4 REM Build Sapphire extension stub entries
6 REM © 1994-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 REM --- Parse arguments ---
29 ON ERROR ERROR EXT 0,REPORT$+"["+STR$(ERL)+"]"
31 PROCparse(FNreadCommandLine)
40 REM --- Read a command line ---
44 SYS "OS_GetEnv" TO comm$
45 IF INSTR(comm$,"-quit")=0 THEN ERROR 1,"SapphStub must be started using *Run"
46 comm$=MID$(comm$,INSTR(comm$,"""")+1)
47 comm$=MID$(comm$,INSTR(comm$," ")+1)
48 comm$=LEFT$(comm$,INSTR(comm$,"""")-1)
51 REM --- Remove a word from a command line ---
53 DEF FNword(RETURN line$)
55 IF INSTR(line$," ") THEN
56 word$=LEFT$(line$,INSTR(line$," ")-1)
57 line$=MID$(line$,INSTR(line$," ")+1)
64 REM --- Convert a string to upper case ---
69 FOR i%=0 TO LEN(line$)-1
70 IF q%?i%>=97 AND q%?i%<=122 THEN q%?i%-=32
74 REM --- Do the command line parsing ---
77 LOCAL libfn$,stub$,lib$,off%,helped%,word$
80 CASE FNupper(word$) OF
91 off%=VAL(FNword(line$))
106 IF libfn$="" OR lib$="" OR stub$="" THEN ERROR 0,"Bad arguments"
107 PROCbuild(lib$,stub$,libfn$,off%)
110 DEF PROCbuild(lib$,stub$,libfn$,off%)
112 REM --- Build library section ---
116 PROCbas_aofInit(&1000)
121 FNimportAs("Sapphire$$LibData$$Base","sapph_base")
122 FNimportAs("Sapphire$$LibData$$Limit","sapph_limit")
124 FNarea("!Stub$$Code","CODE,READONLY")
126 FNexportAs("stubfn",libfn$)
137 FNexportAs("zero","sapphire_init")
138 FNexportAs("zero","sapphire_libInit")
139 FNexportAs("zero","sapphire_disable")
143 FNexportAs("offDiff%","__sph_workoff")
146 PROCbas_aofSaveAs(lib$)
148 REM --- Build stub section ---
155 FNimportAs(libfn$,"stubfn")
157 FNarea("Sapphire$$ExtTable","CODE,READONLY")
162 PROCbas_aofSaveAs(stub$)