| 1 |
/* |
| 2 |
* This program reads the en.mts file and inserts the entries into error.c |
| 3 |
*/ |
| 4 |
fn = 'en.mts' |
| 5 |
en. = '' |
| 6 |
idx = 0 |
| 7 |
Do While Lines( fn ) > 0 |
| 8 |
line = Linein( fn ) |
| 9 |
If Strip( line ) = '' | Left( line, 1 ) = '#' Then Iterate |
| 10 |
Parse Var line err ',' suberr ',' text |
| 11 |
If Datatype( err ) \= 'NUM' | DataType( suberr ) \= 'NUM' Then Call Abort fn, lineno, 'Invalid line format' |
| 12 |
idx = idx + 1 |
| 13 |
en.idx = ' {' Right(err,3)','Right(suberr,3)',"'Changestr('"', text, '\"' )'" },' |
| 14 |
End |
| 15 |
en.0 = idx |
| 16 |
|
| 17 |
fn = 'error.c' |
| 18 |
Call Stream 'error.c', 'C', 'OPEN READ' |
| 19 |
idx = 0 |
| 20 |
Do While Lines( fn ) > 0 |
| 21 |
idx = idx + 1 |
| 22 |
error.idx = Linein( fn ) |
| 23 |
End |
| 24 |
error.0 = idx |
| 25 |
Call Stream 'error.c', 'C', 'CLOSE' |
| 26 |
|
| 27 |
Call Stream fn, 'C', 'OPEN WRITE REPLACE' |
| 28 |
Do i = 1 To error.0 |
| 29 |
If error.i = '/* PLACEMARKER */' Then |
| 30 |
Do j = 1 To en.0 |
| 31 |
Call Lineout fn,en.j |
| 32 |
End |
| 33 |
Else Call Lineout fn,error.i |
| 34 |
End |
| 35 |
Call Stream 'error.c', 'C', 'CLOSE' |
| 36 |
Return 0 |
| 37 |
|
| 38 |
Abort: Procedure |
| 39 |
Parse Arg fn, lineno, msg |
| 40 |
Say 'Error processing' fn 'at line:' lineno':' msg |
| 41 |
Exit 1 |