MakeLib/MakeLib.cc

1 line
50 KiB
C++
Raw Normal View History

2018-03-12 02:34:27 +00:00
/*************************************************************** * * ORCA/M MakeLIB 2.0 * * By Mike Westerfield * Original Version 4 April 1988 * 2.0 Version: August 1991 * * Copyright 1986,1988,1991 * By the Byte Works, Inc. * * The source code for APW is protected by trade secret. It * cannot be released or used in any way except for building * APW and archiving the source without the written permission * of the Byte Works, Inc. * * Written using ORCA/C 1.2. * **************************************************************** * * MAKELIB [-D] [-F] library [+|-|^ object] * * -D indicates that the dictionary should be listed * -F indicates that the list of files should be listed * library name of the library to modify * +object add the object file to the library * -object remove the object file from the library * ^object remove the object file and write it as an object file * ***************************************************************/ #pragma keep "makelib" #pragma lint -1 #pragma optimize 9 #include <stdlib.h> #include <stdio.h> #include <ctype.h> #include <string.h> #define TRUE 1 /* boolean constants */ #define FALSE 0 #define BOOL int /* boolean type */ #define MAXLINE 255 /* size of input line */ #define MAXNAME 256 /* # chars in a symbol or file name */ #define MAXFILE 8192 /* max length of a path name */ /* Shell, GS/OS Interface */ /**************************/ extern pascal void PDosInt(int, char *); #define EXPAND_DEVICES(parm) (PDosInt(0x0154,parm)) #define WRITE_CONSOLE(parm) (PDosInt(0x015A,parm)) #define DestroyGS(pBlockPtr) (PDosInt(0x2002,pBlockPtr)) #define SetFileInfoGS(pBlockPtr) (PDosInt(0x2005,pBlockPtr)) #define GetFileInfoGS(pBlockPtr) (PDosInt(0x2006,pBlockPtr)) typedef unsigned char byte, Byte; struct TimeRec { Byte second; Byte minute; Byte hour; Byte year; Byte day; Byte month; Byte extra; Byte weekDay; } ; typedef struct TimeRec TimeRec, *TimeRecPtr, **TimeRecHndl; struct GSString255 { int length; char text[255]; } ; typedef struct GSString255 GSString255, *GSString255Ptr, **GSString255Hndl; struct ResultBuf255 { int bufSize; GSString255 bufString; } ; typedef struct ResultBuf255 ResultBuf255, *ResultBuf255Ptr, **ResultBuf255Hndl; struct FileInfoRecGS { int pCount; GSString255Ptr pathname; int access; int fileType; long auxType; int storageType; /* must be 0 for SetFileInfo */ TimeRec createDateTime; TimeRec modDateTime; ResultBuf255Ptr optionList; long eof; long blocksUsed; /* must be 0 for SetFileInfo */ long resourceEOF; /* must be 0 for SetFileInfo */ long resourceBlocks; /* must be 0 for SetFileInfo */ } ; typedef struct FileInfoRecGS FileInfoRecGS, *FileInfoRecPtrGS; typedef struct osName { /* GS/OS input name */ int length; char str[MAXFILE]; } osName, *osNamePtr; typedef struct outName { /* GS/OS output name */ int buffsize; int length; char str[MAXFILE]; } outName, *outNamePtr; struct NameRecGS { int pCount; GSString255Ptr pathname; } ; typedef struct NameRecGS NameRecGS, *NameRecPtrGS; /* file handling */ /*****************/ FILE *inFile; /* input file */ FILE *outFile; /* output file */ FILE *objFile; /* obj output file for ^ */ byte *s,*s2; /* disk segment */ long ds,nds; /* disp in s */ char (*libName)[MAXFILE]; /* file names */ char (*segName)[MAXFILE]; char segFlag; /* object segment processing type */ /* symbol tables */ /*****************/ typedef struct fileStruct { /* file list */ struct fileStruct *fNext; char *fName; int fFile; } fileStruct; typedef struct symbolStruct { /* symbol table entry */ struct symbolStruct *sNext; /* next entry */ char *sName; /* symbol name */ int sFile; /* file index number */ long sSeg; BOOL sPrivate; /* private symbol? */ } symbolStruct; symbolStruct *symbol; /* pointer to first symbol */ fileStruct *file; /* pointer to file entr