Skip to content

Commit c582e17

Browse files
committed
Added gsl.escape and gsl.substitute attributes
- to modify escape char from \ - to modify substitute sequence from $( - only affects scripts loaded after this is changed - use -escape:x and/or -substitute:xx from command line - see testesc.gsl Added 'code' and 'headers' targets into Makefile - lets us regenerate all GXL code - lets us rebuild the gsl.h file, since we don't use Boom any more
1 parent 19fa095 commit c582e17

File tree

18 files changed

+652
-220
lines changed

18 files changed

+652
-220
lines changed

README.md

Lines changed: 78 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -56,36 +56,38 @@
5656
&emsp;<a href="#toc4-1217">Shuffle</a>
5757
&emsp;<a href="#toc4-1248">COBOL</a>
5858
&emsp;<a href="#toc4-1253">Line Terminators</a>
59-
&emsp;<a href="#toc4-1258">Arguments</a>
60-
&emsp;<a href="#toc4-1274">Predefined Identifiers</a>
61-
&emsp;<a href="#toc3-1300">Built-In Functions</a>
62-
&emsp;<a href="#toc4-1319">Global Functions</a>
63-
&emsp;<a href="#toc4-1361">conv</a>
64-
&emsp;<a href="#toc4-1366">diag</a>
65-
&emsp;<a href="#toc4-1371">environment</a>
66-
&emsp;<a href="#toc4-1376">fileio</a>
67-
&emsp;<a href="#toc4-1405">Directory Iteration</a>
68-
&emsp;<a href="#toc4-1471">gsl control</a>
69-
&emsp;<a href="#toc4-1485">math</a>
70-
&emsp;<a href="#toc4-1514">regexp</a>
71-
&emsp;<a href="#toc4-1520">process management</a>
72-
&emsp;<a href="#toc4-1525">script</a>
73-
&emsp;<a href="#toc4-1530">socket</a>
74-
&emsp;<a href="#toc4-1543">string</a>
75-
&emsp;<a href="#toc4-1568">symb</a>
76-
&emsp;<a href="#toc4-1573">thread</a>
77-
&emsp;<a href="#toc4-1610">time</a>
78-
&emsp;<a href="#toc4-1625">XML</a>
79-
&emsp;<a href="#toc3-1673">Script Commands</a>
80-
&emsp;<a href="#toc4-1676">Output File Manipulation</a>
81-
&emsp;<a href="#toc4-1721">Control Structures</a>
82-
&emsp;<a href="#toc4-1832">Scope Manipulation</a>
83-
&emsp;<a href="#toc4-1847">Symbol Definition</a>
84-
&emsp;<a href="#toc4-1878">Structured Data Manipulation</a>
85-
&emsp;<a href="#toc4-1956">Script Manipulation</a>
86-
&emsp;<a href="#toc4-1986">Macros and Functions</a>
87-
&emsp;<a href="#toc4-2051">Miscellaneous</a>
88-
&emsp;<a href="#toc4-2066">Examples</a>
59+
&emsp;<a href="#toc4-1258">Escape Symbol</a>
60+
&emsp;<a href="#toc4-1265">Substitute Symbol</a>
61+
&emsp;<a href="#toc4-1274">Arguments</a>
62+
&emsp;<a href="#toc4-1290">Predefined Identifiers</a>
63+
&emsp;<a href="#toc3-1316">Built-In Functions</a>
64+
&emsp;<a href="#toc4-1335">Global Functions</a>
65+
&emsp;<a href="#toc4-1377">conv</a>
66+
&emsp;<a href="#toc4-1382">diag</a>
67+
&emsp;<a href="#toc4-1387">environment</a>
68+
&emsp;<a href="#toc4-1392">fileio</a>
69+
&emsp;<a href="#toc4-1421">Directory Iteration</a>
70+
&emsp;<a href="#toc4-1487">gsl control</a>
71+
&emsp;<a href="#toc4-1501">math</a>
72+
&emsp;<a href="#toc4-1530">regexp</a>
73+
&emsp;<a href="#toc4-1536">process management</a>
74+
&emsp;<a href="#toc4-1541">script</a>
75+
&emsp;<a href="#toc4-1546">socket</a>
76+
&emsp;<a href="#toc4-1559">string</a>
77+
&emsp;<a href="#toc4-1584">symb</a>
78+
&emsp;<a href="#toc4-1589">thread</a>
79+
&emsp;<a href="#toc4-1626">time</a>
80+
&emsp;<a href="#toc4-1641">XML</a>
81+
&emsp;<a href="#toc3-1689">Script Commands</a>
82+
&emsp;<a href="#toc4-1692">Output File Manipulation</a>
83+
&emsp;<a href="#toc4-1737">Control Structures</a>
84+
&emsp;<a href="#toc4-1848">Scope Manipulation</a>
85+
&emsp;<a href="#toc4-1863">Symbol Definition</a>
86+
&emsp;<a href="#toc4-1894">Structured Data Manipulation</a>
87+
&emsp;<a href="#toc4-1972">Script Manipulation</a>
88+
&emsp;<a href="#toc4-2002">Macros and Functions</a>
89+
&emsp;<a href="#toc4-2067">Miscellaneous</a>
90+
&emsp;<a href="#toc4-2082">Examples</a>
8991

9092
<A name="toc2-10" title="Overview" />
9193
## Overview
@@ -1317,7 +1319,23 @@ GSL helps you make neat COBOL code by automatically filling the first six charac
13171319

13181320
GSL uses as its line terminator the value of of the attribute `terminator` of the gsl scope. The default value is "\n" but it could also be set to "\r\n", for example.
13191321

1320-
<A name="toc4-1258" title="Arguments" />
1322+
<A name="toc4-1258" title="Escape Symbol" />
1323+
#### Escape Symbol
1324+
1325+
GSL uses the backslash "\" as its default escape symbol, mainly due to its POSIX / C roots. This can be very annoying in templates that have a lot of backslashes. You can override the escape symbol by changing the [gsl].escape attribute, or using the -escape:X command-line switch.
1326+
1327+
Note that this takes effect for the next script loaded, so you cannot use this in a script to modify how that script itself is processed. You can use it before e.g. including a script.
1328+
1329+
<A name="toc4-1265" title="Substitute Symbol" />
1330+
#### Substitute Symbol
1331+
1332+
GSL uses the string "$(" to open a substitution sequence. You can use any string instead, by changing the [gsl].substitute attribute, or using the -substitute:X command-line switch.
1333+
1334+
Note that this takes effect for the next script loaded, so you cannot use this in a script to modify how that script itself is processed. You can use it before e.g. including a script.
1335+
1336+
Note also that the closing symbol is always ")" and you cannot override this.
1337+
1338+
<A name="toc4-1274" title="Arguments" />
13211339
#### Arguments
13221340

13231341
If GSL is invoked with a `-a` switch, all arguments following the first are treated as arguments to the first script, rather than as further arguments to GSL, as would otherwise be the case. So if you type:
@@ -1333,7 +1351,7 @@ or in a loop:
13331351
n = 1
13341352
echo switches.arg$(n)
13351353

1336-
<A name="toc4-1274" title="Predefined Identifiers" />
1354+
<A name="toc4-1290" title="Predefined Identifiers" />
13371355
#### Predefined Identifiers
13381356

13391357
There are some identifiers whose value is maintained by GSL in the global space referred to by the predefined scopes `gsl` and `global`. They are defined as attributes of the global item.
@@ -1359,7 +1377,7 @@ version
13591377
switches
13601378
: A symbol table holding all the command-line switches present when GSL was invoked.
13611379

1362-
<A name="toc3-1300" title="Built-In Functions" />
1380+
<A name="toc3-1316" title="Built-In Functions" />
13631381
### Built-In Functions
13641382

13651383
GSL provides many built-in functions and uses `modules` to group related functions.
@@ -1382,7 +1400,7 @@ Some functions accept an optional parameter, listed as `error`. If the parameter
13821400
abort "E: cannot open directory: " + error_text
13831401
endif
13841402

1385-
<A name="toc4-1319" title="Global Functions" />
1403+
<A name="toc4-1335" title="Global Functions" />
13861404
#### Global Functions
13871405

13881406
alias (item)
@@ -1424,7 +1442,7 @@ Some functions accept an optional parameter, listed as `error`. If the parameter
14241442
which ()
14251443
To be explained.
14261444
1427-
<A name="toc4-1361" title="conv" />
1445+
<A name="toc4-1377" title="conv" />
14281446
#### conv
14291447

14301448
MODULE: GSL/conv package
@@ -1453,7 +1471,7 @@ MODULE: GSL/conv package
14531471

14541472

14551473

1456-
<A name="toc4-1366" title="diag" />
1474+
<A name="toc4-1382" title="diag" />
14571475
#### diag
14581476

14591477
MODULE: GSL/diag package
@@ -1494,7 +1512,7 @@ MODULE: GSL/diag package
14941512

14951513

14961514

1497-
<A name="toc4-1371" title="environment" />
1515+
<A name="toc4-1387" title="environment" />
14981516
#### environment
14991517

15001518
MODULE: GSL/environment package
@@ -1510,7 +1528,7 @@ MODULE: GSL/environment package
15101528

15111529

15121530

1513-
<A name="toc4-1376" title="fileio" />
1531+
<A name="toc4-1392" title="fileio" />
15141532
#### fileio
15151533

15161534
GSL provides three modules for dealing with directories and files; one directory module and two file modules, one for working with independent files and the second for working with files during a directory traversal. We will discuss the second set after the first because it will make more sense that way.
@@ -1539,7 +1557,7 @@ The offset changes to reflect any read or write operations on the file. This is
15391557

15401558
The final set of file functions manipulate files, file names and file metadata.
15411559

1542-
<A name="toc4-1405" title="Directory Iteration" />
1560+
<A name="toc4-1421" title="Directory Iteration" />
15431561
#### Directory Iteration
15441562

15451563
As mentioned, previously, directories can be opened with the `directory.open` function, which returns a 'directory entry' object.
@@ -1805,7 +1823,7 @@ MODULE: GSL/fileio package
18051823

18061824

18071825

1808-
<A name="toc4-1471" title="gsl control" />
1826+
<A name="toc4-1487" title="gsl control" />
18091827
#### gsl control
18101828

18111829
Class: GSL Control Class
@@ -1819,7 +1837,7 @@ MODULE: GSL/fileio package
18191837
its output is returned as the result of this function. Uses the
18201838
current template mode unless over-ridden by the optional argument.
18211839

1822-
<A name="toc4-1485" title="math" />
1840+
<A name="toc4-1501" title="math" />
18231841
#### math
18241842

18251843
Class: Math Functions
@@ -1848,13 +1866,13 @@ MODULE: GSL/fileio package
18481866
Function: math . acosh (parm)
18491867
Function: math . atanh (parm)
18501868

1851-
<A name="toc4-1514" title="regexp" />
1869+
<A name="toc4-1530" title="regexp" />
18521870
#### regexp
18531871

18541872
Class: Regular Expression Functions
18551873
Function: regexp . match (pattern,subject,[match])
18561874

1857-
<A name="toc4-1520" title="process management" />
1875+
<A name="toc4-1536" title="process management" />
18581876
#### process management
18591877

18601878
MODULE: GSL/process management
@@ -1897,12 +1915,12 @@ package
18971915

18981916

18991917

1900-
<A name="toc4-1525" title="script" />
1918+
<A name="toc4-1541" title="script" />
19011919
#### script
19021920

19031921
Class: GSL Script Line
19041922

1905-
<A name="toc4-1530" title="socket" />
1923+
<A name="toc4-1546" title="socket" />
19061924
#### socket
19071925

19081926
Class: Socket
@@ -1915,7 +1933,7 @@ package
19151933
Function: <sock handle> . read (buffer,[minimum],[timeout],[error])
19161934
Function: <sock handle> . write (buffer,[timeout],[error])
19171935

1918-
<A name="toc4-1543" title="string" />
1936+
<A name="toc4-1559" title="string" />
19191937
#### string
19201938

19211939
Class: String Functions
@@ -1940,12 +1958,12 @@ package
19401958
Function: string . soundex (string)
19411959
Function: string . cntch (string,value)
19421960

1943-
<A name="toc4-1568" title="symb" />
1961+
<A name="toc4-1584" title="symb" />
19441962
#### symb
19451963

19461964
Class: Symbol
19471965

1948-
<A name="toc4-1573" title="thread" />
1966+
<A name="toc4-1589" title="thread" />
19491967
#### thread
19501968

19511969
Class: Thread
@@ -1982,7 +2000,7 @@ package
19822000
Class: Thread
19832001
Function: <parsed item> . run ([error])
19842002

1985-
<A name="toc4-1610" title="time" />
2003+
<A name="toc4-1626" title="time" />
19862004
#### time
19872005

19882006
Class: Time Functions
@@ -1997,7 +2015,7 @@ package
19972015
Function: date . picture ([date],[picture])
19982016
Function: date . number (date)
19992017

2000-
<A name="toc4-1625" title="XML" />
2018+
<A name="toc4-1641" title="XML" />
20012019
#### XML
20022020

20032021
Class: XML
@@ -2045,10 +2063,10 @@ package
20452063

20462064
Class: XML value
20472065

2048-
<A name="toc3-1673" title="Script Commands" />
2066+
<A name="toc3-1689" title="Script Commands" />
20492067
### Script Commands
20502068

2051-
<A name="toc4-1676" title="Output File Manipulation" />
2069+
<A name="toc4-1692" title="Output File Manipulation" />
20522070
#### Output File Manipulation
20532071

20542072
**.output**
@@ -2093,7 +2111,7 @@ Examples:
20932111
things like $(abc).
20942112
.endliteral
20952113

2096-
<A name="toc4-1721" title="Control Structures" />
2114+
<A name="toc4-1737" title="Control Structures" />
20972115
#### Control Structures
20982116

20992117
**.for**
@@ -2204,7 +2222,7 @@ Inside a `for` or `while` loop causes immediate iteration, skipping execution of
22042222

22052223
Inside a `for` or `while` loop causes the loop to terminate iteration immediately. Control passes to the line following the `endfor` or `endwhile` statement. If the scope is specified then the `for` loop corresponding to that scope is terminated.
22062224

2207-
<A name="toc4-1832" title="Scope Manipulation" />
2225+
<A name="toc4-1848" title="Scope Manipulation" />
22082226
#### Scope Manipulation
22092227

22102228
**.scope**
@@ -2219,7 +2237,7 @@ Opens a new scope corresponding to the specified data.
22192237

22202238
Terminates a block opened with a .scope command, closing the scope. The scope name is optional and does not affect the operation. GSL confirms that its value is the name of the scope to be closed and reports an error if this is not the case. In this way, GSL can be made to validate nested .scope blocks for you.
22212239

2222-
<A name="toc4-1847" title="Symbol Definition" />
2240+
<A name="toc4-1863" title="Symbol Definition" />
22232241
#### Symbol Definition
22242242

22252243
.<data-specifier> [<operator>]= [ <expr> ]
@@ -2250,7 +2268,7 @@ Multiplies the value of the identifier x by 2.
22502268

22512269
Does nothing if x is already defined; otherwise assigns it the value of y, or if y is undefined then the value of z, or if z is undefined, x remains undefined.
22522270

2253-
<A name="toc4-1878" title="Structured Data Manipulation" />
2271+
<A name="toc4-1894" title="Structured Data Manipulation" />
22542272
#### Structured Data Manipulation
22552273

22562274
**.new**
@@ -2328,7 +2346,7 @@ Examples:
23282346

23292347
Sorts the specified items. A scope is created with each item in turn and is used to evaluate the expression. The result is then used to sort the items. The `as` clause allows you to give the created scope a different name. After execution, the specified items are in order and after any other children of the same parent.
23302348

2331-
<A name="toc4-1956" title="Script Manipulation" />
2349+
<A name="toc4-1972" title="Script Manipulation" />
23322350
#### Script Manipulation
23332351

23342352
**.include**
@@ -2358,7 +2376,7 @@ Turns template mode on or off.
23582376

23592377
Terminates the block introduced by a `template` instruction.
23602378

2361-
<A name="toc4-1986" title="Macros and Functions" />
2379+
<A name="toc4-2002" title="Macros and Functions" />
23622380
#### Macros and Functions
23632381

23642382
Macros and functions are pieces of GSL which can be invoked with parameters. The only difference between a macro and as function is that macros are interpreted in template mode and functions in script mode.
@@ -2423,7 +2441,7 @@ Examples:
24232441
.$(my.dest) = my.source
24242442
.endfunction
24252443

2426-
<A name="toc4-2051" title="Miscellaneous" />
2444+
<A name="toc4-2067" title="Miscellaneous" />
24272445
#### Miscellaneous
24282446

24292447
**.echo**
@@ -2438,7 +2456,7 @@ Outputs the given expression to the standard output.
24382456

24392457
Outputs the given expression to the standard output and halts GSL operation.
24402458

2441-
<A name="toc4-2066" title="Examples" />
2459+
<A name="toc4-2082" title="Examples" />
24422460
#### Examples
24432461

24442462
See examples in Examples directory

README.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1222,6 +1222,20 @@ GSL helps you make neat COBOL code by automatically filling the first six charac
12221222

12231223
GSL uses as its line terminator the value of of the attribute `terminator` of the gsl scope. The default value is "\n" but it could also be set to "\r\n", for example.
12241224

1225+
#### Escape Symbol
1226+
1227+
GSL uses the backslash "\" as its default escape symbol, mainly due to its POSIX / C roots. This can be very annoying in templates that have a lot of backslashes. You can override the escape symbol by changing the [gsl].escape attribute, or using the -escape:X command-line switch.
1228+
1229+
Note that this takes effect for the next script loaded, so you cannot use this in a script to modify how that script itself is processed. You can use it before e.g. including a script.
1230+
1231+
#### Substitute Symbol
1232+
1233+
GSL uses the string "$(" to open a substitution sequence. You can use any string instead, by changing the [gsl].substitute attribute, or using the -substitute:X command-line switch.
1234+
1235+
Note that this takes effect for the next script loaded, so you cannot use this in a script to modify how that script itself is processed. You can use it before e.g. including a script.
1236+
1237+
Note also that the closing symbol is always ")" and you cannot override this.
1238+
12251239
#### Arguments
12261240

12271241
If GSL is invoked with a `-a` switch, all arguments following the first are treated as arguments to the first script, rather than as further arguments to GSL, as would otherwise be the case. So if you type:

images/README_1.png

0 Bytes
Loading

0 commit comments

Comments
 (0)