File: makeerror.rexx

package info (click to toggle)
regina 3.3-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 4,928 kB
  • ctags: 7,233
  • sloc: ansic: 50,555; sh: 2,727; lex: 2,298; yacc: 1,498; makefile: 1,010; cpp: 117
file content (41 lines) | stat: -rw-r--r-- 1,033 bytes parent folder | download | duplicates (9)
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
/*
 * This program reads the en.mts file and inserts the entries into error.c
 */
fn = 'en.mts'
en. = ''
idx = 0
Do While Lines( fn ) > 0
   line = Linein( fn )
   If Strip( line ) = '' | Left( line, 1 ) = '#' Then Iterate
   Parse Var line err ',' suberr ',' text
   If Datatype( err ) \= 'NUM' | DataType( suberr ) \= 'NUM' Then Call Abort fn, lineno, 'Invalid line format'
   idx = idx + 1
   en.idx = '   {' Right(err,3)','Right(suberr,3)',"'Changestr('"', text, '\"' )'" },'
End
en.0 = idx

fn = 'error.c'
Call Stream 'error.c', 'C', 'OPEN READ'
idx = 0
Do While Lines( fn ) > 0
   idx = idx + 1
   error.idx = Linein( fn )
End
error.0 = idx
Call Stream 'error.c', 'C', 'CLOSE'

Call Stream fn, 'C', 'OPEN WRITE REPLACE'
Do i = 1 To error.0
   If error.i = '/* PLACEMARKER */' Then
      Do j = 1 To en.0
         Call Lineout fn,en.j
      End
   Else Call Lineout fn,error.i
End
Call Stream 'error.c', 'C', 'CLOSE'
Return 0

Abort: Procedure
Parse Arg fn, lineno, msg
Say 'Error processing' fn 'at line:' lineno':' msg
Exit 1