Commit | Line | Data |
---|---|---|
c1b567d8 MW |
1 | REM |
2 | REM fixLink | |
3 | REM | |
4 | REM Fix object files output by partial AOF linking | |
5 | REM | |
6 | REM © 1995-1998 Straylight | |
7 | REM | |
8 | ||
9 | REM ----- Licensing note ---------------------------------------------------- | |
10 | REM | |
11 | REM This file is part of Straylight's core utilities (coreutils) | |
12 | REM | |
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) | |
16 | REM any later version | |
17 | REM | |
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. | |
22 | REM | |
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. | |
26 | ||
27 | SYS "OS_GetEnv" TO comm$ | |
28 | IF INSTR(comm$,"-quit")=0 THEN ERROR 1,"fixLink must be started using *Run" | |
29 | comm$=MID$(comm$,INSTR(comm$,"""")+1) | |
30 | comm$=MID$(comm$,INSTR(comm$," ")+1) | |
31 | comm$=LEFT$(comm$,INSTR(comm$,"""")-1) | |
32 | ||
33 | SYS "OS_File",17,comm$ TO ,,,,size% | |
34 | DIM b% size% | |
35 | SYS "OS_File",16,comm$,b%,0 | |
36 | ||
37 | REM --- Find header --- | |
38 | ||
39 | DIM q% 8 | |
40 | $q%="OBJ_HEAD" | |
41 | A%=q%!0 | |
42 | B%=q%!4 | |
43 | c%=b%!4 | |
44 | x%=b%+12 | |
45 | o%=0 | |
46 | FOR i%=1 TO c% | |
47 | IF x%!0=A% AND x%!4=B% THEN o%=x%!8 | |
48 | x%+=16 | |
49 | NEXT | |
50 | IF o%=0 THEN ERROR 0,"Erk!" | |
51 | ||
52 | REM --- Now munge attributes --- | |
53 | ||
54 | x%=b%+o%+24 | |
55 | a%=!(b%+o%+8) | |
56 | FOR i%=1 TO a% | |
57 | x%!4=x%!4 AND &FFFF | |
58 | x%+=20 | |
59 | NEXT | |
60 | ||
61 | REM --- Save AOF file back --- | |
62 | ||
63 | SYS "OS_File",10,comm$,&FFD,,b%,b%+size% | |
64 | END |