···11+22+pascal void CallPascal(...);
33+pascal char CallPascalB(...);
44+pascal int CallPascalW(...);
55+pascal long CallPascalL(...);
66+77+char *CtoPstr(char *);
88+char *PtoCstr(char *);
+3-4
headers/Appletalk.h
Mac #includes/Appletalk.h
···22/*
33 * Appletalk.h
44 *
55- * Copyright (c) 1986 THINK Technologies, Inc.
66- * These interfaces are based on information published in
77- * "Inside Macintosh" by Apple Computer, Addison-Wesley,
88- * Reading (Mass.), 1985.
55+ * Copyright (c) 1986, 1987 THINK Technologies, Inc.
66+ * These interfaces are based on information copyrighted
77+ * by Apple Computer, Inc., 1985, 1986, 1987.
98 *
109 */
1110
+8-9
headers/ControlMgr.h
Mac #includes/ControlMgr.h
···22/*
33 * ControlMgr.h
44 *
55- * Copyright (c) 1986 THINK Technologies, Inc.
66- * These interfaces are based on information published in
77- * "Inside Macintosh" by Apple Computer, Addison-Wesley,
88- * Reading (Mass.), 1985.
55+ * Copyright (c) 1986, 1987 THINK Technologies, Inc.
66+ * These interfaces are based on information copyrighted
77+ * by Apple Computer, Inc., 1985, 1986, 1987.
98 *
109 */
1110···1312#define _ControlMgr_
14131514#ifndef _MacTypes_
1616-#include "MacTypes.h" /* needs Mactypes.h */
1515+#include "MacTypes.h"
1716#endif
18171918#ifndef _WindowMgr_
2020-#include "WindowMgr.h" /* needs WindowMgr.h */
1919+#include "WindowMgr.h"
2120#endif
22212322/* control messages */
···6463 struct ControlRecord ** nextControl ;
6564 WindowPtr contrlOwner ;
6665 Rect contrlRect ;
6767- char contrlVis ;
6868- char contrlHilite ;
6666+ Byte contrlVis ;
6767+ Byte contrlHilite ;
6968 int contrlValue ;
7069 int contrlMin ;
7170 int contrlMax ;
···8483pascal ControlHandle GetNewControl();
8584pascal ProcPtr GetCtlAction();
86858787-#endif8686+#endif _ControlMgr_
-23
headers/DeskMgr.h
···11-22-/*
33- * DeskMgr.h
44- *
55- * Copyright (c) 1986 THINK Technologies, Inc.
66- * These interfaces are based on information published in
77- * "Inside Macintosh" by Apple Computer, Addison-Wesley,
88- * Reading (Mass.), 1985.
99- *
1010- */
1111-1212-#ifndef _DeskMgr_
1313-#define _DeskMgr_
1414-1515-enum {
1616- undoCmd,
1717- cutCmd = 2,
1818- copyCmd,
1919- pasteCmd,
2020- clearCmd
2121-};
2222-2323-#endif
+30-9
headers/DeviceMgr.h
Mac #includes/DeviceMgr.h
···22/*
33 * DeviceMgr.h
44 *
55- * Copyright (c) 1986 THINK Technologies, Inc.
66- * These interfaces are based on information published in
77- * "Inside Macintosh" by Apple Computer, Addison-Wesley,
88- * Reading (Mass.), 1985-86.
55+ * Copyright (c) 1986, 1987 THINK Technologies, Inc.
66+ * These interfaces are based on information copyrighted
77+ * by Apple Computer, Inc., 1985, 1986, 1987.
98 *
109 */
1110···3433 int ioVRefNum;
3534 int ioRefNum;
3635 int csCode;
3737- int csParam[];
3838- } cntrlParam;
3636+ int csParam[11];
3737+ } cntrlParam, CntrlParam;
3838+#define ioCRefNum ioRefNum
39394040/* csCode */
4141enum {
···91919292/* result codes */
9393enum {
9494- notOpenErr = -28,
9494+ dceExtErr = -30,
9595+ unitTblFullErr,
9696+ notOpenErr,
9597 abortErr,
9698 dInstErr,
9799 dRemovErr,
···107109108110/* chooser interface */
109111enum {
110110- chooserID, /* caller value for chooser */
112112+ chooserID = 1, /* caller value for chooser */
111113 newSelMsg = 12, /* message values */
112114 fillListMsg,
113115 getSelMsg,
···117119 buttonMsg = 19
118120};
119121122122+/* cdev message types */
123123+enum {
124124+ initDev,
125125+ hitDev,
126126+ closeDev,
127127+ nulDev,
128128+ updateDev,
129129+ activDev,
130130+ deactivDev,
131131+ keyEvtDev,
132132+ macDev
133133+};
134134+135135+/* cdev error codes */
136136+#define cdevGenErr (-1)
137137+#define cdevMemErr 0
138138+#define cdevResErr 1
139139+#define cdevUnset 3
140140+120141121142/* functions returning non-integral values */
122143pascal DCtlHandle GetDCtlEntry();
···133154extern ProcPtr ExtStsDT[] : 0x2BE;
134155135156136136-#endif _DeviceMgr_
157157+#endif _DeviceMgr_
+4-5
headers/DialogMgr.h
Mac #includes/DialogMgr.h
···22/*
33 * DialogMgr.h
44 *
55- * Copyright (c) 1986 THINK Technologies, Inc.
66- * These interfaces are based on information published in
77- * "Inside Macintosh" by Apple Computer, Addison-Wesley,
88- * Reading (Mass.), 1985.
55+ * Copyright (c) 1986, 1987 THINK Technologies, Inc.
66+ * These interfaces are based on information copyrighted
77+ * by Apple Computer, Inc., 1985, 1986, 1987.
98 *
109 */
1110···114113/* low-memory globals */
115114extern ProcPtr ResumeProc : 0xA8C;
116115117117-#endif116116+#endif _DialogMgr_
-62
headers/DiskDvr.h
···11-22-/*
33- * DiskDvr.h
44- *
55- * Copyright (c) 1986 THINK Technologies, Inc.
66- * These interfaces are based on information published in
77- * "Inside Macintosh" by Apple Computer, Addison-Wesley,
88- * Reading (Mass.), 1985.
99- *
1010- */
1111-1212-#ifndef _DiskDvr_
1313-#define _DiskDvr_
1414-1515-/* positioning */
1616-#define currPos 0 /* fsAtMark */
1717-#define absPos 1 /* fsFromStart */
1818-#define relPos 3 /* fsFromMark */
1919-2020-typedef struct
2121- {
2222- int track;
2323- char writeProt;
2424- char diskInPlace;
2525- char installed;
2626- char sides;
2727- struct QElem *qLink;
2828- int qType;
2929- int dQDrive;
3030- int dQRefNum;
3131- int dQFSID;
3232- char twoSideFmt;
3333- char needsFlush;
3434- int diskErrs;
3535- } DrvSts;
3636-3737-/* result codes */
3838-#define firstDskErr (-84)
3939-enum {
4040- sectNFErr = -81,
4141- seekErr,
4242- spdAdjErr,
4343- twoSideErr,
4444- initIWMErr,
4545- tk0BadErr,
4646- cantStepErr,
4747- wrUnderrun,
4848- badDBtSlp,
4949- badDCksum,
5050- noDtaMkErr,
5151- badBtSlpErr,
5252- badCksmErr,
5353- dataVerErr,
5454- noAdrMkErr,
5555- noNybErr,
5656- offLinErr,
5757- noDriveErr
5858-};
5959-#define lastDskErr (-64)
6060-6161-6262-#endif
+6-5
headers/EventMgr.h
Mac #includes/EventMgr.h
···22/*
33 * EventMgr.h
44 *
55- * Copyright (c) 1986 THINK Technologies, Inc.
66- * These interfaces are based on information published in
77- * "Inside Macintosh" by Apple Computer, Addison-Wesley,
88- * Reading (Mass.), 1985.
55+ * Copyright (c) 1986, 1987 THINK Technologies, Inc.
66+ * These interfaces are based on information copyrighted
77+ * by Apple Computer, Inc., 1985, 1986, 1987.
98 *
109 */
1110···3938/* masks for keyboard event message */
4039#define charCodeMask 0x000000FFL
4140#define keyCodeMask 0x0000FF00L
4141+#define adbAddrMask 0x00FF0000L
42424343/* event masks */
4444#define mDownMask 0x2
···6666#define shiftKey 0x0200
6767#define alphaLock 0x0400
6868#define optionKey 0x0800
6969+#define controlKey 0x1000
697070717172/* results returned by PostEvent */
···117118extern char ScrDmpEnb : 0x2F8;
118119119120120120-#endif121121+#endif _EventMgr_
+6-6
headers/FileMgr.h
Mac #includes/FileMgr.h
···22/*
33 * FileMgr.h
44 *
55- * Copyright (c) 1986 THINK Technologies, Inc.
66- * These interfaces are based on information published in
77- * "Inside Macintosh" by Apple Computer, Addison-Wesley,
88- * Reading (Mass.), 1985-86.
55+ * Copyright (c) 1986, 1987 THINK Technologies, Inc.
66+ * These interfaces are based on information copyrighted
77+ * by Apple Computer, Inc., 1985, 1986, 1987.
98 *
109 */
1110···4948/* result codes */
5049enum {
5150 fsDSIntErr = -127,
5252- wrgVolTypErr = -123,
5151+ volGoneErr = -124,
5252+ wrgVolTypErr,
5353 badMovErr,
5454 tmwdoErr,
5555 dirNFErr,
···232232extern struct QHdr FSQHdr : 0x360;
233233234234235235-#endif
235235+#endif _FileMgr_
+14-15
headers/FontMgr.h
Mac #includes/FontMgr.h
···22/*
33 * FontMgr.h
44 *
55- * Copyright (c) 1986 THINK Technologies, Inc.
66- * These interfaces are based on information published in
77- * "Inside Macintosh" by Apple Computer, Addison-Wesley,
88- * Reading (Mass.), 1985-86.
55+ * Copyright (c) 1986, 1987 THINK Technologies, Inc.
66+ * These interfaces are based on information copyrighted
77+ * by Apple Computer, Inc., 1985, 1986, 1987.
98 *
109 */
1110···6564 {
6665 int errNum ;
6766 Handle fontHandle ;
6868- char bold ;
6969- char italic ;
7070- char ulOffset ;
7171- char ulShadow ;
7272- char ulThick ;
7373- char shadow ;
6767+ Byte bold ;
6868+ Byte italic ;
6969+ Byte ulOffset ;
7070+ Byte ulShadow ;
7171+ Byte ulThick ;
7272+ Byte shadow ;
7473 SignedByte extra ;
7575- char ascent ;
7676- char descent ;
7777- char widMax ;
7474+ Byte ascent ;
7575+ Byte descent ;
7676+ Byte widMax ;
7877 SignedByte leading ;
7979- char unused ;
7878+ Byte unused ;
8079 Point numer ;
8180 Point denom ;
8281 } FMOutput ;
···167166extern FamRec **LastFOND : 0xBC2;
168167169168170170-#endif
169169+#endif _FontMgr_
+4-5
headers/HFS.h
Mac #includes/HFS.h
···22/*
33 * HFS.h
44 *
55- * Copyright (c) 1986 THINK Technologies, Inc.
66- * These interfaces are based on information published in
77- * "Inside Macintosh" by Apple Computer, Addison-Wesley,
88- * Reading (Mass.), 1986.
55+ * Copyright (c) 1986, 1987 THINK Technologies, Inc.
66+ * These interfaces are based on information copyrighted
77+ * by Apple Computer, Inc., 1985, 1986, 1987.
98 *
109 */
1110···265264extern HFSDefaults *FmtDefaults : 0x39E;
266265267266268268-#endif267267+#endif _HFS_
···22/*
33 * ListMgr.h
44 *
55- * Copyright (c) 1986 THINK Technologies, Inc.
66- * These interfaces are based on information published in
77- * "Inside Macintosh" by Apple Computer, Addison-Wesley,
88- * Reading (Mass.), 1986.
55+ * Copyright (c) 1986, 1987 THINK Technologies, Inc.
66+ * These interfaces are based on information copyrighted
77+ * by Apple Computer, Inc., 1985, 1986, 1987.
98 *
109 */
1110···7170/*pascal Cell LLastClick(); -- actually returns a long */
727173727474-#endif7373+#endif _ListMgr_
+4-5
headers/MacTypes.h
Mac #includes/MacTypes.h
···22/*
33 * MacTypes.h
44 *
55- * Copyright (c) 1986 THINK Technologies, Inc.
66- * These interfaces are based on information published in
77- * "Inside Macintosh" by Apple Computer, Addison-Wesley,
88- * Reading (Mass.), 1985.
55+ * Copyright (c) 1986, 1987 THINK Technologies, Inc.
66+ * These interfaces are based on information copyrighted
77+ * by Apple Computer, Inc., 1985, 1986, 1987.
98 *
109 */
1110···5352extern int ROM85 : 0x28E;
545355545656-#endif5555+#endif _MacTypes_
-41
headers/MacinTalk.h
···11-/*
22- * MacinTalk.h
33- *
44- * Copyright (c) 1986 THINK Technologies, Inc.
55- * These interfaces are based on information published by Apple Computer.
66- *
77- */
88-99-#ifndef _MacTypes_
1010-#include "MacTypes.h"
1111-#endif
1212-1313-typedef int SpeechErr;
1414-1515-typedef char SpeechRecord[100];
1616-1717-typedef SpeechRecord *SpeechPointer, **SpeechHandle;
1818-1919-typedef enum { Male, Female } Sex;
2020-2121-typedef enum { Natural, Robotic, NoChange } FOMode;
2222-2323-typedef enum { xEnglish, French, Spanish, German, Italian } Language;
2424-2525-typedef struct {
2626- Sex theSex;
2727- Language theLanguage;
2828- int theRate;
2929- int thePitch;
3030- FOMode theMode;
3131- Str255 theName;
3232- long refCon;
3333- } VoiceRecord, *VoicePtr;
3434-3535-pascal SpeechErr SpeechOn();
3636-pascal void SpeechOff();
3737-pascal void SpeechRate();
3838-pascal void SpeechPitch();
3939-pascal void SpeechSex();
4040-pascal int Reader();
4141-pascal int MacinTalk();
+11-7
headers/MemoryMgr.h
Mac #includes/MemoryMgr.h
···22/*
33 * MemoryMgr.h
44 *
55- * Copyright (c) 1986 THINK Technologies, Inc.
66- * These interfaces are based on information published in
77- * "Inside Macintosh" by Apple Computer, Addison-Wesley,
88- * Reading (Mass.), 1985-86.
55+ * Copyright (c) 1986, 1987 THINK Technologies, Inc.
66+ * These interfaces are based on information copyrighted
77+ * by Apple Computer, Inc., 1985, 1986, 1987.
98 *
109 */
1110···2322/* result codes */
2423enum {
2524 memLockedErr = -117,
2626- memPurErr = -112,
2525+ memSCErr,
2626+ memBCErr,
2727+ memPCErr,
2828+ memAZErr,
2929+ memPurErr,
2730 memWZErr,
2828- nilHandleErr = -109,
3131+ memAdrErr,
3232+ nilHandleErr,
2933 memFullErr,
3034 memROZErr = -99
3135};
···8185extern Ptr CurStackBase : 0x908;
828683878484-#endif
8888+#endif _MemoryMgr_
+14-5
headers/MenuMgr.h
Mac #includes/MenuMgr.h
···22/*
33 * MenuMgr.h
44 *
55- * Copyright (c) 1986 THINK Technologies, Inc.
66- * These interfaces are based on information published in
77- * "Inside Macintosh" by Apple Computer, Addison-Wesley,
88- * Reading (Mass.), 1985.
55+ * Copyright (c) 1986, 1987 THINK Technologies, Inc.
66+ * These interfaces are based on information copyrighted
77+ * by Apple Computer, Inc., 1985, 1986, 1987.
98 *
109 */
1110···3332/* MDEF id */
3433#define textMenuProc 0
35343535+/* hierarchical and pop-up menus */
3636+#define hMenuCmd 0x1B
3737+#define hierMenu -1
3838+#define mPopUpMsg 4
3939+4040+3641typedef struct
3742 {
3843 int menuID;
···5257pascal MenuHandle GetMHandle();
53585459/* low-memory globals */
6060+extern int TopMenuItem : 0xA0A;
6161+extern int AtMenuBottom : 0xA0C;
5562extern Handle MenuList : 0xA1C;
5663extern int MBarEnable : 0xA20;
5764extern int MenuFlash : 0xA24;
5865extern int TheMenu : 0xA26;
5966extern ProcPtr MBarHook : 0xA2C;
6067extern ProcPtr MenuHook : 0xA30;
6868+extern long MenuDisable : 0xB54;
6969+extern int MBarHeight : 0xBAA;
617062716363-#endif
7272+#endif _MenuMgr_
-103
headers/OSUtil.h
···11-22-/*
33- * OSUtil.h
44- *
55- * Copyright (c) 1986 THINK Technologies, Inc.
66- * These interfaces are based on information published in
77- * "Inside Macintosh" by Apple Computer, Addison-Wesley,
88- * Reading (Mass.), 1985-86.
99- *
1010- */
1111-1212-#ifndef _OSUtil_
1313-#define _OSUtil_
1414-1515-#ifndef _MacTypes_
1616-#include "MacTypes.h"
1717-#endif
1818-1919-/* result codes */
2020-enum {
2121- prInitErr = -88,
2222- prWrErr,
2323- clkWrErr,
2424- clkRdErr,
2525- vTypErr = -2,
2626- qErr
2727-};
2828-2929-/* queue types */
3030-enum {
3131- vType = 1,
3232- ioQType,
3333- drvType,
3434- evType,
3535- fsQType
3636-};
3737-3838-/* machine types */
3939-enum { macXLMachine, macMachine };
4040-4141-/* trap types */
4242-enum { OSTrap, ToolTrap };
4343-4444-/* serial port use */
4545-enum { useFree, useATalk, useAsync };
4646-4747-typedef struct
4848- {
4949- char valid;
5050- char aTalkA;
5151- char aTalkB;
5252- char config;
5353- int portA;
5454- int portB;
5555- long alarm;
5656- int font;
5757- int kbdPrint;
5858- int volClik;
5959- int misc;
6060- } SysParmType,* SysPPtr ;
6161-6262-typedef struct QElem
6363- {
6464- struct QElem *qLink;
6565- int qType;
6666- char qData[];
6767- } QElem, *QElemPtr;
6868-6969-typedef struct QHdr
7070- {
7171- int qFlags;
7272- QElemPtr qHead;
7373- QElemPtr qTail;
7474- } QHdr,* QHdrPtr ;
7575-7676-typedef struct
7777- {
7878- int year;
7979- int month;
8080- int day;
8181- int hour;
8282- int minute;
8383- int second;
8484- int dayOfWeek;
8585- } DateTimeRec ;
8686-8787-8888-/* access A5 from interrupt level */
8989-#define SetUpA5() asm { move.l a5,-(sp) \
9090- move.l 0x904,a5 }
9191-#define RestoreA5() asm { move.l (sp)+,a5 }
9292-9393-9494-/* functions returning non-integral values */
9595-pascal SysPPtr GetSysPPtr();
9696-9797-/* low-memory globals */
9898-extern int SysVersion : 0x15A;
9999-extern SysParmType SysParam : 0x1F8;
100100-extern long Time : 0x20C;
101101-102102-103103-#endif
-36
headers/PackageMgr.h
···11-22-/*
33- * PackageMgr.h
44- *
55- * Copyright (c) 1986 THINK Technologies, Inc.
66- * These interfaces are based on information published in
77- * "Inside Macintosh" by Apple Computer, Addison-Wesley,
88- * Reading (Mass.), 1985-86.
99- *
1010- */
1111-1212-#ifndef _PackageMgr_
1313-#define _PackageMgr_
1414-1515-#ifndef _MacTypes_
1616-#include "MacTypes.h"
1717-#endif
1818-1919-/* package IDs */
2020-enum {
2121- listMgr,
2222- dskInit = 2,
2323- stdFile,
2424- flPoint,
2525- trFunc,
2626- intUtil,
2727- bdConv
2828-};
2929-3030-/* low-memory globals */
3131-extern Handle AppPacks[] : 0xAB8;
3232-3333-3434-#endif
3535-3636-
+85-7
headers/PrintMgr.h
Mac #includes/PrintMgr.h
···22/*
33 * PrintMgr.h
44 *
55- * Copyright (c) 1986 THINK Technologies, Inc.
66- * These interfaces are based on information published in
77- * "Inside Macintosh" by Apple Computer, Addison-Wesley,
88- * Reading (Mass.), 1985; and on the Public Toolbox Interface
99- * Source Code, copyright (c) 1985 Apple Computer, licensed
1010- * to THINK Technologies by Apple Computer.
55+ * Copyright (c) 1986, 1987 THINK Technologies, Inc.
66+ * These interfaces are based on information copyrighted
77+ * by Apple Computer, Inc., 1985, 1986, 1987.
118 *
129 */
1310···4037#define lPrEvtTop 0x0001FFFD
4138#define iPrDevCtl 7
4239#define lPrReset 0x00010000
4040+#define lPrDocOpen 0x00010000
4341#define lPrPageEnd 0x00020000
4242+#define lPrPageClose 0x00020000
4443#define lPrLineFeed 0x00030000
4444+#define lPrLFStd 0x0003FFFF
4545#define lPrLFSixth 0x0003FFFF
4646#define lPrLFEighth 0x0003FFFE
4747+#define lPrPageOpen 0x00040000
4848+#define lPrDocClose 0x00050000
4749#define iFMgrCtl 8
5050+#define iMscCtl 9
5151+#define iPvtCtl 10
48524953/* result codes */
5054#define iPrSavPFil (-1)
···5256#define iMemFullErr (-108)
5357#define iPrAbort 128
54585959+/* PrGeneral constants */
6060+enum {
6161+ getRslDataOp = 4,
6262+ setRslOp,
6363+ draftBitsOp,
6464+ noDraftBitsOp,
6565+ getRotnOp
6666+};
6767+#define noSuchRsl 1
6868+#define rgType1 1
6969+5570/* other constants */
5671#define sPrDrvr "\p.Print"
5772#define iPrDrvrRef (-3)
···129144 TPrInfo prInfoPT;
130145 TPrXInfo prXInfo;
131146 TPrJob prJob;
132132- int printX[19];
147147+ int printX[/*19*/];
148148+ unsigned : 14, fLstPgFst : 1, fUserScale : 1;
149149+ int iZoomMin;
150150+ int iZoomMax;
151151+ StringHandle hDocName;
152152+ int pad[14]; /* to 120 bytes */
133153} TPrint, *TPPrint, **THPrint;
134154135155typedef struct TPrStatus {
···171191} TPrDlg, *TPPrDlg;
172192173193194194+/* typedefs useful for PrGeneral */
195195+196196+typedef struct TGnlData {
197197+ int iOpCode;
198198+ int iError;
199199+ long lReserved;
200200+ /* more fields here, depending on particular call */
201201+} TGnlData;
202202+203203+typedef struct TRslRg {
204204+ int iMin;
205205+ int iMax;
206206+} TRslRg;
207207+208208+typedef struct TRslRec {
209209+ int iXRsl;
210210+ int iYRsl;
211211+} TRslRec;
212212+213213+typedef struct TGetRslBlk {
214214+ int iOpCode;
215215+ int iError;
216216+ long lReserved;
217217+ int iRgType;
218218+ TRslRg xRslRg;
219219+ TRslRg yRslRg;
220220+ int iRslRecCnt;
221221+ TRslRec rgRslRec[27];
222222+} TGetRslBlk;
223223+224224+typedef struct TSetRslBlk {
225225+ int iOpCode;
226226+ int iError;
227227+ long lReserved;
228228+ THPrint hPrint;
229229+ int iXRsl;
230230+ int iYRsl;
231231+} TSetRslBlk;
232232+233233+typedef struct TDftBitsBlk {
234234+ int iOpCode;
235235+ int iError;
236236+ long lReserved;
237237+ THPrint hPrint;
238238+} TDftBitsBlk;
239239+240240+typedef struct TGetRotnBlk {
241241+ int iOpCode;
242242+ int iError;
243243+ long lReserved;
244244+ THPrint hPrint;
245245+ Boolean fLandscape;
246246+ char bXtra;
247247+} TGetRotnBlk;
248248+249249+174250/* functions returning non-integral values */
175251pascal TPPrPort PrOpenDoc();
176252pascal Handle PrDrvrDCE();
253253+pascal TPPrDlg PrStlInit();
254254+pascal TPPrDlg PrJobInit();
177255178256/* low-memory globals */
179257extern int PrintErr : 0x944;
+4-5
headers/Quickdraw.h
Mac #includes/Quickdraw.h
···22/*
33 * Quickdraw.h
44 *
55- * Copyright (c) 1986 THINK Technologies, Inc.
66- * These interfaces are based on information published in
77- * "Inside Macintosh" by Apple Computer, Addison-Wesley,
88- * Reading (Mass.), 1985.
55+ * Copyright (c) 1986, 1987 THINK Technologies, Inc.
66+ * These interfaces are based on information copyrighted
77+ * by Apple Computer, Inc., 1985, 1986, 1987.
98 *
109 */
1110···203202extern Rect CrsrPin : 0x834;
204203205204206206-#endif
205205+#endif _Quickdraw_
+5-5
headers/ResourceMgr.h
Mac #includes/ResourceMgr.h
···22/*
33 * ResourceMgr.h
44 *
55- * Copyright (c) 1986 THINK Technologies, Inc.
66- * These interfaces are based on information published in
77- * "Inside Macintosh" by Apple Computer, Addison-Wesley,
88- * Reading (Mass.), 1985-86.
55+ * Copyright (c) 1986, 1987 THINK Technologies, Inc.
66+ * These interfaces are based on information copyrighted
77+ * by Apple Computer, Inc., 1985, 1986, 1987.
98 *
109 */
1110···5049pascal Handle Get1Resource();
5150pascal Handle Get1IndResource();
5251pascal Handle Get1NamedResource();
5252+pascal Handle RGetResource();
53535454/* low-memory globals */
5555extern Handle TopMapHndl : 0xA50;
···6363extern int RomMapInsert : 0xB9E;
646465656666-#endif6666+#endif _ResourceMgr_
-44
headers/SCSIMgr.h
···11-22-/*
33- * SCSIMgr.h
44- *
55- * Copyright (c) 1986 THINK Technologies, Inc.
66- * These interfaces are based on information published in
77- * "Inside Macintosh" by Apple Computer, Addison-Wesley,
88- * Reading (Mass.), 1986.
99- *
1010- */
1111-1212-#ifndef _SCSIMgr_
1313-#define _SCSIMgr_
1414-1515-1616-/* transfer instruction op codes */
1717-enum {
1818- scInc = 1,
1919- scNoInc,
2020- scAdd,
2121- scMove,
2222- scLoop,
2323- scNop,
2424- scStop,
2525- scComp
2626-};
2727-2828-/* result codes */
2929-enum {
3030- scCommErr = 2,
3131- scBadParmsErr = 4,
3232- scPhaseErr,
3333- scCompareErr
3434-};
3535-3636-3737-typedef struct SCSIInstr {
3838- int scOpcode;
3939- long scParam1;
4040- long scParam2;
4141-} SCSIInstr;
4242-4343-4444-#endif
+4-5
headers/ScrapMgr.h
Mac #includes/ScrapMgr.h
···22/*
33 * ScrapMgr.h
44 *
55- * Copyright (c) 1986 THINK Technologies, Inc.
66- * These interfaces are based on information published in
77- * "Inside Macintosh" by Apple Computer, Addison-Wesley,
88- * Reading (Mass.), 1985.
55+ * Copyright (c) 1986, 1987 THINK Technologies, Inc.
66+ * These interfaces are based on information copyrighted
77+ * by Apple Computer, Inc., 1985, 1986, 1987.
98 *
109 */
1110···3736extern ScrapStuff ScrapInfo : 0x960;
383739384040-#endif
3939+#endif _ScrapMgr_
+4-5
headers/SegmentLdr.h
Mac #includes/SegmentLdr.h
···22/*
33 * SegmentLdr.h
44 *
55- * Copyright (c) 1986 THINK Technologies, Inc.
66- * These interfaces are based on information published in
77- * "Inside Macintosh" by Apple Computer, Addison-Wesley,
88- * Reading (Mass.), 1985.
55+ * Copyright (c) 1986, 1987 THINK Technologies, Inc.
66+ * These interfaces are based on information copyrighted
77+ * by Apple Computer, Inc., 1985, 1986, 1987.
98 *
109 */
1110···3534extern Handle AppParmHandle : 0xAEC;
363537363838-#endif3737+#endif _SegmentLdr_
+9-6
headers/SerialDvr.h
Mac #includes/SerialDvr.h
···22/*
33 * SerialDvr.h
44 *
55- * Copyright (c) 1986 THINK Technologies, Inc.
66- * These interfaces are based on information published in
77- * "Inside Macintosh" by Apple Computer, Addison-Wesley,
88- * Reading (Mass.), 1985-86.
55+ * Copyright (c) 1986, 1987 THINK Technologies, Inc.
66+ * These interfaces are based on information copyrighted
77+ * by Apple Computer, Inc., 1985, 1986, 1987.
98 *
109 */
1110···2928#define stop10 16384
3029#define stop15 ((int) -32768)
3130#define stop20 (-16384)
3232-#define noParity 8192
3131+#define noParity 0
3332#define oddParity 4096
3433#define evenParity 12288
3534#define data5 0
···5857#define BinRefNum -8
5958#define BoutRefNum -9
60596060+/* errors */
6161+#define rcvrErr -89
6262+#define breakRecd -90
6363+61646265typedef struct
6366 {
···8386 } SerStaRec ;
848785888686-#endif8989+#endif _SerialDvr_
+4-5
headers/SoundDvr.h
Mac #includes/SoundDvr.h
···22/*
33 * SoundDvr.h
44 *
55- * Copyright (c) 1986 THINK Technologies, Inc.
66- * These interfaces are based on information published in
77- * "Inside Macintosh" by Apple Computer, Addison-Wesley,
88- * Reading (Mass.), 1985.
55+ * Copyright (c) 1986, 1987 THINK Technologies, Inc.
66+ * These interfaces are based on information copyrighted
77+ * by Apple Computer, Inc., 1985, 1986, 1987.
98 *
109 */
1110···7170extern char SdVolume : 0x260;
727173727474-#endif
7373+#endif _SoundDvr_
+4-5
headers/StdFilePkg.h
Mac #includes/StdFilePkg.h
···22/*
33 * StdFilePkg.h
44 *
55- * Copyright (c) 1986 THINK Technologies, Inc.
66- * These interfaces are based on information published in
77- * "Inside Macintosh" by Apple Computer, Addison-Wesley,
88- * Reading (Mass.), 1985-86.
55+ * Copyright (c) 1986, 1987 THINK Technologies, Inc.
66+ * These interfaces are based on information copyrighted
77+ * by Apple Computer, Inc., 1985, 1986, 1987.
98 *
109 */
1110···5251extern long CurDirStore : 0x398;
535254535555-#endif
5454+#endif _StdFilePkg_
-70
headers/TextEdit.h
···11-22-/*
33- * TextEdit.h
44- *
55- * Copyright (c) 1986 THINK Technologies, Inc.
66- * These interfaces are based on information published in
77- * "Inside Macintosh" by Apple Computer, Addison-Wesley,
88- * Reading (Mass.), 1985.
99- *
1010- */
1111-1212-#ifndef _TextEdit_
1313-#define _TextEdit_
1414-1515-#ifndef _Quickdraw_
1616-#include "Quickdraw.h"
1717-#endif
1818-1919-/* justifications */
2020-enum { teJustRight = -1, teJustLeft, teJustCenter };
2121-2222-typedef char Chars[1], *CharsPtr, **CharsHandle;
2323-2424-typedef struct
2525- {
2626- Rect destRect ;
2727- Rect viewRect ;
2828- Rect selRect ;
2929- int lineHeight ;
3030- int fontAscent ;
3131- Point selPoint ;
3232- int selStart ;
3333- int selEnd ;
3434- int active ;
3535- ProcPtr wordBreak ;
3636- ProcPtr clikLoop ;
3737- long clickTime ;
3838- int clickLoc ;
3939- long caretTime ;
4040- int caretState ;
4141- int just ;
4242- int teLength ;
4343- Handle hText ;
4444- int recalBack ;
4545- int recalLines;
4646- int clikStuff ;
4747- int crOnly ;
4848- int txFont ;
4949- char txFace ;
5050- int txMode ;
5151- int txSize ;
5252- GrafPtr inPort ;
5353- ProcPtr highHook ;
5454- ProcPtr caretHook ;
5555- int nLines ;
5656- int lineStarts[];
5757- } TERec, *TEPtr, **TEHandle ;
5858-5959-6060-/* functions returning non-integral values */
6161-pascal TEHandle TENew();
6262-pascal CharsHandle TEGetText();
6363-pascal Handle TEScrapHandle();
6464-6565-/* low-memory globals */
6666-extern int TEScrpLength : 0xAB0;
6767-extern Handle TEScrpHandle : 0xAB4;
6868-6969-7070-#endif
-28
headers/TimeMgr.h
···11-22-/*
33- * TimeMgr.h
44- *
55- * Copyright (c) 1986 THINK Technologies, Inc.
66- * These interfaces are based on information published in
77- * "Inside Macintosh" by Apple Computer, Addison-Wesley,
88- * Reading (Mass.), 1986.
99- *
1010- */
1111-1212-#ifndef _TimeMgr_
1313-#define _TimeMgr_
1414-1515-#ifndef _MacTypes_
1616-#include "MacTypes.h"
1717-#endif
1818-1919-2020-typedef struct TMTask {
2121- struct QElem *qLink;
2222- int qType;
2323- ProcPtr tmAddr;
2424- int tmCount;
2525-} TMTask;
2626-2727-2828-#endif
+4-5
headers/ToolboxUtil.h
Mac #includes/ToolboxUtil.h
···22/*
33 * ToolboxUtil.h
44 *
55- * Copyright (c) 1986 THINK Technologies, Inc.
66- * These interfaces are based on information published in
77- * "Inside Macintosh" by Apple Computer, Addison-Wesley,
88- * Reading (Mass.), 1985-86.
55+ * Copyright (c) 1986, 1987 THINK Technologies, Inc.
66+ * These interfaces are based on information copyrighted
77+ * by Apple Computer, Inc., 1985, 1986, 1987.
98 *
109 */
1110···4342double Frac2X(Fract);
444345444646-#endif
4545+#endif _ToolboxUtil_
+4-5
headers/VRetraceMgr.h
Mac #includes/VRetraceMgr.h
···22/*
33 * VRetraceMgr.h
44 *
55- * Copyright (c) 1986 THINK Technologies, Inc.
66- * These interfaces are based on information published in
77- * "Inside Macintosh" by Apple Computer, Addison-Wesley,
88- * Reading (Mass.), 1985.
55+ * Copyright (c) 1986, 1987 THINK Technologies, Inc.
66+ * These interfaces are based on information copyrighted
77+ * by Apple Computer, Inc., 1985, 1986, 1987.
98 *
109 */
1110···3534extern struct QHdr VBLQueue : 0x160;
363537363838-#endif3737+#endif _VRetraceMgr_
+4-5
headers/WindowMgr.h
Mac #includes/WindowMgr.h
···22/*
33 * WindowMgr.h
44 *
55- * Copyright (c) 1986 THINK Technologies, Inc.
66- * These interfaces are based on information published in
77- * "Inside Macintosh" by Apple Computer, Addison-Wesley,
88- * Reading (Mass.), 1985-86.
55+ * Copyright (c) 1986, 1987 THINK Technologies, Inc.
66+ * These interfaces are based on information copyrighted
77+ * by Apple Computer, Inc., 1985, 1986, 1987.
98 *
109 */
1110···122121extern WindowPtr GhostWindow : 0xA84;
123122124123125125-#endif
124124+#endif _WindowMgr_
headers/asm.h
Mac #includes/asm.h
-8
headers/pascal.h
···11-22-pascal void CallPascal();
33-pascal char CallPascalB();
44-pascal int CallPascalW();
55-pascal long CallPascalL();
66-77-char *CtoPstr();
88-char *PtoCstr();
+1
profiler/profile.c
···11+/*
Profile and tracing package for LightspeedC.
(C) Copyright 1986 THINK Technologies, Inc. All rights reserved.
*/
#include "stdio.h"
typedef unsigned char Bool; /* for size */
enum{false,true};
typedef void (*address)(); /* address type */
typedef unsigned char byte;
typedef unsigned long time;
typedef struct {
char *name; /* function name */
time average; /* average time */
time maximum; /* largest time */
time minimum; /* smallest time */
time total; /* total time */
unsigned int entries; /* times entered */
} PROFILE;
typedef struct {
address user; /* user return address */
int function; /* index into profiles */
time correction; /* nested call time */
time start; /* entry time */
} STACK;
#define LOCAL static /* local to profiler */
#define MAX_PROFILES 200 /* routines to follow */
#define MAX_STACK 200 /* max nested calls */
#define MAX_TIME 500000L /* max time */
/*
Select execution/compilation options.
SINGLE - each routine contains only its time
TESTING - test profile package without LightspeedC PROFILE option
*/
#define SINGLE /* single routine only */
/* #define TESTING standalone testing */
#ifdef TESTING
#undef LOCAL /* make items visible */
#define LOCAL
#endif
LOCAL int depth = -1;
LOCAL PROFILE profiles[MAX_PROFILES];
LOCAL int profile_count = 0;
LOCAL STACK stack[MAX_STACK];
LOCAL int stack_pointer = -1;
LOCAL time start_time;
int _profile = 1;
int _trace = 0;
void DumpProfile();
extern _profile_exit_();
extern char *CtoPstr();
extern char *PtoCstr();
#define _VIATIMER_ /* if this symbol is defined, the VIA timer now is used
instead of TickCount -- it provides faster ticks,
however there is a false precision to the numbers
and there is a range of + or - 500 ticks since
the VIAtimer is so fast that interrupts and such
play a more significant time role.
NOTE THAT THIS PROFILE OPTION CANNOT BE USED WITH
ANY PROGRAM THAT MANIPULATES THE #1 VIA timer */
#ifdef _VIATIMER_
/* TickCount() - redefine TickCount trap to be a procedure for determining
the timing according to the VIA timer */
#define VIAbase (*((unsigned char**)0x01D4))
#define VIAt1lo (*(VIAbase+512*4))
#define VIAt1hi (*(VIAbase+512*5))
#define VIAmaxtime ~0
time TickCount()
{
static time timer=0;
if (timer > 0)
{
/* Use VIA timer #1 (sound driver) and to implement a fine
resolution counter */
/* Find delta of VIA #1 */
timer += VIAmaxtime - (((unsigned short)VIAt1hi<<8)+VIAt1lo);
}
else
timer = 1;
/* Reset VIA counter */
VIAt1hi = VIAmaxtime;
VIAt1lo = VIAmaxtime;
return (timer);
}
#endif _VIATIMER_
/*
Compare two Pascal strings for equality.
*/
LOCAL Bool pstreq( s1, s2 )
register unsigned char *s1, *s2;
{
register int n = *s1;
if ((n = *s1++) != *s2++)
return( false );
while (n-- > 0)
if (*s1++ != *s2++)
return( false );
return( true );
}
/*
Return the time difference caused by the overhead of function entry and
timer call.
*/
LOCAL time delta( original )
time original;
{
return( (time) TickCount() - original );
}
/*
Lookup a name in the active profile table. For this system, "names" are
the address of the routine. If the name is found in the table, then the
index to the table entry is returned. If the name is not found and the
insert flag is on, then the item is inserted, and the new table index
is returned (if insert is false, then -1 is returned). If the profile
table is full, then -1 is returned.
*/
LOCAL int lookup( name, insert )
char *name;
Bool insert;
{
register int i;
for (i = 0; i < profile_count; i++)
if (pstreq( profiles[i].name, name ))
return( i );
if ( insert && profile_count < MAX_PROFILES)
{ /* place in table - i points to correct entry */
if (++profile_count == 1)
{ /* first time in */
start_time = (time) TickCount();
onexit( DumpProfile );
}
profiles[i].name = name;
profiles[i].minimum = MAX_TIME;
profiles[i].maximum =
profiles[i].total = NULL;
profiles[i].entries = 0;
return( i );
}
return( -1 );
}
/*
Skip over to column 32 from position 'n'.
*/
LOCAL void Skip( n )
register int n;
{
for (; n < 32; n++)
putchar( ' ' );
}
/*
Print the profile table on demand. Output is written to stdout and may
be redirected with the Unix '>' mechanism to a file. The user should
call this routine whenever a report is desired. Each time the routine is
called, the program opens the map file which corresponds to the program
running. The name of the map file is built by appending ".map" to the name
of the running program. If the map file cannot be found then the routine
returns.
*/
void DumpProfile()
{
int j, k; /* generic loop variables */
register int i; /* primary loop variable */
register time duration = 0L; /* time in test regions */
_profile = 0; /* turn off profiling here */
for (i = 0; i < profile_count; i++)
duration += profiles[i].total; /* compute total time */
printf( "\n\n" );
printf( "\t\t\t\tRoutine Profiles\n\n" );
printf( "Routine Address" );
Skip( 15 );
printf( " Minimum Maximum Average %% Entries\n" );
if (duration <= 0.0)
duration++;
for (i = 0; i < profile_count; i++)
{ /* for all entries in the profile table */
if (profiles[i].minimum == MAX_TIME)
continue; /* routine entry, no exit */
printf( "%s", PtoCstr( profiles[i].name ) );
CtoPstr( profiles[i].name );
Skip( profiles[i].name[0] );
printf( "%9lu %9lu %9lu %3.0f %7u\n",
profiles[i].minimum, profiles[i].maximum,
profiles[i].average,
((float) profiles[i].total * 100.0) / (float) duration + 0.05,
profiles[i].entries );
}
_profile = 1; /* re-enable profiling */
}
/*
Called by assembler exit routine. Compute usage statistics for routine on
top of profiling stack.
*/
address __profile_exit()
{
int i;
time exit_time = (time) TickCount();
depth--;
/* end timing for a function */
i = stack[stack_pointer].function;
#ifdef SINGLE
exit_time = exit_time - delta( exit_time ) -
stack[stack_pointer].start - stack[stack_pointer--].correction;
if (exit_time > 0x7FFFFFFF)
exit_time = 0L; /* handle clock rollover */
profiles[i].total += exit_time;
if (stack_pointer >= 0)
stack[stack_pointer].correction += exit_time + stack[stack_pointer + 1].correction;
#else
exit_time = exit_time - delta( exit_time ) - stack[stack_pointer--].start;
if (exit_time > 0x7FFFFFFF)
exit_time = 0L; /* handle clock rollover */
profiles[i].total += exit_time;
#endif
if (exit_time > profiles[i].maximum)
profiles[i].maximum = exit_time;
if (exit_time < profiles[i].minimum)
profiles[i].minimum = exit_time;
if (profiles[i].entries)
profiles[i].average = profiles[i].total / profiles[i].entries;
return( stack[stack_pointer + 1].user );
}
/*
Handle the routine entry profiling. Setup a stack frame and a profile
table entry if needed.
*/
void __profile( unused, ret, name )
unsigned long *ret;
address unused;
char *name;
{
register int function, /* index of routine */
i;
register time entry_time = (time) TickCount();
depth++;
if (_trace)
{
_profile = 0;
for (i = 0; i < depth; i++)
putchar( ' ' );
printf( "%s\n", PtoCstr( name ) );
CtoPstr( name );
_profile = 1;
}
if (++stack_pointer < MAX_STACK)
{ /* setup for return to PROFILE_EXIT on user exit */
stack[stack_pointer].user = (address) *ret;
*ret = (unsigned long) _profile_exit_;
stack[stack_pointer].correction = NULL;
}
else
{
depth--;
return;
}
if ((function = lookup( name, true )) >= 0)
{ /* process function entry */
profiles[function].entries++;
stack[stack_pointer].function = function;
entry_time = TickCount();
stack[stack_pointer].start = entry_time - delta( entry_time );
}
else
{ /* remove entry from stack */
*ret = (unsigned long) stack[stack_pointer--].user;
depth--;
}
}
+1
profiler/profilehooks.c
···11+/*
Profile and tracing package for LightspeedC.
(C) Copyright 1986 THINK Technologies, Inc. All rights reserved.
*/
extern void __profile();
extern void __profile_exit();
/*
;
; Entry point for profiler. Add another parameter to the stack which is
; a pointer to the return address of the caller of this function.
;
*/
_profile_()
{
asm
{
move.l (a7)+,d0 ; get current return address
pea 4(a6) ; push pointer to return address
move.l d0,-(a7) ; push back the return address
jsr __profile ; call the C profiler
move.l (a7)+,d0 ; get return address
move.l d0,(a7) ; write on top of stack and return
}
}
/*
;
; Exit point for profiler. This calls the end of function timing routine
; and returns to the user.
;
*/
_profile_exit_()
{
asm
{
move.l d0, -(a7) ; save old function result
jsr __profile_exit ; call end of routine timer
move.l d0, a0 ; save return address in A0
move.l (a7)+, d0 ; retrieve old function result
jmp (a0) ; then return
}
}
···11/*
22- Routines for LightspeedC�
22+ Routines for LightspeedC
3344 (C) Copyright 1986. THINK Technologies, Inc. All rights reserved.
55*/
sources/errno.h
C Libraries/headers/errno.h
sources/fopenw.h
C Libraries/headers/fopenw.h
sources/io.h
C Libraries/headers/io.h
-584
sources/math.c
···11-/*
22-33- Standard Unix math library for LightspeedC�.
44-55- (C) Copyright 1986 THINK Technologies, Inc. All rights reserved.
66-77- See Harbison & Steele's C:A Reference Manual chapter 11 for details
88-99-*/
1010-1111-1212-#include "stdio.h"
1313-#include "math.h"
1414-#include "sane.h"
1515-1616-#define C (0.00000000011641532183)
1717-1818-/* The following value is the largest possible positive number that can be
1919- represented by the double format */
2020-2121-static union {
2222-unsigned int plusdoubleparts[5];
2323-double plusdouble;
2424-} max = {0x7FFE, 0x7FFF, 0xFFFF, 0xFFFF, 0xFFFF};
2525-2626-/* The following value is positive infinity as represented by SANE */
2727-2828-static union {
2929-unsigned int plusdoubleparts[5];
3030-double plusdouble;
3131-} inf = {0x7FFF, 0, 0, 0, 0};
3232-3333-/* The following value is the base 2 logarithm of 10.0 as represented
3434- by a double value returned by SANE */
3535-3636-static union {
3737-unsigned int tenparts[5];
3838-double ten;
3939-} log2of = {0x4000, 0xD49A, 0x784B, 0xCD1B, 0x8AFE};
4040-4141-/* This is the data structure used with rand() and srand() to generate
4242- random numbers according to the ANSI C spec.
4343- pdg - 6/10/86 */
4444-4545-static union {
4646-unsigned long seed;
4747-struct { int sign : 1, v : 15; } hiword;
4848-} randval = 1;
4949-5050-/* This is the structure of a double, so we can access the exponent
5151- and mantissa sign bits independently without using SANE */
5252-5353-typedef struct {
5454-short expsign:1,
5555- exp:15;
5656-long mansign:1,
5757- man:31;
5858-long moreman;
5959-} dbl;
6060-6161-6262-/* This is the structure of the SANE (Standard Apple Numeric Environment)
6363- environment flags word used in ceil(), floor(), etc. */
6464-6565-typedef struct {
6666-short unused:1, round:2,
6767-/*flags:5, */ inexact:1, divbyzero:1, overflow:1, underflow:1, invalid:1,
6868-lastround:1, precision:2, halts:5;
6969-} SANEenvword;
7070-7171-/* Temporary save area for SANE global environment flags word */
7272-7373-static SANEenvword SANEstate;
7474-7575-/* Define the location of the SANE environment word in Macintosh memory */
7676-7777-#define SANEglobalenv (*((SANEenvword*) 0x0A4A))
7878-7979-8080-/* local function to truncate a double to an integer (works for both old
8181- and new versions of LightspeedC */
8282-8383-#define NEWLSC /* if uncommented, removes excess code for new version */
8484-8585-#ifndef NEWLSC
8686-8787-static int trunc(x)
8888-double x;
8989-{
9090-int i;
9191-9292- SANEstate = SANEglobalenv;
9393-9494- SANEglobalenv.round = TOWARDZERO;
9595-9696- i = x;
9797-9898- SANEglobalenv = SANEstate;
9999-100100- return (i);
101101-}
102102-#else
103103-#define trunc(x) x
104104-#endif NEWLSC
105105-106106-107107-/* Return the absolute value of the integer X */
108108-#line 0 abs
109109-int abs(x)
110110-int x;
111111-{
112112- if (x<0) return (-x);
113113- return (x);
114114-}
115115-116116-/* Return the arc cosine of the double value X */
117117-#line 0 acos
118118-double acos(x)
119119-double x;
120120-{
121121- if ((x > 1.0)||(x < -1.0))
122122- {
123123- errno = EDOM;
124124- return( 0.0 );
125125- }
126126-127127- if (x == -1.0) return ( PI );
128128-129129- x = (1.0 - x) / (1.0 + x);
130130-131131- fp68k(&x, FOSQRT);
132132-133133- x *= 2.0;
134134-135135- return( x );
136136-}
137137-138138-/* Return the arc sine of the double value X */
139139-#line 0 asin
140140-double asin(x)
141141-double x;
142142-{
143143-double y = fabs( x );
144144-145145- if ( y > 1.0 )
146146- {
147147- errno = EDOM;
148148- return( 0.0 );
149149- }
150150-151151- if (y == 1.0)
152152- {
153153- y = PI2;
154154-155155- /* copy sign of x into y */
156156-157157- (*(dbl*) (&y)).mansign = (*(dbl*) (&x)).mansign;
158158-159159- return( y );
160160- }
161161-162162- if ( y >= 0.3 ) x /= sqrt( (1.0 - x) * (1.0 + x) );
163163- else
164164- if ( y >= C ) x /= sqrt( 1.0 - x * x );
165165-166166- elems68k( &x, FOATANX );
167167-168168- return( x ); /* pdg - 6/10/86 - formerly returned y */
169169-}
170170-171171-172172-/* Return the arc tangent of the double value X */
173173-#line 0 atan
174174-double atan(x)
175175-double x;
176176-{
177177- elems68k( &x, FOATANX );
178178- return( x );
179179-}
180180-181181-182182-/* Return the arc tangent of the double value of Y divided by X */
183183-#line 0 atan2
184184-double atan2(y,x)
185185-double y, x;
186186-{
187187-double z;
188188-189189- if ( x == 0.0 )
190190- {
191191- if ( y == 0.0 )
192192- {
193193- errno = EDOM;
194194- return( 0.0 );
195195- }
196196-197197- z = PI2;
198198- }
199199- else
200200- {
201201- z = atan( fabs( y ) / fabs( x ) );
202202-203203- if (x <= 0.0) z = PI - z;
204204- }
205205-206206- /* copy sign of y into z */
207207-208208- (*(dbl*) (&z)).mansign = (*(dbl*) (&y)).mansign;
209209-210210- return (z);
211211-}
212212-213213-214214-/* Round towards positive infinity.
215215- pdg - 6/10/86 - complete revision using SANE call */
216216-#line 0 ceil
217217-double ceil(x)
218218-double x;
219219-{
220220- /* save the state, do the round, restore the state, and return value */
221221-222222- SANEstate = SANEglobalenv;
223223-224224- SANEglobalenv.round = UPWARD;
225225-226226- fp68k( &x, FORTI );
227227-228228- SANEglobalenv = SANEstate;
229229-230230- return (x);
231231-}
232232-233233-234234-/* Return the cosine of the double value X */
235235-#line 0 cos
236236-double cos(x)
237237-double x;
238238-{
239239- elems68k( &x, FOCOSX );
240240- return( x );
241241-}
242242-243243-244244-/* Return the hyperbolic cosine of the double value X */
245245-#line 0 cosh
246246-double cosh(x)
247247-double x;
248248-{
249249-double y = exp( fabs( x ) );
250250-251251- if (y == 0.0)
252252- {
253253- errno = ERANGE;
254254- return ( max.plusdouble );
255255- }
256256-257257- y *= 0.5;
258258- y += y * 0.25;
259259-260260- return( y );
261261-}
262262-263263-/* Return the value of e raised to the X power */
264264-#line 0 exp
265265-double exp(x)
266266-double x;
267267-{
268268- elems68k( &x, FOEXPX );
269269-270270- if (SANEglobalenv.overflow)
271271- {
272272- errno = ERANGE;
273273- return ( max.plusdouble );
274274- }
275275-276276- return( x );
277277-}
278278-279279-280280-/* Return the absolute value of X */
281281-#line 0 fabs
282282-double fabs(x)
283283-double x;
284284-{
285285- fp68k( &x, FOABS );
286286- return( x );
287287-}
288288-289289-290290-/* Round towards negative infinity.
291291- pdg - 6/10/86 - complete revision using SANE call vs. improper C hack */
292292-#line 0 floor
293293-double floor(x)
294294-double x;
295295-{
296296- /* save the state, do the round, restore the state, and return value */
297297-298298- SANEstate = SANEglobalenv;
299299-300300- SANEglobalenv.round = DOWNWARD;
301301-302302- fp68k( &x, FORTI );
303303-304304- SANEglobalenv = SANEstate;
305305-306306- return (x);
307307-}
308308-309309-310310-/* Return a number such F that k * Y + f == X
311311- Thanks to Robert J. Murphy of Data Tailor, Inc. for this revision */
312312-#line 0 fmod
313313-double fmod(x,y)
314314-double x, y;
315315-{
316316-double rem = x;
317317-318318- fp68k( &y, FOABS);
319319- fp68k( &y, &rem, FOREM);
320320-321321- if ( (x > 0) && (rem < 0)) rem += y;
322322- else
323323- if ( (x < 0) && (rem > 0)) rem -= y;
324324-325325- return (rem);
326326-}
327327-328328-329329-/* Return fraction and exponent of X */
330330-#line 0 frexp
331331-double frexp(x,nptr)
332332-double x;
333333-register int *nptr;
334334-{
335335-double y = fabs( x ), z = 2.0;
336336-337337- if (y == 0.0)
338338- {
339339- *nptr = 0;
340340- return( 0.0 );
341341- }
342342-343343- elems68k( &y, FOLOG2X );
344344-345345- y -= (*nptr = trunc(y));
346346-347347- elems68k( &y, &z, FOPWRY );
348348-349349- /* scale the result if not between .5 and 1.0 */
350350-351351- if (z >= 1.0)
352352- {
353353- (*nptr)++;
354354- z *= 0.5;
355355- }
356356- else
357357- if (z < 0.5)
358358- {
359359- (*nptr)--;
360360- z *= 2.0;
361361- }
362362-363363- /* copy sign of x into z */
364364-365365- (*(dbl*) (&z)).mansign = (*(dbl*) (&x)).mansign;
366366-367367- return( z );
368368-}
369369-370370-371371-/* Return the absolute value of the long number X */
372372-#line 0 labs
373373-long int labs(x)
374374-register long int x;
375375-{
376376- if ( x < 0 ) return (-x);
377377-378378- return (x);
379379-}
380380-381381-382382-/* Return return the floating point number represented by (X * radix) ^ n */
383383-#line 0 ldexp
384384-double ldexp(x,n)
385385-double x;
386386-int n;
387387-{
388388- fp68k( &n, &x, FOSCALB );
389389- return( x );
390390-}
391391-392392-393393-/* Return the natural log of the double value X */
394394-#line 0 log
395395-double log(x)
396396-double x;
397397-{
398398- if (x <= 0.0)
399399- {
400400- errno = EDOM;
401401- return ( -max.plusdouble );
402402- }
403403-404404- elems68k( &x, FOLNX );
405405- return( x );
406406-}
407407-408408-409409-/* Return the log base 10 of the double value X */
410410-#line 0 log10
411411-double log10(x)
412412-double x;
413413-{
414414- if (x <= 0.0)
415415- {
416416- errno = EDOM;
417417- return ( -max.plusdouble );
418418- }
419419-420420- elems68k(&x, FOLOG2X); /* LOG2 is much faster than LN */
421421-422422- x /= log2of.ten;
423423-424424- return ( x );
425425-}
426426-427427-428428-/* Split X into a fraction and integer such that |X| < 1 */
429429-#line 0 modf
430430-double modf(x,nptr)
431431-double x;
432432-register int *nptr;
433433-{
434434- if (abs( (*nptr = trunc(x)) ) > fabs( x ))
435435- {
436436- if (*nptr > 0) (*nptr)--;
437437- else
438438- (*nptr)++;
439439- }
440440-441441- x -= *nptr;
442442-443443- return( x );
444444-}
445445-446446-/* Return X ^ Y */
447447-#line 0 pow
448448-double pow(x,y)
449449-double x, y;
450450-{
451451-int dummyint;
452452-453453- if ( (x < 0.0 && (modf(y, &dummyint) != 0)) || (x == 0.0 && y < 0.0) )
454454- {
455455- errno = EDOM;
456456- x = -max.plusdouble;
457457- goto returnx;
458458- }
459459-460460- elems68k( &y, &x, FOPWRY );
461461-462462- if (SANEglobalenv.overflow)
463463- {
464464- errno = ERANGE;
465465- x = max.plusdouble;
466466- }
467467-468468-returnx:
469469-470470- return( x );
471471-}
472472-473473-474474-/* Return a random number in the range 0 .. max int */
475475-#line 0 rand
476476-477477-int rand()
478478-{
479479- /* pdg - 6/10/86 - ANSI random number generator */
480480-481481- randval.seed = randval.seed * 1103515245 + 12345;
482482- return randval.hiword.v;
483483-}
484484-485485-/* Return the sine of the double value X */
486486-#line 0 sin
487487-double sin(x)
488488-double x;
489489-{
490490- elems68k( &x, FOSINX );
491491- return( x );
492492-}
493493-494494-/* Return the hyperbolic sine of the double value X */
495495-#line 0 sinh
496496-double sinh(x)
497497-double x;
498498-{
499499-double y = fabs(x);
500500-501501- if (y >= C)
502502- {
503503- elems68k( &y, FOEXP1X );
504504-505505- if (SANEglobalenv.overflow)
506506- {
507507- errno = ERANGE;
508508- y = max.plusdouble;
509509- }
510510- else
511511- {
512512- y += y / ( y + 1.0);
513513-514514- y *= 0.5;
515515- }
516516- }
517517-518518- /* copy sign of x into y */
519519-520520- (*(dbl*) (&y)).mansign = (*(dbl*) (&x)).mansign;
521521-522522- return (y);
523523-}
524524-525525-526526-/* Return the square root of the double value X */
527527-#line 0 sqrt
528528-double sqrt(x)
529529-double x;
530530-{
531531- if (x < 0.0)
532532- {
533533- errno = EDOM;
534534- return( 0.0 );
535535- }
536536-537537- fp68k(&x, FOSQRT);
538538- return(x);
539539-}
540540-541541-542542-/* Set the seed of the random number generator to SEED */
543543-#line 0 srand
544544-void srand(seed)
545545-unsigned int seed;
546546-{
547547- randval.seed = seed;
548548-}
549549-550550-/* Return the tangent of the double value X */
551551-#line 0 tan
552552-double tan(x)
553553-double x;
554554-{
555555- elems68k( &x, FOTANX );
556556-557557- if ( SANEglobalenv.invalid || ( x == inf.plusdouble ) )
558558- {
559559- errno = ERANGE;
560560- x = max.plusdouble;
561561- }
562562-563563- return(x);
564564-}
565565-566566-567567-/* Return the hyperbolic tangent of the double value X */
568568-#line 0 tanh
569569-double tanh(x)
570570-double x;
571571-{
572572-double y = fabs( x );
573573-574574- if (y >= C)
575575- {
576576- y *= -2.0;
577577- elems68k( &y, FOEXP1X );
578578- y = -y / ( y + 2.0 );
579579- }
580580-581581- (*(dbl*) (&y)).mansign = (*(dbl*) (&x)).mansign;
582582-583583- return (y);
584584-}
-49
sources/math.h
···11-/****************************************************************************
22-33- Standard math library header for LightspeedC�.
44-55- (C) Copyright 1986 THINK Technologies, Inc. All rights reserved.
66-77-*****************************************************************************/
88-99-#ifndef _math_
1010-1111- #define _math_ /* show symbols defined */
1212- double acos();
1313- double asin();
1414- double atan();
1515- double atan2();
1616- double ceil();
1717- double cos();
1818- double cosh();
1919- double exp();
2020- double fabs();
2121- double floor();
2222- double fmod();
2323- double frexp();
2424- long labs();
2525- double ldexp();
2626- double log();
2727- double log10();
2828- double modf();
2929- double pow();
3030- double sin();
3131- double sinh();
3232- double sqrt();
3333- double tan();
3434- double tanh();
3535-3636- #define PI (3.14159265358979323846)
3737- #define PI2 (1.57079632679489661923)
3838- #define PI4 (0.78539816339744830966)
3939-4040- #define E (2.71828182845904523536)
4141-4242- typedef enum{
4343- EDOM=33,
4444- ERANGE=34
4545- };
4646-4747-extern int errno; /* actually defined in stdio */
4848-4949-#endif
+1-1
sources/onexit.c
C Libraries/sources/stdio .c files/onexit.c
···11/*
22- Routines for LightspeedC�
22+ Routines for LightspeedC
3344 (C) Copyright 1985, 1986. THINK Technologies, Inc. All rights reserved.
55
+1-1
sources/printf-1.c
C Libraries/sources/stdio .c files/printf-1.c
···11/*
22- printf routines for LightspeedC�
22+ printf routines for LightspeedC
3344 (C) Copyright 1985, 1986. THINK Technologies, Inc. All rights reserved.
55
+1-1
sources/printf-1a.c
C Libraries/sources/stdio .c files/printf-1a.c
···11/*
22- printf routines for LightspeedC�
22+ printf routines for LightspeedC
3344 (C) Copyright 1985, 1986. THINK Technologies, Inc. All rights reserved.
55
+3-7
sources/printf-2-w.c
C Libraries/sources/stdio .c files/printf-2-w.c
sources/printf-2.c
C Libraries/sources/stdio .c files/printf-2.c
+2-3
sources/printf-3.c
C Libraries/sources/stdio .c files/printf-3.c
···11/*
22- printf formatter for LightspeedC�
22+ printf formatter for LightspeedC
3344 (C) Copyright 1985, 1986. THINK Technologies, Inc. All rights reserved.
55···825825826826 return(_num_count);
827827828828- (void) std_ver();
829829-828828+ (void) std_ver(); /* make the linker drag it in */
830829}
+9-13
sources/printf-4.c
C Libraries/sources/stdio .c files/printf-4.c
···11/*
22- printf routines for LightspeedC�
33-22+ printf routines for LightspeedC
33+44 (C) Copyright 1986. THINK Technologies, Inc. All rights reserved.
5566 allows echoing the output of console window to printer
···46464747 /* if printer port number is non-zero, port A is implied */
48484949- if (SPPrint) p = ".AOut";
5050- else
5151- /* well, check to see if port B is in use by AppleTalk,
5252- indicated by a greater than zero value */
5353-5454- if (PortBUse < 0) p = ".BOut";
5555- else
5656- /* ran out of ports to check */
5757- return (EOF);
5858-4949+ if (SPPrint & 1) p = ".AOut";
5050+ else {
5151+ if (PortBUse < 0 || (PortBUse & 0xF) != 1) p = ".BOut";
5252+ else return (EOF);
5353+ }
5454+5955 /* set to binary mode if we are opening a device driver,
6056 so output directed to a printer gets proper linefeeds */
61576262- if (!(printfile = fopen(p, "wb"))) return (EOF);
5858+ if (!(printfile = fopen(p, "wb"))) return (errno);
63596460 _echo_to_printer_ = send_printer;
6561 }
-351
sources/profile.c
···11-/*
22-33- Profile and tracing package for LightspeedC�.
44-55- (C) Copyright 1986 THINK Technologies, Inc. All rights reserved.
66-77- */
88-99-1010-#include "stdio.h"
1111-1212-1313-typedef unsigned char Bool; /* for size */
1414-enum{false,true};
1515-1616-typedef void (*address)(); /* address type */
1717-typedef unsigned char byte;
1818-typedef unsigned long time;
1919-2020-typedef struct {
2121- char *name; /* function name */
2222- time average; /* average time */
2323- time maximum; /* largest time */
2424- time minimum; /* smallest time */
2525- time total; /* total time */
2626- unsigned int entries; /* times entered */
2727- } PROFILE;
2828-2929-typedef struct {
3030- address user; /* user return address */
3131- int function; /* index into profiles */
3232- time correction; /* nested call time */
3333- time start; /* entry time */
3434- } STACK;
3535-3636-#define LOCAL static /* local to profiler */
3737-#define MAX_PROFILES 200 /* routines to follow */
3838-#define MAX_STACK 200 /* max nested calls */
3939-#define MAX_TIME 500000L /* max time */
4040-4141-4242-/*
4343-4444- Select execution/compilation options.
4545-4646- SINGLE - each routine contains only its time
4747- TESTING - test profile package without LightspeedC PROFILE option
4848-4949- */
5050-5151-#define SINGLE /* single routine only */
5252-/* #define TESTING standalone testing */
5353-5454-5555-#ifdef TESTING
5656-#undef LOCAL /* make items visible */
5757-#define LOCAL
5858-#endif
5959-6060-6161-6262-LOCAL int depth = -1;
6363-LOCAL PROFILE profiles[MAX_PROFILES];
6464-LOCAL int profile_count = 0;
6565-LOCAL STACK stack[MAX_STACK];
6666-LOCAL int stack_pointer = -1;
6767-LOCAL time start_time;
6868-6969-int _profile = 1;
7070-int _trace = 0;
7171-7272-void DumpProfile();
7373-extern _profile_exit_();
7474-extern char *CtoPstr();
7575-extern char *PtoCstr();
7676-7777-#define _VIATIMER_ /* if this symbol is defined, the VIA timer now is used
7878- instead of TickCount -- it provides faster ticks,
7979- however there is a false precision to the numbers
8080- and there is a range of + or - 500 ticks since
8181- the VIAtimer is so fast that interrupts and such
8282- play a more significant time role.
8383-8484- NOTE THAT THIS PROFILE OPTION CANNOT BE USED WITH
8585- ANY PROGRAM THAT MANIPULATES THE #1 VIA timer */
8686-8787-8888-#ifdef _VIATIMER_
8989-9090-/* TickCount() - redefine TickCount trap to be a procedure for determining
9191- the timing according to the VIA timer */
9292-9393-#define VIAbase (*((unsigned char**)0x01D4))
9494-#define VIAt1lo (*(VIAbase+512*4))
9595-#define VIAt1hi (*(VIAbase+512*5))
9696-#define VIAmaxtime ~0
9797-9898-time TickCount()
9999-{
100100-static time timer=0;
101101-102102- if (timer > 0)
103103- {
104104- /* Use VIA timer #1 (sound driver) and to implement a fine
105105- resolution counter */
106106-107107- /* Find delta of VIA #1 */
108108-109109- timer += VIAmaxtime - (((unsigned short)VIAt1hi<<8)+VIAt1lo);
110110- }
111111- else
112112- timer = 1;
113113-114114- /* Reset VIA counter */
115115-116116- VIAt1hi = VIAmaxtime;
117117- VIAt1lo = VIAmaxtime;
118118-119119- return (timer);
120120-}
121121-122122-#endif _VIATIMER_
123123-124124-125125-/*
126126-127127- Compare two Pascal strings for equality.
128128-129129- */
130130-131131-LOCAL Bool pstreq( s1, s2 )
132132-register unsigned char *s1, *s2;
133133-{
134134- register int n = *s1;
135135-136136- if ((n = *s1++) != *s2++)
137137- return( false );
138138- while (n-- > 0)
139139- if (*s1++ != *s2++)
140140- return( false );
141141- return( true );
142142-}
143143-144144-145145-/*
146146-147147- Return the time difference caused by the overhead of function entry and
148148- timer call.
149149-150150- */
151151-152152-LOCAL time delta( original )
153153-time original;
154154-{
155155- return( (time) TickCount() - original );
156156-}
157157-158158-159159-/*
160160-161161- Lookup a name in the active profile table. For this system, "names" are
162162- the address of the routine. If the name is found in the table, then the
163163- index to the table entry is returned. If the name is not found and the
164164- insert flag is on, then the item is inserted, and the new table index
165165- is returned (if insert is false, then -1 is returned). If the profile
166166- table is full, then -1 is returned.
167167-168168- */
169169-170170-LOCAL int lookup( name, insert )
171171-char *name;
172172-Bool insert;
173173-{
174174- register int i;
175175-176176- for (i = 0; i < profile_count; i++)
177177- if (pstreq( profiles[i].name, name ))
178178- return( i );
179179- if ( insert && profile_count < MAX_PROFILES)
180180- { /* place in table - i points to correct entry */
181181- if (++profile_count == 1)
182182- { /* first time in */
183183- start_time = (time) TickCount();
184184- onexit( DumpProfile );
185185- }
186186- profiles[i].name = name;
187187- profiles[i].minimum = MAX_TIME;
188188- profiles[i].maximum =
189189- profiles[i].total = NULL;
190190- profiles[i].entries = 0;
191191- return( i );
192192- }
193193- return( -1 );
194194-}
195195-196196-197197-/*
198198-199199- Skip over to column 32 from position 'n'.
200200-201201- */
202202-203203-LOCAL void Skip( n )
204204-register int n;
205205-{
206206- for (; n < 32; n++)
207207- putchar( ' ' );
208208-}
209209-210210-211211-/*
212212-213213- Print the profile table on demand. Output is written to stdout and may
214214- be redirected with the Unix '>' mechanism to a file. The user should
215215- call this routine whenever a report is desired. Each time the routine is
216216- called, the program opens the map file which corresponds to the program
217217- running. The name of the map file is built by appending ".map" to the name
218218- of the running program. If the map file cannot be found then the routine
219219- returns.
220220-221221- */
222222-223223-void DumpProfile()
224224-{
225225- int j, k; /* generic loop variables */
226226- register int i; /* primary loop variable */
227227- register time duration = 0L; /* time in test regions */
228228-229229- _profile = 0; /* turn off profiling here */
230230-231231- for (i = 0; i < profile_count; i++)
232232- duration += profiles[i].total; /* compute total time */
233233-234234- printf( "\n\n" );
235235- printf( "\t\t\t\tRoutine Profiles\n\n" );
236236- printf( "Routine Address" );
237237- Skip( 15 );
238238- printf( " Minimum Maximum Average %% Entries\n" );
239239-240240- if (duration <= 0.0)
241241- duration++;
242242-243243- for (i = 0; i < profile_count; i++)
244244- { /* for all entries in the profile table */
245245- if (profiles[i].minimum == MAX_TIME)
246246- continue; /* routine entry, no exit */
247247- printf( "%s", PtoCstr( profiles[i].name ) );
248248- CtoPstr( profiles[i].name );
249249- Skip( profiles[i].name[0] );
250250- printf( "%9lu %9lu %9lu %3.0f %7u\n",
251251- profiles[i].minimum, profiles[i].maximum,
252252- profiles[i].average,
253253- ((float) profiles[i].total * 100.0) / (float) duration + 0.05,
254254- profiles[i].entries );
255255- }
256256-257257- _profile = 1; /* re-enable profiling */
258258-}
259259-260260-261261-/*
262262-263263- Called by assembler exit routine. Compute usage statistics for routine on
264264- top of profiling stack.
265265-266266- */
267267-268268-address __profile_exit()
269269-{
270270- int i;
271271- time exit_time = (time) TickCount();
272272-273273- depth--;
274274- /* end timing for a function */
275275-276276- i = stack[stack_pointer].function;
277277-#ifdef SINGLE
278278- exit_time = exit_time - delta( exit_time ) -
279279- stack[stack_pointer].start - stack[stack_pointer--].correction;
280280- if (exit_time > 0x7FFFFFFF)
281281- exit_time = 0L; /* handle clock rollover */
282282- profiles[i].total += exit_time;
283283- if (stack_pointer >= 0)
284284- stack[stack_pointer].correction += exit_time + stack[stack_pointer + 1].correction;
285285-#else
286286- exit_time = exit_time - delta( exit_time ) - stack[stack_pointer--].start;
287287- if (exit_time > 0x7FFFFFFF)
288288- exit_time = 0L; /* handle clock rollover */
289289- profiles[i].total += exit_time;
290290-#endif
291291- if (exit_time > profiles[i].maximum)
292292- profiles[i].maximum = exit_time;
293293- if (exit_time < profiles[i].minimum)
294294- profiles[i].minimum = exit_time;
295295- if (profiles[i].entries)
296296- profiles[i].average = profiles[i].total / profiles[i].entries;
297297- return( stack[stack_pointer + 1].user );
298298-}
299299-300300-301301-/*
302302-303303- Handle the routine entry profiling. Setup a stack frame and a profile
304304- table entry if needed.
305305-306306- */
307307-308308-void __profile( unused, ret, name )
309309-unsigned long *ret;
310310-address unused;
311311-char *name;
312312-{
313313- register int function, /* index of routine */
314314- i;
315315- register time entry_time = (time) TickCount();
316316-317317- depth++;
318318- if (_trace)
319319- {
320320- _profile = 0;
321321- for (i = 0; i < depth; i++)
322322- putchar( ' ' );
323323- printf( "%s\n", PtoCstr( name ) );
324324- CtoPstr( name );
325325- _profile = 1;
326326- }
327327- if (++stack_pointer < MAX_STACK)
328328- { /* setup for return to PROFILE_EXIT on user exit */
329329- stack[stack_pointer].user = (address) *ret;
330330- *ret = (unsigned long) _profile_exit_;
331331- stack[stack_pointer].correction = NULL;
332332- }
333333- else
334334- {
335335- depth--;
336336- return;
337337- }
338338-339339- if ((function = lookup( name, true )) >= 0)
340340- { /* process function entry */
341341- profiles[function].entries++;
342342- stack[stack_pointer].function = function;
343343- entry_time = TickCount();
344344- stack[stack_pointer].start = entry_time - delta( entry_time );
345345- }
346346- else
347347- { /* remove entry from stack */
348348- *ret = (unsigned long) stack[stack_pointer--].user;
349349- depth--;
350350- }
351351-}
-49
sources/profilehooks.c
···11-/*
22-33- Profile and tracing package for LightspeedC�.
44-55- (C) Copyright 1986 THINK Technologies, Inc. All rights reserved.
66-77-*/
88-99-extern void __profile();
1010-extern void __profile_exit();
1111-1212-/*
1313-;
1414-; Entry point for profiler. Add another parameter to the stack which is
1515-; a pointer to the return address of the caller of this function.
1616-;
1717-*/
1818-_profile_()
1919-{
2020-2121- asm
2222- {
2323- move.l (a7)+,d0 ; get current return address
2424- pea 4(a6) ; push pointer to return address
2525- move.l d0,-(a7) ; push back the return address
2626- jsr __profile ; call the C profiler
2727- move.l (a7)+,d0 ; get return address
2828- move.l d0,(a7) ; write on top of stack and return
2929- }
3030-}
3131-3232-/*
3333-;
3434-; Exit point for profiler. This calls the end of function timing routine
3535-; and returns to the user.
3636-;
3737-*/
3838-3939-_profile_exit_()
4040-{
4141- asm
4242- {
4343- move.l d0, -(a7) ; save old function result
4444- jsr __profile_exit ; call end of routine timer
4545- move.l d0, a0 ; save return address in A0
4646- move.l (a7)+, d0 ; retrieve old function result
4747- jmp (a0) ; then return
4848- }
4949-}
sources/qsort.c
C Libraries/sources/unix .c files/qsort.c
+4-4
sources/sane.h
C Libraries/headers/sane.h
···11/***************************************************************************
2233- Standard Apple Numeric Environment (SANE) interface for LightspeedC�.
33+ Standard Apple Numeric Environment (SANE) interface for LightspeedC.
4455 (C) Copyright 1986 THINK Technologies, Inc. All rights reserved.
66···145145 } NaN_codes;
146146147147148148-#define SetEnvironment(where) ( fp68k(where,FOSETENV) )
149149-#define GetEnvironment(where) ( fp68k(where,FOGETENV) )
148148+#define SetEnvironment(where) fp68k(where,FOSETENV)
149149+#define GetEnvironment(where) fp68k(where,FOGETENV)
150150151151-pascal void fp68k() = 0xA9EB; /* 68K arithemtic */
151151+pascal void fp68k() = 0xA9EB; /* 68K arithmetic */
152152pascal void elems68k() = 0xA9EC; /* elementary functions */
153153pascal void Dec2Str();
154154pascal void Str2Dec();
+1-1
sources/scanf1.c
C Libraries/sources/stdio .c files/scanf1.c
···11/*
22- scanf routines for LightspeedC�
22+ scanf routines for LightspeedC
3344 (C) Copyright 1986. THINK Technologies, Inc. All rights reserved.
55*/
+2-2
sources/scanf2.c
C Libraries/sources/stdio .c files/scanf2.c
···11/*
22- scanf routines for LightspeedC�
22+ scanf routines for LightspeedC
3344 (C) Copyright 1986. THINK Technologies, Inc. All rights reserved.
55*/
···457457458458 {Decimal _decimal_;
459459 int fblen = 0;
460460-460460+461461 scratch[0] = '\0';
462462 curr_char = skip_white();
463463
sources/setjmp.h
C Libraries/headers/setjmp.h
sources/signal.h
C Libraries/headers/signal.h
sources/std_decode.c
C Libraries/sources/stdio .c files/std_decode.c
+1-1
sources/stddata_ctype.c
C Libraries/sources/stdio .c files/stddata_ctype.c
···11/*
22- Routines for LightspeedC�
22+ Routines for LightspeedC
3344 (C) Copyright 1985, 1986. THINK Technologies, Inc. All rights reserved.
55*/
+1-1
sources/stddata_file.c
C Libraries/sources/stdio .c files/stddata_file.c
···11/*
22- Routines for LightspeedC�
22+ Routines for LightspeedC
3344 (C) Copyright 1985, 1986. THINK Technologies, Inc. All rights reserved.
55*/
+1-1
sources/stdfile_error.c
C Libraries/sources/stdio .c files/stdfile_error.c
···11/*
22- Routines for LightspeedC�
22+ Routines for LightspeedC
3344 (C) Copyright 1985, 1986. THINK Technologies, Inc. All rights reserved.
55*/
+1-1
sources/stdfile_pos.c
C Libraries/sources/stdio .c files/stdfile_pos.c
···11/*
22- Routines for LightspeedC�
22+ Routines for LightspeedC
3344 (C) Copyright 1985, 1986. THINK Technologies, Inc. All rights reserved.
55*/
+1-1
sources/stdfilebuf.c
C Libraries/sources/stdio .c files/stdfilebuf.c
···11/*
22- Routines for LightspeedC�
22+ Routines for LightspeedC
3344 (C) Copyright 1985, 1986. THINK Technologies, Inc. All rights reserved.
55*/
+1-1
sources/stdfwrite.c
C Libraries/sources/stdio .c files/stdfwrite.c
···11/*
22- Routines for LightspeedC�
22+ Routines for LightspeedC
3344 This file contains fwrite and fread.
55
+8-6
sources/stdget_console.c
C Libraries/sources/stdio .c files/stdget_console.c
···11/*
22- Routines for LightspeedC�
22+ Routines for LightspeedC
3344 (C) Copyright 1985, 1986. THINK Technologies, Inc. All rights reserved.
55···31313232int (*_key_int_sig_func_)() = 0;
33333434-#define AutoInt7 (*(long*) 0x7C)
3535-#define ROMBase (*(long*) 0x2AE)
3636-#define MaskPtr (*(long*) 0x31A)
3434+extern long ATrapHandler : 0x28;
3535+extern long ROMBase : 0x2AE;
3636+extern long Lo3Bytes : 0x31A;
3737+3838+#define DebuggerIn() ((ATrapHandler & Lo3Bytes) < (ROMBase & Lo3Bytes))
37393840/* pdg - 6/18/86 - completely revised command character handling of the
3941 following function to allow control characters to be
···167169 /* call debugger if loaded, then
168170 (or otherwise) depart */
169171170170- if ((AutoInt7 & MaskPtr) < ROMBase)
171171- DebugStr("\pSIGDFL reset!");
172172+ if (DebuggerIn())
173173+ Debugger();
172174173175 ExitToShell();
174176 }
+2-2
sources/stdgets.c
C Libraries/sources/stdio .c files/stdgets.c
···11/*
22- Routines for LightspeedC�
22+ Routines for LightspeedC
3344 (C) Copyright 1985, 1986. THINK Technologies, Inc. All rights reserved.
55···5050 c = _get_char_from_keyboard();
51515252 if ((_echo) && (c != EOF))
5353- putch(c);
5353+ fputc(c, who);
5454 return(c);
5555 }
5656
sources/stdio.h
C Libraries/headers/stdio.h
+1-1
sources/stdmax_min.c
C Libraries/sources/stdio .c files/stdmax_min.c
···11/*
22- max and min routines for LightspeedC�
22+ max and min routines for LightspeedC
3344 (C) Copyright 1985, 1986. THINK Technologies, Inc. All rights reserved.
55*/
+1-1
sources/stdopen.c
C Libraries/sources/stdio .c files/stdopen.c
···11/*
22- Routines for LightspeedC�
22+ Routines for LightspeedC
3344 (C) Copyright 1985, 1986. THINK Technologies, Inc. All rights reserved.
55*/
+1-1
sources/stdput_console.c
C Libraries/sources/stdio .c files/stdput_console.c
···11/*
22- Routines for LightspeedC�
22+ Routines for LightspeedC
3344 (C) Copyright 1985, 1986. THINK Technologies, Inc. All rights reserved.
55
+1-1
sources/stdputs.c
C Libraries/sources/stdio .c files/stdputs.c
···11/*
22- Routines for LightspeedC�
22+ Routines for LightspeedC
3344 (C) Copyright 1985, 1986. THINK Technologies, Inc. All rights reserved.
55
+4-4
sources/stdto..x.c
C Libraries/sources/stdio .c files/stdto..x.c
···11/*
22- Routines for LightspeedC�
22+ Routines for LightspeedC
3344 (C) Copyright 1985, 1986. THINK Technologies, Inc. All rights reserved.
55*/
···2121 if (! isxdigit(c))
2222 return(-1);
23232424- if (isxdigit(c))
2525- return(c-30);
2424+ if (isdigit(c))
2525+ return(c-'0');
2626 else
2727- return(toupper(c)-55);
2727+ return(toupper(c)-'A'+10);
2828}
29293030#line 0 toupper()
+4-6
sources/stdver.c
C Libraries/sources/stdio .c files/stdver.c
···11/*
22- Routines for LightspeedC�
22+ Routines for LightspeedC
3344 (C) Copyright 1986. THINK Technologies, Inc. All rights reserved.
55···1010 perfectly usable function that returns a pointer to a string that
1111 contains the version of standard i/o */
12121313-#define STDIO_VERSION "LightspeedC� Libraries 1.57"
1414-1513/* return the library version number of stdio */
1616-17141815#line 0 std_ver()
1916char *std_ver()
2017{
1818+static char STDIO_VERSION[] = "LightspeedC Libraries 2.15";
1919+static char copyright[] = "(C) 1986 THINK Technologies, Inc. All rights reserved.";
2020+2121 return (STDIO_VERSION);
2222-2323- "(C) Copyright 1986 THINK Technologies,Inc. All rights reserved";
2422}
+14-3
sources/storage.c
C Libraries/sources/storage .c files/storage.c
sources/storageu.c
C Libraries/sources/storage .c files/storageu.c
sources/storageu.h
C Libraries/headers/storageu.h
sources/strings.c
C Libraries/sources/strings .c files/strings.c
sources/strings.h
C Libraries/headers/strings.h
sources/stringsasm.c
C Libraries/sources/strings .c files/stringsasm.c
sources/time.h
C Libraries/headers/time.h
sources/types.h
C Libraries/headers/types.h
-133
sources/unix main.c
···11-/*************************************************************************
22- * *
33- * Module: unix main.c *
44- * Programmer: Steve Adams *
55- * *
66- * (C) Copyright 1985, THINK Technologies, Inc. All rights reserved. *
77- * *
88- * Alternate main program to handle Unix command lines under Lightspeed *
99- * C. The user is prompted for the command line on program entry. The *
1010- * line is disected and placed in an "argv" array up to a maximum of *
1111- * MAX_ARGS entries. I/O redirection is also supported, as follows: *
1212- * *
1313- * > redirects stdout to following file name *
1414- * < redirects stdin to following file name *
1515- * >> redirects stderr to following file name *
1616- * *
1717- * File names following a redirection may be immediately after the *
1818- * redirector, or at what appears to be the next argument. If a file *
1919- * open error occurs, then the program calls "SysBeep" and exits to the *
2020- * shell. *
2121- * *
2222- * TO USE: change the "main" function in you application to "_main" and *
2323- * include this file in your project. *
2424- * *
2525- *************************************************************************/
2626-2727-2828-#include <stdio.h>
2929-#include <ctype.h>
3030-3131-#define MAX_ARGS 50
3232-3333-#ifndef true
3434-#define true 1
3535-#define false 0
3636-#endif
3737-3838-static int argc = 1; /* final argument count */
3939-static char *argv[MAX_ARGS] = { "" }; /* array of pointers */
4040-static char command[256]; /* input line buffer */
4141-static int filename = false; /* TRUE iff file name */
4242-4343-4444-/*************************************************************************
4545- * *
4646- * Local routine to make a "beep" and exit to the shell. *
4747- * *
4848- *************************************************************************/
4949-5050-static void punt()
5151- {
5252- SysBeep( 5L );
5353- ExitToShell();
5454- }
5555-5656-5757-/*************************************************************************
5858- * *
5959- * Local routine to open a file in argv[--argc] after closing it's *
6060- * previous existance. *
6161- * *
6262- *************************************************************************/
6363-6464-6565-static void openfile( file, mode )
6666-char *mode; /* mode for file open */
6767-FILE *file; /* file pointer to use */
6868- {
6969-7070- if ( (file = freopen( argv[--argc], mode, file ) ) <= (FILE *) NULL)
7171- punt();
7272- filename = false;
7373- }
7474-7575-7676-/*************************************************************************
7777- * *
7878- * New main routine. Prompts for command line then calls user's main *
7979- * now called "_main" with the argument list and redirected I/O. *
8080- * *
8181- *************************************************************************/
8282-8383-8484-void main()
8585- {
8686- char c; /* temp for EOLN check */
8787- register char *cp; /* index in command line */
8888- char *mode; /* local file mode */
8989- FILE *file; /* file to change */
9090- int i;
9191-9292- printf( "Enter Unix command line:\n" );
9393- gets( &command ); /* allow user to edit */
9494- cp = &command[0]; /* start of buffer */
9595- argv[0] = ""; /* program name is NULL */
9696- while (argc < MAX_ARGS)
9797- { /* up to MAX_ARGS entries */
9898- while (isspace( *cp++ ));
9999- if ( !*--cp )
100100- break;
101101- else if ( *cp == '<' )
102102- { /* redirect stdin */
103103- cp++;
104104- file = stdin;
105105- mode = "r";
106106- filename = true;
107107- }
108108- else if ( *cp == '>' )
109109- {
110110- mode = "w";
111111- filename = true;
112112- if (*++cp == '>')
113113- {
114114- file = stderr;
115115- cp++;
116116- }
117117- else
118118- file = stdout;
119119- }
120120- else
121121- { /* either an argument or a filename */
122122- argv[argc++] = cp;
123123- while ( *++cp && !isspace( *cp ) );
124124- c = *cp;
125125- *cp++ = '\0';
126126- if (filename)
127127- openfile( file, mode );
128128- if (!c)
129129- break;
130130- }
131131- }
132132- _main( argc, argv );
133133- }
sources/unix.h
C Libraries/headers/unix.h
sources/unix2.c
C Libraries/sources/unix .c files/unix2.c
sources/unix3.c
C Libraries/sources/unix .c files/unix3.c
sources/unix_strings.c
C Libraries/sources/strings .c files/unix_strings.c
sources/unixatof.c
C Libraries/sources/unix .c files/unixatof.c
sources/unixatox.c
C Libraries/sources/unix .c files/unixatox.c
sources/unixexec.c
C Libraries/sources/unix .c files/unixexec.c
+7-5
sources/unixexit.c
C Libraries/sources/unix .c files/unixexit.c