4 REM Convert message files to an AOF format
6 REM © 1995-1998 Straylight
9 REM ----- Licensing note ----------------------------------------------------
11 REM This file is part of Straylight's core utilities (coreutils)
13 REM Coreutils is free software; you can redistribute it and/or modify
14 REM it under the terms of the GNU General Public License as published by
15 REM the Free Software Foundation; either version 2, or (at your option)
18 REM Coreutils is distributed in the hope that it will be useful,
19 REM but WITHOUT ANY WARRANTY; without even the implied warranty of
20 REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 REM GNU General Public License for more details.
23 REM You should have received a copy of the GNU General Public License
24 REM along with Coreutils. If not, write to the Free Software Foundation,
25 REM 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27 ON ERROR ERROR EXT 0,REPORT$+" ["+STR$(ERL)+"]"
30 SYS "OS_GetEnv" TO comm$
31 IF INSTR(comm$,"-quit")=0 THEN ERROR 1,"msgAOF must be started using *Run"
32 comm$=MID$(comm$,INSTR(comm$,"""")+1)
33 comm$=MID$(comm$,INSTR(comm$," ")+1)
34 comm$=LEFT$(comm$,INSTR(comm$,"""")-1)
40 IF file$="" OR out$="" THEN ERROR 0,"Syntax: msgAOF <in> <out> [<header>]"
44 BPUT #hdr%,"; Message symbols [generated by msgAOF]"
47 BPUT #hdr%,CHR$(9)+CHR$(9)+"["+CHR$(9)+":LNOT::DEF:msg__dfn"
48 BPUT #hdr%,CHR$(9)+CHR$(9)+"GBLL"+CHR$(9)+"msg__dfn"
58 ON ERROR CLOSE #in%:IF hdr% THEN CLOSE #hdr%:IF0ELSE:ERROR EXT 0,REPORT$+" ["+STR$(ERL)+"]"
60 PROCbas_aofInit(64*1024)
65 FNarea("Resources$$Data","CODE,READONLY")
70 line$=FNstrip(GET$#in%)
72 CASE LEFT$(line$,1) OF
74 REM Ignore comment lines
78 CLOSE #in%:IF hdr% THEN CLOSE #hdr%:IF0ELSE:ERROR 0,"Bad message line"
80 tag$=FNstrip(LEFT$(line$,col%-1))
81 msg$=FNstrip(MID$(line$,col%+1))
86 .syntax ;Just make sure of this
89 msg$=FNstrip(GET$#in%)
98 IF RIGHT$(msg$,1)="\" THEN
100 dcb FNgsTrans(LEFT$(msg$,LEN(msg$)-1))
112 FNdoExport("help","help_"+tag$)
113 FNdoExport("syntax","synt_"+tag$)
118 err%=EVAL(LEFT$(msg$,col%-1))
119 msg$=FNstrip(MID$(msg$,col%+1))
127 FNdoExport("label","msg_"+tag$)
135 FNdoExport("label","msg_"+tag$)
146 BPUT #hdr%,CHR$(9)+CHR$(9)+"]"
148 BPUT #hdr%,CHR$(9)+CHR$(9)+"END"
150 SYS "OS_File",1,header$,&FFFFFF3A,&BD896000,,3
152 ON ERROR ERROR EXT 0,REPORT$+" ["+STR$(ERL)+"]"
153 PROCbas_aofSaveAs(out$)
156 DEF FNdoExport(alias$,name$)
157 IF FNexportAs(alias$,name$)
158 IF hdr%<>0 AND o=6 THEN BPUT #hdr%,CHR$(9)+CHR$(9)+"IMPORT"+CHR$(9)+name$
161 DEF FNword(RETURN line$)
163 IF INSTR(line$," ") THEN
164 word$=LEFT$(line$,INSTR(line$," ")-1)
165 line$=MID$(line$,INSTR(line$," ")+1)
175 IF LEFT$(line$,1)=" " THEN
179 x$+=STRING$(s%," ")+LEFT$(line$,1)
193 FOR i%=0 TO LEN(line$)-1
194 IF q%?i%>=97 AND q%?i%<=122 THEN q%?i%-=32
200 SYS "OS_GSTrans",s$,q%,256 TO ,,len%