File: tld2c.rex

package info (click to toggle)
the 3.1-2
  • links: PTS
  • area: main
  • in suites: woody
  • size: 4,452 kB
  • ctags: 5,268
  • sloc: ansic: 63,118; sh: 2,399; makefile: 444
file content (30 lines) | stat: -rw-r--r-- 758 bytes parent folder | download | duplicates (8)
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
/*
 * This Rexx program converts a TLD file into the suitable C code to be
 * included in default.c
 * First argument is the name of the parser; eg SNOBOL
 * Second argument is filename
 */
trace o
Parse Arg lang fn
If fn = '' Then
   Do
      Say 'No filename specified'
      Exit 1
   End
Say '      { (CHARTYPE *)"*'Translate(lang)'.TLD",'
Say '        (CHARTYPE *)"'Translate(lang)'",'
code = '        (CHARTYPE *)"* 'Translate(lang)
Do While Lines(fn) > 0
   line = Strip(Linein(fn))
   If Substr(line,1,1) = '*' | Length(line) = 0 Then Iterate
   If Substr(line,1,1) = ':' Then
     Do
       Say code || '" \'
       code = Copies(' ',12) || '"'line'\n'
     End
   Else
     code = code || line || '\n'
End
Say code || '\n"'
Say '      },'
Return 0