File: builtin.yo

package info (click to toggle)
yodl 4.05.02-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,724 kB
  • sloc: ansic: 7,803; perl: 683; cpp: 570; sh: 411; xml: 190; makefile: 163
file content (159 lines) | stat: -rw-r--r-- 6,591 bytes parent folder | download | duplicates (11)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
Functions: `E' indicates that the argument is evaluated and then I: inserted
into the input media, O: inserted into the output media, P: printed
        verb(
- I     ATEXIT  - at the end of the input, the argument is pushed onto the 
                    input for evaluation

- O     CHAR    - the character is inserted into the current output media

- O     COUNTERVALUE - the countervalue is inserted into the output media

E P     ERROR - input is parsed by eval, and then printed

E I     EVAL - the argument is parsed and its output is collected in a string, 
                    which is then inserted into the input.

- O     FILENAME - the current filename is inserted into the output media.

E P     FPUTS - the 1st argument is parsed by eval and then appended to the
                    file given as its second arg.

- I     IFBUILTIN - the argument matching the condition is pushed onto the
                    input. All other if-builtins are handled similarly

- I     INCLUDEFILE - the parsing of the current file is suspended, and 
                    parsing switches to the new file. Once completed, parsing 
                    continues at the suspended file. Begin and End of file are
                    separators.

        INCLUDELIT = INCLUDENOEXPAND

- O     NOEXPAND - the argument is scanned, and only CHAR() calls are
                    interpreted. The produced characters are inserted into the
                    output media.

- O     NOEXPANDINCLUDE - combination of NOEXPAND() and INCLUDEFILE(): the
                    file is inserted into the output media, honoring CHAR() 
                    calls. If that's not appropriate push an empty character
                    table before doing NOEXPANDINCLUDE()

- O     NOEXPANDPATHINCLUDE - like NOEXPANDINCLUDE(), but the Yodl insert path 
                    is followed to find the indicated file.

- O     NOTRANS - the currently active character table is suppressed, and the
                    argument is inserted literally into the output media.

- O     OUTBASE - the basename (filename) of the currently parsed input file
                    is inserted into the output stream. Other out* builtins
                    are handled similarly.

- I     PIPETHROUGH - the output of a process is inserted into the input
                media. 

- I     SYMBOLVALUE - the value of the symbol is inserted into the input
                media. 

E P     TYPEOUT - the argument is evaluated and sent to the standard error
                stream.

E O     UPPERCASE - the argument is evaluated, then transformed to uppercase 
                and subsequently inserted into the output media.

- O     USECOUNTER - the incremented countervalue is inserted into the output
                media.

E P     WARNING like TYPEOUT.

        WRITEOUT = FPUTS
    )

    Functions reinserting information into the input media:
        verb(
- I     ATEXIT  - at the end of the input, the argument is pushed onto the 
                    input for evaluation

E I     EVAL - the argument is parsed and its output is collected in a string, 
                    which is then inserted into the input.

- I     IFBUILTIN - the argument matching the condition is pushed onto the
                    input. All other if-builtins are handled similarly

- I     INCLUDEFILE - the parsing of the current file is suspended, and 
                    parsing switches to the new file. Once completed, parsing 
                    continues at the suspended file. Begin and End of file are
                    separators.

- I     PIPETHROUGH - the output of a process is inserted into the input
                media. 

- I     SYMBOLVALUE - the value of the symbol is inserted into the input
                media. 
        )

    Functions directly inserting into the output media:
        verb(
- O     CHAR    - the character is inserted into the current output media

- O     COUNTERVALUE - the countervalue is inserted into the output media

- O     FILENAME - the current filename is inserted into the output media.

- O     NOEXPAND - the argument is scanned, and only CHAR() calls are
                    interpreted. The produced characters are inserted into the
                    output media.

- O     NOEXPANDINCLUDE - combination of NOEXPAND() and INCLUDEFILE(): the
                    file is inserted into the output media, honoring CHAR() 
                    calls. If that's not appropriate push an empty character
                    table before doing NOEXPANDINCLUDE()

- O     NOEXPANDPATHINCLUDE - like NOEXPANDINCLUDE(), but the Yodl insert path 
                    is followed to find the indicated file.

- O     NOTRANS - the currently active character table is suppressed, and the
                    argument is inserted literally into the output media.

- O     OUTBASE - the basename (filename) of the currently parsed input file
                    is inserted into the output stream. Other out* builtins
                    are handled similarly.

E O     UPPERCASE - the argument is evaluated, then transformed to uppercase 
                and subsequently inserted into the output media.

- O     USECOUNTER - the incremented countervalue is inserted into the output
                media.
        )

    When information is inserted into the output media, the output media
selector may target the output stream or a string: which one will be used
depends on the builtin: E.g, tt(EVAL()) (and tt(parser_eval()), which is
called by it) writes to a string, the default output target is a stream.

    Independently of the output target, character tables may be
used. Chartables may be suppressed, by tt(CHAR()) and tt(NOTRANS()), or simply
not required. Depending on the situation, the input selector will use or not
use character tables.

    As an example: assume the following macros are defined:
        verb(
    A() -> NOTRANS(<)
    B() -> NOTRANS(>)
    C() -> NOTRANS(/>)
    D() -> A()strong+B()hi+A()strong+C()
        )
    the call tt(D()) will be handled as follows (each line represents a
string-push ending in EOF which is interpreted as a separator:
        verb(
    D() -> A()strong+B()hi+A()strong+C()
           NOTRANS(<)<EOR>strong+B()hi+A()strong+C()
output: <            
                          strong+B()hi+A()strong+C()
output: strong
                                 B()hi+A()strong+C()
                                 NOTRANS(>)<EOR>hi+A()strong+C()
output: >
                                                hi+A()strong+C()
output: hi

(etc)
        )