OpenBSD CVS

CVS log for src/usr.bin/mg/interpreter.c


[BACK] Up to [local] / src / usr.bin / mg

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.35 / (download) - annotate - [select for diffs], Mon Apr 17 10:11:30 2023 UTC (13 months ago) by op
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, OPENBSD_7_4_BASE, OPENBSD_7_4, HEAD
Changes since 1.34: +2 -2 lines
Diff to previous 1.34 (colored)

fix a few dobeep_msgs() calls: a space is already added between the arguments

ok tb@

Revision 1.34 / (download) - annotate - [select for diffs], Fri Jan 28 06:18:41 2022 UTC (2 years, 3 months ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_7_3_BASE, OPENBSD_7_3, OPENBSD_7_2_BASE, OPENBSD_7_2, OPENBSD_7_1_BASE, OPENBSD_7_1
Changes since 1.33: +2 -2 lines
Diff to previous 1.33 (colored)

When it's the possessive of 'it', it's spelled "its", without the
apostrophe.

Revision 1.33 / (download) - annotate - [select for diffs], Thu Jan 20 14:07:34 2022 UTC (2 years, 3 months ago) by naddy
Branch: MAIN
Changes since 1.32: +5 -7 lines
Diff to previous 1.32 (colored)

mg: fix -Wunused-but-set-variable warnings

strtonum() is only called to verify that a string is numerical, the
return value is unused.
inlist is no longer used after the code was refactored.

ok millert@ guenther@

Revision 1.32 / (download) - annotate - [select for diffs], Wed May 12 11:13:23 2021 UTC (3 years ago) by lum
Branch: MAIN
CVS Tags: OPENBSD_7_0_BASE, OPENBSD_7_0
Changes since 1.31: +13 -7 lines
Diff to previous 1.31 (colored)

Count the number of arguments in each expression as we initially go
through the expression. To be used in checking function parameter
profiles later.

Revision 1.31 / (download) - annotate - [select for diffs], Sat May 8 12:57:41 2021 UTC (3 years ago) by lum
Branch: MAIN
Changes since 1.30: +11 -14 lines
Diff to previous 1.30 (colored)

Perhaps the syntax '((' and '()' will be valid one day, but not at the
moment.  This diff works the two checks for them into the main for
parsing loop.

Revision 1.30 / (download) - annotate - [select for diffs], Sat May 8 09:27:35 2021 UTC (3 years ago) by lum
Branch: MAIN
Changes since 1.29: +3 -2 lines
Diff to previous 1.29 (colored)

stop parsing if a digit is found as first character of an expression.

Revision 1.29 / (download) - annotate - [select for diffs], Fri May 7 08:29:30 2021 UTC (3 years ago) by lum
Branch: MAIN
Changes since 1.28: +6 -2 lines
Diff to previous 1.28 (colored)

Give an error if quoted string is found as first non-white char after
'('.

Revision 1.28 / (download) - annotate - [select for diffs], Fri May 7 07:42:20 2021 UTC (3 years ago) by lum
Branch: MAIN
Changes since 1.27: +44 -28 lines
Diff to previous 1.27 (colored)

Take a note of expression length when it is extracted from line
submitted to excline().

Revision 1.27 / (download) - annotate - [select for diffs], Thu May 6 14:16:12 2021 UTC (3 years ago) by lum
Branch: MAIN
Changes since 1.26: +41 -33 lines
Diff to previous 1.26 (colored)

Add the line number of an error to error messages.

Revision 1.26 / (download) - annotate - [select for diffs], Thu May 6 07:16:24 2021 UTC (3 years ago) by lum
Branch: MAIN
Changes since 1.25: +8 -3 lines
Diff to previous 1.25 (colored)

Give parse error if character found between blocks.

Revision 1.25 / (download) - annotate - [select for diffs], Wed May 5 06:12:23 2021 UTC (3 years ago) by lum
Branch: MAIN
Changes since 1.24: +12 -6 lines
Diff to previous 1.24 (colored)

Check the characters preceeding and following quotes.

Revision 1.24 / (download) - annotate - [select for diffs], Mon May 3 13:28:03 2021 UTC (3 years ago) by lum
Branch: MAIN
Changes since 1.23: +37 -33 lines
Diff to previous 1.23 (colored)

When parsing a variable value within double quotes, allow parenthesis
to be accomodated for.

Revision 1.23 / (download) - annotate - [select for diffs], Mon May 3 12:18:43 2021 UTC (3 years ago) by lum
Branch: MAIN
Changes since 1.22: +34 -42 lines
Diff to previous 1.22 (colored)

When parsing a variable value within double quotes, allow an escaped
\" to be accomodated for. Also, move the variable structure to be
global in scope within mg.

Revision 1.22 / (download) - annotate - [select for diffs], Tue Apr 20 16:34:20 2021 UTC (3 years ago) by lum
Branch: MAIN
Changes since 1.21: +4 -1 lines
Diff to previous 1.21 (colored)

Indicate if an mg function is unsuitable for a startup file (requires
user interaction).

Revision 1.21 / (download) - annotate - [select for diffs], Tue Apr 20 14:26:19 2021 UTC (3 years ago) by lum
Branch: MAIN
Changes since 1.20: +491 -208 lines
Diff to previous 1.20 (colored)

Allow more than one block of code to exist on a single line. Also,
move the code which expands variables to be ran when variables are
discovered instead of in multiarg() just before execution. This means
a variable who's value is included in anothers', won't change the
others value if its own is changed.

I have also included code, which is commented out at the moment, which
implements a function map specific to interpreter. Not sure if I can
ultimately avoid using it though.

Revision 1.20 / (download) - annotate - [select for diffs], Fri Mar 26 12:31:37 2021 UTC (3 years, 1 month ago) by lum
Branch: MAIN
CVS Tags: OPENBSD_6_9_BASE, OPENBSD_6_9
Changes since 1.19: +32 -6 lines
Diff to previous 1.19 (colored)

Add 'get-environment-variable', in a fashion:

(define curdir(get-environment-variable CURDIR))
(insert curdir)

Should now print the value of the environment variable CURDIR's value,
or error if it is not set.

Revision 1.19 / (download) - annotate - [select for diffs], Fri Mar 26 08:27:49 2021 UTC (3 years, 1 month ago) by lum
Branch: MAIN
Changes since 1.18: +14 -13 lines
Diff to previous 1.18 (colored)

Change the regex for define names. Make more characters available.
Keep the same regex for mg function names. Though perhaps for
user-defined functions other characters could be ok....

Revision 1.18 / (download) - annotate - [select for diffs], Fri Mar 26 07:25:23 2021 UTC (3 years, 1 month ago) by lum
Branch: MAIN
Changes since 1.17: +11 -23 lines
Diff to previous 1.17 (colored)

Change two more bool counters to pointer NULL checks.

Revision 1.17 / (download) - annotate - [select for diffs], Thu Mar 25 20:25:31 2021 UTC (3 years, 1 month ago) by lum
Branch: MAIN
Changes since 1.16: +60 -35 lines
Diff to previous 1.16 (colored)

Move the expression list create item code into a single function.

Revision 1.16 / (download) - annotate - [select for diffs], Thu Mar 25 17:31:21 2021 UTC (3 years, 1 month ago) by lum
Branch: MAIN
Changes since 1.15: +20 -1 lines
Diff to previous 1.15 (colored)

Add an (exit) method.

Revision 1.15 / (download) - annotate - [select for diffs], Thu Mar 25 16:58:46 2021 UTC (3 years, 1 month ago) by lum
Branch: MAIN
Changes since 1.14: +11 -11 lines
Diff to previous 1.14 (colored)

User a pointer's value (!NULL) instead of a boolean to indicate some
kind of data being found.

Revision 1.14 / (download) - annotate - [select for diffs], Thu Mar 25 12:46:11 2021 UTC (3 years, 1 month ago) by lum
Branch: MAIN
Changes since 1.13: +13 -7 lines
Diff to previous 1.13 (colored)

Use length of line to indicate end of characters to process in
foundparen(). No intended functional change. regress tests ok and they
all use excline().

Revision 1.13 / (download) - annotate - [select for diffs], Tue Mar 23 15:22:25 2021 UTC (3 years, 1 month ago) by lum
Branch: MAIN
Changes since 1.12: +12 -3 lines
Diff to previous 1.12 (colored)

Make a parameter to an mg function not throw an error just
because it is numerical.

Revision 1.12 / (download) - annotate - [select for diffs], Mon Mar 22 09:26:23 2021 UTC (3 years, 1 month ago) by lum
Branch: MAIN
Changes since 1.11: +33 -10 lines
Diff to previous 1.11 (colored)

Start the move to TAILQ for expressions instead of an SLIST.

Revision 1.11 / (download) - annotate - [select for diffs], Sun Mar 21 12:56:16 2021 UTC (3 years, 1 month ago) by lum
Branch: MAIN
Changes since 1.10: +90 -41 lines
Diff to previous 1.10 (colored)

Add quoted strings capability in list values, no special chars
detection in between them though.  Add limitation to characters
allowed in symbol names, equivalent to mg function names (A-Za-z-),
quite restrictive but can grow of course. If value is not quoted and
is not a variable, give an error.

Revision 1.10 / (download) - annotate - [select for diffs], Sat Mar 20 19:39:30 2021 UTC (3 years, 1 month ago) by lum
Branch: MAIN
Changes since 1.9: +270 -201 lines
Diff to previous 1.9 (colored)

Looking at loading all expressions initially, working towards multi
line. Next to look at "values" (quotes around values).

Current regress tests pass.

Revision 1.9 / (download) - annotate - [select for diffs], Mon Mar 8 20:01:43 2021 UTC (3 years, 2 months ago) by lum
Branch: MAIN
Changes since 1.8: +26 -5 lines
Diff to previous 1.8 (colored)

Start looking at parsing text to find separators.

Revision 1.8 / (download) - annotate - [select for diffs], Mon Mar 8 18:27:33 2021 UTC (3 years, 2 months ago) by lum
Branch: MAIN
Changes since 1.7: +32 -40 lines
Diff to previous 1.7 (colored)

Put regex tests into a function.

Revision 1.7 / (download) - annotate - [select for diffs], Tue Mar 2 19:50:52 2021 UTC (3 years, 2 months ago) by lum
Branch: MAIN
Changes since 1.6: +24 -24 lines
Diff to previous 1.6 (colored)

It is now possible to define single value variables in the startup file:

(define myfile d.txt)

And use them like:

(find-file myfile)

Revision 1.6 / (download) - annotate - [select for diffs], Wed Feb 24 14:17:18 2021 UTC (3 years, 2 months ago) by lum
Branch: MAIN
Changes since 1.5: +9 -4 lines
Diff to previous 1.5 (colored)

Various fixes from emails Joachim Nilsson sent to tech@ many moons
ago. Sorry for the delay.

- Make sure we don't deref NULL ptr in skipwhite()
- Only deref vendp if not NULL
- Strings must be at least 2 chars for terminating NUL character

Revision 1.5 / (download) - annotate - [select for diffs], Sat Jul 20 11:06:33 2019 UTC (4 years, 10 months ago) by lum
Branch: MAIN
CVS Tags: OPENBSD_6_8_BASE, OPENBSD_6_8, OPENBSD_6_7_BASE, OPENBSD_6_7, OPENBSD_6_6_BASE, OPENBSD_6_6
Changes since 1.4: +2 -1 lines
Diff to previous 1.4 (colored)

Missed a free.

Revision 1.4 / (download) - annotate - [select for diffs], Sat Jul 20 06:00:16 2019 UTC (4 years, 10 months ago) by lum
Branch: MAIN
Changes since 1.3: +5 -5 lines
Diff to previous 1.3 (colored)

Move a bit of code to where it is called only if needed.

Revision 1.3 / (download) - annotate - [select for diffs], Fri Jul 19 16:00:08 2019 UTC (4 years, 10 months ago) by lum
Branch: MAIN
Changes since 1.2: +24 -14 lines
Diff to previous 1.2 (colored)

Previously I left the ')' on the end of a list to indicate the end.
Just to get things working. Best get rid of that nonsense sooner
rather than later.

Revision 1.2 / (download) - annotate - [select for diffs], Thu Jul 18 10:50:24 2019 UTC (4 years, 10 months ago) by lum
Branch: MAIN
Changes since 1.1: +17 -2 lines
Diff to previous 1.1 (colored)

Add logging to interpreter.c

Revision 1.1 / (download) - annotate - [select for diffs], Thu Jul 18 05:57:48 2019 UTC (4 years, 10 months ago) by lum
Branch: MAIN

Add some more basic interpreter functionality to mg. Needs a lot more
work, including a proper parser.

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.