diff --git a/code/SIBOSDK/ats/checkvid.bat b/code/SIBOSDK/ats/checkvid.bat new file mode 100644 index 0000000..5c6199f --- /dev/null +++ b/code/SIBOSDK/ats/checkvid.bat @@ -0,0 +1,2 @@ +@if not "%jpivid%"=="v2" set jpivid=v0 + diff --git a/code/SIBOSDK/ats/kats.afl b/code/SIBOSDK/ats/kats.afl new file mode 100644 index 0000000..e3981ed --- /dev/null +++ b/code/SIBOSDK/ats/kats.afl @@ -0,0 +1,2 @@ +kats.pic +kats.rsc diff --git a/code/SIBOSDK/ats/kats.c b/code/SIBOSDK/ats/kats.c new file mode 100644 index 0000000..4be199a --- /dev/null +++ b/code/SIBOSDK/ats/kats.c @@ -0,0 +1,498 @@ +/* + File: KATS.C +*/ + +#include +#include +#include +#include +#include +#include +#include +#include + +#define KATS_MODS (W_CTRL_MODIFIER|W_PSION_MODIFIER) +#define KATS_RECORD 0x20 +#define KATS_PLAYBACK W_KEY_RETURN +#define KATS_PLAYBACK2 W_KEY_TAB +#define KATS_SAVE W_KEY_DIAMOND + +#define MAX_NUM_KEYS 128 /* maximum number of keys per macro */ +#define MACRO_NAME_LEN 24 /* includes zero terminator */ + +typedef struct + { + TEXT name[MACRO_NAME_LEN]; + WORD num_keys; + ATS_KEY_DEF keys[MAX_NUM_KEYS]; + } KATS_MACRO; + +GLREF_D VOID *DatCommandPtr; +GLREF_D VOID *DatGate; + +LOCAL_D HANDLE olib; + +LOCAL_D VOID *vaxvar; +LOCAL_D UWORD nmacros; + +LOCAL_D KATS_MACRO mac_rec; /* macro being recorded */ +LOCAL_D ATS_KEY full_key; /* key being recorded */ + +LOCAL_D KATS_MACRO *mac_play; /* macro being played back */ +LOCAL_D INT play_keys; + +LOCAL_D INT changed; + +LOCAL_D INT pid; + +LOCAL_D INT record; +LOCAL_D INT playback; + +LOCAL_D WS_EV event; +LOCAL_D WORD rec_stat; +LOCAL_D WORD rec_active; +LOCAL_D WORD play_stat; +LOCAL_D WORD play_active; + +LOCAL_D TEXT *pmac_name; +LOCAL_D ATS_DIAL_DEF dl_edit; +LOCAL_D ATS_DIAL_DEF dl_choose; +LOCAL_D ATS_DIAL_DEF dl_confirm; +LOCAL_D ATS_DIAL_DEF dl_save; + +LOCAL_C INT GetForegroundClient(VOID) + { + UWORD pids[WS_MAX_CLIENTS+1]; + + wGetProcessList(&pids[0]); + return(pids[0]); + } + +LOCAL_C INT GetTestForegroundClient(VOID) + { + INT pid; + + pid=GetForegroundClient(); + if (!p_send3(DatGate,O_GT_CHECK_ATS_ON,pid)) + return(pid); /* okay */ + p_sound(5,320); + p_sound(5,280); + p_sound(5,240); + return(NULL); + } + +LOCAL_C VOID ForegroundAtsWait(INT type,ATS_MESS_BODY *pu) + { + INT pid; + + pid=GetTestForegroundClient(); + if (pid) + p_msendreceivew(pid,type,pu); + } + +LOCAL_C VOID Message(TEXT *msg) + { + ATS_MESS_BODY u; + + u.offs=msg; + ForegroundAtsWait(TY_ATS_MESSAGE,&u); + } + +LOCAL_C VOID TellErr(INT err) + { + TEXT buf[64]; + + if (err==E_GEN_FAIL) + return; + p_errs(&buf[0],err); + Message(&buf[0]); + } + +LOCAL_C VOID TellOom(VOID) + { + TellErr(E_GEN_NOMEMORY); + } + +LOCAL_C VOID PlayNextKey(VOID) + { + ATS_MESS_BODY u; + + u.k=mac_play->keys[play_keys]; + play_active=TRUE; + p_msendreceivea(pid,TY_ATS_KEY,&u,&play_stat); + } + +LOCAL_C VOID RequestNextKey(VOID) + { + ATS_MESS_BODY u; + + u.offs=(&full_key); + rec_active=TRUE; + p_msendreceivea(pid,TY_ATS_GET_KEY,&u,&rec_stat); + } + +LOCAL_C VOID TransmitRecordState(VOID) + { + ATS_MESS_BODY u; + + u.par=record; + p_msendreceivew(pid,TY_ATS_RECORD,&u); + } + +LOCAL_C KATS_MACRO *FindMacro(INT i) + { + return((KATS_MACRO *)p_send(vaxvar,O_VA_PBUF,i)); + } + +LOCAL_C VOID DeleteMacro(INT i) + { + p_send3(vaxvar,O_VA_DELETE,i); + nmacros--; + changed=TRUE; + } + +LOCAL_C INT QueryOverwrite(VOID) + { + ATS_MESS_BODY u; + + u.d=dl_confirm; + return(p_msendreceivew(pid,TY_ATS_DIALOG,&u)); + } + +LOCAL_C VOID SaveIfConfirmed(VOID) + { + INT pid; + ATS_MESS_BODY u; + + pid=GetTestForegroundClient(); + if (!pid) + return; + u.d=dl_save; + if (p_msendreceivew(pid,TY_ATS_DIALOG,&u)==W_KEY_RETURN) + { + Message("Should save now!"); + changed=FALSE; + } + } + +LOCAL_C INT CheckNotMatching(VOID) + { + INT i; + KATS_MACRO *pmac; + INT key; + + for (i=0; iname[0],&mac_rec.name[0])) + continue; + key=QueryOverwrite(); + if (key==W_KEY_ESCAPE) + return(FALSE); + DeleteMacro(i); + return(key==' '); + } + return(TRUE); + } + +LOCAL_C INT GetMacroName(VOID) + { + ATS_MESS_BODY u; + INT ret; + + u.d=dl_edit; + ret=p_msendreceivew(pid,TY_ATS_DIALOG,&u); + if (ret<0) + { + TellErr(ret); + return(0); + } + return(CheckNotMatching()); + } + +LOCAL_C VOID StartRecording(VOID) + { + pid=GetTestForegroundClient(); + if (!pid) + return; + if (GetMacroName()) + { + record=TRUE; + TransmitRecordState(); + Message("Recording..."); + mac_rec.num_keys=0; + RequestNextKey(); + } + } + +#pragma save,ENTER_CALL + +LOCAL_C INT AppendMacro(VOID) + { + RC_VAXVAR rcv; + + rcv.buf=(UBYTE *)(&mac_rec); + rcv.len=MACRO_NAME_LEN+sizeof(WORD)+mac_rec.num_keys*sizeof(ATS_KEY_DEF); + p_send3(vaxvar,O_VA_APPEND,&rcv); + nmacros++; + return(0); + } + +#pragma restore + +LOCAL_C VOID StopRecording(VOID) + { + record=FALSE; + TransmitRecordState(); + if (!mac_rec.num_keys) + { + Message("Recording cancelled"); + return; + } + if (p_enter1(AppendMacro)<0) + TellOom(); + else if (mac_rec.num_keys==MAX_NUM_KEYS) + Message("Maximum number of keystrokes reached"); + else + Message("Finished recording"); + } + +LOCAL_C VOID BuildNameList(VOID) + { + UBYTE *pb; + UBYTE *new_pb; + INT i; + INT size; + INT this_size; + KATS_MACRO *pmac; + + pb=p_alloc(1); + if (!pb) + return; + size=1; + *pb=0; + for (i=0; iname[0])+2; /* include LBC and ZTS */ + new_pb=p_realloc(pb,size+this_size); + if (!new_pb) + { + p_free(pb); + return; + } + pb=new_pb; + *(pb+size)=this_size-1; /* leading byte count */ + p_scpy(pb+size+1,&pmac->name[0]); + size+=this_size; + } + *pb=i; + dl_choose.buts=(UWORD)pb; + dl_choose.butslen=size; + } + +LOCAL_C VOID FreeNameList(VOID) + { + p_free((VOID *)dl_choose.buts); + dl_choose.buts=NULL; + } + +LOCAL_C VOID StartPlayback(VOID) + { + ATS_MESS_BODY u; + INT ret; + + pid=GetTestForegroundClient(); + if (!pid) + return; + BuildNameList(); + if (!dl_choose.buts) + { + TellOom(); + return; + } + u.d=dl_choose; + ret=p_msendreceivew(pid,TY_ATS_DIALOG,&u); + FreeNameList(); + if (ret<0) + { + TellErr(ret); + return; + } + mac_play=FindMacro(ret); + play_keys=0; + playback=TRUE; + PlayNextKey(); + } + +LOCAL_C VOID StopPlayback(VOID) + { + playback=FALSE; + } + +LOCAL_C VOID NextStageInRecord(VOID) + { + ATS_KEY_DEF *short_key; + + short_key=(&mac_rec.keys[mac_rec.num_keys++]); + short_key->key=full_key.keycode; + short_key->mod=full_key.modifiers; + changed=TRUE; + if (mac_rec.num_keys==MAX_NUM_KEYS) + StopRecording(); + else + RequestNextKey(); + } + +LOCAL_C VOID NextStageInPlayback(VOID) + { + play_keys++; + if (play_keys==mac_play->num_keys) + { + StopPlayback(); + Message("Playback complete"); + } + else + PlayNextKey(); + } + +LOCAL_C VOID MainLoop(VOID) + { + FOREVER + { + wGetEvent(&event); + wait: + p_iowait(); + switch (event.type) + { + case E_FILE_PENDING: + if (rec_active && rec_stat!=E_FILE_PENDING) + { + rec_active=FALSE; + if (record) /* else recording cancelled */ + NextStageInRecord(); + } + else if (play_active && play_stat!=E_FILE_PENDING) + { + play_active=FALSE; + if (playback) /* else playback cancelled */ + NextStageInPlayback(); + } + goto wait; + case WM_FOREGROUND: + wClientPosition(WS_LAST_CLIENT_POSITION,0); + break; + case WM_KEY: + switch (event.p.key.keycode) + { + case KATS_SAVE: + if (record) + Message("Can't save macros while recording"); + else if (playback) + Message("Can't save macros while playing back"); + else if (!changed) + Message("No macro changes to save"); + else + SaveIfConfirmed(); + break; + case KATS_RECORD: + if (record) + StopRecording(); + else if (playback) + Message("Can't record while playing back"); + else + StartRecording(); + break; + case KATS_PLAYBACK: + case KATS_PLAYBACK2: + if (playback) + { + Message("Playback terminated"); + StopPlayback(); + } + else if (record) + Message("Can't play back while recording"); + else if (!nmacros) + Message("Nothing to play back"); + else + StartPlayback(); + } + } + } + } + +LOCAL_C VOID FindOlib(VOID) + { + p_findlib("OLIB.DYL",&olib); + } + +LOCAL_C VOID CreateGate(VOID) + { + HANDLE hwim; + + p_findlib("HWIM.DYL",&hwim); + DatGate=f_newlibh(hwim,C_GATE); + } + +LOCAL_C VOID LoadDialogData(VOID) + { + VOID *rcb; + + rcb=f_newlibhsend(olib,C_RSCFILE,O_RS_INIT,DatCommandPtr); + dl_edit.mainlen=p_send4(rcb,O_RS_READ,KATS_DL_MAC_NAME,&dl_edit.main); + dl_choose.mainlen=p_send4(rcb,O_RS_READ,KATS_DL_PLAYBACK,&dl_choose.main); + dl_confirm.mainlen=p_send4(rcb,O_RS_READ, + KATS_DL_CONFIRM,&dl_confirm.main); + dl_confirm.butslen=p_send4(rcb,O_RS_READ, + KATS_AC_CONFIRM,&dl_confirm.buts); + dl_save.mainlen=p_send4(rcb,O_RS_READ,KATS_DL_SAVE,&dl_save.main); + dl_save.butslen=p_send4(rcb,O_RS_READ,KATS_AC_SAVE,&dl_save.buts); + p_send2(rcb,O_DESTROY); + dl_edit.butslen=(-2); + dl_edit.buts=(UWORD)(&pmac_name); + pmac_name=(&mac_rec.name[0]); + } + +LOCAL_C VOID CreateMacroStorage(VOID) + { + vaxvar=f_newlibhsend(olib,C_VAXVAR,O_VA_INIT,48); + } + +LOCAL_C VOID ConnectToWindowServer(VOID) + { + wConnect(f_alloc(sizeof(WSERV_SPEC)),0,W_CONNECT_AT_BACK); + } + +LOCAL_C VOID CaptureKeys(VOID) + { + wCaptureKey(KATS_RECORD,KATS_MODS,KATS_MODS); + wCaptureKey(KATS_PLAYBACK,KATS_MODS,KATS_MODS); + wCaptureKey(KATS_PLAYBACK2,KATS_MODS,KATS_MODS); + wCaptureKey(KATS_SAVE,KATS_MODS,KATS_MODS); + } + +#pragma save,ENTER_CALL + +LOCAL_C INT Initialise(VOID) + { + FindOlib(); + CreateGate(); + LoadDialogData(); + CreateMacroStorage(); + ConnectToWindowServer(); + CaptureKeys(); + Message("Keyboard macro support loaded"); + return(0); + } + +#pragma restore + +GLDEF_C INT main(VOID) + { + INT ret; + + ret=p_enter1(Initialise); + if (!ret) + MainLoop(); + return(ret); + } diff --git a/code/SIBOSDK/ats/kats.pic b/code/SIBOSDK/ats/kats.pic new file mode 100644 index 0000000..f9206fe Binary files /dev/null and b/code/SIBOSDK/ats/kats.pic differ diff --git a/code/SIBOSDK/ats/kats.pr b/code/SIBOSDK/ats/kats.pr new file mode 100644 index 0000000..99b81f0 --- /dev/null +++ b/code/SIBOSDK/ats/kats.pr @@ -0,0 +1,13 @@ +#system epoc img +#model small jpi + +#if (%main.rsg #older %main.rss) #or (%main.rsc #older %main.rss) #then + #run "rs %main" no_window no_abort +#endif +#if (%main.img #older %main.afl) #or (%main.img #older %main.pic) #then + #file delete %main.img +#endif +#compile %main +#link %main + + diff --git a/code/SIBOSDK/ats/kats.rss b/code/SIBOSDK/ats/kats.rss new file mode 100644 index 0000000..e550b56 --- /dev/null +++ b/code/SIBOSDK/ats/kats.rss @@ -0,0 +1,102 @@ +#include +#include + +RESOURCE DIALOG kats_dl_mac_name + { + title="Record keyboard macro"; + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_RBUF_FILLED; + controls= + { + CONTROL + { + class=C_EDWIN; + prompt="Name for macro"; + info=EDWIN + { + flags=IN_EDWIN_VULEN_CHARACTERS; + vulen=16; + maxlen=23; + }; + } + }; + } + +RESOURCE DIALOG kats_dl_playback + { + title="Playback keyboard macro"; + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_RBUF_FILLED; + controls= + { + CONTROL + { + class=C_CHLIST; + prompt="Macro name"; + info=CHLIST { }; + } + }; + } + +RESOURCE ACLIST_ARRAY kats_ac_confirm + { + button = + { + PUSH_BUT + { + keycode=W_KEY_ESCAPE; + str="Cancel"; + }, + PUSH_BUT + { + keycode=W_KEY_SPACE; + str="Overwrite"; + }, + PUSH_BUT + { + keycode=W_KEY_DELETE_LEFT; + str="Delete"; + } + }; + } + +RESOURCE DIALOG kats_dl_confirm + { + title="Name already exists"; + controls= + { + CONTROL + { + class=C_ACLIST; + info=ACLIST { rid=kats_ac_confirm; }; + } + }; + } + +RESOURCE ACLIST_ARRAY kats_ac_save + { + button = + { + PUSH_BUT + { + keycode=W_KEY_ESCAPE; + str="Cancel"; + }, + PUSH_BUT + { + keycode=W_KEY_RETURN; + str="Confirm"; + } + }; + } + +RESOURCE DIALOG kats_dl_save + { + title="Save macros to file"; + controls= + { + CONTROL + { + class=C_ACLIST; + info=ACLIST { rid=kats_ac_save; }; + } + }; + } diff --git a/code/SIBOSDK/ats/make.bat b/code/SIBOSDK/ats/make.bat new file mode 100644 index 0000000..319ca30 --- /dev/null +++ b/code/SIBOSDK/ats/make.bat @@ -0,0 +1,9 @@ +@echo off +call checkvid +if not exist %1.pr goto error +tscx /m %1 /%jpivid% +tscx /m %1 /%jpivid% +goto end +:error +echo Project file %1.pr does not exist +:end diff --git a/code/SIBOSDK/ats/vid.bat b/code/SIBOSDK/ats/vid.bat new file mode 100644 index 0000000..4ccb4d5 --- /dev/null +++ b/code/SIBOSDK/ats/vid.bat @@ -0,0 +1,22 @@ +@echo off +goto X%1X +:Xv0X +:XoffX +set jpivid=v0 +echo VID is now OFF +goto :end +:Xv2X +:XonX +set jpivid=v2 +echo VID is now ON +goto :end +:XX +call checkvid +goto %jpivid% +:v0 +echo VID is OFF +goto end +:v2 +echo VID is ON +:end + diff --git a/code/SIBOSDK/demo/alert.c b/code/SIBOSDK/demo/alert.c new file mode 100644 index 0000000..878ba01 --- /dev/null +++ b/code/SIBOSDK/demo/alert.c @@ -0,0 +1,50 @@ +#include +#include + +GLREF_D TEXT *DatStatusNamePtr; + +LOCAL_D WSERV_SPEC wSpec; + +LOCAL_C VOID CDECL Alert3(TEXT *m1,TEXT *m2,TEXT *m3) + { + TEXT *pt; + TEXT **pps; + DESC *pd,*pdend; + struct { + WORD zero; + DESC line[3]; + TEXT buf[W_ALERT_TEXT_MAX_LEN]; + } al; + + al.zero=0; + pt=&al.buf[0]; + pps=&m1; + for (pd=&al.line[0],pdend=pd+3;pdhposition=0xff; + pd->length=p_slen(*pps); + pd->offset=pt-(TEXT *)&al; + pt=(TEXT *)p_bcpy(pt,*pps++,pd->length); + } + wsAlertW(WS_ALERT_CLIENT,(TEXT *)&al,NULL,NULL); + } + +LOCAL_C VOID AlertErr(INT err,TEXT *msg) + { + TEXT bb[3]; + + bb[0]=0; + bb[1]=0xfe; + bb[2]=err; + wsAlertW(WS_ALERT_CLIENT,msg,&bb[0],NULL); + } + +GLDEF_C INT main(VOID) + { + DatStatusNamePtr="Sample"; + wConnect(&wSpec,0,W_CONNECT_PRIORITY); + wsAlertW(WS_ALERT_CLIENT,"Hello World",NULL,NULL); + AlertErr(E_GEN_NOMEMORY,"Failed to save"); + Alert3("Line 1","Line 2","Line 3"); + return(0); + } diff --git a/code/SIBOSDK/demo/bldall.bat b/code/SIBOSDK/demo/bldall.bat new file mode 100644 index 0000000..09612ff --- /dev/null +++ b/code/SIBOSDK/demo/bldall.bat @@ -0,0 +1,22 @@ +CALL MAKE HELLO +CALL MAKE P_HELLO +CALL MAKE P_COMP +CALL MAKE P_DLIST +CALL MAKE P_PRNDIR +CALL MAKE P_SEARCH +CALL MAKE EVENTS +CALL MAKE SUBPROC +CALL MAKE EVENTS2 +CALL MAKE EVENTS3 +CALL MAKE EVENTS4 +CALL MAKE W_HELLO +CALL MAKE GAUGE +CALL MAKE LINED +CALL MAKE SCAPT +CALL MAKE FONTS +CALL MAKE HCSHELL +CALL MAKE LKSHELL +CALL MAKE ALERT +CALL MAKE CLOCK +CALL MAKE BUTTON +CALL MAKE SOUND diff --git a/code/SIBOSDK/demo/button.c b/code/SIBOSDK/demo/button.c new file mode 100644 index 0000000..1d1b345 --- /dev/null +++ b/code/SIBOSDK/demo/button.c @@ -0,0 +1,75 @@ +/* +BUTTON.C +*/ + +#include +#include + +LOCAL_D WSERV_SPEC wSpec; +LOCAL_D UINT wMainWid; +LOCAL_D UINT FontID; +LOCAL_D UINT FontStyle; +LOCAL_D G_FONT_INFO FontInfo; + +LOCAL_C VOID SetFont(INT fid,INT style) + { + gFontInfo(FontID=fid,FontStyle=style,&FontInfo); + } + +LOCAL_C VOID SetGC(VOID) + { + G_GC gc; + + gc.font=FontID; + gc.style=FontStyle; + gSetGC(0,G_GC_MASK_FONT|G_GC_MASK_STYLE,&gc); + } + +LOCAL_C VOID DrawButton(INT state) + { + P_RECT rect; + + rect.tl.x=20; + rect.tl.y=(40-2)-FontInfo.height; + rect.br.x=140; + rect.br.y=(40+2)+FontInfo.height; + wDrawButton(&rect,"Press any key",state); + } + +LOCAL_C VOID MainEventLoop(VOID) + { + WS_EV event; + + for (;;) + { + wGetEventWait(&event); + if (event.type==WM_REDRAW) + { + wBeginRedrawWinGC0(wMainWid); + gBorder(W_BORD_SHADOW_D|W_BORD_SHADOW_ON); + SetGC(); + DrawButton(FALSE); + wEndRedraw(); + continue; + } + if (event.type==WM_KEY) + { + gCreateTempGC0(wMainWid); + SetGC(); + DrawButton(TRUE); + wFlush(); + p_sleep(5l); + DrawButton(FALSE); + gFreeTempGC(); + } + } + } + +GLDEF_C VOID main(VOID) + { + wConnect(&wSpec,0,W_CONNECT_PRIORITY); + wMainWid=wCreateWindow(0,0,0,1); + wInitialiseWindowTree(wMainWid); + SetFont(WS_FONT_SYSTEM,G_STY_BOLD); + MainEventLoop(); + } diff --git a/code/SIBOSDK/demo/cc.bat b/code/SIBOSDK/demo/cc.bat new file mode 100644 index 0000000..42c025d --- /dev/null +++ b/code/SIBOSDK/demo/cc.bat @@ -0,0 +1,8 @@ +@echo off +call checkvid +if exist %1.pr goto custom +tsc %1.c /fpunnamed /%jpivid% +goto end +:custom +tsc %1.c /fp%1 /%jpivid% +:end diff --git a/code/SIBOSDK/demo/checkvid.bat b/code/SIBOSDK/demo/checkvid.bat new file mode 100644 index 0000000..5c6199f --- /dev/null +++ b/code/SIBOSDK/demo/checkvid.bat @@ -0,0 +1,2 @@ +@if not "%jpivid%"=="v2" set jpivid=v0 + diff --git a/code/SIBOSDK/demo/clock.c b/code/SIBOSDK/demo/clock.c new file mode 100644 index 0000000..83570c3 --- /dev/null +++ b/code/SIBOSDK/demo/clock.c @@ -0,0 +1,40 @@ +/* +CLOCK.C +*/ + +#include +#include + +LOCAL_D WSERV_SPEC wSpec; +LOCAL_D UINT wMainWid; + +LOCAL_C VOID MainEventLoop(VOID) + { + WS_EV event; + + for (;;) + { + wGetEventWait(&event); + if (event.type==WM_REDRAW) + { + wBeginRedrawWinGC0(wMainWid); + gBorder(W_BORD_SHADOW_D|W_BORD_SHADOW_ON); + wEndRedraw(); + } + } + } + +GLDEF_C VOID main(VOID) + { + wConnect(&wSpec,0,W_CONNECT_PRIORITY); + wMainWid=wCreateWindow(0,0,0,1); + wsCreateClock(wMainWid,WS_CLOCK_LARGE_ANALOG|WS_CLOCK_WITH_SECONDS,4,4,0); + wsCreateClock(wMainWid,WS_CLOCK_MEDIUM|WS_CLOCK_FORCE_DIGITAL| + WS_CLOCK_WITH_DATE,4+66+6,4,0); + wsCreateClock(wMainWid,WS_CLOCK_MEDIUM|WS_CLOCK_FORCE_ANALOG| + WS_CLOCK_WITH_DATE,4+66+6+36+6,4,0); + wsCreateClock(wMainWid,WS_CLOCK_SMALL_DIGITAL|WS_CLOCK_WITH_DATE| + WS_CLOCK_WITH_SECONDS,104,66,0); + wInitialiseWindowTree(wMainWid); + MainEventLoop(); + } diff --git a/code/SIBOSDK/demo/demo.prj b/code/SIBOSDK/demo/demo.prj new file mode 100644 index 0000000..e75a6e5 --- /dev/null +++ b/code/SIBOSDK/demo/demo.prj @@ -0,0 +1,82 @@ +DEMO.PRJ ! This file +READ.ME ! About the \sibosdk\demo directory +BLDALL.BAT ! Build everything in this directory +! +! ========================== +! General Programming Manual +! +! Building An Application +HELLO.C ! A first example application (using CLIB) +HELLO.PR ! Jpi project file for the above +P_HELLO.C ! A PLIB version of Hello World +P_HELLO.PR ! Jpi project file for the above +! +! Housekeeping batch files and re-using project files +UNNAMED.PR ! General (single source file) project file for Plib +CC.BAT ! For Brief-style test compiles +MAKE.BAT ! Intelligent make batch file +VID.BAT ! Sets/senses JPIVID environment variable +CHECKVID.BAT ! Used in above batch files +! +! Fundamental Programming Guidelines +EVENTS.C ! First version of Events +SUBPROC.H ! Header file for SUBPROC +SUBPROC.C ! Program launched as a subprocess +EVENTS2.C ! Second version of Events +EVENTS3.C ! Third version of Events +EVENTS4.C ! Fourth version of Events +! +! ==================== +! HC Programming Guide +! +! Writing Software for the HC: Example programs +W_HELLO.C ! A graphics version of Hello World +GAUGE.C ! Graphics and timers illustrated +LINED.C ! Line editor code and test code +LINED.H ! Line editor header file +! +! ========================== +! Series 3/3a Programming Guide +! +! Enhanced Sound Output +SOUND.C ! Using the SND: device driver on the Series 3a +! +! ============================= +! Additional System Information +! +! Resource Files +READRSC.C ! Reading the contents of a resource file +! +! ============== +! PLIB Reference +! +! Files +P_DLIST.C ! Using p_dinfo to list devices +P_PRNDIR.C ! Using p_open(P_FDIR) to list a directory +P_COMP.C ! Binary file access (comparing two files) +P_SEARCH.C ! Text file access (p_read to search a text file) +! +! ======================= +! Window Server Reference +! +! Introduction: Bitmaps +PCXSAVE.C ! Capturing the screen directly to a PCX file +SCAPT.C ! Screen capture program using MCLINK RUN +SCAPT.PR ! Jpi project file for the above +! +! Introduction: Text fonts +FONTS.C ! The program that generated the font pictures +! +! Introduction: System start-up: Replacing the shell on the HC +HCSHELL.C ! Sample shell/application +LKSHELL.C ! Minimal shell for remote debugging on the HC +LKSHELL.PR ! Defines small stack +! +! General window server functions: wsAlertW +ALERT.C ! Alert3 example of calling wsAlertW +! +! Windows: Clocks +CLOCK.C ! Clocks demonstration for the HC +! +! Graphics output: wDrawButton +BUTTON.C ! Intended use of wDrawButton diff --git a/code/SIBOSDK/demo/events.c b/code/SIBOSDK/demo/events.c new file mode 100644 index 0000000..2bcbe22 --- /dev/null +++ b/code/SIBOSDK/demo/events.c @@ -0,0 +1,136 @@ +/* EVENTS.C */ + +#include +#include +#include +#include +#include + + +LOCAL_D VOID *timH; +LOCAL_D WORD timstat; +LOCAL_D WORD counter; +LOCAL_D ULONG timint; + +LOCAL_D VOID *conH; +LOCAL_D WORD keystat; +LOCAL_D P_CON_KBREC key; + +#define MAX_COUNT 100 + + +LOCAL_C VOID QueueKey(VOID) + { + p_ioa4(conH,P_FREAD,&keystat,&key); + } + +LOCAL_C VOID QueueTimer(VOID) + { + p_ioa4(timH,P_FRELATIVE,&timstat,&timint); + } + +LOCAL_C VOID CancelTimer(VOID) + { + p_iow2(timH,P_FCANCEL); + p_waitstat(&timstat); + } + +LOCAL_C VOID Check(INT val,TEXT *msg) + { + TEXT buf[30]; + + if (!val) + return; + p_atos(&buf[0],"Failed to open %s",msg); + p_notifyerr(val,&buf[0],0,0,0); + p_exit(0); + } + +LOCAL_C VOID OpenTimer(VOID) + { + Check(p_open(&timH,"TIM:",-1),"timer"); + } + +LOCAL_C VOID OpenConsole(VOID) + { + P_RECT rect; + WORD func; + + Check(p_open(&conH,"CON:",-1),"console"); + rect.tl.x=rect.tl.y=0; + rect.br.x=25; + rect.br.y=9; + func=P_SCR_WSET; + Check(p_iow4(conH,P_FSET,&func,&rect),"console"); + } + +LOCAL_C VOID SetTimInt(INT new) + { + CancelTimer(); + timint=new; + QueueTimer(); + } + +LOCAL_C VOID Write(INT x,INT y,TEXT *pb,INT len) + { + P_POINT pos; + WORD func; + + pos.x=x; + pos.y=y; + func=P_SCR_POSA; + p_iow4(conH,P_FSET,&func,&pos); + p_write(conH,pb,len); + } + +LOCAL_C VOID DisplayCount(VOID) + { + TEXT buf[4]; + + p_atos(&buf[0],"%3d",counter); + Write(10,2,&buf[0],3); + } + +LOCAL_C VOID DrawBorder(VOID) + { + TEXT buf[26]; + INT i; + + p_bfil(&buf[0],26,'*'); + Write(0,0,&buf[0],25); + for (i=1; i<8; i++) + { + Write(0,i,&buf[0],1); + Write(24,i,&buf[0],1); + } + Write(0,8,&buf[0],25); + } + +GLDEF_C VOID main(VOID) + { + OpenConsole(); + DrawBorder(); + OpenTimer(); + timint=10; + QueueTimer(); + QueueKey(); + FOREVER + { + p_iowait(); + if (keystat!=E_FILE_PENDING) + { + if (key.keycode==W_KEY_ESCAPE) + p_exit(0); + if (key.keycode>='1' && key.keycode<='9') + SetTimInt(2*(key.keycode-'0')); + QueueKey(); + } + else if (timstat!=E_FILE_PENDING) + { + if (counter++==MAX_COUNT) + counter=1; + DisplayCount(); + QueueTimer(); + } + } + } diff --git a/code/SIBOSDK/demo/events2.c b/code/SIBOSDK/demo/events2.c new file mode 100644 index 0000000..4cd58b4 --- /dev/null +++ b/code/SIBOSDK/demo/events2.c @@ -0,0 +1,200 @@ +/* EVENTS2.C */ + +#include +#include +#include +#include +#include +#include "subproc.h" + + +GLREF_C TEXT *DatCommandPtr; + +LOCAL_D VOID *timH; +LOCAL_D WORD timstat; +LOCAL_D WORD counter; +LOCAL_D ULONG timint; + +LOCAL_D VOID *conH; +LOCAL_D WORD keystat; +LOCAL_D P_CON_KBREC key; + +LOCAL_D WORD subexist; +LOCAL_D WORD substat; +LOCAL_D WORD answer; + +#define MAX_COUNT 100 + + +LOCAL_C VOID QueueKey(VOID) + { + p_ioa4(conH,P_FREAD,&keystat,&key); + } + +LOCAL_C VOID QueueTimer(VOID) + { + p_ioa4(timH,P_FRELATIVE,&timstat,&timint); + } + +LOCAL_C VOID CancelTimer(VOID) + { + p_iow2(timH,P_FCANCEL); + p_waitstat(&timstat); + } + +LOCAL_C VOID Check(INT val,TEXT *msg) + { + TEXT buf[30]; + + if (!val) + return; + p_atos(&buf[0],"Failed to open %s",msg); + p_notifyerr(val,&buf[0],0,0,0); + p_exit(0); + } + +LOCAL_C VOID OpenTimer(VOID) + { + Check(p_open(&timH,"TIM:",-1),"timer"); + } + +LOCAL_C VOID OpenConsole(VOID) + { + P_RECT rect; + WORD func; + + Check(p_open(&conH,"CON:",-1),"console"); + rect.tl.x=rect.tl.y=0; + rect.br.x=25; + rect.br.y=9; + func=P_SCR_WSET; + Check(p_iow4(conH,P_FSET,&func,&rect),"console"); + } + +LOCAL_C VOID SetTimInt(INT new) + { + CancelTimer(); + timint=new; + QueueTimer(); + } + +LOCAL_C VOID Write(INT x,INT y,TEXT *pb,INT len) + { + P_POINT pos; + WORD func; + + pos.x=x; + pos.y=y; + func=P_SCR_POSA; + p_iow4(conH,P_FSET,&func,&pos); + p_write(conH,pb,len); + } + +LOCAL_C VOID DisplayCount(VOID) + { + TEXT buf[4]; + + p_atos(&buf[0],"%3d",counter); + Write(10,2,&buf[0],3); + } + +LOCAL_C VOID DrawBorder(VOID) + { + TEXT buf[26]; + INT i; + + p_bfil(&buf[0],26,'*'); + Write(0,0,&buf[0],25); + for (i=1; i<8; i++) + { + Write(0,i,&buf[0],1); + Write(24,i,&buf[0],1); + } + Write(0,8,&buf[0],25); + } + +LOCAL_C VOID Message(TEXT *pb) + { + TEXT buf[22]; + INT len; + + p_bfil(&buf[0],22,' '); + len=p_slen(pb); + p_bcpy(&buf[10-len/2],pb,len); + Write(2,6,&buf[0],21); + } + +LOCAL_C VOID LaunchSub(VOID) + { + HANDLE pid; + SUBPROC_CL cl; + TEXT subname[P_FNAMESIZE]; + + if (subexist) + { + p_sound(-5,320); + return; + } + p_fparse("subproc.img",DatCommandPtr,&subname[0],0); + cl.pid=p_getpid(); + cl.poff=(&answer); + cl.data=p_date(); + if ((pid=p_execc(&subname[0],&cl,sizeof(cl)))<0) + { + p_notifyerr(pid,"Failed to launch subprocess",0,0,0); + return; + } + p_logona(pid,&substat); + subexist=TRUE; + Message("Subp launched"); + p_presume(pid); + } + +LOCAL_C VOID ReportSub(VOID) + { + TEXT buf[22]; + + subexist=FALSE; + if (substat) + Message("Subp abnormal exit"); + else + { + p_atos(&buf[0],"Subp slept %d ticks",answer); + Message(&buf[0]); + } + } + +GLDEF_C VOID main(VOID) + { + p_unmarka(); + OpenConsole(); + DrawBorder(); + OpenTimer(); + timint=10; + QueueTimer(); + QueueKey(); + LaunchSub(); + FOREVER + { + p_iowait(); + if (keystat!=E_FILE_PENDING) + { + if (key.keycode==W_KEY_ESCAPE) + p_exit(0); + if (key.keycode==W_KEY_RETURN) + LaunchSub(); + else if (key.keycode>='1' && key.keycode<='9') + SetTimInt(2*(key.keycode-'0')); + QueueKey(); + } + else if (timstat!=E_FILE_PENDING) + { + if (counter++==MAX_COUNT) + counter=1; + DisplayCount(); + QueueTimer(); + } + else if (substat!=E_FILE_PENDING) + ReportSub(); + } + } diff --git a/code/SIBOSDK/demo/events3.c b/code/SIBOSDK/demo/events3.c new file mode 100644 index 0000000..308bd58 --- /dev/null +++ b/code/SIBOSDK/demo/events3.c @@ -0,0 +1,252 @@ +/* EVENTS3.C */ + +#include +#include +#include +#include +#include +#include "subproc.h" + + +GLREF_C TEXT *DatCommandPtr; + +LOCAL_D VOID *timH; +LOCAL_D WORD timstat; +LOCAL_D WORD counter; +LOCAL_D ULONG timint; + +LOCAL_D VOID *conH; +LOCAL_D WORD keystat; +LOCAL_D P_CON_KBREC key; + +LOCAL_D WORD subexist; +LOCAL_D WORD substat; +LOCAL_D WORD answer; + +LOCAL_D VOID *serH; +LOCAL_D WORD serstat; +LOCAL_D WORD serlen; +LOCAL_D TEXT serbuf[2]; +LOCAL_D WORD serpos; + +#define MAX_COUNT 100 +#define MAX_SERPOS 11 + + +LOCAL_C VOID QueueKey(VOID) + { + p_ioa4(conH,P_FREAD,&keystat,&key); + } + +LOCAL_C VOID QueueTimer(VOID) + { + p_ioa4(timH,P_FRELATIVE,&timstat,&timint); + } + +LOCAL_C VOID CancelTimer(VOID) + { + p_iow2(timH,P_FCANCEL); + p_waitstat(&timstat); + } + +LOCAL_C VOID Check(INT val,TEXT *msg) + { + TEXT buf[30]; + + if (!val) + return; + p_atos(&buf[0],"Failed to open %s",msg); + p_notifyerr(val,&buf[0],0,0,0); + p_exit(0); + } + +LOCAL_C VOID OpenTimer(VOID) + { + Check(p_open(&timH,"TIM:",-1),"timer"); + } + +LOCAL_C VOID OpenConsole(VOID) + { + P_RECT rect; + WORD func; + + Check(p_open(&conH,"CON:",-1),"console"); + rect.tl.x=rect.tl.y=0; + rect.br.x=25; + rect.br.y=9; + func=P_SCR_WSET; + Check(p_iow4(conH,P_FSET,&func,&rect),"console"); + } + +LOCAL_C VOID SetTimInt(INT new) + { + CancelTimer(); + timint=new; + QueueTimer(); + } + +LOCAL_C VOID Write(INT x,INT y,TEXT *pb,INT len) + { + P_POINT pos; + WORD func; + + pos.x=x; + pos.y=y; + func=P_SCR_POSA; + p_iow4(conH,P_FSET,&func,&pos); + p_write(conH,pb,len); + } + +LOCAL_C VOID DisplayCount(VOID) + { + TEXT buf[4]; + + p_atos(&buf[0],"%3d",counter); + Write(10,2,&buf[0],3); + } + +LOCAL_C VOID DrawBorder(VOID) + { + TEXT buf[26]; + INT i; + + p_bfil(&buf[0],26,'*'); + Write(0,0,&buf[0],25); + for (i=1; i<8; i++) + { + Write(0,i,&buf[0],1); + Write(24,i,&buf[0],1); + } + Write(0,8,&buf[0],25); + } + +LOCAL_C VOID Message(TEXT *pb) + { + TEXT buf[22]; + INT len; + + p_bfil(&buf[0],22,' '); + len=p_slen(pb); + p_bcpy(&buf[10-len/2],pb,len); + Write(2,6,&buf[0],21); + } + +LOCAL_C VOID LaunchSub(VOID) + { + HANDLE pid; + SUBPROC_CL cl; + TEXT subname[P_FNAMESIZE]; + + if (subexist) + { + p_sound(-5,320); + return; + } + p_fparse("subproc.img",DatCommandPtr,&subname[0],0); + cl.pid=p_getpid(); + cl.poff=(&answer); + cl.data=p_date(); + if ((pid=p_execc(&subname[0],&cl,sizeof(cl)))<0) + { + p_notifyerr(pid,"Failed to launch subprocess",0,0,0); + return; + } + p_logona(pid,&substat); + subexist=TRUE; + Message("Subp launched"); + p_presume(pid); + } + +LOCAL_C VOID ReportSub(VOID) + { + TEXT buf[22]; + + subexist=FALSE; + if (substat) + Message("Subp abnormal exit"); + else + { + p_atos(&buf[0],"Subp slept %d ticks",answer); + Message(&buf[0]); + } + } + +LOCAL_C VOID QueueSer() + { + if (!serH) + return; + serlen=1; + p_ioa5(serH,P_FREAD,&serstat,&serbuf[0],&serlen); + } + +LOCAL_C VOID OpenSer() + { + INT ret; + + ret=p_open(&serH,"TTY:B",-1); + if (ret<0) + ret=p_open(&serH,"TTY:A",-1); + if (ret<0) + { + p_notifyerr(ret,"Opening serial port",0,0,0); + serH=0; + } + } + +LOCAL_C VOID DisplaySerChar(VOID) + { + TEXT buf[12]; + + if (!serlen || !p_isprint(serbuf[0])) + return; + if (serpos++==MAX_SERPOS) + { + serpos=1; + p_bfil(&buf[0],12,' '); + Write(7,4,&buf[0],11); + } + Write(6+serpos,4,&serbuf[0],1); + } + +GLDEF_C VOID main(VOID) + { + p_unmarka(); + OpenConsole(); + DrawBorder(); + OpenTimer(); + timint=10; + QueueTimer(); + QueueKey(); + LaunchSub(); + OpenSer(); + QueueSer(); + FOREVER + { + p_iowait(); + if (keystat!=E_FILE_PENDING) + { + if (key.keycode==W_KEY_ESCAPE) + p_exit(0); + if (key.keycode==W_KEY_RETURN) + LaunchSub(); + else if (key.keycode>='1' && key.keycode<='9') + SetTimInt(2*(key.keycode-'0')); + QueueKey(); + } + else if (timstat!=E_FILE_PENDING) + { + if (counter++==MAX_COUNT) + counter=1; + DisplayCount(); + QueueTimer(); + } + else if (subexist && substat!=E_FILE_PENDING) + ReportSub(); + else if (serH && serstat!=E_FILE_PENDING) + { + p_tickle(); + DisplaySerChar(); + QueueSer(); + } + } + } diff --git a/code/SIBOSDK/demo/events4.c b/code/SIBOSDK/demo/events4.c new file mode 100644 index 0000000..643b119 --- /dev/null +++ b/code/SIBOSDK/demo/events4.c @@ -0,0 +1,278 @@ +/* EVENTS4.C */ + +#include +#include +#include +#include +#include +#include "subproc.h" + + +GLREF_C TEXT *DatCommandPtr; + +LOCAL_D VOID *timH; +LOCAL_D WORD timstat; +LOCAL_D WORD counter; +LOCAL_D ULONG timint; + +LOCAL_D VOID *conH; +LOCAL_D WORD keystat; +LOCAL_D P_CON_KBREC key; + +LOCAL_D WORD subexist; +LOCAL_D WORD substat; +LOCAL_D WORD answer; + +LOCAL_D VOID *serH; +LOCAL_D WORD serstat; +LOCAL_D WORD serlen; +LOCAL_D TEXT serbuf[2]; +LOCAL_D WORD serpos; + +LOCAL_D WORD thinkcount; +LOCAL_D TEXT thinkchar[4]={'-','\\','|','/'}; + +#define MAX_COUNT 100 +#define MAX_SERPOS 11 +#define MAX_THINK 20 + + +LOCAL_C VOID QueueKey(VOID) + { + p_ioa4(conH,P_FREAD,&keystat,&key); + } + +LOCAL_C VOID QueueTimer(VOID) + { + p_ioa4(timH,P_FRELATIVE,&timstat,&timint); + } + +LOCAL_C VOID CancelTimer(VOID) + { + p_iow2(timH,P_FCANCEL); + p_waitstat(&timstat); + } + +LOCAL_C VOID Check(INT val,TEXT *msg) + { + TEXT buf[30]; + + if (!val) + return; + p_atos(&buf[0],"Failed to open %s",msg); + p_notifyerr(val,&buf[0],0,0,0); + p_exit(0); + } + +LOCAL_C VOID OpenTimer(VOID) + { + Check(p_open(&timH,"TIM:",-1),"timer"); + } + +LOCAL_C VOID OpenConsole(VOID) + { + P_RECT rect; + WORD func; + + Check(p_open(&conH,"CON:",-1),"console"); + rect.tl.x=rect.tl.y=0; + rect.br.x=25; + rect.br.y=9; + func=P_SCR_WSET; + Check(p_iow4(conH,P_FSET,&func,&rect),"console"); + } + +LOCAL_C VOID SetTimInt(INT new) + { + CancelTimer(); + timint=new; + QueueTimer(); + } + +LOCAL_C VOID Write(INT x,INT y,TEXT *pb,INT len) + { + P_POINT pos; + WORD func; + + pos.x=x; + pos.y=y; + func=P_SCR_POSA; + p_iow4(conH,P_FSET,&func,&pos); + p_write(conH,pb,len); + } + +LOCAL_C VOID DisplayCount(VOID) + { + TEXT buf[4]; + + p_atos(&buf[0],"%3d",counter); + Write(10,2,&buf[0],3); + } + +LOCAL_C VOID DrawBorder(VOID) + { + TEXT buf[26]; + INT i; + + p_bfil(&buf[0],26,'*'); + Write(0,0,&buf[0],25); + for (i=1; i<8; i++) + { + Write(0,i,&buf[0],1); + Write(24,i,&buf[0],1); + } + Write(0,8,&buf[0],25); + } + +LOCAL_C VOID Message(TEXT *pb) + { + TEXT buf[22]; + INT len; + + p_bfil(&buf[0],22,' '); + len=p_slen(pb); + p_bcpy(&buf[10-len/2],pb,len); + Write(2,6,&buf[0],21); + } + +LOCAL_C VOID LaunchSub(VOID) + { + HANDLE pid; + SUBPROC_CL cl; + TEXT subname[P_FNAMESIZE]; + + if (subexist) + { + p_sound(-5,320); + return; + } + p_fparse("subproc.img",DatCommandPtr,&subname[0],0); + cl.pid=p_getpid(); + cl.poff=(&answer); + cl.data=p_date(); + if ((pid=p_execc(&subname[0],&cl,sizeof(cl)))<0) + { + p_notifyerr(pid,"Failed to launch subprocess",0,0,0); + return; + } + p_logona(pid,&substat); + subexist=TRUE; + Message("Subp launched"); + p_presume(pid); + } + +LOCAL_C VOID ReportSub(VOID) + { + TEXT buf[22]; + + subexist=FALSE; + if (substat) + Message("Subp abnormal exit"); + else + { + p_atos(&buf[0],"Subp slept %d ticks",answer); + Message(&buf[0]); + } + } + +LOCAL_C VOID QueueSer() + { + if (!serH) + return; + serlen=1; + p_ioa5(serH,P_FREAD,&serstat,&serbuf[0],&serlen); + } + +LOCAL_C VOID OpenSer() + { + INT ret; + + ret=p_open(&serH,"TTY:B",-1); + if (ret<0) + ret=p_open(&serH,"TTY:A",-1); + if (ret<0) + { + p_notifyerr(ret,"Opening serial port",0,0,0); + serH=0; + } + } + +LOCAL_C VOID DisplaySerChar(VOID) + { + TEXT buf[12]; + + if (!serlen || !p_isprint(serbuf[0])) + return; + if (serpos++==MAX_SERPOS) + { + serpos=1; + p_bfil(&buf[0],12,' '); + Write(7,4,&buf[0],11); + } + Write(6+serpos,4,&serbuf[0],1); + } + +LOCAL_C VOID Think(VOID) + { + TEXT *pb; + + if (thinkcount++==MAX_THINK) + thinkcount=0; + pb=(&thinkchar[thinkcount/5]); + Write(0,4,pb,1); + Write(25,4,pb,1); + } + +LOCAL_C VOID QueueThink(VOID) + { + p_iosignal(); + } + +GLDEF_C VOID main(VOID) + { + p_unmarka(); + OpenConsole(); + DrawBorder(); + OpenTimer(); + timint=10; + QueueTimer(); + QueueKey(); + LaunchSub(); + OpenSer(); + QueueSer(); + QueueThink(); + FOREVER + { + p_iowait(); + if (keystat!=E_FILE_PENDING) + { + if (key.keycode==W_KEY_ESCAPE) + p_exit(0); + if (key.keycode==W_KEY_RETURN) + LaunchSub(); + else if (key.keycode>='1' && key.keycode<='9') + SetTimInt(2*(key.keycode-'0')); + QueueKey(); + } + else if (timstat!=E_FILE_PENDING) + { + if (counter++==MAX_COUNT) + counter=1; + DisplayCount(); + QueueTimer(); + } + else if (subexist && substat!=E_FILE_PENDING) + ReportSub(); + else if (serH && serstat!=E_FILE_PENDING) + { + p_tickle(); + DisplaySerChar(); + QueueSer(); + } + else + { + Think(); + QueueThink(); + } + } + } diff --git a/code/SIBOSDK/demo/fonts.c b/code/SIBOSDK/demo/fonts.c new file mode 100644 index 0000000..bcb211f --- /dev/null +++ b/code/SIBOSDK/demo/fonts.c @@ -0,0 +1,218 @@ +/* +FONTS.C - Display fonts + +This program was used to produce the font displays in the Window Server +Reference manual. +*/ + +#include +#include + +#define MINX 2 +#define MINY 2 +#define WIDTH 160 + +LOCAL_D INT FontID; +LOCAL_D INT CurrentY,CurrentX; +LOCAL_D G_FONT_INFO FontInfo; + +LOCAL_C VOID DrawSideLines(INT y1,INT dy) + { + gDrawLine(0,y1,0,y1+dy+1); + gDrawLine(WIDTH-1,y1,WIDTH-1,y1+dy+1); + } + +LOCAL_C VOID PrintHexNumber(INT x,INT y,UINT n) + { + TEXT buf[5]; + + gPrintText(x,y,&buf[0],p_gtob(&buf[0],n,16)); + } + +LOCAL_C VOID CDECL PrintLine(INT style,INT final,TEXT *fmt,...) + { + INT height,ascent,len; + P_RECT box; + G_GC gc; + TEXT b[80]; + + height=FontInfo.height; + ascent=FontInfo.ascent; + if (style&G_STY_DOUBLE) + { + height<<=1; + ascent<<=1; + } + if (CurrentX==MINX) + DrawSideLines(CurrentY,height+1); + gc.font=FontID; + gc.style=style; + gSetGC(0,G_GC_MASK_FONT|G_GC_MASK_STYLE,&gc); + len=p_atob(&b[0],fmt,&fmt+1); + box.tl.x=CurrentX; + box.br.x=WIDTH-MINX; + box.tl.y=CurrentY; + box.br.y=box.tl.y+height; + if (box.br.x>box.tl.x) + gPrintBoxText(&box,ascent,G_TEXT_ALIGN_LEFT,0,&b[0],len); + if (final) + { + CurrentY+=height+1; + CurrentX=MINX; + } + else + CurrentX+=gTextWidth(FontID,style,&b[0],len); + } + +LOCAL_C VOID SaveFontCodes(VOID) + { + INT x,y,dx,dy,xo,yo,yy; + INT bitmap; + W_OPEN_BIT_SEG bit; + G_GC gc; + P_RECT rect; + TEXT name[32]; + + dx=18; + dy=FontInfo.height+1; + xo=FontInfo.numeric_width+(MINX+5); + yo=FontInfo.ascent+(MINY+3); + bit.size.x=dx*16+xo+MINX; + bit.size.y=dy*16+yo+MINY; + bitmap=gCreateBit(0,&bit); + gCreateTempGC0(bitmap); + gc.font=FontID; + gSetGC(0,G_GC_MASK_FONT,&gc); + rect.tl.x=rect.tl.y=0; + rect.br=bit.size; + gClrRect(&rect,G_TRMODE_CLR); + gDrawBox(&rect); + rect.tl.x=xo-2; + rect.tl.y=yo-2; + gDrawBox(&rect); + for (x=0;x<16;x++) + PrintHexNumber(x*dx+xo,FontInfo.ascent+1,x); + name[0]=0; + for (y=0;y<16;y++) + { + PrintHexNumber(3,yy=y*dy+yo+FontInfo.ascent,y); + for (x=0;x<16;x++) + { + gPrintText(x*dx+xo,yy,&name[0],1); + name[0]++; + } + } + gFreeTempGC(); + p_atos(&name[0],"rem::fcode%d.pic",FontID-WS_FONT_BASE); + gSaveBit(&name[0],bitmap); + wFree(bitmap); + } + +LOCAL_C VOID DrawFontStyles(VOID) + { + P_RECT rect; + + CurrentY=MINY; + CurrentX=MINX; + rect.tl.x=rect.tl.y=0; + rect.br.x=WIDTH; + rect.br.y=1000; + gClrRect(&rect,G_TRMODE_CLR); + gDrawLine(0,0,WIDTH,0); + DrawSideLines(0,MINY); + PrintLine(G_STY_NORMAL,FALSE,"Normal text (%d) ",FontInfo.height); + PrintLine(G_STY_BOLD,TRUE,"Bold text"); + PrintLine(G_STY_ITALIC,FALSE,"Italic text "); + PrintLine(G_STY_MONO,TRUE,"Mono text"); + PrintLine(G_STY_DOUBLE,FALSE,"Double height "); + PrintLine(G_STY_DOUBLE|G_STY_BOLD,TRUE,"Double bold"); + gDrawLine(0,CurrentY,WIDTH,CurrentY); + } + +LOCAL_C VOID SaveFontStyles(VOID) + { + INT bitmap; + W_OPEN_BIT_SEG bit; + TEXT name[32]; + + bit.size.x=WIDTH; + bit.size.y=CurrentY+1; + bitmap=gCreateBit(0,&bit); + gCreateTempGC0(bitmap); + DrawFontStyles(); + gFreeTempGC(); + p_atos(&name[0],"rem::font%d.pic",FontID-WS_FONT_BASE); + gSaveBit(&name[0],bitmap); + wFree(bitmap); + } + +LOCAL_C VOID SetFont(INT fid) + { + gFontInfo(FontID=fid,0,&FontInfo); + } + +LOCAL_C VOID HandleKeyPress(INT code) + { + INT i; + + if (code=='\r') + p_exit(0); + if ('0'<=code && code<'6') + { + SetFont(code-'0'+WS_FONT_BASE); + DrawFontStyles(); + } + if (code=='s') + { + wSetBusyMsg("Saving",W_CORNER_TOP_LEFT); + SaveFontStyles(); + wCancelBusyMsg(); + wInfoMsg("Styles bitmap saved"); + } + if (code=='a') + { + wSetBusyMsg("Saving",W_CORNER_TOP_LEFT); + for (i=0;i<6;i++) + { + SetFont(i+WS_FONT_BASE); + DrawFontStyles(); + SaveFontStyles(); + } + wCancelBusyMsg(); + wInfoMsg("Bitmaps saved"); + } + if (code=='c') + { + wSetBusyMsg("Saving",W_CORNER_TOP_LEFT); + SaveFontCodes(); + wCancelBusyMsg(); + wInfoMsg("Codes bitmap saved"); + } + if (code=='z') + { + wSetBusyMsg("Saving",W_CORNER_TOP_LEFT); + for (i=0;i<6;i++) + { + SetFont(i+WS_FONT_BASE); + SaveFontCodes(); + } + wCancelBusyMsg(); + wInfoMsg("Bitmaps saved"); + } + } + +GLDEF_C INT main(VOID) + { + WS_EV event; + + wStartup(); + SetFont(WS_FONT_BASE); + DrawFontStyles(); + for (;;) + { + wGetEventWait(&event); + if (event.type==WM_KEY) + HandleKeyPress(event.p.key.keycode); + } + return(0); + } diff --git a/code/SIBOSDK/demo/gauge.c b/code/SIBOSDK/demo/gauge.c new file mode 100644 index 0000000..b4086fa --- /dev/null +++ b/code/SIBOSDK/demo/gauge.c @@ -0,0 +1,212 @@ +#include +#include +#include + +LOCAL_D VOID *timH; +LOCAL_D WORD timstat; +LOCAL_D WORD counter; +LOCAL_D ULONG timint; + +#define NUM_STEPS 9 +#define STEP_WIDTH 16 +#define BAR_LEFT 8 +#define BAR_WIDTH 144 + +LOCAL_C VOID GetBarChartRect(P_RECT *pbox) + { + pbox->tl.x=BAR_LEFT; + pbox->br.x=BAR_LEFT+BAR_WIDTH; + pbox->br.y=80-4-1; + pbox->tl.y=80-4-1-6; + } + +LOCAL_C VOID QueueTimer(VOID) + { + p_ioa4(timH,P_FRELATIVE,&timstat,&timint); + } + +LOCAL_C VOID CancelTimer(VOID) + { + p_iow2(timH,P_FCANCEL); + p_waitstat(&timstat); + } + +LOCAL_C VOID CentrePrint(INT y1,INT y2,INT ascent,TEXT *pb) + { + P_RECT box; + + box.tl.x=4; + box.br.x=160-4; + box.tl.y=y1; + box.br.y=y2; + gPrintBoxText(&box,ascent,G_TEXT_ALIGN_CENTRE,0,pb,p_slen(pb)); + } + +LOCAL_C VOID SetFont(INT font) + { + G_GC gc; + + gc.font=font; + gSetGC(0,G_GC_MASK_FONT,&gc); + } + +LOCAL_C VOID SetStyle(INT style) + { + G_GC gc; + + gc.style=style; + gSetGC(0,G_GC_MASK_STYLE,&gc); + } + +LOCAL_C VOID TellCounter(VOID) + { + TEXT buf[10]; + + p_atos(&buf[0],"%d",counter); + SetStyle(G_STY_DOUBLE|G_STY_BOLD); + CentrePrint(46,64,16,&buf[0]); + SetStyle(G_STY_NORMAL); + } + +LOCAL_C VOID DrawBar(VOID) + { + P_RECT box; + + GetBarChartRect(&box); + if (!counter) + gClrRect(&box,G_TRMODE_CLR); + else + { + box.br.x=BAR_LEFT+counter*STEP_WIDTH; + gFillPattern(&box,WS_BITMAP_GREY,G_TRMODE_REPL); + } + TellCounter(); + } + +LOCAL_C VOID TellTimint(VOID) + { + TEXT buf[30]; + + p_atos(&buf[0],"Ticking every %d secs/10",(INT)timint); + CentrePrint(4,12,7,&buf[0]); + } + +typedef struct + { + TEXT *msg; + WORD x; + WORD y; + } CHOICE; + +LOCAL_D CHOICE ch[4]= + { + "(F) Faster",12,20, + "(S) Slower",12,30, + "(Z) Zero",88,20, + "(X) Exit",88,30 + }; + +LOCAL_C VOID DisplayChoice(INT i) + { + P_RECT box; + TEXT *pb; + + box.tl.x=ch[i].x; + box.tl.y=ch[i].y; + box.br.x=box.tl.x+65; + box.br.y=box.tl.y+8; + pb=ch[i].msg; + gPrintBoxText(&box,7,G_TEXT_ALIGN_LEFT,0,pb,p_slen(pb)); + } + +LOCAL_C VOID DisplayChoices(VOID) + { + INT i; + + for (i=0; i<4; i++) + DisplayChoice(i); + } + +#define S3_FONT WS_FONT_BASE+4 + +LOCAL_C VOID Flash(INT i) + { + P_EXTENT ext; + + ext.tl.x=ch[i].x-1; + ext.tl.y=ch[i].y-1; + ext.width=gTextWidth(S3_FONT,G_STY_NORMAL,ch[i].msg,3)+1; + ext.height=9; + gInvObloid(&ext); + wFlush(); + p_sleep(2); + gInvObloid(&ext); + } + +GLDEF_C VOID main(VOID) + { + WS_EV event; + P_RECT box; + WORD wactive; + + wStartup(); + gBorder(W_BORD_CORNER_4); + GetBarChartRect(&box); + p_insrec(&box,-1,-1); + gBorderRect(&box,W_BORD_CORNER_1); + SetFont(S3_FONT); + DisplayChoices(); + p_open(&timH,"TIM:",-1); + timint=10; + TellTimint(); + QueueTimer(); + wactive=FALSE; + FOREVER + { + if (wactive) + wFlush(); + else + { + wGetEvent(&event); + wactive=TRUE; + } + p_iowait(); + if (event.type==E_FILE_PENDING) + { + if (counter++==NUM_STEPS) + counter=0; + DrawBar(); + QueueTimer(); + continue; + } + wactive=FALSE; + if (event.type==WM_KEY) + { + switch (event.p.key.keycode) + { + case 'x': + Flash(3); + p_exit(0); + case 'z': + Flash(2); + CancelTimer(); + counter=0; + DrawBar(); + QueueTimer(); + break; + case 'f': + Flash(0); + if (timint!=1) + { + timint--; + TellTimint(); + } + break; + case 's': + Flash(1); + timint++; + TellTimint(); + } + } + } + } diff --git a/code/SIBOSDK/demo/hcshell.c b/code/SIBOSDK/demo/hcshell.c new file mode 100644 index 0000000..e351e68 --- /dev/null +++ b/code/SIBOSDK/demo/hcshell.c @@ -0,0 +1,70 @@ +/* +HCSHELL.C - Sample shell for the HC +*/ + +#include +#include + +GLREF_D UINT wMainGc; +GLREF_D WSERV_SPEC wSpec; + +LOCAL_D INT FontHeight; +LOCAL_D INT FontAscent; + +LOCAL_C VOID SetFontHeight(VOID) + { + G_FONT_INFO info; + + gFontInfo(WS_FONT_SYSTEM,0,&info); + FontHeight=info.height; + FontAscent=info.ascent; + } + +LOCAL_C VOID CDECL PrintLine(INT line,INT align,TEXT *fmt,...) + { + INT len; + P_RECT box; + TEXT b[80]; + + box.tl.x=4; + box.br.x=wSpec.conn.info.pixels.x-4; + box.tl.y=FontHeight*line+4; + box.br.y=box.tl.y+FontHeight; + len=p_atob(&b[0],fmt,&fmt+1); + gPrintBoxText(&box,FontAscent,align,0,&b[0],len); + } + +LOCAL_C VOID HandleKeyPress(WMSG_KEY *pk) + { + PrintLine(2,G_TEXT_ALIGN_CENTRE,"code:%02x mod:%02x count:%02x", + pk->keycode,pk->modifiers,pk->count); + } + +LOCAL_C VOID MainEventLoop(VOID) + { + WS_EV event; + + SetFontHeight(); + gBorder(W_BORD_SHADOW_D|W_BORD_SHADOW_ON); + PrintLine(0,G_TEXT_ALIGN_LEFT,"Free memory: %dKbytes",p_sgfree()>>6); + for (;;) + { + wGetEventWait(&event); + if (event.type==WM_KEY) + HandleKeyPress(&event.p.key); + } + } + +GLDEF_C INT main(VOID) + { + INT NotifierPid; + + wStartup(); + wSystem(WSERV_FLAG_NO_NOTIFIER_REBOOT,0xffff); + if ((NotifierPid=p_pidfind("SYS$NTFY.*"))>0) + p_pterminate(NotifierPid,0); + wSystem(WSERV_FLAG_HOOK_NOTIFIER|WSERV_FLAG_LOW_BATTERY_WARNINGS|WSERV_FLAG_HUNG_UP_SW, + WSERV_FLAG_HOOK_NOTIFIER|WSERV_FLAG_LOW_BATTERY_WARNINGS|WSERV_FLAG_HUNG_UP_SW); + MainEventLoop(); + return(0); + } diff --git a/code/SIBOSDK/demo/hello.c b/code/SIBOSDK/demo/hello.c new file mode 100644 index 0000000..41730c0 --- /dev/null +++ b/code/SIBOSDK/demo/hello.c @@ -0,0 +1,15 @@ +/* +HELLO.C + +CLIB Hello World application +*/ + +#include + + +int main(VOID) + { + printf("Hello World"); + getchar(); + return(0); + } diff --git a/code/SIBOSDK/demo/hello.pr b/code/SIBOSDK/demo/hello.pr new file mode 100644 index 0000000..7d915c9 --- /dev/null +++ b/code/SIBOSDK/demo/hello.pr @@ -0,0 +1,7 @@ +#system epoc img +#model small jpi + +#compile hello +#link hello + + diff --git a/code/SIBOSDK/demo/lined.c b/code/SIBOSDK/demo/lined.c new file mode 100644 index 0000000..9194314 --- /dev/null +++ b/code/SIBOSDK/demo/lined.c @@ -0,0 +1,396 @@ +#include +#include + +#include "lined.h" + + +GLREF_D UINT wMainWid; + + +LOCAL_C INT CreateGC(LINED *ed) + { + G_GC gc; + + if (ed->gc) + return(FALSE); + gc.font=ed->i.font; + gc.style=ed->i.style; + gCreateTempGC(ed->i.winid,G_GC_MASK_FONT|G_GC_MASK_STYLE,&gc); + ed->gc=TRUE; + return(TRUE); + } + +LOCAL_C VOID FreeGC(LINED *ed,INT gc) + { + if (!gc) + return; + ed->gc=FALSE; + gFreeTempGC(); + } + +LOCAL_C INT WidthTo(LINED *ed,INT blen) + { + return(gTextWidth(ed->i.font,ed->i.style,ed->pb,blen)); + } + +LOCAL_C VOID GetBox(LINED *ed,P_RECT *pbox) + { + pbox->tl.x=ed->i.xoff; + pbox->tl.y=ed->i.yoff; + pbox->br.x=pbox->tl.x+ed->i.width; + pbox->br.y=pbox->tl.y+ed->i.height; + } + +LOCAL_C VOID DrawCursor(LINED *ed) + { + W_CURSOR flash; + + flash.pos.x=ed->i.xoff+ed->marg+WidthTo(ed,ed->cur); + flash.pos.y=ed->i.yoff+ed->i.asc; + flash.height=ed->i.height; + flash.ascent=ed->i.asc; + flash.width=ed->cwidth; + flash.flags=0; + wTextCursor(ed->i.winid,&flash); + } + +LOCAL_C VOID ToggleHighlight(LINED *ed) + { + P_RECT box; + INT gc; + + if (ed->select) + { + gc=CreateGC(ed); + GetBox(ed,&box); + box.br.x=box.tl.x+ed->marg+WidthTo(ed,ed->blen); + gClrRect(&box,G_TRMODE_INV); + FreeGC(ed,gc); + } + } + +LOCAL_C VOID DrawAll(LINED *ed) + { + P_RECT box; + INT gc; + + GetBox(ed,&box); + gc=CreateGC(ed); + gPrintBoxText(&box,ed->i.asc,G_TEXT_ALIGN_LEFT,ed->marg,ed->pb,ed->blen); + if (ed->emph) + { + DrawCursor(ed); + ToggleHighlight(ed); + } + FreeGC(ed,gc); + } + +GLDEF_C VOID le_destroy(LINED *ed) + { + p_free(ed->pb); + p_free(ed); + } + +GLDEF_C LINED *le_init(IN_LINED *pin) + { + LINED *ed; + + ed=p_alloc(sizeof(LINED)); + if (!ed) + return(NULL); + p_bfil(ed,sizeof(LINED),0); + ed->cwidth=2; + ed->pb=p_alloc(pin->maxchars+1); + if (!ed->pb) + { + p_free(ed); + return(NULL); + } + ed->i=(*pin); + ed->lmarg=ed->i.width/4; + return(ed); + } + +LOCAL_C VOID ScrollForCursor(LINED *ed,INT draw) + { + INT oldmarg; + INT curx; + INT exx; + INT exl; + INT exr; + + oldmarg=ed->marg; + curx=WidthTo(ed,ed->cur); + exx=curx+ed->marg; + exl=exx-ed->lmarg; + exr=exx+ed->cwidth-ed->i.width; + if (exl<0 && ed->marg) + { + ed->marg-=exl-ed->scrollx; + if (ed->marg>0) + ed->marg=0; + } + else if (exr>0) + ed->marg-=exr+ed->scrollx; + if (ed->marg!=oldmarg && draw) + DrawAll(ed); + } + +GLDEF_C VOID le_set_text(LINED *ed,INT blen,TEXT *pb) + { + *(p_bcpy(ed->pb,pb,blen))=0; + ed->blen=blen; + ed->marg=0; + ed->select=FALSE; + ed->cur=0; + if (ed->i.autoselect && blen) + { + ed->cur=blen; + ed->select=TRUE; + ScrollForCursor(ed,FALSE); + } + if (ed->visible) + DrawAll(ed); + } + +LOCAL_C VOID DelSelRange(LINED *ed) + { + ed->select=FALSE; + ed->cur=0; + ed->marg=0; + ed->blen=0; + *ed->pb=0; + } + +LOCAL_C VOID DoDelete(LINED *ed,INT modifier) + { + INT start; + INT finish; + + if (ed->select) + DelSelRange(ed); + else + { + if (modifier&W_SHIFT_MODIFIER) + { + if (ed->cur==ed->blen) + return; + } + else if (!ed->cur) + return; + start=finish=ed->cur; + switch (modifier) + { + case W_SHIFT_MODIFIER: + finish++; + break; + case W_PSION_MODIFIER: + finish=ed->blen; + break; + default: + start--; + } + p_bcpy(ed->pb+start,ed->pb+finish,ed->blen+1-finish); + ed->blen-=finish-start; + ed->cur=start; + ScrollForCursor(ed,FALSE); + } + DrawAll(ed); + } + +LOCAL_C VOID LoseHighlight(LINED *ed) + { + ToggleHighlight(ed); + ed->select=FALSE; + } + +LOCAL_C VOID DisplayCursor(LINED *ed) + { + ScrollForCursor(ed,TRUE); + DrawCursor(ed); + } + +GLDEF_C INT le_key(LINED *ed,INT keycode,INT modifier) + { + TEXT *pb; + + if (keycode<0x100 && p_isprint(keycode)) + { + if (ed->select) + DelSelRange(ed); + if (ed->blen==ed->i.maxchars) + { + p_sound(-5,320); + return(-1); + } + pb=ed->pb+ed->cur; + p_bcpy(pb+1,pb,ed->blen+1-ed->cur); + *pb=keycode; + (ed->blen)++; + (ed->cur)++; + ScrollForCursor(ed,FALSE); + DrawAll(ed); + return(0); + } + if (keycode==W_KEY_DELETE_LEFT || keycode==W_KEY_DELETE_RIGHT) + DoDelete(ed,modifier); + else + { + switch (keycode) + { + case W_KEY_LEFT: + if (ed->select) + { + LoseHighlight(ed); + ed->cur=0; + } + else if (!ed->cur) + return(0); + else + { + if (modifier&W_PSION_MODIFIER) + ed->cur=0; + else + (ed->cur)--; + } + DisplayCursor(ed); + break; + case W_KEY_RIGHT: + if (ed->select) + { + LoseHighlight(ed); + ed->cur=ed->blen; + } + else if (ed->cur==ed->blen) + return(0); + else + { + if (modifier&W_PSION_MODIFIER) + ed->cur=ed->blen; + else + (ed->cur)++; + } + DisplayCursor(ed); + } + } + return(0); + } + +GLDEF_C VOID le_emphasise(LINED *ed,INT emph) + { + if (emph) + emph=TRUE; + if (ed->emph==emph) + return; + ed->emph=emph; + if (!ed->visible) + return; + DrawAll(ed); + if (!emph) + wEraseTextCursor(); + } + +GLDEF_C VOID le_set_cwidth(LINED *ed,INT cwidth) + { + ed->cwidth=cwidth; + if (ed->visible && ed->emph) + { + if (cwidth) + DrawCursor(ed); + else + wEraseTextCursor(); + } + } + +GLDEF_C VOID le_visible(LINED *ed,INT visible) + { + P_RECT box; + INT gc; + + if (visible) + visible=TRUE; + if (ed->visible==visible) + return; + ed->visible=visible; + if (visible) + DrawAll(ed); + else + { + GetBox(ed,&box); + gc=CreateGC(ed); + gClrRect(&box,G_TRMODE_CLR); + FreeGC(ed,gc); + } + } + + +/************************** TEST CODE FOLLOWS ***********************/ + + +LOCAL_C LINED *CreateLined(INT yoff,TEXT *msg,INT emph) + { + IN_LINED init; + LINED *ed; + + init.maxchars=20; + init.winid=wMainWid; + init.xoff=10; + init.yoff=yoff; + init.width=80; + init.height=10; + init.asc=8; + init.font=WS_FONT_BASE+4; + init.style=0; + init.autoselect=TRUE; + ed=le_init(&init); + le_set_text(ed,p_slen(msg),msg); + le_emphasise(ed,emph); + le_visible(ed,TRUE); + return(ed); + } + +GLDEF_C VOID main(VOID) + { + LINED *ed[3]; + INT which; + WS_EV event; + INT keycode; + + wStartup(); + gBorder(W_BORD_CORNER_4); + ed[0]=CreateLined(10,"One",TRUE); + ed[1]=CreateLined(30,"Two",FALSE); + ed[2]=CreateLined(50,"Three",FALSE); + which=0; + FOREVER + { + do + { + wGetEventWait(&event); + } while (event.type!=WM_KEY); + keycode=event.p.key.keycode&(~W_SPECIAL_KEY); + switch (keycode) + { + case W_KEY_ESCAPE: + if (event.p.key.modifiers==W_PSION_MODIFIER) + p_exit(0); + case W_KEY_UP: + if (which) + { + le_emphasise(ed[which--],FALSE); + le_emphasise(ed[which],TRUE); + } + break; + case W_KEY_DOWN: + if (which<2) + { + le_emphasise(ed[which++],FALSE); + le_emphasise(ed[which],TRUE); + } + break; + default: + le_key(ed[which],keycode,event.p.key.modifiers); + } + } + } + diff --git a/code/SIBOSDK/demo/lined.h b/code/SIBOSDK/demo/lined.h new file mode 100644 index 0000000..7b08687 --- /dev/null +++ b/code/SIBOSDK/demo/lined.h @@ -0,0 +1,43 @@ +#define LINED_H + +#ifndef P_STD_H +#include +#endif + +typedef struct + { + WORD maxchars; + WORD winid; + WORD xoff; + WORD yoff; + WORD width; + WORD height; + WORD asc; + WORD font; + WORD style; + WORD autoselect; + } IN_LINED; + +typedef struct + { + WORD blen; + TEXT *pb; + WORD select; + WORD emph; + WORD cur; + WORD marg; + WORD cwidth; + WORD visible; + WORD gc; + WORD scrollx; + WORD lmarg; + IN_LINED i; + } LINED; + +GLREF_C LINED *le_init(IN_LINED *pin); +GLREF_C VOID le_set_text(LINED *ed,INT blen,TEXT *pb); +GLREF_C VOID le_emphasise(LINED *ed,INT emph); +GLREF_C VOID le_set_cwidth(LINED *ed,INT cwidth); +GLREF_C VOID le_visible(LINED *ed,INT visible); +GLREF_C INT le_key(LINED *ed,INT keycode,INT modifier); +GLREF_C VOID le_destroy(LINED *ed); diff --git a/code/SIBOSDK/demo/lkshell.c b/code/SIBOSDK/demo/lkshell.c new file mode 100644 index 0000000..01cd86d --- /dev/null +++ b/code/SIBOSDK/demo/lkshell.c @@ -0,0 +1,79 @@ +/* +LKSHELL.C - Just starts up the link +*/ + +#include +#include + +LOCAL_D WSERV_SPEC wSpec; +LOCAL_D UINT wMainGc; +LOCAL_D UINT wMainWid; +LOCAL_D INT FontHeight; +LOCAL_D INT FontAscent; + +LOCAL_C VOID SetFontHeight(VOID) + { + G_FONT_INFO info; + + gFontInfo(WS_FONT_SYSTEM,0,&info); + FontHeight=info.height; + FontAscent=info.ascent; + } + +LOCAL_C VOID CDECL PrintLine(INT line,INT align,TEXT *fmt,...) + { + INT len; + P_RECT box; + TEXT b[80]; + + box.tl.x=4; + box.br.x=wSpec.conn.info.pixels.x-4; + box.tl.y=FontHeight*line+4; + box.br.y=box.tl.y+FontHeight; + len=p_atob(&b[0],fmt,&fmt+1); + gPrintBoxText(&box,FontAscent,align,0,&b[0],len); + } + +LOCAL_C VOID MainEventLoop(VOID) + { + WS_EV event; + + SetFontHeight(); + for (;;) + { + wGetEventWait(&event); + if (event.type==WM_REDRAW) + { + wValidateWin(wMainWid); + gBorder(W_BORD_SHADOW_D|W_BORD_SHADOW_ON); + PrintLine(0,G_TEXT_ALIGN_LEFT,"Free memory: %dKbytes",p_sgfree()>>6); + } + else if (event.type==WM_KEY && event.p.key.keycode=='\r') + wInvalidateWin(wMainWid); + } + } + +GLDEF_C VOID main(VOID) + { + INT NotifierPid; + WORD stat; + + p_setonevent(TRUE); + wConnect(&wSpec,0,W_CONNECT_PRIORITY); + wSystem(WSERV_FLAG_NO_NOTIFIER_REBOOT,WSERV_FLAG_NO_NOTIFIER_REBOOT); + if ((NotifierPid=p_pidfind("SYS$NTFY.*"))>0) + { + p_logona(NotifierPid,&stat); + p_pterminate(NotifierPid,0); + p_waitstat(&stat); + } + wSystem(WSERV_FLAG_HOOK_NOTIFIER|WSERV_FLAG_LOW_BATTERY_WARNINGS|WSERV_FLAG_HUNG_UP_SW, + WSERV_FLAG_HOOK_NOTIFIER|WSERV_FLAG_LOW_BATTERY_WARNINGS|WSERV_FLAG_HUNG_UP_SW); + if (p_pidfind("SYS$NCP.*")<0) + p_presume(p_execc("ROM::LINK",NULL,0)); + wMainWid=wCreateWindow(0,0,0,1); + wsCreateClock(wMainWid,WS_CLOCK_WITH_DATE|WS_CLOCK_WITH_SECONDS,104,66,0); + wInitialiseWindowTree(wMainWid); + wMainGc=gCreateGC0(wMainWid); + MainEventLoop(); + } diff --git a/code/SIBOSDK/demo/lkshell.pr b/code/SIBOSDK/demo/lkshell.pr new file mode 100644 index 0000000..131b53d --- /dev/null +++ b/code/SIBOSDK/demo/lkshell.pr @@ -0,0 +1,5 @@ +#system epoc img +#set epocinit=iplib2 +#model small jpi +#compile lkshell +#link lkshell diff --git a/code/SIBOSDK/demo/make.bat b/code/SIBOSDK/demo/make.bat new file mode 100644 index 0000000..f260a39 --- /dev/null +++ b/code/SIBOSDK/demo/make.bat @@ -0,0 +1,8 @@ +@echo off +call checkvid +if exist %1.pr goto custom +tsc /m unnamed.pr /smain=%1 /%jpivid% +goto end +:custom +tsc /m %1.pr /smain=%1 /%jpivid% +:end diff --git a/code/SIBOSDK/demo/p_comp.c b/code/SIBOSDK/demo/p_comp.c new file mode 100644 index 0000000..d992140 --- /dev/null +++ b/code/SIBOSDK/demo/p_comp.c @@ -0,0 +1,96 @@ +/* +P_COMP.C +*/ + +#include + +typedef struct + { + INT ret; + VOID *chan; + LONG len; + TEXT name[P_FNAMESIZE]; + UBYTE buf[P_FBLKSIZE]; + } FILE_DATA; + +LOCAL_D FILE_DATA f1={0,NULL}; +LOCAL_D FILE_DATA f2={0,NULL}; + +LOCAL_C VOID CleanUp(TEXT *msg, FILE_DATA *pf) + { + TEXT bb[E_MAX_ERROR_TEXT_SIZE]; + + p_close(pf->chan); + pf->chan=NULL; + if (pf->ret<0) + { + p_errs(&bb[0],pf->ret); + p_printf("Failed to %s %s\n\r%s)",msg,&pf->name[0],&bb[0]); + pf->ret=0; + } + } + +LOCAL_C VOID Exit(TEXT *msg) + { + if (f1.ret>=0 && f2.ret>=0) + p_printf(msg); + CleanUp(msg,&f1); + CleanUp(msg,&f2); + p_leave(0); + } + +LOCAL_C VOID OpenFile(FILE_DATA *pf, TEXT *name, TEXT *related) + { + LONG pos; + + if ((pf->ret=p_fparse(name,related,&pf->name[0],NULL))<0) + Exit("parse"); + if ((pf->ret=p_open(&pf->chan,&pf->name[0],P_FSTREAM|P_FSHARE|P_FRANDOM))<0) + Exit("open"); + pf->len=0L; p_seek(pf->chan,P_FEND,&pf->len); + pos=0; p_seek(pf->chan,P_FABS,&pos); + } + +LOCAL_C VOID ReadFile(FILE_DATA *pf) + { + pf->ret=p_read(pf->chan,&pf->buf[0],sizeof(pf->buf)); + if (pf->ret!=E_FILE_EOF && pf->ret<0) + Exit("read"); + } + +LOCAL_C VOID CDECL CompareFiles(TEXT *file1, TEXT *file2) + { + OpenFile(&f1,file1,NULL); + OpenFile(&f2,file2,&f1.name[0]); + p_printf("Compare %s (%ld)",&f1.name[0],f1.len); + p_printf(" with %s (%ld)",&f2.name[0],f2.len); + if (f1.len!=f2.len) + Exit("Files are of different length"); + FOREVER + { + ReadFile(&f1); + ReadFile(&f2); + if (f1.ret==E_FILE_EOF && f2.ret==E_FILE_EOF) + { + f1.ret=f2.ret=0; + Exit("Files are identical"); + } + if (p_bcmp(&f1.buf[0],f1.ret,&f2.buf[0],f2.ret)) + Exit("Files are different"); + } + } + +GLDEF_C INT main(VOID) + { + TEXT *p; + TEXT bb[P_FNAMESIZE]; + + while (p_getl("Enter ?\r\n",&bb[0],P_FNAMESIZE)) + { + p=p_skipch(&bb[0]); + if (*p) + *p++=0; + p_enter((VOID *)CompareFiles,&bb[0],p_skipwh(p)); + } + return(0); + } diff --git a/code/SIBOSDK/demo/p_dlist.c b/code/SIBOSDK/demo/p_dlist.c new file mode 100644 index 0000000..85f326f --- /dev/null +++ b/code/SIBOSDK/demo/p_dlist.c @@ -0,0 +1,65 @@ +/* +P_DLIST.C +*/ + +#include + +LOCAL_C TEXT *GetTypeText(UINT type) + { + switch (type) + { + case P_FMEDIA_FLOPPY: + return "Floppy"; + case P_FMEDIA_HARDDISK: + return "Hard"; + case P_FMEDIA_FLASH: + return "Flash"; + case P_FMEDIA_RAM: + return "RAM"; + case P_FMEDIA_ROM: + return "ROM"; + case P_FMEDIA_WRITEPROTECTED: + return "Protected"; + } + return "Unknown"; + } + +LOCAL_C VOID ListDevices(VOID) + { + VOID *ncb,*dcb; + INT ret; + TEXT device[P_FNAMESIZE]; + TEXT bb[E_MAX_ERROR_TEXT_SIZE]; + P_DINFO dinfo; + + p_printf(" Device Name Type Size Free"); + p_printf("=========== ========== ========== ======== ========"); + p_open(&ncb,"FIL:",P_FNODE); + while (!p_iow(ncb,P_FREAD,&device[0],NULL)) + { + p_scat(&device[0],"a:\\"); + if (p_open(&dcb,&device[0],P_FDEVICE)) + continue; + while (!p_read(dcb,&device[P_FSYSNAMESIZE],0)) + { + if ((ret=p_dinfo(&device[0],&dinfo))<0) + { + p_errs(&bb[0],ret); + p_printf("%- 12s %- 12s<%s>",&device[0],"**Failed**",&bb[0]); + continue; + } + p_printf("%- 12s %- 12s%- 11s %7ldK %7ldK", + &device[0],&dinfo.name[0],GetTypeText(dinfo.mediatype&0xff), + (dinfo.size+512)>>10,(dinfo.free+512)>>10); + } + p_close(dcb); + } + p_close(ncb); + } + +GLDEF_C INT main(VOID) + { + ListDevices(); + p_getch(); + return(0); + } diff --git a/code/SIBOSDK/demo/p_hello.c b/code/SIBOSDK/demo/p_hello.c new file mode 100644 index 0000000..02dc07d --- /dev/null +++ b/code/SIBOSDK/demo/p_hello.c @@ -0,0 +1,15 @@ +/* +P_HELLO.C + +PLIB Hello World application +*/ + +#include + + +GLDEF_C INT main(VOID) + { + p_printf("Hello World"); + p_getch(); + return(0); + } diff --git a/code/SIBOSDK/demo/p_hello.pr b/code/SIBOSDK/demo/p_hello.pr new file mode 100644 index 0000000..37acebf --- /dev/null +++ b/code/SIBOSDK/demo/p_hello.pr @@ -0,0 +1,7 @@ +#system epoc img +#set epocinit=iplib +#model small jpi + +#compile p_hello +#link p_hello + diff --git a/code/SIBOSDK/demo/p_prndir.c b/code/SIBOSDK/demo/p_prndir.c new file mode 100644 index 0000000..197bf7e --- /dev/null +++ b/code/SIBOSDK/demo/p_prndir.c @@ -0,0 +1,75 @@ +/* +P_PRNDIR.C +*/ + +#include + +LOCAL_D VOID *dcb=NULL; + +LOCAL_C VOID panic(TEXT *msg, INT errno) + { + TEXT bb[E_MAX_ERROR_TEXT_SIZE]; + + p_close(dcb); dcb=NULL; + p_errs(&bb[0],errno); + p_printf("%s: %s",msg,&bb[0]); + p_leave(errno); + } + +LOCAL_C VOID PrintDirLine(TEXT *name, P_INFO *pinfo) + { + P_DAYSEC ds; + P_DATE dt; + TEXT *p,b[40]; + + p=&b[0]; + if (pinfo->status&P_FAVOLUME) + p=p_scpy(p,"Vol,"); + if (pinfo->status&P_FADIR) + p=p_scpy(p,"Dir,"); + if (pinfo->status&P_FAMOD) + p=p_scpy(p,"Mod,"); + if (!(pinfo->status&P_FAWRITE)) + p=p_scpy(p,"Read,"); + if (pinfo->status&P_FASYSTEM) + p=p_scpy(p,"Sys,"); + if (pinfo->status&P_FAHIDDEN) + p=p_scpy(p,"Hid,"); + if (*(p-1)==',') + *--p=0; + p_sttods(&pinfo->modst,&ds); + p_dstodt(&ds,&dt); + p_printf("%- 12s %8lu %02u-%02u-%02u %02u:%02u %s", + name,pinfo->size,dt.day+1,dt.month+1,dt.year,dt.hour,dt.minute,&b[0]); + } + +LOCAL_C INT CDECL PrintDirList(TEXT *dir) + { + INT ret,NoFiles; + P_INFO info; + TEXT name[P_FNAMESIZE]; + + if ((ret=p_open(&dcb,dir,P_FDIR))!=0) + panic("Failed to open directory file",ret); + NoFiles=TRUE; + while (!(ret=p_iow(dcb,P_FREAD,&name[0],&info))) + { + NoFiles=FALSE; + PrintDirLine(&name[0],&info); + } + p_close(dcb); dcb=NULL; + if (ret!=E_FILE_EOF) + panic("Failed to read directory",ret); + if (NoFiles) + p_printf("No files found"); + return(0); + } + +GLDEF_C INT main(VOID) + { + TEXT name[P_FNAMESIZE]; + + while (p_getl(">",&name[0],P_FNAMESIZE)) + p_enter((VOID *)PrintDirList,&name[0]); + return(0); + } diff --git a/code/SIBOSDK/demo/p_search.c b/code/SIBOSDK/demo/p_search.c new file mode 100644 index 0000000..59f03e7 --- /dev/null +++ b/code/SIBOSDK/demo/p_search.c @@ -0,0 +1,56 @@ +/* +P_SEARCH.C +*/ + +#include + +LOCAL_D VOID *fcb=NULL; + +LOCAL_C VOID panic(TEXT *msg, INT errno) + { + TEXT bb[E_MAX_ERROR_TEXT_SIZE]; + + p_errs(&bb[0],errno); + p_printf("%s: %s",msg,&bb[0]); + p_leave(errno); + } + +#pragma save +#pragma ENTER_CALL + +LOCAL_C INT CDECL SearchFile(TEXT *file, TEXT *pattern) + { + INT ret; + TEXT line[P_FMAXRSIZE]; + + if ((ret=p_open(&fcb,file,P_FTEXT))<0) + panic("Failed to open file",ret); + while ((ret=p_read(fcb,&line[0],sizeof(line)))>=0) + { + line[ret]=0; + if (ret && p_ssubi(&line[0],pattern)>=0) + p_printf(&line[0]); + } + p_close(fcb); + if (ret!=E_FILE_EOF) + panic("Failed to read file",ret); + return(0); + } + +#pragma restore + +GLDEF_C INT main(VOID) + { + TEXT *p; + TEXT bb[P_FNAMESIZE]; + + while (p_getl(">",&bb[0],P_FNAMESIZE)) + { + p=p_skipch(&bb[0]); + *p++=0; + p=p_skipwh(p); + p_printf("Searching %s for %s",&bb[0],p); + p_enter3(SearchFile,&bb[0],p); + } + return(0); + } diff --git a/code/SIBOSDK/demo/pcxsave.c b/code/SIBOSDK/demo/pcxsave.c new file mode 100644 index 0000000..2fa11a8 --- /dev/null +++ b/code/SIBOSDK/demo/pcxsave.c @@ -0,0 +1,139 @@ +/* +Save the screen to PCX file +*/ + +#include +#include + +#define BUFLEN 256 + +GLREF_D WSERV_SPEC *wserv_channel; + +LOCAL_D VOID *fcb; +LOCAL_D UBYTE *pbuf; +LOCAL_D UBYTE *pobuf; +LOCAL_D UBYTE obuf[BUFLEN]; + +LOCAL_C VOID FlushBuffer(VOID) + { + f_write(fcb,&obuf[0],pobuf-&obuf[0]); + pobuf=&obuf[0]; + } + +LOCAL_C VOID putb(INT b) + { + *pobuf++=b; + if (pobuf==&obuf[BUFLEN]) + FlushBuffer(); + } + +LOCAL_C INT rev(INT dat) + { + INT i; + INT rdat; + + rdat=0; + for (i=0;i<8;i++) + rdat|=((dat>>i)&1)<<(7-i); + return(rdat^0xff); + } + +LOCAL_C VOID WritePCXLine(UBYTE *buf,UINT len) + { + UBYTE *p; + UINT end; + UINT count; + INT byte; + + p=buf; + byte=*p++; + count=1; + do + { + end=(p==(&buf[0]+len)); + if (byte==*p && count<0x3f && !end) + { + count++; + p++; + } + else + { + byte=rev(byte); + if (count>1 || (byte&0xC0)==0xC0) + putb(count+0xC0); + putb(byte); + byte=*p++; + count=1; + } + } while (!end); + } + +LOCAL_C VOID WriteHeader(TEXT *name,UINT width,UINT height,UINT bytewid) + { + struct + { + UBYTE manuf; + UBYTE hard; + UBYTE encod; + UBYTE bitpx; + P_RECT rect; + WORD hres; + WORD vres; + UBYTE clrma[48]; + UBYTE vmode; + UBYTE nplanes; + WORD bplin; + UBYTE padding[60]; + } header; + + f_open(&fcb,name,P_FREPLACE|P_FSTREAM|P_FUPDATE); + p_bfil(&header,sizeof(header),0); + header.manuf=10; + header.hard=3; + header.encod=TRUE; + header.bitpx=1; + header.rect.br.x=width-1; + header.rect.br.y=height-1; + header.hres=640; + header.vres=480; + header.nplanes=1; + header.bplin=bytewid; + f_write(fcb,&header,sizeof(header)); + } + +#pragma save, ENTER_CALL + +LOCAL_C INT WritePCXFile(TEXT *name) + { + UINT len; + P_POINT size; + P_POINT line; + + size=wserv_channel->conn.info.pixels; + len=((size.x+15)>>3)&~1; + WriteHeader(name,size.x,size.y,len); + pbuf=f_alloc(len); + line.x=0; + for (line.y=0;line.y +#include +#include +#include + +GLREF_D VOID *DatCommandPtr; + +LOCAL_D VOID *fcb; /* handle of resource file */ +LOCAL_D UWORD resoff; /* offset to resource file within .img file */ +LOCAL_D UWORD ixpos; /* offset to index table within resource file */ + +LOCAL_D TEXT buf[80]; /* scratch buffer used for resources loaded */ + +LOCAL_C VOID SeekToPos(UWORD roff) +/* +Position to offset roff within the resource file +*/ + { + LONG ioff; /* offset within image file */ + + ioff=resoff+roff; + p_seek(fcb,P_FABS,&ioff); + } + +LOCAL_C VOID InitRsc(VOID) +/* +Open resource file at add-file slot 2 inside own .img file. +Set up the values of fcb, resoff, and ixpos +*/ + { + ImgHeader head; + + p_open(&fcb,DatCommandPtr,P_FRANDOM|P_FSTREAM|P_FSHARE); + p_read(fcb,&head,sizeof(head)); + resoff=head.Add[1].offset; + SeekToPos(0); + p_read(fcb,&ixpos,2); + } + +LOCAL_C TEXT *ReadRsc(INT i) +/* +Returns pointer to buffer containing resource i. +Note that the static buffer buf[] is used in every case. +*/ + { + UWORD tmp[2]; /* section of index table */ + + SeekToPos(ixpos+((i-1)*2)); /* position into index table */ + p_read(fcb,&tmp[0],4); + SeekToPos(tmp[0]); + p_read(fcb,&buf[0],tmp[1]-tmp[0]); + return(&buf[0]); + } + +GLDEF_C INT main(VOID) + { + InitRsc(); + p_printf("Resource 1 is %s",ReadRsc(1)); + p_printf("Resource 2 is %s",ReadRsc(2)); + p_printf("Press any key to exit"); + p_getch(); + return(0); + } diff --git a/code/SIBOSDK/demo/scapt.c b/code/SIBOSDK/demo/scapt.c new file mode 100644 index 0000000..a3b0d3a --- /dev/null +++ b/code/SIBOSDK/demo/scapt.c @@ -0,0 +1,31 @@ +/* +SCAPT.C - Capture the screen to a file +*/ + +#include +#include + +GLREF_D TEXT *DatCommandPtr; + +GLREF_C INT pcxScreenSave(TEXT *name); + +LOCAL_D WSERV_SPEC wSpec; + +GLDEF_C INT main(VOID) + { + INT ret; + TEXT *pc; + TEXT name[P_FNAMESIZE]; + + pc=p_skipch(DatCommandPtr)+1; + if (*pc) + pc=p_skipwh(pc+1); + ret=p_fparse(pc,"REM::SCREEN.PCX",&name[0],NULL); + if (!ret) + { + wConnect(&wSpec,0,W_CONNECT_AT_BACK); + ret=pcxScreenSave(&name[0]); + p_sound(1,512); + } + return(ret); + } diff --git a/code/SIBOSDK/demo/scapt.pr b/code/SIBOSDK/demo/scapt.pr new file mode 100644 index 0000000..2936529 --- /dev/null +++ b/code/SIBOSDK/demo/scapt.pr @@ -0,0 +1,7 @@ +#system epoc img +#set epocinit=iplib2 +#model small jpi + +#compile scapt +#compile pcxsave +#link scapt diff --git a/code/SIBOSDK/demo/sound.c b/code/SIBOSDK/demo/sound.c new file mode 100644 index 0000000..514672e --- /dev/null +++ b/code/SIBOSDK/demo/sound.c @@ -0,0 +1,94 @@ +#include +#include +#include + +/* Sound demo: plays the ice cream van tune at various + beat per minute ... */ + +GLDEF_C VOID waitstat2(WORD *pstat1, WORD *pstat2) +/* +Wait for *pstat!=E_FILE_PENDING and *pstat2 != E_FILE_PENDING +*/ + { + INT i; + + i = -1; + do + { + p_iowait(); + i++; + } + while (*pstat1 == E_FILE_PENDING && *pstat2 == E_FILE_PENDING); + + if (*pstat2 == E_FILE_PENDING) + pstat1 = pstat2; + p_waitstat(pstat1); + + while (i--) + p_iosignal(); + } + + +GLDEF_C VOID play_notes(WORD *buf1, WORD *buf2, WORD l1, WORD l2, INT volume, INT beatsPerMinute) + { + VOID *pcb; + WORD sndstat1,sndstat2; + E_SOUND sound; + INT err; + + if ((err=p_open(&pcb,"SND:",-1)) < 0) + { + p_close(pcb); + p_exit(err); + } + + if ((err=p_iow3(pcb,P_FSENSE,&sound)) < 0) + { + p_close(pcb); + p_exit(err); + } + + if (beatsPerMinute >= 0) + sound.beatsPerMinute = (UBYTE) beatsPerMinute; + + if (volume >= 0) + sound.volume = (UBYTE) volume; + + if ((err=p_iow3(pcb,P_FSET,&sound)) < 0) + { + p_close(pcb); + p_exit(err); + } + + p_ioc5(pcb,E_FSSOUNDCHANNEL1,&sndstat1,&buf1[0],&l1); + p_ioc5(pcb,E_FSSOUNDCHANNEL2,&sndstat2,&buf2[0],&l2); + waitstat2(&sndstat1,&sndstat2); + + p_close(pcb); + + if (sndstat1 != 0 || sndstat1 != 0) + p_exit(0); +} + +GLDEF_C INT main(VOID) +{ + WORD notes1[] = {1048,24,524,12}; + WORD notes2[] = {1048,4,1320,4,1568,4,2092,4,1568,4,1320,4,1048,12}; + WORD len1 = sizeof(notes1)/4,len2 = sizeof(notes2)/4; + INT i; + + for (i = 0; i < 6; i++) + { + play_notes(¬es1[0],¬es2[0],len1,len2,i,-1); + p_sleep(1); + } + + for (i = 0; i < 6; i++) + { + play_notes(¬es1[0],¬es2[0],len1,len2,-1,140+i*20); + p_sleep(1); + } + + return(0); +} + diff --git a/code/SIBOSDK/demo/subproc.c b/code/SIBOSDK/demo/subproc.c new file mode 100644 index 0000000..5231243 --- /dev/null +++ b/code/SIBOSDK/demo/subproc.c @@ -0,0 +1,31 @@ +/* SUBPROC.C */ + +#include +#include +#include +#include +#include "subproc.h" + +GLREF_C TEXT *DatCommandPtr; + + +GLDEF_C INT main(VOID) + { + TEXT *pb; + SUBPROC_CL *pcl; + UWORD answer; + WORD logstat; + + pb=DatCommandPtr+p_slen(DatCommandPtr)+1; + if (*pb!=sizeof(SUBPROC_CL)) + return(E_GEN_ARG); + pcl=(SUBPROC_CL *)(pb+1); + if (!p_logona(pcl->pid,&logstat)) + { + answer=(UWORD)(p_randl(&pcl->data)%(2*60*32)); + p_sleept(answer); + if (logstat<0) + p_pcpyto(pcl->pid,pcl->poff,&answer,sizeof(UWORD)); + } + return(0); + } diff --git a/code/SIBOSDK/demo/subproc.h b/code/SIBOSDK/demo/subproc.h new file mode 100644 index 0000000..d21441c --- /dev/null +++ b/code/SIBOSDK/demo/subproc.h @@ -0,0 +1,6 @@ +typedef struct + { + HANDLE pid; + VOID *poff; + ULONG data; + } SUBPROC_CL; diff --git a/code/SIBOSDK/demo/unnamed.pr b/code/SIBOSDK/demo/unnamed.pr new file mode 100644 index 0000000..ce7f97b --- /dev/null +++ b/code/SIBOSDK/demo/unnamed.pr @@ -0,0 +1,5 @@ +#system epoc img +#set epocinit=iplib +#model small jpi +#compile %main +#link %main diff --git a/code/SIBOSDK/demo/vid.bat b/code/SIBOSDK/demo/vid.bat new file mode 100644 index 0000000..4ccb4d5 --- /dev/null +++ b/code/SIBOSDK/demo/vid.bat @@ -0,0 +1,22 @@ +@echo off +goto X%1X +:Xv0X +:XoffX +set jpivid=v0 +echo VID is now OFF +goto :end +:Xv2X +:XonX +set jpivid=v2 +echo VID is now ON +goto :end +:XX +call checkvid +goto %jpivid% +:v0 +echo VID is OFF +goto end +:v2 +echo VID is ON +:end + diff --git a/code/SIBOSDK/demo/w_hello.c b/code/SIBOSDK/demo/w_hello.c new file mode 100644 index 0000000..c7e3b2b --- /dev/null +++ b/code/SIBOSDK/demo/w_hello.c @@ -0,0 +1,16 @@ +#include +#include + +GLDEF_C INT main(VOID) + { + WS_EV event; + + wStartup(); + gBorder(W_BORD_CORNER_4); + wSetBusyMsg("Hello world",W_CORNER_BOTTOM_LEFT); + do + { + wGetEventWait(&event); + } while (event.type!=WM_KEY || event.p.key.keycode!=W_KEY_ESCAPE); + return(0); + } diff --git a/code/SIBOSDK/ewdemo/ehbwin.c b/code/SIBOSDK/ewdemo/ehbwin.c new file mode 100644 index 0000000..c9924e6 --- /dev/null +++ b/code/SIBOSDK/ewdemo/ehbwin.c @@ -0,0 +1,70 @@ +/* EHBWIN.C */ + +#include +#include +#include + +LOCAL_C VOID LaunchDialog(INT class,INT resid,VOID *rbuf) + { + DL_DATA dld; + + dld.id=resid; + dld.rbuf=rbuf; + dld.pdlg=NULL; + hLaunchDial(CAT_EHELLO_EHELLO,class,&dld); + } + +#pragma METHOD_CALL + +METHOD VOID ehbwin_wn_init(PR_EHBWIN *self) + { + W_WINDATA wd; + IN_EDWIN_X initx; + struct + { + IN_EDWIN e; + TEXT rest[21]; + } init; + + wd.extent.width=240-50; /* extent calculation presupposes S3 screen */ + wd.extent.height=3+10+5; /* matches flags set for bwin below */ + wd.extent.tl.x=0; + wd.extent.tl.y=31; /* centred vertically */ + p_send5(self,O_WN_CONNECT,NULL,W_WIN_EXTENT,&wd); + hLoadResBuf(EHSTR_INIT,&init.e.contents[0]); + init.e.vulen=240-50-3-1-5-1; /* one extra pixel clearance each end */ + init.e.maxlen=50; + init.e.flags=IN_EDWIN_VULEN_PIXELS|IN_EDWIN_POSITION_SUPPLIED; + initx.pos.x=3+1; + initx.pos.y=3; + self->ehbwin.edwin=f_newsend(CAT_EHELLO_HWIM,C_EDWIN,O_WN_INIT, + &init,self,&initx); + self->win.flags=IN_BWIN_SHADOW_2|IN_BWIN_CUSHION; + p_send3(self,O_WN_EMPHASISE,TRUE); + hInitVis(self); + } + +METHOD VOID ehbwin_wn_emphasise(PR_EHBWIN *self,INT flag) + { + p_supersend3(self,O_WN_EMPHASISE,flag); + p_send3(self->ehbwin.edwin,O_WN_EMPHASISE,flag); + } + +METHOD VOID ehbwin_wn_draw(PR_EHBWIN *self) + { + p_supersend2(self,O_WN_DRAW); + p_send2(self->ehbwin.edwin,O_WN_DRAW); + } + +METHOD VOID ehbwin_wn_key(PR_EHBWIN *self,INT keycode,INT mods) + { + SE_EDWIN sense; + + if (keycode!=W_KEY_RETURN) + p_send4(self->ehbwin.edwin,O_WN_KEY,keycode,mods); + else + { + p_send3(self->ehbwin.edwin,O_WN_SENSE,&sense); + LaunchDialog(C_EHDLG,EHDLG,sense.buf); + } + } diff --git a/code/SIBOSDK/ewdemo/ehdlg.c b/code/SIBOSDK/ewdemo/ehdlg.c new file mode 100644 index 0000000..ab60147 --- /dev/null +++ b/code/SIBOSDK/ewdemo/ehdlg.c @@ -0,0 +1,11 @@ +/* EHDLG.C */ + +#include +#include + +#pragma METHOD_CALL + +METHOD VOID ehdlg_dl_dyn_init(PR_DLGBOX *self) + { + hDlgSetText(1,self->dlgbox.rbuf); + } diff --git a/code/SIBOSDK/ewdemo/ehello.afl b/code/SIBOSDK/ewdemo/ehello.afl new file mode 100644 index 0000000..279ac4f --- /dev/null +++ b/code/SIBOSDK/ewdemo/ehello.afl @@ -0,0 +1,2 @@ +ehello.pic +ehello.rzc diff --git a/code/SIBOSDK/ewdemo/ehello.cat b/code/SIBOSDK/ewdemo/ehello.cat new file mode 100644 index 0000000..ae208cf --- /dev/null +++ b/code/SIBOSDK/ewdemo/ehello.cat @@ -0,0 +1,29 @@ +IMAGE ehello + +EXTERNAL olib +EXTERNAL hwim + +INCLUDE hwimman.g +INCLUDE edwin.g + +CLASS ehwserv wserv + { + REPLACE ws_dyn_init + } + +CLASS ehbwin bwin + { + REPLACE wn_init + REPLACE wn_emphasise + REPLACE wn_key + REPLACE wn_draw + PROPERTY + { + PR_EDWIN *edwin; + } + } + +CLASS ehdlg dlgbox + { + REPLACE dl_dyn_init + } diff --git a/code/SIBOSDK/ewdemo/ehello.pic b/code/SIBOSDK/ewdemo/ehello.pic new file mode 100644 index 0000000..d980c34 Binary files /dev/null and b/code/SIBOSDK/ewdemo/ehello.pic differ diff --git a/code/SIBOSDK/ewdemo/ehello.pr b/code/SIBOSDK/ewdemo/ehello.pr new file mode 100644 index 0000000..c75ea9c --- /dev/null +++ b/code/SIBOSDK/ewdemo/ehello.pr @@ -0,0 +1,31 @@ +#system epoc img +#set epocinit=iplib +#model small jpi + +#compile ehello.cat + +#if %remake #or (ehello.rg #older ehello.re) #or (ehello.rg #older ehello.g) #then + #run "re ehello" no_window no_abort +#endif + +#if (ehello.rsg #older ehello.rss) #or (ehello.rsg #older ehello.rg) #then + #run "rs ehello" no_window no_abort +#endif + +#if ehello.rzc #older ehello.rsg #then + #run "rch ehello" no_window no_abort + #file delete ehello.img +#endif + +#compile ehmain.c +#compile ehwserv.c +#compile ehbwin.c +#compile ehdlg.c + +#if (ehello.img #older ehello.afl) #or (ehello.img #older ehello.pic) #then + #file delete ehello.img +#endif + +#pragma link(hwim.lib) + +#link ehello.img diff --git a/code/SIBOSDK/ewdemo/ehello.re b/code/SIBOSDK/ewdemo/ehello.re new file mode 100644 index 0000000..c1b422f --- /dev/null +++ b/code/SIBOSDK/ewdemo/ehello.re @@ -0,0 +1,3 @@ +#include + +_O_COM_EXIT diff --git a/code/SIBOSDK/ewdemo/ehello.rss b/code/SIBOSDK/ewdemo/ehello.rss new file mode 100644 index 0000000..818ec95 --- /dev/null +++ b/code/SIBOSDK/ewdemo/ehello.rss @@ -0,0 +1,54 @@ +/* EHELLO.RSS */ + +#include +#include +#include + +RESOURCE WSERV_INFO ehello_accs + { + menbar_id=ehello_mbar; + first_com=O_COM_EXIT; + accel={'x'}; + } + +RESOURCE MENU_BAR ehello_mbar + { + items = + { + MENU_BAR_ITEM + { + menu_id=special_menu; + mb_item="Special"; + } + }; + } + +RESOURCE MENU special_menu + { + items = + { + MENU_ITEM + { + com_id=O_COM_EXIT; + mn_item="Exit"; + } + }; + } + +RESOURCE DIALOG ehdlg + { + title="Edit window"; + flags=DLGBOX_RBUF_FILLED; + controls= + { + CONTROL + { + class=C_TEXTWIN; + flags=DLGBOX_ITEM_DEAD; + prompt="Current text"; + info=TXTMESS { str="*";}; /* placeholder */ + } + }; + } + +RESOURCE STRING ehstr_init { str="Hello world"; } diff --git a/code/SIBOSDK/ewdemo/ehmain.c b/code/SIBOSDK/ewdemo/ehmain.c new file mode 100644 index 0000000..16f9cf6 --- /dev/null +++ b/code/SIBOSDK/ewdemo/ehmain.c @@ -0,0 +1,17 @@ +/* EHMAIN.C */ + +#include + +GLDEF_C VOID main(VOID) + { + IN_HWIMMAN app; + IN_WSERV wserv; + + p_linklib(0); + app.flags=FLG_APPMAN_RSCFILE|FLG_APPMAN_SRSCFILE|FLG_APPMAN_CLEAN; + app.wserv_cat=p_getlibh(CAT_EHELLO_EHELLO); + app.wserv_class=C_EHWSERV; + wserv.com_cat=p_getlibh(CAT_EHELLO_HWIM); + wserv.com_class=C_COMMAN; + p_send4(p_new(CAT_EHELLO_HWIM,C_HWIMMAN),O_AM_INIT,&app,&wserv); + } diff --git a/code/SIBOSDK/ewdemo/ehrel.prj b/code/SIBOSDK/ewdemo/ehrel.prj new file mode 100644 index 0000000..ee134eb --- /dev/null +++ b/code/SIBOSDK/ewdemo/ehrel.prj @@ -0,0 +1,15 @@ +ehrel.prj ! releases source files +ehello.pr ! TS project file +make.bat ! makes EHELLO.IMG +! +ehello.cat ! category file +ehello.re ! resource externals file +ehello.rss ! resource script +! +ehbwin.c ! client window +ehdlg.c ! dialog +ehmain.c ! main +ehwserv.c ! window server subclass +! +ehello.afl ! add file list +ehello.pic ! icon diff --git a/code/SIBOSDK/ewdemo/ehwserv.c b/code/SIBOSDK/ewdemo/ehwserv.c new file mode 100644 index 0000000..3096862 --- /dev/null +++ b/code/SIBOSDK/ewdemo/ehwserv.c @@ -0,0 +1,11 @@ +/* EHWSERV.C */ + +#include + +#pragma METHOD_CALL + +METHOD VOID ehwserv_ws_dyn_init(PR_EHWSERV *self) + { + wsEnable(); + self->wserv.cli=f_newsend(CAT_EHELLO_EHELLO,C_EHBWIN,O_WN_INIT); + } diff --git a/code/SIBOSDK/ewdemo/make.bat b/code/SIBOSDK/ewdemo/make.bat new file mode 100644 index 0000000..d0fea3a --- /dev/null +++ b/code/SIBOSDK/ewdemo/make.bat @@ -0,0 +1,3 @@ +@echo off +tscx /m ehello +tscx /m ehello diff --git a/code/SIBOSDK/fconv/s3fconv.lib b/code/SIBOSDK/fconv/s3fconv.lib new file mode 100644 index 0000000..b6a8229 Binary files /dev/null and b/code/SIBOSDK/fconv/s3fconv.lib differ diff --git a/code/SIBOSDK/fconv/txtread.c b/code/SIBOSDK/fconv/txtread.c new file mode 100644 index 0000000..4638bcb --- /dev/null +++ b/code/SIBOSDK/fconv/txtread.c @@ -0,0 +1,94 @@ +/* +TXTREAD.C +*/ + +#include +#include +#include +#include "wpfconv.h" + +GLREF_D VOID *DatApp5; /* used for file conversion DYLs... */ +#define FileName DatApp5 /* ...to point to the source file's name */ + +LOCAL_C VOID InsertBuf(PR_TXTREAD *self, TEXT *buf, UINT len) + { + InsertText(self->txtread.pos,buf,len); + self->txtread.pos+=len; + } + +LOCAL_C VOID ApplyPlainStyle(PR_TXTREAD *self) + { + PARA_STYLE *para; + EMPH_STYLE *emph; + TEXT paracode[2]; + TEXT emphcode[2]; + + *(WORD *)¶code[0]='B'+('T'<<8); + para=SenseParaStyleBySC(¶code[0]); + DoApplyParaStyle(self->txtread.lastpos,self->txtread.pos,para); + *(WORD *)&emphcode[0]='N'+('N'<<8); + emph=(EMPH_STYLE *)SenseEmphStyleBySC(&emphcode[0]); + DoApplyEmphasis(self->txtread.lastpos,self->txtread.pos,emph); + } + +#pragma METHOD_CALL + +METHOD VOID txtread_ao_init(PR_TXTREAD *self) +/* +Keep the supplied filename extension. +*/ + { + f_open((VOID **)&self->active.pcb,FileName,P_FOPEN|P_FTEXT); + CloseCurrentFile(); + SetDefaultStyles(4,6); + StartActive(self); + } + +METHOD VOID txtread_ao_queue(PR_TXTREAD *self) + { + self->active.isactive=TRUE; + self->txtread.len=TXTREAD_BUFLEN; + p_ioc5(self->active.pcb,P_FREAD,&self->active.stat,&self->txtread.buf[0], + &self->txtread.len); + } + +METHOD INT txtread_ao_run(PR_TXTREAD *self) + { + if (self->active.stat==E_FILE_EOF) + { + ApplyPlainStyle(self); /* apply style to final paragraph */ + SwitchToNewFile(FileName); + p_send2(self,O_DESTROY); + return(RUN_ACTIVE_USED); + } + f_leave(self->active.stat); + + if (self->txtread.pos) + { + ApplyPlainStyle(self); /* range does not include the terminating NULL */ + InsertBuf(self,&self->txtread.eopara,1); + self->txtread.lastpos=self->txtread.pos; + } + InsertBuf(self,&self->txtread.buf[0],self->txtread.len); /* add text of next paragraph */ + + p_send2(self,O_AO_QUEUE); + return(RUN_ACTIVE_USED); + } + +METHOD VOID txtread_ao_abrun(PR_TXTREAD *self) +/* +The application is shut down after reporting any error on loading. +No data is ever lost by doing this, since any previous file will +already have been saved. +*/ + { + StopActive(); + p_supersend2(self,O_AO_ABRUN); + p_exit(0); + } + +METHOD VOID txtread_destroy(PR_TXTREAD *self) + { + StopActive(); + p_supersend2(self,O_DESTROY); + } diff --git a/code/SIBOSDK/fconv/txtwrite.c b/code/SIBOSDK/fconv/txtwrite.c new file mode 100644 index 0000000..f0f6c31 --- /dev/null +++ b/code/SIBOSDK/fconv/txtwrite.c @@ -0,0 +1,89 @@ +/* +TXTWRITE.C +*/ + +#include +#include +#include +#include "wpfconv.h" + +GLREF_D VOID *DatApp5; + +LOCAL_C INT OpenFile(PR_TXTSAVE *self) +/* forces .TXT extension */ + { + TEXT extension[6]; + P_INFO info; + TEXT name[P_FNAMESIZE]; + + *((UWORD *)&extension[0])='.'+('T'<<8); + *((UWORD *)&extension[2])='X'+('T'<<8); + extension[4]=0; + f_fparse(&extension[0],DatApp5,&name[0],NULL); + if (!p_finfo(&name[0],&info)) + { + if (!DoConfirmOverwrite()) + return(FALSE); + } + f_open(&self->active.pcb,&name[0],P_FUPDATE|P_FREPLACE|P_FSTREAM_TEXT); + return(TRUE); + } + +LOCAL_C VOID ReplaceNulls(TEXT *p,UINT len) + { + TEXT *pe; + + for (pe=p+len;ptxtsave.ntags=CountTags(); + StartActive(self); + } +METHOD VOID txtsave_ao_queue(PR_TXTSAVE *self) + { + self->active.isactive=TRUE; + p_iosignal(); + } +METHOD INT txtsave_ao_run(PR_TXTSAVE *self) + { + PARA_STYLE style; + EMPH_STYLE emphasis; + UINT taglen,txtlen; + + taglen=SenseTagItem(self->txtsave.curtag++,&style,&emphasis); + while (taglen) + { + txtlen=taglen>TXTSAVE_BUFFER_LEN ? TXTSAVE_BUFFER_LEN : taglen; + ExtractText(self->txtsave.pos,&self->txtsave.buf[0],txtlen); + ReplaceNulls(&self->txtsave.buf[0],txtlen); + f_write(self->active.pcb,&self->txtsave.buf[0],txtlen); + self->txtsave.pos+=txtlen; + taglen-=txtlen; + } + if (self->txtsave.curtagtxtsave.ntags) + p_send2(self,O_AO_QUEUE); + else + p_send2(self,O_DESTROY); + return(RUN_ACTIVE_USED); + } +METHOD VOID txtsave_ao_abrun(PR_TXTSAVE *self) + { + p_close(self->active.pcb); + StopActive(); + p_supersend2(self,O_AO_ABRUN); + p_supersend2(self,O_DESTROY); + } +METHOD VOID txtsave_destroy(PR_TXTSAVE *self) + { + StopActive(); + p_supersend2(self,O_DESTROY); + } diff --git a/code/SIBOSDK/fconv/wl$txt.cat b/code/SIBOSDK/fconv/wl$txt.cat new file mode 100644 index 0000000..f4b5c4b --- /dev/null +++ b/code/SIBOSDK/fconv/wl$txt.cat @@ -0,0 +1,31 @@ +LIBRARY wl$txt + +EXTERNAL olib + +INCLUDE p_std.h +INCLUDE p_object.h +INCLUDE olib.g +INCLUDE appman.g + +CLASS txtread active +NB Must be first class in DYL + { + REPLACE destroy + REPLACE ao_init + REPLACE ao_queue + REPLACE ao_run + REPLACE ao_abrun + CONSTANTS + { + TXTREAD_BUFLEN 256 + } + PROPERTY + { + UWORD pos; current document character content offset + UWORD lastpos; start of previous paragraph + TEXT eopara; end of para marker + TEXT dummy; + UWORD len; length of text in buf[] + TEXT buf[TXTREAD_BUFLEN]; input text buffer + } + } diff --git a/code/SIBOSDK/fconv/wl$txt.dyl b/code/SIBOSDK/fconv/wl$txt.dyl new file mode 100644 index 0000000..0b1bdf8 Binary files /dev/null and b/code/SIBOSDK/fconv/wl$txt.dyl differ diff --git a/code/SIBOSDK/fconv/wl$txt.pr b/code/SIBOSDK/fconv/wl$txt.pr new file mode 100644 index 0000000..1499df0 --- /dev/null +++ b/code/SIBOSDK/fconv/wl$txt.pr @@ -0,0 +1,18 @@ +#system epoc dyl +#set epocinit=iplib +#model small jpi + +#abort on + +#set version=0x320F + +#compile %main.cat + +#compile txtread.c + +#pragma link(s3fconv.lib) +#pragma link(olib.lib) +#pragma link(hwim.lib) + +#link %main + diff --git a/code/SIBOSDK/fconv/word.app b/code/SIBOSDK/fconv/word.app new file mode 100644 index 0000000..5d80d9f Binary files /dev/null and b/code/SIBOSDK/fconv/word.app differ diff --git a/code/SIBOSDK/fconv/wpfconv.h b/code/SIBOSDK/fconv/wpfconv.h new file mode 100644 index 0000000..ae6cf13 --- /dev/null +++ b/code/SIBOSDK/fconv/wpfconv.h @@ -0,0 +1,82 @@ +/* +WPFCONV.H + +Public word processor structures and prototypes for file conversion DYL code. +*/ + +#ifndef SCRLAY_G +#include +#endif +#ifndef PRINTER_G +#include +#endif + +typedef struct + { + SCRLAY_FONT sf; + UWORD inherit; + } WP_FONT; + +typedef struct + { + TEXT sc[2]; + TEXT tag_name[16]; + UWORD sflags; + WP_FONT font; + } EMPH_DATA; /* saved emphasis style structure */ + +typedef struct + { + SCRLAY_MARGINS marg; + SCRLAY_SPACING spc; + UWORD olevel; + SCRLAY_TABS tabs; + } PARA_DATA; /* saved paragraph style structure */ + +typedef struct + { + VOID *next; /* style queue header - written by system code */ + EMPH_DATA ph; + } EMPH_STYLE; /* in-memory emphasis style structure */ + +typedef struct + { + VOID *next; /* style queue header - written by system code */ + EMPH_DATA ph; + PARA_DATA pa; + SCRLAY_MARGINS prn_mar; /* printer margin positions */ + SCRLAY_MARGINS scr_mar; /* screen margin positions */ + SCRLAY_SPACING prn_spc; /* printer vertical spacing data */ + SCRLAY_TABS *pts; /* screen tabs data */ + SCRLAY_TABS *ptp; /* printer tabs data */ + } PARA_STYLE; /* in-memory paragraph style structure */ + +/* +Prototypes for file conversion DYL interface. +*/ +GLREF_C INT CountParaStyles(VOID); +GLREF_C INT CountEmphStyles(VOID); +GLREF_C PARA_STYLE *SenseParaStyleByIndex(INT); +GLREF_C EMPH_STYLE *SenseEmphStyleByIndex(INT); +GLREF_C PARA_STYLE *SenseParaStyleBySC(TEXT *); +GLREF_C EMPH_STYLE *SenseEmphStyleBySC(TEXT *); +GLREF_C PARA_STYLE *AppendParaStyle(PARA_STYLE *); +GLREF_C EMPH_STYLE *AppendEmphStyle(EMPH_STYLE *); +GLREF_C VOID DoApplyParaStyle(UINT,UINT,PARA_STYLE *); +GLREF_C VOID DoApplyEmphasis(UINT,UINT,EMPH_STYLE *); +GLREF_C VOID SetDefaultStyles(UINT,UINT); +GLREF_C VOID SetBusyStatus(INT); +GLREF_C INT DoConfirmOverwrite(VOID); +GLREF_C PRINTER_PARAMS *SensePrinterParams(VOID **); +GLREF_C WDR_MODEL *SensePrinterModel(VOID); +GLREF_C VOID *SenseWDR(VOID); +GLREF_C VOID SetFileErr(INT); +GLREF_C VOID StartActive(VOID *); +GLREF_C VOID StopActive(VOID); +GLREF_C VOID CloseCurrentFile(VOID); +GLREF_C VOID SwitchToNewFile(TEXT *); +GLREF_C VOID InsertText(UINT,TEXT *,UINT); +GLREF_C VOID DeleteText(UINT,UINT); +GLREF_C VOID ExtractText(UINT,TEXT *,UINT); +GLREF_C UINT CountTags(VOID); +GLREF_C UINT SenseTagItem(UINT,PARA_STYLE *,EMPH_STYLE *); diff --git a/code/SIBOSDK/fconv/ws$txt.cat b/code/SIBOSDK/fconv/ws$txt.cat new file mode 100644 index 0000000..ebe9581 --- /dev/null +++ b/code/SIBOSDK/fconv/ws$txt.cat @@ -0,0 +1,30 @@ +LIBRARY ws$txt + +EXTERNAL olib + +INCLUDE p_std.h +INCLUDE p_object.h +INCLUDE olib.g +INCLUDE appman.g + +CLASS txtsave active +NB Must be first class in DYL + { + REPLACE destroy + REPLACE ao_init + REPLACE ao_queue + REPLACE ao_run + REPLACE ao_abrun + CONSTANTS + { + CHAR_CR 13 + TXTSAVE_BUFFER_LEN 256 + } + PROPERTY + { + UINT ntags; + UINT curtag; + UINT pos; + TEXT buf[TXTSAVE_BUFFER_LEN]; + } + } diff --git a/code/SIBOSDK/fconv/ws$txt.dyl b/code/SIBOSDK/fconv/ws$txt.dyl new file mode 100644 index 0000000..0c7e50a Binary files /dev/null and b/code/SIBOSDK/fconv/ws$txt.dyl differ diff --git a/code/SIBOSDK/fconv/ws$txt.pr b/code/SIBOSDK/fconv/ws$txt.pr new file mode 100644 index 0000000..8505a6b --- /dev/null +++ b/code/SIBOSDK/fconv/ws$txt.pr @@ -0,0 +1,18 @@ +#system epoc dyl +#set epocinit=iplib +#model small jpi + +#abort on + +#set version=0x320F + +#compile %main.cat + +#compile txtwrite.c + +#pragma link(s3fconv.lib) +#pragma link(olib.lib) +#pragma link(hwim.lib) + +#link %main + diff --git a/code/SIBOSDK/font/bold.fsc b/code/SIBOSDK/font/bold.fsc new file mode 100644 index 0000000..b952859 --- /dev/null +++ b/code/SIBOSDK/font/bold.fsc @@ -0,0 +1,2311 @@ +*name Sys$bold +*special 1 +*descent 1 +*height 8 +*maxwid 8 +*flag ascii +*flag cp850 + +0000011 ;0 +0000011 +0000011 +0010011 +0110011 +1111111 +0110000 +0010000 + +00000000 ;1 +00000000 +00000000 +00000000 +00000000 +11010110 +11010110 +00000000 + +110110 ;2 +110110 +011100 +000000 +111110 +000000 +000000 +000000 + +110110 ;3 +011100 +011100 +110110 +000000 +000000 +000000 +000000 + +1111110 ;4 +1100110 +1100110 +1100110 +1101110 +1101100 +1111000 +0000000 + +0000000 ;5 +0111100 +1000010 +0011000 +1100110 +1100110 +1111110 +0000000 + +001000 ;6 +010100 +010100 +111110 +110110 +110110 +011100 +000000 + +000000 ;7 +000000 +000000 +000000 +111110 +000000 +000000 +000000 + +000 ;8 +000 +000 +000 +000 +000 +010 +010 + +0000000 ;9 +0000000 +0011000 +0011100 +1111110 +0011100 +0011000 +0000000 + +0011000 ;10 +0011000 +0011000 +0011000 +0011000 +1111110 +0111100 +0011000 + +0001110 ;11 +0001100 +0001100 +0001100 +0001100 +1101100 +0111000 +0000000 + +00000011 ;12 +00000110 +00000110 +00001100 +00001100 +10011000 +11011000 +01110000 + +00000000 ;13 +00000000 +00111000 +00111000 +11111110 +01111100 +00111000 +00000000 + +000000 ;14 +000000 +000000 +110110 +000000 +000000 +000000 +000000 + +000 ;15 +000 +000 +000 +000 +000 +000 +000 + +0000000 ;16 +0011000 +0011100 +1111110 +1111110 +0011100 +0011000 +0000000 + +0000000 ;17 +0011000 +0111000 +1111110 +1111110 +0111000 +0011000 +0000000 + +001111 ;18 +011000 +011000 +011000 +011000 +011000 +011000 +001111 + +11100 ;19 +00110 +00110 +00110 +00110 +00110 +00110 +11100 + +001111 ;20 +011010 +011101 +011010 +011101 +011010 +011101 +001111 + +11100 ;21 +10110 +01110 +10110 +01110 +10110 +01110 +11100 + +001111 ;22 +011111 +011111 +011111 +011111 +011111 +011111 +001111 + +11100 ;23 +11110 +11110 +11110 +11110 +11110 +11110 +11100 + +0011000 ;24 +0111100 +1111110 +0011000 +0011000 +0011000 +0011000 +0000000 + +0011000 ;25 +0011000 +0011000 +0011000 +1111110 +0111100 +0011000 +0000000 + +00000000 ;26 +00011000 +00011100 +11111110 +00011100 +00011000 +00000000 +00000000 + +00000000 ;27 +00110000 +01110000 +11111110 +01110000 +00110000 +00000000 +00000000 + +110000 ;28 +111000 +111100 +111110 +111100 +111000 +110000 +000000 + +0000000 ;29 +0011000 +0111100 +0111100 +1111110 +1111110 +0011000 +0000000 + +00000000 ;30 +00000000 +00111000 +01111100 +11111110 +00111000 +00111000 +00000000 + +0000000 ;31 +0000000 +0000000 +0000000 +0000000 +0000000 +0000000 +0000000 + +000 ;32 ' ' +000 +000 +000 +000 +000 +000 +000 + +0110 ;33 '!' +0110 +0110 +0110 +0110 +0000 +0110 +0000 + +110110 ;34 '"' +110110 +110110 +000000 +000000 +000000 +000000 +000000 + +00000000 ;35 '#' +01101100 +11111110 +01101100 +01101100 +11111110 +01101100 +00000000 + +0011000 ;36 '$' +0111110 +1011000 +0111100 +0011010 +1111100 +0011000 +0000000 + +1100000 ;37 '%' +1100110 +0001100 +0011000 +0110000 +1100110 +0000110 +0000000 + +0111100 ;38 '&' +1100110 +1101100 +0110000 +1101010 +1100100 +0111010 +0000000 + +1110 ;39 ''' +0110 +1100 +0000 +0000 +0000 +0000 +0000 + +00110 ;40 '(' +01100 +11000 +11000 +11000 +01100 +00110 +00000 + +11000 ;41 ')' +01100 +00110 +00110 +00110 +01100 +11000 +00000 + +0000000 ;42 '*' +0011000 +1011010 +0111100 +1011010 +0011000 +0000000 +0000000 + +0000000 ;43 '+' +0011000 +0011000 +1111110 +0011000 +0011000 +0000000 +0000000 + +0000 ;44 ',' +0000 +0000 +0000 +1110 +1110 +0110 +1100 + +000000 ;45 '-' +000000 +000000 +111110 +000000 +000000 +000000 +000000 + +0000 ;46 '.' +0000 +0000 +0000 +0000 +1110 +1110 +0000 + +0000000 ;47 '/' +0000110 +0001100 +0011000 +0110000 +1100000 +0000000 +0000000 + +0111100 ;48 '0' +1100110 +1101110 +1111110 +1110110 +1100110 +0111100 +0000000 + +0011000 ;49 '1' +0111000 +0011000 +0011000 +0011000 +0011000 +0111100 +0000000 + +0111100 ;50 '2' +1100110 +0000110 +0001100 +0011000 +0110000 +1111110 +0000000 + +0111100 ;51 '3' +1100110 +0000110 +0011100 +0000110 +1100110 +0111100 +0000000 + +0001100 ;52 '4' +0011100 +0111100 +1101100 +1111110 +0001100 +0001100 +0000000 + +1111110 ;53 '5' +1100000 +1111100 +0000110 +0000110 +1100110 +0111100 +0000000 + +0111100 ;54 '6' +1100110 +1100000 +1111100 +1100110 +1100110 +0111100 +0000000 + +1111110 ;55 '7' +0000110 +0001100 +0011000 +0110000 +0110000 +0110000 +0000000 + +0111100 ;56 '8' +1100110 +1100110 +0111100 +1100110 +1100110 +0111100 +0000000 + +0111100 ;57 '9' +1100110 +1100110 +0111110 +0000110 +1100110 +0111100 +0000000 + +0000 ;58 ':' +1110 +1110 +0000 +1110 +1110 +0000 +0000 + +0000 ;59 ';' +1110 +1110 +0000 +1110 +0110 +1100 +0000 + +000110 ;60 '<' +001100 +011000 +110000 +011000 +001100 +000110 +000000 + +000000 ;61 '=' +000000 +111110 +000000 +111110 +000000 +000000 +000000 + +110000 ;62 '>' +011000 +001100 +000110 +001100 +011000 +110000 +000000 + +0111100 ;63 '?' +1100110 +0000110 +0001100 +0011000 +0000000 +0011000 +0000000 + +0111100 ;64 '@' +1100110 +0000110 +0110110 +1010110 +1010110 +0111100 +0000000 + +0111100 ;65 'A' +1100110 +1100110 +1111110 +1100110 +1100110 +1100110 +0000000 + +1111100 ;66 'B' +1100110 +1100110 +1111100 +1100110 +1100110 +1111100 +0000000 + +0111100 ;67 'C' +1100110 +1100000 +1100000 +1100000 +1100110 +0111100 +0000000 + +1111000 ;68 'D' +1101100 +1100110 +1100110 +1100110 +1101100 +1111000 +0000000 + +111110 ;69 'E' +110000 +110000 +111100 +110000 +110000 +111110 +000000 + +111110 ;70 'F' +110000 +110000 +111100 +110000 +110000 +110000 +000000 + +0111100 ;71 'G' +1100110 +1100000 +1101110 +1100110 +1100110 +0111110 +0000000 + +1100110 ;72 'H' +1100110 +1100110 +1111110 +1100110 +1100110 +1100110 +0000000 + +11110 ;73 'I' +01100 +01100 +01100 +01100 +01100 +11110 +00000 + +0011110 ;74 'J' +0001100 +0001100 +0001100 +0001100 +1101100 +0111000 +0000000 + +1100110 ;75 'K' +1101100 +1111000 +1110000 +1111000 +1101100 +1100110 +0000000 + +110000 ;76 'L' +110000 +110000 +110000 +110000 +110000 +111110 +000000 + +11000110 ;77 'M' +11101110 +11010110 +11010110 +11000110 +11000110 +11000110 +00000000 + +1100110 ;78 'N' +1100110 +1110110 +1111110 +1101110 +1100110 +1100110 +0000000 + +0111100 ;79 'O' +1100110 +1100110 +1100110 +1100110 +1100110 +0111100 +0000000 + +1111100 ;80 'P' +1100110 +1100110 +1111100 +1100000 +1100000 +1100000 +0000000 + +0111100 ;81 'Q' +1100110 +1100110 +1100110 +1100110 +1101110 +0111100 +0000110 + +1111100 ;82 'R' +1100110 +1100110 +1111100 +1111000 +1101100 +1100110 +0000000 + +0111100 ;83 'S' +1100110 +1100000 +0111100 +0000110 +1100110 +0111100 +0000000 + +1111110 ;84 'T' +0011000 +0011000 +0011000 +0011000 +0011000 +0011000 +0000000 + +1100110 ;85 'U' +1100110 +1100110 +1100110 +1100110 +1100110 +0111100 +0000000 + +1100110 ;86 'V' +1100110 +1100110 +0111100 +0111100 +0011000 +0011000 +0000000 + +11000110 ;87 'W' +11000110 +11000110 +11000110 +11010110 +11010110 +01101100 +00000000 + +1100110 ;88 'X' +1100110 +0111100 +0111100 +0111100 +1100110 +1100110 +0000000 + +1100110 ;89 'Y' +1100110 +0111100 +0011000 +0011000 +0011000 +0011000 +0000000 + +1111110 ;90 'Z' +0000110 +0001100 +0011000 +0110000 +1100000 +1111110 +0000000 + +11110 ;91 '[' +11000 +11000 +11000 +11000 +11000 +11110 +00000 + +0000000 ;92 '\' +1100000 +0110000 +0011000 +0001100 +0000110 +0000000 +0000000 + +11110 ;93 ']' +00110 +00110 +00110 +00110 +00110 +11110 +00000 + +0011000 ;94 '^' +0111100 +1100110 +0000000 +0000000 +0000000 +0000000 +0000000 + +000000 ;95 '_' +000000 +000000 +000000 +000000 +000000 +111110 +000000 + +1110 ;96 '`' +1100 +0110 +0000 +0000 +0000 +0000 +0000 + +0000000 ;97 'a' +0000000 +0111100 +0000110 +0111110 +1100110 +0111110 +0000000 + +1100000 ;98 'b' +1100000 +1101100 +1110110 +1100110 +1100110 +1111100 +0000000 + +000000 ;99 'c' +000000 +011110 +110000 +110000 +110000 +011110 +000000 + +0000110 ;100 'd' +0000110 +0110110 +1101110 +1100110 +1100110 +0111110 +0000000 + +0000000 ;101 'e' +0000000 +0111100 +1100110 +1111110 +1100000 +0111100 +0000000 + +001110 ;102 'f' +011010 +011000 +111100 +011000 +011000 +011000 +000000 + +0000000 ;103 'g' +0000000 +0111110 +1100110 +1100110 +0111110 +0000110 +0111100 + +1100000 ;104 'h' +1100000 +1101100 +1110110 +1100110 +1100110 +1100110 +0000000 + +01100 ;105 'i' +00000 +11100 +01100 +01100 +01100 +11110 +00000 + +000110 ;106 'j' +000000 +001110 +000110 +000110 +000110 +110110 +011100 + +110000 ;107 'k' +110000 +110110 +111100 +111000 +111100 +110110 +000000 + +11100 ;108 'l' +01100 +01100 +01100 +01100 +01100 +11110 +00000 + +00000000 ;109 'm' +00000000 +11101100 +11010110 +11010110 +11000110 +11000110 +00000000 + +0000000 ;110 'n' +0000000 +1101100 +1110110 +1100110 +1100110 +1100110 +0000000 + +0000000 ;111 'o' +0000000 +0111100 +1100110 +1100110 +1100110 +0111100 +0000000 + +0000000 ;112 'p' +0000000 +1111100 +1100110 +1100110 +1111100 +1100000 +1100000 + +0000000 ;113 'q' +0000000 +0110110 +1101110 +1100110 +0111110 +0000110 +0000110 + +0000000 ;114 'r' +0000000 +1101100 +1110110 +1100000 +1100000 +1100000 +0000000 + +000000 ;115 's' +000000 +011110 +110000 +011100 +000110 +111100 +000000 + +011000 ;116 't' +011000 +111100 +011000 +011000 +011010 +001110 +000000 + +0000000 ;117 'u' +0000000 +1100110 +1100110 +1100110 +1101110 +0110110 +0000000 + +0000000 ;118 'v' +0000000 +1100110 +1100110 +1100110 +0111100 +0011000 +0000000 + +00000000 ;119 'w' +00000000 +11000110 +11000110 +11010110 +11010110 +01101100 +00000000 + +000000 ;120 'x' +000000 +110110 +110110 +011100 +110110 +110110 +000000 + +0000000 ;121 'y' +0000000 +1100110 +1100110 +1100110 +0111110 +0000110 +0111100 + +000000 ;122 'z' +000000 +111110 +000110 +011100 +110000 +111110 +000000 + +00110 ;123 '{' +01100 +01100 +11000 +01100 +01100 +00110 +00000 + +0110 ;124 '|' +0110 +0110 +0000 +0110 +0110 +0110 +0000 + +11000 ;125 '}' +01100 +01100 +00110 +01100 +01100 +11000 +00000 + +0110110 ;126 '~' +1101100 +0000000 +0000000 +0000000 +0000000 +0000000 +0000000 + +0000000 ;127 +0000000 +0011000 +0111100 +1100110 +1100110 +1111110 +0000000 + +0111100 ;128 '€' +1100110 +1100000 +1100000 +1100000 +1100110 +0111100 +0011000 + +1100110 ;129 '' +0000000 +1100110 +1100110 +1100110 +1101110 +0110110 +0000000 + +0001100 ;130 '‚' +0011000 +0111100 +1100110 +1111110 +1100000 +0111100 +0000000 + +0011000 ;131 'ƒ' +0100100 +0111100 +0000110 +0111110 +1100110 +0111110 +0000000 + +1100110 ;132 '„' +0000000 +0111100 +0000110 +0111110 +1100110 +0111110 +0000000 + +0110000 ;133 '…' +0011000 +0111100 +0000110 +0111110 +1100110 +0111110 +0000000 + +0011000 ;134 '†' +0000000 +0111100 +0000110 +0111110 +1100110 +0111110 +0000000 + +000000 ;135 '‡' +000000 +011110 +110000 +110000 +110000 +011110 +001100 + +0011000 ;136 'ˆ' +0100100 +0111100 +1100110 +1111110 +1100000 +0111100 +0000000 + +1100110 ;137 '‰' +0000000 +0111100 +1100110 +1111110 +1100000 +0111100 +0000000 + +0110000 ;138 'Š' +0011000 +0111100 +1100110 +1111110 +1100000 +0111100 +0000000 + +00000 ;139 '‹' +10010 +00000 +11100 +01100 +01100 +11110 +00000 + +01100 ;140 'Œ' +10010 +00000 +11100 +01100 +01100 +11110 +00000 + +11000 ;141 '' +01100 +00000 +11100 +01100 +01100 +11110 +00000 + +1100110 ;142 'Ž' +0000000 +0111100 +1100110 +1111110 +1100110 +1100110 +0000000 + +0011000 ;143 '' +0000000 +0111100 +1100110 +1111110 +1100110 +1100110 +0000000 + +001100 ;144 '' +011000 +111110 +110000 +111100 +110000 +111110 +000000 + +00000000 ;145 '‘' +00000000 +11101100 +00110110 +11111110 +11011000 +01111110 +00000000 + +01111110 ;146 '’' +11011000 +11011000 +11011100 +11111000 +11011000 +11011110 +00000000 + +0011000 ;147 '“' +0100100 +0000000 +0111100 +1100110 +1100110 +0111100 +0000000 + +0000000 ;148 '”' +1100110 +0000000 +0111100 +1100110 +1100110 +0111100 +0000000 + +0110000 ;149 '•' +0011000 +0000000 +0111100 +1100110 +1100110 +0111100 +0000000 + +0011000 ;150 '–' +0100100 +0000000 +1100110 +1100110 +1101110 +0110110 +0000000 + +0110000 ;151 '—' +0011000 +0000000 +1100110 +1100110 +1101110 +0110110 +0000000 + +0000000 ;152 '˜' +1100110 +0000000 +1100110 +1100110 +0111110 +0000110 +0111100 + +1100110 ;153 '™' +0000000 +0111100 +1100110 +1100110 +1100110 +0111100 +0000000 + +1100110 ;154 'š' +0000000 +1100110 +1100110 +1100110 +1100110 +0111100 +0000000 + +00000000 ;155 '›' +00000010 +01111100 +11001110 +11010110 +11100110 +01111100 +10000000 + +0011100 ;156 'œ' +0110110 +0110000 +1111000 +0110000 +0110000 +1111110 +0000000 + +00000110 ;157 '' +01111100 +11001110 +11011110 +11110110 +11100110 +01111100 +11000000 + +000000 ;158 'ž' +000000 +110110 +011100 +011100 +110110 +000000 +000000 + +00001110 ;159 'Ÿ' +00011010 +00011000 +01111100 +00110000 +00110000 +10110000 +11100000 + +0001100 ;160 ' ' +0011000 +0111100 +0000110 +0111110 +1100110 +0111110 +0000000 + +00110 ;161 '¡' +01100 +00000 +11100 +01100 +01100 +11110 +00000 + +0001100 ;162 '¢' +0011000 +0000000 +0111100 +1100110 +1100110 +0111100 +0000000 + +0001100 ;163 '£' +0011000 +0000000 +1100110 +1100110 +1101110 +0110110 +0000000 + +0110110 ;164 '¤' +1101100 +0000000 +1101100 +1110110 +1100110 +1100110 +0000000 + +0110110 ;165 '¥' +1101100 +1100110 +1110110 +1101110 +1100110 +1100110 +0000000 + +0111100 ;166 '¦' +1101100 +1101100 +0111110 +0000000 +1111110 +0000000 +0000000 + +011100 ;167 '§' +110110 +110110 +011100 +000000 +111110 +000000 +000000 + +0011000 ;168 '¨' +0000000 +0011000 +0110000 +1100000 +1100110 +0111100 +0000000 + +01111100 ;169 '©' +11000110 +10110010 +10101010 +10110010 +10101010 +11000110 +01111100 + +000000 ;170 'ª' +000000 +000000 +111110 +000110 +000110 +000000 +000000 + +1001100 ;171 '«' +1011000 +0110000 +1101100 +1010010 +0000100 +0001110 +0000000 + +1001100 ;172 '¬' +1011000 +0110100 +1101100 +1010100 +0011110 +0000100 +0000000 + +0110 ;173 '­' +0000 +0110 +0110 +0110 +0110 +0110 +0000 + +00000000 ;174 '®' +00110110 +01101100 +11011000 +01101100 +00110110 +00000000 +00000000 + +00000000 ;175 '¯' +11011000 +01101100 +00110110 +01101100 +11011000 +00000000 +00000000 + +11010110 ;176 '°' +00000000 +11010110 +00000000 +11010110 +00000000 +11010110 +00000000 + +10101010 ;177 '±' +01010101 +10101010 +01010101 +10101010 +01010101 +10101010 +01010101 + +10010010 ;178 '²' +01001001 +10010010 +01001001 +10010010 +01001001 +10010010 +01001001 + +00011000 ;179 '³' +00011000 +00011000 +00011000 +00011000 +00011000 +00011000 +00011000 + +00011000 ;180 '´' +00011000 +00011000 +11111000 +00011000 +00011000 +00011000 +00011000 + +0001100 ;181 'µ' +0011000 +0111100 +1100110 +1111110 +1100110 +1100110 +0000000 + +0011000 ;182 '¶' +0100100 +0111100 +1100110 +1111110 +1100110 +1100110 +0000000 + +0110000 ;183 '·' +0011000 +0111100 +1100110 +1111110 +1100110 +1100110 +0000000 + +01111100 ;184 '¸' +11000110 +10010010 +10100010 +10100010 +10010010 +11000110 +01111100 + +01100110 ;185 '¹' +01100110 +11100110 +00000110 +11100110 +01100110 +01100110 +01100110 + +01100110 ;186 'º' +01100110 +01100110 +01100110 +01100110 +01100110 +01100110 +01100110 + +00000000 ;187 '»' +00000000 +11111110 +00000110 +11100110 +01100110 +01100110 +01100110 + +01100110 ;188 '¼' +01100110 +11100110 +00000110 +11111110 +00000000 +00000000 +00000000 + +0000000 ;189 '½' +0001100 +0111110 +1101100 +1101100 +1101100 +0111110 +0001100 + +1100110 ;190 '¾' +0111100 +1111110 +0011000 +1111110 +0011000 +0011000 +0000000 + +00000000 ;191 '¿' +00000000 +00000000 +11111000 +00011000 +00011000 +00011000 +00011000 + +00011000 ;192 'À' +00011000 +00011000 +00011111 +00000000 +00000000 +00000000 +00000000 + +00011000 ;193 'Á' +00011000 +00011000 +11111111 +00000000 +00000000 +00000000 +00000000 + +00000000 ;194 'Â' +00000000 +00000000 +11111111 +00011000 +00011000 +00011000 +00011000 + +00011000 ;195 'Ã' +00011000 +00011000 +00011111 +00011000 +00011000 +00011000 +00011000 + +00000000 ;196 'Ä' +00000000 +00000000 +11111111 +00000000 +00000000 +00000000 +00000000 + +00011000 ;197 'Å' +00011000 +00011000 +11111111 +00011000 +00011000 +00011000 +00011000 + +0110110 ;198 'Æ' +1101100 +0111100 +0000110 +0111110 +1100110 +0111110 +0000000 + +0110110 ;199 'Ç' +1101100 +0111100 +1100110 +1111110 +1100110 +1100110 +0000000 + +01100110 ;200 'È' +01100110 +01100111 +01100000 +01111111 +00000000 +00000000 +00000000 + +00000000 ;201 'É' +00000000 +01111111 +01100000 +01100111 +01100110 +01100110 +01100110 + +01100110 ;202 'Ê' +01100110 +11100111 +00000000 +11111111 +00000000 +00000000 +00000000 + +00000000 ;203 'Ë' +00000000 +11111111 +00000000 +11100111 +01100110 +01100110 +01100110 + +01100110 ;204 'Ì' +01100110 +01100111 +01100000 +01100111 +01100110 +01100110 +01100110 + +00000000 ;205 'Í' +00000000 +11111111 +00000000 +11111111 +00000000 +00000000 +00000000 + +01100110 ;206 'Î' +01100110 +11100111 +00000000 +11100111 +01100110 +01100110 +01100110 + +0000000 ;207 'Ï' +0000000 +1100110 +0111100 +0100100 +0111100 +1100110 +0000000 + +0010110 ;208 'Ð' +0001100 +0011110 +0000110 +0111110 +1100110 +0111100 +0000000 + +01111100 ;209 'Ñ' +01100110 +01100110 +11110110 +01100110 +01100110 +01111100 +00000000 + +011000 ;210 'Ò' +100100 +111110 +110000 +111100 +110000 +111110 +000000 + +110110 ;211 'Ó' +000000 +111110 +110000 +111100 +110000 +111110 +000000 + +011000 ;212 'Ô' +001100 +111110 +110000 +111100 +110000 +111110 +000000 + +00000 ;213 'Õ' +11100 +01100 +01100 +01100 +11110 +00000 +00000 + +00110 ;214 'Ö' +01100 +11110 +01100 +01100 +01100 +11110 +00000 + +01100 ;215 '×' +10010 +11110 +01100 +01100 +01100 +11110 +00000 + +10010 ;216 'Ø' +00000 +11110 +01100 +01100 +01100 +11110 +00000 + +00011000 ;217 'Ù' +00011000 +00011000 +11111000 +00000000 +00000000 +00000000 +00000000 + +00000000 ;218 'Ú' +00000000 +00000000 +00011111 +00011000 +00011000 +00011000 +00011000 + +11111111 ;219 'Û' +11111111 +11111111 +11111111 +11111111 +11111111 +11111111 +11111111 + +00000000 ;220 'Ü' +00000000 +00000000 +00000000 +11111111 +11111111 +11111111 +11111111 + +0110 ;221 'Ý' +0110 +0110 +0000 +0000 +0110 +0110 +0110 + +11000 ;222 'Þ' +01100 +11110 +01100 +01100 +01100 +11110 +00000 + +11111111 ;223 'ß' +11111111 +11111111 +11111111 +00000000 +00000000 +00000000 +00000000 + +0001100 ;224 'à' +0011000 +0111100 +1100110 +1100110 +1100110 +0111100 +0000000 + +0000000 ;225 'á' +0111100 +1100110 +1111100 +1100110 +1100110 +1111100 +1100000 + +0011000 ;226 'â' +0100100 +0111100 +1100110 +1100110 +1100110 +0111100 +0000000 + +0110000 ;227 'ã' +0011000 +0111100 +1100110 +1100110 +1100110 +0111100 +0000000 + +0110110 ;228 'ä' +1101100 +0000000 +0111100 +1100110 +1100110 +0111100 +0000000 + +0110110 ;229 'å' +1101100 +0111100 +1100110 +1100110 +1100110 +0111100 +0000000 + +0000000 ;230 'æ' +0000000 +1100110 +1100110 +1100110 +1101110 +1110110 +1100000 + +1100000 ;231 'ç' +1101100 +1110110 +1110110 +1101100 +1100000 +1100000 +1100000 + +1111000 ;232 'è' +0110000 +0111100 +0110110 +0110110 +0111100 +0110000 +1111000 + +0001100 ;233 'é' +0011000 +1100110 +1100110 +1100110 +1100110 +0111100 +0000000 + +0011000 ;234 'ê' +0100100 +1100110 +1100110 +1100110 +1100110 +0111100 +0000000 + +0110000 ;235 'ë' +0011000 +1100110 +1100110 +1100110 +1100110 +0111100 +0000000 + +0001100 ;236 'ì' +0011000 +0000000 +1100110 +1100110 +0111110 +0000110 +0111100 + +0001100 ;237 'í' +0011000 +1100110 +1100110 +0111100 +0011000 +0011000 +0000000 + +0000 ;238 'î' +0000 +1110 +0000 +0000 +0000 +0000 +0000 + +00110 ;239 'ï' +01100 +00000 +00000 +00000 +00000 +00000 +00000 + +0000 ;240 'ð' +0000 +0000 +0000 +1110 +0000 +0000 +0000 + +0011000 ;241 'ñ' +0011000 +1111110 +0011000 +0011000 +0000000 +1111110 +0000000 + +000000 ;242 'ò' +000000 +000000 +000000 +000000 +111110 +000000 +111110 + +11000000 ;243 'ó' +01100000 +11100000 +01100000 +11001100 +00011100 +00111110 +00001100 + +01111110 ;244 'ô' +10110110 +10110110 +01110110 +00110110 +00110110 +00110110 +00000000 + +01110 ;245 'õ' +01100 +11110 +10010 +11110 +01100 +11100 +00000 + +0000000 ;246 'ö' +0011000 +0000000 +1111110 +0000000 +0011000 +0000000 +0000000 + +0000000 ;247 '÷' +0000000 +0000000 +0000000 +0000000 +0000000 +0001000 +0011000 + +011100 ;248 'ø' +110110 +110110 +011100 +000000 +000000 +000000 +000000 + +1100110 ;249 'ù' +0000000 +0000000 +0000000 +0000000 +0000000 +0000000 +0000000 + +0000 ;250 'ú' +0000 +0000 +1110 +1110 +0000 +0000 +0000 + +01100 ;251 'û' +11100 +01100 +01100 +11110 +00000 +00000 +00000 + +11100 ;252 'ü' +00110 +01100 +00110 +11100 +00000 +00000 +00000 + +01100 ;253 'ý' +10110 +00110 +01100 +11110 +00000 +00000 +00000 + +00000 ;254 'þ' +00000 +00000 +11100 +11100 +00000 +00000 +00000 + +00000000 ;255 'ÿ' +00000000 +00000000 +00000000 +00000000 +00000000 +00000000 +00000000 diff --git a/code/SIBOSDK/font/diary.fsc b/code/SIBOSDK/font/diary.fsc new file mode 100644 index 0000000..3b8ba19 --- /dev/null +++ b/code/SIBOSDK/font/diary.fsc @@ -0,0 +1,158 @@ +*name Diary +*descent 0 +*height 9 +*maxwid 8 + +*char 0 + +00000000000 ! DY_SYMBOL_ARROW_TAIL +00011100000 +00010100000 +00010100000 +00010100000 +00010100000 +00010100000 +00010100000 +00010100000 + +00010100000 ! DY_SYMBOL_ARROW_MIDDLE +00010100000 +00010100000 +00010100000 +00010100000 +00010100000 +00010100000 +00010100000 +00010100000 + +00000000000 ! DY_SYMBOL_ARROW_HEAD_CLOSED +00011100000 +00010100000 +00010100000 +01110111000 +00100010000 +00010100000 +00001000000 +00000000000 + +00010100000 ! DY_SYMBOL_ARROW_HEAD_OPEN +00010100000 +00010100000 +00010100000 +01110111000 +00100010000 +00010100000 +00001000000 +00000000000 + +1 ! DY_SYMBOL_VERTICAL_BAR +1 +1 +1 +1 +1 +1 +1 +1 + +00000000 ! Numeric space +00000000 +00000000 +00000000 +00000000 +00000000 +00000000 +00000000 +00000000 + +00000000 ! DY_SYMBOL_TODO_PRIORITY_ONE +00111000 +01101100 +11001110 +11101110 +11101110 +01101100 +00111000 +00000000 + +00000000 ! DY_SYMBOL_TODO_PRIORITY_TWO +00111000 +01000100 +11110110 +11101110 +11011110 +01000100 +00111000 +00000000 + +00000000 ! DY_SYMBOL_TODO_PRIORITY_THREE +00111000 +01000100 +11110110 +11100110 +11110110 +01000100 +00111000 +00000000 + +00000000 ! DY_SYMBOL_TODO_PRIORITY_FOUR +00111000 +01011100 +11011110 +11010110 +11000110 +01110100 +00111000 +00000000 + +00000000 ! DY_SYMBOL_TODO_PRIORITY_FIVE +00111000 +01000100 +11011110 +11000110 +11110110 +01000100 +00111000 +00000000 + +00000000 ! DY_SYMBOL_TODO_PRIORITY_SIX +00111000 +01000100 +11011110 +11000110 +11010110 +01000100 +00111000 +00000000 + +00000000 ! DY_SYMBOL_TODO_PRIORITY_SEVEN +00111000 +01000100 +11110110 +11110110 +11101110 +01101100 +00111000 +00000000 + +00000000 ! DY_SYMBOL_TODO_PRIORITY_EIGHT +00111000 +01000100 +11010110 +11000110 +11010110 +01000100 +00111000 +00000000 + +00000000 ! DY_SYMBOL_TODO_PRIORITY_NINE +00111000 +01000100 +11010110 +11000110 +11110110 +01110100 +00111000 +00000000 + + diff --git a/code/SIBOSDK/font/digit.fsc b/code/SIBOSDK/font/digit.fsc new file mode 100644 index 0000000..8586f65 --- /dev/null +++ b/code/SIBOSDK/font/digit.fsc @@ -0,0 +1,93 @@ +*name Sys$digt +*descent 1 +*height 6 +*max_width 6 + +*char 31 + +000000 +000000 +000000 +000000 +000000 +000000 + +000000 +000000 +000000 +000000 +000000 +000000 + +*char 48 + +011100 +100010 +100010 +100010 +011100 +000000 + +001000 +011000 +001000 +001000 +011100 +000000 + +011100 +100010 +001100 +010000 +111110 +000000 + +011100 +100010 +001100 +100010 +011100 +000000 + +000100 +001100 +010100 +111110 +000100 +000000 + +111110 +100000 +111100 +000010 +111100 +000000 + +011100 +100000 +111100 +100010 +011100 +000000 + +111110 +000010 +000100 +001000 +001000 +000000 + +011100 +100010 +011100 +100010 +011100 +000000 + +011100 +100010 +011110 +000010 +011100 +000000 + diff --git a/code/SIBOSDK/font/font.prj b/code/SIBOSDK/font/font.prj new file mode 100644 index 0000000..9f45d81 --- /dev/null +++ b/code/SIBOSDK/font/font.prj @@ -0,0 +1,11 @@ +FONT.PRJ ! This file +! +READ.ME ! About the \sibosdk\font directory +! +! =================== +! Sample font sources +! +NORM.FSC ! A 'normal' font +BOLD.FSC ! A bolded version of the above +DIGIT.FSC ! The Series 3 'digits' font +DIARY.FSC ! The Series 3 Agenda special character font diff --git a/code/SIBOSDK/font/norm.fsc b/code/SIBOSDK/font/norm.fsc new file mode 100644 index 0000000..cc98101 --- /dev/null +++ b/code/SIBOSDK/font/norm.fsc @@ -0,0 +1,2311 @@ +*name Sys$norm +*special 1 +*descent 1 +*height 8 +*maxwid 6 +*flag ascii +*flag cp850 + +000001 ;0 +000001 +000001 +001001 +011001 +111111 +011000 +001000 + +000000 ;1 +000000 +000000 +000000 +000000 +101010 +101010 +000000 + +10010 ;2 +10010 +01100 +00000 +11110 +00000 +00000 +00000 + +10010 ;3 +01100 +01100 +10010 +00000 +00000 +00000 +00000 + +111110 ;4 +100010 +100010 +100010 +101110 +101100 +111000 +000000 + +000000 ;5 +011100 +100010 +001000 +010100 +010100 +011100 +000000 + +001000 ;6 +010100 +010100 +111110 +110110 +110110 +011100 +000000 + +000000 ;7 +000000 +000000 +000000 +111110 +000000 +000000 +000000 + +000 ;8 +000 +000 +000 +000 +000 +010 +010 + +000000 ;9 +000000 +001000 +001100 +111110 +001100 +001000 +000000 + +001000 ;10 +001000 +001000 +001000 +001000 +111110 +011100 +001000 + +001110 ;11 +001000 +001000 +001000 +001000 +101000 +010000 +000000 + +00000011 ;12 +00000110 +00000110 +00001100 +00001100 +10011000 +11011000 +01110000 + +0000000 ;13 +0000000 +0011000 +0011000 +1111110 +0111100 +0011000 +0000000 + +000000 ;14 +000000 +000000 +110110 +000000 +000000 +000000 +000000 + +000 ;15 +000 +000 +000 +000 +000 +000 +000 + +000000 ;16 +001000 +001100 +111110 +111110 +001100 +001000 +000000 + +000000 ;17 +001000 +011000 +111110 +111110 +011000 +001000 +000000 + +001111 ;18 +010000 +010000 +010000 +010000 +010000 +010000 +001111 + +11100 ;19 +00010 +00010 +00010 +00010 +00010 +00010 +11100 + +001111 ;20 +011010 +010101 +011010 +010101 +011010 +010101 +001111 + +11100 ;21 +10110 +01010 +10110 +01010 +10110 +01010 +11100 + +001111 ;22 +011111 +011111 +011111 +011111 +011111 +011111 +001111 + +11100 ;23 +11110 +11110 +11110 +11110 +11110 +11110 +11100 + +001000 ;24 +011100 +111110 +001000 +001000 +001000 +001000 +000000 + +001000 ;25 +001000 +001000 +001000 +111110 +011100 +001000 +000000 + +00000000 ;26 +00001000 +00001100 +11111110 +00001100 +00001000 +00000000 +00000000 + +00000000 ;27 +00100000 +01100000 +11111110 +01100000 +00100000 +00000000 +00000000 + +10000 ;28 +11000 +11100 +11110 +11100 +11000 +10000 +00000 + +000000 ;29 +001000 +011100 +011100 +111110 +111110 +001000 +000000 + +0000000 ;30 +0000000 +0011000 +0111100 +1111110 +0011000 +0011000 +0000000 + +000000 ;31 +000000 +000000 +000000 +000000 +000000 +000000 +000000 + +000 ;32 ' ' +000 +000 +000 +000 +000 +000 +000 + +010 ;33 '!' +010 +010 +010 +010 +000 +010 +000 + +1010 ;34 '"' +1010 +1010 +0000 +0000 +0000 +0000 +0000 + +000000 ;35 '#' +010100 +111110 +010100 +010100 +111110 +010100 +000000 + +001000 ;36 '$' +011110 +101000 +011100 +001010 +111100 +001000 +000000 + +110000 ;37 '%' +110010 +000100 +001000 +010000 +100110 +000110 +000000 + +011000 ;38 '&' +100100 +101000 +010000 +101010 +100100 +011010 +000000 + +110 ;39 ''' +010 +100 +000 +000 +000 +000 +000 + +0010 ;40 '(' +0100 +1000 +1000 +1000 +0100 +0010 +0000 + +1000 ;41 ')' +0100 +0010 +0010 +0010 +0100 +1000 +0000 + +000000 ;42 '*' +001000 +101010 +011100 +101010 +001000 +000000 +000000 + +000000 ;43 '+' +001000 +001000 +111110 +001000 +001000 +000000 +000000 + +000 ;44 ',' +000 +000 +000 +110 +110 +010 +100 + +000000 ;45 '-' +000000 +000000 +111110 +000000 +000000 +000000 +000000 + +000 ;46 '.' +000 +000 +000 +000 +110 +110 +000 + +000000 ;47 '/' +000010 +000100 +001000 +010000 +100000 +000000 +000000 + +011100 ;48 '0' +100010 +100110 +101010 +110010 +100010 +011100 +000000 + +001000 ;49 '1' +011000 +001000 +001000 +001000 +001000 +011100 +000000 + +011100 ;50 '2' +100010 +000010 +000100 +001000 +010000 +111110 +000000 + +011100 ;51 '3' +100010 +000010 +001100 +000010 +100010 +011100 +000000 + +000100 ;52 '4' +001100 +010100 +100100 +111110 +000100 +000100 +000000 + +111110 ;53 '5' +100000 +111100 +000010 +000010 +100010 +011100 +000000 + +011100 ;54 '6' +100010 +100000 +111100 +100010 +100010 +011100 +000000 + +111110 ;55 '7' +000010 +000100 +001000 +010000 +010000 +010000 +000000 + +011100 ;56 '8' +100010 +100010 +011100 +100010 +100010 +011100 +000000 + +011100 ;57 '9' +100010 +100010 +011110 +000010 +100010 +011100 +000000 + +000 ;58 ':' +110 +110 +000 +110 +110 +000 +000 + +000 ;59 ';' +110 +110 +000 +110 +010 +100 +000 + +00010 ;60 '<' +00100 +01000 +10000 +01000 +00100 +00010 +00000 + +000000 ;61 '=' +000000 +111110 +000000 +111110 +000000 +000000 +000000 + +10000 ;62 '>' +01000 +00100 +00010 +00100 +01000 +10000 +00000 + +011100 ;63 '?' +100010 +000010 +000100 +001000 +000000 +001000 +000000 + +011100 ;64 '@' +100010 +000010 +011010 +101010 +101010 +011100 +000000 + +011100 ;65 'A' +100010 +100010 +111110 +100010 +100010 +100010 +000000 + +111100 ;66 'B' +100010 +100010 +111100 +100010 +100010 +111100 +000000 + +011100 ;67 'C' +100010 +100000 +100000 +100000 +100010 +011100 +000000 + +111000 ;68 'D' +100100 +100010 +100010 +100010 +100100 +111000 +000000 + +111110 ;69 'E' +100000 +100000 +111100 +100000 +100000 +111110 +000000 + +111110 ;70 'F' +100000 +100000 +111100 +100000 +100000 +100000 +000000 + +011100 ;71 'G' +100010 +100000 +100110 +100010 +100010 +011110 +000000 + +100010 ;72 'H' +100010 +100010 +111110 +100010 +100010 +100010 +000000 + +1110 ;73 'I' +0100 +0100 +0100 +0100 +0100 +1110 +0000 + +001110 ;74 'J' +000100 +000100 +000100 +000100 +100100 +011000 +000000 + +100010 ;75 'K' +100100 +101000 +110000 +101000 +100100 +100010 +000000 + +10000 ;76 'L' +10000 +10000 +10000 +10000 +10000 +11110 +00000 + +100010 ;77 'M' +110110 +101010 +101010 +100010 +100010 +100010 +000000 + +100010 ;78 'N' +110010 +101010 +101010 +100110 +100010 +100010 +000000 + +011100 ;79 'O' +100010 +100010 +100010 +100010 +100010 +011100 +000000 + +111100 ;80 'P' +100010 +100010 +111100 +100000 +100000 +100000 +000000 + +011100 ;81 'Q' +100010 +100010 +100010 +100010 +101010 +011100 +000010 + +111100 ;82 'R' +100010 +100010 +111100 +101000 +100100 +100010 +000000 + +011100 ;83 'S' +100010 +100000 +011100 +000010 +100010 +011100 +000000 + +111110 ;84 'T' +001000 +001000 +001000 +001000 +001000 +001000 +000000 + +100010 ;85 'U' +100010 +100010 +100010 +100010 +100010 +011100 +000000 + +100010 ;86 'V' +100010 +100010 +010100 +010100 +001000 +001000 +000000 + +100010 ;87 'W' +100010 +100010 +100010 +101010 +101010 +010100 +000000 + +100010 ;88 'X' +100010 +010100 +001000 +010100 +100010 +100010 +000000 + +100010 ;89 'Y' +100010 +010100 +001000 +001000 +001000 +001000 +000000 + +111110 ;90 'Z' +000010 +000100 +001000 +010000 +100000 +111110 +000000 + +1110 ;91 '[' +1000 +1000 +1000 +1000 +1000 +1110 +0000 + +000000 ;92 '\' +100000 +010000 +001000 +000100 +000010 +000000 +000000 + +1110 ;93 ']' +0010 +0010 +0010 +0010 +0010 +1110 +0000 + +001000 ;94 '^' +010100 +100010 +000000 +000000 +000000 +000000 +000000 + +000000 ;95 '_' +000000 +000000 +000000 +000000 +000000 +111110 +000000 + +110 ;96 '`' +100 +010 +000 +000 +000 +000 +000 + +000000 ;97 'a' +000000 +011100 +000010 +011110 +100010 +011110 +000000 + +100000 ;98 'b' +100000 +101100 +110010 +100010 +100010 +111100 +000000 + +00000 ;99 'c' +00000 +01110 +10000 +10000 +10000 +01110 +00000 + +000010 ;100 'd' +000010 +011010 +100110 +100010 +100010 +011110 +000000 + +000000 ;101 'e' +000000 +011100 +100010 +111110 +100000 +011100 +000000 + +00100 ;102 'f' +01010 +01000 +11100 +01000 +01000 +01000 +00000 + +000000 ;103 'g' +000000 +011110 +100010 +100010 +011110 +000010 +011100 + +100000 ;104 'h' +100000 +101100 +110010 +100010 +100010 +100010 +000000 + +0100 ;105 'i' +0000 +1100 +0100 +0100 +0100 +1110 +0000 + +00010 ;106 'j' +00000 +00110 +00010 +00010 +00010 +10010 +01100 + +10000 ;107 'k' +10000 +10010 +10100 +11000 +10100 +10010 +00000 + +1100 ;108 'l' +0100 +0100 +0100 +0100 +0100 +1110 +0000 + +000000 ;109 'm' +000000 +110100 +101010 +101010 +100010 +100010 +000000 + +000000 ;110 'n' +000000 +101100 +110010 +100010 +100010 +100010 +000000 + +000000 ;111 'o' +000000 +011100 +100010 +100010 +100010 +011100 +000000 + +000000 ;112 'p' +000000 +111100 +100010 +100010 +111100 +100000 +100000 + +000000 ;113 'q' +000000 +011010 +100110 +100010 +011110 +000010 +000010 + +000000 ;114 'r' +000000 +101100 +110010 +100000 +100000 +100000 +000000 + +00000 ;115 's' +00000 +01110 +10000 +01100 +00010 +11100 +00000 + +01000 ;116 't' +01000 +11100 +01000 +01000 +01010 +00100 +00000 + +000000 ;117 'u' +000000 +100010 +100010 +100010 +100110 +011010 +000000 + +000000 ;118 'v' +000000 +100010 +100010 +100010 +010100 +001000 +000000 + +000000 ;119 'w' +000000 +100010 +100010 +101010 +101010 +010100 +000000 + +00000 ;120 'x' +00000 +10010 +10010 +01100 +10010 +10010 +00000 + +000000 ;121 'y' +000000 +100010 +100010 +100010 +011110 +000010 +011100 + +00000 ;122 'z' +00000 +11110 +00010 +01100 +10000 +11110 +00000 + +0010 ;123 '{' +0100 +0100 +1000 +0100 +0100 +0010 +0000 + +010 ;124 '|' +010 +010 +000 +010 +010 +010 +000 + +1000 ;125 '}' +0100 +0100 +0010 +0100 +0100 +1000 +0000 + +01010 ;126 '~' +10100 +00000 +00000 +00000 +00000 +00000 +00000 + +000000 ;127 +000000 +001000 +010100 +100010 +100010 +111110 +000000 + +011100 ;128 '€' +100010 +100000 +100000 +100000 +100010 +011100 +001000 + +010100 ;129 '' +000000 +100010 +100010 +100010 +100110 +011010 +000000 + +000100 ;130 '‚' +001000 +011100 +100010 +111110 +100000 +011100 +000000 + +001000 ;131 'ƒ' +010100 +011100 +000010 +011110 +100010 +011110 +000000 + +010100 ;132 '„' +000000 +011100 +000010 +011110 +100010 +011110 +000000 + +010000 ;133 '…' +001000 +011100 +000010 +011110 +100010 +011110 +000000 + +001000 ;134 '†' +000000 +011100 +000010 +011110 +100010 +011110 +000000 + +00000 ;135 '‡' +00000 +01110 +10000 +10000 +10000 +01110 +00100 + +001000 ;136 'ˆ' +010100 +011100 +100010 +111110 +100000 +011100 +000000 + +010100 ;137 '‰' +000000 +011100 +100010 +111110 +100000 +011100 +000000 + +010000 ;138 'Š' +001000 +011100 +100010 +111110 +100000 +011100 +000000 + +0000 ;139 '‹' +1010 +0000 +1100 +0100 +0100 +1110 +0000 + +0100 ;140 'Œ' +1010 +0000 +1100 +0100 +0100 +1110 +0000 + +1000 ;141 '' +0100 +0000 +1100 +0100 +0100 +1110 +0000 + +010100 ;142 'Ž' +000000 +011100 +100010 +111110 +100010 +100010 +000000 + +001000 ;143 '' +000000 +011100 +100010 +111110 +100010 +100010 +000000 + +000100 ;144 '' +001000 +111110 +100000 +111100 +100000 +111110 +000000 + +000000 ;145 '‘' +000000 +110100 +001010 +111100 +101000 +010110 +000000 + +011110 ;146 '’' +101000 +101000 +101100 +111000 +101000 +101110 +000000 + +001000 ;147 '“' +010100 +000000 +011100 +100010 +100010 +011100 +000000 + +000000 ;148 '”' +010100 +000000 +011100 +100010 +100010 +011100 +000000 + +010000 ;149 '•' +001000 +000000 +011100 +100010 +100010 +011100 +000000 + +001000 ;150 '–' +010100 +000000 +100010 +100010 +100110 +011010 +000000 + +010000 ;151 '—' +001000 +000000 +100010 +100010 +100110 +011010 +000000 + +000000 ;152 '˜' +010100 +000000 +100010 +100010 +011110 +000010 +011100 + +010100 ;153 '™' +000000 +011100 +100010 +100010 +100010 +011100 +000000 + +010100 ;154 'š' +000000 +100010 +100010 +100010 +100010 +011100 +000000 + +000000 ;155 '›' +000010 +011100 +100110 +101010 +110010 +011100 +100000 + +001100 ;156 'œ' +010010 +010000 +111000 +010000 +010000 +111110 +000000 + +000010 ;157 '' +011100 +100110 +101010 +101010 +110010 +011100 +100000 + +00000 ;158 'ž' +00000 +10010 +01100 +01100 +10010 +00000 +00000 + +000110 ;159 'Ÿ' +001010 +001000 +011100 +001000 +001000 +101000 +110000 + +000100 ;160 ' ' +001000 +011100 +000010 +011110 +100010 +011110 +000000 + +0010 ;161 '¡' +0100 +0000 +1100 +0100 +0100 +1110 +0000 + +000100 ;162 '¢' +001000 +000000 +011100 +100010 +100010 +011100 +000000 + +000100 ;163 '£' +001000 +000000 +100010 +100010 +100110 +011010 +000000 + +001010 ;164 '¤' +010100 +000000 +101100 +110010 +100010 +100010 +000000 + +001010 ;165 '¥' +010100 +100010 +110010 +101010 +100110 +100010 +000000 + +011100 ;166 '¦' +100100 +100100 +011110 +000000 +111110 +000000 +000000 + +011000 ;167 '§' +100100 +100100 +011000 +000000 +111100 +000000 +000000 + +001000 ;168 '¨' +000000 +001000 +010000 +100000 +100010 +011100 +000000 + +00111000 ;169 '©' +01000100 +10110010 +10101010 +10110010 +10101010 +01000100 +00111000 + +00000 ;170 'ª' +00000 +00000 +11110 +00010 +00010 +00000 +00000 + +100100 ;171 '«' +101000 +010000 +101100 +010010 +000100 +001110 +000000 + +100100 ;172 '¬' +101000 +010100 +101100 +010100 +011110 +000100 +000000 + +010 ;173 '­' +000 +010 +010 +010 +010 +010 +000 + +000000 ;174 '®' +001010 +010100 +101000 +010100 +001010 +000000 +000000 + +000000 ;175 '¯' +101000 +010100 +001010 +010100 +101000 +000000 +000000 + +101010 ;176 '°' +000000 +101010 +000000 +101010 +000000 +101010 +000000 + +101010 ;177 '±' +010101 +101010 +010101 +101010 +010101 +101010 +010101 + +100100 ;178 '²' +010010 +100100 +010010 +100100 +010010 +100100 +010010 + +001000 ;179 '³' +001000 +001000 +001000 +001000 +001000 +001000 +001000 + +001000 ;180 '´' +001000 +001000 +111000 +001000 +001000 +001000 +001000 + +000100 ;181 'µ' +001000 +011100 +100010 +111110 +100010 +100010 +000000 + +001000 ;182 '¶' +010100 +011100 +100010 +111110 +100010 +100010 +000000 + +010000 ;183 '·' +001000 +011100 +100010 +111110 +100010 +100010 +000000 + +00111000 ;184 '¸' +01000100 +10010010 +10100010 +10100010 +10010010 +01000100 +00111000 + +010100 ;185 '¹' +010100 +110100 +000100 +110100 +010100 +010100 +010100 + +010100 ;186 'º' +010100 +010100 +010100 +010100 +010100 +010100 +010100 + +000000 ;187 '»' +000000 +111100 +000100 +110100 +010100 +010100 +010100 + +010100 ;188 '¼' +010100 +110100 +000100 +111100 +000000 +000000 +000000 + +00000 ;189 '½' +00100 +01110 +10100 +10100 +10100 +01110 +00100 + +100010 ;190 '¾' +010100 +111110 +001000 +111110 +001000 +001000 +000000 + +000000 ;191 '¿' +000000 +000000 +111000 +001000 +001000 +001000 +001000 + +001000 ;192 'À' +001000 +001000 +001111 +000000 +000000 +000000 +000000 + +001000 ;193 'Á' +001000 +001000 +111111 +000000 +000000 +000000 +000000 + +000000 ;194 'Â' +000000 +000000 +111111 +001000 +001000 +001000 +001000 + +001000 ;195 'Ã' +001000 +001000 +001111 +001000 +001000 +001000 +001000 + +000000 ;196 'Ä' +000000 +000000 +111111 +000000 +000000 +000000 +000000 + +001000 ;197 'Å' +001000 +001000 +111111 +001000 +001000 +001000 +001000 + +001010 ;198 'Æ' +010100 +011100 +000010 +011110 +100010 +011110 +000000 + +001010 ;199 'Ç' +010100 +011100 +100010 +111110 +100010 +100010 +000000 + +010100 ;200 'È' +010100 +010111 +010000 +011111 +000000 +000000 +000000 + +000000 ;201 'É' +000000 +011111 +010000 +010111 +010100 +010100 +010100 + +010100 ;202 'Ê' +010100 +110111 +000000 +111111 +000000 +000000 +000000 + +000000 ;203 'Ë' +000000 +111111 +000000 +110111 +010100 +010100 +010100 + +010100 ;204 'Ì' +010100 +010111 +010000 +010111 +010100 +010100 +010100 + +000000 ;205 'Í' +000000 +111111 +000000 +111111 +000000 +000000 +000000 + +010100 ;206 'Î' +010100 +110111 +000000 +110111 +010100 +010100 +010100 + +000000 ;207 'Ï' +000000 +100010 +011100 +010100 +011100 +100010 +000000 + +001010 ;208 'Ð' +000100 +001010 +000010 +011110 +100010 +011100 +000000 + +011100 ;209 'Ñ' +010010 +010010 +111010 +010010 +010010 +011100 +000000 + +001000 ;210 'Ò' +010100 +111110 +100000 +111100 +100000 +111110 +000000 + +010100 ;211 'Ó' +000000 +111110 +100000 +111100 +100000 +111110 +000000 + +010000 ;212 'Ô' +001000 +111110 +100000 +111100 +100000 +111110 +000000 + +0000 ;213 'Õ' +1100 +0100 +0100 +0100 +1110 +0000 +0000 + +0010 ;214 'Ö' +0100 +1110 +0100 +0100 +0100 +1110 +0000 + +0100 ;215 '×' +1010 +1110 +0100 +0100 +0100 +1110 +0000 + +1010 ;216 'Ø' +0000 +1110 +0100 +0100 +0100 +1110 +0000 + +001000 ;217 'Ù' +001000 +001000 +111000 +000000 +000000 +000000 +000000 + +000000 ;218 'Ú' +000000 +000000 +001111 +001000 +001000 +001000 +001000 + +111111 ;219 'Û' +111111 +111111 +111111 +111111 +111111 +111111 +111111 + +000000 ;220 'Ü' +000000 +000000 +000000 +111111 +111111 +111111 +111111 + +010 ;221 'Ý' +010 +010 +000 +000 +010 +010 +010 + +1000 ;222 'Þ' +0100 +1110 +0100 +0100 +0100 +1110 +0000 + +111111 ;223 'ß' +111111 +111111 +111111 +000000 +000000 +000000 +000000 + +000100 ;224 'à' +001000 +011100 +100010 +100010 +100010 +011100 +000000 + +000000 ;225 'á' +011100 +100010 +111100 +100010 +100010 +111100 +100000 + +001000 ;226 'â' +010100 +011100 +100010 +100010 +100010 +011100 +000000 + +010000 ;227 'ã' +001000 +011100 +100010 +100010 +100010 +011100 +000000 + +001010 ;228 'ä' +010100 +000000 +011100 +100010 +100010 +011100 +000000 + +001010 ;229 'å' +010100 +011100 +100010 +100010 +100010 +011100 +000000 + +000000 ;230 'æ' +000000 +100010 +100010 +100010 +100110 +111010 +100000 + +100000 ;231 'ç' +101100 +110010 +110010 +101100 +100000 +100000 +100000 + +111000 ;232 'è' +010000 +011100 +010010 +010010 +011100 +010000 +111000 + +000100 ;233 'é' +001000 +100010 +100010 +100010 +100010 +011100 +000000 + +001000 ;234 'ê' +010100 +100010 +100010 +100010 +100010 +011100 +000000 + +010000 ;235 'ë' +001000 +100010 +100010 +100010 +100010 +011100 +000000 + +000100 ;236 'ì' +001000 +000000 +100010 +100010 +011110 +000010 +011100 + +000100 ;237 'í' +001000 +100010 +100010 +010100 +001000 +001000 +000000 + +0000 ;238 'î' +0000 +1110 +0000 +0000 +0000 +0000 +0000 + +000100 ;239 'ï' +001000 +000000 +000000 +000000 +000000 +000000 +000000 + +0000 ;240 'ð' +0000 +0000 +0000 +1110 +0000 +0000 +0000 + +001000 ;241 'ñ' +001000 +111110 +001000 +001000 +000000 +111110 +000000 + +000000 ;242 'ò' +000000 +000000 +000000 +000000 +111110 +000000 +111110 + +100000 ;243 'ó' +010000 +110000 +010000 +100100 +001100 +011110 +000100 + +011110 ;244 'ô' +101010 +101010 +011010 +001010 +001010 +001010 +000000 + +0110 ;245 'õ' +0100 +1110 +1010 +1110 +0100 +1100 +0000 + +000000 ;246 'ö' +001000 +000000 +111110 +000000 +001000 +000000 +000000 + +000000 ;247 '÷' +000000 +000000 +000000 +000000 +000000 +001000 +001000 + +01100 ;248 'ø' +10010 +10010 +01100 +00000 +00000 +00000 +00000 + +010100 ;249 'ù' +000000 +000000 +000000 +000000 +000000 +000000 +000000 + +000 ;250 'ú' +000 +000 +110 +110 +000 +000 +000 + +0100 ;251 'û' +1100 +0100 +0100 +1110 +0000 +0000 +0000 + +1100 ;252 'ü' +0010 +0100 +0010 +1100 +0000 +0000 +0000 + +0100 ;253 'ý' +1010 +0010 +0100 +1110 +0000 +0000 +0000 + +0000 ;254 'þ' +0000 +0000 +1100 +1100 +0000 +0000 +0000 + +000000 ;255 'ÿ' +000000 +000000 +000000 +000000 +000000 +000000 +000000 diff --git a/code/SIBOSDK/font/read.me b/code/SIBOSDK/font/read.me new file mode 100644 index 0000000..d9886cd --- /dev/null +++ b/code/SIBOSDK/font/read.me @@ -0,0 +1,95 @@ +This directory contains demonstration font source (.fsc) files. + +Use the program wsfcomp.exe to generate font (.fon) files. For example, +to compile diary.fsc, producing diary.fon, just type: + + wsfcomp diary + +See FONT.PRJ (a plain text file) for an annotated list of the files in +this directory. + +A font source file contains a header section followed by patterns +which make up the font, as in the following extract from the +beginning of a font source file: + + *name System mono + *descent 2 + *height 10 + *maxwid 7 + *flag ascii + *flag cp850 + + *char 28 + + 100000000000 + 100001100000 + 100001100000 + 101111111100 + 100111111000 + 110011110111 + 000001100000 + 000000000000 + 111111111111 + 100000000000 + + 0000000 + 0000000 + 0001000 + 0001100 + 1111110 + 1111110 + 0001100 + 0001000 + 0000000 + 0000000 + + 0000000 + 0000011 + 0000011 + 0010011 + 0110011 + 1111111 + 1111111 + 0110000 + 0010000 + 0000000 + +The keywords have the following meanings: +----------------------------------------- + +*name The font name (maximum length 16 characters) + +*descent The descent for the font + +*height The height for the font + +*maxwid Not the real maximum width, but the width of the + widest normal character + +*flag Some informational flags + +*char Skip all characters up to the specified code. + Character codes start at 0 and follow sequentially + until the next *char statement + +The keyword "*special 1" may also be present, to specify a font +suitable for "fast" blitting onto the screen. If present, this +keyword must come before the *height statement. ("Fast" fonts must +have all their widths less than 9 pixels.) + +If the height of a character defined is less than that defined in the +header, blank rows are added at the top. + +Possible values for "*flag" (each one defined on its own line) are +"ascii", "cp850", "bold", "italic", and "serif". + +For more details about fonts, see the 'Text fonts' sections of both +the 'Introduction' and 'Graphics Output' chapters of the WSERV +Reference manual. + +Note that only the first letter of keywords and flagnames is +significant. Thus "*max_width" and "*maxwid" have the same effect. + +One tip when editing .fsc files is to temporarily change all '1's +into graphics square characters (ascii 219, say), and all '0's into +dots. Then change them back when you're finished. diff --git a/code/SIBOSDK/hcmast/big.fon b/code/SIBOSDK/hcmast/big.fon new file mode 100644 index 0000000..1de7bed Binary files /dev/null and b/code/SIBOSDK/hcmast/big.fon differ diff --git a/code/SIBOSDK/hcmast/cheng.cfo b/code/SIBOSDK/hcmast/cheng.cfo new file mode 100644 index 0000000..29da13a Binary files /dev/null and b/code/SIBOSDK/hcmast/cheng.cfo differ diff --git a/code/SIBOSDK/hcmast/chengel.cfo b/code/SIBOSDK/hcmast/chengel.cfo new file mode 100644 index 0000000..c7d5030 Binary files /dev/null and b/code/SIBOSDK/hcmast/chengel.cfo differ diff --git a/code/SIBOSDK/hcmast/chfrn.cfo b/code/SIBOSDK/hcmast/chfrn.cfo new file mode 100644 index 0000000..cd410e6 Binary files /dev/null and b/code/SIBOSDK/hcmast/chfrn.cfo differ diff --git a/code/SIBOSDK/hcmast/chfrnel.cfo b/code/SIBOSDK/hcmast/chfrnel.cfo new file mode 100644 index 0000000..c7d5030 Binary files /dev/null and b/code/SIBOSDK/hcmast/chfrnel.cfo differ diff --git a/code/SIBOSDK/hcmast/chnzl.cfo b/code/SIBOSDK/hcmast/chnzl.cfo new file mode 100644 index 0000000..bdcb246 Binary files /dev/null and b/code/SIBOSDK/hcmast/chnzl.cfo differ diff --git a/code/SIBOSDK/hcmast/chnzlel.cfo b/code/SIBOSDK/hcmast/chnzlel.cfo new file mode 100644 index 0000000..c7d5030 Binary files /dev/null and b/code/SIBOSDK/hcmast/chnzlel.cfo differ diff --git a/code/SIBOSDK/hcmast/chswe.cfo b/code/SIBOSDK/hcmast/chswe.cfo new file mode 100644 index 0000000..2a5049e Binary files /dev/null and b/code/SIBOSDK/hcmast/chswe.cfo differ diff --git a/code/SIBOSDK/hcmast/chsweel.cfo b/code/SIBOSDK/hcmast/chsweel.cfo new file mode 100644 index 0000000..c7d5030 Binary files /dev/null and b/code/SIBOSDK/hcmast/chsweel.cfo differ diff --git a/code/SIBOSDK/hcmast/custom$.dat b/code/SIBOSDK/hcmast/custom$.dat new file mode 100644 index 0000000..941f728 --- /dev/null +++ b/code/SIBOSDK/hcmast/custom$.dat @@ -0,0 +1 @@ +ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ \ No newline at end of file diff --git a/code/SIBOSDK/hcmast/makemast.bat b/code/SIBOSDK/hcmast/makemast.bat new file mode 100644 index 0000000..e4ecb60 --- /dev/null +++ b/code/SIBOSDK/hcmast/makemast.bat @@ -0,0 +1,6 @@ +@echo off +rem Specimen batch file to create master HC SSD +rem Drivers for external SSD drives must be installed +emast -u1 v033eeng.mas +echo Transferring other software... +xcopy \hcmast\*.* f:\*.* /s diff --git a/code/SIBOSDK/hcmast/mclinkpa.trm b/code/SIBOSDK/hcmast/mclinkpa.trm new file mode 100644 index 0000000..ae987b4 Binary files /dev/null and b/code/SIBOSDK/hcmast/mclinkpa.trm differ diff --git a/code/SIBOSDK/hcmast/mon_5x8.fon b/code/SIBOSDK/hcmast/mon_5x8.fon new file mode 100644 index 0000000..bce02a3 Binary files /dev/null and b/code/SIBOSDK/hcmast/mon_5x8.fon differ diff --git a/code/SIBOSDK/hcmast/mono.fon b/code/SIBOSDK/hcmast/mono.fon new file mode 100644 index 0000000..71b334f Binary files /dev/null and b/code/SIBOSDK/hcmast/mono.fon differ diff --git a/code/SIBOSDK/hcmast/mrchv.bat b/code/SIBOSDK/hcmast/mrchv.bat new file mode 100644 index 0000000..7c0cdf1 --- /dev/null +++ b/code/SIBOSDK/hcmast/mrchv.bat @@ -0,0 +1,3 @@ +rem Example batch file to create master file image of HC ROM +erom >sch.mep -c -m -b0xa000 -v0x033e -lsch -oENG epocchp +type sch.mep diff --git a/code/SIBOSDK/hcmast/olib.dyl b/code/SIBOSDK/hcmast/olib.dyl new file mode 100644 index 0000000..34d4d2e Binary files /dev/null and b/code/SIBOSDK/hcmast/olib.dyl differ diff --git a/code/SIBOSDK/hcmast/olibx.dyl b/code/SIBOSDK/hcmast/olibx.dyl new file mode 100644 index 0000000..04ef26a Binary files /dev/null and b/code/SIBOSDK/hcmast/olibx.dyl differ diff --git a/code/SIBOSDK/hcmast/oplch.dyl b/code/SIBOSDK/hcmast/oplch.dyl new file mode 100644 index 0000000..e0befa8 Binary files /dev/null and b/code/SIBOSDK/hcmast/oplch.dyl differ diff --git a/code/SIBOSDK/hcmast/oplterr.rsc b/code/SIBOSDK/hcmast/oplterr.rsc new file mode 100644 index 0000000..21426fd Binary files /dev/null and b/code/SIBOSDK/hcmast/oplterr.rsc differ diff --git a/code/SIBOSDK/hcmast/repro.app b/code/SIBOSDK/hcmast/repro.app new file mode 100644 index 0000000..b3c55c4 Binary files /dev/null and b/code/SIBOSDK/hcmast/repro.app differ diff --git a/code/SIBOSDK/hcmast/sch.rom b/code/SIBOSDK/hcmast/sch.rom new file mode 100644 index 0000000..a7ee048 --- /dev/null +++ b/code/SIBOSDK/hcmast/sch.rom @@ -0,0 +1,22 @@ +cheng.cfo,sys$ctry.cfo +wsrvhch1.img,sys$wsrv.img +corpshll.img,sys$shll.img +corpntfy.img,sys$ntfy.img +sys$env.ini +sys$rfsv.img +sys$ncp.img +link.img +mclinkpa.trm,mclink.trm +olib.dyl +big.fon +small.fon +mon_5x8.fon +mono.fon +sys$norm.fon +sys$bold.fon +exopl.img +oplch.dyl,opl.dyl +batchk.img +ttest.img +pprint.img +custom$.dat diff --git a/code/SIBOSDK/hcmast/small.fon b/code/SIBOSDK/hcmast/small.fon new file mode 100644 index 0000000..a8c9689 Binary files /dev/null and b/code/SIBOSDK/hcmast/small.fon differ diff --git a/code/SIBOSDK/hcmast/sys$bold.fon b/code/SIBOSDK/hcmast/sys$bold.fon new file mode 100644 index 0000000..44cf92b Binary files /dev/null and b/code/SIBOSDK/hcmast/sys$bold.fon differ diff --git a/code/SIBOSDK/hcmast/sys$env.ini b/code/SIBOSDK/hcmast/sys$env.ini new file mode 100644 index 0000000..a9ef960 Binary files /dev/null and b/code/SIBOSDK/hcmast/sys$env.ini differ diff --git a/code/SIBOSDK/hcmast/sys$norm.fon b/code/SIBOSDK/hcmast/sys$norm.fon new file mode 100644 index 0000000..59f90c4 Binary files /dev/null and b/code/SIBOSDK/hcmast/sys$norm.fon differ diff --git a/code/SIBOSDK/hcmast/sys$rem.pdd b/code/SIBOSDK/hcmast/sys$rem.pdd new file mode 100644 index 0000000..20dc33d Binary files /dev/null and b/code/SIBOSDK/hcmast/sys$rem.pdd differ diff --git a/code/SIBOSDK/hcmast/ukdatach.cfo b/code/SIBOSDK/hcmast/ukdatach.cfo new file mode 100644 index 0000000..ffe0d00 Binary files /dev/null and b/code/SIBOSDK/hcmast/ukdatach.cfo differ diff --git a/code/SIBOSDK/hwdemo/cc.bat b/code/SIBOSDK/hwdemo/cc.bat new file mode 100644 index 0000000..42c025d --- /dev/null +++ b/code/SIBOSDK/hwdemo/cc.bat @@ -0,0 +1,8 @@ +@echo off +call checkvid +if exist %1.pr goto custom +tsc %1.c /fpunnamed /%jpivid% +goto end +:custom +tsc %1.c /fp%1 /%jpivid% +:end diff --git a/code/SIBOSDK/hwdemo/checkvid.bat b/code/SIBOSDK/hwdemo/checkvid.bat new file mode 100644 index 0000000..5c6199f --- /dev/null +++ b/code/SIBOSDK/hwdemo/checkvid.bat @@ -0,0 +1,2 @@ +@if not "%jpivid%"=="v2" set jpivid=v0 + diff --git a/code/SIBOSDK/hwdemo/days.afl b/code/SIBOSDK/hwdemo/days.afl new file mode 100644 index 0000000..560d29b --- /dev/null +++ b/code/SIBOSDK/hwdemo/days.afl @@ -0,0 +1,3 @@ +days.pic +days.rsc +days.shd diff --git a/code/SIBOSDK/hwdemo/days.c b/code/SIBOSDK/hwdemo/days.c new file mode 100644 index 0000000..82a8151 --- /dev/null +++ b/code/SIBOSDK/hwdemo/days.c @@ -0,0 +1,1817 @@ +/* + DAYS.C + +Written by DavidW +Started on 4/12/91 +*/ + +#include /* basic Psion header file */ +#include /* defines E_FILE_ error values, etc */ +#include /* defines DbfXXX functions */ +#include /* defines date and time functions */ +#include /* defines E_CONFIG struct */ +#include /* general Epoc definitions */ +#include /* defines al Window Server library functions */ +#include /* defines all Hwif library functions */ + +GLREF_D UWORD DatLocked; /* non-zero when application "busy" */ +GLREF_D TEXT *DatUsedPathNamePtr; /* full path name of current file */ + +LOCAL_D TEXT *cmds[]= + { /* the commands in the menu bar */ + "nNew", + "oOpen", + "mMerge", + "aSave as", + "kCompress", + "xExit", + "iInsert text", + "cCopy text", + "vEvaluate", + "hShow symbols", + "sSave", + "rRevert", + "eEnter anniversary", + "dDelete anniversary", + "uChange date", + "fFind", + "gFind next", + "bFind back", + "tFind date", + "jJump to", + "lList view", + "wWander through", + "pPrint", + "yPrint setup", + NULL + }; + +#define FILE_ITEMS 6 /* how many items in each menu */ +#define EDIT_ITEMS 6 +#define CHANGE_ITEMS 3 +#define SEARCH_ITEMS 5 +#define SPECIAL_ITEMS 4 + +#define ITEMS_BEFORE_FILE 0 +#define ITEMS_BEFORE_EDIT FILE_ITEMS +#define ITEMS_BEFORE_CHANGE (ITEMS_BEFORE_EDIT+EDIT_ITEMS) +#define ITEMS_BEFORE_SEARCH (ITEMS_BEFORE_CHANGE+CHANGE_ITEMS) +#define ITEMS_BEFORE_SPECIAL (ITEMS_BEFORE_SEARCH+SEARCH_ITEMS) + +#define LIST_ITEM ITEMS_BEFORE_SPECIAL +#define SYMBOLS_ITEM ITEMS_BEFORE_EDIT+3 + +LOCAL_D H_MENU_DATA mdata[]= + { /* the menus in the menu bar */ + "File",FILE_ITEMS, + "Edit",EDIT_ITEMS, + "Change",CHANGE_ITEMS, + "Search",SEARCH_ITEMS, + "Special",SPECIAL_ITEMS, + NULL + }; + +GLDEF_D TEXT ** _cmds=(&cmds[0]); /* Hwif code expects this */ +GLDEF_D H_MENU_DATA * _mdata=(&mdata[0]); /* Hwif code expects this */ + +LOCAL_D UINT MainWid; /* ID of main window */ + +LOCAL_D struct + { /* format of data at start of Days DBF file */ + UWORD dataStart; + UWORD needVersion; + UWORD firHeader; + UBYTE fir[3]; + } ModelHeader= + { + DbfHeaderLength, + 0x100f, /* DBF code version number required */ + (DbfRecordTypeFir<<12)|3, /* 3 fields defined */ + { + DbfFieldTypeWord, /* word field ("DayInYear") */ + DbfFieldTypeString, /* string field ("name") */ + DbfFieldTypeString /* string field ("notes") */ + } + }; + +LOCAL_D TEXT filename[P_FNAMESIZE]; /* for current filename */ +LOCAL_D VOID *dH; /* handle for DbfXXX services */ +LOCAL_D UBYTE dBuf[512]; /* buffer used by DbfXXX services */ +LOCAL_D UWORD dOff; /* current offset into dBuf[] */ + +typedef struct + { /* structure of INDex ENTry */ + UWORD diy; /* no of Day In Year */ + UWORD no; /* no of record in file (secondary key) */ + } INDENT; + +LOCAL_D INDENT index[500]; /* cope with up to 500 entries */ +LOCAL_D WORD count; /* how many entries */ +LOCAL_D WORD where; /* current entry */ + +LOCAL_D WORD top; /* entry at top of screen (list view) */ +LOCAL_D UWORD ViewList=FALSE; /* TRUE if in list view */ + +LOCAL_D VOID *edit[3]; /* the three editors */ +LOCAL_D UWORD show_statwin=TRUE; /* whether Status Window is showing */ +LOCAL_D UWORD ScreenWidth; /* width of main display area */ +LOCAL_D INT emph=0; /* which editor is emphasised */ + +LOCAL_D UWORD lastbflags=W_BORD_CORNER_4; /* state of border flags */ + +LOCAL_D UWORD ShowSymbols=FALSE; /* whether editors display symbols */ + +LOCAL_D WORD currdiy; /* Day In Year of current entry */ +LOCAL_D WORD origdiy; /* currdiy before operation started */ +LOCAL_D WORD dummdiy; /* DIY of dummy entry (placeholder for real one) */ + +LOCAL_D WORD DummyEntry=FALSE; /* whether dummy entry in place */ +LOCAL_D WORD lastchanged=FALSE; /* last state of "changed" flag */ + +LOCAL_D UBYTE daysim[]={31,29,31,30,31,30,31,31,30,31,30,31}; + +LOCAL_D TEXT find[20]={0}; /* the current find string */ +LOCAL_D UWORD findtype=1; /* which type of find is being done */ + +LOCAL_D UWORD PrintNamesOnly=1; /* whether only to print names */ +LOCAL_D UWORD PrintRec; /* which record is being printed */ +LOCAL_D UWORD PrintState; /* which part of the record is being printed */ +LOCAL_D UBYTE *PrintBuf; /* the text being printed */ +LOCAL_D WORD PrintLen; /* length of text being printed */ +LOCAL_D WORD PrintIndent; /* indent before text being printed */ +LOCAL_D TEXT PrintDate[40]; /* text of date of entry being printed */ + +LOCAL_D UWORD tly[]={0,17,35}; /* top left y-positions of three editors */ +LOCAL_D UWORD bry[]={15,32,80}; /* bottom right y-positions of editors */ + + +LOCAL_C VOID DrawBorder(INT i) + { /* draw border round i-th editor and emphasise */ + P_RECT rect; /* appropriate rectangle */ + + rect.tl.x=0; + rect.br.x=ScreenWidth; + if (!i) + rect.br.x-=54; + else if (i==1) + rect.br.x-=10; + rect.tl.y=tly[i]; + rect.br.y=bry[i]; + gBorderRect(&rect, /* should border be emphasised? */ + W_BORD_CORNER_4|W_BORD_SHADOW_S|(i==emph? W_BORD_SHADOW_ON: 0)); + hEBEmphasise(edit[i],i==emph); /* emphasise or de-emphasise editor */ + } + +LOCAL_C VOID DrawWhereAndCount(VOID) + { /* draw the text "n/m" */ + TEXT buf[10]; + P_RECT box; /* where to draw the text */ + + p_atos(&buf[0],"%d/%d",where+1,count); /* construct text to display */ + box.tl.x=ScreenWidth-54; + box.tl.y=2; + box.br.x=ScreenWidth; + box.br.y=12; + gPrintBoxText(&box,8,G_TEXT_ALIGN_CENTRE,0,buf,p_slen(buf)); + } + +LOCAL_C INT CheckIfChanged(VOID) + { /* return TRUE if current entry has been changed */ + if (ViewList) + return(0); + return(origdiy!=currdiy + || hEBSenseChanged(edit[1]) || hEBSenseChanged(edit[2])); + } + +LOCAL_C INT FindMonNo(INT *pdiy) + { /* find month number corresponding to day-in-year */ + INT monno; + + monno=0; + while (*pdiy>=daysim[monno]) + (*pdiy)-=daysim[monno++]; + return(monno); + } + +LOCAL_C VOID DiyToBuf(INT diy,TEXT *pb) + { /* get full textual representation of day in year */ + E_CONFIG cfg; /* current system defaults */ + TEXT mon[32]; /* name of month */ + TEXT suff[31][3]; /* numerical suffices */ + + p_nmmon(&mon[0],FindMonNo(&diy)); + p_getsuffixes(&suff[0][0]); + p_getctd(&cfg); + if (cfg.dateType==E_DATE_EUROPE) + p_atos(pb,"%u%s %s",diy+1,&suff[diy][0],&mon[0]); + else + p_atos(pb,"%s %u%s",&mon[0],diy+1,&suff[diy][0]); + } + +LOCAL_C VOID DiyToShortBuf(INT diy,TEXT *pb) + { /* get short textual representation of day in year */ + INT mon; + E_CONFIG cfg; /* to find date separator */ + INT first; /* either day number or month number */ + INT second; /* the other */ + + mon=FindMonNo(&diy)+1; + diy++; + p_getctd(&cfg); + if (cfg.dateType==E_DATE_EUROPE) + { + first=diy; + second=mon; + } + else + { + first=mon; + second=diy; + } + p_atos(pb,"%u%c%u",first,cfg.dateSeparator,second); + } + +LOCAL_C INT SetDateText(INT diy) + { /* set date text into the date "editor" */ + TEXT date[40]; + + DiyToBuf(diy,&date[0]); + return(hEBSetText(edit[0],&date[0],p_slen(&date[0]))); + } + +LOCAL_C VOID ClearChangedFlags(VOID) + { /* acknowledge that changes have been absorbed */ + origdiy=currdiy; + hEBClearChanged(edit[1]); + hEBClearChanged(edit[2]); + } + +LOCAL_C VOID ZeroBufferStart(VOID) + { /* put dummy entry at start of dBuf[] */ + *(UWORD *)(&dBuf[2])=dummdiy; + *(UWORD *)(&dBuf[4])=0; + dOff=0; + DbfTrash(dH); + } + +LOCAL_C VOID Check(INT val) + { /* terminate application on file error */ + TEXT buf[64]; + + if (val<0 && val!=E_FILE_EOF) + { + uForceToFront(); /* come into foreground */ + DatLocked=TRUE; + p_errs(&buf[0],val); /* get error string */ + wsAlertW(WS_ALERT_CLIENT,&buf[0],"Terminating application",0); + p_exit(0); /* exit cleanly */ + } + } + +LOCAL_C VOID SeekTo(UINT current) + { /* read the specified record into dBuf[] */ + Check(DbfAbsRead(dH,current,&dOff)); + } + +LOCAL_C INT LoadBuffer(INT j) + { /* read the specified record (maybe dummy) into dBuf[] */ + INT no; + + if (j>=count) + return(-1); /* no such record */ + no=index[j].no; + if (DummyEntry && no==count-1) + ZeroBufferStart(); /* record in process of being added */ + else + SeekTo(no); /* real record */ + return(0); + } + +LOCAL_C VOID LoadEditors(VOID) + { /* load editors in preparation to edit current entry */ + UBYTE *psrc; /* points into dBuf[] */ + INT len; /* length of text field */ + + LoadBuffer(where); /* read current record into dBuf[] */ + psrc=(&dBuf[dOff+2]); /* position psrc to start of record */ + ClearChangedFlags(); /* no changes made yet */ + DrawWhereAndCount(); /* display new "n/m" text */ + origdiy=currdiy=(*(UWORD *)psrc); /* read the Day In Year */ + if (SetDateText(currdiy)) /* set text of date "editor" */ + return; + psrc+=2; /* increment to first text field */ + len=(*psrc); /* length of first text field */ + if (hEBSetText(edit[1],(TEXT *)psrc+1,len)) + return; + psrc+=len+1; /* increment to second text field */ + hEBSetText(edit[2],(TEXT *)psrc+1,*psrc); + } + +LOCAL_C INT AddMonthChoiceList(UWORD *pmonno) + { /* add choice list of all month names to current dialog */ + H_DI_CHOICE ch; + TEXT mon[32]; /* for name of current month */ + INT i; + + if (uBeginDCL(&ch)) + return(-1); + for (i=0; i<12; i++) + { /* for each month */ + p_nmmon(&mon[0],i); /* look up month name */ + if (uGrowDCL(&ch,&mon[0])) /* try to add next entry */ + return(-1); + } + return(uAddDCL("Month",pmonno,&ch)); + } + +LOCAL_C INT FindDiy(INT monno,INT dayinm) + { /* find DayInYear for given day in given month */ + while (monno) + dayinm+=daysim[--monno]; + return(dayinm); + } + +LOCAL_C VOID IndexDelete(VOID) + { /* delete an item from the index */ + UWORD deleted; /* the record number of item deleted */ + UWORD i; + INDENT *pindent; + UWORD tomove; + + deleted=index[where].no; + count--; /* decrement total count number */ + tomove=count-where; /* how many index entries to move to close gap */ + p_bcpy(&index[where],&index[where+1],tomove*sizeof(INDENT)); + pindent=(&index[0]); /* to scan through all index entries */ + i=count; + while (i--) + { + if (pindent->no>deleted) + (pindent->no)--; /* since this record number now one less */ + pindent++; + } + } + +LOCAL_C UWORD FindKey(VOID) + { /* read the DayInYear of the current entry */ + return(*(UWORD *)(&dBuf[dOff+2])); + } + +LOCAL_C INT compare(INDENT *p1,INDENT *p2) + { /* find which of two entries is first in order */ + UWORD diff; + + diff=p1->diy-p2->diy; + return(diff? diff: p1->no-p2->no); + } + +LOCAL_C INT cmp(INT r,VOID *pindent) + { /* routine expected by p_bsrch */ + return(compare(pindent,&index[r])); + } + +LOCAL_C INT LocateByDate(INDENT *pent) + { /* locate index position matching (or nearest after) given entry */ + INT dir; /* direction to nearest hit (as given by p_bsrch) */ + INT mid; /* nearest hit (as given by p_bsrch) */ + + if (!count) + mid=0; + else + { + dir=p_bsrch(count,cmp,&mid,pent); + if (dir>0) + mid++; + } + return(mid); + } + +LOCAL_C VOID IndexAppend() + { /* add index entry for new record at end of file */ + INT mid; + UWORD tomove; + INDENT new; + + new.no=count; /* new record added at end of file */ + new.diy=currdiy; + mid=LocateByDate(&new); /* find where to insert index entry */ + tomove=count-mid; /* how many entries to move down */ + count++; /* increment total count of records */ + p_bcpy(&index[mid+1],&index[mid],tomove*sizeof(INDENT)); + index[mid]=new; /* write in the new entry */ + where=mid; /* this entry is now current */ + } + +LOCAL_C VOID IndexUpdate(VOID) + { /* update index entry for record updated */ + IndexDelete(); /* delete the old entry... */ + IndexAppend(); /* ...and construct a new one */ + } + +LOCAL_C INT Try(INT ret,TEXT *msg) + { /* in case of file error, give user chance to retry */ + TEXT buf[64]; + + if (ret>=0) + return(0); /* no error */ + uForceToFront(); /* come to foreground */ + DatLocked=TRUE; /* mark application as "busy" */ + p_errs(&buf[0],ret); + if (wsAlertW(WS_ALERT_CLIENT,msg,&buf[0],"Continue","Exit",0)) + p_exit(0); /* user is willing to exit application */ + DatLocked=FALSE; + return(-1); + } + +LOCAL_C VOID SeekToCurrent(VOID) + { /* read the current record into dBuf[] */ + SeekTo(index[where].no); + } + +LOCAL_C INT DoUpdate(INT len) + { /* user has finished updating record */ + INT state; + + if (DummyEntry) + { /* was editing dummy record - so append real one */ + if (Try(DbfAppend(dH,len),"Failed to save changes")) + return(-1); + DummyEntry=FALSE; + } + else + { + SeekToCurrent(); /* find the record to update */ + state=DbfStateDisabled; /* instant update */ + if (Try(DbfUpdate(&state,dH,len),"Failed to save changes")) + return(-1); + } + IndexUpdate(); /* update the corresponding index entry */ + return(0); + } + +LOCAL_C VOID EditEmphasise(INT flag) + { /* pass emphasis or de-emphasis message to current editor */ + if (!ViewList) + hEBEmphasise(edit[emph],flag); + } /* else no editors */ + +LOCAL_C INT RunDialog(VOID) + { /* layer round dialog code to handle cursor flashing */ + INT ret; + + EditEmphasise(FALSE); /* remove any flashing cursor */ + ret=uRunDialog(); /* run the dialog */ + EditEmphasise(TRUE); /* reinstate any flashing cursor */ + return(ret); + } + +LOCAL_C INT Confirm(TEXT *pb) + { /* present a "No/Yes" dialog */ + if (uOpenDialog(pb)) /* title text supplied by caller */ + return(-1); + if (uAddButtonList("No",-'n',"Yes",'y',NULL)) + return(-1); + return(RunDialog()!='y'); /* return TRUE iff user answered Yes */ + } + +LOCAL_C INT SizeRecord(VOID) + { /* return the length of first text field in current record */ + return(*(UWORD *)&dBuf[dOff+4]); + } + +LOCAL_C VOID AddDummyEntry() + { /* add index position for record in process of being defined */ + DummyEntry=TRUE; + dummdiy=currdiy; + IndexAppend(); + } + +LOCAL_C INT CalculateBflags(VOID) + { /* find whether scroll arrows should be displayed on border */ + INT bflags; + + if (top) /* check if more records off top of screen */ + bflags=W_BORD_CORNER_4|W_BORD_TOP_ON; + else + bflags=W_BORD_CORNER_4|W_BORD_TOP_OFF; + if (top+8tl.y=4+y*9; + pbox->br.y=pbox->tl.y+9; + } + +LOCAL_C VOID LineToScreen(INT y,INT x1,INT x2,INT align,TEXT *pb,INT tlen) + { /* utility layer around gPrintBoxText */ + P_RECT box; + + box.tl.x=x1; + box.br.x=x2; + LoadYs(&box,y); + gPrintBoxText(&box,8,align,0,pb,tlen); + } + +LOCAL_C VOID ClrLine(INT y) + { /* clear a line on the screen */ + P_RECT box; + + box.tl.x=4; + box.br.x=ScreenWidth-4; + LoadYs(&box,y); + gClrRect(&box,G_TRMODE_CLR); + } + +LOCAL_C VOID SetBold(INT flag) + { /* prepare to print in bold (or in non-bold) */ + G_GC gc; + + gc.font=WS_FONT_BASE+flag; + gSetGC(0,G_GC_MASK_FONT,&gc); + } + +LOCAL_C VOID GetCursorBox(INT i,P_RECT *pbox) + { /* get rectangle to draw cursor for specified entry */ + pbox->tl.x=4; + pbox->br.x=10; + LoadYs(pbox,i); + } + +LOCAL_C VOID DrawCursor(INT i,INT on) + { /* draw (or clear) cursor alongside given entry */ + P_RECT box; + + GetCursorBox(i,&box); + gPrintBoxText(&box,8,G_TEXT_ALIGN_LEFT,0,"\034",on); + } + +LOCAL_C VOID DrawLine(INT i) + { /* display a given entry on a line on screen */ + INT entno; + UBYTE *psrc; /* pointer into dBuf[] */ + TEXT date[6]; /* for short textual representation of date */ + + entno=i+top; /* offset by no of entry at screen top */ + if (LoadBuffer(entno)) + { /* no such entry */ + ClrLine(i); + return; + } + psrc=(&dBuf[dOff+2]); /* point to start of record */ + DiyToShortBuf(*(UWORD *)psrc,&date[0]); /* get short date text */ + DrawCursor(i,entno==where); /* draw or clear cursor */ + SetBold(TRUE); /* draw date in bold */ + LineToScreen(i,14,49,G_TEXT_ALIGN_RIGHT,&date[0],p_slen(&date[0])); + psrc+=2; /* position to first text field */ + SetBold(FALSE); /* print remainder in non-bold */ + LineToScreen(i,54,ScreenWidth-4,G_TEXT_ALIGN_LEFT,(TEXT *)psrc+1,*psrc); + } + +LOCAL_C VOID ListDisplay(VOID) + { /* redraw all visible entries (in list view) */ + INT i; + + for (i=0; i<8; i++) + DrawLine(i); + } + +LOCAL_C VOID WholeListDisplay(VOID) + { /* re-display whole screen (in list view) */ + if (top+8>count) + top=count-8; /* wasted spaced at end of display */ + if (top<0) + top=0; + if (wheretop+7) + top=where-7; + lastbflags=CalculateBflags(); + gBorder(lastbflags); /* draw border */ + ListDisplay(); /* draw the entries themselves */ + } + +LOCAL_C INT LookFor(UBYTE *pb) + { /* look for find text in given text field */ + return(p_bsubi((TEXT *)pb+1,*pb,&find[1],find[0])); + } + +LOCAL_C VOID RotateTo(INT newemph) + { /* change which editor is emphasised */ + INT oldemph; + + if (newemph!=emph) + { + oldemph=emph; + emph=newemph; + DrawBorder(oldemph); /* clear former emphasis */ + DrawBorder(newemph); /* apply new emphasis */ + } + } + +LOCAL_C INT SaveChanges(VOID) + { /* save changes made to current record */ + INT len1; /* length of first text field */ + INT len2; /* length of second text field */ + UBYTE *pb; /* pointer into dBuf[] */ + TEXT *psrc; /* pointer into editor's text */ + + pb=(&dBuf[2]); /* start at beginning of dBuf[] */ + *(UWORD *)pb=currdiy; /* fill in word DIY field */ + pb+=2; /* position to first text field */ + psrc=hEBSenseText(edit[1]); /* sense text in editor */ + len1=p_slen(psrc); + *pb++=len1; /* record the length of the text */ + pb=p_bcpy(pb,psrc,len1); /* record the text itself */ + psrc=hEBSenseText(edit[2]); /* sense text in next editor */ + len2=p_slen(psrc); + *pb++=len2; /* record the length of the text */ + p_bcpy(pb,psrc,len2); /* record the text itself */ + dOff=0; + if (DoUpdate(len1+len2+4)) /* give length of record being added */ + return(-1); + ClearChangedFlags(); /* acknowledge editors are no longer "changed" */ + DrawWhereAndCount(); /* position in index may be different now */ + return(0); + } + +LOCAL_C INT SaveIfChanged(VOID) + { /* save changes made, if any */ + if (!CheckIfChanged()) + return(0); + return(SaveChanges()); + } + +LOCAL_C VOID CompressFile(VOID) + { /* user has requested file be compressed */ + UINT state; + + if (!hIsDbfCompressible(dH)) + wInfoMsg("Cannot compress on Flash"); + else + { + state=DbfStateDisabled; + Check(DbfCompress(&state,dH)); + wInfoMsg("File compressed"); + } + } + +LOCAL_C VOID ChangeName(TEXT *newname) + { /* name of file being edited has changed */ + p_scpy(&filename[0],newname); /* copy to own buffer */ + hSetUpStatusNames(&filename[0]); /* inform system of the change */ + wsUpdate(WS_UPDATE_NAME); /* force status window update */ + } + +LOCAL_C INT ordf(INT r1,INT r2,VOID *junk) + { /* ordering function required by p_qsort() */ + return(compare(&index[r1],&index[r2])); + } + +LOCAL_C VOID excf(INT r1,INT r2,VOID *junk) + { /* exchange function required by p_qsort() */ + p_bswap(&index[r1],&index[r2],sizeof(INDENT)); + } + +LOCAL_C VOID BuildIndex(VOID) + { /* build index for current file */ + INDENT *pindent; + UWORD no; + + no=0; + count=DbfCount(dH); + pindent=(&index[0]); /* to pass through whole index */ + while (nodiy=FindKey(); /* extract its DayInYear value */ + pindent->no=no++; /* record secondary key */ + pindent++; + } + p_qsort(no,ordf,excf,NULL); /* sort the index */ + } + +LOCAL_C VOID DoScroll(INT dely) + { /* scroll part of the screen display vertically */ + P_POINT offset; /* offset to scroll by */ + P_RECT src; /* source region for the scroll */ + + offset.x=0; + offset.y=dely*9; /* each line is 9 pixels high */ + src.tl.x=4; + src.br.x=ScreenWidth-4; + if (dely>0) + { /* scrolling down - so omit display bottom from source */ + src.tl.y=4; + src.br.y=4+(8-dely)*9; + } + else + { /* scrolling up - so omit display top from source */ + src.tl.y=4-dely*9; + src.br.y=4+8*9; + } + wScrollRect(MainWid,&src,&offset); + } + +LOCAL_C VOID MakeHighlight(INT newcent) + { /* move the cursor to the specified new value */ + INT toscroll; + + if (newcent==where) + return; /* cursor already there */ + DrawCursor(where-top,FALSE); /* remove old cursor */ + toscroll=top-newcent; + if (toscroll>0) + { /* new cursor position off top of screen */ + top-=toscroll; + if (toscroll<8) + DoScroll(toscroll); + else + toscroll=8; /* toscroll now gives number of lines to redraw */ + while (toscroll) + DrawLine(--toscroll); /* draw lines not handled by scroll */ + } + else + { + toscroll=-7-toscroll; + if (toscroll>0) /* new cursor position off bottom of screen */ + { + top+=toscroll; + if (toscroll<8) + DoScroll(-toscroll); + else + toscroll=8; + while (toscroll) + DrawLine(8-toscroll--);/* draw lines not handled by scroll */ + } + } + where=newcent; + DrawCursor(where-top,TRUE); /* draw cursor in new position */ + } + +LOCAL_C VOID NewWhere(UWORD new) + { /* there is a new current record */ + if (ViewList) + MakeHighlight(new); /* scroll if need be */ + else + { /* editors view - so change all editor contents */ + where=new; + LoadEditors(); + } + } + +LOCAL_C VOID WholeDisplay(VOID) + { /* the whole screen needs redrawn */ + if (ViewList) + WholeListDisplay(); + else + LoadEditors(); + } + +LOCAL_C VOID DisplayStart(VOID) + { /* a new file needs loading and displaying */ + BuildIndex(); + if (!count) + AddDummyEntry(); + where=0; + WholeDisplay(); + } + +LOCAL_C VOID ChangeOverTo(VOID *newdH,TEXT *newname) + { /* change the file being edited */ + DbfClose(dH); + dH=newdH; /* (new file is already successfully opened) */ + ChangeName(newname); + DisplayStart(); + } + +LOCAL_C INT doOpen(VOID **pdH,TEXT *pb,INT flags,DbfHeader *pHead) + { /* utility layer over DbfOpen */ + INT state; + + state=DbfStateDisabled; + p_scpy((TEXT *)&pHead->fileType[0],"OPLDatabaseFile"); + return(uErrorValue(DbfOpen(&state,pdH,pb,flags,pHead,&dBuf[0],512,1))); + } + +LOCAL_C INT TryOpenDbf(TEXT *pb,VOID **pdH) + { /* save any current changes, and try to open named file */ + DbfHeader Header; + + if (SaveIfChanged()) + return(-1); + return(doOpen(pdH,pb,P_FOPEN|P_FUPDATE|P_FRANDOM,&Header)); + } + +LOCAL_C VOID SetupFilename(TEXT *pb) + { /* initialise text for editor from current filename */ + p_bcpy(pb+1,DatUsedPathNamePtr,*pb=p_slen(DatUsedPathNamePtr)); + } + +LOCAL_C VOID OpenDbf(VOID) + { /* user wants to open another file */ + H_DI_FSEL open; + TEXT openbuf[P_FNAMESIZE+2]; + VOID *newdH; /* open new file before closing old */ + + SetupFilename(open.fname=(&openbuf[0])); /* seed filename */ + open.flags=H_FILE_PICK_SELECTOR|H_FILE_RESTRICT_LIST|H_FILE_SET_DEFEXT; + FOREVER + { /* loop until success or user cancels */ + if (uOpenDialog("Open anniversary file")) + break; + if (uAddDialogItem(H_DIALOG_FSEL,"File:",&open)) + break; + if (RunDialog()<=0) + break; + openbuf[1+openbuf[0]]=0; /* convert from lbc to zts */ + if (!TryOpenDbf(&openbuf[1],&newdH)) + { /* new file opened successfully */ + ChangeOverTo(newdH,&openbuf[1]); + return; + } + } + } + +LOCAL_C INT TryNewDbf(TEXT *pb,VOID **pdH) + { /* save any changes, and try to create new named file */ + DbfHeader Header; /* values defined at top of this file */ + + if (SaveIfChanged()) + return(-1); + hEnsurePath(pb); /* check the directory exists */ + Header.createVersion=DbfVersion(); + p_bcpy(&Header.dataStart,&ModelHeader,sizeof(ModelHeader)); + return(doOpen(pdH,pb,P_FREPLACE|P_FUPDATE|P_FRANDOM,&Header)); + } + +LOCAL_C VOID NewDbf(VOID) + { /* user wants to create a new file */ + H_DI_FSEL new; + TEXT newbuf[P_FNAMESIZE+2]; + VOID *newdH; /* create new file before closing old */ + + SetupFilename(new.fname=(&newbuf[0])); /* seed filename */ + new.flags=H_FILE_NEW_EDITOR|H_FILE_SET_DEFEXT; + FOREVER + { /* loop until success or user cancels */ + if (uOpenDialog("New anniversary file")) + break; + if (uAddDialogItem(H_DIALOG_FSEL,"File:",&new)) + break; + if (RunDialog()<=0) + break; + newbuf[1+newbuf[0]]=0; /* convert from lbc to zts */ + if (!TryNewDbf(&newbuf[1],&newdH)) + { /* new file created successfully */ + ChangeOverTo(newdH,&newbuf[1]); + return; + } + } + } + +LOCAL_C INT DoMerge(TEXT *pb,INT flags,INT dir) + { /* common code for Merge and SaveAs */ + UINT state; + + state=DbfStateDisabled; + return(uErrorValue(DbfCopyFile(&state,dH,pb,flags,1,dir))); + } + +LOCAL_C VOID MergeDbf(VOID) + { /* user wants to merge two files */ + H_DI_FSEL merge; + TEXT mergebuf[P_FNAMESIZE+2]; + + if (SaveIfChanged()) /* save any changes first */ + return; + SetupFilename(merge.fname=(&mergebuf[0])); /* seed filename */ + merge.flags=H_FILE_PICK_SELECTOR|H_FILE_RESTRICT_LIST|H_FILE_SET_DEFEXT; + FOREVER + { + if (uOpenDialog("Merge anniversary file")) + break; + if (uAddDialogItem(H_DIALOG_FSEL,"File:",&merge)) + break; + if (RunDialog()<=0) + break; + mergebuf[1+mergebuf[0]]=0; /* convert lbc to zts */ + if (!DoMerge(&mergebuf[1],P_FOPEN,DbfCopyToHandle)) + { /* merging handled by Dbf services */ + wInfoMsg("File merged"); + DisplayStart(); + return; + } + } + } + +LOCAL_C VOID DoSave(TEXT *pb,INT usenew) + { /* Save to new filename and optionally use new file */ + VOID *newdH; /* use separate Dbf handle */ + INT i; + INT len; + + if (TryNewDbf(pb,&newdH)) /* start by creating the new file */ + return; + DbfTrash(dH); /* NB dBuf[] shared between two handles */ + for (i=0; i0) + { + savebuf[1+savebuf[0]]=0; + DoSave(&savebuf[1],usenew==2); + } + } + +LOCAL_C VOID SetSymbolsState(VOID) + { /* Set the "show symbols" state of the editors */ + hEBShowSymbols(edit[2],ShowSymbols); + } + +LOCAL_C VOID ToggleShowSymbols(VOID) + { /* toggle the "show symbols" state of the editors */ + ShowSymbols^=TRUE; + if (!ViewList) + SetSymbolsState(); + cmds[SYMBOLS_ITEM]=(ShowSymbols? "hHide symbols": "hShow symbols"); + } + +LOCAL_C VOID ExitApplication(VOID) + { /* user wants to exit */ + if (!SaveIfChanged()) + p_exit(0); + } + +LOCAL_C INT DateDialog(TEXT *title,INT *pdiy) + { /* present a date dialog with given title (common code) */ + UWORD monno; /* month number in year */ + INT dayinm; /* day number in month */ + LONG ldayinm; /* dayinm as a LONG */ + H_DI_NUMBER num; + + dayinm=(*pdiy); + monno=FindMonNo(&dayinm)+1; /* crack the given DayInYear */ + ldayinm=dayinm+1; + num.value=(&ldayinm); + num.low=1; + num.high=31; /* this limit is generally correct */ + FOREVER + { + if (uOpenDialog(title)) + return(-1); + if (AddMonthChoiceList(&monno)) + return(-1); + if (uAddDialogItem(H_DIALOG_NUMBER,"Day in month",&num)) + return(-1); + if (RunDialog()<=0) + return(-1); + dayinm=(INT)ldayinm-1; + if (dayinm=count) + try=0; /* handle wrap round forwards */ + else if (try<0) + try=count-1; /* handle wrap round backwards */ + SeekTo(index[try].no); /* load text of specified record */ + pb=(&dBuf[dOff+4]); /* position to name field */ + if (findtype&1) + { /* if searching in name field */ + newemph=1; + off=LookFor(pb); + if (off>=0) + break; /* found */ + } + pb+=(*pb)+1; /* position to notes field */ + if (findtype&2) + { /* if searching in notes field */ + newemph=2; + off=LookFor(pb); + if (off>=0) + break; /* found */ + } + } + if (ViewList) + { + if (newemph==1) + { /* can position to name field in list view... */ + MakeHighlight(try); + return(0); + } + if (ToggleListMode()) /* ...but not to notes field */ + return(0); + } + NewWhere(try); /* load editors with relevant record */ + hEBSetSelect(edit[newemph],off,off+find[0]); /* highlight match */ + RotateTo(newemph); /* emphasise correct editor */ + return(0); + } + +LOCAL_C VOID FindAnniversary(VOID) + { /* user wants to Find */ + H_DI_EDIT edfind; + + if (SaveIfChanged()) + return; /* failed to save changes */ + edfind.str=(&find[0]); /* seed with previous find string */ + edfind.len=19; + FOREVER + { + if (uOpenDialog("Find text")) + return; + if (uAddDialogItem(H_DIALOG_EDIT,"Text",&edfind)) + return; + if (uAddChoiceList("Search",&findtype,"Just names", + "Just notes","Names and notes",NULL)) + return; + if (RunDialog()<=0) + return; + if (!DoFind(count,+1,count)) + return; /* match found */ + wInfoMsg("Not found"); + } + } + +LOCAL_C VOID FindAgain(INT dir) + { /* user wants to Find Again */ + if (SaveIfChanged()) + return; + if (DoFind(where,dir,count-1)) + wInfoMsg("No more found"); + } + +LOCAL_C VOID JumpTo(VOID) + { /* user wants to jump to record by index number */ + LONG curr; + H_DI_NUMBER num; + INT new; + + if (SaveIfChanged()) + return; /* failed to save changes */ + if (uOpenDialog(NULL)) /* this dialog has no title */ + return; + curr=where+1; /* seed with current value */ + num.value=(&curr); + num.low=1; + num.high=count; + if (uAddDialogItem(H_DIALOG_NUMBER,"Jump to record",&num)) + return; + if (RunDialog()<=0) + return; + new=(UINT)(curr-1); + NewWhere(new); + } + +LOCAL_C INT Today(VOID) + { /* return DayInYear for today */ + P_DAYSEC ds; + P_DATE dt; + ULONG now; + + now=p_date(); + p_sttods(&now,&ds); + p_dstodt(&ds,&dt); + return(FindDiy(dt.month,dt.day)); + } + +LOCAL_C VOID FindDate(VOID) + { /* user wants to find record on given date */ + INT diy; + INT mid; + INDENT ent; + + diy=Today(); /* seed with today */ + if (DateDialog("Find date",&diy)) + return; /* user cancelled or out of memory */ + ent.diy=diy; + ent.no=0; + mid=LocateByDate(&ent); + if (mid>=count) + mid=count-1; + NewWhere(mid); + } + +LOCAL_C INT PrintLine(H_PRINT *pr) + { /* call-back function to print line of data */ + INT ind; + + switch (PrintState++) + { + case 0: /* reached only at very beginning: set up print indent */ + PrintIndent=hPrintSenseBufWidth(" ",1)*4; + hPrintSetSI(PrintIndent); /* indent for word-wrapped lines */ + PrintState++; + case 1: /* print date */ + LoadBuffer(PrintRec); /* load record into dBuf[] */ + PrintBuf=(&dBuf[dOff+2]); /* position to DayInYear field */ + DiyToBuf(*(UWORD *)PrintBuf,&PrintDate[0]); + PrintBuf+=2; /* position to name text field */ + pr->buf=(&PrintDate[0]); /* print text version of date */ + pr->blen=p_slen(&PrintDate[0]); + pr->style|=H_PRINT_STY_BOLD; /* print in bold */ + break; + case 2: /* print name */ + pr->blen=(*PrintBuf++); + pr->buf=(TEXT *)PrintBuf; + PrintBuf+=pr->blen; /* position to notes text field */ + PrintLen=(*PrintBuf++); /* how many characters in note */ + break; + default: /* print (next section of) notes */ + if (PrintNamesOnly==1) + { /* if NOT only printing names */ + pr->buf=(TEXT *)PrintBuf; + pr->indent=PrintIndent; + ind=p_bloc(PrintBuf,PrintLen,'\n'); /* search for '\n' */ + if (ind<0) + { /* all (remaining) text is one "paragraph" */ + pr->blen=PrintLen; /* print it all */ + PrintLen=0; /* none left */ + } + else + { + pr->blen=ind; /* print rest of "paragraph" */ + PrintLen-=ind+1; /* still some of note left to print */ + PrintBuf+=ind+1; /* position to next "paragraph" */ + } + if (pr->blen || PrintLen) + break; /* not finished note yet */ + } + pr->blen=0; /* print blank line */ + PrintState=1; /* ready for date of next record */ + return(++PrintRec!=count); /* return FALSE if finished */ + } + pr->flags|=H_PRINT_KEEP; /* keep record together, if possible */ + return(TRUE); /* still more to print */ + } + +LOCAL_C VOID PrintAnniversaries(VOID) + { /* user wants to Print */ + if (SaveIfChanged()) + return; /* failed to save changes */ + if (uOpenDialog("Print")) + return; + if (uAddChoiceList("Names only",&PrintNamesOnly,"No","Yes",0)) + return; + if (RunDialog()<=0) + return; + PrintRec=0; /* initialise print state variables */ + PrintState=0; + hPrint(PrintLine); /* specify call-back function */ + } + +LOCAL_C VOID DeleteAnniversary(VOID) + { /* user wants to delete anniversary */ + INT state; + + if (count==1 && !SizeRecord()) + { + wInfoMsg("Nothing to delete"); + return; + } + if (Confirm("Delete this anniversary")) + return; /* user failed to confirm */ + SeekToCurrent(); /* load current entry into dBuf[] */ + state=DbfStateDisabled; + Check(DbfEraseRead(&state,dH,&dOff)); + IndexDelete(); /* remove current entry from index too */ + if (!count) + AddDummyEntry(); /* don't leave index completely empty */ + if (where==count) + where=count-1; + WholeDisplay(); + } + +LOCAL_C VOID ManageCommand(INT index) + { /* switch on command index to appropriate function */ + switch (index) + { + case ITEMS_BEFORE_FILE: + NewDbf(); + break; + case ITEMS_BEFORE_FILE+1: + OpenDbf(); + break; + case ITEMS_BEFORE_FILE+2: + MergeDbf(); + break; + case ITEMS_BEFORE_FILE+3: + SaveDbfAs(); + break; + case ITEMS_BEFORE_FILE+4: + CompressFile(); + break; + case ITEMS_BEFORE_FILE+5: + ExitApplication(); + break; + case ITEMS_BEFORE_EDIT: + if (!CheckEditing()) + { /* insert text - handled by editor */ + if (hEBPaste(edit[2])>0) + wInfoMsg("No text to insert"); + } + break; + case ITEMS_BEFORE_EDIT+1: + if (!CheckEditing()) + { /* copy text - handled by editor */ + if (hEBCopy(edit[2])>0) + wInfoMsg("No text to copy"); + else + wInfoMsg("Text copied"); + } + break; + case ITEMS_BEFORE_EDIT+2: + if (!CheckEditing()) + hEBEvaluate(edit[2]); /* evaluate - handled by editor */ + break; + case ITEMS_BEFORE_EDIT+3: + ToggleShowSymbols(); + break; + case ITEMS_BEFORE_EDIT+4: + SaveAnniversary(); + break; + case ITEMS_BEFORE_EDIT+5: + UndoEditing(); + break; + case ITEMS_BEFORE_CHANGE: + EnterAnniversary(); + break; + case ITEMS_BEFORE_CHANGE+1: + DeleteAnniversary(); + break; + case ITEMS_BEFORE_CHANGE+2: + ChangeDate(); + break; + case ITEMS_BEFORE_SEARCH: + FindAnniversary(); + break; + case ITEMS_BEFORE_SEARCH+1: + FindAgain(+1); + break; + case ITEMS_BEFORE_SEARCH+2: + FindAgain(-1); /* this is "Find Backwards" */ + break; + case ITEMS_BEFORE_SEARCH+3: + FindDate(); + break; + case ITEMS_BEFORE_SEARCH+4: + JumpTo(); + break; + case ITEMS_BEFORE_SPECIAL: + ToggleListMode(); + break; + case ITEMS_BEFORE_SPECIAL+1: + WanderThrough(); + break; + case ITEMS_BEFORE_SPECIAL+2: + PrintAnniversaries(); + break; + case ITEMS_BEFORE_SPECIAL+3: + PrintSetupDialog(); + } + } + +LOCAL_C INT ObeySystemCommand(INT cmd,TEXT *pb,VOID **pdH) + { /* respond to SwitchFiles command from System Screen */ + return((cmd=='O'? TryOpenDbf: TryNewDbf)(pb,pdH)); + } + +LOCAL_C VOID ProcessSystemCommand(VOID) + { /* respond to message from System Screen */ + TEXT buf[P_FNAMESIZE+2]; + VOID *newdH; + + wGetCommand((UBYTE *)&buf[0]); + if (buf[0]=='X') + ExitApplication(); + if (!ObeySystemCommand(buf[0],&buf[1],&newdH)) + ChangeOverTo(newdH,&buf[1]); + } + +LOCAL_C VOID TryExecuteCommand(INT keycode) + { /* try to find command to execute matching accelerator passed */ + keycode=uLocateCommand(keycode); /* look up accelerator table */ + if (keycode>=0) /* found - keycode converted to index */ + ManageCommand(keycode); + } + +LOCAL_C VOID RotateFocus(INT shifted) + { /* respond to TAB key */ + INT newemph; + + if (ViewList) + ToggleListMode(); + else + { + newemph=emph; + if (shifted) + { /* go backwards for SHIFT TAB */ + if (!newemph--) + newemph=2; + } + else if (++newemph==3) + newemph=0; + RotateTo(newemph); + } + } + +LOCAL_C VOID MoveTo(INT newwhere) + { /* move to given record (works in either list or editors view */ + if (SaveIfChanged()) + return; + if (newwhere<0) + newwhere=count-1; + else if (newwhere>=count) + newwhere=0; + NewWhere(newwhere); + } + +LOCAL_C INT ResizeWidth(UWORD width) + { /* try to change the width of the main display region */ + INT ret; + W_WINDATA wd; + + wd.extent.tl.x=wd.extent.tl.y=0; + wd.extent.width=width; + wd.extent.height=80; + wSetWindow(MainWid,W_WIN_EXTENT,&wd); + ret=uErrorValue(wCheckPoint()); /* check whether successful */ + if (!ret) + ScreenWidth=width; + return(ret); + } + +LOCAL_C VOID ToggleStatusWindow(VOID) + { /* attempt to toggle the visibility of the status window */ + if (show_statwin) + { /* status window is currently showing */ + if (ResizeWidth(240)) + return; + wsDisable(); /* remove status window */ + } + else + { /* status window not currently showing */ + if (ResizeWidth(189)) + return; + wsEnable(); /* display status window */ + } + show_statwin^=TRUE; + ClearWholeWindow(); + if (ViewList) + { + gBorder(lastbflags); + ListDisplay(); + } + else + { + lastchanged=FALSE; + DrawFramework(); + hEBChangeWidth(edit[0],ScreenWidth-12-32-54); + hEBChangeWidth(edit[1],ScreenWidth-12-32-10); + hEBChangeWidth(edit[2],ScreenWidth-12); /* change editor widths */ + } + } + +LOCAL_C VOID UpdateDateDisplays(VOID) + { /* system time format defaults may have changed */ + if (ViewList) + ListDisplay(); + else + SetDateText(currdiy); + } + +LOCAL_C VOID KeyToEditors(WMSG_KEY *pkey) + { /* pass key to emphasised editor */ + if (!emph) + { /* emphasis on date "editor" */ + switch (pkey->keycode) + { + case W_KEY_LEFT: + MoveTo(pkey->modifiers&W_PSION_MODIFIER? 0: where-1); + break; + case W_KEY_RIGHT: + MoveTo(pkey->modifiers&W_PSION_MODIFIER? count-1: where+1); + break; + case W_KEY_RETURN: + ChangeDate(); + } + return; + } + if (pkey->keycode==W_KEY_RETURN && emph!=2) + return; + hEBHandleKey(edit[emph],pkey->keycode,pkey->modifiers); + } + +LOCAL_C VOID ScrollPageBy(INT delta) + { /* implementation of PgUp / PgDn */ + if (delta<(-7)) + delta=(-7); + else if (delta>7) + delta=7; + top+=delta; + where+=delta; + ListDisplay(); + } + +LOCAL_C VOID KeyToList(WMSG_KEY *pkey) + { /* key handling routine for list view */ + switch (pkey->keycode) + { + case W_KEY_UP: + if (where) + MakeHighlight(where-1); + break; + case W_KEY_DOWN: + if (wheremodifiers&W_CTRL_MODIFIER) + MakeHighlight(0); + else if (!top) + MakeHighlight(0); + else + ScrollPageBy(-top); + break; + case W_KEY_PAGE_DOWN: + if (pkey->modifiers&W_CTRL_MODIFIER) + MakeHighlight(count-1); + else if (top+8>=count) + MakeHighlight(count-1); + else + ScrollPageBy(count-top-8); + break; + } + } + +LOCAL_C VOID CheckEmbellishments(VOID) + { /* called regularly (once every event) */ + INT bflags; + INT changed; + P_RECT box; /* rectangle to draw "changed" asterisk in */ + + if (ViewList) + { /* see if scroll arrows in border need changing */ + bflags=CalculateBflags(); + if (bflags!=lastbflags) + gBorder(lastbflags=bflags); + } + else + { /* see if "changed" asterisk after name editor needs changing */ + changed=CheckIfChanged(); + if (changed==lastchanged) + return; + lastchanged=changed; + box.tl.x=ScreenWidth-10; + box.tl.y=19; + box.br.x=ScreenWidth; + box.br.y=29; + gPrintBoxText(&box,8,G_TEXT_ALIGN_CENTRE,0,"*",changed); + } + } + +LOCAL_C VOID MainLoop(VOID) + { /* central event processing loop */ + INT ret; + WMSG_KEY key; + + FOREVER + { + CheckEmbellishments(); /* check display up-to-date */ + uGetKey(&key); + if (key.keycode&W_EVENT_KEY) + { + switch (key.keycode) + { + case CONS_EVENT_FOREGROUND: + UpdateDateDisplays(); + break; + case CONS_EVENT_COMMAND: + ProcessSystemCommand(); + } + } + else if (key.keycode&W_SPECIAL_KEY) /* Psion key pressed */ + TryExecuteCommand(key.keycode&(~W_SPECIAL_KEY)); + else + { + switch (key.keycode) + { + case W_KEY_MENU: + if (key.modifiers&W_CTRL_MODIFIER) + ToggleStatusWindow(); + else + { /* display menu bar */ + ret=uPresentMenus(); + if (ret>0) + TryExecuteCommand(ret); + } + break; + case W_KEY_MODE: /* if assigned app button pressed */ + ToggleListMode(); + break; + case W_KEY_TAB: + RotateFocus(key.modifiers&W_SHIFT_MODIFIER); + break; + default: + (ViewList? KeyToList: KeyToEditors)(&key); + } + } + } + } + +LOCAL_C VOID SmallScreen(VOID) + { /* attempt to make room for status window */ + if (ResizeWidth(189)) + p_exit(0); + } + +LOCAL_C VOID CreateGC(VOID) + { /* attempt to create default graphics context on main window */ + INT hgc; /* graphics context handle (if successful) */ + + hgc=gCreateGC0(MainWid); + if (hgc<0) + p_exit(hgc); + } + +LOCAL_C VOID SpecificInit(VOID) + { /* application initialisation specific to Days */ + INT command; + + uEscape(FALSE); /* disable Psion-Esc */ + MainWid=uFindMainWid(); /* find id of main display window */ + CreateGC(); /* create default graphics context */ + SmallScreen(); /* make room for status window */ + wsEnable(); /* display status window */ + CreateEditors(); /* start in editor mode */ + command=hCrackCommandLine(); /* analyse command line */ + if (ObeySystemCommand(command,DatUsedPathNamePtr,&dH)) + p_exit(0); + DrawFramework(); + DisplayStart(); + } + +GLDEF_C VOID main(VOID) + { /* the main() for all Hwif programs */ + uCommonInit(); /* initialisation common to all Hwif programs */ + SpecificInit(); /* initialisation specific to Days */ + MainLoop(); /* the central event processing loop */ + } diff --git a/code/SIBOSDK/hwdemo/days.ms b/code/SIBOSDK/hwdemo/days.ms new file mode 100644 index 0000000..9b02cf8 --- /dev/null +++ b/code/SIBOSDK/hwdemo/days.ms @@ -0,0 +1,3 @@ +Days.ANN +\ANN\ +3 diff --git a/code/SIBOSDK/hwdemo/days.pic b/code/SIBOSDK/hwdemo/days.pic new file mode 100644 index 0000000..4162ee4 Binary files /dev/null and b/code/SIBOSDK/hwdemo/days.pic differ diff --git a/code/SIBOSDK/hwdemo/days.rsc b/code/SIBOSDK/hwdemo/days.rsc new file mode 100644 index 0000000..e69de29 diff --git a/code/SIBOSDK/hwdemo/days.shd b/code/SIBOSDK/hwdemo/days.shd new file mode 100644 index 0000000..99283ee Binary files /dev/null and b/code/SIBOSDK/hwdemo/days.shd differ diff --git a/code/SIBOSDK/hwdemo/dump.afl b/code/SIBOSDK/hwdemo/dump.afl new file mode 100644 index 0000000..f6c3bae --- /dev/null +++ b/code/SIBOSDK/hwdemo/dump.afl @@ -0,0 +1,3 @@ +dump.pic +dump.rsc +dump.shd diff --git a/code/SIBOSDK/hwdemo/dump.c b/code/SIBOSDK/hwdemo/dump.c new file mode 100644 index 0000000..412cd7e --- /dev/null +++ b/code/SIBOSDK/hwdemo/dump.c @@ -0,0 +1,660 @@ +/* + DUMP.C + +Written by DavidW +Started on 27/11/91 + +*/ + +#include +#include +#include +#include + +GLREF_D UWORD DatLocked; +GLREF_D TEXT *DatUsedPathNamePtr; + + +LOCAL_D TEXT *cmds[]= + { + "oOpen", + "wWrite", + "fFind text", + "bFind bytes", + "aFind again", + "gGoto", + "xExit", + NULL + }; + +#define FILE_ITEMS 2 +#define FIND_ITEMS 3 +#define SPECIAL_ITEMS 2 + +#define ITEMS_BEFORE_FILE 0 +#define ITEMS_BEFORE_FIND FILE_ITEMS +#define ITEMS_BEFORE_SPECIAL (ITEMS_BEFORE_FIND+FIND_ITEMS) + +LOCAL_D H_MENU_DATA mdata[]= + { + "File",FILE_ITEMS, + "Find",FIND_ITEMS, + "Special",SPECIAL_ITEMS, + NULL + }; + +GLDEF_D TEXT ** _cmds=(&cmds[0]); +GLDEF_D H_MENU_DATA * _mdata=(&mdata[0]); + + +LOCAL_D TEXT filename[P_FNAMESIZE+2]; +LOCAL_D VOID *fcb; + +LOCAL_D LONG lpos; +LOCAL_D LONG last; + +LOCAL_D UWORD DisplayPending; + +LOCAL_D VOID *wfcb; + +LOCAL_D TEXT findt[14]={0}; +LOCAL_D UWORD caset=1; +LOCAL_D TEXT findb[14]={0}; +LOCAL_D TEXT *pfind; +LOCAL_D UWORD casef; +LOCAL_D LONG fpos=(-1); + + +LOCAL_C VOID Check(INT val) + { + TEXT buf[64]; + + if (val<0) + { + wCancelBusyMsg(); + uForceToFront(); + DatLocked=TRUE; + p_errs(&buf[0],val); + wsAlertW(WS_ALERT_CLIENT,&buf[0],"Terminating application",0); + p_exit(0); + } + } + +LOCAL_C VOID DoSeek(INT sense,LONG *ppos) + { + Check(p_seek(fcb,sense,ppos)); + } + +LOCAL_C INT WriteLine(INT ignore,TEXT *pb) + { + return(p_write(wfcb,pb,38)); + } + +LOCAL_C INT PrintLine(INT lineno,TEXT *pb) + { + P_RECT box; + + box.tl.x=6; + box.tl.y=4+9*lineno; + box.br.x=234; + box.br.y=box.tl.y+9; + gPrintBoxText(&box,8,G_TEXT_ALIGN_LEFT,0,pb,38); + return(0); + } + +LOCAL_C VOID Output(INT len,INT nlines,INT DoLine(INT,TEXT *)) + { + TEXT inbuf[64]; + TEXT outbuf[38]; + INT i; + LONG loclpos; + INT linelen; + TEXT *pin; + TEXT *pout1; + TEXT *pout2; + INT val; + + Check(p_read(fcb,&inbuf[0],len)); + pin=(&inbuf[0]); + loclpos=lpos; + for (i=0; i64) + len=64; + else + { + len=(INT)diff; + stop=TRUE; + } + Output(len,len/8,WriteLine); + if (stop) + break; + diff-=64; + } + p_close(wfcb); + wInfoMsg("Dump written to file"); + } + +LOCAL_C VOID GotoLpos(VOID) + { + H_DI_NUMBER num; + + if (last<=64) + { + wInfoMsg("Whole file is already visible"); + return; + } + if (uOpenDialog(NULL)) + return; + num.value=(&lpos); + num.low=0; + num.high=last-64; + if (uAddDialogItem(H_DIALOG_NUMBER,"Goto",&num)) + return; + if (uRunDialog()<=0) + return; + Display(); + } + +LOCAL_C VOID HighlightBlock(INT x,INT y) + { + P_RECT box; + + box.tl.y=4+9*y; + box.br.y=box.tl.y+9; + if (&findb[0]==pfind) + { + box.tl.x=41+18*x; + box.br.x=box.tl.x+13; + } + else + { + box.tl.x=185+6*x; + box.br.x=box.tl.x+7; + } + gClrRect(&box,G_TRMODE_INV); + wFlush(); + p_sleep(10); + gClrRect(&box,G_TRMODE_INV); + } + +LOCAL_C VOID HighlightFpos(VOID) + { + INT offset; + + if (fposlpos+63) + { + lpos=fpos; + if (lpos>last-64) + lpos=last-64; + } + Display(); + offset=(INT)(fpos-lpos); + HighlightBlock(offset%8,offset/8); + } + +LOCAL_C INT DoSearch(LONG *ptot) + { + TEXT buf[256]; + INT toread; + TEXT *pb; + INT j; + INT offset; + INT len; + + DoSeek(P_FABS,ptot); + toread=256; + pb=(&buf[0]); + offset=0; + wSetBusyMsg("Searching",W_CORNER_BOTTOM_LEFT|2); + FOREVER + { + len=p_read(fcb,pb,toread); + if (len==E_FILE_EOF) + break; + Check(len); + if (casef==2) + j=p_bsub(&buf[0],len+offset,pfind+1,*pfind); + else + j=p_bsubi(&buf[0],len+offset,pfind+1,*pfind); + if (j>=0) + { + fpos=(*ptot)+j; + wCancelBusyMsg(); + HighlightFpos(); + return(0); + } + if (len=0) + { + wInfoMsg("Don't type any spaces"); + return(-1); + } + if (*pin&1) + { + wInfoMsg("Type bytes as two characters each"); + return(-1); + } + len=buf[0]=(*pin++)/2; + pout=(&buf[1]); + while (len--) + { + newpin=pin+2; + tmp=(*newpin); + *newpin=0; + if (p_stog(&pin,(UWORD *)pout,16) || pin!=newpin) + { + p_atos(&buf[0],"Conversion failure at %s",newpin-2); + wInfoMsg(&buf[0]); + *newpin=tmp; + return(-1); + } + *newpin=tmp; + pout++; + } + p_bcpy(&findb[0],&buf[0],buf[0]+1); + return(0); + } + +LOCAL_C VOID FindBytes(VOID) + { + TEXT bytes[26]; + H_DI_EDIT ed; + + LoadBytes(&bytes[0]); + ed.str=(&bytes[0]); + ed.len=24; + do + { + if (uOpenDialog("Find")) + return; + if (uAddDialogItem(H_DIALOG_EDIT,"Bytes",&ed)) + return; + if (uRunDialog()<=0) + return; + } while (RecoverBytes(&bytes[0])); + pfind=(&findb[0]); + casef=2; + SearchAll(); + } + +LOCAL_C VOID FindAgain(VOID) + { + LONG tot; + + if (fpos<0) + { + wInfoMsg("Nothing to find again"); + return; + } + tot=fpos+1; + if (tot==last || DoSearch(&tot)) + wInfoMsg("No more found"); + } + +LOCAL_C VOID ManageCommand(INT index) + { + switch (index) + { + case ITEMS_BEFORE_FILE: + OpenFile(); + break; + case ITEMS_BEFORE_FILE+1: + WriteFile(); + break; + case ITEMS_BEFORE_FIND: + FindText(); + break; + case ITEMS_BEFORE_FIND+1: + FindBytes(); + break; + case ITEMS_BEFORE_FIND+2: + FindAgain(); + break; + case ITEMS_BEFORE_SPECIAL: + GotoLpos(); + break; + case ITEMS_BEFORE_SPECIAL+1: + p_exit(0); + } + } + +LOCAL_C VOID MoveToTop(VOID) + { + lpos=0; + DisplayPending=TRUE; + } + +LOCAL_C VOID CheckAndDisplay(VOID) + { + if (lpos<0) + lpos=0; + DisplayPending=TRUE; + } + +LOCAL_C VOID MoveToBottom(VOID) + { + lpos=last-64; + CheckAndDisplay(); + } + +LOCAL_C VOID MoveBy(INT delta) + { + lpos+=delta; + if (lpos>last-64) + lpos=last-64; + CheckAndDisplay(); + } + +LOCAL_C VOID EnsureDisplay(VOID) + { + if (DisplayPending) + Display(); + } + +LOCAL_C VOID TryExecuteCommand(INT keycode) + { + keycode=uLocateCommand(keycode); + if (keycode>=0) + ManageCommand(keycode); + } + +LOCAL_C VOID MainLoop(VOID) + { + INT ret; + WMSG_KEY key; + + FOREVER + { + uGetKey(&key); + if (key.keycode&W_EVENT_KEY) + { + if (key.keycode==CONS_EVENT_COMMAND) + p_exit(0); + } + else if (key.keycode&W_SPECIAL_KEY) + { + EnsureDisplay(); + TryExecuteCommand(key.keycode&(~W_SPECIAL_KEY)); + } + else + { + switch (key.keycode) + { + case W_KEY_MENU: + if (!(key.modifiers&W_CTRL_MODIFIER)) + { + EnsureDisplay(); + ret=uPresentMenus(); + if (ret>0) + TryExecuteCommand(ret); + } + break; + case W_KEY_LEFT: + MoveBy(-1); + break; + case W_KEY_RIGHT: + MoveBy(1); + break; + case W_KEY_UP: + if (key.modifiers&W_CTRL_MODIFIER) + MoveToTop(); + else + MoveBy(-8); + break; + case W_KEY_DOWN: + if (key.modifiers&W_CTRL_MODIFIER) + MoveToBottom(); + else + MoveBy(8); + break; + case W_KEY_HOME: + MoveBy(-4); + break; + case W_KEY_END: + MoveBy(4); + break; + case W_KEY_PAGE_UP: + if (key.modifiers&W_CTRL_MODIFIER) + MoveToTop(); + else + MoveBy(-56); + break; + case W_KEY_PAGE_DOWN: + if (key.modifiers&W_CTRL_MODIFIER) + MoveToBottom(); + else + MoveBy(56); + break; + } + } + if (DisplayPending && !uKeyPressOutstanding()) + Display(); + } + } + +LOCAL_C VOID CreateGC(VOID) + { + INT hgc; + G_GC gc; + + gc.style=G_STY_MONO; + hgc=gCreateGC(uFindMainWid(),G_GC_MASK_STYLE,&gc); + if (hgc<0) + p_exit(hgc); + } + +LOCAL_C VOID SpecificInit(VOID) + { + CreateGC(); + gBorder(W_BORD_CORNER_4); + hCrackCommandLine(); + if (TryOpenFile(DatUsedPathNamePtr,&fcb)) + p_exit(0); + ResetDisplay(); + } + +GLDEF_C VOID main(VOID) + { + uCommonInit(); + SpecificInit(); + MainLoop(); + } diff --git a/code/SIBOSDK/hwdemo/dump.ms b/code/SIBOSDK/hwdemo/dump.ms new file mode 100644 index 0000000..783c98e --- /dev/null +++ b/code/SIBOSDK/hwdemo/dump.ms @@ -0,0 +1,3 @@ +Dump.DMP +\DMP\ +8004 diff --git a/code/SIBOSDK/hwdemo/dump.pic b/code/SIBOSDK/hwdemo/dump.pic new file mode 100644 index 0000000..a72c839 Binary files /dev/null and b/code/SIBOSDK/hwdemo/dump.pic differ diff --git a/code/SIBOSDK/hwdemo/dump.rsc b/code/SIBOSDK/hwdemo/dump.rsc new file mode 100644 index 0000000..e69de29 diff --git a/code/SIBOSDK/hwdemo/dump.shd b/code/SIBOSDK/hwdemo/dump.shd new file mode 100644 index 0000000..cec4279 Binary files /dev/null and b/code/SIBOSDK/hwdemo/dump.shd differ diff --git a/code/SIBOSDK/hwdemo/iconed.afl b/code/SIBOSDK/hwdemo/iconed.afl new file mode 100644 index 0000000..aab4c51 --- /dev/null +++ b/code/SIBOSDK/hwdemo/iconed.afl @@ -0,0 +1,3 @@ +iconed.pic +iconed.rsc +iconed.shd diff --git a/code/SIBOSDK/hwdemo/iconed.c b/code/SIBOSDK/hwdemo/iconed.c new file mode 100644 index 0000000..4e67cd8 --- /dev/null +++ b/code/SIBOSDK/hwdemo/iconed.c @@ -0,0 +1,1364 @@ +/* + ICONED.C + +Written by DavidW +Started on 12/9/91 + +Based in part on work by Robert, May 91 +*/ + +#include +#include +#include +#include +#include + +GLREF_D UWORD DatLocked; +GLREF_D TEXT *DatUsedPathNamePtr; + + +LOCAL_D TEXT *cmds[]= + { + "nNew icon", + "oOpen icon", + "aSave as", + "sSave", + "rRevert", + "xExit", + "iInsert", + "cCopy", + "uUse", + "pPlaster", + "mMove", + "gGoto", + "zSet", + "qClear", + "tToggle", + "fFrame off", + "kCursor off", + "hHighlight select", + "wWrite text", + "bBorder", + "yInterrogation", + NULL + }; + +#define FILE_ITEMS 6 +#define EDIT_ITEMS 6 +#define BRUSH_ITEMS 3 +#define SPECIAL_ITEMS 6 + +#define ITEMS_BEFORE_FILE 0 +#define ITEMS_BEFORE_EDIT FILE_ITEMS +#define ITEMS_BEFORE_BRUSH (ITEMS_BEFORE_EDIT+EDIT_ITEMS) +#define ITEMS_BEFORE_SPECIAL (ITEMS_BEFORE_BRUSH+BRUSH_ITEMS) + +#define FRAME_ITEM ITEMS_BEFORE_SPECIAL +#define CURSOR_ITEM ITEMS_BEFORE_SPECIAL+1 + +LOCAL_D H_MENU_DATA mdata[]= + { + "File",FILE_ITEMS, + "Edit",EDIT_ITEMS, + "Brush",BRUSH_ITEMS, + "Special",SPECIAL_ITEMS, + NULL + }; + +GLDEF_D TEXT ** _cmds=(&cmds[0]); +GLDEF_D H_MENU_DATA * _mdata=(&mdata[0]); + + +LOCAL_D UINT MainWid; + +LOCAL_D WMSG_KEY key; + +LOCAL_D WORD bid; +LOCAL_D VOID *fcb; +LOCAL_D TEXT filename[P_FNAMESIZE]; + +LOCAL_D WORD clipbid[6]={0,0,0,0,0,0}; +LOCAL_D P_POINT clipsize[6]; + +#define MOVE_BACKUP 0 +#define MOVE_RAFT 5 + +LOCAL_D UWORD MoveUpdatePending; +LOCAL_D P_RECT moveorigin; +LOCAL_D P_RECT movedto; +LOCAL_D UWORD MoveSingle; + +LOCAL_D UWORD using=1; +LOCAL_D UWORD brush=2; +LOCAL_D UWORD changed=FALSE; +LOCAL_D UWORD show_cursor=TRUE; + +LOCAL_D UWORD show_frame=FALSE; +LOCAL_D UWORD show_statwin=FALSE; +LOCAL_D UWORD require_query=TRUE; + +LOCAL_D P_POINT anch; +LOCAL_D P_POINT curs; +LOCAL_D UWORD issel; + +LOCAL_D TEXT ToWrite[10]={0}; +LOCAL_D UWORD font=1; +LOCAL_D UWORD italic=1; + +LOCAL_D UWORD BordCorner=2; +LOCAL_D UWORD BordShadow=1; +LOCAL_D UWORD BordCushion=1; + +#define ICON_SIZE 24 +#define LARGE_ICON_SCALE 3 + +#define SMALL_ICON_X 41 +#define SMALL_ICON_WIDTH ICON_SIZE +#define SMALL_ICON_Y 8 +#define SMALL_ICON_HEIGHT ICON_SIZE + +#define LEFT_CURSOR_X 106 +#define TOP_CURSOR_Y 0 + +#define LARGE_ICON_X 110 +#define LARGE_ICON_Y 4 + +#define RIGHT_CURSOR_X 185 +#define BOTTOM_CURSOR_Y 79 + +#define TEXT_TL_X 4 +#define BRUSH_TEXT_Y 41 +#define USING_TEXT_Y 50 +#define CURSOR_TEXT_Y 59 +#define ANCHOR_TEXT_Y 68 +#define TEXT_BR_X 104 +#define TEXT_HEIGHT 9 +#define TEXT_ASCENT 8 + + +LOCAL_C VOID CDECL WriteAt(INT y,TEXT *str,...) + { + P_RECT box; + TEXT buf[40]; + INT len; + + len=p_atob(&buf[0],str,&str+1); + box.tl.x=TEXT_TL_X; + box.tl.y=y; + box.br.x=TEXT_BR_X; + box.br.y=y+TEXT_HEIGHT; + gPrintBoxText(&box,TEXT_ASCENT,G_TEXT_ALIGN_LEFT,0,&buf[0],len); + } + +LOCAL_C VOID WriteBrushText(VOID) + { + WriteAt(BRUSH_TEXT_Y,"Brush is `%s'",cmds[brush+ITEMS_BEFORE_BRUSH]+1); + } + +LOCAL_C VOID WriteCursorText(VOID) + { + WriteAt(CURSOR_TEXT_Y,"Cursor: X %d, Y %d",curs.x,curs.y); + WriteAt(ANCHOR_TEXT_Y,(issel? "Anchor: X %d, Y %d": ""),anch.x,anch.y); + } + +LOCAL_C VOID WriteClipboardText(VOID) + { + WriteAt(USING_TEXT_Y,"Using clipboard %d",using); + } + +LOCAL_C VOID ScaleUp(P_RECT *pbox) + { + pbox->tl.x=LARGE_ICON_X+pbox->tl.x*LARGE_ICON_SCALE; + pbox->tl.y=LARGE_ICON_Y+pbox->tl.y*LARGE_ICON_SCALE; + pbox->br.x=LARGE_ICON_X+pbox->br.x*LARGE_ICON_SCALE; + pbox->br.y=LARGE_ICON_Y+pbox->br.y*LARGE_ICON_SCALE; + } + +LOCAL_C VOID GetSmallSelectRegion(P_RECT *pbox) + { + if (anch.x>curs.x) + { + pbox->tl.x=curs.x; + pbox->br.x=anch.x+1; + } + else + { + pbox->tl.x=anch.x; + pbox->br.x=curs.x+1; + } + if (anch.y>curs.y) + { + pbox->tl.y=curs.y; + pbox->br.y=anch.y+1; + } + else + { + pbox->tl.y=anch.y; + pbox->br.y=curs.y+1; + } + } + +LOCAL_C VOID GetSelectRegion(P_RECT *pbox) + { + GetSmallSelectRegion(pbox); + ScaleUp(pbox); + } + +LOCAL_C VOID GetCursorBox(P_RECT *pbox) + { + pbox->tl.x=LARGE_ICON_X+curs.x*LARGE_ICON_SCALE; + pbox->tl.y=LARGE_ICON_Y+curs.y*LARGE_ICON_SCALE; + pbox->br.x=pbox->tl.x+LARGE_ICON_SCALE; + pbox->br.y=pbox->tl.y+LARGE_ICON_SCALE; + } + +LOCAL_C VOID MakeCursorFlash(P_RECT *pbox) + { + W_CURSOR wc; + + wc.pos.x=pbox->tl.x+1; + wc.pos.y=pbox->tl.y+1; + wc.height=1; + wc.width=1; + wc.ascent=0; + wDrawTextCursor(MainWid,&wc); + } + +LOCAL_C VOID ReassertCursor(VOID) + { + P_RECT box; + + if (show_cursor) + { + GetCursorBox(&box); + MakeCursorFlash(&box); + } + } + +LOCAL_C INT RunDialog(VOID) + { + INT ret; + + ret=uRunDialog(); + ReassertCursor(); + return(ret); + } + +LOCAL_C VOID ToggleHorizCurs(P_RECT *pbox,INT tly,INT dely) + { + P_RECT box; + + box=(*pbox); + box.tl.y=tly; + box.br.y=tly+1; + gClrRect(&box,G_TRMODE_INV); + p_offrec(&box,0,dely); + p_insrec(&box,1,0); + gClrRect(&box,G_TRMODE_INV); + } + +LOCAL_C VOID ToggleVertCurs(P_RECT *pbox,INT tlx,INT delx) + { + P_RECT box; + + box=(*pbox); + box.tl.x=tlx; + box.br.x=tlx+1; + gClrRect(&box,G_TRMODE_INV); + p_offrec(&box,delx,0); + p_insrec(&box,0,1); + gClrRect(&box,G_TRMODE_INV); + } + +LOCAL_C VOID ToggleSelectBox(VOID) + { + P_RECT box; + + GetSelectRegion(&box); + gDrawBox(&box); + } + +LOCAL_C VOID ToggleCursor(VOID) + { + P_RECT box; + + if (show_cursor) + { + GetCursorBox(&box); + ToggleHorizCurs(&box,TOP_CURSOR_Y,1); + ToggleHorizCurs(&box,BOTTOM_CURSOR_Y,-1); + ToggleVertCurs(&box,LEFT_CURSOR_X,1); + ToggleVertCurs(&box,RIGHT_CURSOR_X,-1); + MakeCursorFlash(&box); + if (issel) + ToggleSelectBox(); + } + } + +LOCAL_C VOID DrawSmallIcon(VOID) + { + P_POINT offset; + P_RECT size; + + offset.x=SMALL_ICON_X; + offset.y=SMALL_ICON_Y; + size.tl.x=size.tl.y=0; + size.br.x=SMALL_ICON_WIDTH; + size.br.y=SMALL_ICON_HEIGHT; + gCopyBit(&offset,bid,&size,G_TRMODE_REPL); + } + +LOCAL_C VOID DrawLargeIcon(VOID) + { + ULONG bits[2]; + P_POINT log; + P_RECT box; + INT j; + + log.x=0; + box.tl.y=LARGE_ICON_Y; + for (log.y=0; log.ytl.x=pbox->tl.y=0; + pbox->br.x=pbox->br.y=ICON_SIZE; + } + +LOCAL_C VOID InvertOrGrey(VOID) + { + INT keycode; + P_RECT box; + + if (uOpenDialog(issel? "Plaster selection": "Plaster whole icon")) + return; + if (uAddButtonList("Cancel",W_KEY_ESCAPE,"Grey",'g',"Invert",'i',NULL)) + return; + if (!(keycode=RunDialog())) + return; + if (!issel) + GetWholeIcon(&box); + else + { + ToggleSelectBox(); + GetSmallSelectRegion(&box); + } + gCreateTempGC0(bid); + if (keycode=='i') + gClrRect(&box,G_TRMODE_INV); + else + gFillPattern(&box,WS_BITMAP_GREY,G_TRMODE_INV); + changed=TRUE; + gFreeTempGC(); + DrawIcons(); + if (issel) + ToggleSelectBox(); + } + +LOCAL_C VOID ToggleCursorVisibility(VOID) + { + cmds[CURSOR_ITEM]=(show_cursor? "kCursor on": "kCursor off"); + if (show_cursor) + { + ToggleCursor(); + show_cursor=FALSE; + wEraseTextCursor(); + } + else + { + show_cursor=TRUE; + ToggleCursor(); + } + } + +LOCAL_C VOID WriteText(VOID) + { + H_DI_EDIT edit; + G_GC gc; + INT gcflags; + + if (uOpenDialog("Write text")) + return; + edit.str=(&ToWrite[0]); + edit.len=9; + if (uAddDialogItem(H_DIALOG_EDIT,"Text",&edit)) + return; + if (uAddChoiceList("Font",&font,"Standard","Bold","Small digits",NULL)) + return; + if (AddNoYesChoice("Italic",&italic)) + return; + if (RunDialog()<=0) + return; + gCreateTempGC0(bid); + gcflags=G_GC_MASK_TEXTMODE|G_GC_MASK_FONT; + gc.textmode=brush; + gc.font=WS_FONT_BASE+font-1; + if (italic==2) + { + gcflags|=G_GC_MASK_STYLE; + gc.style=G_STY_ITALIC; + } + gSetGC(0,gcflags,&gc); + gPrintText(curs.x,curs.y,&ToWrite[1],ToWrite[0]); + changed=TRUE; + gFreeTempGC(); + DrawIcons(); + } + +LOCAL_C VOID DrawBorder(VOID) + { + INT bflags; + G_GC gc; + + if (uOpenDialog("Draw border")) + return; + if (uAddChoiceList("Corner",&BordCorner,"Simple","Gentle","Round",NULL)) + return; + if (uAddChoiceList("Shadow",&BordShadow,"None","Single","Double",NULL)) + return; + if (AddNoYesChoice("Cushion",&BordCushion)) + return; + if (RunDialog()<=0) + return; + gc.gmode=brush; + gCreateTempGC(bid,G_GC_MASK_GMODE,&gc); + bflags=W_BORD_SHADOW_ON; + if (BordCorner==1) + bflags|=W_BORD_CORNER_1; + else if (BordCorner==3) + bflags|=W_BORD_CORNER_4; + if (BordShadow==2) + bflags|=W_BORD_SHADOW_S; + else if (BordShadow==3) + bflags|=W_BORD_SHADOW_D; + if (BordCushion==2) + bflags|=W_BORD_CUSHION; + gBorder(bflags); + changed=TRUE; + gFreeTempGC(); + DrawIcons(); + } + +LOCAL_C VOID ChangeClipboardUsed(VOID) + { + if (uOpenDialog("Use")) + return; + if (uAddChoiceList("Clipboard",&using,"1","2","3","4",NULL)) + return; + if (RunDialog()<=0) + return; + WriteClipboardText(); + } + +LOCAL_C VOID CancelSelect(VOID) + { + ToggleSelectBox(); + issel=FALSE; + WriteCursorText(); + } + +LOCAL_C VOID CheckIfSelectStatusChanging(VOID) + { + if (!(key.modifiers&W_SHIFT_MODIFIER)) + issel=FALSE; + else if (!issel) + { + issel=TRUE; + anch=curs; + } + } + +LOCAL_C VOID CheckForNullSelect(VOID) + { + if (anch.x==curs.x && anch.y==curs.y) + issel=FALSE; + } + +LOCAL_C VOID MoveCursorAbsolute(INT newx,INT newy) + { + ToggleCursor(); + CheckIfSelectStatusChanging(); + if (newx>=0) + curs.x=newx; + if (newy>=0) + curs.y=newy; + CheckForNullSelect(); + ToggleCursor(); + WriteCursorText(); + } + +LOCAL_C VOID RepositionCursor(VOID) + { + H_DI_NUMBER posx; + H_DI_NUMBER posy; + LONG curx; + LONG cury; + UWORD extend; + + curx=curs.x; + cury=curs.y; + posx.low=0; + posx.high=23; + posx.value=(&curx); + posy.low=0; + posy.high=23; + posy.value=(&cury); + extend=(issel? 2: 1); + if (uOpenDialog("Go to")) + return; + if (uAddDialogItem(H_DIALOG_NUMBER,"Cursor x",&posx)) + return; + if (uAddDialogItem(H_DIALOG_NUMBER,"Cursor y",&posy)) + return; + if (AddNoYesChoice("Extend select",&extend)) + return; + if (RunDialog()<=0) + return; + key.modifiers=(extend==2? W_SHIFT_MODIFIER: 0); + MoveCursorAbsolute((INT)curx,(INT)cury); + } + +LOCAL_C VOID FlashHighlightRegion(VOID) + { + P_RECT select; + + if (!issel) + { + wInfoMsg("No select region"); + return; + } + GetSelectRegion(&select); + wInfoMsgCorner("Showing select region",W_CORNER_TOP_LEFT); + gFillPattern(&select,WS_BITMAP_GREY,G_TRMODE_INV); + wFlush(); + p_sleep(20L); + gFillPattern(&select,WS_BITMAP_GREY,G_TRMODE_INV); + } + +LOCAL_C INT DoCopy(P_RECT *prect,INT clipindex) + { + P_POINT size; + P_POINT origin; + INT newclipbid; + + size.x=prect->br.x-prect->tl.x; + size.y=prect->br.y-prect->tl.y; + newclipbid=gCreateBit(0,&size); + if (newclipbid<0) + { + uErrorValue(newclipbid); + return(-1); + } + gCreateTempGC0(newclipbid); + origin.x=origin.y=0; + gCopyBit(&origin,bid,prect,G_TRMODE_REPL); + gFreeTempGC(); + wFree(clipbid[clipindex]); + clipbid[clipindex]=newclipbid; + clipsize[clipindex]=size; + return(0); + } + +LOCAL_C VOID CopyToClipboard(VOID) + { + P_RECT rect; + + if (issel) + { + if (!CheckUserConfirms("Copy select region to clipboard")) + return; + GetSmallSelectRegion(&rect); + } + else + { + if (!CheckUserConfirms("Copy whole icon to clipboard")) + return; + GetWholeIcon(&rect); + } + if (DoCopy(&rect,using)) + return; + wInfoMsg("Copied"); + } + +LOCAL_C VOID DoDelete(P_RECT *prect) + { + gCreateTempGC0(bid); + gClrRect(prect,G_TRMODE_CLR); + gFreeTempGC(); + } + +LOCAL_C VOID CutToClipboard(VOID) + { + P_RECT rect; + + if (issel) + { + if (!CheckUserConfirms("Cut select region into clipboard")) + return; + GetSmallSelectRegion(&rect); + } + else + { + if (!CheckUserConfirms("Cut whole icon into clipboard")) + return; + GetWholeIcon(&rect); + } + if (DoCopy(&rect,using)) + return; + key.modifiers=0; + MoveCursorAbsolute(rect.tl.x,rect.tl.y); + DoDelete(&rect); + changed=TRUE; + DrawIcons(); + } + +LOCAL_C VOID DoInsert(P_POINT *target,INT clipindex,INT mode) + { + P_RECT rect; + + rect.tl.x=rect.tl.y=0; + rect.br.x=clipsize[clipindex].x; + rect.br.y=clipsize[clipindex].y; + gCreateTempGC0(bid); + gCopyBit(target,clipbid[clipindex],&rect,mode); + gFreeTempGC(); + } + +LOCAL_C VOID InsertFromClipboard(VOID) + { + if (!clipbid[using]) + { + wInfoMsg("Current clipboard is empty"); + return; + } + if (!CheckUserConfirms("Insert from clipboard")) + return; + if (issel) + CancelSelect(); + DoInsert(&curs,using,brush); + DrawIcons(); + changed=TRUE; + } + +LOCAL_C VOID ConsiderInterrogation(VOID) + { + UWORD nsel; + + if (uOpenDialog("Before cut/copy/insert")) + return; + nsel=(require_query? 2: 1); + if (AddNoYesChoice("Request confirmation",&nsel)) + return; + if (RunDialog()<=0) + return; + require_query=(nsel==2); + } + +LOCAL_C VOID ResetStateBeforeMove(VOID) + { + P_POINT origin; + + origin.x=origin.y=0; + DoInsert(&origin,MOVE_BACKUP,G_TRMODE_REPL); + } + +LOCAL_C VOID MoveBy(INT offx,INT offy) + { + if (issel || !MoveSingle) + ResetStateBeforeMove(); + if (MoveSingle) + DoDelete(&moveorigin); + p_offrec(&movedto,offx,offy); + DoInsert(&movedto.tl,MOVE_RAFT,G_TRMODE_REPL); + MoveUpdatePending=TRUE; + } + +LOCAL_C VOID EnterMoveState(VOID) + { + TEXT *title; + INT keycode; + + GetWholeIcon(&moveorigin); + if (DoCopy(&moveorigin,MOVE_BACKUP)) + return; + if (issel) + { + title="Move select region"; + GetSmallSelectRegion(&moveorigin); + } + else + title="Move whole icon"; + if (uOpenDialog(title)) + goto TidyUp; + if (uAddButtonList("Single copy",'s',"Double copy",'d',NULL)) + goto TidyUp; + if (!(keycode=RunDialog())) + goto TidyUp; + MoveSingle=(keycode=='s'); + if (DoCopy(&moveorigin,MOVE_RAFT)) + goto TidyUp; + movedto=moveorigin; + ToggleCursor(); + wEraseTextCursor(); + DatLocked=TRUE; + wSetBusyMsg("Moving",W_CORNER_BOTTOM_LEFT); + MoveUpdatePending=FALSE; + FOREVER + { + uGetKey(&key); + switch (key.keycode) + { + case W_KEY_UP: + MoveBy(0,-1); + break; + case W_KEY_DOWN: + MoveBy(0,1); + break; + case W_KEY_LEFT: + MoveBy(-1,0); + break; + case W_KEY_RIGHT: + MoveBy(1,0); + break; + case W_KEY_ESCAPE: + ResetStateBeforeMove(); + DrawIcons(); + goto ExitMoveState; + case W_KEY_RETURN: + changed=TRUE; + goto ExitMoveState; + default: + p_sound(-5,320); + wInfoMsg("ENTER or ESC exits `Moving'"); + } + if (MoveUpdatePending && !uKeyPressOutstanding()) + { + DrawIcons(); + MoveUpdatePending=FALSE; + } + } +ExitMoveState: + DatLocked=FALSE; + ToggleCursor(); + wCancelBusyMsg(); + wFree(clipbid[MOVE_RAFT]); + clipbid[MOVE_RAFT]=0; +TidyUp: + wFree(clipbid[MOVE_BACKUP]); + clipbid[MOVE_BACKUP]=0; + } + +LOCAL_C INT IncrementAndFix(INT value,INT delta) + { + value+=delta; + if (value<0) + value+=ICON_SIZE; + else if (value>=ICON_SIZE) + value-=ICON_SIZE; + return(value); + } + +LOCAL_C VOID AlterBit(INT gmode) + { + P_RECT box; + + gCreateTempGC0(bid); + box.tl=curs; + box.br.x=curs.x+1; + box.br.y=curs.y+1; + gClrRect(&box,gmode); + changed=TRUE; + gFreeTempGC(); + DrawSmallIcon(); + ScaleUp(&box); + gClrRect(&box,gmode); + } + +LOCAL_C VOID MoveCursorRelative(INT delx,INT dely) + { + if (key.modifiers&W_CTRL_MODIFIER) + AlterBit(brush); + ToggleCursor(); + CheckIfSelectStatusChanging(); + curs.x=IncrementAndFix(curs.x,delx); + curs.y=IncrementAndFix(curs.y,dely); + CheckForNullSelect(); + ToggleCursor(); + WriteCursorText(); + } + +LOCAL_C VOID ReduceScreenSize(VOID) + { + W_WINDATA wd; + + wd.extent.tl.x=wd.extent.tl.y=0; + wd.extent.width=189; + wd.extent.height=80; + wSetWindow(MainWid,W_WIN_EXTENT,&wd); + if (uErrorValue(wCheckPoint())) + p_exit(0); + } + +LOCAL_C INT ObeySystemCommand(INT cmd,TEXT *pb,VOID **newfcb) + { + return((cmd=='O'? TryOpenIconFile: TryNewIconFile)(pb,newfcb)); + } + +LOCAL_C VOID CreateGC(VOID) + { + G_GC gc; + INT hgc; + + gc.gmode=G_TRMODE_INV; + hgc=gCreateGC(MainWid,G_GC_MASK_GMODE,&gc); + if (hgc<0) + p_exit(hgc); + } + +LOCAL_C VOID SpecificInit(VOID) + { + INT command; + + MainWid=uFindMainWid(); + CreateGC(); + ToggleFrame(); + command=hCrackCommandLine(); + bid=ObeySystemCommand(command,DatUsedPathNamePtr,&fcb); + if (bid<=0) + p_exit(0); + ReduceScreenSize(); + ToggleStatusWindow(); + RestartDisplay(); + WriteBrushText(); + WriteClipboardText(); + wInfoMsg("Press `Help' for tips on usage"); + } + +LOCAL_C VOID ProcessSystemCommand(VOID) + { + TEXT buf[P_FNAMESIZE+2]; + INT newbid; + VOID *newfcb; + + wGetCommand((UBYTE *)&buf[0]); + if (buf[0]=='X') + ExitApplication(); + SaveIfChanged(); + newbid=ObeySystemCommand(buf[0],&buf[1],&newfcb); + if (newbid>0) + ChangeOverTo(newbid,newfcb,&buf[1]); + } + +LOCAL_C VOID DisplayHelpText(VOID) + { + INT choice; + + FOREVER + { + choice=uDialogMenu("Help on which topic", + "Cursor position", + "Select regions", + "Drawing lines", + "Brushes", + "Using clipboards", + "Borders and frames",NULL); + switch (choice) + { + case 0: + return; + case 2: + uDisplayText("To move the cursor:", + "use the usual cursor keys", + "including Home, End, PgUp and PgDn", + "or use `Goto' in the `Edit' menu.", + "Use Enter or Space to toggle the pixel", + "at the cursor position.",NULL); + break; + case 3: + uDisplayText("To create a select region:", + "use SHIFTed cursor keys.", + "To emphasise a select region:", + "use `Highlight' in the `Special' menu.", + "`Move', Delete, `Copy' and `Plaster'", + "all operate on the current select region.",NULL); + break; + case 4: + uDisplayText("To draw vertical or horizontal lines:", + "use the cursor keys plus CONTROL.", + "Lines are drawn in the current Brush.",NULL); + break; + case 5: + uDisplayText("The Brush setting affects:", + "horizontal and vertical lines drawn", + "borders drawn using `Border'", + "text written using `Write'", + "and contents inserted from clipboards.", + "`Toggle' is the most useful setting.",NULL); + break; + case 6: + uDisplayText("Choose between 4 clipboards with `Use'.", + "Cut into a clipboard with the Delete key.", + "To eliminate `Are you sure?' queries:", + "use `Interrogation' in the `Special' menu.",NULL); + break; + case 7: + uDisplayText("To apply one of many types of border:", + "use `Border' in the `Special' menu.", + "To hide or show a frame round the icon:", + "use `Frame' in the `Special' menu.", + "To control cursor indicators in the frame:", + "use `Cursor' in the `Special' menu.",NULL); + break; + } + } + } + +LOCAL_C VOID ManageCommand(INT index) + { + switch (index) + { + case ITEMS_BEFORE_FILE: + NewIconFile(); + break; + case ITEMS_BEFORE_FILE+1: + OpenIconFile(); + break; + case ITEMS_BEFORE_FILE+2: + SaveIconAs(); + break; + case ITEMS_BEFORE_FILE+3: + SaveIcon(); + break; + case ITEMS_BEFORE_FILE+4: + RevertIfConfirmed(); + break; + case ITEMS_BEFORE_FILE+5: + ExitApplication(); + break; + case ITEMS_BEFORE_EDIT: + InsertFromClipboard(); + break; + case ITEMS_BEFORE_EDIT+1: + CopyToClipboard(); + break; + case ITEMS_BEFORE_EDIT+2: + ChangeClipboardUsed(); + break; + case ITEMS_BEFORE_EDIT+3: + InvertOrGrey(); + break; + case ITEMS_BEFORE_EDIT+4: + EnterMoveState(); + break; + case ITEMS_BEFORE_EDIT+5: + RepositionCursor(); + break; + case ITEMS_BEFORE_BRUSH: + case ITEMS_BEFORE_BRUSH+1: + case ITEMS_BEFORE_BRUSH+2: + brush=index-ITEMS_BEFORE_BRUSH; + WriteBrushText(); + break; + case ITEMS_BEFORE_SPECIAL: + ToggleFrame(); + break; + case ITEMS_BEFORE_SPECIAL+1: + ToggleCursorVisibility(); + break; + case ITEMS_BEFORE_SPECIAL+2: + FlashHighlightRegion(); + break; + case ITEMS_BEFORE_SPECIAL+3: + WriteText(); + break; + case ITEMS_BEFORE_SPECIAL+4: + DrawBorder(); + break; + case ITEMS_BEFORE_SPECIAL+5: + ConsiderInterrogation(); + break; + } + } + +LOCAL_C VOID TryExecuteCommand(INT keycode) + { + keycode=uLocateCommand(keycode); + if (keycode>=0) + ManageCommand(keycode); + } + +LOCAL_C VOID MainLoop(VOID) + { + INT ret; + + FOREVER + { + uGetKey(&key); + if (key.keycode&W_EVENT_KEY) + { + if (key.keycode==CONS_EVENT_COMMAND) + ProcessSystemCommand(); + } + else if (key.keycode&W_SPECIAL_KEY) + TryExecuteCommand(key.keycode&(~W_SPECIAL_KEY)); + else + { + switch (key.keycode) + { + case W_KEY_MENU: + if (key.modifiers&W_CTRL_MODIFIER) + ToggleStatusWindow(); + else + { + ret=uPresentMenus(); + if (ret>0) + TryExecuteCommand(ret); + } + break; + case W_KEY_RETURN: + case ' ': + AlterBit(G_TRMODE_INV); + break; + case W_KEY_LEFT: + MoveCursorRelative(-1,0); + break; + case W_KEY_RIGHT: + MoveCursorRelative(1,0); + break; + case W_KEY_UP: + MoveCursorRelative(0,-1); + break; + case W_KEY_DOWN: + MoveCursorRelative(0,1); + break; + case W_KEY_HOME: + MoveCursorAbsolute(0,-1); + break; + case W_KEY_END: + MoveCursorAbsolute(ICON_SIZE-1,-1); + break; + case W_KEY_PAGE_UP: + MoveCursorAbsolute(-1,0); + break; + case W_KEY_PAGE_DOWN: + MoveCursorAbsolute(-1,ICON_SIZE-1); + break; + case W_KEY_ESCAPE: + if (issel) + CancelSelect(); + break; + case W_KEY_DELETE_LEFT: + CutToClipboard(); + break; + case W_KEY_HELP: + DisplayHelpText(); + } + } + } + } + +GLDEF_C VOID main(VOID) + { + uCommonInit(); + SpecificInit(); + MainLoop(); + } diff --git a/code/SIBOSDK/hwdemo/iconed.ms b/code/SIBOSDK/hwdemo/iconed.ms new file mode 100644 index 0000000..0f86baa --- /dev/null +++ b/code/SIBOSDK/hwdemo/iconed.ms @@ -0,0 +1,3 @@ +Iconed.PIC +\PIC\ +3 diff --git a/code/SIBOSDK/hwdemo/iconed.pic b/code/SIBOSDK/hwdemo/iconed.pic new file mode 100644 index 0000000..97e81e4 Binary files /dev/null and b/code/SIBOSDK/hwdemo/iconed.pic differ diff --git a/code/SIBOSDK/hwdemo/iconed.rsc b/code/SIBOSDK/hwdemo/iconed.rsc new file mode 100644 index 0000000..e69de29 diff --git a/code/SIBOSDK/hwdemo/iconed.shd b/code/SIBOSDK/hwdemo/iconed.shd new file mode 100644 index 0000000..f435236 Binary files /dev/null and b/code/SIBOSDK/hwdemo/iconed.shd differ diff --git a/code/SIBOSDK/hwdemo/joker.afl b/code/SIBOSDK/hwdemo/joker.afl new file mode 100644 index 0000000..38248ad --- /dev/null +++ b/code/SIBOSDK/hwdemo/joker.afl @@ -0,0 +1,3 @@ +joker.pic +joker.rsc +joker.shd diff --git a/code/SIBOSDK/hwdemo/joker.c b/code/SIBOSDK/hwdemo/joker.c new file mode 100644 index 0000000..a3785ea --- /dev/null +++ b/code/SIBOSDK/hwdemo/joker.c @@ -0,0 +1,338 @@ +/* + JOKER.C + +Written by DavidW +Started on 15/11/91 + +*/ + +#include +#include +#include +#include +#include + + +LOCAL_D TEXT *cmds[]= + { + "oOverwrite", + "dDouble free", + "fFaulty free", + "wWind up stack", + "bBusy", + "sSlow exit", + "xExit", + NULL + }; + +#define CORRUPT_ITEMS 3 +#define SPECIAL_ITEMS 4 + +#define ITEMS_BEFORE_CORRUPT 0 +#define ITEMS_BEFORE_SPECIAL CORRUPT_ITEMS + +LOCAL_D H_MENU_DATA mdata[]= + { + "Corrupt heap",CORRUPT_ITEMS, + "Special",SPECIAL_ITEMS, + NULL + }; + +GLDEF_D TEXT ** _cmds=(&cmds[0]); +GLDEF_D H_MENU_DATA * _mdata=(&mdata[0]); + + +LOCAL_D UINT MainWid; + +LOCAL_D LONG delay=50l; + + +LOCAL_C VOID DoSleep(VOID) + { + TEXT buf[30]; + + p_atos(&buf[0],"Waiting %ld/10 secs",delay); + wSetBusyMsg(&buf[0],W_CORNER_BOTTOM_LEFT); + p_sleep(delay); + wCancelBusyMsg(); + } + +LOCAL_C INT AddInDelayItem(VOID) + { + H_DI_NUMBER num; + + num.value=(&delay); + num.low=0; + num.high=1000; + return(uAddDialogItem(H_DIALOG_NUMBER,"Delay (10ths of secs)",&num)); + } + +LOCAL_C INT AddNumberEditor(TEXT *prompt,LONG *pnum,INT low,INT high) + { + H_DI_NUMBER num; + + num.value=pnum; + num.low=low; + num.high=high; + return(uAddDialogItem(H_DIALOG_NUMBER,prompt,&num)); + } + +LOCAL_C VOID OverwriteAllocCell(VOID) + { + LONG cellen; + LONG overwlen; + UBYTE *cell; + + if (uOpenDialog("Overwrite alloc cell")) + return; + cellen=0x100; + if (AddNumberEditor("Length of cell to alloc",&cellen,4,0x1000)) + return; + overwlen=4; + if (AddNumberEditor("Length of overwrite",&overwlen,1,0x100)) + return; + if (AddInDelayItem()) + return; + if (uRunDialog()<=0) + return; + cell=p_alloc((UWORD)cellen); + if (!cell) + { + wInfoMsg("Cell too large to alloc"); + return; + } + DoSleep(); + p_bfil(cell,(UWORD)(cellen+overwlen),0xee); + } + +LOCAL_C VOID FreeCellTwice(VOID) + { + LONG cellen; + UBYTE *cell; + + if (uOpenDialog("Free cell twice")) + return; + cellen=0x100; + if (AddNumberEditor("Length of cell to free twice",&cellen,4,0x1000)) + return; + if (AddInDelayItem()) + return; + if (uRunDialog()<=0) + return; + cell=p_alloc((UWORD)cellen); + if (!cell) + { + wInfoMsg("Cell too large to alloc"); + return; + } + p_free(cell); + DoSleep(); + p_free(cell); + } + +LOCAL_C VOID FreeWrongCell(VOID) + { + LONG cellen; + UBYTE *cell; + + if (uOpenDialog("Free wrong cell")) + return; + cellen=0x100; + if (AddNumberEditor("Length of correct cell",&cellen,4,0x1000)) + return; + if (AddInDelayItem()) + return; + if (uRunDialog()<=0) + return; + cell=p_alloc((UWORD)cellen); + if (!cell) + { + wInfoMsg("Cell too large to alloc"); + return; + } + DoSleep(); + p_free(cell+1); + } + +LOCAL_C VOID MainLoop(VOID); + +LOCAL_C VOID DoWindupStack(VOID) + { + UBYTE junk[256]; + + p_bfil(&junk[0],256,0); + MainLoop(); + } + +LOCAL_C VOID WindupStack(VOID) + { + if (uOpenDialog("Wind up stack")) + return; + if (AddInDelayItem()) + return; + if (uRunDialog()<=0) + return; + DoSleep(); + DoWindupStack(); + } + +#define Y_BUSY_LOW 10 +#define Y_BUSY_HIGH 78 +#define X_BUSY 83 +#define BUSY_SCALE 1000 + +LOCAL_C VOID DoPrint(UINT y) + { + gPrintText(X_BUSY,y,"Busy",4); + wFlush(); + } + +LOCAL_C VOID GoBusy(VOID) + { + LONG nloops; + UWORD y; + UWORD lasty; + ULONG j; + + if (uOpenDialog("Go busy")) + return; + nloops=3; + if (AddNumberEditor("Number of loops of activity",&nloops,1,10)) + return; + if (AddInDelayItem()) + return; + if (uRunDialog()<=0) + return; + DoSleep(); + while (nloops--) + { + lasty=Y_BUSY_LOW; + DoPrint(lasty); + j=Y_BUSY_LOW*BUSY_SCALE; + FOREVER + { + j++; + y=(UWORD)(j/BUSY_SCALE); + if (y!=lasty) + { + DoPrint(lasty); + if (y>Y_BUSY_HIGH) + break; + lasty=y; + DoPrint(y); + } + } + } + } + +LOCAL_C VOID SlowExit(VOID) + { + if (uOpenDialog("Slow exit")) + return; + if (AddInDelayItem()) + return; + if (uRunDialog()<=0) + return; + DoSleep(); + p_exit(0); + } + +LOCAL_C VOID ManageCommand(INT index) + { + switch (index) + { + case ITEMS_BEFORE_CORRUPT: + OverwriteAllocCell(); + break; + case ITEMS_BEFORE_CORRUPT+1: + FreeCellTwice(); + break; + case ITEMS_BEFORE_CORRUPT+2: + FreeWrongCell(); + break; + case ITEMS_BEFORE_SPECIAL: + WindupStack(); + break; + case ITEMS_BEFORE_SPECIAL+1: + GoBusy(); + break; + case ITEMS_BEFORE_SPECIAL+2: + SlowExit(); + break; + case ITEMS_BEFORE_SPECIAL+3: + p_exit(0); + } + } + +LOCAL_C VOID TryExecuteCommand(INT keycode) + { + keycode=uLocateCommand(keycode); + if (keycode>=0) + ManageCommand(keycode); + } + +LOCAL_C VOID GoToSystemScreen(VOID) + { + wClientPosition(0,p_pidfind("SYS$SHLL.*")); + } + +LOCAL_C VOID MainLoop(VOID) + { + INT ret; + WMSG_KEY key; + + FOREVER + { + uGetKey(&key); + if (key.keycode&W_SPECIAL_KEY) + TryExecuteCommand(key.keycode&(~W_SPECIAL_KEY)); + else if (key.keycode==W_KEY_MENU && !(key.modifiers&W_CTRL_MODIFIER)) + { + ret=uPresentMenus(); + if (ret>0) + TryExecuteCommand(ret); + } + else if (key.keycode==26) + GoToSystemScreen(); + } + } + +LOCAL_C VOID ReduceScreenSize(VOID) + { + W_WINDATA wd; + + wd.extent.tl.x=wd.extent.tl.y=0; + wd.extent.width=189; + wd.extent.height=80; + wSetWindow(MainWid,W_WIN_EXTENT,&wd); + if (uErrorValue(wCheckPoint())) + p_exit(0); + } + +LOCAL_C VOID CreateGC(VOID) + { + G_GC gc; + INT hgc; + + gc.textmode=G_TRMODE_INV; + hgc=gCreateGC(MainWid,G_GC_MASK_TEXTMODE,&gc); + if (hgc<0) + p_exit(hgc); + } + +LOCAL_C VOID SpecificInit(VOID) + { + MainWid=uFindMainWid(); + CreateGC(); + ReduceScreenSize(); + gBorder(W_BORD_CORNER_4); + wsEnable(); + wCaptureKey(26,W_CTRL_MODIFIER,W_CTRL_MODIFIER); + } + +GLDEF_C VOID main(VOID) + { + uCommonInit(); + SpecificInit(); + MainLoop(); + } diff --git a/code/SIBOSDK/hwdemo/joker.ms b/code/SIBOSDK/hwdemo/joker.ms new file mode 100644 index 0000000..c4dfc59 --- /dev/null +++ b/code/SIBOSDK/hwdemo/joker.ms @@ -0,0 +1 @@ +Joker diff --git a/code/SIBOSDK/hwdemo/joker.pic b/code/SIBOSDK/hwdemo/joker.pic new file mode 100644 index 0000000..27bf496 Binary files /dev/null and b/code/SIBOSDK/hwdemo/joker.pic differ diff --git a/code/SIBOSDK/hwdemo/joker.rsc b/code/SIBOSDK/hwdemo/joker.rsc new file mode 100644 index 0000000..e69de29 diff --git a/code/SIBOSDK/hwdemo/joker.shd b/code/SIBOSDK/hwdemo/joker.shd new file mode 100644 index 0000000..a30768f Binary files /dev/null and b/code/SIBOSDK/hwdemo/joker.shd differ diff --git a/code/SIBOSDK/hwdemo/make.bat b/code/SIBOSDK/hwdemo/make.bat new file mode 100644 index 0000000..f260a39 --- /dev/null +++ b/code/SIBOSDK/hwdemo/make.bat @@ -0,0 +1,8 @@ +@echo off +call checkvid +if exist %1.pr goto custom +tsc /m unnamed.pr /smain=%1 /%jpivid% +goto end +:custom +tsc /m %1.pr /smain=%1 /%jpivid% +:end diff --git a/code/SIBOSDK/hwdemo/notes.afl b/code/SIBOSDK/hwdemo/notes.afl new file mode 100644 index 0000000..7578d91 --- /dev/null +++ b/code/SIBOSDK/hwdemo/notes.afl @@ -0,0 +1,3 @@ +notes.pic +notes.rsc +notes.shd diff --git a/code/SIBOSDK/hwdemo/notes.c b/code/SIBOSDK/hwdemo/notes.c new file mode 100644 index 0000000..a7d0326 --- /dev/null +++ b/code/SIBOSDK/hwdemo/notes.c @@ -0,0 +1,1121 @@ +/* + NOTES.C + +Written by DavidW +Started on 17/12/91 + +*/ + +#include +#include +#include +#include +#include +#include + + +LOCAL_D TEXT *cmds[]= + { + "aNew note", + "jInsert note", + "kCopy note", + "dDelete note", + "iInsert text", + "cCopy text", + "vEvaluate", + "zSum", + "rRecord", + "uUndo", + "tTitle window", + "nNotes window", + "fFind window", + "oOptions", + "sSearch forwards", + "bSearch backwards", + "qSearch first", + "lSearch last", + "+Set", + "-Clear", + "*Tag all", + "/Clear all", + "gGo to", + "mMove to", + "hShow symbols", + "pPrint", + "yPrint setup", + "xExit", + NULL + }; + +#define NOTES_ITEMS 4 +#define EDIT_ITEMS 6 +#define WINDOW_ITEMS 3 +#define SEARCH_ITEMS 5 +#define TAG_ITEMS 4 +#define SPECIAL_ITEMS 6 + +#define ITEMS_BEFORE_NOTES 0 +#define ITEMS_BEFORE_EDIT NOTES_ITEMS +#define ITEMS_BEFORE_WINDOW (ITEMS_BEFORE_EDIT+EDIT_ITEMS) +#define ITEMS_BEFORE_SEARCH (ITEMS_BEFORE_WINDOW+WINDOW_ITEMS) +#define ITEMS_BEFORE_TAG (ITEMS_BEFORE_SEARCH+SEARCH_ITEMS) +#define ITEMS_BEFORE_SPECIAL (ITEMS_BEFORE_TAG+TAG_ITEMS) + +#define SYMBOLS_ITEM ITEMS_BEFORE_SPECIAL+2 + +LOCAL_D H_MENU_DATA mdata[]= + { + "Notes",NOTES_ITEMS, + "Edit",EDIT_ITEMS, + "Windows",WINDOW_ITEMS, + "Search",SEARCH_ITEMS, + "Tag",TAG_ITEMS, + "Special",SPECIAL_ITEMS, + NULL + }; + +GLDEF_D TEXT ** _cmds=(&cmds[0]); +GLDEF_D H_MENU_DATA * _mdata=(&mdata[0]); + + +LOCAL_D UINT MainWid; + +typedef struct + { + UBYTE len; + TEXT *buf; + } LENBUF; + +typedef struct + { + LENBUF title; + LENBUF note; + UWORD tagged; + } NOTE; + +LOCAL_D NOTE index[99]; +LOCAL_D WORD count=1; +LOCAL_D WORD where; + +LOCAL_D WORD changed=TRUE; + +LOCAL_D VOID *edit[3]; +LOCAL_D UWORD show_statwin=TRUE; +LOCAL_D UWORD ScreenWidth; +LOCAL_D INT emph=0; + +LOCAL_D INT sumflag='='; +LOCAL_D INT sumndp=2; + +LOCAL_D NOTE clip; + +LOCAL_D UWORD PrintTagsOnly; +LOCAL_D UWORD PrintRec; +LOCAL_D UWORD PrintState; +LOCAL_D TEXT *PrintBuf; +LOCAL_D WORD PrintLen; +LOCAL_D UWORD PrintCount; +LOCAL_D UWORD PrintNewPage=1; + +LOCAL_D UWORD casesens=1; +LOCAL_D UWORD findtype=1; +LOCAL_D TEXT *pattern; +LOCAL_D WORD pattlen; + +LOCAL_D UWORD ShowSymbols=FALSE; + +LOCAL_D TEXT FindStack[6][21]; +LOCAL_D WORD FindSP=0; + +LOCAL_D UWORD tly[]={0,17,65}; +LOCAL_D UWORD bry[]={15,62,80}; + +LOCAL_C VOID DrawBorder(INT i) + { + P_RECT rect; + + rect.tl.x=(i? 0: 8); + rect.br.x=ScreenWidth; + if (i==2) + rect.br.x-=30; + rect.tl.y=tly[i]; + rect.br.y=bry[i]; + gBorderRect(&rect, + W_BORD_CORNER_4|W_BORD_SHADOW_S|(i==emph? W_BORD_SHADOW_ON: 0)); + hEBEmphasise(edit[i],i==emph); + } + +LOCAL_C VOID RotateTo(INT newemph) + { + INT oldemph; + + if (newemph!=emph) + { + oldemph=emph; + emph=newemph; + DrawBorder(oldemph); + DrawBorder(newemph); + } + } + +LOCAL_C INT CheckEditing(VOID) + { + if (emph==1) + return(0); + wInfoMsg("Only available in notes window"); + return(-1); + } + +LOCAL_C INT RecordChange(VOID *ebH,LENBUF *lb) + { + TEXT *buf; + INT len; + TEXT *newbuf; + + if (!hEBSenseChanged(ebH)) + return(0); + buf=hEBSenseText(ebH); + len=p_slen(buf); + newbuf=p_realloc(lb->buf,len); + if (!newbuf) + { + wInfoMsg("No memory to store changes in note"); + return(-1); + } + lb->buf=newbuf; + lb->len=len; + p_bcpy(newbuf,buf,len); + hEBClearChanged(ebH); + return(0); + } + +LOCAL_C INT RecordChanges(VOID) + { + return(RecordChange(edit[0],&index[where].title) + || RecordChange(edit[1],&index[where].note)); + } + +LOCAL_C VOID DrawWhereAndCount(VOID) + { + TEXT buf[10]; + P_RECT box; + + p_atos(&buf[0],"%d/%d",where+1,count); + box.tl.x=ScreenWidth-30; + box.br.x=ScreenWidth; + box.tl.y=67; + box.br.y=77; + gPrintBoxText(&box,8,G_TEXT_ALIGN_CENTRE,0,&buf[0],p_slen(&buf[0])); + } + +LOCAL_C VOID DrawTagStatus(VOID) + { + P_RECT box; + + box.tl.y=2; + box.br.y=12; + box.tl.x=0; + box.br.x=8; + gPrintBoxText(&box,8,G_TEXT_ALIGN_LEFT,0,"\014",index[where].tagged); + } + +LOCAL_C INT LoadEditors(VOID) + { + if (hEBSetText(edit[0],index[where].title.buf,index[where].title.len)) + return(-1); + hEBClearChanged(edit[0]); + if (hEBSetText(edit[1],index[where].note.buf,index[where].note.len)) + return(-1); + hEBClearChanged(edit[1]); + DrawWhereAndCount(); + DrawTagStatus(); + return(0); + } + +LOCAL_C INT LocateNewWhere(VOID) + { + if (index[where].title.len || index[where].note.len) + { + if (count==99) + { + wInfoMsg("Maximum number of notes reached"); + return(-1); + } + where=count++; + } + return(0); + } + +LOCAL_C VOID StartNewNote(VOID) + { + if (RecordChanges()) + return; + if (LocateNewWhere()) + return; + if (LoadEditors()) + return; + RotateTo(0); + } + +LOCAL_C INT CheckChanged(VOID) + { + if (!hEBSenseChanged(edit[0]) && !hEBSenseChanged(edit[1])) + { + wInfoMsg("Not changed"); + return(-1); + } + return(0); + } + +LOCAL_C VOID RecordNote(VOID) + { + if (CheckChanged()) + return; + if (RecordChanges()) + return; + wInfoMsg("Note recorded"); + } + +LOCAL_C INT RunDialog(VOID) + { + INT ret; + + hEBEmphasise(edit[emph],FALSE); + ret=uRunDialog(); + hEBEmphasise(edit[emph],TRUE); + return(ret); + } + +LOCAL_C INT Confirm(TEXT *pb) + { + if (uOpenDialog(pb)) + return(-1); + if (uAddButtonList("No",-'n',"Yes",'y',NULL)) + return(-1); + return(RunDialog()!='y'); + } + +LOCAL_C VOID UndoEditing(VOID) + { + if (CheckChanged()) + return; + if (Confirm("Undo editing")) + return; + LoadEditors(); + } + +LOCAL_C VOID GoToNote(VOID) + { + LONG newwhere; + H_DI_NUMBER num; + + newwhere=where+1; + if (uOpenDialog("Go to")) + return; + num.value=(&newwhere); + num.low=1; + num.high=count; + if (uAddDialogItem(H_DIALOG_NUMBER,"Note number",&num)) + return; + if (RunDialog()<=0) + return; + if (RecordChanges()) + return; + where=(INT)newwhere-1; + LoadEditors(); + } + +LOCAL_C VOID MoveNote(VOID) + { + LONG newwhere; + H_DI_NUMBER num; + INT neww; + INT tomove; + NOTE moving; + NOTE *targ; + NOTE *src; + + newwhere=1; + if (uOpenDialog("Move note")) + return; + num.value=(&newwhere); + num.low=1; + num.high=count; + if (uAddDialogItem(H_DIALOG_NUMBER,"New note number",&num)) + return; + if (RunDialog()<=0) + return; + neww=(INT)newwhere-1; + tomove=(neww-where)*sizeof(NOTE); + if (!tomove) + return; + moving=index[where]; + targ=(&index[where]); + src=targ+1; + if (tomove<0) + { + src=(&index[neww]); + targ=src+1; + tomove=(-tomove); + } + p_bcpy(targ,src,tomove); + index[neww]=moving; + where=neww; + DrawWhereAndCount(); + } + +LOCAL_C INT AddCentredTextItem(TEXT *pb) + { + H_DI_TEXT txt; + TEXT buf[64]; + + txt.type=H_DTEXT_ALIGN_CENTRE; + txt.str=(&buf[0]); + uZTStoBCS(&buf[0],pb); + return(uAddDialogItem(H_DIALOG_TEXT,NULL,&txt)); + } + +LOCAL_C VOID SumData(VOID) + { + TEXT flag[2]; + H_DI_EDIT ed; + LONG newndp; + H_DI_NUMBER num; + WORD datacount; + INT badcount; + DOUBLE datasum; + DOUBLE value; + TEXT *pb; + INT ind; + TEXT buf[30]; + P_DTOB dtob; + + if (uOpenDialog("Sum data")) + return; + flag[0]=1; + flag[1]=(BYTE)sumflag; + ed.len=1; + ed.str=(&flag[0]); + if (uAddDialogItem(H_DIALOG_EDIT,"Sum values flagged by",&ed)) + return; + newndp=sumndp; + num.value=(&newndp); + num.low=0; + num.high=10; + if (uAddDialogItem(H_DIALOG_NUMBER,"Number of dec places",&num)) + return; + if (RunDialog()<=0) + return; + sumndp=(INT)newndp; + if (flag[1]) + sumflag=flag[1]; + datacount=0; + badcount=0; + p_itof(&datasum,&datacount); + pb=hEBSenseText(edit[1]); + FOREVER + { + ind=p_sloc(pb,sumflag); + if (ind<0) + break; + pb+=ind+1; + if (p_stod(&pb,&value,'.')) + badcount++; + else + { + datacount++; + p_fadd(&datasum,&value); + } + } + if (badcount) + { + if (uOpenDialog("Warning")) + return; + p_atos(&buf[0],"%d bad flagged value(s)",badcount); + if (AddCentredTextItem(&buf[0])) + return; + RunDialog(); + } + p_atos(&buf[0],"Sum of %d values",datacount); + if (uOpenDialog(&buf[0])) + return; + dtob.type=P_DTOB_FIXED; + dtob.width=29; + dtob.ndec=sumndp; + dtob.point='.'; + dtob.trilen=0; + buf[p_dtob(&buf[0],&datasum,&dtob)]=0; + if (AddCentredTextItem(&buf[0])) + return; + if (AddCentredTextItem("(Sum will be copied into clipboard)")) + return; + if (RunDialog()<=0) + return; + hEBSetClipText(edit[1],&buf[0],p_slen(&buf[0])); + } + +LOCAL_C VOID PrintSetupDialog(VOID) + { + hEBEmphasise(edit[emph],FALSE); + hPrintSetupDialog(); + hEBEmphasise(edit[emph],TRUE); + } + +LOCAL_C VOID ZeroLenbuf(LENBUF *lb) + { + p_free(lb->buf); + lb->buf=NULL; + lb->len=0; + } + +LOCAL_C VOID ZeroNote(NOTE *pn) + { + ZeroLenbuf(&pn->title); + ZeroLenbuf(&pn->note); + pn->tagged=FALSE; + } + +LOCAL_C VOID DeleteNote(VOID) + { + INT tomove; + + if (Confirm("Delete this note")) + return; + tomove=count-1-where; + if (tomove>0) + p_bcpy(&index[where],&index[where+1],tomove*sizeof(NOTE)); + else + ZeroNote(&index[where]); + if (count>1) + count--; + if (where==count) + where=count-1; + LoadEditors(); + } + +LOCAL_C VOID ExitIfConfirmed(VOID) + { + if (uOpenDialog("Warning")) + return; + if (AddCentredTextItem("Exiting will delete all notes")) + return; + if (uAddButtonList("Cancel",W_KEY_ESCAPE,"Exit",W_KEY_RETURN,NULL)) + return; + if (RunDialog()!=W_KEY_RETURN) + return; + p_exit(0); + } + +LOCAL_C INT TakeCopyLenbuf(LENBUF *targ,LENBUF *src) + { + targ->buf=p_alloc(src->len); + if (!targ->buf) + { + uErrorValue(E_GEN_NOMEMORY); + return(-1); + } + p_bcpy(targ->buf,src->buf,src->len); + targ->len=src->len; + return(0); + } + +LOCAL_C INT TakeCopy(NOTE *targ,NOTE *src) + { + if (TakeCopyLenbuf(&targ->title,&src->title)) + return(-1); + if (TakeCopyLenbuf(&targ->note,&src->note)) + { + p_free(targ->title.buf); + targ->title.buf=0; + return(-1); + } + targ->tagged=src->tagged; + return(0); + } + +LOCAL_C VOID CopyNote(VOID) + { + NOTE new; + + if (RecordChanges()) + return; + if (!index[where].title.len && !index[where].note.len) + { + wInfoMsg("No note to copy"); + return; + } + if (TakeCopy(&new,&index[where])) + return; + ZeroNote(&clip); + clip=new; + wInfoMsg("Note copied"); + } + +LOCAL_C VOID InsertNote(VOID) + { + if (!clip.title.len && !clip.note.len) + { + wInfoMsg("No note to insert"); + return; + } + if (LocateNewWhere()) + return; + TakeCopy(&index[where],&clip); + LoadEditors(); + } + +LOCAL_C INT TagCount(VOID) + { + INT i; + INT tagcount; + + tagcount=0; + for (i=0; iblen=0; + if (PrintNewPage==2) + pr->flags|=H_PRINT_PAGE; + return(TRUE); + } + PrintState++; + case 1: + pr->style|=H_PRINT_STY_BOLD; + pr->blen=index[PrintRec].title.len; + pr->buf=index[PrintRec].title.buf; + break; + case 2: + PrintBuf=index[PrintRec].note.buf; + PrintLen=index[PrintRec].note.len; + default: + pr->buf=PrintBuf; + ind=p_bloc(PrintBuf,PrintLen,'\n'); + if (ind>=0) + { + pr->blen=ind; + PrintLen-=ind+1; + PrintBuf+=ind+1; + } + else + { + pr->blen=PrintLen; + PrintCount++; + PrintState=0; + PrintRec++; + } + } + pr->flags|=H_PRINT_KEEP; + return(TRUE); + } + +LOCAL_C VOID PrintNotes(VOID) + { + if (uOpenDialog("Print")) + return; + if (uAddChoiceList("New page for each note",&PrintNewPage,"No","Yes",0)) + return; + if (uAddButtonList("Tagged notes",'t',"All notes",'a',NULL)) + return; + PrintTagsOnly=FALSE; + switch (RunDialog()) + { + case 't': + PrintTagsOnly=TRUE; + case 'a': + if (RecordChanges()) + return; + PrintRec=0; + PrintState=0; + PrintCount=0; + hPrint(PrintLine); + InfoMsg("%d note(s) printed",PrintCount); + } + } + +LOCAL_C VOID OptionsForSearch(VOID) + { + if (uOpenDialog("Options for search")) + return; + if (uAddChoiceList("Case sensitive",&casesens,"No","Yes",NULL)) + return; + if (uAddChoiceList("Search",&findtype,"Just notes", + "Just title","Title and notes",NULL)) + return; + RunDialog(); + } + +LOCAL_C INT Search(INT here,INT window) + { + LENBUF *lb; + INT ind; + + lb=(&index[here].title)+window; + if (casesens==1) + ind=p_bsubi(lb->buf,lb->len,pattern,pattlen); + else + ind=p_bsub(lb->buf,lb->len,pattern,pattlen); + if (ind<0) + return(-1); + if (here!=where) + { + where=here; + if (LoadEditors()) + return(0); + } + if (pattlen) + { + if (window!=emph) + { + hEBEmphasise(edit[emph],FALSE); + hEBSetCWidth(edit[window],0); + hEBEmphasise(edit[window],TRUE); + } + hEBSetSelect(edit[window],ind,ind+pattlen); + if (window!=emph) + { + wFlush(); + p_sleep(5L); + hEBEmphasise(edit[window],FALSE); + hEBSetCWidth(edit[window],2); + hEBEmphasise(edit[emph],TRUE); + } + } + return(0); + } + +LOCAL_C INT CheckSearchTitle(INT here) + { + if (!(findtype&0x02)) + return(-1); + return(Search(here,0)); + } + +LOCAL_C INT CheckSearchNote(INT here) + { + if (!(findtype&0x01)) + return(-1); + return(Search(here,1)); + } + +LOCAL_C VOID DoSearch(INT here,INT direction) + { + INT k; + + if (RecordChanges()) + return; + pattern=hEBSenseText(edit[2]); + pattlen=p_slen(pattern); + hEBClearChanged(edit[2]); + k=count; + while (k--) + { + here+=direction; + if (here<0) + here=count-1; + else if (here>=count) + here=0; + if (!CheckSearchTitle(here)) + return; + if (!CheckSearchNote(here)) + return; + } + wInfoMsg("Not found"); + } + +LOCAL_C VOID ToggleShowSymbols(VOID) + { + ShowSymbols^=TRUE; + hEBShowSymbols(edit[1],ShowSymbols); + cmds[SYMBOLS_ITEM]=(ShowSymbols? "hHide symbols": "hShow symbols"); + } + +LOCAL_C VOID ManageCommand(INT index) + { + switch (index) + { + case ITEMS_BEFORE_NOTES: + StartNewNote(); + break; + case ITEMS_BEFORE_NOTES+1: + InsertNote(); + break; + case ITEMS_BEFORE_NOTES+2: + CopyNote(); + break; + case ITEMS_BEFORE_NOTES+3: + DeleteNote(); + break; + case ITEMS_BEFORE_EDIT: + if (!CheckEditing()) + { + if (hEBPaste(edit[1])>0) + wInfoMsg("No text to insert"); + } + break; + case ITEMS_BEFORE_EDIT+1: + if (!CheckEditing()) + { + if (hEBCopy(edit[1])>0) + wInfoMsg("No text to copy"); + else + wInfoMsg("Text copied"); + } + break; + case ITEMS_BEFORE_EDIT+2: + if (!CheckEditing()) + hEBEvaluate(edit[1]); + break; + case ITEMS_BEFORE_EDIT+3: + if (!CheckEditing()) + SumData(); + break; + case ITEMS_BEFORE_EDIT+4: + RecordNote(); + break; + case ITEMS_BEFORE_EDIT+5: + UndoEditing(); + break; + case ITEMS_BEFORE_WINDOW: + case ITEMS_BEFORE_WINDOW+1: + case ITEMS_BEFORE_WINDOW+2: + RotateTo(index-ITEMS_BEFORE_WINDOW); + break; + case ITEMS_BEFORE_SEARCH: + OptionsForSearch(); + break; + case ITEMS_BEFORE_SEARCH+1: + DoSearch(where, +1); + break; + case ITEMS_BEFORE_SEARCH+2: + DoSearch(where, -1); + break; + case ITEMS_BEFORE_SEARCH+3: + DoSearch(count,+1); + break; + case ITEMS_BEFORE_SEARCH+4: + DoSearch(count,-1); + break; + case ITEMS_BEFORE_TAG: + case ITEMS_BEFORE_TAG+1: + SetTag(ITEMS_BEFORE_TAG+1-index); + break; + case ITEMS_BEFORE_TAG+2: + case ITEMS_BEFORE_TAG+3: + TagAll(ITEMS_BEFORE_TAG+3-index); + break; + case ITEMS_BEFORE_SPECIAL: + GoToNote(); + break; + case ITEMS_BEFORE_SPECIAL+1: + MoveNote(); + break; + case ITEMS_BEFORE_SPECIAL+2: + ToggleShowSymbols(); + break; + case ITEMS_BEFORE_SPECIAL+3: + PrintNotes(); + break; + case ITEMS_BEFORE_SPECIAL+4: + PrintSetupDialog(); + break; + case ITEMS_BEFORE_SPECIAL+5: + ExitIfConfirmed(); + } + } + +LOCAL_C VOID TryExecuteCommand(INT keycode) + { + keycode=uLocateCommand(keycode); + if (keycode>=0) + ManageCommand(keycode); + } + +LOCAL_C INT ResizeWidth(UWORD width) + { + INT ret; + W_WINDATA wd; + + wd.extent.tl.x=wd.extent.tl.y=0; + wd.extent.width=width; + wd.extent.height=80; + wSetWindow(MainWid,W_WIN_EXTENT,&wd); + ret=uErrorValue(wCheckPoint()); + if (!ret) + ScreenWidth=width; + return(ret); + } + +LOCAL_C VOID SetStyle(INT style) + { + G_GC gc; + + gc.style=style; + gSetGC(0,G_GC_MASK_STYLE,&gc); + } + +LOCAL_C VOID DrawFindPrompt(VOID) + { + SetStyle(G_STY_ITALIC); + gPrintText(5,67+8,"Find:",5); + SetStyle(0); + } + +LOCAL_C VOID DrawBorders(VOID) + { + INT i; + + for (i=0; i<3; i++) + DrawBorder(i); + DrawFindPrompt(); + DrawWhereAndCount(); + } + +LOCAL_C VOID ClearWholeWindow(VOID) + { + P_RECT whole; + + whole.tl.x=whole.tl.y=0; + whole.br.x=240; + whole.br.y=80; + gClrRect(&whole,G_TRMODE_CLR); + } + +LOCAL_C VOID ToggleStatusWindow(VOID) + { + if (show_statwin) + { + if (ResizeWidth(240)) + return; + wsDisable(); + } + else + { + if (ResizeWidth(189)) + return; + wsEnable(); + } + show_statwin^=TRUE; + ClearWholeWindow(); + DrawBorders(); + hEBChangeWidth(edit[0],ScreenWidth-12-8); + hEBChangeWidth(edit[1],ScreenWidth-12); + hEBChangeWidth(edit[2],ScreenWidth-12-32-30); + } + +LOCAL_C VOID RotateFocus(INT shifted) + { + INT newemph; + + newemph=emph; + if (shifted) + { + if (!newemph--) + newemph=2; + } + else if (++newemph==3) + newemph=0; + RotateTo(newemph); + } + +LOCAL_C VOID QuickSearch(INT dir) + { + INT here; + + here=(hEBSenseChanged(edit[2])? count: where); + DoSearch(here,dir); + } + +LOCAL_C VOID ToFindStack(VOID) + { + TEXT *buf; + INT len; + + if (!hEBSenseChanged(edit[2])) + return; + buf=hEBSenseText(edit[2]); + len=p_slen(buf); + FindStack[FindSP][0]=len; + p_bcpy(&FindStack[FindSP][1],buf,len); + } + +LOCAL_C VOID ChangeFindSP(INT dir) + { + FindSP+=dir; + if (FindSP<0) + FindSP=5; + else if (FindSP>5) + FindSP=0; + if (hEBSetText(edit[2],&FindStack[FindSP][1],FindStack[FindSP][0])) + return; + hEBSetSelect(edit[2],0,FindStack[FindSP][0]); + } + +LOCAL_C VOID MainLoop(VOID) + { + INT ret; + WMSG_KEY key; + + FOREVER + { + uGetKey(&key); + if (key.keycode&W_SPECIAL_KEY) + TryExecuteCommand(key.keycode&(~W_SPECIAL_KEY)); + else + { + switch (key.keycode) + { + case W_KEY_MENU: + if (key.modifiers&W_CTRL_MODIFIER) + ToggleStatusWindow(); + else + { + ret=uPresentMenus(); + if (ret>0) + TryExecuteCommand(ret); + } + break; + case W_KEY_TAB: + RotateFocus(key.modifiers&W_SHIFT_MODIFIER); + break; + case W_KEY_RETURN: + if (!emph) + { + RotateTo(1); + break; + } + default: + if (emph==2) + { + if (key.keycode==W_KEY_RETURN) + { + ToFindStack(); + QuickSearch(key.modifiers&W_SHIFT_MODIFIER? -1: +1); + break; + } + else if (key.keycode==W_KEY_UP) + { + ToFindStack(); + ChangeFindSP(-1); + break; + } + else if (key.keycode==W_KEY_DOWN || key.keycode==W_KEY_ESCAPE) + { + ToFindStack(); + ChangeFindSP(+1); + break; + } + } + hEBHandleKey(edit[emph],key.keycode,key.modifiers); + } + } + } + } + +LOCAL_C VOID OpenEditors(VOID) + { + H_EDIT_BOX heb; + + heb.win=MainWid; + heb.maxchars=40; + heb.vulen=177-8; + heb.pos.x=5+8; + heb.pos.y=2; + heb.font=0x4001; + heb.style=0; + edit[0]=hEBOpen(H_EDIT_BOX_FONT,&heb); + heb.maxchars=256; + heb.vulen=177; + heb.vislines=4; + heb.pos.x=5; + heb.pos.y=19; + edit[1]=hEBOpen(H_EDIT_BOX_VISLINES| + H_EDIT_BOX_LEFT_CURSOR|H_EDIT_BOX_CLIPBOARD,&heb); + heb.maxchars=20; + heb.vulen=177-32-30; + heb.pos.x=5+32; + heb.pos.y=67; + edit[2]=hEBOpen(0,&heb); + } + +LOCAL_C VOID SmallScreen(VOID) + { + if (ResizeWidth(189)) + p_exit(0); + } + +LOCAL_C VOID CreateGC(VOID) + { + INT hgc; + + hgc=gCreateGC0(MainWid); + if (hgc<0) + p_exit(hgc); + } + +LOCAL_C VOID SpecificInit(VOID) + { + uEscape(FALSE); + MainWid=uFindMainWid(); + CreateGC(); + hCrackCommandLine(); + SmallScreen(); + OpenEditors(); + DrawBorders(); + wsEnable(); + } + +GLDEF_C VOID main(VOID) + { + uCommonInit(); + SpecificInit(); + MainLoop(); + } diff --git a/code/SIBOSDK/hwdemo/notes.ms b/code/SIBOSDK/hwdemo/notes.ms new file mode 100644 index 0000000..80e8176 --- /dev/null +++ b/code/SIBOSDK/hwdemo/notes.ms @@ -0,0 +1,3 @@ +Notes + +4000 diff --git a/code/SIBOSDK/hwdemo/notes.pic b/code/SIBOSDK/hwdemo/notes.pic new file mode 100644 index 0000000..63d830f Binary files /dev/null and b/code/SIBOSDK/hwdemo/notes.pic differ diff --git a/code/SIBOSDK/hwdemo/notes.rsc b/code/SIBOSDK/hwdemo/notes.rsc new file mode 100644 index 0000000..e69de29 diff --git a/code/SIBOSDK/hwdemo/notes.shd b/code/SIBOSDK/hwdemo/notes.shd new file mode 100644 index 0000000..dbd95a9 Binary files /dev/null and b/code/SIBOSDK/hwdemo/notes.shd differ diff --git a/code/SIBOSDK/hwdemo/qu1.c b/code/SIBOSDK/hwdemo/qu1.c new file mode 100644 index 0000000..ccfcb5a --- /dev/null +++ b/code/SIBOSDK/hwdemo/qu1.c @@ -0,0 +1,18 @@ +/* + QU1.C +*/ + +#include +#include +#include + +GLDEF_C VOID main(VOID) + { + WMSG_KEY key; + + uCommonInit(); + wSetBusyMsg("Hello world",W_CORNER_BOTTOM_LEFT); + uGetKey(&key); + uGetKey(&key); + p_exit(0); + } diff --git a/code/SIBOSDK/hwdemo/qu2.c b/code/SIBOSDK/hwdemo/qu2.c new file mode 100644 index 0000000..8c8b98a --- /dev/null +++ b/code/SIBOSDK/hwdemo/qu2.c @@ -0,0 +1,32 @@ +/* + QU2.C +*/ + +#include +#include +#include + +LOCAL_C VOID CreateGC(VOID) + { + INT hgc; + + hgc=gCreateGC0(uFindMainWid()); + if (hgc<0) + p_exit(hgc); + } + +GLDEF_C VOID main(VOID) + { + WMSG_KEY key; + + uCommonInit(); + CreateGC(); + gBorder(W_BORD_CORNER_4); + wSetBusyMsg("Hello world",W_CORNER_BOTTOM_LEFT); + FOREVER + { + uGetKey(&key); + if (key.keycode==(W_SPECIAL_KEY|'x')) + p_exit(0); + } + } diff --git a/code/SIBOSDK/hwdemo/qu3.c b/code/SIBOSDK/hwdemo/qu3.c new file mode 100644 index 0000000..d5dab36 --- /dev/null +++ b/code/SIBOSDK/hwdemo/qu3.c @@ -0,0 +1,120 @@ +/* + QU3.C +*/ + +#include +#include +#include + + +LOCAL_D TEXT *cmds[]= + { + "iInches/Centimetres", + "mMiles/Kilometres", + "lPounds/Kilogrammes", + "pPints/Litres", + "fFahrenheit/Centigrade", + "dDay of week", + "cCombinations", + "tTime difference", + "hHoroscope", + "nNow", + "wPassword", + "eEncrypt", + "uDecrypt", + "sSignificance", + "zFile size", + "xExit", + NULL + }; + +LOCAL_D H_MENU_DATA mdata[]= + { + "Conversions",5, + "Calendar",5, + "Secret",3, + "Special",3, + NULL + }; + +GLDEF_D TEXT ** _cmds=(&cmds[0]); +GLDEF_D H_MENU_DATA * _mdata=(&mdata[0]); + + +LOCAL_D UINT MainWid; + +LOCAL_C VOID ManageCommand(INT keycode) + { + INT index; + TEXT buf[40]; + + switch (keycode) + { + case 'x': + p_exit(0); + default: + index=uLocateCommand(keycode); + if (index>=0) + { + p_atos(&buf[0],"You chose `%s'",cmds[index]+1); + wInfoMsg(&buf[0]); + } + } + } + +LOCAL_C VOID MainLoop(VOID) + { + INT ret; + WMSG_KEY key; + + FOREVER + { + uGetKey(&key); + if (key.keycode&W_SPECIAL_KEY) + ManageCommand(key.keycode&(~W_SPECIAL_KEY)); + else if (key.keycode==W_KEY_MENU && !(key.modifiers&W_CTRL_MODIFIER)) + { + ret=uPresentMenus(); + if (ret>0) + ManageCommand(ret); + } + } + } + +LOCAL_C VOID ReduceScreenSize(VOID) + { + W_WINDATA wd; + + wd.extent.tl.x=wd.extent.tl.y=0; + wd.extent.width=189; + wd.extent.height=80; + wSetWindow(MainWid,W_WIN_EXTENT,&wd); + if (uErrorValue(wCheckPoint())) + p_exit(0); + } + +LOCAL_C VOID CreateGC(VOID) + { + INT hgc; + + hgc=gCreateGC0(MainWid); + if (hgc<0) + p_exit(hgc); + } + +LOCAL_C VOID SpecificInit(VOID) + { + MainWid=uFindMainWid(); + ReduceScreenSize(); + CreateGC(); + gBorder(W_BORD_CORNER_4); + wsEnable(); + wInfoMsg("Hello world"); + } + +GLDEF_C VOID main(VOID) + { + uCommonInit(); + SpecificInit(); + MainLoop(); + } diff --git a/code/SIBOSDK/hwdemo/qu4.afl b/code/SIBOSDK/hwdemo/qu4.afl new file mode 100644 index 0000000..3336f13 --- /dev/null +++ b/code/SIBOSDK/hwdemo/qu4.afl @@ -0,0 +1 @@ +query.pic diff --git a/code/SIBOSDK/hwdemo/qu4.c b/code/SIBOSDK/hwdemo/qu4.c new file mode 100644 index 0000000..eb942b9 --- /dev/null +++ b/code/SIBOSDK/hwdemo/qu4.c @@ -0,0 +1,250 @@ +/* + QU4.C +*/ + +#include +#include +#include +#include +#include + + +LOCAL_D TEXT *cmds[]= + { + "iInches/Centimetres", + "mMiles/Kilometres", + "lPounds/Kilogrammes", + "pPints/Litres", + "fFahrenheit/Centigrade", + "dDay of week", + "cCombinations", + "tTime difference", + "hHoroscope", + "nNow", + "wPassword", + "eEncrypt", + "uDecrypt", + "sSignificance", + "zFile size", + "xExit", + NULL + }; + +LOCAL_D H_MENU_DATA mdata[]= + { + "Conversions",5, + "Calendar",5, + "Secret",3, + "Special",3, + NULL + }; + +GLDEF_D TEXT ** _cmds=(&cmds[0]); +GLDEF_D H_MENU_DATA * _mdata=(&mdata[0]); + + +LOCAL_D UINT MainWid; + +LOCAL_D VOID *ttH; +LOCAL_D UWORD ttMonth=1; +LOCAL_D UWORD ttSuffix=1; +LOCAL_D UWORD ttDay=1; +LOCAL_D UWORD ttCentury=2; +LOCAL_D UWORD ttSeconds=2; + + +LOCAL_C INT AddNoYesChoiceList(TEXT *pmt,UWORD *pval) + { + return(uAddChoiceList(pmt,pval,"No","Yes",NULL)); + } + +LOCAL_C VOID TimeNow(VOID) + { + INT values; + H_DI_TEXT txt; + TEXT buf[48]; + + txt.str=(&buf[0]); + do + { + if (uOpenDialog(NULL)) + return; + uZTStoBCS(&buf[0],"Time is now"); + txt.type=H_DTEXT_ALIGN_CENTRE; + if (uAddDialogItem(H_DIALOG_TEXT,NULL,&txt)) + return; + values=0; + if (ttMonth==2) + values=H_TIME_FORMAT_MONTH_NAME; + if (ttDay==2) + values|=H_TIME_FORMAT_DAY_NAME; + if (ttSuffix==2) + values|=H_TIME_FORMAT_SUFFIX; + if (ttCentury==1) + values|=H_TIME_FORMAT_NO_CENTURY; + if (ttSeconds==1) + values|=H_TIME_FORMAT_NO_SECONDS; + hTTSetFormat(ttH,values); + hTTSetTime(ttH,H_TIME_SET_NOW,NULL); + buf[0]=hTTSenseString(ttH,H_TIME_SENSE_BOTH,&buf[1]); + txt.type=H_DTEXT_ALIGN_CENTRE|H_DTEXT_UNDERLINE; + if (uAddDialogItem(H_DIALOG_TEXT,NULL,&txt)) + return; + if (AddNoYesChoiceList("Give month name",&ttMonth)) + return; + if (AddNoYesChoiceList("Give day name",&ttDay)) + return; + if (AddNoYesChoiceList("Use date suffix",&ttSuffix)) + return; + if (AddNoYesChoiceList("Show century",&ttCentury)) + return; + if (AddNoYesChoiceList("Show seconds",&ttSeconds)) + return; + } while (uRunDialog()>0); + } + +LOCAL_C VOID SetUpDiDate(H_DI_DATE *pdate,P_DAYSEC *pds) + { + ULONG sdate; + + sdate=p_date(); + p_sttods(&sdate,pds); + pdate->value=(&pds->day); + pdate->low=0; + pdate->high=H_LAST_DAY; + } + +LOCAL_C VOID DayOfWeek(VOID) + { + P_DAYSEC ds; + H_DI_DATE date; + TEXT buf[40]; + H_DI_TEXT txt; + + SetUpDiDate(&date,&ds); + do + { + p_nmday(&buf[1],p_wkday(ds.day)); + buf[0]=p_slen(&buf[1]); + txt.str=(&buf[0]); + txt.type=H_DTEXT_ALIGN_LEFT; + if (uOpenDialog("Find day of week")) + return; + if (uAddDialogItem(H_DIALOG_DATE,"Date",&date)) + return; + if (uAddDialogItem(H_DIALOG_TEXT,"Day of week",&txt)) + return; + } while (uRunDialog()>0); + } + +LOCAL_C VOID FileSize(VOID) + { + TEXT fname[P_FNAMESIZE+2]; + H_DI_FSEL fsel; + P_INFO info; + TEXT buf[30]; + + fname[0]=0; + fsel.fname=(&fname[0]); + fsel.flags=H_FILE_PICK_SELECTOR; + FOREVER + { + if (uOpenDialog("Find file size")) + return; + if (uAddDialogItem(H_DIALOG_FSEL,"File:",&fsel)) + return; + if (uRunDialog()<=0) + return; + fname[1+fname[0]]=0; + if (!uErrorValue(p_finfo(&fname[1],&info))) + { + p_atos(&buf[0],"File size is %lu bytes",info.size); + wInfoMsg(&buf[0]); + } + } + } + +LOCAL_C VOID ManageCommand(INT keycode) + { + INT index; + TEXT buf[40]; + + switch (keycode) + { + case 'd': + DayOfWeek(); + break; + case 'n': + TimeNow(); + break; + case 'z': + FileSize(); + break; + case 'x': + p_exit(0); + default: + index=uLocateCommand(keycode); + if (index>=0) + { + p_atos(&buf[0],"You chose `%s'",cmds[index]+1); + wInfoMsg(&buf[0]); + } + } + } + +LOCAL_C VOID MainLoop(VOID) + { + INT ret; + WMSG_KEY key; + + FOREVER + { + uGetKey(&key); + if (key.keycode&W_SPECIAL_KEY) + ManageCommand(key.keycode&(~W_SPECIAL_KEY)); + else if (key.keycode==W_KEY_MENU && !(key.modifiers&W_CTRL_MODIFIER)) + { + ret=uPresentMenus(); + if (ret>0) + ManageCommand(ret); + } + } + } + +LOCAL_C VOID ReduceScreenSize(VOID) + { + W_WINDATA wd; + + wd.extent.tl.x=wd.extent.tl.y=0; + wd.extent.width=189; + wd.extent.height=80; + wSetWindow(MainWid,W_WIN_EXTENT,&wd); + if (uErrorValue(wCheckPoint())) + p_exit(0); + } + +LOCAL_C VOID CreateGC(VOID) + { + INT hgc; + + hgc=gCreateGC0(MainWid); + if (hgc<0) + p_exit(hgc); + } + +LOCAL_C VOID SpecificInit(VOID) + { + MainWid=uFindMainWid(); + ReduceScreenSize(); + CreateGC(); + gBorder(W_BORD_CORNER_4); + wsEnable(); + ttH=hTTOpen(); + } + +GLDEF_C VOID main(VOID) + { + uCommonInit(); + SpecificInit(); + MainLoop(); + } diff --git a/code/SIBOSDK/hwdemo/query.afl b/code/SIBOSDK/hwdemo/query.afl new file mode 100644 index 0000000..45e3789 --- /dev/null +++ b/code/SIBOSDK/hwdemo/query.afl @@ -0,0 +1,3 @@ +query.pic +query.rsc +query.shd diff --git a/code/SIBOSDK/hwdemo/query.c b/code/SIBOSDK/hwdemo/query.c new file mode 100644 index 0000000..995f400 --- /dev/null +++ b/code/SIBOSDK/hwdemo/query.c @@ -0,0 +1,796 @@ +/* + QUERY.C + +Written by DavidW +Started on 28/11/91 + +*/ + +#include +#include +#include +#include +#include +#include +#include + + +LOCAL_D TEXT *cmds[]= + { + "iInches/Centimetres", + "mMiles/Kilometres", + "lPounds/Kilogrammes", + "pPints/Litres", + "fFahrenheit/Centigrade", + "dDay of week", + "cCombinations", + "tTime difference", + "hHoroscope", + "nNow", + "wPassword", + "eEncrypt", + "uDecrypt", + "sSignificance", + "zFile size", + "xExit", + NULL + }; + +#define CONVERT_ITEMS 5 +#define CALENDAR_ITEMS 5 +#define SECRET_ITEMS 3 +#define SPECIAL_ITEMS 3 + +#define ITEMS_BEFORE_CONVERT 0 +#define ITEMS_BEFORE_CALENDAR CONVERT_ITEMS +#define ITEMS_BEFORE_SECRET (ITEMS_BEFORE_CALENDAR+CALENDAR_ITEMS) +#define ITEMS_BEFORE_SPECIAL (ITEMS_BEFORE_SECRET+SECRET_ITEMS) + +LOCAL_D H_MENU_DATA mdata[]= + { + "Conversions",CONVERT_ITEMS, + "Calendar",CALENDAR_ITEMS, + "Secret",SECRET_ITEMS, + "Special",SPECIAL_ITEMS, + NULL + }; + +GLDEF_D TEXT ** _cmds=(&cmds[0]); +GLDEF_D H_MENU_DATA * _mdata=(&mdata[0]); + + +LOCAL_D UINT MainWid; + +LOCAL_D WORD ndp=2; +LOCAL_D DOUBLE small; +LOCAL_D DOUBLE vsmall; + +LOCAL_D TEXT pass[10]; + +LOCAL_D VOID *ttH; +LOCAL_D UWORD ttMonth=1; +LOCAL_D UWORD ttSuffix=1; +LOCAL_D UWORD ttDay=1; +LOCAL_D UWORD ttCentury=2; +LOCAL_D UWORD ttSeconds=2; + + +LOCAL_C VOID CalcSmall(VOID) + { + DOUBLE dndp; + DOUBLE ten; + + dndp=(-ndp); + ten=10; + p_pow(&small,&ten,&dndp); + vsmall=small/2; + } + +LOCAL_C VOID Clip(DOUBLE *pval) + { + DOUBLE remain; + + if (*pval>=0) + (*pval)+=vsmall; + else + (*pval)-=vsmall; + p_mod(&remain,pval,&small); + (*pval)-=remain; + } + +LOCAL_C VOID Temperatures(VOID) + { + DOUBLE fahr; + DOUBLE cent; + H_DI_FLOAT ffahr; + H_DI_FLOAT fcent; + INT index; + + fahr=32; + cent=0; + ffahr.value=(&fahr); + ffahr.low=(-17968); + ffahr.high=18032; + fcent.value=(¢); + fcent.low=(-10000); + fcent.high=10000; + FOREVER + { + if (uOpenDialog("Convert temperature")) + return; + if (uAddDialogItem(H_DIALOG_FLOAT,"Fahrenheit",&ffahr)) + return; + if (uAddDialogItem(H_DIALOG_FLOAT,"Centigrade",&fcent)) + return; + index=uRunDialog(); + if (index<=0) + break; + if (index==2) + { + cent=(fahr-32)*5/9; + Clip(¢); + } + else + { + fahr=32+cent*9/5; + Clip(&fahr); + } + } + } + +LOCAL_C VOID Convert(TEXT *pmt1,TEXT *pmt2,INT high1,INT high2) + { + DOUBLE val1; + DOUBLE val2; + H_DI_FLOAT fled1; + H_DI_FLOAT fled2; + INT index; + DOUBLE ratio; + + val1=0; + val2=0; + fled1.value=(&val1); + fled1.low=0; + fled1.high=high1; + fled2.value=(&val2); + fled2.low=0; + fled2.high=high2; + ratio=fled2.high/fled1.high; + FOREVER + { + if (uOpenDialog("Convert")) + return; + if (uAddDialogItem(H_DIALOG_FLOAT,pmt1,&fled1)) + return; + if (uAddDialogItem(H_DIALOG_FLOAT,pmt2,&fled2)) + return; + index=uRunDialog(); + if (index<=0) + break; + if (index==2) + { + val2=val1*ratio; + Clip(&val2); + } + else + { + val1=val2/ratio; + Clip(&val1); + } + } + } + +LOCAL_C VOID InchAndCm(VOID) + { + Convert("Inches","Centimetres",10000,25400); + } + +LOCAL_C VOID MileAndKm(VOID) + { + Convert("Miles","Kilometres",20000,32187); + } + +LOCAL_C VOID PoundAndKg(VOID) + { + Convert("Pounds","Kilograms",31938,14500); + } + +LOCAL_C VOID PintAndL(VOID) + { + Convert("Pints","Litres",28156,16000); + } + +LOCAL_C VOID ChangeNdp(VOID) + { + LONG lndp; + H_DI_NUMBER num; + + if (uOpenDialog("Level of significance")) + return; + lndp=ndp; + num.value=(&lndp); + num.low=0; + num.high=4; + if (uAddDialogItem(H_DIALOG_NUMBER,"Decimal places",&num)) + return; + if (uRunDialog()<=0) + return; + ndp=(WORD)lndp; + CalcSmall(); + } + +LOCAL_C VOID SetUpDiDate(H_DI_DATE *pdate,P_DAYSEC *pds) + { + ULONG sdate; + + sdate=p_date(); + p_sttods(&sdate,pds); + pdate->value=(&pds->day); + pdate->low=0; + pdate->high=H_LAST_DAY; + } + +LOCAL_C VOID DayOfWeek(VOID) + { + P_DAYSEC ds; + H_DI_DATE date; + TEXT buf[40]; + H_DI_TEXT txt; + + SetUpDiDate(&date,&ds); + do + { + p_nmday(&buf[1],p_wkday(ds.day)); + buf[0]=p_slen(&buf[1]); + txt.str=(&buf[0]); + txt.type=H_DTEXT_ALIGN_LEFT; + if (uOpenDialog("Find day of week")) + return; + if (uAddDialogItem(H_DIALOG_DATE,"Date",&date)) + return; + if (uAddDialogItem(H_DIALOG_TEXT,"Day of week",&txt)) + return; + } while (uRunDialog()>0); + } + +LOCAL_D TEXT *orient[]= + { + "Rat","Cow","Tiger","Rabbit","Dragon","Snake", + "Horse","Sheep","Monkey","Rooster","Dog","Pig" + }; + +LOCAL_D TEXT *western[]= + { + "Capricorn","Aquarius","Pisces","Aries","Taurus","Gemini", + "Cancer","Leo","Virgo","Libra","Scorpio","Sagittarius" + }; + +LOCAL_C INT Zodiac(P_DATE *pdt) + { + INT ret; + LOCAL_D changeover[12]={19,18,19,19,20,20,22,22,22,22,21,20}; + + ret=pdt->month; + if (pdt->day>changeover[ret]) + { + if (ret++==11) + ret=0; + } + return(ret); + } + +LOCAL_C VOID Horoscope(VOID) + { + P_DAYSEC ds; + H_DI_DATE date; + P_DATE dt; + INT key; + TEXT buf[40]; + + SetUpDiDate(&date,&ds); + FOREVER + { + if (uOpenDialog("Horoscope")) + return; + if (uAddDialogItem(H_DIALOG_DATE,"Date of birth",&date)) + return; + if (uAddButtonList("Stop",W_KEY_ESCAPE, + "Western",'w',"Oriental",'o',NULL)) + return; + key=uRunDialog(); + if (key<=0) + return; + p_dstodt(&ds,&dt); + if (key=='o') + p_atos(&buf[0],"Oriental horoscope is %s",orient[dt.year%12]); + else + p_atos(&buf[0],"Western horoscope is %s",western[Zodiac(&dt)]); + wInfoMsg(&buf[0]); + } + } + +LOCAL_C INT AddListOfDays(UWORD *pdiw) + { + H_DI_CHOICE ch; + TEXT nam[32]; + INT i; + + if (uBeginDCL(&ch)) + return(-1); + for (i=0; i<7; i++) + { + p_nmday(&nam[0],i); + if (uGrowDCL(&ch,&nam[0])) + return(-1); + } + return(uAddDCL("Day in week",pdiw,&ch)); + } + +LOCAL_C VOID Combinations(VOID) + { + P_DAYSEC ds; + H_DI_DATE date; + P_DATE dt; + INT key; + UWORD diw; + LONG dim; + H_DI_NUMBER num; + INT diff; + ULONG reset; + INT inc; + + SetUpDiDate(&date,&ds); + p_dstodt(&ds,&dt); + diw=p_wkday(ds.day)+1; + dim=dt.day+1; + num.value=(&dim); + num.low=1; + num.high=31; + FOREVER + { + if (uOpenDialog("Find date combinations")) + return; + if (AddListOfDays(&diw)) + return; + if (uAddDialogItem(H_DIALOG_NUMBER,"Day in month",&num)) + return; + if (uAddDialogItem(H_DIALOG_DATE,"Found date",&date)) + return; + if (uAddButtonList("Stop",W_KEY_ESCAPE,"Backwards",W_KEY_MENU, + "Forwards",W_KEY_RETURN,0)) + return; + key=uRunDialog(); + if (key<=0) + return; + reset=ds.day; + diff=diw-p_wkday(ds.day)-1; + if (key==W_KEY_RETURN) + { + if (diff<=0) + diff+=7; + inc=7; + } + else + { + if (diff>=0) + diff-=7; + inc=(-7); + } + ds.day+=diff; + dim-=1; + FOREVER + { + if (ds.day>H_LAST_DAY) + { + wInfoMsg("No further matches"); + ds.day=reset; + break; + } + p_dstodt(&ds,&dt); + if (dt.day==dim) + break; + ds.day+=inc; + } + dim+=1; + } + } + +LOCAL_C VOID SetUpTime(H_DI_TIME *ptime,P_DAYSEC *pds) + { + ptime->value=(&pds->sec); + ptime->low=0; + ptime->high=P_NSECDAY-1; + ptime->type=H_DTIME_SHOW_SECONDS; + } + +LOCAL_C VOID TimeDifference(VOID) + { + P_DAYSEC ds1; + H_DI_DATE date1; + H_DI_TIME time1; + P_DAYSEC ds2; + H_DI_DATE date2; + H_DI_TIME time2; + LONG diff; + TEXT buf[40]; + + SetUpDiDate(&date1,&ds1); + SetUpDiDate(&date2,&ds2); + SetUpTime(&time1,&ds1); + SetUpTime(&time2,&ds2); + FOREVER + { + if (uOpenDialog("Time difference")) + return; + if (uAddDialogItem(H_DIALOG_DATE,"From",&date1)) + return; + if (uAddDialogItem(H_DIALOG_TIME,"",&time1)) + return; + if (uAddDialogItem(H_DIALOG_DATE,"To",&date2)) + return; + if (uAddDialogItem(H_DIALOG_TIME,"",&time2)) + return; + if (uRunDialog()<=0) + return; + diff=ds2.day-ds1.day; + if (diff<0 || !diff && ds2.sec0x7fffffffl/P_NSECDAY) + { + wInfoMsg("Dates are too far apart"); + continue; + } + p_atos(&buf[0],"Dates are %ld seconds apart", + diff*P_NSECDAY+ds2.sec-ds1.sec); + wInfoMsg(&buf[0]); + } + } + +LOCAL_C INT AddNoYesChoiceList(TEXT *pmt,UWORD *pval) + { + return(uAddChoiceList(pmt,pval,"No","Yes",NULL)); + } + +LOCAL_C VOID TimeNow(VOID) + { + INT values; + H_DI_TEXT txt; + TEXT buf[48]; + + txt.str=(&buf[0]); + do + { + if (uOpenDialog(NULL)) + return; + uZTStoBCS(&buf[0],"Time is now"); + txt.type=H_DTEXT_ALIGN_CENTRE; + if (uAddDialogItem(H_DIALOG_TEXT,NULL,&txt)) + return; + values=0; + if (ttMonth==2) + values=H_TIME_FORMAT_MONTH_NAME; + if (ttDay==2) + values|=H_TIME_FORMAT_DAY_NAME; + if (ttSuffix==2) + values|=H_TIME_FORMAT_SUFFIX; + if (ttCentury==1) + values|=H_TIME_FORMAT_NO_CENTURY; + if (ttSeconds==1) + values|=H_TIME_FORMAT_NO_SECONDS; + hTTSetFormat(ttH,values); + hTTSetTime(ttH,H_TIME_SET_NOW,NULL); + buf[0]=hTTSenseString(ttH,H_TIME_SENSE_BOTH,&buf[1]); + txt.type=H_DTEXT_ALIGN_CENTRE|H_DTEXT_UNDERLINE; + if (uAddDialogItem(H_DIALOG_TEXT,NULL,&txt)) + return; + if (AddNoYesChoiceList("Give month name",&ttMonth)) + return; + if (AddNoYesChoiceList("Give day name",&ttDay)) + return; + if (AddNoYesChoiceList("Use date suffix",&ttSuffix)) + return; + if (AddNoYesChoiceList("Show century",&ttCentury)) + return; + if (AddNoYesChoiceList("Show seconds",&ttSeconds)) + return; + } while (uRunDialog()>0); + } + +LOCAL_C VOID EnterPassword(VOID) + { + TEXT pass1[10]; + TEXT pass2[10]; + H_DI_XINPUT x1; + H_DI_XINPUT x2; + + x1.str=(&pass1[0]); + x2.str=(&pass2[0]); + FOREVER + { + if (uOpenDialog(NULL)) + return; + if (uAddDialogItem(H_DIALOG_XINPUT,"Define password",&x1)) + return; + if (uAddDialogItem(H_DIALOG_XINPUT,"Confirm password",&x2)) + return; + if (uRunDialog()<=0) + return; + if (p_bcmpi(&pass1[1],pass1[0],&pass2[1],pass2[0])) + { + wInfoMsg("Password not confirmed"); + continue; + } + if (pass1[0]) + break; + wInfoMsg("Please supply password"); + } + p_bfil(&pass[0],10,0); + p_bcpy(&pass[0],&pass1[0],pass1[0]+1); + } + +LOCAL_C VOID MakeReadable(TEXT *out,TEXT *in) + { + INT len; + INT i; + INT val; + + i=32; + len=(*in++); + *out++=len*2; + while (len--) + { + val=(*in++); + *out++=i+(val&0xf); + i+=16; + *out++=i+(val>>4); + if (i==112) + i=32; + else + i+=16; + } + } + +LOCAL_C VOID MakeUnreadable(TEXT *out,TEXT *in) + { + INT len; + INT i; + INT val; + + i=32; + len=(*in++)/2; + *out++=len; + while (len--) + { + val=(*in++)-i; + i+=16; + val+=((*in++)-i)<<4; + *out++=val; + if (i==112) + i=32; + else + i+=16; + } + } + +LOCAL_C VOID Report(TEXT *title,TEXT *mess) + { + H_DI_TEXT txt; + + if (uOpenDialog(title)) + return; + txt.str=mess; + txt.type=H_DTEXT_ALIGN_CENTRE; + if (uAddDialogItem(H_DIALOG_TEXT,NULL,&txt)) + return; + uRunDialog(); + } + +LOCAL_C VOID EncryptMessage(VOID) + { + P_MASK mask; + H_DI_EDIT ed; + TEXT in[20]; + TEXT out[38]; + + if (!pass[0]) + { + wInfoMsg("Can't encrypt with no password set"); + return; + } + p_setmask((VOID **)&mask,&pass[1]); /** bug in prototype **/ + if (uOpenDialog("Encrypt message")) + return; + ed.str=(&in[0]); + ed.len=18; + in[0]=0; + if (uAddDialogItem(H_DIALOG_EDIT,"Message",&ed)) + return; + if (uRunDialog()<=0) + return; + p_encrypt(&mask,&in[1],in[0]); + MakeReadable(&out[0],&in[0]); + Report("Encrypted message",&out[0]); + } + +LOCAL_C VOID DecryptMessage(VOID) + { + P_MASK mask; + H_DI_SEDIT sed; + TEXT in[38]; + TEXT out[20]; + + if (!pass[0]) + { + wInfoMsg("Can't decrypt with no password set"); + return; + } + p_setmask((VOID **)&mask,&pass[1]); + if (uOpenDialog("Decrypt message")) + return; + sed.str=(&in[0]); + sed.len=36; + sed.width=16; + in[0]=0; + if (uAddDialogItem(H_DIALOG_SEDIT,"Message",&sed)) + return; + if (uRunDialog()<=0) + return; + MakeUnreadable(&out[0],&in[0]); + p_decrypt(&mask,&out[1],out[0]); + Report("Decrypted message",&out[0]); + } + +LOCAL_C VOID FileSize(VOID) + { + TEXT fname[P_FNAMESIZE+2]; + H_DI_FSEL fsel; + P_INFO info; + TEXT buf[30]; + + fname[0]=0; + fsel.fname=(&fname[0]); + fsel.flags=H_FILE_PICK_SELECTOR; + FOREVER + { + if (uOpenDialog("Find file size")) + return; + if (uAddDialogItem(H_DIALOG_FSEL,"File:",&fsel)) + return; + if (uRunDialog()<=0) + return; + fname[1+fname[0]]=0; + if (!uErrorValue(p_finfo(&fname[1],&info))) + { + p_atos(&buf[0],"File size is %lu bytes",info.size); + wInfoMsg(&buf[0]); + } + } + } + +LOCAL_C VOID ManageCommand(INT index) + { + switch (index) + { + case ITEMS_BEFORE_CONVERT: + InchAndCm(); + break; + case ITEMS_BEFORE_CONVERT+1: + MileAndKm(); + break; + case ITEMS_BEFORE_CONVERT+2: + PoundAndKg(); + break; + case ITEMS_BEFORE_CONVERT+3: + PintAndL(); + break; + case ITEMS_BEFORE_CONVERT+4: + Temperatures(); + break; + case ITEMS_BEFORE_CALENDAR: + DayOfWeek(); + break; + case ITEMS_BEFORE_CALENDAR+1: + Combinations(); + break; + case ITEMS_BEFORE_CALENDAR+2: + TimeDifference(); + break; + case ITEMS_BEFORE_CALENDAR+3: + Horoscope(); + break; + case ITEMS_BEFORE_CALENDAR+4: + TimeNow(); + break; + case ITEMS_BEFORE_SECRET: + EnterPassword(); + break; + case ITEMS_BEFORE_SECRET+1: + EncryptMessage(); + break; + case ITEMS_BEFORE_SECRET+2: + DecryptMessage(); + break; + case ITEMS_BEFORE_SPECIAL: + ChangeNdp(); + break; + case ITEMS_BEFORE_SPECIAL+1: + FileSize(); + break; + case ITEMS_BEFORE_SPECIAL+2: + p_exit(0); + } + } + +LOCAL_C VOID TryExecuteCommand(INT keycode) + { + keycode=uLocateCommand(keycode); + if (keycode>=0) + ManageCommand(keycode); + } + +LOCAL_C VOID MainLoop(VOID) + { + INT ret; + WMSG_KEY key; + + FOREVER + { + uGetKey(&key); + if (key.keycode&W_EVENT_KEY) + { + if (key.keycode==CONS_EVENT_COMMAND) + p_exit(0); + } + else if (key.keycode&W_SPECIAL_KEY) + TryExecuteCommand(key.keycode&(~W_SPECIAL_KEY)); + else if (key.keycode==W_KEY_MENU && !(key.modifiers&W_CTRL_MODIFIER)) + { + ret=uPresentMenus(); + if (ret>0) + TryExecuteCommand(ret); + } + } + } + +LOCAL_C VOID ReduceScreenSize(VOID) + { + W_WINDATA wd; + + wd.extent.tl.x=wd.extent.tl.y=0; + wd.extent.width=189; + wd.extent.height=80; + wSetWindow(MainWid,W_WIN_EXTENT,&wd); + if (uErrorValue(wCheckPoint())) + p_exit(0); + } + +LOCAL_C VOID CreateGC(VOID) + { + INT hgc; + + hgc=gCreateGC0(MainWid); + if (hgc<0) + p_exit(hgc); + } + +LOCAL_C VOID SpecificInit(VOID) + { + hCrackCommandLine(); + MainWid=uFindMainWid(); + ReduceScreenSize(); + CreateGC(); + gBorder(W_BORD_CORNER_4); + wsEnable(); + CalcSmall(); + ttH=hTTOpen(); + } + +GLDEF_C VOID main(VOID) + { + uCommonInit(); + SpecificInit(); + MainLoop(); + } diff --git a/code/SIBOSDK/hwdemo/query.ms b/code/SIBOSDK/hwdemo/query.ms new file mode 100644 index 0000000..900368a --- /dev/null +++ b/code/SIBOSDK/hwdemo/query.ms @@ -0,0 +1 @@ +Query diff --git a/code/SIBOSDK/hwdemo/query.pic b/code/SIBOSDK/hwdemo/query.pic new file mode 100644 index 0000000..8ab3856 Binary files /dev/null and b/code/SIBOSDK/hwdemo/query.pic differ diff --git a/code/SIBOSDK/hwdemo/query.rsc b/code/SIBOSDK/hwdemo/query.rsc new file mode 100644 index 0000000..e69de29 diff --git a/code/SIBOSDK/hwdemo/query.shd b/code/SIBOSDK/hwdemo/query.shd new file mode 100644 index 0000000..97e58fc Binary files /dev/null and b/code/SIBOSDK/hwdemo/query.shd differ diff --git a/code/SIBOSDK/hwdemo/remind.afl b/code/SIBOSDK/hwdemo/remind.afl new file mode 100644 index 0000000..8841d6e --- /dev/null +++ b/code/SIBOSDK/hwdemo/remind.afl @@ -0,0 +1,3 @@ +remind.pic +remind.rsc +remind.shd diff --git a/code/SIBOSDK/hwdemo/remind.c b/code/SIBOSDK/hwdemo/remind.c new file mode 100644 index 0000000..c6bcaba --- /dev/null +++ b/code/SIBOSDK/hwdemo/remind.c @@ -0,0 +1,875 @@ +/* + REMIND.C + +Written by DavidW +Started on 6/12/91 +Resource file version 1/11/92 +*/ + +#include /* basic Psion header file */ +#include /* defines object oriented functions */ +#include /* defines E_GEN_ error values, etc */ +#include /* defines E_FILE_ error values, etc */ +#include /* defines date and time functions */ +#include /* defines C_RSCFILE and related constants */ +#include /* defines all Window Server library functions */ +#include /* defines all Hwif Library functions */ +#include "remind.rh" /* definitions common to remind.rss & remind.c */ +#include "remind.rsg" /* GENERATED resource file header */ + +GLREF_D VOID *DatCommandPtr; /* where run from */ + +GLDEF_D TEXT ** _cmds; /* for menu commands */ +GLDEF_D H_MENU_DATA * _mdata; /* for menu titles */ + +LOCAL_C VOID *rcb; /* resource file object handle */ +LOCAL_D UINT MainWid; /* ID of main window */ + +typedef struct + { + ULONG sdate; /* date when reminder due */ + UBYTE ref; /* TRUE iff this is the reminder queued to ALM: */ + UBYTE tlen; /* length of text message */ + TEXT *pb; /* the text message itself (another alloc cell) */ + } ENTRY; /* represents one reminder */ + +LOCAL_D ENTRY table[500]; /* handle up to 500 reminders */ +LOCAL_D UWORD nent=0; /* number of entries */ +LOCAL_D INT cent=0; /* entry at cursor */ +LOCAL_D INT tent=0; /* entry at top of screen */ + +LOCAL_D ENTRY clipent; /* entry in clipboard */ + +LOCAL_D UWORD show_statwin=FALSE; /* is Status Window showing */ +LOCAL_D UWORD ScreenWidth; /* width of remaining screen */ + +LOCAL_D UWORD lastbflags=W_BORD_CORNER_4; /* which kind of Border flags */ + +LOCAL_D VOID *ttH; /* handle of Time Text object */ + +LOCAL_D VOID *aH; /* handle of channel to ALM: alarm device */ +LOCAL_D WORD almstat; /* status word for ALM: services */ +LOCAL_D WORD almactive; /* active word for ALM: services */ + +LOCAL_D UWORD PrintRec; /* which entry is being printed */ +LOCAL_D UWORD PrintState; /* which part of entry is being printed */ +LOCAL_D TEXT PrintBuf[48]; /* holds text about to be printed */ + + +LOCAL_C VOID LoadStr(INT rid,TEXT *pb) + { /* load resource into given buffer (assumed long enough) */ + while (p_entersend4(rcb,O_RS_READ_BUF,rid,pb)<0) + hRequestReplacePack(rcb,DatCommandPtr); + } + +LOCAL_C TEXT *str(INT rid) + { /* load specified resource into scratch buffer and return address */ + LOCAL_D TEXT scratch[50]; /* static "scratch" buffer */ + + LoadStr(rid,&scratch[0]); + return(&scratch[0]); + } + +LOCAL_C INT cmp(INT r,VOID *pent) + { /* comparison function used in binary searching */ + return(table[r].sdate>(*(ULONG *)pent)? -1: 1); + } + +LOCAL_C INT LocateEntry(ULONG *psdate) + { /* find entry at (or nearest after) given date */ + INT dir; /* direction to nearest hit (as given by p_bsrch) */ + INT ret; /* nearest hit (as given by p_bsrch) */ + + dir=p_bsrch(nent,cmp,&ret,psdate); + if (dir>0) + ret++; + return(ret); + } + +LOCAL_C ENTRY *LocateRef(VOID) + { /* find the entry that was queued to ALM: */ + ENTRY *pent; + + pent=(&table[0]); + while (!pent->ref) + pent++; + return(pent); + } + +LOCAL_C VOID RequeueAlarm(VOID) + { /* recalculate the next alarm due, and queue it (if any) */ + ULONG sdate; /* current time and date */ + INT entno; /* no of entry to queue */ + ENTRY *pent; /* entry to queue */ + ULONG times[2]; /* needed for service to ALM: */ + TEXT buf[66]; /* needed for service to ALM: */ + + if (almactive) + { /* cancel any alarm currently queued */ + p_iow2(aH,P_FCANCEL); + p_waitstat(&almstat); + almactive=FALSE; + LocateRef()->ref=FALSE; + } + if (!nent) + return; /* no entries hence none to queue */ + sdate=p_date(); + entno=LocateEntry(&sdate); + if (entno>=nent) + return; /* no entries with dates in the future */ + pent=(&table[entno]); + *p_bcpy(&buf[0],pent->pb,pent->tlen)=0; /* copy the text */ + pent->ref=TRUE; /* mark this entry as the one queued */ + times[0]=pent->sdate; /* fill in the time the alarm is due */ + times[1]=pent->sdate; /* and the time to DISPLAY */ + p_ioc5(aH,P_FWRITE,&almstat,×,&buf); + almactive=TRUE; /* set active word TRUE */ + } + +LOCAL_C VOID UpdateTimeFormat(VOID) + { /* Update time-text object's record of time format */ + hTTSetFormat(ttH,H_TIME_FORMAT_NO_SECONDS|H_TIME_FORMAT_SUFFIX| + H_TIME_FORMAT_DAY_NAME|H_TIME_FORMAT_MONTH_NAME); + } + +LOCAL_C INT SdateToBuf(TEXT *pb,ULONG *psdate) + { /* convert time and date to text, as per system preferences */ + hTTSetTime(ttH,H_TIME_SET_SDATE,psdate); + return(hTTSenseString(ttH,H_TIME_SENSE_BOTH,pb)); + } + +LOCAL_C VOID SetGmode(INT gmode) + { /* set Gmode of current graphics context */ + G_GC gc; + + gc.gmode=gmode; + gSetGC(0,G_GC_MASK_GMODE,&gc); + } + +LOCAL_C VOID SetBold(INT flag) + { /* prepare to print in bold (if flag TRUE) or non-bold */ + G_GC gc; + + gc.font=WS_FONT_BASE+flag; + gSetGC(0,G_GC_MASK_FONT,&gc); + } + +LOCAL_C VOID GetCursorBox(INT i,P_RECT *pbox) + { /* where should the cursor be drawn */ + pbox->tl.x=4; + pbox->br.x=10; + pbox->tl.y=4+i*18; + pbox->br.y=pbox->tl.y+9; + } + +LOCAL_C VOID DrawCursor(INT i) + { /* draw the cursor (character octal 34) */ + P_RECT box; + + GetCursorBox(i,&box); + gPrintBoxText(&box,8,G_TEXT_ALIGN_LEFT,0,"\034",1); + } + +LOCAL_C VOID EraseCursor(INT i) + { /* remove the cursor (from the specified row) */ + P_RECT box; + + GetCursorBox(i,&box); + gClrRect(&box,G_TRMODE_CLR); /* clear all pixels in the rectangle */ + } + +LOCAL_C VOID LineToScreen(INT y,INT xoff,TEXT *pb,INT tlen) + { /* print the given line of text on the screen */ + P_RECT box; + + box.tl.x=4; + box.tl.y=4+y*9; + box.br.x=ScreenWidth-4; + box.br.y=box.tl.y+9; + gPrintBoxText(&box,8,G_TEXT_ALIGN_LEFT,xoff,pb,tlen); + } + +LOCAL_C VOID ClearLine(INT y) + { /* clear all text from the given line */ + LineToScreen(y,0,NULL,0); + } + +LOCAL_C VOID DrawLine(INT i) + { /* draw the two lines of text for the specified entry */ + INT len; + INT entno; + ENTRY *pent; + TEXT buf[48]; + + entno=i+tent; /* offset by no. of first on-screen entry */ + if (entno>=nent) + { /* no entry for this position - hence clear */ + ClearLine(i*2); + ClearLine(i*2+1); + } + else + { + pent=(&table[entno]); + SetBold(TRUE); /* draw the date and time in bold */ + len=SdateToBuf(&buf[0],&pent->sdate); + LineToScreen(i*2,10,&buf[0],len); + SetBold(FALSE); /* draw the text (and any cursor) in non-bold */ + if (entno==cent) + DrawCursor(i); + LineToScreen(i*2+1,22,pent->pb,pent->tlen); + } + } + +LOCAL_C VOID Display(VOID) + { /* draw all four entry slots on the screen */ + INT i; + + if (!nent) + { /* no entries set - so display text to this effect */ + SetBold(TRUE); + LineToScreen(0,10,str(STR_NO_REMINDERS_SET),16); + ClearLine(1); /* clear the line under the message */ + return; + } + for (i=0; i<4; i++) + DrawLine(i); + } + +LOCAL_C INT ResizeWidth(UWORD width) + { /* try to change the width of the main display region */ + INT ret; + W_WINDATA wd; + + wd.extent.tl.x=wd.extent.tl.y=0; + wd.extent.width=width; + wd.extent.height=80; + wSetWindow(MainWid,W_WIN_EXTENT,&wd); + ret=uErrorValue(wCheckPoint()); /* check whether successful */ + if (!ret) + ScreenWidth=width; /* only record new value if successful */ + return(ret); + } + +LOCAL_C INT ToggleStatusWindow(VOID) + { /* attempt to toggle the visibility of the status window */ + if (show_statwin) + { /* status window is currently showing */ + if (ResizeWidth(240)) + return(-1); + wsDisable(); /* remove status window */ + } + else + { /* status window not currently showing */ + if (ResizeWidth(189)) + return(-1); + wsEnable(); /* display status window */ + } + show_statwin^=TRUE; + gBorder(lastbflags); /* redraw the border */ + Display(); /* redraw the main display */ + return(0); + } + +LOCAL_C VOID EnsureGoodTent(VOID) + { /* find good value for tent - top entry on screen */ + if (nent<5) + tent=0; /* show ALL entries if less than five in total */ + else if (tentcent) + tent=cent; /* cursor was off top of screen */ + } + +LOCAL_C VOID AppendEntry(ENTRY *pent) + { /* add the given entry */ + INT tomove; + + if (!nent) + cent=0; + else + { /* find where to insert the entry */ + cent=LocateEntry(&pent->sdate); /* uses binary search */ + tomove=nent-cent; /* how many entries to "move along */ + p_bcpy(&table[cent+1],&table[cent],tomove*sizeof(ENTRY)); + } + nent++; /* increment count of number of entries */ + table[cent]=(*pent); /* copy the entry details into the table */ + EnsureGoodTent(); /* check whether need to scroll */ + Display(); /* redraw the main display */ + RequeueAlarm(); /* ensure correct alarm is queued */ + } + +LOCAL_C VOID DoDeleteEntry(VOID) + { /* delete the current entry */ + INT tomove; /* how many records to "move back" */ + + p_free(table[cent].pb); /* free alloc cell holding the text */ + nent--; /* decrement total count of entries */ + tomove=nent-cent; /* now fill up the gap in the table */ + p_bcpy(&table[cent],&table[cent+1],tomove*sizeof(ENTRY)); + } + +LOCAL_C VOID CleanEntry(ENTRY *pent) + { /* prepare a blank entry */ + p_bfil(pent,sizeof(ENTRY),0); + pent->sdate=p_date()+3600; /* seed to one hour in the future */ + } + +LOCAL_C INT EditEntry(ENTRY *pent) + { /* allow the user to edit an entry */ + P_DAYSEC ds; + H_DI_DATE date; + H_DI_TIME time; + TEXT buf[66]; + H_DI_SEDIT sed; + + if (uOpenDialog(str(STR_REMINDER))) /* title line of dialog */ + return(-1); + p_bcpy(&buf[1],pent->pb,buf[0]=pent->tlen); + sed.str=(&buf[0]); /* prepare to edit the text of the reminder */ + sed.len=64; /* maximum allowed length */ + sed.width=25; /* width of "viewing" region */ + if (uAddDialogItem(H_DIALOG_SEDIT,str(STR_MESSAGE),&sed)) + return(-1); + p_sttods(&pent->sdate,&ds); /* crack into "time" and "date" */ + time.value=(&ds.sec); /* prepare to edit the time of the reminder */ + time.low=0; + time.high=P_NSECDAY-1; + time.type=0; + if (uAddDialogItem(H_DIALOG_TIME,str(STR_TIME),&time)) + return(-1); + date.value=(&ds.day); /* prepare to edit the date of the reminder */ + date.low=H_FIRST_SYS_DAY; + date.high=H_LAST_SYS_DAY; + if (uAddDialogItem(H_DIALOG_DATE,str(STR_DATE),&date)) + return(-1); + if (uRunDialog()<=0) + return(-1); /* user cancelled (or insufficient memory) */ + p_dstost(&ds,&pent->sdate); /* reconstitute system time */ + pent->pb=p_realloc(pent->pb,buf[0]); /* check text alloc cell length */ + if (!pent->pb) + { /* no memory left to grow the text alloc cell */ + uErrorValue(E_GEN_NOMEMORY); + return(-1); + } + pent->tlen=buf[0]; + p_bcpy(pent->pb,&buf[1],buf[0]); + return(0); /* signal successful edit */ + } + +LOCAL_C VOID AddEntry(VOID) + { /* the user wants to add an entry */ + ENTRY ent; + + CleanEntry(&ent); /* prepare a "clean" initial starting point */ + if (EditEntry(&ent)) /* allow the user to edit it */ + return; + AppendEntry(&ent); /* insert the entry */ + } + +LOCAL_C VOID InfoMsg(INT rid) + { /* present info message with text with given resource id */ + wInfoMsg(str(rid)); + } + +LOCAL_C VOID UpdateEntry(VOID) + { /* the user wants to update the current entry */ + ENTRY *pent; + ENTRY ent; + + if (!nent) + { /* no current entry to update */ + InfoMsg(STR_NO_ENTRY_UPDATE); + return; + } + pent=(&table[cent]); /* find the current entry */ + if (EditEntry(pent)) /* allow the user to edit it */ + return; + ent=(*pent); + pent->pb=0; + DoDeleteEntry(); /* delete the existing entry... */ + AppendEntry(&ent); /* ... and re-insert it with the new contents */ + } + +LOCAL_C VOID DeleteEntry(VOID) + { /* the user wants to delete the current entry */ + TEXT ny[4]; /* for the characters 'n' then 'y' */ + TEXT yes[10]; /* for the string "yes" */ + TEXT no[10]; /* for the string "no" */ + + if (!nent) + { /* no entry to delete */ + InfoMsg(STR_NO_ENTRY_DELETE); + return; + } + if (uOpenDialog(str(STR_DELETE_REMINDER))) /* title of dialog */ + return; + LoadStr(STR_NY,&ny[0]); /* find the text for the existing language */ + LoadStr(STR_NO,&no[0]); + LoadStr(STR_YES,&yes[0]); + if (uAddButtonList(&no[0],-ny[0],&yes[0],ny[1],NULL)) /* no-yes buttons */ + return; + if (uRunDialog()!=ny[1]) /* check if user pressed 'y' button */ + return; + DoDeleteEntry(); /* delete the entry */ + if (cent==nent && nent) /* change the cursor position */ + cent=nent-1; + EnsureGoodTent(); /* check whether need to scroll display */ + Display(); /* redraw main display area */ + RequeueAlarm(); /* recalculate which alarm to queue */ + } + +LOCAL_C INT TakeCopy(ENTRY *targ,ENTRY *src) + { /* copy specified entry */ + targ->pb=p_alloc(src->tlen); /* prepare an alloc cell for the text */ + if (!targ->pb) + { + uErrorValue(E_GEN_NOMEMORY); + return(-1); + } + p_bcpy(targ->pb,src->pb,src->tlen); /* copy the text */ + p_bcpy(targ,src,sizeof(ENTRY)-sizeof(TEXT *)); /* copy everything else */ + return(0); + } + +LOCAL_C VOID CopyEntry(VOID) + { /* the user wants to copy the current entry */ + ENTRY new; + + if (!nent) + { /* no current entry to copy */ + InfoMsg(STR_NO_ENTRY_COPY); + return; + } + if (TakeCopy(&new,&table[cent])) + return; /* no memory to make copy */ + p_free(clipent.pb); /* free any existing clipboard text */ + clipent=new; + InfoMsg(STR_REMINDER_COPIED); /* signal success to user */ + } + +LOCAL_C VOID InsertEntry(VOID) + { /* the user wants to insert the clipboard contents */ + ENTRY new; + + if (!clipent.pb) + { /* the clipboard contents are empty */ + InfoMsg(STR_NO_ENTRY_INSERT); + return; + } + if (TakeCopy(&new,&clipent)) + return; /* no memory for new entry */ + AppendEntry(&new); /* insert the entry */ + } + +LOCAL_C VOID ExitIfConfirmed(VOID) + { /* the user wants to exit - request confirmation */ + H_DI_TEXT txt; + TEXT cancel[10]; /* for the text "cancel" */ + TEXT exit[10]; /* for the text "exit" */ + + if (nent) + { /* only need confirmation if there are entries */ + if (uOpenDialog(str(STR_WARNING))) /* dialog title */ + return; + txt.str=str(LSTR_DELETE_ALL); /* lbc text from resource file */ + txt.type=H_DTEXT_ALIGN_CENTRE; /* centre alignment */ + if (uAddDialogItem(H_DIALOG_TEXT,0,&txt)) + return; + LoadStr(STR_CANCEL,&cancel[0]); /* load correct language text */ + LoadStr(STR_EXIT,&exit[0]); + if (uAddButtonList(&cancel[0],W_KEY_ESCAPE, + &exit[0],W_KEY_RETURN,NULL)) + return; + if (uRunDialog()!=W_KEY_RETURN) + return; /* the user failed to confirm */ + } + p_exit(0); /* exit cleanly */ + } + +LOCAL_C INT PrintLine(H_PRINT *pr) + { /* print next line of data */ + ENTRY *pent; + + pent=(&table[PrintRec]); /* which entry to print */ + switch (PrintState++) + { + case 0: /* need to print the date and time */ + pr->blen=SdateToBuf(&PrintBuf[0],&pent->sdate); + pr->buf=(&PrintBuf[0]); + pr->style|=H_PRINT_STY_BOLD; /* print date and time in bold */ + break; + case 1: /* need to print the text */ + pr->buf=pent->pb; + pr->blen=pent->tlen; + break; + case 2: /* gap between entries */ + pr->blen=0; + PrintState=0; + PrintRec++; + return(PrintRec!=nent); /* return FALSE if no more to print */ + } + pr->flags|=H_PRINT_KEEP;/* keep different parts of entry on same page */ + return(TRUE); /* return TRUE since printing not yet finished */ + } + +LOCAL_C VOID PrintAll(VOID) + { /* the user wants to print the reminders */ + if (!nent) + { /* no entries to print */ + InfoMsg(STR_NOTHING_PRINT); + return; + } + PrintRec=0; /* initialise print state variables */ + PrintState=0; + hPrint(PrintLine); /* specify call-back function */ + } + +LOCAL_C VOID ManageCommand(INT index) + { /* switch on command index to appropriate function */ + switch (index) + { + case ITEMS_BEFORE_EDIT: + InsertEntry(); + break; + case ITEMS_BEFORE_EDIT+1: + CopyEntry(); + break; + case ITEMS_BEFORE_EDIT+2: + UpdateEntry(); + break; + case ITEMS_BEFORE_EDIT+3: + AddEntry(); + break; + case ITEMS_BEFORE_EDIT+4: + DeleteEntry(); + break; + case ITEMS_BEFORE_SPECIAL: + PrintAll(); + break; + case ITEMS_BEFORE_SPECIAL+1: + hPrintSetupDialog(); + break; + case ITEMS_BEFORE_SPECIAL+2: + ExitIfConfirmed(); + break; + } + } + +LOCAL_C VOID TryExecuteCommand(INT keycode) + { /* try to find command to execute matching accelerator passed */ + keycode=uLocateCommand(keycode); /* look up accelerator table */ + if (keycode>=0) /* found - keycode converted to index */ + ManageCommand(keycode); + } + +LOCAL_C VOID DoScroll(INT dely) + { /* scroll the display vertically by given amount */ + P_POINT offset; /* offset to scroll */ + P_RECT src; /* source region for scroll */ + + offset.x=0; + offset.y=dely*18; /* each entry is two lines each 9 pixels high */ + src.tl.x=4; + src.br.x=ScreenWidth-4; + if (dely>0) + { /* scrolling down - so exclude bottom from source */ + src.tl.y=4; + src.br.y=4+(4-dely)*18; + } + else + { /* scrolling up - so exclude top from source */ + src.tl.y=4-dely*18; + src.br.y=4+4*18; + } + wScrollRect(MainWid,&src,&offset); + } + +LOCAL_C VOID MakeHighlight(INT newcent) + { /* change the cursor position as specified, with smooth scrolling */ + INT toscroll; /* amount of scroll needed (if any) */ + + if (!nent) + return; /* no entries - hence nothing to do */ + if (newcent==cent) + return; /* cursor already at specified position */ + EraseCursor(cent-tent); /* remove existing cursor */ + toscroll=tent-newcent; + if (toscroll>0) + { /* new cursor position off top of screen */ + tent-=toscroll; /* adjust record of entry at top of screen */ + if (toscroll<4) + DoScroll(toscroll); /* only actually scroll if less than 4 */ + else + toscroll=4; /* toscroll now holds number of lines to redraw */ + while (toscroll) + DrawLine(--toscroll); /* redraw lines not scrolled */ + } + else + { + toscroll=-3-toscroll; + if (toscroll>0) + { /* new cursor position off bottom of screen */ + tent+=toscroll; /* adjust record of entry at top of screen */ + if (toscroll<4) + DoScroll(-toscroll); + else + toscroll=4; + while (toscroll) + DrawLine(4-toscroll--); /* redraw lines not scrolled */ + } + } + cent=newcent; + DrawCursor(cent-tent); /* draw the cursor back in */ + } + +LOCAL_C VOID ScrollPageBy(INT delta) + { /* implementation of PgUp / PgDn */ + if (!nent) + return; /* no entries to display */ + if (delta<(-3)) + delta=(-3); /* scroll at most three records */ + else if (delta>3) + delta=3; + tent+=delta; + cent+=delta; + Display(); + } + +LOCAL_C VOID HandleAlarmEvent(VOID) + { /* an alarm has expired (or time has been put back) */ + ENTRY *pent; /* the alarm that was queued */ + INT expired; /* whether alarm really did expire */ + + pent=LocateRef(); + expired=(pent->sdate<=p_date()); /* find if alarm time has elapsed */ + almactive=FALSE; + pent->ref=FALSE; + RequeueAlarm(); /* find which is next alarm to queue */ + if (expired) + { + uForceToFront(); /* come into foreground */ + MakeHighlight(pent-(&table[0])); /* highlight the elapsed alarm */ + UpdateEntry(); /* allow user to edit the reminder */ + } + } + +LOCAL_C VOID CheckBorderArrows(VOID) + { /* see if border needs redisplaying (on account of "scroll arrows") */ + INT bflags; /* the flags that ought to be displayed */ + + if (!nent) + return; /* no entries */ + if (tent) /* check if more entries off screen top */ + bflags=W_BORD_CORNER_4|W_BORD_TOP_ON; + else + bflags=W_BORD_CORNER_4|W_BORD_TOP_OFF; + if (tent+40) + TryExecuteCommand(ret); + } + break; + case W_KEY_DELETE_LEFT: + DeleteEntry(); /* user wants to delete entry */ + break; + case W_KEY_RETURN: + if (!nent || key.modifiers&W_SHIFT_MODIFIER) + AddEntry(); /* user wants to add entry */ + else + UpdateEntry(); /* user wants to update entry */ + break; + case W_KEY_UP: + if (cent) + MakeHighlight(cent-1); + break; + case W_KEY_DOWN: + if (cent=nent) + MakeHighlight(nent-1); + else + ScrollPageBy(nent-tent-4); + break; + } + } + } + } + +LOCAL_C VOID CreateGC(VOID) + { /* attempt to create default graphics context on main window */ + INT hgc; /* graphics context handle (if successful) */ + + hgc=gCreateGC0(MainWid); + if (hgc<0) + p_exit(hgc); + } + +LOCAL_C VOID *InitRcb(VOID) + { /* create and initialise resource file object */ + INT ret; + VOID *rcb; /* resource file object handle */ + + rcb=p_new(1,C_RSCFILE); + ret=p_entersend3(rcb,O_RS_INIT,DatCommandPtr); /* pass file name */ + if (ret<0) /* no resource file found */ + p_exit(ret); /* fatal (programmer) error */ + return(rcb); + } + +LOCAL_C H_MENU_DATA *LoadMenuTitles(VOID *rcb,INT rid) + { /* load menu titles from specified resource file */ + H_MENU_DATA *pmdata,*pi; /* for created alloc cell */ + TEXT *titles; /* for loaded alloc cell */ + WORD count; /* how many menus */ + INT ret; + + ret=p_entersend4(rcb,O_RS_READ,rid,&titles); + if (ret<0) + return(NULL); /* couldn't access resource file */ + count=(*(WORD *)titles); /* first WORD gives count of menus */ + pmdata=p_alloc((count+1)*sizeof(H_MENU_DATA)); + if (!pmdata) + { /* no memory to alloc H_MENU_DATA array */ + p_free(titles); /* clean up partially constructed data */ + return(NULL); + } + pi=pmdata; /* prepare to walk through H_MENU_DATA array */ + titles+=2; /* skip over leading WORD count */ + while (count--) /* for each menu */ + { + pi->title=titles; /* store pointer to title text */ + titles+=p_slen(titles)+1; /* skip the text and terminating zero */ + pi->nlines=(*titles++); /* store the number of lines */ + pi++; /* increment to next H_MENU_DATA element */ + } + pi->title=0; /* place NULL at end of array */ + return(pmdata); /* return pointer to created struct */ + } + +LOCAL_C TEXT **LoadMenuCommands(VOID *rcb,INT rid) + { /* load menu commands from specified resource file */ + TEXT **pcmds,**pi; /* for created alloc cell */ + TEXT *cmds; /* for loaded alloc cell */ + WORD count; /* how many commands */ + INT ret; + + ret=p_entersend4(rcb,O_RS_READ,rid,&cmds); + if (ret<0) + return(NULL); /* couldn't access resource file */ + count=(*(WORD *)cmds); /* first WORD gives count of commands */ + pcmds=p_alloc((count+1)*sizeof(TEXT *)); + if (!pcmds) + { /* no memory to allow TEXT * array */ + p_free(cmds); /* clean up partially constructed data */ + return(NULL); + } + pi=pcmds; /* prepare to walk through TEXT * array */ + cmds+=2; /* skip over leading WORD count */ + while (count--) /* for each menu command */ + { + *pi++=cmds; /* store pointer to command details */ + cmds+=p_slen(cmds)+1; /* skip the text and terminating zero */ + } + *pi=0; /* place NULL at end of array */ + return(pcmds); /* return pointer to created struct */ + } + +LOCAL_C VOID LoadMenus(VOID) + { /* load all menu data */ + rcb=InitRcb(); /* create and initialise resource file object */ + _cmds=LoadMenuCommands(rcb,REMIND_CMDS); /* load commands */ + _mdata=LoadMenuTitles(rcb,REMIND_MENUS); /* load menu titles */ + if (!_cmds || !_mdata) /* test if either load failed */ + p_exit(E_GEN_START); /* report fatal initialisation error */ + } + +LOCAL_C VOID SpecificInit(VOID) + { /* application initialisation specific to Remind */ + uEscape(FALSE); /* disable Psion-Esc */ + LoadMenus(); /* load all menu data */ + MainWid=uFindMainWid(); /* find id of main display window */ + CreateGC(); /* create default graphics context */ + p_open(&aH,"ALM:",-1); /* open channel to ALM: device */ + ttH=hTTOpen(); /* open channel to time-text object */ + hTTSetAbbreviations(ttH,3,3); /* set abbreviations to use */ + UpdateTimeFormat(); /* check current system time format */ + hCrackCommandLine(); /* crack incoming command line */ + if (ToggleStatusWindow()) /* attempt to display status window */ + p_exit(0); + } + +GLDEF_C VOID main(VOID) + { /* the main() for all Hwif programs */ + uCommonInit(); /* initialisation common to all Hwif programs */ + SpecificInit(); /* initialisation specific to Remind */ + MainLoop(); /* the central event processing loop */ + } diff --git a/code/SIBOSDK/hwdemo/remind.ms b/code/SIBOSDK/hwdemo/remind.ms new file mode 100644 index 0000000..eedb219 --- /dev/null +++ b/code/SIBOSDK/hwdemo/remind.ms @@ -0,0 +1,3 @@ +Remind + +4000 diff --git a/code/SIBOSDK/hwdemo/remind.pic b/code/SIBOSDK/hwdemo/remind.pic new file mode 100644 index 0000000..25dea78 Binary files /dev/null and b/code/SIBOSDK/hwdemo/remind.pic differ diff --git a/code/SIBOSDK/hwdemo/remind.pr b/code/SIBOSDK/hwdemo/remind.pr new file mode 100644 index 0000000..9be274e --- /dev/null +++ b/code/SIBOSDK/hwdemo/remind.pr @@ -0,0 +1,8 @@ +#system epoc img +#set epocinit=iplib +#model small jpi + +#run "rs remind" no_window no_abort +#compile remind.c +#pragma link(hwif.lib) +#link remind diff --git a/code/SIBOSDK/hwdemo/remind.rh b/code/SIBOSDK/hwdemo/remind.rh new file mode 100644 index 0000000..c530b8d --- /dev/null +++ b/code/SIBOSDK/hwdemo/remind.rh @@ -0,0 +1,9 @@ +/* +Constants shared between remind.rss and remind.c +*/ + +#define EDIT_ITEMS 5 +#define SPECIAL_ITEMS 3 + +#define ITEMS_BEFORE_EDIT 0 +#define ITEMS_BEFORE_SPECIAL EDIT_ITEMS diff --git a/code/SIBOSDK/hwdemo/remind.rss b/code/SIBOSDK/hwdemo/remind.rss new file mode 100644 index 0000000..9152e29 --- /dev/null +++ b/code/SIBOSDK/hwdemo/remind.rss @@ -0,0 +1,66 @@ +#include "remind.rh" + +STRUCT STRING + { + TEXT str; + } + +STRUCT LSTRING + { + LTEXT lstr; + } + +STRUCT MENU_TITLE + { + TEXT str; + BYTE ncommands; + } + +STRUCT STRING_ARRAY + { + STRUCT strlst[]; + } + +RESOURCE STRING_ARRAY remind_cmds + { + strlst= + { + STRING {str="iInsert";}, + STRING {str="cCopy";}, + STRING {str="uUpdate";}, + STRING {str="aAdd";}, + STRING {str="dDelete";}, + STRING {str="pPrint";}, + STRING {str="yPrint setup";}, + STRING {str="xExit";} + }; + } + +RESOURCE STRING_ARRAY remind_menus + { + strlst= + { + MENU_TITLE {str="Edit"; ncommands=EDIT_ITEMS;}, + MENU_TITLE {str="Special"; ncommands=SPECIAL_ITEMS;} + }; + } + +RESOURCE STRING str_no_reminders_set {str="No reminders set";} +RESOURCE STRING str_reminder {str="Reminder";} +RESOURCE STRING str_message {str="Message";} +RESOURCE STRING str_time {str="Time";} +RESOURCE STRING str_date {str="Date";} +RESOURCE STRING str_no_entry_update {str="No entry to update";} +RESOURCE STRING str_no_entry_delete {str="No entry to delete";} +RESOURCE STRING str_no_entry_copy {str="No entry to copy";} +RESOURCE STRING str_no_entry_insert {str="No entry to insert";} +RESOURCE STRING str_reminder_copied {str="Reminder copied";} +RESOURCE STRING str_nothing_print {str="Nothing to print";} +RESOURCE STRING str_delete_reminder {str="Delete this reminder";} +RESOURCE STRING str_warning {str="Warning";} +RESOURCE LSTRING lstr_delete_all {lstr="Exiting will delete all reminders";} +RESOURCE STRING str_ny {str="ny";} +RESOURCE STRING str_no {str="No";} +RESOURCE STRING str_yes {str="Yes";} +RESOURCE STRING str_cancel {str="Cancel";} +RESOURCE STRING str_exit {str="Exit";} diff --git a/code/SIBOSDK/hwdemo/remind.shd b/code/SIBOSDK/hwdemo/remind.shd new file mode 100644 index 0000000..1751b95 Binary files /dev/null and b/code/SIBOSDK/hwdemo/remind.shd differ diff --git a/code/SIBOSDK/hwdemo/rs.bat b/code/SIBOSDK/hwdemo/rs.bat new file mode 100644 index 0000000..393704e --- /dev/null +++ b/code/SIBOSDK/hwdemo/rs.bat @@ -0,0 +1,2 @@ +@echo off +rcomp.exe -S%1 -O%1 -I\sibosdk\include\ -G\sibosdk\include\%1 diff --git a/code/SIBOSDK/hwdemo/spy.afl b/code/SIBOSDK/hwdemo/spy.afl new file mode 100644 index 0000000..e48715c --- /dev/null +++ b/code/SIBOSDK/hwdemo/spy.afl @@ -0,0 +1,3 @@ +spy.pic +spy.rsc +spy.shd diff --git a/code/SIBOSDK/hwdemo/spy.c b/code/SIBOSDK/hwdemo/spy.c new file mode 100644 index 0000000..c234f01 --- /dev/null +++ b/code/SIBOSDK/hwdemo/spy.c @@ -0,0 +1,1043 @@ +/* + SPY.C + +Written by DavidW +Started on 12/11/91 + +Derived from earlier work by Poh Siew, GeoffO, Joe, CharlesD, JohnH, & PeterM. +*/ + +#include +#include +#include +#include +#include + +GLREF_C VOID wsReport(HANDLE); +GLREF_C VOID MonitorBandWidth(VOID); +GLREF_C VOID DisableReads(UINT flag); + +GLREF_D UBYTE DatHeapLocked; + +LOCAL_D TEXT *cmds[]= + { + "dChange data", + "hUse decimal", + "pChange processes", + "uUpdate", + "bBand width", + "tTimer off", + "rRefresh rate", + "nLog client", + "mLog all clients", + "cCompress heaps", + "wRewalk failed process", + "gGoto process", + "lReset least stack", + "kKill process", + "xExit", + NULL + }; + +#define DISPLAY_ITEMS 5 +#define TIMER_ITEMS 2 +#define LOG_ITEMS 2 +#define SPECIAL_ITEMS 6 + +#define ITEMS_BEFORE_DISPLAY 0 +#define ITEMS_BEFORE_TIMER DISPLAY_ITEMS +#define ITEMS_BEFORE_LOG (ITEMS_BEFORE_TIMER+TIMER_ITEMS) +#define ITEMS_BEFORE_SPECIAL (ITEMS_BEFORE_LOG+LOG_ITEMS) + +#define USE_ITEM 1 +#define TIMER_ITEM ITEMS_BEFORE_TIMER + +LOCAL_D H_MENU_DATA mdata[]= + { + "Display",DISPLAY_ITEMS, + "Timer",TIMER_ITEMS, + "Log",LOG_ITEMS, + "Special",SPECIAL_ITEMS, + NULL + }; + +GLDEF_D TEXT ** _cmds=(&cmds[0]); +GLDEF_D H_MENU_DATA * _mdata=(&mdata[0]); + + +LOCAL_D UINT MainWid; + +#define TEXT_HEIGHT 10 +#define TEXT_ASCENT 8 + +#define LAY_TOP_BORDER 4 +#define Y_TO_FIRST_PROCESS 15 + +#define SCREEN_WIDTH 240 +#define LAY_LEFT_BORDER 4 +#define LAY_RIGHT_BORDER 4 + +#define NAME_COLUMN_INDENT 4 +#define NAME_COLUMN_WIDTH 74 +#define X_TO_FIRST_COLUMN (LAY_LEFT_BORDER+NAME_COLUMN_INDENT+NAME_COLUMN_WIDTH) +#define FIRST_COLUMN_WIDTH 32 +#define SECOND_COLUMN_WIDTH 50 +#define THIRD_COLUMN_WIDTH 72 +#define TRAILING_INDENT 4 +#define X_TO_END (SCREEN_WIDTH-LAY_RIGHT_BORDER) + +LOCAL_D UWORD cwid[3]={FIRST_COLUMN_WIDTH,SECOND_COLUMN_WIDTH,THIRD_COLUMN_WIDTH}; + +typedef struct + { + TEXT name[E_MAX_NAME+2]; + UWORD bytes_allocated; + UWORD bytes_free; + UWORD seg_size; + UWORD last_free; + UWORD least_stack; + UWORD priority; + UWORD stack_pointer; + UWORD pid; + UWORD cells_allocated; + UWORD cells_free; + UWORD iosemcnt; + UWORD status; + } PROCESS_DATA; + +#define PROCESS_SYSTEM 1 +#define PROCESS_APPLICATION 2 +#define PROCESS_ALL 3 + +LOCAL_D UWORD which_processes=PROCESS_ALL; + +LOCAL_D UWORD using_decimal=FALSE; +LOCAL_D UWORD lastbflags=0; + +#define DISPLAY_PROCESS_NAME 0 +#define DISPLAY_BYTES_ALLOCED 1 +#define DISPLAY_BYTES_FREE 2 +#define DISPLAY_SEG_SIZE 3 +#define DISPLAY_LAST_FREE 4 +#define DISPLAY_LEAST_STACK 5 +#define DISPLAY_PRIORITY 6 +#define DISPLAY_STACK_POINTER 7 +#define DISPLAY_PID 8 +#define DISPLAY_CELLS_ALLOCED 9 +#define DISPLAY_CELLS_FREE 10 +#define DISPLAY_IOSEMCNT 11 +#define DISPLAY_STATUS 12 + +LOCAL_D TEXT *titles[13]= + { + "Process name", + "Alloc bytes", + "Bytes free", + "Seg size", + "Last free", + "Lst stack", + "Priority", + "Stack ptr", + "Proc ID", + "Alloc cells", + "Cells free", + "IO count", + "Status" + }; + +LOCAL_D TEXT *statuses[]= + { + "Curr", + "Busy", + "TimQ", + "Susp", + "Wait" + }; + +LOCAL_D UWORD col[4]= + { + DISPLAY_PROCESS_NAME, + DISPLAY_BYTES_ALLOCED, + DISPLAY_CELLS_ALLOCED, + DISPLAY_LEAST_STACK + }; + +LOCAL_D PROCESS_DATA proc[E_MAX_PROCESSES-1]; +LOCAL_D UWORD numproc; +LOCAL_D HANDLE failpid=NULL; + +typedef struct mblock + { + UWORD mlen; + struct mblock *mnext; + } MBLOCK; + +#define SZMBLK sizeof(MBLOCK) +#define SZHD sizeof(UWORD) + +#define ERR_FREECELL_BEYOND_MEMHIGH 1 +#define ERR_FREECELL_GOES_BACKWARDS 2 +#define ERR_CELL_LENGTH_TOO_SMALL 3 +#define ERR_CELL_LENGTH_ODD 4 +#define ERR_ALLOCED_CELLS_OVERRUN_FREE 5 +#define ERR_TOTALS_DONT_MATCH 6 + +LOCAL_D TEXT *heap_errors[]= + { + "Free cell beyond memhigh", + "Free cell goes backwards", + "Cell length too small", + "Cell length odd", + "Alloced cells don't end at next free cell", + "Total free + total alloced != segment size" + }; + +#define STACK_READ_SIZE 256 + +LOCAL_D UWORD selproc=0; +LOCAL_D UWORD topproc=0; + +LOCAL_D LONG timint=50; +LOCAL_D VOID *timcb; +LOCAL_D WORD timstat; +LOCAL_D UWORD using_timer=TRUE; + + +LOCAL_C VOID QueueTimer(VOID) + { + if (using_timer) + p_ioa4(timcb,P_FRELATIVE,&timstat,&timint); + } + +LOCAL_C VOID CancelTimer(VOID) + { + if (using_timer) + { + p_iow2(timcb,P_FCANCEL); + p_waitstat(&timstat); + } + } + +LOCAL_C INT GetWidth(TEXT *pb) + { + return(gTextWidth(WS_FONT_BASE,G_STY_NORMAL,pb,p_slen(pb))); + } + +LOCAL_C VOID DrawTitles(VOID) + { + INT i; + INT totwid; + INT width[4]; + INT gap; + TEXT *buf; + P_RECT box; + + totwid=0; + for (i=0; i<=3; i++) + totwid+=(width[i]=GetWidth(titles[col[i]])); + gap=(X_TO_END-LAY_LEFT_BORDER-totwid)/3; + box.tl.x=LAY_LEFT_BORDER; + box.tl.y=LAY_TOP_BORDER; + box.br.y=LAY_TOP_BORDER+TEXT_HEIGHT; + for (i=0; i<=3; i++) + { + if (i==3) + box.br.x=X_TO_END; + else + box.br.x=box.tl.x+width[i]+gap; + buf=(titles[col[i]]); + gPrintBoxText(&box,TEXT_ASCENT,G_TEXT_ALIGN_LEFT,0,buf,p_slen(buf)); + box.tl.x=box.br.x; + } + } + +LOCAL_C VOID InvertLine(INT j) + { + P_EXTENT ext; + + ext.tl.x=LAY_LEFT_BORDER; + ext.tl.y=Y_TO_FIRST_PROCESS+(j-topproc)*TEXT_HEIGHT; + ext.width=X_TO_END-LAY_LEFT_BORDER; + ext.height=TEXT_HEIGHT; + gInvObloid(&ext); + } + +LOCAL_C VOID DrawLine(INT j) + { + P_RECT box; + INT len; + UWORD *base; + TEXT *fmt; + TEXT *buf; + INT margin; + TEXT out[20]; + INT i; + INT val; + + box.tl.x=LAY_LEFT_BORDER; + box.tl.y=Y_TO_FIRST_PROCESS+j*TEXT_HEIGHT; + box.br.y=box.tl.y+TEXT_HEIGHT; + j+=topproc; + if (j>=numproc) + { + box.br.x=X_TO_END; + gClrRect(&box,G_TRMODE_CLR); + return; + } + box.br.x=X_TO_FIRST_COLUMN; + buf=(&proc[j].name[0]); + len=p_slen(buf); + gPrintBoxText(&box,TEXT_ASCENT,G_TEXT_ALIGN_LEFT, + NAME_COLUMN_INDENT,buf,len); + base=(&proc[j].bytes_allocated)-1; + for (i=0; i<3; ) + { + box.tl.x=box.br.x; + box.br.x=box.tl.x+cwid[i]; + val=(*(base+col[++i])); + if (col[i]==DISPLAY_STATUS) + buf=statuses[val]; + else + { + if (col[i]==DISPLAY_IOSEMCNT) + fmt="%d"; + else if (using_decimal || col[i]>=DISPLAY_CELLS_ALLOCED) + fmt="%u"; + else + fmt="%x"; + p_atos(buf=(&out[0]),fmt,val); + } + margin=(i==3? TRAILING_INDENT: 0); + gPrintBoxText(&box,TEXT_ASCENT,G_TEXT_ALIGN_RIGHT, + margin,buf,p_slen(buf)); + } + if (j==selproc) + InvertLine(j); + } + +LOCAL_C VOID DrawList(VOID) + { + INT j; + + for (j=0; j<6; j++) + DrawLine(j); + } + +LOCAL_C VOID SetPriority(INT prio) + { + p_setpri(p_getpid(),prio); + } + +LOCAL_C VOID PriorityHigh(VOID) + { + SetPriority(E_MAX_PRIORITY); + } + +LOCAL_C VOID PriorityLow(VOID) + { + SetPriority(E_PRIORITY_BACK+1); + } + +LOCAL_C INT SystemProcessName(TEXT *pname) + { + return(!p_bcmp(pname,4,"SYS$",4)); + } + +LOCAL_C VOID GetMblock(HANDLE pid,MBLOCK *ofs,MBLOCK *buf) + { + p_pcpyfr(pid,ofs,buf,SZMBLK); + } + +LOCAL_C INT WalkHeap(HANDLE pid,UWORD *poffset,PROCESS_DATA *pdata, + MBLOCK *MemBasePtr) + { + MBLOCK *p1,*p2,*memhigh; + MBLOCK m1,m2; + + memhigh=(MBLOCK *)pdata->seg_size; + p2=MemBasePtr; + p1=p2+1; /* first allocated cell starts at an mblock after memBasePtr */ + FOREVER + { /* walk every cell from memlow to memhigh */ + GetMblock(pid,p2,&m2); + *poffset=(UWORD)p2; + p2=m2.mnext; /* next free cell */ + if (!p2) + p2=memhigh; /* last free cell */ + else + { + GetMblock(pid,p2,&m2); + if (p2>(memhigh-1)) + return(ERR_FREECELL_BEYOND_MEMHIGH); + else if (m2.mnext && m2.mnextcells_allocated++; + pdata->bytes_allocated+=m1.mlen; + if (m1.mlen>((UBYTE *)p2-(UBYTE *)p1)) + return(ERR_ALLOCED_CELLS_OVERRUN_FREE); + p1=(MBLOCK *)(((UBYTE *)p1)+m1.mlen); + } + if (p2==memhigh) + { + *poffset=0; + break; + } + p1=(MBLOCK *)(((UBYTE *)p2)+m2.mlen); /* next allocated cell */ + pdata->cells_free++; + pdata->bytes_free+=m2.mlen; + pdata->last_free=m2.mlen; + } + if (pdata->seg_size!=(UINT)(MemBasePtr)+SZMBLK + +pdata->bytes_allocated+pdata->bytes_free) + return(ERR_TOTALS_DONT_MATCH); + return(0); /* all OK */ + } + +LOCAL_C VOID NotifyError(INT ret,UWORD offset,TEXT *pname) + { + TEXT buf[40]; + + p_atos(&buf[0],"%s: heap corrupt at %u",pname,offset); + p_notify(&buf[0],heap_errors[ret-1],0,0,0); + } + +LOCAL_C VOID CollectProcessData(HANDLE pid,TEXT *pname) + { + PROCESS_DATA *pdata; + E_PROC epc; + UBYTE sbuf[STACK_READ_SIZE+2]; + UBYTE *p; + UBYTE *pEnd; + UWORD segoffset; + WORD locked; + UWORD offset; + INT ret; + UWORD sem[3]; + + pdata=(&proc[numproc++]); + p_bfil(pdata,sizeof(PROCESS_DATA),0); + p_scpy(&pdata->name[0],pname); + pdata->pid=pid; + p_getosd(&epc,(VOID *)(E_PIDMASK&pid),sizeof(E_PROC)); + pdata->seg_size=p_sgsize(epc.dataSeg)<<4; + pdata->stack_pointer=(UWORD)epc.saveSP; + pdata->status=epc.status-E_PROC_CURRENT; + pdata->priority=p_getpri(pid); + p_getosd(&sem[0],(VOID *)epc.semaphore,6); + pdata->iosemcnt=sem[2]; + segoffset=0x80; + pEnd=(&sbuf[STACK_READ_SIZE]); + *pEnd=0; + do + { + p_pcpyfr(pid,(VOID *)segoffset,&sbuf[0],STACK_READ_SIZE); + p=(&sbuf[0]); + while (*p==255) + p++; + segoffset+=STACK_READ_SIZE; + } while (p==pEnd); + pdata->least_stack=segoffset-STACK_READ_SIZE+p-(&sbuf[0]); + if (epc.memBasePtr && !epc.isTask && pid!=failpid) + { + locked=0; + p_pcpyfr(pid,&DatHeapLocked,&locked,1); + if (!locked) + { + ret=WalkHeap(pid,&offset,pdata,(MBLOCK *)epc.memBasePtr); + if (ret) + { + NotifyError(ret,offset,pname); + failpid=pid; + } + } + } + } + +LOCAL_C VOID BuildList(VOID) + { + HANDLE prchand; + TEXT name[E_MAX_NAME+2]; + HANDLE pid; + INT first; + + numproc=0; + first=TRUE; + prchand=NULL; + PriorityHigh(); + while ((prchand=p_pfind(prchand,"*",&name[0]))!=E_FILE_NXIST) + { + if (first) + { + first=FALSE; + continue; + } + if (which_processes!=PROCESS_ALL) + { + if (SystemProcessName(&name[0])) + { + if (which_processes==PROCESS_APPLICATION) + continue; + } + else if (which_processes==PROCESS_SYSTEM) + continue; + } + if ((pid=p_pidfind(&name[0]))<0) + continue; + CollectProcessData(pid,&name[0]); + } + PriorityLow(); + if (topproc>numproc-6) + topproc=numproc-6; + if (selproc>numproc-1) + selproc=numproc-1; + } + +LOCAL_C VOID UpdateList(VOID) + { + BuildList(); + DrawList(); + } + +LOCAL_C VOID ResetList(VOID) + { + CancelTimer(); + UpdateList(); + QueueTimer(); + } + +LOCAL_C VOID ChangeColumnsViewed(VOID) + { + UWORD copy[3]; + INT j; + TEXT prompt[10]; + TEXT *pb; + + p_bcpy(©[0],&col[1],6); + pb=(&prompt[7]); /* points to '1' of "Column 1" */ + FOREVER + { + p_scpy(&prompt[0],"Column 1"); + if (uOpenDialog("Change display for each column")) + return; + for (j=0; j<3; j++) + { + if (uAddChoiceList(&prompt[0],©[j],"Bytes allocated", + "Bytes free","Segment size","Last free cell", + "Least stack","Process priority","Stack pointer", + "Process ID","Cells allocated","Cells free", + "IO semaphore count","Process status",NULL)) + return; + (*pb)++; + } + if (uRunDialog()<=0) + return; + if (copy[0]!=copy[1] && copy[0]!=copy[2] && copy[1]!=copy[2]) + break; + wInfoMsg("Duplicate columns"); + } + p_bcpy(&col[1],©[0],6); + DrawTitles(); + ResetList(); + } + +LOCAL_C VOID ChangeRefreshRate(VOID) + { + H_DI_NUMBER num; + + if (uOpenDialog("Refresh rate")) + return; + num.value=(&timint); + num.low=5; + num.high=1000; + if (uAddDialogItem(H_DIALOG_NUMBER,"Tenths of seconds",&num)) + return; + if (uRunDialog()<=0) + return; + CancelTimer(); + QueueTimer(); + } + +LOCAL_C VOID ChangeProcessesViewed(VOID) + { + if (uOpenDialog(NULL)) + return; + if (uAddChoiceList("View which processes",&which_processes, + "System","Application","All",NULL)) + return; + if (uRunDialog()<=0) + return; + ResetList(); + } + +LOCAL_C VOID ToggleBaseUsed(VOID) + { + if (using_decimal^=TRUE) + { + wInfoMsg("Display now using decimal"); + cmds[USE_ITEM]="hUse hex"; + } + else + { + wInfoMsg("Display now using hexadecimal"); + cmds[USE_ITEM]="hUse decimal"; + } + ResetList(); + } + +LOCAL_C VOID ToggleTimer(VOID) + { + CancelTimer(); + if (using_timer^=TRUE) + { + wInfoMsg("Timer re-enabled"); + cmds[TIMER_ITEM]="tTimer off"; + } + else + { + wInfoMsg("Timer suspended"); + cmds[TIMER_ITEM]="tTimer on"; + } + QueueTimer(); + } + +LOCAL_C VOID CompressAllHeaps(VOID) + { + p_sgcreate("t$t$",0x7FFF,E_SEGMENT_HIGH); + wInfoMsg("All heaps compressed"); + ResetList(); + } + +LOCAL_C VOID WalkAllHeapsAgain(VOID) + { + if (!failpid) + wInfoMsg("No failed process"); + else + { + failpid=NULL; + wInfoMsg("Now rewalking ALL processes"); + ResetList(); + } + } + +LOCAL_C TEXT *CurrentTaskName(VOID) + { + return(&proc[selproc].name[0]); + } + +LOCAL_C VOID NamedInfoMsg(TEXT *fmt) + { + TEXT buf[40]; + + p_atos(&buf[0],fmt,CurrentTaskName()); + wInfoMsg(&buf[0]); + } + +LOCAL_C VOID GotoCurrentProcess(VOID) + { + HANDLE pid; + + pid=proc[selproc].pid; + if ((INT)wClientInfo(pid)>=0) + wClientPosition(0,pid); + else + NamedInfoMsg("Cannot go to %s"); + } + +LOCAL_C INT TryResetLeastStack(VOID) + { + HANDLE pid; + E_PROC epc; + UBYTE *offset; + TEXT buf[STACK_READ_SIZE]; + + PriorityHigh(); + if (proc[selproc].priority>=E_MAX_PRIORITY) + { + PriorityLow(); + NamedInfoMsg("Cannot reset stack of %s"); + return; + } + p_bfil(&buf[0],STACK_READ_SIZE,0xFF); + pid=proc[selproc].pid; + p_getosd(&epc,(VOID *)(E_PIDMASK&pid),sizeof(E_PROC)); + offset=(UBYTE *)0x80; + while (offset+STACK_READ_SIZE=0) + ManageCommand(keycode); + } + +LOCAL_C VOID DoScroll(INT dely) + { + P_POINT offset; + P_RECT src; + + offset.x=0; + offset.y=dely*TEXT_HEIGHT; + src.tl.x=LAY_LEFT_BORDER; + src.br.x=X_TO_END; + if (dely>0) + { + src.tl.y=Y_TO_FIRST_PROCESS; + src.br.y=Y_TO_FIRST_PROCESS+(6-dely)*TEXT_HEIGHT; + } + else + { + src.tl.y=Y_TO_FIRST_PROCESS-dely*TEXT_HEIGHT; + src.br.y=Y_TO_FIRST_PROCESS+6*TEXT_HEIGHT; + } + wScrollRect(MainWid,&src,&offset); + } + +LOCAL_C VOID MakeHighlight(INT newselproc) + { + INT toscroll; + + if (newselproc==selproc) + return; + InvertLine(selproc); + toscroll=topproc-newselproc; + if (toscroll>0) + { + topproc-=toscroll; + if (toscroll<6) + DoScroll(toscroll); + else + toscroll=6; + while (toscroll) + DrawLine(--toscroll); + } + else + { + toscroll=-5-toscroll; + if (toscroll>0) + { + topproc+=toscroll; + if (toscroll<6) + DoScroll(-toscroll); + else + toscroll=6; + while (toscroll) + DrawLine(6-toscroll--); + } + } + selproc=newselproc; + InvertLine(selproc); + } + +LOCAL_C VOID ScrollPageBy(INT delta) + { + if (delta<(-5)) + delta=(-5); + else if (delta>5) + delta=5; + topproc+=delta; + selproc+=delta; + DrawList(); + } + +LOCAL_C VOID TryMatchFirstLetter(INT upper) + { + INT k; + INT i; + + k=numproc; + i=selproc; + while (k--) + { + if (++i==numproc) + i=0; + if (proc[i].name[0]==upper) + { + MakeHighlight(i); + return; + } + } + p_sound(-5,320); + } + +LOCAL_C VOID CheckBorderArrows(VOID) + { + INT bflags; + + if (topproc) + bflags=W_BORD_CORNER_4|W_BORD_TOP_ON; + else + bflags=W_BORD_CORNER_4|W_BORD_TOP_OFF; + if (topproc+60) + TryExecuteCommand(ret); + } + break; + case W_KEY_UP: + if (selproc) + MakeHighlight(selproc-1); + break; + case W_KEY_DOWN: + if (selproc=numproc) + MakeHighlight(numproc-1); + else + ScrollPageBy(numproc-topproc-6); + break; + default: + if (p_isprint(key.keycode)) + TryMatchFirstLetter(p_toupper(key.keycode)); + } + } + } + } + +LOCAL_C VOID CreateGC(VOID) + { + INT hgc; + + hgc=gCreateGC0(MainWid); + if (hgc<0) + p_exit(hgc); + } + +LOCAL_C VOID SpecificInit(VOID) + { + MainWid=uFindMainWid(); + CreateGC(); + hCrackCommandLine(); + p_unmarka(); + DrawTitles(); + UpdateList(); + p_open(&timcb,"TIM:",-1); + QueueTimer(); + if (wCaptureKey('n'|W_SPECIAL_KEY,W_CTRL_MODIFIER|W_PSION_MODIFIER, + W_CTRL_MODIFIER|W_PSION_MODIFIER)<0) + wInfoMsg("'n' key capture failed"); + if (wCaptureKey('p'|W_SPECIAL_KEY,W_CTRL_MODIFIER|W_PSION_MODIFIER, + W_CTRL_MODIFIER|W_PSION_MODIFIER)<0) + wInfoMsg("'p' key capture failed"); + if (wCaptureKey('s'|W_SPECIAL_KEY,W_CTRL_MODIFIER|W_PSION_MODIFIER, + W_CTRL_MODIFIER|W_PSION_MODIFIER)<0) + wInfoMsg("'s' key capture failed"); + } + +GLDEF_C VOID main(VOID) + { + uCommonInit(); + SpecificInit(); + MainLoop(); + } diff --git a/code/SIBOSDK/hwdemo/spy.ms b/code/SIBOSDK/hwdemo/spy.ms new file mode 100644 index 0000000..1d6a7e4 --- /dev/null +++ b/code/SIBOSDK/hwdemo/spy.ms @@ -0,0 +1 @@ +Spy diff --git a/code/SIBOSDK/hwdemo/spy.pic b/code/SIBOSDK/hwdemo/spy.pic new file mode 100644 index 0000000..9a4063f Binary files /dev/null and b/code/SIBOSDK/hwdemo/spy.pic differ diff --git a/code/SIBOSDK/hwdemo/spy.pr b/code/SIBOSDK/hwdemo/spy.pr new file mode 100644 index 0000000..479517d --- /dev/null +++ b/code/SIBOSDK/hwdemo/spy.pr @@ -0,0 +1,8 @@ +#system epoc img +#set epocinit=iplib +#model small jpi +#compile spy +#compile spybw +#compile wsreport +#pragma link(hwif.lib) +#link spy diff --git a/code/SIBOSDK/hwdemo/spy.rsc b/code/SIBOSDK/hwdemo/spy.rsc new file mode 100644 index 0000000..e69de29 diff --git a/code/SIBOSDK/hwdemo/spy.shd b/code/SIBOSDK/hwdemo/spy.shd new file mode 100644 index 0000000..762f780 Binary files /dev/null and b/code/SIBOSDK/hwdemo/spy.shd differ diff --git a/code/SIBOSDK/hwdemo/spybw.c b/code/SIBOSDK/hwdemo/spybw.c new file mode 100644 index 0000000..5c7b08f --- /dev/null +++ b/code/SIBOSDK/hwdemo/spybw.c @@ -0,0 +1,293 @@ +/* + SPYBW.C + +Written by SteveT +Started on 20/7/92 + +Part of Spy to monitor CPU band width usage. +*/ + +#include +#include + +#define DLG_WIDTH 190 +#define DLG_HEIGHT 49 +#define DLG_LINE 13 +#define STACK_SIZE 500 + +GLREF_D TEXT *DatCommandPtr; +GLREF_D VOID *winHandle; +GLREF_D TEXT *DatProcessNamePtr; + +LOCAL_D UINT TaskCount; + +LOCAL_D INT Debug=FALSE; +LOCAL_D UINT oldPri; +LOCAL_D INT winId; +LOCAL_D HANDLE bwPid; +LOCAL_D HANDLE spyPid; +LOCAL_D VOID *TimCB; +LOCAL_D ULONG bwTotal; +LOCAL_D UINT bwCount; +LOCAL_D ULONG bwCabTotal; +LOCAL_D UINT bwCabCount; +LOCAL_D UINT bwCabBase; +LOCAL_D ULONG bwCabDisplayTotal; +LOCAL_D UINT bwCabDisplayCount; +LOCAL_D UINT bwCabDisplayBase; +LOCAL_D UWORD LastCount; +LOCAL_D UWORD SampleCount; + +LOCAL_D UBYTE TaskStack[STACK_SIZE]; + +/***********************************************************/ +/* This section of code is used by the task to measure the */ +/* available band width. */ +/***********************************************************/ + +LOCAL_C VOID MonitorLoop(VOID) + { + UINT i; + + p_unmarka(); + FOREVER + { + for(i=0;i<500;i++); + TaskCount++; + } + } + +/*********************/ +/* Main body of code */ +/*********************/ + +LOCAL_C VOID DebugInfo(VOID) + { + TEXT buf[80]; + + p_atos(&buf[0],"%u/%u",LastCount,SampleCount); + wInfoMsg(&buf[0]); + } + +GLDEF_C VOID DisableReads(UINT flag) + { + UINT tmp; + + tmp=P_SCR_DISABLE_READS; + p_iow(winHandle,P_FSET,&tmp,&flag); + } + +LOCAL_C INT CreateDialog(VOID) + { + W_WINDATA windata; + INT w_id; + + windata.extent.width=DLG_WIDTH; + windata.extent.height=DLG_HEIGHT; + windata.extent.tl.x=(240-DLG_WIDTH)>>1; + windata.extent.tl.y=(80-DLG_HEIGHT)>>1; + w_id=wCreateWindow(0,W_WIN_EXTENT,&windata,1); + wInitialiseWindowTree(w_id); + return(w_id); + } + +LOCAL_C VOID pTxt(UINT line,TEXT *txt,ULONG *pTotal,INT count,INT count2) + { + P_RECT rect; + TEXT buf[20]; + ULONG Percentage,lCount; + + rect.tl.x=4; + rect.br.x=96; + rect.tl.y=DLG_LINE+3+line*10; + rect.br.y=rect.tl.y+8; + gPrintBoxText(&rect,7,G_TEXT_ALIGN_LEFT,0,txt,p_slen(txt)); + buf[0]=0; + if (bwCount>0 && count!=0) + { + lCount=(ULONG)(count==-1?1:count); + Percentage=(*pTotal)*100l; + Percentage/=lCount; + Percentage/=(ULONG)SampleCount; + if (count!=0) + { + if (count2>=0) + p_atos(&buf[0],"%U%% [%u-%u]",Percentage,count2,count+count2); + else + p_atos(&buf[0],count>0?"%U%% [%u]":"%U%%",Percentage,count); + } + } + rect.tl.x=rect.br.x; + rect.br.x=DLG_WIDTH-6; + gPrintBoxText(&rect,7,G_TEXT_ALIGN_LEFT,0,&buf[0],p_slen(&buf[0])); + } + +LOCAL_C VOID redrawWin(UINT update) + { + P_RECT rect; + ULONG tmp; + + if (update) + gCreateTempGC0(winId); + else + { + wBeginRedrawWinGC0(winId); + gBorder(W_BORD_CORNER_4|W_BORD_SHADOW_D|W_BORD_SHADOW_ON); + rect.tl.x=4; + rect.br.x=DLG_WIDTH-6; + rect.tl.y=3; + rect.br.y=11; + gPrintBoxText(&rect,7,G_TEXT_ALIGN_CENTRE,0,"Available CPU band width",24); + gDrawLine(1,DLG_LINE,DLG_WIDTH-2,DLG_LINE); + } + pTxt(0,"Average",&bwTotal,bwCount,-1); + tmp=LastCount; + pTxt(1,"Last",&tmp,-1,-1); + pTxt(2,"\002B",&bwCabDisplayTotal,bwCabDisplayCount,bwCabDisplayBase); + if (update) + gFreeTempGC(); + else + wEndRedraw(); + } + +LOCAL_C VOID GetCount(UWORD *pCount) + { + LONG time; + WORD tstat; + + p_presume(bwPid); + time=10l; + TaskCount=0; + p_ioc(TimCB,P_FREAD,&tstat,&time); + p_waitstat(&tstat); + *pCount=TaskCount; + if (TaskCount>SampleCount) + SampleCount=TaskCount; + p_psuspend(bwPid); + p_allowoff(); + } + +LOCAL_C VOID InitBW(VOID) + { + UWORD oldSample,Count2; + INT i; + + f_leave(bwPid=p_ptask("SYS$SPY",E_MAX_PRIORITY-1,MonitorLoop,&TaskStack[STACK_SIZE-1])); + f_open(&TimCB,"TIM:",-1); + spyPid=p_getpid(); + oldPri=p_getpri(spyPid); + p_setpri(spyPid,E_MAX_PRIORITY); + if (SampleCount==0) + for(i=0;i<5;i++) + { /* If no matching samples in 5 then just take the best so far */ + oldSample=SampleCount; + GetCount(&Count2); + if (Count2==oldSample || (Count2+1)==oldSample || Count2==(oldSample+1)) + break; /* Two matching samples, must be good! */ + } + p_setpri(bwPid,E_MIN_PRIORITY); + p_setpri(spyPid,E_PRIORITY_WSERV-1); + } + +#ifdef JPIC +#pragma save,ENTER_CALL +#endif +LOCAL_C INT xMonitorBandWidth(VOID) + { + WS_EV event; + + bwCabDisplayCount=bwCabCount=bwCount=bwCabDisplayBase=bwCabBase=LastCount=0; + bwCabDisplayTotal=bwCabTotal=bwTotal=0; + DisableReads(TRUE); + winId=CreateDialog(); + redrawWin(FALSE); + wFlush(); + InitBW(); + wGetEvent(&event); + FOREVER + { + p_ioyield(); + if (event.type!=E_FILE_PENDING) + { + p_iowait(); + if (event.type==WM_KEY) + { + if (event.p.key.keycode==27) + break; + if (event.p.key.keycode==(W_SPECIAL_KEY|'p')) + wClientPosition(0,0); + else if (event.p.key.keycode==(W_SPECIAL_KEY|'b')) + { + p_sound(-5,320); + bwCabDisplayTotal=bwCabTotal; + bwCabDisplayCount=bwCabCount; + bwCabDisplayBase=bwCabBase; + bwCabTotal=0; + bwCabCount=0; + bwCabBase=bwCount; + redrawWin(TRUE); + } + else if (event.p.key.keycode=='d') + Debug=!Debug; + } + else switch (event.type) + { + case WM_REDRAW: + if (event.handle!=1) + wInfoMsg("Redraw to unknown window!"); + else + redrawWin(FALSE); + break; + case WM_FOREGROUND: + case WM_BACKGROUND: + p_setpri(spyPid,E_PRIORITY_WSERV-1); + break; + } + wGetEvent(&event); + } + else + { + GetCount(&LastCount); + if (Debug) + DebugInfo(); + bwTotal+=LastCount; + if (bwCount++==9999) + bwCount=1; + bwCabTotal+=LastCount; + bwCabCount++; + redrawWin(TRUE); + wFlush(); + } + } + return(0); + } +#ifdef JPIC +#pragma restore +#endif + +GLDEF_C VOID MonitorBandWidth(VOID) + { + INT err; + TEXT *name; + + name=DatProcessNamePtr; + bwPid=spyPid=0; + DatProcessNamePtr=0; + if (wCaptureKey(W_SPECIAL_KEY|'b',W_PSION_MODIFIER|W_CTRL_MODIFIER,W_PSION_MODIFIER|W_CTRL_MODIFIER)<0) + wInfoMsg("'b' key capture failed"); + wDisableLeaves(FALSE); + err=p_enter1(xMonitorBandWidth); + wDisableLeaves(TRUE); + p_close(TimCB); + wCancelCaptureKey(W_SPECIAL_KEY|'b',W_PSION_MODIFIER|W_CTRL_MODIFIER,W_PSION_MODIFIER|W_CTRL_MODIFIER); + if (bwPid>0) + p_pkill(bwPid,0); + wCloseWindowTree(winId); + DisableReads(FALSE); + if (spyPid>0) + p_setpri(spyPid,oldPri); + if (err<0) + p_notifyerr(err,"Band width monitor failed",NULL,NULL,NULL); + DatProcessNamePtr=name; + wDisableLeaves(FALSE); + } diff --git a/code/SIBOSDK/hwdemo/ta1.afl b/code/SIBOSDK/hwdemo/ta1.afl new file mode 100644 index 0000000..b866e4f --- /dev/null +++ b/code/SIBOSDK/hwdemo/ta1.afl @@ -0,0 +1,3 @@ +tables.pic +tables.rsc +tables.shd diff --git a/code/SIBOSDK/hwdemo/ta1.c b/code/SIBOSDK/hwdemo/ta1.c new file mode 100644 index 0000000..b30a5b8 --- /dev/null +++ b/code/SIBOSDK/hwdemo/ta1.c @@ -0,0 +1,244 @@ +/* + TA1.C +*/ + +#include +#include +#include +#include + +LOCAL_D TEXT *cmds[]= + { + "rReset score", + "lLimits", + "mMode", + "tTiming", + "xExit", + NULL + }; + +#define TABLES_ITEMS 5 + +LOCAL_D H_MENU_DATA mdata[]= + { + "Tables",TABLES_ITEMS, + NULL + }; + +GLDEF_D TEXT ** _cmds=(&cmds[0]); +GLDEF_D H_MENU_DATA * _mdata=(&mdata[0]); + + +LOCAL_D UINT MainWid; + +typedef struct + { + UWORD TableEnd; + UWORD MaxTable; + UWORD Tested; + UWORD Correct; + UWORD Timing; + UWORD Mode; + } TSTATE; + +LOCAL_D TSTATE state={12,12,0,0,5,1}; + +LOCAL_D TEXT *EnvName="TABLES"; +#define ENV_NAME_LEN 6 + + +LOCAL_C VOID ResetScore(VOID) + { + if (!state.Tested) + { + wInfoMsg("No score to reset"); + return; + } + if (uOpenDialog("Reset score to zero")) + return; + if (uAddButtonList("No",-'n',"Yes",'y',NULL)) + return; + if (uRunDialog()=='y') + { + state.Tested=0; + state.Correct=0; + } + } + +LOCAL_C VOID ChangeLimits(VOID) + { + LONG lTableEnd; + LONG lMaxTable; + H_DI_NUMBER end; + H_DI_NUMBER last; + + lTableEnd=state.TableEnd; + lMaxTable=state.MaxTable; + if (uOpenDialog("Limits for testing")) + return; + end.value=(&lTableEnd); + end.low=10; + end.high=99; + if (uAddDialogItem(H_DIALOG_NUMBER,"Tables end at",&end)) + return; + last.value=(&lMaxTable); + last.low=2; + last.high=99; + if (uAddDialogItem(H_DIALOG_NUMBER,"Highest table",&last)) + return; + if (uRunDialog()<=0) + return; + state.TableEnd=lTableEnd; + state.MaxTable=lMaxTable; + if (state.Mode>state.MaxTable) + state.Mode=state.MaxTable; + } + +LOCAL_C VOID ChangeTiming(VOID) + { + LONG lTiming; + H_DI_NUMBER tim; + + lTiming=state.Timing; + if (uOpenDialog("Timing")) + return; + tim.value=(&lTiming); + tim.low=1; + tim.high=20; + if (uAddDialogItem(H_DIALOG_NUMBER,"Number of seconds allowed",&tim)) + return; + if (uRunDialog()<=0) + return; + state.Timing=lTiming; + } + +LOCAL_C VOID ChangeMode(VOID) + { + H_DI_CHOICE ch; + INT j; + TEXT buf[20]; + + if (uOpenDialog("Mode")) + return; + if (uBeginDCL(&ch)) + return; + if (uGrowDCL(&ch,"All tables")) + return; + for (j=2; j<=state.MaxTable; j++) + { + p_atos(&buf[0],"%d times table",j); + if (uGrowDCL(&ch,&buf[0])) + return; + } + if (uAddDCL("Test which tables",&state.Mode,&ch)) + return; + uRunDialog(); + } + +LOCAL_C VOID ExitApplication(VOID) + { + uErrorValue(p_setenviron(EnvName,ENV_NAME_LEN,&state,sizeof(TSTATE))); + p_exit(0); + } + +LOCAL_C VOID ManageCommand(INT index) + { + switch (index) + { + case 0: + ResetScore(); + break; + case 1: + ChangeLimits(); + break; + case 2: + ChangeMode(); + break; + case 3: + ChangeTiming(); + break; + case 4: + ExitApplication(); + } + } + +LOCAL_C VOID TryExecuteCommand(INT keycode) + { + keycode=uLocateCommand(keycode); + if (keycode>=0) + ManageCommand(keycode); + } + +LOCAL_C VOID MainLoop(VOID) + { + INT ret; + WMSG_KEY key; + + FOREVER + { + uGetKey(&key); + if (key.keycode&W_EVENT_KEY) + { + if (key.keycode==CONS_EVENT_COMMAND) + ExitApplication(); + } + else if (key.keycode&W_SPECIAL_KEY) + TryExecuteCommand(key.keycode&(~W_SPECIAL_KEY)); + else if (key.keycode==W_KEY_MENU && !(key.modifiers&W_CTRL_MODIFIER)) + { + ret=uPresentMenus(); + if (ret>0) + TryExecuteCommand(ret); + } + } + } + +LOCAL_C VOID ReadState(VOID) + { + INT len; + UBYTE buf[P_ENVMAX]; + + len=p_getenviron(EnvName,ENV_NAME_LEN,&buf[0]); + if (len<0 || len!=sizeof(TSTATE)) + return; + p_bcpy(&state,&buf[0],sizeof(TSTATE)); + } + +LOCAL_C VOID ReduceScreenSize(VOID) + { + W_WINDATA wd; + + wd.extent.tl.x=wd.extent.tl.y=0; + wd.extent.width=189; + wd.extent.height=80; + wSetWindow(MainWid,W_WIN_EXTENT,&wd); + if (uErrorValue(wCheckPoint())) + p_exit(0); + } + +LOCAL_C VOID CreateGC(VOID) + { + INT hgc; + + hgc=gCreateGC0(uFindMainWid()); + if (hgc<0) + p_exit(hgc); + } + +LOCAL_C VOID SpecificInit(VOID) + { + hCrackCommandLine(); + MainWid=uFindMainWid(); + ReduceScreenSize(); + CreateGC(); + gBorder(W_BORD_CORNER_4); + wsEnable(); + ReadState(); + } + +GLDEF_C VOID main(VOID) + { + uCommonInit(); + SpecificInit(); + MainLoop(); + } diff --git a/code/SIBOSDK/hwdemo/ta2.afl b/code/SIBOSDK/hwdemo/ta2.afl new file mode 100644 index 0000000..b866e4f --- /dev/null +++ b/code/SIBOSDK/hwdemo/ta2.afl @@ -0,0 +1,3 @@ +tables.pic +tables.rsc +tables.shd diff --git a/code/SIBOSDK/hwdemo/ta2.c b/code/SIBOSDK/hwdemo/ta2.c new file mode 100644 index 0000000..491ab46 --- /dev/null +++ b/code/SIBOSDK/hwdemo/ta2.c @@ -0,0 +1,340 @@ +/* + TA2.C +*/ + +#include +#include +#include +#include + +LOCAL_D TEXT *cmds[]= + { + "rReset score", + "lLimits", + "mMode", + "tTiming", + "xExit", + NULL + }; + +#define TABLES_ITEMS 5 + +LOCAL_D H_MENU_DATA mdata[]= + { + "Tables",TABLES_ITEMS, + NULL + }; + +GLDEF_D TEXT ** _cmds=(&cmds[0]); +GLDEF_D H_MENU_DATA * _mdata=(&mdata[0]); + + +LOCAL_D UINT MainWid; + +typedef struct + { + UWORD TableEnd; + UWORD MaxTable; + UWORD Tested; + UWORD Correct; + UWORD Timing; + UWORD Mode; + } TSTATE; + +LOCAL_D TSTATE state={12,12,0,0,5,1}; + +LOCAL_D TEXT *EnvName="TABLES"; +#define ENV_NAME_LEN 6 + + +LOCAL_C VOID DrawLine(INT j,TEXT *pb) + { + P_RECT box; + + box.tl.x=4; + box.br.x=189-4; + box.tl.y=4+9*j; + box.br.y=box.tl.y+9; + gPrintBoxText(&box,8,G_TEXT_ALIGN_CENTRE,0,pb,p_slen(pb)); + } + +LOCAL_C VOID DisplayScores(VOID) + { + TEXT buf[40]; + + p_atos(&buf[0],"Score: %u correct out of %u",state.Correct,state.Tested); + DrawLine(0,&buf[0]); + } + +LOCAL_C VOID DisplayMode(VOID) + { + TEXT *pb; + TEXT buf[40]; + + if (state.Mode==1) + pb="Testing all tables"; + else + { + p_atos(&buf[0],"Testing %d times table",state.Mode); + pb=(&buf[0]); + } + DrawLine(1,pb); + } + +LOCAL_C VOID DisplayLimits(VOID) + { + TEXT buf[40]; + + p_atos(&buf[0],"(up to %d times %d)", + (state.Mode==1? state.MaxTable: state.Mode),state.TableEnd); + DrawLine(2,&buf[0]); + } + +LOCAL_C VOID DrawButton(INT state) + { + P_RECT box; + + box.tl.x=34+36; + box.br.x=34+36+38; + box.tl.y=47; + box.br.y=47+14; + wDrawButton(&box,"Enter",state); + } + +LOCAL_C VOID DisplayPressButton(VOID) + { + gPrintText(34,56,"Press",5); + DrawButton(FALSE); + gPrintText(34+36+38+6,56,"to test",7); + } + +LOCAL_C VOID Display(VOID) + { + DisplayScores(); + DisplayMode(); + DisplayLimits(); + DisplayPressButton(); + } + +LOCAL_C VOID ResetScore(VOID) + { + if (!state.Tested) + { + wInfoMsg("No score to reset"); + return; + } + if (uOpenDialog("Reset score to zero")) + return; + if (uAddButtonList("No",-'n',"Yes",'y',NULL)) + return; + if (uRunDialog()=='y') + { + state.Tested=0; + state.Correct=0; + DisplayScores(); + } + } + +LOCAL_C VOID ChangeLimits(VOID) + { + LONG lTableEnd; + LONG lMaxTable; + H_DI_NUMBER end; + H_DI_NUMBER last; + + lTableEnd=state.TableEnd; + lMaxTable=state.MaxTable; + if (uOpenDialog("Limits for testing")) + return; + end.value=(&lTableEnd); + end.low=10; + end.high=99; + if (uAddDialogItem(H_DIALOG_NUMBER,"Tables end at",&end)) + return; + last.value=(&lMaxTable); + last.low=2; + last.high=99; + if (uAddDialogItem(H_DIALOG_NUMBER,"Highest table",&last)) + return; + if (uRunDialog()<=0) + return; + state.TableEnd=lTableEnd; + state.MaxTable=lMaxTable; + if (state.Mode>state.MaxTable) + state.Mode=state.MaxTable; + DisplayMode(); + DisplayLimits(); + } + +LOCAL_C VOID ChangeTiming(VOID) + { + LONG lTiming; + H_DI_NUMBER tim; + + lTiming=state.Timing; + if (uOpenDialog("Timing")) + return; + tim.value=(&lTiming); + tim.low=1; + tim.high=20; + if (uAddDialogItem(H_DIALOG_NUMBER,"Number of seconds allowed",&tim)) + return; + if (uRunDialog()<=0) + return; + state.Timing=lTiming; + } + +LOCAL_C VOID ChangeMode(VOID) + { + H_DI_CHOICE ch; + INT j; + TEXT buf[20]; + + if (uOpenDialog("Mode")) + return; + if (uBeginDCL(&ch)) + return; + if (uGrowDCL(&ch,"All tables")) + return; + for (j=2; j<=state.MaxTable; j++) + { + p_atos(&buf[0],"%d times table",j); + if (uGrowDCL(&ch,&buf[0])) + return; + } + if (uAddDCL("Test which tables",&state.Mode,&ch)) + return; + if (uRunDialog()<=0) + return; + DisplayMode(); + DisplayLimits(); + } + +LOCAL_C VOID ExitApplication(VOID) + { + uErrorValue(p_setenviron(EnvName,ENV_NAME_LEN,&state,sizeof(TSTATE))); + p_exit(0); + } + +LOCAL_C VOID ManageCommand(INT index) + { + switch (index) + { + case 0: + ResetScore(); + break; + case 1: + ChangeLimits(); + break; + case 2: + ChangeMode(); + break; + case 3: + ChangeTiming(); + break; + case 4: + ExitApplication(); + } + } + +LOCAL_C VOID TryExecuteCommand(INT keycode) + { + keycode=uLocateCommand(keycode); + if (keycode>=0) + ManageCommand(keycode); + } + +LOCAL_C VOID MakeButtonDance(VOID) + { + DrawButton(TRUE); + wFlush(); + p_sleep(2); + DrawButton(FALSE); + wFlush(); + p_sleep(2); + } + +LOCAL_C VOID DoTest(VOID) + { + MakeButtonDance(); + state.Tested++; + state.Correct++; + DisplayScores(); + } + +LOCAL_C VOID MainLoop(VOID) + { + INT ret; + WMSG_KEY key; + + FOREVER + { + uGetKey(&key); + if (key.keycode&W_EVENT_KEY) + { + if (key.keycode==CONS_EVENT_COMMAND) + ExitApplication(); + } + else if (key.keycode&W_SPECIAL_KEY) + TryExecuteCommand(key.keycode&(~W_SPECIAL_KEY)); + else if (key.keycode==W_KEY_MENU && !(key.modifiers&W_CTRL_MODIFIER)) + { + ret=uPresentMenus(); + if (ret>0) + TryExecuteCommand(ret); + } + else if (key.keycode==W_KEY_RETURN) + DoTest(); + } + } + +LOCAL_C VOID ReadState(VOID) + { + INT len; + UBYTE buf[P_ENVMAX]; + + len=p_getenviron(EnvName,ENV_NAME_LEN,&buf[0]); + if (len<0 || len!=sizeof(TSTATE)) + return; + p_bcpy(&state,&buf[0],sizeof(TSTATE)); + } + +LOCAL_C VOID ReduceScreenSize(VOID) + { + W_WINDATA wd; + + wd.extent.tl.x=wd.extent.tl.y=0; + wd.extent.width=189; + wd.extent.height=80; + wSetWindow(MainWid,W_WIN_EXTENT,&wd); + if (uErrorValue(wCheckPoint())) + p_exit(0); + } + +LOCAL_C VOID CreateGC(VOID) + { + INT hgc; + + hgc=gCreateGC0(uFindMainWid()); + if (hgc<0) + p_exit(hgc); + } + +LOCAL_C VOID SpecificInit(VOID) + { + hCrackCommandLine(); + MainWid=uFindMainWid(); + ReduceScreenSize(); + CreateGC(); + gBorder(W_BORD_CORNER_4); + wsEnable(); + ReadState(); + Display(); + } + +GLDEF_C VOID main(VOID) + { + uCommonInit(); + SpecificInit(); + MainLoop(); + } diff --git a/code/SIBOSDK/hwdemo/ta3.afl b/code/SIBOSDK/hwdemo/ta3.afl new file mode 100644 index 0000000..b866e4f --- /dev/null +++ b/code/SIBOSDK/hwdemo/ta3.afl @@ -0,0 +1,3 @@ +tables.pic +tables.rsc +tables.shd diff --git a/code/SIBOSDK/hwdemo/ta3.c b/code/SIBOSDK/hwdemo/ta3.c new file mode 100644 index 0000000..6df7e2e --- /dev/null +++ b/code/SIBOSDK/hwdemo/ta3.c @@ -0,0 +1,517 @@ +/* + TA3.C +*/ + +#include +#include +#include +#include + + +GLREF_D UWORD DatLocked; + +LOCAL_D TEXT *cmds[]= + { + "rReset score", + "lLimits", + "mMode", + "tTiming", + "xExit", + NULL + }; + +#define TABLES_ITEMS 5 + +LOCAL_D H_MENU_DATA mdata[]= + { + "Tables",TABLES_ITEMS, + NULL + }; + +GLDEF_D TEXT ** _cmds=(&cmds[0]); +GLDEF_D H_MENU_DATA * _mdata=(&mdata[0]); + + +LOCAL_D UINT MainWid; + +typedef struct + { + UWORD TableEnd; + UWORD MaxTable; + UWORD Tested; + UWORD Correct; + UWORD Timing; + UWORD Mode; + } TSTATE; + +LOCAL_D TSTATE state={12,12,0,0,5,1}; + +LOCAL_D TEXT *EnvName="TABLES"; +#define ENV_NAME_LEN 6 + +LOCAL_D ULONG seed; + + +LOCAL_C VOID DrawLine(INT j,TEXT *pb) + { + P_RECT box; + + box.tl.x=4; + box.br.x=189-4; + box.tl.y=4+9*j; + box.br.y=box.tl.y+9; + gPrintBoxText(&box,8,G_TEXT_ALIGN_CENTRE,0,pb,p_slen(pb)); + } + +LOCAL_C VOID DisplayScores(VOID) + { + TEXT buf[40]; + + p_atos(&buf[0],"Score: %u correct out of %u",state.Correct,state.Tested); + DrawLine(0,&buf[0]); + } + +LOCAL_C VOID DisplayMode(VOID) + { + TEXT *pb; + TEXT buf[40]; + + if (state.Mode==1) + pb="Testing all tables"; + else + { + p_atos(&buf[0],"Testing %d times table",state.Mode); + pb=(&buf[0]); + } + DrawLine(1,pb); + } + +LOCAL_C VOID DisplayLimits(VOID) + { + TEXT buf[40]; + + p_atos(&buf[0],"(up to %d times %d)", + (state.Mode==1? state.MaxTable: state.Mode),state.TableEnd); + DrawLine(2,&buf[0]); + } + +LOCAL_C VOID DrawButton(INT state) + { + P_RECT box; + + box.tl.x=34+36; + box.br.x=34+36+38; + box.tl.y=47; + box.br.y=47+14; + wDrawButton(&box,"Enter",state); + } + +LOCAL_C VOID DisplayPressButton(VOID) + { + gPrintText(34,56,"Press",5); + DrawButton(FALSE); + gPrintText(34+36+38+6,56,"to test",7); + } + +LOCAL_C VOID Display(VOID) + { + DisplayScores(); + DisplayMode(); + DisplayLimits(); + DisplayPressButton(); + } + +LOCAL_C VOID ResetScore(VOID) + { + if (!state.Tested) + { + wInfoMsg("No score to reset"); + return; + } + if (uOpenDialog("Reset score to zero")) + return; + if (uAddButtonList("No",-'n',"Yes",'y',NULL)) + return; + if (uRunDialog()=='y') + { + state.Tested=0; + state.Correct=0; + DisplayScores(); + } + } + +LOCAL_C VOID ChangeLimits(VOID) + { + LONG lTableEnd; + LONG lMaxTable; + H_DI_NUMBER end; + H_DI_NUMBER last; + + lTableEnd=state.TableEnd; + lMaxTable=state.MaxTable; + if (uOpenDialog("Limits for testing")) + return; + end.value=(&lTableEnd); + end.low=10; + end.high=99; + if (uAddDialogItem(H_DIALOG_NUMBER,"Tables end at",&end)) + return; + last.value=(&lMaxTable); + last.low=2; + last.high=99; + if (uAddDialogItem(H_DIALOG_NUMBER,"Highest table",&last)) + return; + if (uRunDialog()<=0) + return; + state.TableEnd=lTableEnd; + state.MaxTable=lMaxTable; + if (state.Mode>state.MaxTable) + state.Mode=state.MaxTable; + DisplayMode(); + DisplayLimits(); + } + +LOCAL_C VOID ChangeTiming(VOID) + { + LONG lTiming; + H_DI_NUMBER tim; + + lTiming=state.Timing; + if (uOpenDialog("Timing")) + return; + tim.value=(&lTiming); + tim.low=1; + tim.high=20; + if (uAddDialogItem(H_DIALOG_NUMBER,"Number of seconds allowed",&tim)) + return; + if (uRunDialog()<=0) + return; + state.Timing=lTiming; + } + +LOCAL_C VOID ChangeMode(VOID) + { + H_DI_CHOICE ch; + INT j; + TEXT buf[20]; + + if (uOpenDialog("Mode")) + return; + if (uBeginDCL(&ch)) + return; + if (uGrowDCL(&ch,"All tables")) + return; + for (j=2; j<=state.MaxTable; j++) + { + p_atos(&buf[0],"%d times table",j); + if (uGrowDCL(&ch,&buf[0])) + return; + } + if (uAddDCL("Test which tables",&state.Mode,&ch)) + return; + if (uRunDialog()<=0) + return; + DisplayMode(); + DisplayLimits(); + } + +LOCAL_C VOID ExitApplication(VOID) + { + uErrorValue(p_setenviron(EnvName,ENV_NAME_LEN,&state,sizeof(TSTATE))); + p_exit(0); + } + +LOCAL_C VOID ManageCommand(INT index) + { + switch (index) + { + case 0: + ResetScore(); + break; + case 1: + ChangeLimits(); + break; + case 2: + ChangeMode(); + break; + case 3: + ChangeTiming(); + break; + case 4: + ExitApplication(); + } + } + +LOCAL_C VOID TryExecuteCommand(INT keycode) + { + keycode=uLocateCommand(keycode); + if (keycode>=0) + ManageCommand(keycode); + } + +LOCAL_C INT FindRandom(INT low,INT high) + { + INT range; + + range=high-low+1; + return(low+(INT)(p_randl(&seed)%range)); + } + +LOCAL_C VOID FindFactors(WORD *pa,WORD *pb) + { + *pa=(state.Mode==1? FindRandom(2,state.MaxTable): state.Mode); + *pb=FindRandom(2,state.TableEnd); + } + +LOCAL_C VOID SwitchStyle(INT style) + { + G_GC gc; + + gc.style=style; + gSetGC(0,G_GC_MASK_STYLE,&gc); + } + +LOCAL_C VOID *CreateEditor(VOID) + { + H_EDIT_BOX heb; + + heb.maxchars=4; + heb.vulen=30; + heb.pos.x=113; + heb.pos.y=45; + heb.win=MainWid; + heb.font=WS_FONT_BASE; + heb.style=G_STY_DOUBLE; + return(hEBOpen(H_EDIT_BOX_FONT,&heb)); + } + +LOCAL_C VOID ClearBottomArea(VOID) + { + P_RECT box; + + box.tl.x=4; + box.br.x=189-4; + box.tl.y=4+3*9; + box.br.y=80-4; + gClrRect(&box,G_TRMODE_CLR); + } + +LOCAL_C VOID Beep(VOID) + { + p_sound(-5,320); + } + +LOCAL_C VOID SelectAll(VOID *ebH) + { + hEBSetSelect(ebH,0,p_slen(hEBSenseText(ebH))); + } + +LOCAL_C INT SenseNumberTyped(VOID *ebH) + { + TEXT *pb; + WORD num; + + pb=hEBSenseText(ebH); + p_stoi(&pb,&num); + return(num); + } + +LOCAL_C INT AddTextItem(TEXT *pmt,TEXT *pbod) + { + H_DI_TEXT txt; + TEXT buf[20]; + + txt.type=H_DTEXT_ALIGN_CENTRE; + uZTStoBCS(txt.str=(&buf[0]),pbod); + return(uAddDialogItem(H_DIALOG_TEXT,pmt,&txt)); + } + +LOCAL_C INT Complain(INT a,INT b,INT c) + { + TEXT buf[20]; + + if (uOpenDialog("Incorrect")) + return(-1); + p_atos(&buf[0],"%d \236 %d",a,b); + if (AddTextItem("The question",&buf[0])) + return(-1); + buf[p_itob(&buf[0],c)]=0; + if (AddTextItem("Your answer",&buf[0])) + return(-1); + if (uAddButtonList("Help",W_KEY_ESCAPE,"Retry",W_KEY_RETURN,NULL)) + return(-1); + if (uRunDialog()==W_KEY_RETURN) + return(0); + p_atos(&buf[0],"%d \236 %d = %d",a,b,a*b); + if (uOpenDialog(&buf[0])) + return(-1); + if (uAddButtonList("Continue",W_KEY_RETURN,NULL)) + return(-1); + uRunDialog(); + return(-1); + } + +LOCAL_C INT BadKey(INT k) + { + return(k<256 && p_isprint(k) && !p_isdigit(k)); + } + +LOCAL_C VOID DisplayQuestion(VOID) + { + TEXT buf[30]; + WMSG_KEY key; + P_RECT box; + VOID *ebH; + WORD a; + WORD b; + WORD c; + WORD ans; + + ebH=CreateEditor(); + if (!ebH) + return; + ClearBottomArea(); + hEBEmphasise(ebH,TRUE); + FindFactors(&a,&b); + ans=a*b; + p_atos(&buf[0],"%d \236 %d = ",a,b); + box.tl.x=53; + box.br.x=113; + box.tl.y=45; + box.br.y=45+17; + SwitchStyle(G_STY_DOUBLE); + gPrintBoxText(&box,15,G_TEXT_ALIGN_RIGHT,0,&buf[0],p_slen(&buf[0])); + SwitchStyle(G_STY_NORMAL); + DatLocked=TRUE; + state.Tested++; + FOREVER + { + uGetKey(&key); + if (BadKey(key.keycode)) + Beep(); + else if (key.keycode!=W_KEY_RETURN) + hEBHandleKey(ebH,key.keycode,key.modifiers); + else + { + c=SenseNumberTyped(ebH); + if (c==ans) + { + state.Correct++; + break; + } + Beep(); + hEBEmphasise(ebH,FALSE); + if (Complain(a,b,c)) + break; + DisplayScores(); + state.Tested++; + hEBEmphasise(ebH,TRUE); + SelectAll(ebH); + } + } + DatLocked=FALSE; + hEBClose(ebH); + ClearBottomArea(); + DisplayPressButton(); + } + +LOCAL_C VOID MakeButtonDance(VOID) + { + DrawButton(TRUE); + wFlush(); + p_sleep(2); + DrawButton(FALSE); + wFlush(); + p_sleep(2); + } + +LOCAL_C VOID DoTest(VOID) + { + MakeButtonDance(); + DisplayQuestion(); + DisplayScores(); + } + +LOCAL_C VOID MainLoop(VOID) + { + INT ret; + WMSG_KEY key; + + FOREVER + { + uGetKey(&key); + if (key.keycode&W_EVENT_KEY) + { + if (key.keycode==CONS_EVENT_COMMAND) + ExitApplication(); + } + else if (key.keycode&W_SPECIAL_KEY) + TryExecuteCommand(key.keycode&(~W_SPECIAL_KEY)); + else if (key.keycode==W_KEY_MENU && !(key.modifiers&W_CTRL_MODIFIER)) + { + ret=uPresentMenus(); + if (ret>0) + TryExecuteCommand(ret); + } + else if (key.keycode==W_KEY_RETURN) + DoTest(); + } + } + +LOCAL_C VOID ReadState(VOID) + { + INT len; + UBYTE buf[P_ENVMAX]; + + len=p_getenviron(EnvName,ENV_NAME_LEN,&buf[0]); + if (len<0 || len!=sizeof(TSTATE)) + return; + p_bcpy(&state,&buf[0],sizeof(TSTATE)); + } + +LOCAL_C VOID InitSeed(VOID) + { + seed=p_date(); + } + +LOCAL_C VOID ReduceScreenSize(VOID) + { + W_WINDATA wd; + + wd.extent.tl.x=wd.extent.tl.y=0; + wd.extent.width=189; + wd.extent.height=80; + wSetWindow(MainWid,W_WIN_EXTENT,&wd); + if (uErrorValue(wCheckPoint())) + p_exit(0); + } + +LOCAL_C VOID CreateGC(VOID) + { + INT hgc; + + hgc=gCreateGC0(uFindMainWid()); + if (hgc<0) + p_exit(hgc); + } + +LOCAL_C VOID SpecificInit(VOID) + { + uEscape(FALSE); + hCrackCommandLine(); + MainWid=uFindMainWid(); + ReduceScreenSize(); + CreateGC(); + gBorder(W_BORD_CORNER_4); + wsEnable(); + ReadState(); + Display(); + InitSeed(); + } + +GLDEF_C VOID main(VOID) + { + uCommonInit(); + SpecificInit(); + MainLoop(); + } diff --git a/code/SIBOSDK/hwdemo/tables.afl b/code/SIBOSDK/hwdemo/tables.afl new file mode 100644 index 0000000..b866e4f --- /dev/null +++ b/code/SIBOSDK/hwdemo/tables.afl @@ -0,0 +1,3 @@ +tables.pic +tables.rsc +tables.shd diff --git a/code/SIBOSDK/hwdemo/tables.c b/code/SIBOSDK/hwdemo/tables.c new file mode 100644 index 0000000..9624a50 --- /dev/null +++ b/code/SIBOSDK/hwdemo/tables.c @@ -0,0 +1,626 @@ +/* + + TABLES.C + +Written by DavidW +Started on 21/1/92 + +*/ + +#include +#include +#include +#include +#include + + +GLREF_D UWORD DatLocked; + +LOCAL_D TEXT *cmds[]= + { + "rReset score", + "lLimits", + "mMode", + "tTiming", + "xExit", + NULL + }; + +#define TABLES_ITEMS 5 + +LOCAL_D H_MENU_DATA mdata[]= + { + "Tables",TABLES_ITEMS, + NULL + }; + +GLDEF_D TEXT ** _cmds=(&cmds[0]); +GLDEF_D H_MENU_DATA * _mdata=(&mdata[0]); + + +LOCAL_D UINT MainWid; + +typedef struct + { + UWORD TableEnd; + UWORD MaxTable; + UWORD Tested; + UWORD Correct; + UWORD Timing; + UWORD Mode; + } TSTATE; + +LOCAL_D TSTATE state={12,12,0,0,5,1}; + +LOCAL_D TEXT *EnvName="TABLES"; +#define ENV_NAME_LEN 6 + +LOCAL_D ULONG seed; + +LOCAL_D VOID *timH; +LOCAL_D WORD timactive; +LOCAL_D WORD timstat; +LOCAL_D ULONG timint; +LOCAL_D WORD timcount; +LOCAL_D WORD timtotcnt; + + +LOCAL_C VOID DrawLine(INT j,TEXT *pb) + { + P_RECT box; + + box.tl.x=4; + box.br.x=189-4; + box.tl.y=4+9*j; + box.br.y=box.tl.y+9; + gPrintBoxText(&box,8,G_TEXT_ALIGN_CENTRE,0,pb,p_slen(pb)); + } + +LOCAL_C VOID DisplayScores(VOID) + { + TEXT buf[40]; + + p_atos(&buf[0],"Score: %u correct out of %u",state.Correct,state.Tested); + DrawLine(0,&buf[0]); + } + +LOCAL_C VOID DisplayMode(VOID) + { + TEXT *pb; + TEXT buf[40]; + + if (state.Mode==1) + pb="Testing all tables"; + else + { + p_atos(&buf[0],"Testing %d times table",state.Mode); + pb=(&buf[0]); + } + DrawLine(1,pb); + } + +LOCAL_C VOID DisplayLimits(VOID) + { + TEXT buf[40]; + + p_atos(&buf[0],"(up to %d times %d)", + (state.Mode==1? state.MaxTable: state.Mode),state.TableEnd); + DrawLine(2,&buf[0]); + } + +LOCAL_C VOID DrawButton(INT state) + { + P_RECT box; + + box.tl.x=34+36; + box.br.x=34+36+38; + box.tl.y=47; + box.br.y=47+14; + wDrawButton(&box,"Enter",state); + } + +LOCAL_C VOID DisplayPressButton(VOID) + { + gPrintText(34,56,"Press",5); + DrawButton(FALSE); + gPrintText(34+36+38+6,56,"to test",7); + } + +LOCAL_C VOID Display(VOID) + { + DisplayScores(); + DisplayMode(); + DisplayLimits(); + DisplayPressButton(); + } + +LOCAL_C VOID ResetScore(VOID) + { + if (!state.Tested) + { + wInfoMsg("No score to reset"); + return; + } + if (uOpenDialog("Reset score to zero")) + return; + if (uAddButtonList("No",-'n',"Yes",'y',NULL)) + return; + if (uRunDialog()=='y') + { + state.Tested=0; + state.Correct=0; + DisplayScores(); + } + } + +LOCAL_C VOID ChangeLimits(VOID) + { + LONG lTableEnd; + LONG lMaxTable; + H_DI_NUMBER end; + H_DI_NUMBER last; + + lTableEnd=state.TableEnd; + lMaxTable=state.MaxTable; + if (uOpenDialog("Limits for testing")) + return; + end.value=(&lTableEnd); + end.low=10; + end.high=99; + if (uAddDialogItem(H_DIALOG_NUMBER,"Tables end at",&end)) + return; + last.value=(&lMaxTable); + last.low=2; + last.high=99; + if (uAddDialogItem(H_DIALOG_NUMBER,"Highest table",&last)) + return; + if (uRunDialog()<=0) + return; + state.TableEnd=lTableEnd; + state.MaxTable=lMaxTable; + if (state.Mode>state.MaxTable) + state.Mode=state.MaxTable; + DisplayMode(); + DisplayLimits(); + } + +LOCAL_C VOID ChangeTiming(VOID) + { + LONG lTiming; + H_DI_NUMBER tim; + + lTiming=state.Timing; + if (uOpenDialog("Timing")) + return; + tim.value=(&lTiming); + tim.low=1; + tim.high=20; + if (uAddDialogItem(H_DIALOG_NUMBER,"Number of seconds allowed",&tim)) + return; + if (uRunDialog()<=0) + return; + state.Timing=lTiming; + } + +LOCAL_C VOID ChangeMode(VOID) + { + H_DI_CHOICE ch; + INT j; + TEXT buf[20]; + + if (uOpenDialog("Mode")) + return; + if (uBeginDCL(&ch)) + return; + if (uGrowDCL(&ch,"All tables")) + return; + for (j=2; j<=state.MaxTable; j++) + { + p_atos(&buf[0],"%d times table",j); + if (uGrowDCL(&ch,&buf[0])) + return; + } + if (uAddDCL("Test which tables",&state.Mode,&ch)) + return; + if (uRunDialog()<=0) + return; + DisplayMode(); + DisplayLimits(); + } + +LOCAL_C VOID ExitApplication(VOID) + { + uErrorValue(p_setenviron(EnvName,ENV_NAME_LEN,&state,sizeof(TSTATE))); + p_exit(0); + } + +LOCAL_C VOID ManageCommand(INT index) + { + switch (index) + { + case 0: + ResetScore(); + break; + case 1: + ChangeLimits(); + break; + case 2: + ChangeMode(); + break; + case 3: + ChangeTiming(); + break; + case 4: + ExitApplication(); + } + } + +LOCAL_C VOID TryExecuteCommand(INT keycode) + { + keycode=uLocateCommand(keycode); + if (keycode>=0) + ManageCommand(keycode); + } + +LOCAL_C INT FindRandom(INT low,INT high) + { + INT range; + + range=high-low+1; + return(low+(INT)(p_randl(&seed)%range)); + } + +LOCAL_C VOID FindFactors(WORD *pa,WORD *pb) + { + *pa=(state.Mode==1? FindRandom(2,state.MaxTable): state.Mode); + *pb=FindRandom(2,state.TableEnd); + } + +LOCAL_C VOID SwitchStyle(INT style) + { + G_GC gc; + + gc.style=style; + gSetGC(0,G_GC_MASK_STYLE,&gc); + } + +LOCAL_C VOID *CreateEditor(VOID) + { + H_EDIT_BOX heb; + + heb.maxchars=4; + heb.vulen=30; + heb.pos.x=113; + heb.pos.y=38; + heb.win=MainWid; + heb.font=WS_FONT_BASE; + heb.style=G_STY_DOUBLE; + return(hEBOpen(H_EDIT_BOX_FONT,&heb)); + } + +LOCAL_C VOID ClearBottomArea(VOID) + { + P_RECT box; + + box.tl.x=4; + box.br.x=189-4; + box.tl.y=4+3*9; + box.br.y=80-4; + gClrRect(&box,G_TRMODE_CLR); + } + +LOCAL_C VOID Beep(VOID) + { + p_sound(-5,320); + } + +LOCAL_C VOID SelectAll(VOID *ebH) + { + hEBSetSelect(ebH,0,p_slen(hEBSenseText(ebH))); + } + +LOCAL_C INT SenseNumberTyped(VOID *ebH) + { + TEXT *pb; + WORD num; + + pb=hEBSenseText(ebH); + if (!*pb) + return(0); + p_stoi(&pb,&num); + return(num); + } + +LOCAL_C INT AddTextItem(TEXT *pmt,TEXT *pbod) + { + H_DI_TEXT txt; + TEXT buf[20]; + + txt.type=H_DTEXT_ALIGN_CENTRE; + uZTStoBCS(txt.str=(&buf[0]),pbod); + return(uAddDialogItem(H_DIALOG_TEXT,pmt,&txt)); + } + +LOCAL_C INT Complain(INT a,INT b,INT c) + { + TEXT buf[20]; + + if (uOpenDialog("Incorrect")) + return(-1); + p_atos(&buf[0],"%d \236 %d",a,b); + if (AddTextItem("The question",&buf[0])) + return(-1); + buf[p_itob(&buf[0],c)]=0; + if (AddTextItem("Your answer",&buf[0])) + return(-1); + if (uAddButtonList("Help",W_KEY_ESCAPE,"Retry",W_KEY_RETURN,NULL)) + return(-1); + if (uRunDialog()==W_KEY_RETURN) + return(0); + p_atos(&buf[0],"%d \236 %d = %d",a,b,a*b); + if (uOpenDialog(&buf[0])) + return(-1); + if (uAddButtonList("Continue",W_KEY_RETURN,NULL)) + return(-1); + uRunDialog(); + return(-1); + } + +LOCAL_C INT BadKey(INT k) + { + return(k<256 && p_isprint(k) && !p_isdigit(k)); + } + +LOCAL_C VOID CancelTimer(VOID) + { + if (timactive) + { + p_iow2(timH,P_FCANCEL); + p_waitstat(&timstat); + } + timactive=FALSE; + } + +LOCAL_C VOID QueueTimer(VOID) + { + CancelTimer(); + p_ioa4(timH,P_FRELATIVE,&timstat,&timint); + timactive=TRUE; + } + +LOCAL_C VOID InitialiseTimer(VOID) + { + if (state.Timing<=4) + { + timint=5; + timcount=2*state.Timing; + } + else + { + timint=10; + timcount=state.Timing; + } + timtotcnt=timcount; + QueueTimer(); + } + +LOCAL_C VOID GetBarChartRect(P_RECT *pbox) + { + pbox->tl.x=9; + pbox->br.x=180; + pbox->tl.y=62; + pbox->br.y=68; + } + +LOCAL_C VOID IncrementBarChart(VOID) + { + P_RECT box; + + timcount--; + GetBarChartRect(&box); + box.br.x=9+171*(timtotcnt-timcount)/timtotcnt; + gFillPattern(&box,WS_BITMAP_GREY,G_TRMODE_REPL); + } + +LOCAL_C VOID ClearBarChart(VOID) + { + P_RECT box; + + GetBarChartRect(&box); + gClrRect(&box,G_TRMODE_CLR); + } + +LOCAL_C VOID DisplayQuestion(VOID) + { + TEXT buf[30]; + WMSG_KEY key; + WORD keyactive; + WORD keystat; + P_RECT box; + VOID *ebH; + WORD a; + WORD b; + WORD c; + WORD ans; + + ebH=CreateEditor(); + if (!ebH) + return; + ClearBottomArea(); + hEBEmphasise(ebH,TRUE); + FindFactors(&a,&b); + ans=a*b; + p_atos(&buf[0],"%d \236 %d = ",a,b); + box.tl.x=53; + box.br.x=113; + box.tl.y=38; + box.br.y=38+17; + SwitchStyle(G_STY_DOUBLE); + gPrintBoxText(&box,15,G_TEXT_ALIGN_RIGHT,0,&buf[0],p_slen(&buf[0])); + SwitchStyle(G_STY_NORMAL); + box.tl.x=8; + box.br.x=189-8; + box.tl.y=61; + box.br.y=61+8; + gBorderRect(&box,W_BORD_CORNER_1); + DatLocked=TRUE; + state.Tested++; + keyactive=FALSE; + InitialiseTimer(); + FOREVER + { + if (keyactive) + wFlush(); + else + { + uGetKeyA(&keystat,&key); + keyactive=TRUE; + } + p_iowait(); + if (keystat==E_FILE_PENDING) + { + timactive=FALSE; + IncrementBarChart(); + if (!timcount) + { + wFlush(); + p_sleep(2); + goto CheckAnswer; + } + QueueTimer(); + continue; + } + keyactive=FALSE; + if (BadKey(key.keycode)) + Beep(); + else if (key.keycode!=W_KEY_RETURN) + hEBHandleKey(ebH,key.keycode,key.modifiers); + else + { + CheckAnswer: + c=SenseNumberTyped(ebH); + if (c==ans) + { + state.Correct++; + break; + } + Beep(); + hEBEmphasise(ebH,FALSE); + if (Complain(a,b,c)) + break; + DisplayScores(); + state.Tested++; + hEBEmphasise(ebH,TRUE); + SelectAll(ebH); + ClearBarChart(); + InitialiseTimer(); + } + } + DatLocked=FALSE; + hEBClose(ebH); + ClearBottomArea(); + DisplayPressButton(); + CancelTimer(); + } + +LOCAL_C VOID MakeButtonDance(VOID) + { + DrawButton(TRUE); + wFlush(); + p_sleep(2); + DrawButton(FALSE); + wFlush(); + p_sleep(2); + } + +LOCAL_C VOID DoTest(VOID) + { + MakeButtonDance(); + DisplayQuestion(); + DisplayScores(); + } + +LOCAL_C VOID MainLoop(VOID) + { + INT ret; + WMSG_KEY key; + + FOREVER + { + uGetKey(&key); + if (key.keycode&W_EVENT_KEY) + { + if (key.keycode==CONS_EVENT_COMMAND) + ExitApplication(); + } + else if (key.keycode&W_SPECIAL_KEY) + TryExecuteCommand(key.keycode&(~W_SPECIAL_KEY)); + else if (key.keycode==W_KEY_MENU && !(key.modifiers&W_CTRL_MODIFIER)) + { + ret=uPresentMenus(); + if (ret>0) + TryExecuteCommand(ret); + } + else if (key.keycode==W_KEY_RETURN) + DoTest(); + } + } + +LOCAL_C VOID ReadState(VOID) + { + INT len; + UBYTE buf[P_ENVMAX]; + + len=p_getenviron(EnvName,ENV_NAME_LEN,&buf[0]); + if (len<0 || len!=sizeof(TSTATE)) + return; + p_bcpy(&state,&buf[0],sizeof(TSTATE)); + } + +LOCAL_C VOID InitSeed(VOID) + { + seed=p_date(); + } + +LOCAL_C VOID ReduceScreenSize(VOID) + { + W_WINDATA wd; + + wd.extent.tl.x=wd.extent.tl.y=0; + wd.extent.width=189; + wd.extent.height=80; + wSetWindow(MainWid,W_WIN_EXTENT,&wd); + if (uErrorValue(wCheckPoint())) + p_exit(0); + } + +LOCAL_C VOID CreateGC(VOID) + { + INT hgc; + + hgc=gCreateGC0(uFindMainWid()); + if (hgc<0) + p_exit(hgc); + } + +LOCAL_C VOID SpecificInit(VOID) + { + uEscape(FALSE); + hCrackCommandLine(); + MainWid=uFindMainWid(); + ReduceScreenSize(); + CreateGC(); + gBorder(W_BORD_CORNER_4); + wsEnable(); + ReadState(); + Display(); + InitSeed(); + p_open(&timH,"TIM:",-1); + } + +GLDEF_C VOID main(VOID) + { + uCommonInit(); + SpecificInit(); + MainLoop(); + } diff --git a/code/SIBOSDK/hwdemo/tables.ms b/code/SIBOSDK/hwdemo/tables.ms new file mode 100644 index 0000000..5f173d5 --- /dev/null +++ b/code/SIBOSDK/hwdemo/tables.ms @@ -0,0 +1 @@ +Tables diff --git a/code/SIBOSDK/hwdemo/tables.pic b/code/SIBOSDK/hwdemo/tables.pic new file mode 100644 index 0000000..67f7507 Binary files /dev/null and b/code/SIBOSDK/hwdemo/tables.pic differ diff --git a/code/SIBOSDK/hwdemo/tables.rsc b/code/SIBOSDK/hwdemo/tables.rsc new file mode 100644 index 0000000..e69de29 diff --git a/code/SIBOSDK/hwdemo/tables.shd b/code/SIBOSDK/hwdemo/tables.shd new file mode 100644 index 0000000..9e5433e Binary files /dev/null and b/code/SIBOSDK/hwdemo/tables.shd differ diff --git a/code/SIBOSDK/hwdemo/tele.afl b/code/SIBOSDK/hwdemo/tele.afl new file mode 100644 index 0000000..3b8eaf6 --- /dev/null +++ b/code/SIBOSDK/hwdemo/tele.afl @@ -0,0 +1,3 @@ +tele.pic +tele.rsc +tele.shd diff --git a/code/SIBOSDK/hwdemo/tele.c b/code/SIBOSDK/hwdemo/tele.c new file mode 100644 index 0000000..a141443 --- /dev/null +++ b/code/SIBOSDK/hwdemo/tele.c @@ -0,0 +1,1055 @@ +/* + TELE.C + +Written by DavidW +Started on 20/11/91 + +*/ + +#include +#include +#include +#include +#include + +GLREF_D UWORD DatLocked; +GLREF_D TEXT *DatUsedPathNamePtr; + + +LOCAL_D TEXT *cmds[]= + { + "nNew", + "oOpen", + "mMerge", + "sSave as", + "kCompress", + "xExit", + "iInsert", + "cCopy", + "uUpdate", + "aAdd", + "dDelete", + "rFind previous", + "fFind", + "gFind next", + "jJump to", + "zSort", + "lDial", + "yPrint setup", + "pPrint", + NULL + }; + +#define FILE_ITEMS 6 +#define EDIT_ITEMS 5 +#define FIND_ITEMS 3 +#define SPECIAL_ITEMS 5 + +#define ITEMS_BEFORE_FILE 0 +#define ITEMS_BEFORE_EDIT FILE_ITEMS +#define ITEMS_BEFORE_FIND (ITEMS_BEFORE_EDIT+EDIT_ITEMS) +#define ITEMS_BEFORE_SPECIAL (ITEMS_BEFORE_FIND+FIND_ITEMS) + +LOCAL_D H_MENU_DATA mdata[]= + { + "File",FILE_ITEMS, + "Edit",EDIT_ITEMS, + "Find",FIND_ITEMS, + "Special",SPECIAL_ITEMS, + NULL + }; + +GLDEF_D TEXT ** _cmds=(&cmds[0]); +GLDEF_D H_MENU_DATA * _mdata=(&mdata[0]); + + +LOCAL_D UINT MainWid; + +LOCAL_D struct + { + UWORD dataStart; + UWORD needVersion; + UWORD firHeader; + UBYTE fir[3]; + } ModelHeader= + { + DbfHeaderLength, + 0x100f, + (DbfRecordTypeFir<<12)|3, + { + DbfFieldTypeString, + DbfFieldTypeString, + DbfFieldTypeWord + } + }; + +LOCAL_D TEXT filename[P_FNAMESIZE]; +LOCAL_D VOID *dH; +LOCAL_D UBYTE dBuf[512]; +LOCAL_D UWORD dOff; + +typedef struct + { + TEXT nam[20]; + TEXT dep[4]; + WORD nmb; + } ENTRY; + +LOCAL_D ENTRY clip; +LOCAL_D UWORD clipfill=FALSE; + +LOCAL_D TEXT find[22]={0}; + +LOCAL_D UWORD PrintState; +LOCAL_D TEXT PrintBuf[10]; +LOCAL_D UWORD PrintRec; +LOCAL_D ENTRY PrintEnt; + +#define NAME_TLY 4 +#define DEPT_TLY 24 +#define TELE_TLY 44 +#define COUNT_TLY 58 +#define TEXT_HEIGHT 18 +#define TEXT_ASCENT 16 + +#define LABEL_TLX 15 +#define LABEL_WID 30 +#define FIELD_TLX 65 +#define FIELD_WID 120 +#define COUNT_TLX 105 +#define COUNT_WID 75 + +#define TRN_CALL call(reg_param=>(bx,si),reg_saved=>(cx,dx,di,EPOC_SAVE)) + + +LOCAL_C VOID DisplayPrompt(INT tly,TEXT *buf) + { + P_RECT box; + + box.tl.y=tly; + box.tl.x=LABEL_TLX; + box.br.x=LABEL_TLX+LABEL_WID; + box.br.y=tly+TEXT_HEIGHT; + gPrintBoxText(&box,TEXT_ASCENT,G_TEXT_ALIGN_CENTRE,0,buf,p_slen(buf)); + } + +LOCAL_C VOID DisplayPrompts(VOID) + { + DisplayPrompt(NAME_TLY,"Name"); + DisplayPrompt(DEPT_TLY,"Dept"); + DisplayPrompt(TELE_TLY,"\05"); + } + +LOCAL_C VOID DisplayField(INT tly,TEXT *buf,INT len) + { + P_RECT box; + + box.tl.y=tly; + box.tl.x=FIELD_TLX; + box.br.x=FIELD_TLX+FIELD_WID; + box.br.y=tly+TEXT_HEIGHT; + gPrintBoxText(&box,TEXT_ASCENT,G_TEXT_ALIGN_LEFT,0,buf,len); + } + +LOCAL_C VOID DisplayCount(TEXT *buf) + { + P_RECT box; + + box.tl.x=COUNT_TLX; + box.tl.y=COUNT_TLY; + box.br.x=COUNT_TLX+COUNT_WID; + box.br.y=COUNT_TLY+TEXT_HEIGHT; + gPrintBoxText(&box,TEXT_ASCENT,G_TEXT_ALIGN_RIGHT,0,buf,p_slen(buf)); + } + +LOCAL_C VOID BufToEntry(ENTRY *pent) + { + UBYTE *psrc; + INT len; + + psrc=(&dBuf[dOff+2]); + len=(*psrc)+1; + p_bcpy(&pent->nam[0],psrc,len); + psrc+=len; + len=(*psrc)+1; + p_bcpy(&pent->dep[0],psrc,len); + psrc+=len; + pent->nmb=(*(WORD *)psrc); + } + +LOCAL_C VOID CleanEntry(ENTRY *pent) + { + p_bfil(pent,sizeof(ENTRY),0); + } + +LOCAL_C VOID Display(VOID) + { + ENTRY ent; + UWORD count; + TEXT buf[12]; + TEXT num[4]; + INT len; + + count=DbfCount(dH); + if (count) + { + p_atos(&buf[0],"%u/%u",DbfSense(dH)+1,count); + BufToEntry(&ent); + } + else + { + p_scpy(&buf[0],"Empty"); + CleanEntry(&ent); + } + DisplayField(NAME_TLY,&ent.nam[1],ent.nam[0]); + DisplayField(DEPT_TLY,&ent.dep[1],ent.dep[0]); + if (ent.nmb) + len=p_itob(&num[0],ent.nmb); + else + len=0; + DisplayField(TELE_TLY,&num[0],len); + DisplayCount(&buf[0]); + } + +LOCAL_C INT EditEntry(ENTRY *pent,TEXT *title) + { + H_DI_EDIT edname; + H_DI_EDIT eddept; + LONG lnumb; + H_DI_NUMBER numb; + + if (uOpenDialog(title)) + return(-1); + edname.len=19; + edname.str=(&pent->nam[0]); + if (uAddDialogItem(H_DIALOG_EDIT,"Name",&edname)) + return(-1); + eddept.len=3; + eddept.str=(&pent->dep[0]); + if (uAddDialogItem(H_DIALOG_EDIT,"Dept",&eddept)) + return(-1); + lnumb=pent->nmb; + numb.value=(&lnumb); + numb.low=100; + numb.high=999; + if (uAddDialogItem(H_DIALOG_NUMBER,"Number",&numb)) + return(-1); + if (uRunDialog()<=0) + return(-1); + pent->nmb=lnumb; + return(0); + } + +LOCAL_C INT EntryToBuf(ENTRY *pent) + { + INT len1; + INT len2; + UBYTE *pb; + + len1=pent->nam[0]+1; + pb=(&dBuf[2]); + pb=p_bcpy(pb,&pent->nam[0],len1); + len2=pent->dep[0]+1; + pb=p_bcpy(pb,&pent->dep[0],len2); + *(WORD *)pb=pent->nmb; + dOff=0; + return(len1+len2+2); + } + +LOCAL_C INT Check(INT val) + { + TEXT buf[64]; + + if (val<0 && val!=E_FILE_EOF) + { + uForceToFront(); + DatLocked=TRUE; + p_errs(&buf[0],val); + wsAlertW(WS_ALERT_CLIENT,&buf[0],"Terminating application",0); + p_exit(0); + } + return(val); + } + +LOCAL_C VOID DoUpdate(INT len) + { + INT state; + + state=DbfStateDisabled; + Check(DbfUpdate(&state,dH,len)); + } + +LOCAL_C VOID DoAppend(INT len) + { + Check(DbfAppend(dH,len)); + Display(); + } + +LOCAL_C VOID AddRecord(VOID) + { + ENTRY new; + + CleanEntry(&new); + if (!EditEntry(&new,"Add new record")) + DoAppend(EntryToBuf(&new)); + } + +LOCAL_C VOID UpdateRecord(VOID) + { + ENTRY ent; + + if (!DbfCount(dH)) + { + wInfoMsg("No record to update"); + return; + } + BufToEntry(&ent); + if (!EditEntry(&ent,"Update record")) + { + DoUpdate(EntryToBuf(&ent)); + Display(); + } + } + +LOCAL_C INT Transition( +#pragma save,TRN_CALL + INT pf(VOID *,UWORD *)) +#pragma restore + { + return(Check(pf(dH,&dOff))); + } + +LOCAL_C VOID DeleteRecord(VOID) + { + INT state; + + if (!DbfCount(dH)) + { + wInfoMsg("No record to delete"); + return; + } + if (uOpenDialog("Delete current record")) + return; + if (uAddButtonList("No",-'n',"Yes",'y',NULL)) + return; + if (uRunDialog()!='y') + return; + state=DbfStateDisabled; + if (Check(DbfEraseRead(&state,dH,&dOff))<0) + Transition(DbfBackRead); + Display(); + } + +LOCAL_C VOID InsertFromClipboard(VOID) + { + if (!clipfill) + { + wInfoMsg("No record to insert"); + return; + } + DoAppend(EntryToBuf(&clip)); + } + +LOCAL_C VOID CopyToClipboard(VOID) + { + if (!DbfCount(dH)) + { + wInfoMsg("No record to copy"); + return; + } + BufToEntry(&clip); + clipfill=TRUE; + wInfoMsg("Record copied"); + } + +LOCAL_C INT Search(INT dir) + { + UINT state; + INT len; + INT ret; + + len=find[0]; + find[0]='*'; + find[len+1]='*'; + state=DbfStateDisabled; + ret=Check(DbfFindRead(&state,dH,&find[0],len+2, + 255|dir|DbfFindCaseIndependent,2,&dOff)); + find[0]=len; + return(ret); + } + +LOCAL_C INT ResetTo(UINT current) + { + return(Check(DbfAbsRead(dH,current,&dOff))); + } + +LOCAL_C VOID DoFind(INT dir) + { + UINT current; + + current=DbfSense(dH); + if (Search(dir)>=0) + Display(); + else + { + ResetTo(current); + wInfoMsg("Not found"); + } + } + +LOCAL_C VOID FindAgain(INT dir1,INT dir2, +#pragma save,TRN_CALL + INT pf(VOID *,UWORD *)) +#pragma restore + { + UINT current; + + current=DbfSense(dH); + if (Transition(pf)>=0 && Search(dir1)>=0 + || Search(dir2)>=0 && DbfSense(dH)!=current) + Display(); + else + { + ResetTo(current); + wInfoMsg("No more found"); + } + } + +LOCAL_C VOID FindNext(VOID) + { + FindAgain(DbfFindForwards,DbfFindFirst,DbfNextRead); + } + +LOCAL_C VOID FindPrevious(VOID) + { + FindAgain(DbfFindBackwards,DbfFindLast,DbfBackRead); + } + +LOCAL_C VOID FindRecord(VOID) + { + H_DI_EDIT edfind; + + if (uOpenDialog(NULL)) + return; + edfind.str=(&find[0]); + edfind.len=19; + if (uAddDialogItem(H_DIALOG_EDIT,"Find",&edfind)) + return; + if (uAddButtonList("Cancel",W_KEY_ESCAPE,"Find backwards",W_KEY_TAB, + "Find forwards",W_KEY_RETURN,NULL)) + return; + switch (uRunDialog()) + { + case W_KEY_TAB: + DoFind(DbfFindLast); + case 0: + return; + case W_KEY_RETURN: + DoFind(DbfFindFirst); + } + } + +LOCAL_C VOID DialNumber(VOID) + { + ENTRY tmp; + TEXT buf[4]; + + if (!DbfCount(dH)) + { + wInfoMsg("No number to dial"); + return; + } + BufToEntry(&tmp); + buf[p_itob(&buf[0],tmp.nmb)]=0; + if (hDTMFString(&buf[0])) + wInfoMsg("Sound device busy"); + } + +LOCAL_C VOID CompressFile(VOID) + { + UINT state; + + if (!hIsDbfCompressible(dH)) + wInfoMsg("Cannot compress on Flash"); + else + { + state=DbfStateDisabled; + Check(DbfCompress(&state,dH)); + wInfoMsg("File compressed"); + } + } + +LOCAL_C VOID ChangeName(TEXT *newname) + { + p_scpy(&filename[0],newname); + hSetUpStatusNames(&filename[0]); + wsUpdate(WS_UPDATE_NAME); + } + +LOCAL_C VOID DisplayStart(VOID) + { + Transition(DbfFirstRead); + Display(); + } + +LOCAL_C VOID ChangeOverTo(VOID *newdH,TEXT *newname) + { + DbfClose(dH); + dH=newdH; + ChangeName(newname); + DisplayStart(); + } + +LOCAL_C INT doOpen(VOID **pdH,TEXT *pb,INT flags,DbfHeader *pHead) + { + INT state; + + state=DbfStateDisabled; + p_scpy((TEXT *)&pHead->fileType[0],"OPLDatabaseFile"); + return(uErrorValue(DbfOpen(&state,pdH,pb,flags,pHead,&dBuf[0],512,1))); + } + +LOCAL_C INT TryOpenDbf(TEXT *pb,VOID **pdH) + { + DbfHeader Header; + + return(doOpen(pdH,pb,P_FOPEN|P_FUPDATE|P_FRANDOM,&Header)); + } + +LOCAL_C VOID SetupFilename(TEXT *pb) + { + p_bcpy(pb+1,DatUsedPathNamePtr,*pb=p_slen(DatUsedPathNamePtr)); + } + +LOCAL_C VOID OpenDbf(VOID) + { + H_DI_FSEL open; + TEXT openbuf[P_FNAMESIZE+2]; + VOID *newdH; + UINT current; + + current=DbfSense(dH); + SetupFilename(open.fname=(&openbuf[0])); + open.flags=H_FILE_PICK_SELECTOR|H_FILE_RESTRICT_LIST|H_FILE_SET_DEFEXT; + FOREVER + { + if (uOpenDialog("Open telephone file")) + break; + if (uAddDialogItem(H_DIALOG_FSEL,"File:",&open)) + break; + if (uRunDialog()<=0) + break; + openbuf[1+openbuf[0]]=0; + if (!TryOpenDbf(&openbuf[1],&newdH)) + { + ChangeOverTo(newdH,&openbuf[1]); + return; + } + } + ResetTo(current); + } + +LOCAL_C INT TryNewDbf(TEXT *pb,VOID **pdH) + { + DbfHeader Header; + + hEnsurePath(pb); + Header.createVersion=DbfVersion(); + p_bcpy(&Header.dataStart,&ModelHeader,sizeof(ModelHeader)); + return(doOpen(pdH,pb,P_FREPLACE|P_FUPDATE|P_FRANDOM,&Header)); + } + +LOCAL_C VOID NewDbf(VOID) + { + H_DI_FSEL new; + TEXT newbuf[P_FNAMESIZE+2]; + VOID *newdH; + UINT current; + + current=DbfSense(dH); + SetupFilename(new.fname=(&newbuf[0])); + new.flags=H_FILE_NEW_EDITOR|H_FILE_SET_DEFEXT; + FOREVER + { + if (uOpenDialog("New telephone file")) + break; + if (uAddDialogItem(H_DIALOG_FSEL,"File:",&new)) + break; + if (uRunDialog()<=0) + break; + newbuf[1+newbuf[0]]=0; + if (!TryNewDbf(&newbuf[1],&newdH)) + { + ChangeOverTo(newdH,&newbuf[1]); + return; + } + } + ResetTo(current); + } + +LOCAL_C INT DoMerge(TEXT *pb,INT flags,INT dir) + { + UINT state; + + state=DbfStateDisabled; + return(uErrorValue(DbfCopyFile(&state,dH,pb,flags,1,dir))); + } + +LOCAL_C VOID MergeDbf(VOID) + { + H_DI_FSEL merge; + TEXT mergebuf[P_FNAMESIZE+2]; + UINT current; + + current=DbfSense(dH); + SetupFilename(merge.fname=(&mergebuf[0])); + merge.flags=H_FILE_PICK_SELECTOR|H_FILE_RESTRICT_LIST|H_FILE_SET_DEFEXT; + FOREVER + { + if (uOpenDialog("Merge telephone file")) + break; + if (uAddDialogItem(H_DIALOG_FSEL,"File:",&merge)) + break; + if (uRunDialog()<=0) + break; + mergebuf[1+mergebuf[0]]=0; + if (!DoMerge(&mergebuf[1],P_FOPEN,DbfCopyToHandle)) + { + wInfoMsg("File merged"); + DisplayStart(); + return; + } + } + ResetTo(current); + } + +LOCAL_C VOID DoSave(TEXT *pb,INT usenew) + { + if (DoMerge(pb,P_FUPDATE|P_FREPLACE,DbfCopyFromHandle)) + return; + if (usenew) + { + DbfClose(dH); + ChangeName(pb); + while (TryOpenDbf(pb,&dH)) + ; + DisplayStart(); + } + wInfoMsg("Saved"); + } + +LOCAL_C VOID SaveDbfAs(VOID) + { + H_DI_FSEL save; + TEXT savebuf[P_FNAMESIZE+2]; + UWORD usenew; + + if (uOpenDialog("Save as")) + return; + SetupFilename(save.fname=(&savebuf[0])); + save.flags=H_FILE_NEW_EDITOR|H_FILE_SET_DEFEXT; + if (uAddDialogItem(H_DIALOG_FSEL,"File:",&save)) + return; + usenew=1; + if (uAddChoiceList("Use new file",&usenew,"No","Yes",NULL)) + return; + if (uRunDialog()) + { + savebuf[1+savebuf[0]]=0; + hEnsurePath(&savebuf[1]); + DoSave(&savebuf[1],usenew==2); + } + } + +LOCAL_C INT ordf(INT r1,INT r2,VOID *base) + { + UBYTE *table; + UBYTE *e1; + UBYTE *e2; + INT entlen; + + table=(UBYTE *)base; + entlen=(*(UWORD *)table); + table+=2; + r1=(*(UWORD *)(table+r1*entlen)); + r2=(*(UWORD *)(table+r2*entlen)); + table+=2; + e1=table+r1*entlen; + e2=table+r2*entlen; + return(p_bcmp(e1+1,*e1,e2+1,*e2)); + } + +LOCAL_C VOID excf(INT r1,INT r2,VOID *base) + { + UBYTE *table; + INT entlen; + UWORD *p1; + UWORD *p2; + UWORD swap; + + table=(UBYTE *)base; + entlen=(*(UWORD *)table); + table+=2; + p1=(UWORD *)(table+r1*entlen); + p2=(UWORD *)(table+r2*entlen); + swap=(*p1); + *p1=(*p2); + *p2=swap; + } + +LOCAL_C INT DoSort(UINT k,INT len) + { + INT entlen; + UBYTE *table; + INT i,j; + INT thislen; + UBYTE *target; + UBYTE *source; + UWORD moved; + INT ret; + + entlen=len+3; + table=p_alloc(2+k*entlen); + if (!table) + { + uErrorString("Insufficient memory"); + return(-1); + } + *(UWORD *)table=entlen; + Transition(DbfFirstRead); + target=table+2; + for (i=0; ilen) + thislen=len; + *(UWORD *)target=i; + *(target+2)=thislen; + p_bcpy(target+3,source,thislen); + target+=entlen; + Transition(DbfNextRead); + } + if (p_qsort(k,ordf,excf,table)) + { + uErrorString("Internal sort stack overflow"); + ret=(-1); + } + else + { + for (i=0; imoved) + (*(UWORD *)target)--; + target+=entlen; + } + } + ret=0; + wInfoMsg("Sorted"); + DisplayStart(); + } + p_free(table); + return(ret); + } + +LOCAL_C VOID SortDbf(VOID) + { + UINT k; + LONG len; + H_DI_NUMBER num; + UINT current; + + k=DbfCount(dH); + if (!k) + { + wInfoMsg("No records to sort"); + return; + } + current=DbfSense(dH); + len=19; + num.low=1; + num.high=19; + num.value=(&len); + FOREVER + { + if (uOpenDialog("Sort file by name")) + break; + if (uAddDialogItem(H_DIALOG_NUMBER,"Key length",&num)) + break; + if (uRunDialog()<=0) + break; + if (DoSort(k,(INT)len)) + return; + } + ResetTo(current); + } + +LOCAL_C VOID JumpTo(VOID) + { + INT count; + LONG curr; + H_DI_NUMBER num; + + count=DbfCount(dH); + if (!count) + { + wInfoMsg("No records to jump to"); + return; + } + if (uOpenDialog(NULL)) + return; + curr=DbfSense(dH)+1; + num.value=(&curr); + num.low=1; + num.high=count; + if (uAddDialogItem(H_DIALOG_NUMBER,"Jump to record",&num)) + return; + if (uRunDialog()<=0) + return; + ResetTo((UINT)(curr-1)); + Display(); + } + +LOCAL_C INT PrintLine(H_PRINT *pr) + { + switch (PrintState++) + { + case 0: + if (ResetTo(PrintRec++)<0) + return(0); + BufToEntry(&PrintEnt); + pr->buf=(&PrintEnt.nam[1]); + pr->blen=PrintEnt.nam[0]; + pr->style|=2; + break; + case 1: + pr->buf=(&PrintEnt.dep[1]); + pr->blen=PrintEnt.dep[0]; + break; + case 2: + pr->buf=(&PrintBuf[0]); + pr->blen=p_itob(&PrintBuf[0],PrintEnt.nmb); + break; + case 3: + pr->blen=0; + PrintState=0; + return(TRUE); + } + pr->flags|=0x8000; + return(TRUE); + } + +LOCAL_C VOID DoPrint(VOID) + { + UINT current; + + current=DbfSense(dH); + PrintState=0; + PrintRec=0; + hPrint(PrintLine); + ResetTo(current); + } + +LOCAL_C VOID ManageCommand(INT index) + { + switch (index) + { + case ITEMS_BEFORE_FILE: + NewDbf(); + break; + case ITEMS_BEFORE_FILE+1: + OpenDbf(); + break; + case ITEMS_BEFORE_FILE+2: + MergeDbf(); + break; + case ITEMS_BEFORE_FILE+3: + SaveDbfAs(); + break; + case ITEMS_BEFORE_FILE+4: + CompressFile(); + break; + case ITEMS_BEFORE_FILE+5: + p_exit(0); + case ITEMS_BEFORE_EDIT: + InsertFromClipboard(); + break; + case ITEMS_BEFORE_EDIT+1: + CopyToClipboard(); + break; + case ITEMS_BEFORE_EDIT+2: + UpdateRecord(); + break; + case ITEMS_BEFORE_EDIT+3: + AddRecord(); + break; + case ITEMS_BEFORE_EDIT+4: + DeleteRecord(); + break; + case ITEMS_BEFORE_FIND: + FindPrevious(); + break; + case ITEMS_BEFORE_FIND+1: + FindRecord(); + break; + case ITEMS_BEFORE_FIND+2: + FindNext(); + break; + case ITEMS_BEFORE_SPECIAL: + JumpTo(); + break; + case ITEMS_BEFORE_SPECIAL+1: + SortDbf(); + break; + case ITEMS_BEFORE_SPECIAL+2: + DialNumber(); + break; + case ITEMS_BEFORE_SPECIAL+3: + hPrintSetupDialog(); + break; + case ITEMS_BEFORE_SPECIAL+4: + DoPrint(); + } + } + +LOCAL_C INT ObeySystemCommand(INT cmd,TEXT *pb,VOID **pdH) + { + return((cmd=='O'? TryOpenDbf: TryNewDbf)(pb,pdH)); + } + +LOCAL_C VOID ProcessSystemCommand(VOID) + { + TEXT buf[P_FNAMESIZE+2]; + VOID *newdH; + + wGetCommand((UBYTE *)&buf[0]); + if (buf[0]=='X') + p_exit(0); + if (!ObeySystemCommand(buf[0],&buf[1],&newdH)) + ChangeOverTo(newdH,&buf[1]); + } + +LOCAL_C VOID TryExecuteCommand(INT keycode) + { + keycode=uLocateCommand(keycode); + if (keycode>=0) + ManageCommand(keycode); + } + +LOCAL_C VOID MainLoop(VOID) + { + INT ret; + WMSG_KEY key; + + FOREVER + { + uGetKey(&key); + if (key.keycode&W_EVENT_KEY) + { + if (key.keycode==CONS_EVENT_COMMAND) + ProcessSystemCommand(); + } + else if (key.keycode&W_SPECIAL_KEY) + TryExecuteCommand(key.keycode&(~W_SPECIAL_KEY)); + else + { + switch (key.keycode) + { + case W_KEY_MENU: + if (!(key.modifiers&W_CTRL_MODIFIER)) + { + ret=uPresentMenus(); + if (ret>0) + TryExecuteCommand(ret); + } + break; + case W_KEY_LEFT: + if (Transition(DbfBackRead)>=0) + { + Display(); + break; + } + case W_KEY_HOME: + Transition(DbfFirstRead); + Display(); + break; + case W_KEY_RIGHT: + if (Transition(DbfNextRead)>=0) + { + Display(); + break; + } + case W_KEY_END: + Transition(DbfLastRead); + Display(); + break; + case W_KEY_DELETE_LEFT: + DeleteRecord(); + break; + case W_KEY_TAB: + key.modifiers^=W_SHIFT_MODIFIER; + case W_KEY_RETURN: + if (key.modifiers&W_SHIFT_MODIFIER) + FindPrevious(); + else + FindNext(); + break; + case W_KEY_HELP: + if (key.modifiers&W_PSION_MODIFIER) + DialNumber(); + } + } + } + } + +LOCAL_C VOID ReduceScreenSize(VOID) + { + W_WINDATA wd; + + wd.extent.tl.x=wd.extent.tl.y=0; + wd.extent.width=189; + wd.extent.height=80; + wSetWindow(MainWid,W_WIN_EXTENT,&wd); + if (uErrorValue(wCheckPoint())) + p_exit(0); + } + +LOCAL_C VOID CreateGC(VOID) + { + G_GC gc; + INT hgc; + + gc.style=G_STY_DOUBLE; + hgc=gCreateGC(MainWid,G_GC_MASK_STYLE,&gc); + if (hgc<0) + p_exit(hgc); + } + +LOCAL_C VOID SpecificInit(VOID) + { + INT command; + + MainWid=uFindMainWid(); + CreateGC(); + command=hCrackCommandLine(); + if (ObeySystemCommand(command,DatUsedPathNamePtr,&dH)) + p_exit(0); + ReduceScreenSize(); + gBorder(W_BORD_CORNER_4); + wsEnable(); + DisplayPrompts(); + DisplayStart(); + } + +GLDEF_C VOID main(VOID) + { + uCommonInit(); + SpecificInit(); + MainLoop(); + } diff --git a/code/SIBOSDK/hwdemo/tele.ms b/code/SIBOSDK/hwdemo/tele.ms new file mode 100644 index 0000000..2e16de8 --- /dev/null +++ b/code/SIBOSDK/hwdemo/tele.ms @@ -0,0 +1,3 @@ +Tele.TEL +\TEL\ +3 diff --git a/code/SIBOSDK/hwdemo/tele.pic b/code/SIBOSDK/hwdemo/tele.pic new file mode 100644 index 0000000..02d603a Binary files /dev/null and b/code/SIBOSDK/hwdemo/tele.pic differ diff --git a/code/SIBOSDK/hwdemo/tele.rsc b/code/SIBOSDK/hwdemo/tele.rsc new file mode 100644 index 0000000..e69de29 diff --git a/code/SIBOSDK/hwdemo/tele.shd b/code/SIBOSDK/hwdemo/tele.shd new file mode 100644 index 0000000..70357ff Binary files /dev/null and b/code/SIBOSDK/hwdemo/tele.shd differ diff --git a/code/SIBOSDK/hwdemo/unnamed.pr b/code/SIBOSDK/hwdemo/unnamed.pr new file mode 100644 index 0000000..408c49b --- /dev/null +++ b/code/SIBOSDK/hwdemo/unnamed.pr @@ -0,0 +1,6 @@ +#system epoc img +#set epocinit=iplib +#model small jpi +#compile %main +#pragma link(hwif.lib) +#link %main diff --git a/code/SIBOSDK/hwdemo/vid.bat b/code/SIBOSDK/hwdemo/vid.bat new file mode 100644 index 0000000..4ccb4d5 --- /dev/null +++ b/code/SIBOSDK/hwdemo/vid.bat @@ -0,0 +1,22 @@ +@echo off +goto X%1X +:Xv0X +:XoffX +set jpivid=v0 +echo VID is now OFF +goto :end +:Xv2X +:XonX +set jpivid=v2 +echo VID is now ON +goto :end +:XX +call checkvid +goto %jpivid% +:v0 +echo VID is OFF +goto end +:v2 +echo VID is ON +:end + diff --git a/code/SIBOSDK/hwdemo/wsreport.c b/code/SIBOSDK/hwdemo/wsreport.c new file mode 100644 index 0000000..cc7efe8 --- /dev/null +++ b/code/SIBOSDK/hwdemo/wsreport.c @@ -0,0 +1,343 @@ +/* Module WSREPORT.C + Written by Steve Mar 1992 + + Write a log of one or all the applications window server resources. +*/ +#include +#include +#include + +GLREF_D VOID *DatApp1; +GLREF_D WSERV_SPEC *wserv_channel; + +#define MAX_OBJ 256 +#define G_SEG_SEL_MAX_ROM 63 + +typedef struct + { + G_FONT_INFO info; + UBYTE *addr; + P_RECT area; + UWORD bytewid; + UWORD segment; + UWORD work_spc_size; + UWORD work_spc_wid; + UBYTE *width_table; + } G_FONT; + +typedef struct + { + UWORD seg; + UBYTE *addr; + UWORD bytewid; + } BM_DATA; + +typedef struct + { + UBYTE flags; + UBYTE filler; + BM_DATA bm_data; + VOID *region; + P_POINT size; + TEXT name[14]; + } BITMAP; + +typedef union + { + G_FONT *font; + BITMAP *bit; + } IFOB; + +typedef struct + { + UBYTE type; + UBYTE usage; + IFOB addr; + UINT self_index; + } SHARED_HEADER; + +typedef struct s_shared_data /* Bitmap and font header structure */ + { + SHARED_HEADER head; + UWORD checksum; + struct s_shared_data *next; + struct s_shared_data **prev; + } S_SHARED_DATA; + +typedef struct s_window + { + UBYTE type; + UBYTE status; + UWORD flags; + P_POINT origin; + P_RECT abs; + P_RECT rel; + struct s_window *parent; + struct s_window *child; + struct s_window *sibling; + VOID *region; + VOID *area; + UWORD self_index; + } S_WINDOW; + +typedef struct s_gcb + { + UBYTE type; + UBYTE style; + BM_DATA bm_data; + UBYTE gmode; + UBYTE textmode; + P_POINT origin; + VOID *region; + UWORD draws_to; + G_FONT *font; + BM_DATA extra_bm_data; + P_RECT extra_rect; + } S_GCB; + +typedef union + { + S_WINDOW win; + S_GCB gcb; + S_SHARED_DATA shared; + } OBJECT; + +#define MAX_DEV_EVENTS 8 +#define DEQ_ENTRY_SIZE 16 +typedef struct + { + UWORD ready; + UBYTE front; + UBYTE n_entries; + UBYTE buffer[DEQ_ENTRY_SIZE][MAX_DEV_EVENTS]; + } S_DEQ; + +typedef struct + { + UBYTE *read_addr; + UWORD flags; + UBYTE *gcb; + UWORD os_id; + UBYTE SelfIndex; + BYTE error; + VOID *clock; + S_WINDOW *capture; + VOID *redrawq; + VOID *invalid_area; + S_WINDOW *redraw_win; + VOID *redraw_region; + S_WINDOW *cursor_win; + W_CURSOR cursor; + UWORD root_handle; + S_GCB *tempgcb; + S_WINDOW *front_window; + VOID *alert; + TEXT busy_txt[W_BUSY_MSG_MAX_LEN+1]; + UBYTE busy_corner; + VOID *bit_list; + S_GCB *static_gcb; + UBYTE *ipcbuf; + WORD death_stat; + UBYTE *cmd_buf; + UWORD open_mode; + ULONG open_addr; + S_DEQ deq; + UINT status[2]; + UWORD tab_size; + OBJECT *obj_tab[MAX_OBJ]; + } WS_CCB; + +typedef struct + { + WORD WservStaticInitGcb; + WORD WservStaticFontTable; + WORD WservStaticClients[WS_MAX_CLIENTS]; + WORD WservStaticRomSegments[G_SEG_SEL_MAX_ROM]; + WORD WservStaticFontTabSize; + WORD WservStaticBitmapTab; + WORD WservStaticBitmapTabSize; + WORD WservStaticIconTab; + WORD WservStaticIconTabSize; + } WSERV_STATICS; + +GLREF_D P_DEVICE p_file; +LOCAL_D VOID *FileCB=NULL; +LOCAL_D WSERV_STATICS *wsDatApp; +LOCAL_D WS_CCB *ClientCCBs[WS_MAX_CLIENTS]; +LOCAL_D WS_CCB ccb; + +LOCAL_C VOID wsRead(VOID *to,VOID *from,UINT len) + { + p_pcpyfr(wserv_channel->link.local.wserv_pid,from,to,len); + } + +LOCAL_C VOID fWrite(TEXT *str,...) + { + INT len; + TEXT buf[128]; + + len=p_atob(&buf[0],str,&str+1); + f_write(FileCB,&buf[0],len); + } + +LOCAL_C VOID ReportWindow(S_WINDOW *pWin,UINT inset) + { + S_WINDOW *pNext,win; + static TEXT *back[4]={"None","Clr","Set","Bit"}; + + for(pNext=pWin;pNext;) + { + wsRead(&win,pNext,sizeof(S_WINDOW)); + if (win.self_index>ccb.tab_size || + &ccb.obj_tab[win.self_index]->win!=pNext) + break; + fWrite("%- *fWindow(%d) %s%sisible %s,{{%d,%d},%d,%d}",inset, + win.self_index, + win.status&W_UNINITIALISED?"Uninitialised ":"", + win.status&W_SET_INVISIBLE?"Inv":"V", + back[win.status&3], + win.rel.tl.x,win.rel.tl.y, + win.rel.br.x-win.rel.tl.x, + win.rel.br.y-win.rel.tl.y); + ReportWindow(win.child,inset+1); + pNext=win.sibling; + } + } + +LOCAL_C VOID ReportClient(VOID *client) + { + UINT j; + OBJECT object; + BITMAP bitmap; + G_FONT font; + TEXT name[34]; + + wsRead(&ccb,client,sizeof(ccb)); + f_leave(p_pname(ccb.os_id,&name[0])); + fWrite(&name[0]); + fWrite("--------------"); + fWrite("Client slot %d",ccb.SelfIndex); + fWrite(ccb.read_addr?"Read outstanding":"No read outstanding"); + fWrite("Flags 0x%x",ccb.flags); + if (ccb.error) + fWrite("Pending error %d",ccb.error); + fWrite(ccb.redrawq ? "Redraws-pending":"No Redraws-pending"); + fWrite("PID=0x%x",ccb.os_id); + fWrite(""); + ReportWindow(ccb.front_window,0); + for(j=2;jWservStaticClients[0], + sizeof(ClientCCBs)); + index=nodlg=0; + if (pid==-1) /* Log the foreground clients resources */ + { + wGetProcessList(&buf[0]); + pid=buf[0]; + nodlg=TRUE; /* Log to the last file name used with no query */ + } + if (pid) /* Find the client index of the process to log */ + FOREVER + { + index++; + if (index==WS_MAX_CLIENTS) + { + wInfoMsg("Not a window server client"); + return; + } + if (ClientCCBs[index]) + { + wsRead(&ccb,ClientCCBs[index],sizeof(ccb)); + if (ccb.os_id==pid) + break; + } + } + fsel.fname= &fName[0]; + fsel.flags=H_FILE_SET_DEFEXT|H_FILE_NEW_EDITOR; + if (nodlg==TRUE || + (uOpenDialog("Select file to write report to")>=0 && + uAddDialogItem(H_DIALOG_FSEL,"File",&fsel)>=0 && + uRunDialog()>0)) + { + wsRead(&wsDatApp,&DatApp1,2); + fName[fName[0]+1]=0; + uErrorValue(p_enter3(report,&fName[1],index)); + p_close(FileCB); + FileCB=NULL; + } + } + diff --git a/code/SIBOSDK/hwifood/gbar.afl b/code/SIBOSDK/hwifood/gbar.afl new file mode 100644 index 0000000..905a7c4 --- /dev/null +++ b/code/SIBOSDK/hwifood/gbar.afl @@ -0,0 +1,2 @@ +gbar.pic +gbar.rsc diff --git a/code/SIBOSDK/hwifood/gbar.cat b/code/SIBOSDK/hwifood/gbar.cat new file mode 100644 index 0000000..58cb0b2 --- /dev/null +++ b/code/SIBOSDK/hwifood/gbar.cat @@ -0,0 +1,59 @@ +IMAGE gbar + +EXTERNAL olib +EXTERNAL hwim + +INCLUDE lprinter.g +INCLUDE help.g +INCLUDE dlgbox.g + +CLASS hprinter lprinter + { + REPLACE lpr_read + REPLACE lpr_sense_text + PROPERTY + { + INT (*sense)(WDR_PRINT *); + } + } + +CLASS hhelpdlg helpdlg + { + REPLACE destroy + } + +CLASS data_dl dlgbox + { + REPLACE dl_dyn_init + REPLACE dl_key + TYPES + { + typedef struct + { + UWORD exit_code; + UWORD totloops; + UWORD update; + UWORD esc; + UWORD loopsleft; + UWORD toupdate; + } RB_GBAR; + } + } + +CLASS gbar_dl dlgbox + { + REPLACE wn_sense_help + REPLACE dl_dyn_init + REPLACE dl_key + ADD gbar_update + } + +CLASS bar_ao active + { + REPLACE ao_init + REPLACE ao_run + PROPERTY + { + RB_GBAR *prb; + } + } diff --git a/code/SIBOSDK/hwifood/gbar.pic b/code/SIBOSDK/hwifood/gbar.pic new file mode 100644 index 0000000..8ab3856 Binary files /dev/null and b/code/SIBOSDK/hwifood/gbar.pic differ diff --git a/code/SIBOSDK/hwifood/gbar.pr b/code/SIBOSDK/hwifood/gbar.pr new file mode 100644 index 0000000..7f52c76 --- /dev/null +++ b/code/SIBOSDK/hwifood/gbar.pr @@ -0,0 +1,21 @@ +#system epoc img +#set epocinit=iplib +#model small jpi + +#compile gbar.cat + +#if %remake #or (gbar.rsg #older gbar.rss) #or (gbar.rsc #older gbar.rss) #then + #run "rs gbar" no_window no_abort + #file delete gbar.img +#endif + +#compile growbar.c + +#pragma link(hwifo.lib) +#pragma link(hwim.lib) + +#if (gbar.img #older gbar.afl) #or (gbar.img #older gbar.pic) #then + #file delete gbar.img +#endif + +#link gbar.img diff --git a/code/SIBOSDK/hwifood/gbar.rss b/code/SIBOSDK/hwifood/gbar.rss new file mode 100644 index 0000000..4e633a2 --- /dev/null +++ b/code/SIBOSDK/hwifood/gbar.rss @@ -0,0 +1,60 @@ +#include +#include +#include + +RESOURCE DIALOG dl_data + { + title="Specify grow-bar data"; + flags=DLGBOX_NOTIFY_ENTER; + controls= + { + CONTROL + { + class=C_NCEDIT; + prompt="Total number of loops"; + info=NCEDIT + { + high=100; + low=1; + }; + }, + CONTROL + { + class=C_NCEDIT; + prompt="Update display every"; + info=NCEDIT + { + high=100; + low=1; + }; + }, + CONTROL + { + class=C_CHLIST; + prompt="Allow escape"; + info=CHLIST { rid=-SYS_NO_YES; }; + } + }; + } + +RESOURCE CONTROL item_abandon + { + class=C_ACLIST; + info=ACLIST { rid=-SYS_AC_ABANDON; }; + } + +RESOURCE DIALOG dl_gbar + { + title="Example grow bar"; + flags=DLGBOX_NOTIFY_ESCAPE|DLGBOX_NOTIFY_ENTER; + controls= + { + CONTROL + { + class=C_DONEWN; + } + }; + } + +RESOURCE STRING str_cancelled { str="Cancelled by user"; } +RESOURCE STRING str_finished { str="Looping finished"; } diff --git a/code/SIBOSDK/hwifood/growbar.c b/code/SIBOSDK/hwifood/growbar.c new file mode 100644 index 0000000..60dffc6 --- /dev/null +++ b/code/SIBOSDK/hwifood/growbar.c @@ -0,0 +1,164 @@ +/* + GROWBAR.C + +Written by DavidW +Started on 19/8/94 + +*/ + +#include +#include +#include +#include + +#include +#include +#include "gbar.rsg" + +GLREF_D VOID *w_am; +GLREF_D PR_WSERV *w_ws; +GLREF_D VOID *DatDialogPtr; + + +LOCAL_C VOID doDial(INT classno,INT resid,VOID *rbuf) + { + hOODialog(p_getlibh(CAT_GBAR_GBAR),classno,resid,rbuf); + } + +LOCAL_C VOID InitGbarData(RB_GBAR *pgb) + { + pgb->totloops=10; + pgb->update=1; + pgb->esc=TRUE; + } + +LOCAL_C VOID DisallowDialling(VOID) + { + w_ws->wserv.flags|=PR_WSERV_FREEFORM_DIALLING; + } + +LOCAL_C VOID MainLoop(VOID) + { + VOID *ao; + RB_GBAR gb_data; + + InitGbarData(&gb_data); + DisallowDialling(); + ao=f_newsend(CAT_GBAR_GBAR,C_BAR_AO,O_AO_INIT,&gb_data); + FOREVER + { + doDial(C_DATA_DL,DL_DATA,&gb_data); + if (gb_data.exit_code==W_KEY_ESCAPE) + continue; + p_send2(ao,O_AO_QUEUE); + doDial(C_GBAR_DL,DL_GBAR,&gb_data); + p_send2(ao,O_AO_CANCEL); + hInfoPrint(gb_data.exit_code==W_KEY_ESCAPE? + STR_CANCELLED: STR_FINISHED); + } + } + +LOCAL_C VOID SpecificInit(VOID) + { + hInitAppRcb(); + hCrackCommandLine(); + } + +GLDEF_C VOID main(VOID) + { + uCommonInit(); + SpecificInit(); + MainLoop(); + } + +#pragma METHOD_CALL + +#define DL_DATA_TOT 1 +#define DL_DATA_UPD 2 +#define DL_DATA_ESC 3 + +METHOD VOID data_dl_dl_dyn_init(PR_DLGBOX *self) + { + RB_GBAR *prbuf; + + prbuf=self->dlgbox.rbuf; + hDlgSetNcedit(DL_DATA_TOT,prbuf->totloops); + hDlgSetNcedit(DL_DATA_UPD,prbuf->update); + hDlgSetChlist(DL_DATA_ESC,prbuf->esc); + } + +METHOD INT data_dl_dl_key(PR_DLGBOX *self) + { + RB_GBAR *prbuf; + + prbuf=self->dlgbox.rbuf; + prbuf->totloops=hDlgSenseNcedit(DL_DATA_TOT); + prbuf->update=hDlgSenseNcedit(DL_DATA_UPD); + prbuf->esc=hDlgSenseChlist(DL_DATA_ESC); + return(WN_KEY_CHANGED); + } + +METHOD VOID gbar_dl_dl_dyn_init(PR_DLGBOX *self) + { + RB_GBAR *prbuf; + SE_DONEWN set; + + prbuf=self->dlgbox.rbuf; + if (prbuf->esc) + p_send3(self,O_DL_ITEM_APPEND,ITEM_ABANDON); + set.flags=SE_DONEWN_RANGE; + set.range=prbuf->totloops; + hDlgSet(1,&set); + prbuf->toupdate=prbuf->update; + prbuf->loopsleft=prbuf->totloops; + } + +METHOD VOID gbar_dl_gbar_update(PR_DLGBOX *self) + { + RB_GBAR *prbuf; + SE_DONEWN set; + + prbuf=self->dlgbox.rbuf; + set.flags=SE_DONEWN_VALUE; + set.val=prbuf->totloops-prbuf->loopsleft; + hDlgSet(1,&set); + } + +METHOD INT gbar_dl_dl_key(PR_DLGBOX *self) + { + RB_GBAR *prbuf; + + prbuf=self->dlgbox.rbuf; + return(prbuf->esc? WN_KEY_CHANGED: WN_KEY_NO_CHANGE); + } + +METHOD VOID gbar_dl_wn_sense_help(VOID *self) + { + p_leave(RUN_ACTIVE_USED); + } + +METHOD VOID bar_ao_ao_init(PR_BAR_AO *self,RB_GBAR *prb) + { + p_send3(w_am,O_AM_ADD_TASK,self); + self->bar_ao.prb=prb; + } + +METHOD INT bar_ao_ao_run(PR_BAR_AO *self) + { + RB_GBAR *prb; + + p_sleep(5); /* the next stage of computation or drawing etc */ + p_send2(self,O_AO_QUEUE); + prb=self->bar_ao.prb; + if (!--(prb->loopsleft)) + { + p_send2(DatDialogPtr,O_DESTROY); + prb->exit_code=0; + } + else if (!--(prb->toupdate)) + { + p_send2(DatDialogPtr,O_GBAR_UPDATE); + prb->toupdate=prb->update; + } + return(RUN_ACTIVE_USED); + } diff --git a/code/SIBOSDK/hwifood/hwifood.prj b/code/SIBOSDK/hwifood/hwifood.prj new file mode 100644 index 0000000..f1fe7a7 --- /dev/null +++ b/code/SIBOSDK/hwifood/hwifood.prj @@ -0,0 +1,27 @@ +hwifood.prj ! release source files +ts.red ! redirection file +! +oqd.pr ! TS project file (OQuery dyl) +oquery.pr ! TS project file (OQuery app) +makeoq.bat ! makes OQUERY.IMG +! +oquery.c ! source for Oquery +oquery.rss ! resource script +oquery.afl ! add file list +query.ms ! shell data source +query.shd ! shell data file +query.pic ! icon +oquery.dfl ! DYL file list +! +oqd.cat ! dialog DYL definitions +oqdc.c ! dialog DYL methods + +gbar.pr ! TS project file (GBAR) +makegbar.bat ! makes GBAR.IMG +! +gbar.cat ! incorporates HWIF.CAT +growbar.c ! main source code +gbar.rss ! resource script +gbar.afl ! add file list +gbar.pic ! icon + diff --git a/code/SIBOSDK/hwifood/makegbar.bat b/code/SIBOSDK/hwifood/makegbar.bat new file mode 100644 index 0000000..4eb1356 --- /dev/null +++ b/code/SIBOSDK/hwifood/makegbar.bat @@ -0,0 +1,2 @@ +@echo off +tscx /m gbar diff --git a/code/SIBOSDK/hwifood/makeoq.bat b/code/SIBOSDK/hwifood/makeoq.bat new file mode 100644 index 0000000..75ec24e --- /dev/null +++ b/code/SIBOSDK/hwifood/makeoq.bat @@ -0,0 +1,3 @@ +@echo off +tscx /m oqd /%jpivid% +tscx /m oquery /%jpivid% diff --git a/code/SIBOSDK/hwifood/oqd.cat b/code/SIBOSDK/hwifood/oqd.cat new file mode 100644 index 0000000..35f949a --- /dev/null +++ b/code/SIBOSDK/hwifood/oqd.cat @@ -0,0 +1,12 @@ +LIBRARY oqd + +EXTERNAL olib +EXTERNAL hwim + +INCLUDE dlgbox.g + +CLASS oqd_combins dlgbox + { + REPLACE dl_dyn_init + REPLACE dl_key + } diff --git a/code/SIBOSDK/hwifood/oqd.pr b/code/SIBOSDK/hwifood/oqd.pr new file mode 100644 index 0000000..5fbedf0 --- /dev/null +++ b/code/SIBOSDK/hwifood/oqd.pr @@ -0,0 +1,14 @@ +#system epoc dyl +#set epocinit=iplib +#model small jpi + +#compile oqd.cat + +#if %remake #or (oquery.rsg #older oquery.rss) #or (oquery.rsc #older oquery.rss) #then + #run "rs oquery" no_window no_abort + #file delete oquery.img +#endif + +#compile oqdc.c +#pragma link(hwim.lib) +#link oqd.dyl diff --git a/code/SIBOSDK/hwifood/oqdc.c b/code/SIBOSDK/hwifood/oqdc.c new file mode 100644 index 0000000..bf7a7ba --- /dev/null +++ b/code/SIBOSDK/hwifood/oqdc.c @@ -0,0 +1,88 @@ +/* + OQDC.C + +Methods of OO dialogs of OQUERY.C +Written by DavidW +Started on 5/9/93 + +*/ + +#include +#include +#include + +#include "oquery.rsg" + +#define COMBINS_DIW 1 +#define COMBINS_DIM 2 +#define COMBINS_FOUND 3 + +LOCAL_C VOID SetControls(P_DAYSEC *pds) + { + P_DATE dt; + + hDlgSetChlist(COMBINS_DIW,p_wkday(pds->day)); + p_dstodt(pds,&dt); + hDlgSetNcedit(COMBINS_DIM,dt.day+1); + hDlgSetDtedit(COMBINS_FOUND,pds->day); + } + +#pragma METHOD_CALL + +METHOD VOID oqd_combins_dl_dyn_init(PR_DLGBOX *self) + { + ULONG sdate; + P_DAYSEC ds; + + sdate=p_date(); + p_sttods(&sdate,&ds); + SetControls(&ds); + } + +METHOD INT oqd_combins_dl_key(PR_DLGBOX *self,INT index,INT key) + { + P_DAYSEC ds; + P_DATE dt; + INT diw; + INT dim; + INT diff; + ULONG reset; + INT inc; + + if (key==W_KEY_ESCAPE) + return(WN_KEY_CHANGED); + diw=hDlgSenseChlist(COMBINS_DIW); + dim=hDlgSenseNcedit(COMBINS_DIM)-1; + ds.day=hDlgSenseDtedit(COMBINS_FOUND); + ds.sec=0; + reset=ds.day; + diff=diw-p_wkday(ds.day); + if (key==W_KEY_RETURN) + { + if (diff<=0) + diff+=7; + inc=7; + } + else + { + if (diff>=0) + diff-=7; + inc=(-7); + } + ds.day+=diff; + FOREVER + { + if (ds.day>93501l) + { + hInfoPrint(OQS_NO_FURTHER_MATCHES); + ds.day=reset; + break; + } + p_dstodt(&ds,&dt); + if (dt.day==dim) + break; + ds.day+=inc; + } + SetControls(&ds); + return(WN_KEY_NO_CHANGE); + } diff --git a/code/SIBOSDK/hwifood/oquery.afl b/code/SIBOSDK/hwifood/oquery.afl new file mode 100644 index 0000000..0536df5 --- /dev/null +++ b/code/SIBOSDK/hwifood/oquery.afl @@ -0,0 +1,3 @@ +query.pic +oquery.rsc +query.shd diff --git a/code/SIBOSDK/hwifood/oquery.c b/code/SIBOSDK/hwifood/oquery.c new file mode 100644 index 0000000..190d414 --- /dev/null +++ b/code/SIBOSDK/hwifood/oquery.c @@ -0,0 +1,781 @@ +/* + OQUERY.C + +Written by DavidW +Started on 28/11/91 +OO aspects started 1/9/93 + +*/ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "oquery.rsg" + + +LOCAL_D INT DylHandle; + +LOCAL_D TEXT *cmds[]= + { + "iInches/Centimetres", + "mMiles/Kilometres", + "lPounds/Kilogrammes", + "pPints/Litres", + "fFahrenheit/Centigrade", + "dDay of week", + "cCombinations", + "tTime difference", + "hHoroscope", + "nNow", + "wPassword", + "eEncrypt", + "uDecrypt", + "sSignificance", + "zFile size", + "xExit", + NULL + }; + +#define CONVERT_ITEMS 5 +#define CALENDAR_ITEMS 5 +#define SECRET_ITEMS 3 +#define SPECIAL_ITEMS 3 + +#define ITEMS_BEFORE_CONVERT 0 +#define ITEMS_BEFORE_CALENDAR CONVERT_ITEMS +#define ITEMS_BEFORE_SECRET (ITEMS_BEFORE_CALENDAR+CALENDAR_ITEMS) +#define ITEMS_BEFORE_SPECIAL (ITEMS_BEFORE_SECRET+SECRET_ITEMS) + +LOCAL_D H_MENU_DATA mdata[]= + { + "Conversions",CONVERT_ITEMS, + "Calendar",CALENDAR_ITEMS, + "Secret",SECRET_ITEMS, + "Special",SPECIAL_ITEMS, + NULL + }; + +GLDEF_D TEXT ** _cmds=(&cmds[0]); +GLDEF_D H_MENU_DATA * _mdata=(&mdata[0]); + + +LOCAL_D UINT MainWid; + +LOCAL_D WORD ndp=2; +LOCAL_D DOUBLE small; +LOCAL_D DOUBLE vsmall; + +LOCAL_D TEXT pass[10]; + +LOCAL_D VOID *ttH; +LOCAL_D UWORD ttMonth=1; +LOCAL_D UWORD ttSuffix=1; +LOCAL_D UWORD ttDay=1; +LOCAL_D UWORD ttCentury=2; +LOCAL_D UWORD ttSeconds=2; + + +LOCAL_C VOID ZeroDouble(DOUBLE *pdbl) + { + p_bfil(pdbl,sizeof(DOUBLE),0); + } + +LOCAL_C VOID MakeDouble(DOUBLE *pdbl,WORD val) + { + p_itof(pdbl,&val); + } + +LOCAL_C VOID CalcSmall(VOID) + { + DOUBLE dndp; + DOUBLE temp; + + MakeDouble(&dndp,ndp); + p_fneg(&dndp); + MakeDouble(&temp,10); + p_pow(&small,&temp,&dndp); + MakeDouble(&temp,2); + p_fld(&vsmall,&small); + p_fdiv(&vsmall,&temp); + } + +LOCAL_C VOID Clip(DOUBLE *pval) + { + DOUBLE remain; + DOUBLE temp; + + MakeDouble(&temp,0); + if (p_fcmp(pval,&temp)>=0) + p_fadd(pval,&vsmall); + else + p_fsub(pval,&vsmall); + p_mod(&remain,pval,&small); + p_fsub(pval,&remain); + } + +LOCAL_C VOID FahrToCent(DOUBLE *pcent,DOUBLE *pfahr) + { + DOUBLE temp; + + p_fld(pcent,pfahr); + MakeDouble(&temp,32); + p_fsub(pcent,&temp); + MakeDouble(&temp,5); + p_fmul(pcent,&temp); + MakeDouble(&temp,9); + p_fdiv(pcent,&temp); + } + +LOCAL_C VOID CentToFahr(DOUBLE *pfahr,DOUBLE *pcent) + { + DOUBLE temp; + + p_fld(pfahr,pcent); + MakeDouble(&temp,9); + p_fmul(pfahr,&temp); + MakeDouble(&temp,5); + p_fdiv(pfahr,&temp); + MakeDouble(&temp,32); + p_fadd(pfahr,&temp); + } + +LOCAL_C VOID Temperatures(VOID) + { + DOUBLE fahr; + DOUBLE cent; + H_DI_FLOAT ffahr; + H_DI_FLOAT fcent; + INT index; + + MakeDouble(&fahr,32); + MakeDouble(¢,0); + ffahr.value=(&fahr); + MakeDouble(&ffahr.low,-17968); + MakeDouble(&ffahr.high,18032); + fcent.value=(¢); + MakeDouble(&fcent.low,-10000); + MakeDouble(&fcent.high,10000); + FOREVER + { + if (uOpenDialog("Convert temperature")) + return; + if (uAddDialogItem(H_DIALOG_FLOAT,"Fahrenheit",&ffahr)) + return; + if (uAddDialogItem(H_DIALOG_FLOAT,"Centigrade",&fcent)) + return; + index=uRunDialog(); + if (index<=0) + break; + if (index==2) + { + FahrToCent(¢,&fahr); + Clip(¢); + } + else + { + CentToFahr(&fahr,¢); + Clip(&fahr); + } + } + } + +LOCAL_C VOID Convert(TEXT *pmt1,TEXT *pmt2,INT high1,INT high2) + { + DOUBLE val1; + DOUBLE val2; + H_DI_FLOAT fled1; + H_DI_FLOAT fled2; + INT index; + DOUBLE ratio; + + ZeroDouble(&val1); + ZeroDouble(&val2); + fled1.value=(&val1); + ZeroDouble(&fled1.low); + MakeDouble(&fled1.high,high1); + fled2.value=(&val2); + ZeroDouble(&fled2.low); + MakeDouble(&fled2.high,high2); + p_fld(&ratio,&fled2.high); + p_fdiv(&ratio,&fled1.high); + FOREVER + { + if (uOpenDialog("Convert")) + return; + if (uAddDialogItem(H_DIALOG_FLOAT,pmt1,&fled1)) + return; + if (uAddDialogItem(H_DIALOG_FLOAT,pmt2,&fled2)) + return; + index=uRunDialog(); + if (index<=0) + break; + if (index==2) + { + p_fld(&val2,&val1); + p_fmul(&val2,&ratio); + Clip(&val2); + } + else + { + p_fld(&val1,&val2); + p_fdiv(&val1,&ratio); + Clip(&val1); + } + } + } + +LOCAL_C VOID InchAndCm(VOID) + { + Convert("Inches","Centimetres",10000,25400); + } + +LOCAL_C VOID MileAndKm(VOID) + { + Convert("Miles","Kilometres",20000,32187); + } + +LOCAL_C VOID PoundAndKg(VOID) + { + Convert("Pounds","Kilograms",31938,14500); + } + +LOCAL_C VOID PintAndL(VOID) + { + Convert("Pints","Litres",28156,16000); + } + +LOCAL_C VOID ChangeNdp(VOID) + { + LONG lndp; + H_DI_NUMBER num; + + if (uOpenDialog("Level of significance")) + return; + lndp=ndp; + num.value=(&lndp); + num.low=0; + num.high=4; + if (uAddDialogItem(H_DIALOG_NUMBER,"Decimal places",&num)) + return; + if (uRunDialog()<=0) + return; + ndp=(WORD)lndp; + CalcSmall(); + } + +LOCAL_C VOID SetUpDiDate(H_DI_DATE *pdate,P_DAYSEC *pds) + { + ULONG sdate; + + sdate=p_date(); + p_sttods(&sdate,pds); + pdate->value=(&pds->day); + pdate->low=0; + pdate->high=H_LAST_DAY; + } + +LOCAL_C VOID DayOfWeek(VOID) + { + P_DAYSEC ds; + H_DI_DATE date; + TEXT buf[40]; + H_DI_TEXT txt; + + SetUpDiDate(&date,&ds); + do + { + p_nmday(&buf[1],p_wkday(ds.day)); + buf[0]=p_slen(&buf[1]); + txt.str=(&buf[0]); + txt.type=H_DTEXT_ALIGN_LEFT; + if (uOpenDialog("Find day of week")) + return; + if (uAddDialogItem(H_DIALOG_DATE,"Date",&date)) + return; + if (uAddDialogItem(H_DIALOG_TEXT,"Day of week",&txt)) + return; + } while (uRunDialog()>0); + } + +LOCAL_D TEXT *orient[]= + { + "Rat","Cow","Tiger","Rabbit","Dragon","Snake", + "Horse","Sheep","Monkey","Rooster","Dog","Pig" + }; + +LOCAL_D TEXT *western[]= + { + "Capricorn","Aquarius","Pisces","Aries","Taurus","Gemini", + "Cancer","Leo","Virgo","Libra","Scorpio","Sagittarius" + }; + +LOCAL_C INT Zodiac(P_DATE *pdt) + { + INT ret; + LOCAL_D changeover[12]={19,18,19,19,20,20,22,22,22,22,21,20}; + + ret=pdt->month; + if (pdt->day>changeover[ret]) + { + if (ret++==11) + ret=0; + } + return(ret); + } + +LOCAL_C VOID Horoscope(VOID) + { + P_DAYSEC ds; + H_DI_DATE date; + P_DATE dt; + INT key; + TEXT buf[40]; + + SetUpDiDate(&date,&ds); + FOREVER + { + if (uOpenDialog("Horoscope")) + return; + if (uAddDialogItem(H_DIALOG_DATE,"Date of birth",&date)) + return; + if (uAddButtonList("Stop",W_KEY_ESCAPE, + "Western",'w',"Oriental",'o',NULL)) + return; + key=uRunDialog(); + if (key<=0) + return; + p_dstodt(&ds,&dt); + if (key=='o') + p_atos(&buf[0],"Oriental horoscope is %s",orient[dt.year%12]); + else + p_atos(&buf[0],"Western horoscope is %s",western[Zodiac(&dt)]); + wInfoMsg(&buf[0]); + } + } + +LOCAL_C INT AddListOfDays(UWORD *pdiw) + { + H_DI_CHOICE ch; + TEXT nam[32]; + INT i; + + if (uBeginDCL(&ch)) + return(-1); + for (i=0; i<7; i++) + { + p_nmday(&nam[0],i); + if (uGrowDCL(&ch,&nam[0])) + return(-1); + } + return(uAddDCL("Day in week",pdiw,&ch)); + } + +LOCAL_C VOID SetUpTime(H_DI_TIME *ptime,P_DAYSEC *pds) + { + ptime->value=(&pds->sec); + ptime->low=0; + ptime->high=P_NSECDAY-1; + ptime->type=H_DTIME_SHOW_SECONDS; + } + +LOCAL_C VOID TimeDifference(VOID) + { + P_DAYSEC ds1; + H_DI_DATE date1; + H_DI_TIME time1; + P_DAYSEC ds2; + H_DI_DATE date2; + H_DI_TIME time2; + LONG diff; + TEXT buf[40]; + + SetUpDiDate(&date1,&ds1); + SetUpDiDate(&date2,&ds2); + SetUpTime(&time1,&ds1); + SetUpTime(&time2,&ds2); + FOREVER + { + if (uOpenDialog("Time difference")) + return; + if (uAddDialogItem(H_DIALOG_DATE,"From",&date1)) + return; + if (uAddDialogItem(H_DIALOG_TIME,"",&time1)) + return; + if (uAddDialogItem(H_DIALOG_DATE,"To",&date2)) + return; + if (uAddDialogItem(H_DIALOG_TIME,"",&time2)) + return; + if (uRunDialog()<=0) + return; + diff=ds2.day-ds1.day; + if (diff<0 || !diff && ds2.sec0x7fffffffl/P_NSECDAY) + { + wInfoMsg("Dates are too far apart"); + continue; + } + p_atos(&buf[0],"Dates are %ld seconds apart", + diff*P_NSECDAY+ds2.sec-ds1.sec); + wInfoMsg(&buf[0]); + } + } + +LOCAL_C INT AddNoYesChoiceList(TEXT *pmt,UWORD *pval) + { + return(uAddChoiceList(pmt,pval,"No","Yes",NULL)); + } + +LOCAL_C VOID TimeNow(VOID) + { + INT values; + H_DI_TEXT txt; + TEXT buf[48]; + + txt.str=(&buf[0]); + do + { + if (uOpenDialog(NULL)) + return; + uZTStoBCS(&buf[0],"Time is now"); + txt.type=H_DTEXT_ALIGN_CENTRE; + if (uAddDialogItem(H_DIALOG_TEXT,NULL,&txt)) + return; + values=0; + if (ttMonth==2) + values=H_TIME_FORMAT_MONTH_NAME; + if (ttDay==2) + values|=H_TIME_FORMAT_DAY_NAME; + if (ttSuffix==2) + values|=H_TIME_FORMAT_SUFFIX; + if (ttCentury==1) + values|=H_TIME_FORMAT_NO_CENTURY; + if (ttSeconds==1) + values|=H_TIME_FORMAT_NO_SECONDS; + hTTSetFormat(ttH,values); + hTTSetTime(ttH,H_TIME_SET_NOW,NULL); + buf[0]=hTTSenseString(ttH,H_TIME_SENSE_BOTH,&buf[1]); + txt.type=H_DTEXT_ALIGN_CENTRE|H_DTEXT_UNDERLINE; + if (uAddDialogItem(H_DIALOG_TEXT,NULL,&txt)) + return; + if (AddNoYesChoiceList("Give month name",&ttMonth)) + return; + if (AddNoYesChoiceList("Give day name",&ttDay)) + return; + if (AddNoYesChoiceList("Use date suffix",&ttSuffix)) + return; + if (AddNoYesChoiceList("Show century",&ttCentury)) + return; + if (AddNoYesChoiceList("Show seconds",&ttSeconds)) + return; + } while (uRunDialog()>0); + } + +LOCAL_C VOID EnterPassword(VOID) + { + TEXT pass1[10]; + TEXT pass2[10]; + H_DI_XINPUT x1; + H_DI_XINPUT x2; + + x1.str=(&pass1[0]); + x2.str=(&pass2[0]); + FOREVER + { + if (uOpenDialog(NULL)) + return; + if (uAddDialogItem(H_DIALOG_XINPUT,"Define password",&x1)) + return; + if (uAddDialogItem(H_DIALOG_XINPUT,"Confirm password",&x2)) + return; + if (uRunDialog()<=0) + return; + if (p_bcmpi(&pass1[1],pass1[0],&pass2[1],pass2[0])) + { + wInfoMsg("Password not confirmed"); + continue; + } + if (pass1[0]) + break; + wInfoMsg("Please supply password"); + } + p_bfil(&pass[0],10,0); + p_bcpy(&pass[0],&pass1[0],pass1[0]+1); + } + +LOCAL_C VOID MakeReadable(TEXT *out,TEXT *in) + { + INT len; + INT i; + INT val; + + i=32; + len=(*in++); + *out++=len*2; + while (len--) + { + val=(*in++); + *out++=i+(val&0xf); + i+=16; + *out++=i+(val>>4); + if (i==112) + i=32; + else + i+=16; + } + } + +LOCAL_C VOID MakeUnreadable(TEXT *out,TEXT *in) + { + INT len; + INT i; + INT val; + + i=32; + len=(*in++)/2; + *out++=len; + while (len--) + { + val=(*in++)-i; + i+=16; + val+=((*in++)-i)<<4; + *out++=val; + if (i==112) + i=32; + else + i+=16; + } + } + +LOCAL_C VOID Report(TEXT *title,TEXT *mess) + { + H_DI_TEXT txt; + + if (uOpenDialog(title)) + return; + txt.str=mess; + txt.type=H_DTEXT_ALIGN_CENTRE; + if (uAddDialogItem(H_DIALOG_TEXT,NULL,&txt)) + return; + uRunDialog(); + } + +LOCAL_C VOID EncryptMessage(VOID) + { + P_MASK mask; + H_DI_EDIT ed; + TEXT in[20]; + TEXT out[38]; + + if (!pass[0]) + { + wInfoMsg("Can't encrypt with no password set"); + return; + } + p_setmask((VOID **)&mask,&pass[1]); + if (uOpenDialog("Encrypt message")) + return; + ed.str=(&in[0]); + ed.len=18; + in[0]=0; + if (uAddDialogItem(H_DIALOG_EDIT,"Message",&ed)) + return; + if (uRunDialog()<=0) + return; + p_encrypt(&mask,&in[1],in[0]); + MakeReadable(&out[0],&in[0]); + Report("Encrypted message",&out[0]); + } + +LOCAL_C VOID DecryptMessage(VOID) + { + P_MASK mask; + H_DI_SEDIT sed; + TEXT in[38]; + TEXT out[20]; + + if (!pass[0]) + { + wInfoMsg("Can't decrypt with no password set"); + return; + } + p_setmask((VOID **)&mask,&pass[1]); + if (uOpenDialog("Decrypt message")) + return; + sed.str=(&in[0]); + sed.len=36; + sed.width=16; + in[0]=0; + if (uAddDialogItem(H_DIALOG_SEDIT,"Message",&sed)) + return; + if (uRunDialog()<=0) + return; + MakeUnreadable(&out[0],&in[0]); + p_decrypt(&mask,&out[1],out[0]); + Report("Decrypted message",&out[0]); + } + +LOCAL_C VOID FileSize(VOID) + { + TEXT fname[P_FNAMESIZE+2]; + H_DI_FSEL fsel; + P_INFO info; + TEXT buf[30]; + + fname[0]=0; + fsel.fname=(&fname[0]); + fsel.flags=H_FILE_PICK_SELECTOR; + FOREVER + { + if (uOpenDialog("Find file size")) + return; + if (uAddDialogItem(H_DIALOG_FSEL,"File:",&fsel)) + return; + if (uRunDialog()<=0) + return; + fname[1+fname[0]]=0; + if (!uErrorValue(p_finfo(&fname[1],&info))) + { + p_atos(&buf[0],"File size is %lu bytes",info.size); + wInfoMsg(&buf[0]); + } + } + } + +LOCAL_C VOID ManageCommand(INT index) + { + switch (index) + { + case ITEMS_BEFORE_CONVERT: + InchAndCm(); + break; + case ITEMS_BEFORE_CONVERT+1: + MileAndKm(); + break; + case ITEMS_BEFORE_CONVERT+2: + PoundAndKg(); + break; + case ITEMS_BEFORE_CONVERT+3: + PintAndL(); + break; + case ITEMS_BEFORE_CONVERT+4: + Temperatures(); + break; + case ITEMS_BEFORE_CALENDAR: + DayOfWeek(); + break; + case ITEMS_BEFORE_CALENDAR+1: + hOODialog(DylHandle,C_OQD_COMBINS,OQD_DATE_COMBINS,NULL); + break; + case ITEMS_BEFORE_CALENDAR+2: + TimeDifference(); + break; + case ITEMS_BEFORE_CALENDAR+3: + Horoscope(); + break; + case ITEMS_BEFORE_CALENDAR+4: + TimeNow(); + break; + case ITEMS_BEFORE_SECRET: + EnterPassword(); + break; + case ITEMS_BEFORE_SECRET+1: + EncryptMessage(); + break; + case ITEMS_BEFORE_SECRET+2: + DecryptMessage(); + break; + case ITEMS_BEFORE_SPECIAL: + ChangeNdp(); + break; + case ITEMS_BEFORE_SPECIAL+1: + FileSize(); + break; + case ITEMS_BEFORE_SPECIAL+2: + p_exit(0); + } + } + +LOCAL_C VOID TryExecuteCommand(INT keycode) + { + keycode=uLocateCommand(keycode); + if (keycode>=0) + ManageCommand(keycode); + } + +LOCAL_C VOID MainLoop(VOID) + { + INT ret; + WMSG_KEY key; + + FOREVER + { + uGetKey(&key); + if (key.keycode&W_EVENT_KEY) + { + if (key.keycode==CONS_EVENT_COMMAND) + p_exit(0); + } + else if (key.keycode&W_SPECIAL_KEY) + TryExecuteCommand(key.keycode&(~W_SPECIAL_KEY)); + else if (key.keycode==W_KEY_MENU && !(key.modifiers&W_CTRL_MODIFIER)) + { + ret=uPresentMenus(); + if (ret>0) + TryExecuteCommand(ret); + } + } + } + +LOCAL_C VOID ReduceScreenSize(VOID) + { + W_WINDATA wd; + + wd.extent.tl.x=wd.extent.tl.y=0; + wd.extent.width=189; + wd.extent.height=80; + wSetWindow(MainWid,W_WIN_EXTENT,&wd); + if (uErrorValue(wCheckPoint())) + p_exit(0); + } + +LOCAL_C VOID CreateGC(VOID) + { + INT hgc; + + hgc=gCreateGC0(MainWid); + if (hgc<0) + p_exit(hgc); + } + +LOCAL_C VOID SpecificInit(VOID) + { + hInitAppRcb(); + DylHandle=hLoadOwnDyl(0); + hCrackCommandLine(); + MainWid=uFindMainWid(); + ReduceScreenSize(); + CreateGC(); + gBorder(W_BORD_CORNER_4); + wsEnable(); + CalcSmall(); + ttH=hTTOpen(); + } + +GLDEF_C VOID main(VOID) + { + uCommonInit(); + SpecificInit(); + MainLoop(); + } diff --git a/code/SIBOSDK/hwifood/oquery.dfl b/code/SIBOSDK/hwifood/oquery.dfl new file mode 100644 index 0000000..32b2b76 --- /dev/null +++ b/code/SIBOSDK/hwifood/oquery.dfl @@ -0,0 +1 @@ +oqd.dyl diff --git a/code/SIBOSDK/hwifood/oquery.pr b/code/SIBOSDK/hwifood/oquery.pr new file mode 100644 index 0000000..1e93326 --- /dev/null +++ b/code/SIBOSDK/hwifood/oquery.pr @@ -0,0 +1,17 @@ +#system epoc img +#set epocinit=iplib +#model small jpi + +#compile oquery.c + +#if %remake #or (oqd.dyl #older oquery.img) #or (oquery.dfl #older oquery.img) #then + #file delete oquery.img +#endif + +#pragma link(hwif.lib) + +#if (oquery.img #older oquery.afl) #or (oquery.img #older oquery.pic) #then + #file delete oquery.img +#endif + +#link oquery.img diff --git a/code/SIBOSDK/hwifood/oquery.rss b/code/SIBOSDK/hwifood/oquery.rss new file mode 100644 index 0000000..830f0b5 --- /dev/null +++ b/code/SIBOSDK/hwifood/oquery.rss @@ -0,0 +1,80 @@ +#include +#include + +RESOURCE MENU oqm_daynames + { + items = + { + CHOICE_ITEM { str="Monday";}, + CHOICE_ITEM { str="Tuesday";}, + CHOICE_ITEM { str="Wednesday";}, + CHOICE_ITEM { str="Thursday";}, + CHOICE_ITEM { str="Friday";}, + CHOICE_ITEM { str="Saturday";}, + CHOICE_ITEM { str="Sunday";} + }; + } + +RESOURCE ACLIST_ARRAY oqa_date_combins + { + button = + { + PUSH_BUT + { + keycode=W_KEY_ESCAPE; + str="Stop"; + }, + PUSH_BUT + { + keycode=W_KEY_MENU; + str="Backwards"; + }, + PUSH_BUT + { + keycode=W_KEY_RETURN; + str="Forwards"; + } + }; + } + +RESOURCE DIALOG oqd_date_combins + { + title="Find date combinations"; + controls= + { + CONTROL + { + class=C_CHLIST; + prompt="Day in week"; + info=CHLIST { rid=oqm_daynames; }; + }, + CONTROL + { + class=C_NCEDIT; + prompt="Day in month"; + info=NCEDIT + { + low=1; + high=31; + }; + }, + CONTROL + { + class=C_DTEDIT; + prompt="Found date"; + info=DTEDIT + { + flags=IN_DTEDIT_DDMMYYYY|IN_DTEDIT_INIT; + low=0; + high=93501l; + }; + }, + CONTROL + { + class=C_ACLIST; + info=ACLIST { rid=oqa_date_combins; }; + } + }; + } + +RESOURCE STRING oqs_no_further_matches { str="No further matches"; } diff --git a/code/SIBOSDK/hwifood/query.ms b/code/SIBOSDK/hwifood/query.ms new file mode 100644 index 0000000..900368a --- /dev/null +++ b/code/SIBOSDK/hwifood/query.ms @@ -0,0 +1 @@ +Query diff --git a/code/SIBOSDK/hwifood/query.pic b/code/SIBOSDK/hwifood/query.pic new file mode 100644 index 0000000..8ab3856 Binary files /dev/null and b/code/SIBOSDK/hwifood/query.pic differ diff --git a/code/SIBOSDK/hwifood/query.shd b/code/SIBOSDK/hwifood/query.shd new file mode 100644 index 0000000..97e58fc Binary files /dev/null and b/code/SIBOSDK/hwifood/query.shd differ diff --git a/code/SIBOSDK/hwifsrc/diyhwif.c b/code/SIBOSDK/hwifsrc/diyhwif.c new file mode 100644 index 0000000..40908f1 --- /dev/null +++ b/code/SIBOSDK/hwifsrc/diyhwif.c @@ -0,0 +1,88 @@ +/* + DIYHWIF.C + +Started by DavidW, 6/11/92 + +Routines to access some dialog item classes + +*/ + +#include +#include +#include +#include + +GLREF_D PR_DLGBOX *DatDialogPtr; + +GLDEF_C VOID hDTClose(VOID *dte) + { + p_send2(dte,O_DESTROY); + } + +GLDEF_C VOID hDTSet(VOID *dte,H_SE_DTEDIT *sdte) + { + p_send3(dte,O_WN_SET,sdte); + } + +GLDEF_C VOID hDTSense(VOID *dte,H_SE_DTEDIT *sdte) + { + p_send3(dte,O_WN_SENSE,sdte); + } + +GLDEF_C INT hDTSelfCheck(VOID *dte) + { + INT ret; + + ret=p_send2(dte,O_LG_SELF_CHECK); + return(ret!=LG_CHECK_OK && ret!=LG_CHECK_OK_CHANGED); + } + +GLDEF_C VOID hDTEmphasise(VOID *dte,INT flag) + { + p_send3(dte,O_WN_EMPHASISE,flag); + } + +GLDEF_C INT hDTHandleKey(VOID *dte,INT keycode,INT modifier) + { + return(p_send4(dte,O_WN_KEY,keycode,modifier)); + } + +GLDEF_C VOID *hDTOpen(H_DTEDIT *dte) + { + VOID *self; + PR_WIN win; + + self=uCheckHandle(p_new(CAT_HWIF_HWIM,C_DTEDIT)); + if (self) + { + win.win.id=dte->win; + p_send4(self,O_WN_INIT,dte,&win); + p_send5(self,O_LG_SET_ID_POS,dte->win,&dte->pos,dte->width); + hDTEmphasise(self,dte->emph); + } + return(self); + } + +GLDEF_C VOID hSetVarrayInChlist(INT index,INT nsel,VOID *varray) + { + SE_CHLIST set; + + set.nsel=nsel; + set.data=varray; + set.set_flags=SE_CHLIST_DATA|SE_CHLIST_NSEL|SE_CHLIST_RETAIN; + p_send4(DatDialogPtr,O_WN_SET,index,&set); + } + +GLDEF_C VOID uSetDialogUline(INT pos,INT on) + { + DLGBOX_ITEM *pitm; + + pitm=(DatDialogPtr->dlgbox.count>7)? + DatDialogPtr->dlgbox.u.pitm+pos: + &DatDialogPtr->dlgbox.u.item[pos]; + if (on) + pitm->flags|=DLGBOX_ITEM_UNDERLINED; + else + pitm->flags&=(~DLGBOX_ITEM_UNDERLINED); + } + diff --git a/code/SIBOSDK/hwifsrc/ehwif.c b/code/SIBOSDK/hwifsrc/ehwif.c new file mode 100644 index 0000000..f69cab0 --- /dev/null +++ b/code/SIBOSDK/hwifsrc/ehwif.c @@ -0,0 +1,276 @@ +/* + EHWIF.C + +Started by DavidW, 5/12/91 + +Edit box extension to h layer of hwif + +*/ + +#include +#include +#include +#include +#include + +GLDEF_D UWORD _ebControlFormat=FALSE; + +#define EebH ((PR_EDWIN *)ebH) + + +#pragma save,ENTER_CALL + +LOCAL_C INT DoEntersend(VOID *ebH,INT method,VOID *p1,VOID *p2,VOID *p3) + { + p_send5(ebH,method,p1,p2,p3); + return(0); + } + +#pragma restore + +LOCAL_C INT Entersend(VOID *ebH,INT method,VOID *p1,VOID *p2,VOID *p3) + { + INT ret; + + ret=p_enter6(DoEntersend,ebH,method,p1,p2,p3); + if (ret<-1) + uErrorValue(ret); + return(ret); + } + +#define V (VOID*) + +GLDEF_C INT hEBCompleteFormat(VOID *ebH) + { + PR_SCRIMG *scrimg; + INT ret; + + scrimg=EebH->edwin.scrimg; + if (!scrimg->scrimg.formatting) + return(0); + ret=Entersend(scrimg,O_SI_SET,0,0,0); + p_send2(scrimg->scrimg.wrap,O_AO_CANCEL); + return(ret); + } + +GLDEF_C INT hEBHandleKey(VOID *ebH,INT keycode,INT modifier) + { + INT ret; + + if (keycode==W_KEY_RETURN) + modifier|=W_SHIFT_MODIFIER; + ret=Entersend(ebH,O_WN_KEY,V keycode,V modifier,NULL); + if (!ret && !_ebControlFormat) + ret=hEBCompleteFormat(ebH); + return(ret); + } + +GLDEF_C VOID hEBClose(VOID *ebH) + { + p_send2(ebH,O_DESTROY); + } + +GLDEF_C TEXT *hEBSenseText(VOID *ebH) + { + SE_EDWIN sense; + + p_send3(ebH,O_WN_SENSE,&sense); + return(sense.buf); + } + +GLDEF_C INT hEBSetText(VOID *ebH,TEXT *pb,INT blen) + { + SE_EDWIN set; + + set.buf=pb; + set.len=blen; + return(Entersend(ebH,O_WN_SET,&set,NULL,NULL)); + } + +GLDEF_C VOID hEBEmphasise(VOID *ebH,INT flag) + { + p_send3(ebH,O_WN_EMPHASISE,flag); + } + +GLDEF_C INT hEBSetSelect(VOID *ebH,INT aoff,INT coff) + { + SET_EDWIN set; + + set.flags=SET_EDWIN_CURSOR|SET_EDWIN_ANCHOR; + set.anchor=aoff; + set.cursor=coff; + return(Entersend(ebH,O_EW_SET,&set,NULL,NULL)); + } + +GLDEF_C INT hEBSenseSelect(VOID *ebH,UWORD *top) + { + return(p_send3(EebH->edwin.scrimg,O_SI_GET_SELECT,top)); + } + +GLDEF_C INT hEBSetClipText(VOID *ebH,TEXT *pb,INT blen) + { + return(Entersend(EebH->edwin.clip,O_EP_SET_TEXT,pb,V blen,0)); + } + +GLDEF_C TEXT *hEBSenseClipText(VOID *ebH) + { + TEXT *pb; + + p_send3(EebH->edwin.clip,O_EF_SENSE_BUF,&pb); + return(pb); + } + +GLDEF_C INT hEBEvaluate(VOID *ebH) + { + return(Entersend(ebH,O_EW_EVALUATE,NULL,NULL,NULL)); + } + +GLDEF_C INT hEBChangeWidth(VOID *ebH,INT width) + { + P_EXTENT ext; + + p_send3(ebH,O_EW_SENSE_SIZE,&ext); + EebH->edwin.margins.right+=width-ext.width; + ext.width=width; + return(Entersend(ebH,O_EW_SET_SIZE,&ext,NULL,NULL)); + } + +GLDEF_C INT hEBSetMargin(VOID *ebH,UINT right) + { + INT ret; + UINT oright; + + oright=EebH->edwin.margins.right; + EebH->edwin.margins.right=right; + ret=Entersend(EebH->edwin.scrimg, + O_SI_STYLE_CHANGED,SCRIMG_STCHNG_DOC,NULL,NULL); + if (ret<0) + EebH->edwin.margins.right=oright; + return(ret); + } + +GLDEF_C UINT hEBSenseMargin(VOID *ebH) + { + return(EebH->edwin.margins.right); + } + +GLDEF_C INT hEBInsert(VOID *ebH,TEXT *pb,INT blen) + { + return(Entersend(ebH,O_EW_INSERT,pb,V blen,NULL)); + } + +GLDEF_C INT hEBReplace(VOID *ebH,TEXT *replace,INT backwards) + { + return(Entersend(ebH,O_EW_REPLACE,replace,V backwards,NULL)); + } + +GLDEF_C INT hEBCopy(VOID *ebH) + { + if (!(EebH->edwin.select)) + return(1); + return(Entersend(ebH,O_EW_REPLACE_CLIP,NULL,NULL,NULL)); + } + +GLDEF_C INT hEBPaste(VOID *ebH) + { + if (!(p_send2(EebH->edwin.clip,O_EP_SENSE_LEN))) + return(1); + return(Entersend(ebH,O_EW_PASTE_CLIP,NULL,NULL,NULL)); + } + +GLDEF_C INT hEBFind(VOID *ebH,TEXT *str,INT flags) + { + return(p_send4(ebH,O_EW_FIND,str,flags)); + } + +GLDEF_C INT hEBSenseChanged(VOID *ebH) + { + return(EebH->edwin.change); + } + +GLDEF_C VOID hEBClearChanged(VOID *ebH) + { + EebH->edwin.change=FALSE; + } + +GLDEF_C VOID hEBSetCWidth(VOID *ebH,INT cwidth) + { + SCRIMG_WIN win; + + p_send3(EebH->edwin.scrimg,O_SI_SENSE,&win); + win.cwidth=cwidth; + Entersend(EebH->edwin.scrimg,O_SI_SET,&win,NULL,NULL); + } + + +GLDEF_C INT hEBShowSymbols(VOID *ebH,INT flag) + { + SCRLAY_STYLE style; + + p_send3(EebH->edwin.scrlay,O_SL_SENSE,&style); + style.options=FALSE; + if (flag) + style.options=SCRLAY_SHOW_SPACES|SCRLAY_SHOW_LFS; + p_send3(EebH->edwin.scrlay,O_SL_SET,&style); + return(Entersend(EebH->edwin.scrimg,O_SI_STYLE_CHANGED,0,0,0)); + } + +GLDEF_C VOID *hEBOpen(INT flags,H_EDIT_BOX *heb) + { + VOID *ebH; + IN_EDWIN in; + IN_EDWIN_X inx; + PR_WIN win; + + ebH=uCheckHandle(p_new(CAT_HWIF_HWIM,C_EDWIN)); + if (!ebH) + return(NULL); + win.win.id=heb->win; + in.vulen=heb->vulen; + in.flags=flags|IN_EDWIN_VULEN_PIXELS + |IN_EDWIN_NO_AUTOSELECT|IN_EDWIN_POSITION_SUPPLIED; + in.maxlen=heb->maxchars; + in.contents[0]=0; + inx.vislines=heb->vislines; + inx.pos=heb->pos; + inx.font=heb->font; + inx.style=heb->style; + inx.leading.total=heb->lead_tot; + inx.leading.top=heb->lead_top; + inx.clip=NULL; + if (Entersend(ebH,O_WN_INIT,&in,&win,&inx)) + { + hEBClose(ebH); + return(NULL); + } + return(ebH); + } + +GLDEF_C VOID *hEBSenseDoc(VOID *ebH) + { + return(EebH->edwin.doc); + } + +GLDEF_C INT hEDCapacity(VOID *doc,UINT maxlen) + { + return(Entersend(doc,O_EP_CAPACITY,V (maxlen+1),NULL,NULL)); + } + +GLDEF_C INT hEDInsert(VOID *doc,UINT pos,VOID *buf,UINT len) + { + return(Entersend(doc,O_EP_INSERT,V pos,buf,V len)); + } + +GLDEF_C INT hEBDocChanged(VOID *ebH) + { + UINT doclen; + + doclen=p_send2(EebH->edwin.doc,O_EP_SENSE_LEN); + EebH->edwin.clen=doclen+1; + return(Entersend(EebH->edwin.scrimg,O_SI_DOC_CHANGED,V doclen,NULL,NULL)); + } + +GLDEF_C INT hEBPosToXL(void *ebH,H_SCRLAY_PLX *plx) + { + return(p_send3(EebH->edwin.scrlay,O_SL_POS_TO_XL,plx)); + } diff --git a/code/SIBOSDK/hwifsrc/hhwif.c b/code/SIBOSDK/hwifsrc/hhwif.c new file mode 100644 index 0000000..caa6d48 --- /dev/null +++ b/code/SIBOSDK/hwifsrc/hhwif.c @@ -0,0 +1,209 @@ +/* + HHWIF.C + +Started by Huw 11/3/91 + +Routines for supplying menus and dialogs for non OOP users +such as OPL/W +*/ + +#include +#include +#include +#include +#include + +GLREF_D PR_GATE *DatGate; +GLDEF_D UWORD _UseFullScreen; +GLDEF_D UWORD *_GreyLines; +GLDEF_D UWORD *_MenuPositions; +GLDEF_D UWORD _SmallFontDialog; + +GLDEF_C INT hIFInit(VOID *console) +/* +Initialise HWIM interface +*/ + { + if (!(DatGate=p_new(CAT_HWIF_HWIM,C_GATE))) + return(E_GEN_NOMEMORY); + if (_UseFullScreen) + p_send2(DatGate,O_GT_XW_ENABLE); + return(p_send3(DatGate,O_GT_INIT,console)); + } + +GLDEF_C INT hMenuOpen() +/* +Create a new menu bar +*/ + { + return(p_send2(DatGate,O_GT_MENU_OPEN)); + } + +GLDEF_C INT hMenuAdd(TEXT *title,VOID *menu) +/* +Add another menu to the menu bar +*/ + { + return(p_send4(DatGate,O_GT_MENU_ADD,title,menu)); + } + +GLDEF_C INT hMenuRun() +/* +Display and use the menu bar + +Note that due to the addition of 'gate.g.dx' in os 356 and above, the +property 'gate.g.ulines' is in different places on different models. + +Older models will be expecting the greyline data to be where later +models look for 'gate.g.dx', so a test is required to determine where +to copy the greyline data to. +*/ + { + if (_GreyLines) + { + p_bcpy((BYTE *)&DatGate->gate.g.ulines[0]-((p_version()>0x355f)?0: + sizeof(DLG_X_CONSTANTS)),_GreyLines,16*sizeof(UWORD)); + } + return(p_send3(DatGate,O_GT_MENU_RUN,_MenuPositions)); + } + +GLDEF_C VOID hMenuClose() +/* +Close an incomplete menu bar down +*/ + { + p_send2(DatGate,O_GT_MENU_CLOSE); + } + +GLDEF_C INT hDlgOpen(TEXT *title) +/* +Create a new dialog +*/ + { + INT method; + + method=O_GT_DIAL_OPEN; + if (_SmallFontDialog) + { + method=O_GT_DIAL_SOPEN; + _SmallFontDialog=FALSE; + } + return(p_send3(DatGate,method,title)); + } + +GLDEF_C INT hDlgAdd(UWORD type,TEXT *prompt,VOID *data) +/* +Add an item to the dialog +*/ + { + return(p_send5(DatGate,O_GT_DIAL_ADD,type,prompt,data)); + } + +GLDEF_C INT hDlgRun() +/* +Display and use the dialog +*/ + { + return(p_send2(DatGate,O_GT_DIAL_RUN)); + } + +GLDEF_C VOID hDlgClose() +/* +Close an incomplete dialog down +*/ + { + p_send2(DatGate,O_GT_DIAL_CLOSE); + } + +GLDEF_C VOID *hCardOpen() +/* +Open a menu card for building +*/ + { + return((VOID *)p_send2(DatGate,O_GT_CARD_OPEN)); + } + +GLDEF_C INT hCardAdd(VOID *hand,INT index,INT accel,TEXT *str) +/* +Add an item to a menu card +*/ + { + H_CARD card; + + card.accel=accel; + card.str=str; + return(p_send5(DatGate,O_GT_CARD_ADD,hand,index,&card)); + } + +GLDEF_C VOID hCardClose(VOID *hand) +/* +Discard a menu card +*/ + { + p_send3(DatGate,O_GT_CARD_CLOSE,hand); + } + +GLDEF_C VOID *hChoiceOpen() +/* +Open a choice list for building +*/ + { + return((VOID *)p_send2(DatGate,O_GT_CHOICE_OPEN)); + } + +GLDEF_C INT hChoiceAdd(VOID *hand,INT index,TEXT *str) +/* +Add an item to a choice list +*/ + { + H_CHOICE choice; + + choice.str=str; + return(p_send5(DatGate,O_GT_CHOICE_ADD,hand,index,&choice)); + } + +GLDEF_C VOID hChoiceClose(VOID *hand) +/* +Discard a choice list +*/ + { + p_send3(DatGate,O_GT_CHOICE_CLOSE,hand); + } + +GLDEF_C VOID *hButtonOpen() +/* +Open a action list for building +*/ + { + return((VOID *)p_send2(DatGate,O_GT_BUTTON_OPEN)); + } + +GLDEF_C INT hButtonAdd(VOID *hand,INT index,INT key,TEXT *str) +/* +Add a button to an action list +*/ + { + H_BUTTON but; + + but.keycode=key; + but.str=str; + return(p_send5(DatGate,O_GT_BUTTON_ADD,hand,index,&but)); + } + +GLDEF_C VOID hButtonClose(VOID *hand) +/* +Discard an action list +*/ + { + p_send3(DatGate,O_GT_BUTTON_CLOSE,hand); + } + +GLDEF_C INT hDlgPosition(INT x,INT y) + { + return(p_send4(DatGate,O_GT_DIAL_POSITION,x,y)); + } + +GLDEF_C UINT hLastSystemKey(UINT *pmodifiers) + { + return(p_send3(DatGate,O_GT_LAST_KEY,pmodifiers)); + } diff --git a/code/SIBOSDK/hwifsrc/hwif.cat b/code/SIBOSDK/hwifsrc/hwif.cat new file mode 100644 index 0000000..2c49dec --- /dev/null +++ b/code/SIBOSDK/hwifsrc/hwif.cat @@ -0,0 +1,23 @@ +IMAGE hwif + +EXTERNAL olib +EXTERNAL hwim + +INCLUDE lprinter.g +INCLUDE help.g + +CLASS hprinter lprinter + { + REPLACE lpr_read + REPLACE lpr_sense_text + PROPERTY + { + INT (*sense)(WDR_PRINT *); + } + } + +CLASS hhelpdlg helpdlg + { + REPLACE destroy + } + diff --git a/code/SIBOSDK/hwifsrc/hwif.h b/code/SIBOSDK/hwifsrc/hwif.h new file mode 100644 index 0000000..47015ec --- /dev/null +++ b/code/SIBOSDK/hwifsrc/hwif.h @@ -0,0 +1,339 @@ +/* HEADER - HWIF.H +Copyright (C) Psion PLC 1992 + VER DATE BY DESCRIPTION +===== ======== === =========== +1.20F 08/11/92 DWW New version for Developers Conference +2.00F 01/12/93 DWW Version 2 C SDK +*/ +#ifndef HWIF_H +#define HWIF_H + +#include +#include + +#ifdef STDEPOC_H +# include +#else +# ifndef EPOCCONS_H +# include +# endif +#endif + +typedef struct + { + char *title; + unsigned short int nlines; + } H_MENU_DATA; +#define H_DIALOG_TEXT 0 +#define H_DIALOG_CHOICE 1 +#define H_DIALOG_NUMBER 2 +#define H_DIALOG_FLOAT 3 +#define H_DIALOG_TIME 4 +#define H_DIALOG_DATE 5 +#define H_DIALOG_EDIT 6 +#define H_DIALOG_SEDIT 7 +#define H_DIALOG_XINPUT 8 +#define H_DIALOG_FSEL 9 +#define H_DIALOG_BUTTONS 10 +typedef struct + { + char *str; + unsigned short int type; + } H_DI_TEXT; +#define H_DTEXT_ALIGN_LEFT 0 +#define H_DTEXT_ALIGN_RIGHT 1 +#define H_DTEXT_ALIGN_CENTRE 2 +#define H_DTEXT_BOLD 0x100 +#define H_DTEXT_UNDERLINE 0x200 +#define H_DTEXT_SELECTABLE 0x400 +typedef struct + { + union + { + unsigned short int *sel; + unsigned short int count; + } u; + void *menu; + } H_DI_CHOICE; +typedef struct + { + long int *value; + long int low; + long int high; + } H_DI_NUMBER; +typedef struct + { + double *value; + double low; + double high; + } H_DI_FLOAT; +typedef struct + { + unsigned long int *value; + unsigned long int low; + unsigned long int high; + unsigned short int type; + } H_DI_TIME; +#define H_DTIME_SHOW_SECONDS 1 +#define H_DTIME_DURATION 2 +typedef struct + { + unsigned long int *value; + unsigned long int low; + unsigned long int high; + } H_DI_DATE; +#define H_LAST_DAY 93501l +#define H_FIRST_SYS_DAY 25567l +#define H_LAST_SYS_DAY 75276l +typedef struct + { + char *str; + unsigned short int len; + } H_DI_EDIT; +typedef struct + { + char *str; + unsigned short int len; + unsigned short int width; + } H_DI_SEDIT; +typedef struct + { + char *str; + } H_DI_XINPUT; +typedef struct + { + char *fname; + unsigned short int flags; + } H_DI_FSEL; +typedef struct + { + char *str; + short int accel; + } H_CARD; +typedef struct + { + char *str; + } H_CHOICE; +typedef struct + { + char *str; + unsigned short int keycode; + } H_BUTTON; +#define W_EVENT_KEY (CONS_SPECIAL_EVENT*256) +#define H_FILE_ALLOW_DIRS 0x02 +#define H_FILE_JUST_DIRS 0x04 +#define H_FILE_FORCE_NXIST 0x08 +#define H_FILE_NO_AUTOQUERY 0x10 +#define H_FILE_ACCEPT_NULL 0x20 +#define H_FILE_SET_DEFEXT 0x40 +#define H_FILE_CAN_WILDCARD 0x80 +#define H_FILE_RESTRICT_LIST H_FILE_FORCE_NXIST +#define H_FILE_PICK_SELECTOR 0 +#define H_FILE_NEW_EDITOR 0x01 +#define H_PRINT_PAGE 0x01 +#define H_PRINT_LINE 0x02 +#define H_PRINT_RIGHT 0x04 +#define H_PRINT_TEXT 0x10 +#define H_PRINT_KEEP 0x8000 +#define H_PRINT_STY_UNDERLINE 0x01 +#define H_PRINT_STY_BOLD 0x02 +#define H_PRINT_STY_ITALIC 0x04 +#define H_PRINT_STY_SUPER 0x08 +#define H_PRINT_STY_SUB 0x10 +typedef struct + { + short int flags; + short int typf; + short int fheight; + short int style; + short int down; + short int indent; + short int height; + short int right; + char *buf; + unsigned short int blen; + } H_PRINT; +#define H_TIME_SET_SDATE 0 +#define H_TIME_SET_DATE 1 +#define H_TIME_SET_DAYSEC 2 +#define H_TIME_SET_NOW 3 +#define H_TIME_SENSE_BOTH 3 +#define H_TIME_SENSE_DATE 4 +#define H_TIME_SENSE_TIME 5 +#define H_TIME_FORMAT_NO_DAY 0x0004 +#define H_TIME_FORMAT_NO_MONTH 0x0008 +#define H_TIME_FORMAT_NO_YEAR 0x0010 +#define H_TIME_FORMAT_MONTH_NAME 0x0020 +#define H_TIME_FORMAT_SUFFIX 0x0040 +#define H_TIME_FORMAT_DAY_NAME 0x0080 +#define H_TIME_FORMAT_NO_CENTURY 0x0100 +#define H_TIME_FORMAT_NO_SECONDS 0x0200 +#define H_ALARM_TIMED 2 +#define H_ALARM_UNTIMED 1 +typedef struct + { + unsigned short int maxchars; + unsigned short int vulen; + unsigned short int vislines; + P_POINT pos; + unsigned short int win; + unsigned short int font; + unsigned short int style; + unsigned short int lead_tot; + unsigned short int lead_top; + } H_EDIT_BOX; +typedef struct + { + unsigned short int pos; + short int line; + short int x; + } H_SCRLAY_PLX; +#define H_EDIT_BOX_CLIPBOARD 0x0040 +#define H_EDIT_BOX_LEFT_CURSOR 0x0200 +#define H_EDIT_BOX_FONT 0x1000 +#define H_EDIT_BOX_LEADING 0x2000 +#define H_EDIT_BOX_VISLINES 0x4000 +#define HEB_FIND_BACKWARDS 0x01 +#define HEB_FIND_CASESENS 0x02 +#define H_DTEDIT_DDMMYYYY 0x0000 +#define H_DTEDIT_HHMMSS 0x1100 +#define H_DTEDIT_HHMM 0x0100 +#define H_DTEDIT_HHMMSS_D 0x1300 +#define H_DTEDIT_HHMM_D 0x0300 +#define H_DTEDIT_SET_VALUE 0x0001 +#define H_DTEDIT_SET_LOW 0x0002 +#define H_DTEDIT_SET_HIGH 0x0004 +typedef struct + { + unsigned short int flags; + long int value; + long int low; + long int high; + P_POINT pos; + unsigned short int win; + unsigned short int width; + unsigned short int emph; + } H_DTEDIT; +typedef struct + { + unsigned short int flags; + long int value; + long int low; + long int high; + } H_SE_DTEDIT; +#ifdef __cplusplus +extern "C" { +#endif +extern int hIFInit(void *); +extern int hMenuOpen(void); +extern int hMenuAdd(char *,void *); +extern int hMenuRun(void); +extern void hMenuClose(void); +extern int hDlgOpen(char *); +extern int hDlgAdd(unsigned short int,char *,void *); +extern int hDlgRun(void); +extern void hDlgClose(void); +extern int hDlgPosition(int x,int y); +extern void *hCardOpen(void); +extern int hCardAdd(void *,int,int,char *); +extern void hCardClose(void *); +extern void *hChoiceOpen(void); +extern int hChoiceAdd(void *,int,char *); +extern void hChoiceClose(void *); +extern void *hButtonOpen(void); +extern int hButtonAdd(void *,int,int,char *); +extern void hButtonClose(void *); +extern void hEnsurePath(char *fname); +extern void hSetUpStatusNames(char *pb); +extern int hCrackCommandLine(void); +extern int hIsDbfCompressible(void *dH); +extern int hDTMFString(char *zts); +extern unsigned int hLastSystemKey(unsigned int *pmodifiers); +extern void uCommonInit(void); +extern void uEnableGrey(void); +extern void uGetKey(WMSG_KEY *pkey); +extern void uGetKeyA(short int *pstat,WMSG_KEY *pkey); +extern void uCancelGetKeyA(void); +extern int uKeyPressOutstanding(void); +extern void uEscape(unsigned short int flag); +extern unsigned int uFindMainWid(void); +extern void uForceToFront(void); +extern void uErrorString(char *message); +extern int uErrorValue(int ret); +extern void *uCheckHandle(void *handle); +extern void uZTStoBCS(char *bcs,char *zts); +extern int uOpenDialog(char *title); +extern int uAddDialogItem(int type,char *prompt,void *data); +extern int uRunDialog(void); +extern int cdecl uAddButtonList(char *but,int code,...); +extern int uBeginDCL(H_DI_CHOICE *pch); +extern int uGrowDCL(H_DI_CHOICE *pch,char *choice); +extern int uAddDCL(char *prompt,unsigned short int *nsel,H_DI_CHOICE *pch); +extern int cdecl uAddChoiceList(char *prompt,unsigned short int *nsel,char *choice,...); +extern int cdecl uDialogMenu(char *title,char *pb,...); +extern void cdecl uDisplayText(char *pb,...); +extern int uPresentMenus(void); +extern void uAddGreyUline(unsigned char,unsigned short int *plines); +extern void uSetDialogUline(int pos,int on); +extern int uLocateCommand(int accel); +extern void hPrintSetupDialog(void); +extern void hPrint(int printline(H_PRINT *)); +extern void hPrinterSetupDialog(void); +extern void hPrintSetSI(unsigned int subsqind); +extern int hPrintSensePageWidth(void); +extern int hPrintSenseBufWidth(char *buf,int blen); +extern void hHelpSubSystem(int startid,int indexid); +extern void *hTTOpen(void); +extern int hTTSetTime(void *handle,int type,void *data); +extern int hTTSenseString(void *handle,int type,char *buf); +extern void hTTSetFormat(void *handle,int values); +extern void hTTSetAbbreviations(void *handle,int dayabb,int monabb); +extern void hTTClose(void *handle); +extern int hEBHandleKey(void *ebH,int keycode,int modifier); +extern int hEBCompleteFormat(void *ebH); +extern char *hEBSenseText(void *ebH); +extern int hEBSetText(void *ebH,char *pb,int blen); +extern void hEBEmphasise(void *ebH,int flag); +extern int hEBSetSelect(void *ebH,int aoff,int coff); +extern int hEBSenseSelect(void *ebH,unsigned short int *top); +extern int hEBSetClipText(void *ebH,char *pb,int blen); +extern char *hEBSenseClipText(void *ebH); +extern int hEBEvaluate(void *ebH); +extern int hEBSetMargin(void *ebH,unsigned int right); +extern unsigned int hEBSenseMargin(void *ebH); +extern int hEBChangeWidth(void *ebH,int width); +extern void hEBSetCWidth(void *ebH,int cwidth); +extern int hEBInsert(void *ebH,char *pb,int blen); +extern int hEBReplace(void *ebH,char *replace,int backwards); +extern int hEBCopy(void *ebH); +extern int hEBPaste(void *ebH); +extern int hEBFind(void *ebH,char *str,int flags); +extern int hEBSenseChanged(void *ebH); +extern void hEBClearChanged(void *ebH); +extern int hEBShowSymbols(void *ebH,int flag); +extern void *hEBOpen(int flags,H_EDIT_BOX *heb); +extern void hEBClose(void *ebH); +extern void *hEBSenseDoc(void *ebH); +extern int hEDCapacity(void *doc,unsigned int maxlen); +extern int hEDInsert(void *doc,unsigned int pos,void *buf,unsigned int len); +extern int hEBDocChanged(void *ebH); +extern int hEBPosToXL(void *ebH,H_SCRLAY_PLX *plx); +extern void hDeclareAppRcb(void *rcb); +extern void *hInitAppRcb(void); +extern int hSetSystemResLang(int lang); +extern void hRequestReplacePack(void *rcb,char *fname); +extern void *hDTOpen(H_DTEDIT *dte); +extern void hDTClose(void *dte); +extern void hDTSet(void *dte,H_SE_DTEDIT *sdte); +extern void hDTSense(void *dte,H_SE_DTEDIT *sdte); +extern int hDTSelfCheck(void *dte); +extern int hDTHandleKey(void *dte,int keycode,int modifier); +extern void hDTEmphasise(void *dte,int flag); +extern void hSetVarrayInChlist(int index,int nsel,void *varray); +extern void hOODialog(int catHandle,int classno,int resid,void *rbuf); +extern int hLoadOwnDyl(int index); +#ifdef __cplusplus +} +#endif + +#endif // HWIF_H diff --git a/code/SIBOSDK/hwifsrc/hwif.pr b/code/SIBOSDK/hwifsrc/hwif.pr new file mode 100644 index 0000000..82dfc30 --- /dev/null +++ b/code/SIBOSDK/hwifsrc/hwif.pr @@ -0,0 +1,17 @@ +#system epoc img +#model small jpi + +#message "HWIF library project file" + +#compile hwif.cat + +#compile hhwif.c +#compile xhwif.c +#compile uhwif.c +#compile phwif.c +#compile thwif.c +#compile ehwif.c +#compile rhwif.c +#compile diyhwif.c + +#dolink hwif.lib diff --git a/code/SIBOSDK/hwifsrc/hwifo.pr b/code/SIBOSDK/hwifsrc/hwifo.pr new file mode 100644 index 0000000..03caf3a --- /dev/null +++ b/code/SIBOSDK/hwifsrc/hwifo.pr @@ -0,0 +1,18 @@ +#system epoc img +#model small jpi + +#message "HWIFO library project file" + +#compile hwif.cat +#dolink dummy.lib + +#compile hhwif.c +#compile xhwif.c +#compile uhwif.c +#compile phwif.c +#compile thwif.c +#compile ehwif.c +#compile rhwif.c +#compile diyhwif.c + +#dolink hwifo.lib diff --git a/code/SIBOSDK/hwifsrc/hwifsrc.prj b/code/SIBOSDK/hwifsrc/hwifsrc.prj new file mode 100644 index 0000000..74a0185 --- /dev/null +++ b/code/SIBOSDK/hwifsrc/hwifsrc.prj @@ -0,0 +1,20 @@ +hwifsrc.prj ! releases source files +read.me ! read me for distribution +release.txt ! list of changes between releases +! +hwif.pr ! TS project file +hwifo.pr ! Alternative project file +make.bat ! Makes HWIF.LIB & HWIFO.LIB +ts.red ! Redirector (for completeness) +! +hwif.cat ! printing subclass definition +hhwif.c ! original h layer of hwif +xhwif.c ! later additions to h layer of hwif +uhwif.c ! u layer of hwif +phwif.c ! printing routines +thwif.c ! time manipulation routines +ehwif.c ! edit box routines +rhwif.c ! resource file routines +diyhwif.c ! DIY dialog item routines +! +hwif.h ! header file (releasable) diff --git a/code/SIBOSDK/hwifsrc/make.bat b/code/SIBOSDK/hwifsrc/make.bat new file mode 100644 index 0000000..d3aa98e --- /dev/null +++ b/code/SIBOSDK/hwifsrc/make.bat @@ -0,0 +1,4 @@ +@echo off +tscx /m hwif /v0 +tscx /m hwif /v0 +tscx /m hwifo /v0 diff --git a/code/SIBOSDK/hwifsrc/phwif.c b/code/SIBOSDK/hwifsrc/phwif.c new file mode 100644 index 0000000..4a01361 --- /dev/null +++ b/code/SIBOSDK/hwifsrc/phwif.c @@ -0,0 +1,216 @@ +/* + PHWIF.C + +Started by DavidW, 5/12/91 + +Printing extension to h layer of hwif + +Help subsystem extension added 3/8/92 + +*/ + +#include +#include +#include +#include +#include +#include + +GLREF_D PR_WSERV *w_ws; +GLREF_D PR_HWIMMAN *w_am; +GLREF_D PR_GATE *DatGate; +GLREF_D UWORD DatLocked; + +typedef struct + { + INT (*f)(WDR_PRINT *); + } GATE_PRINTER; + +typedef struct + { + HANDLE catHand; + INT class; + DL_DATA d; + } GATE_OOD; + +#define GATE_FORCE_WSERV_LEAVE FALSE + + +#pragma save,ENTER_CALL + +LOCAL_C INT EditPrintContext(VOID *junk) + { + p_send2(w_ws,O_WS_EDIT_PRINT_CONTEXT); + return(0); + } + +LOCAL_C INT EditPrinterSetup(VOID *junk) + { + p_send2(w_ws,O_WS_EDIT_PDEV_SETUP); + return(0); + } + +#define _phand ((PR_HPRINTER *)(w_ws->wserv.filelist)) + +LOCAL_C INT DoPrint(VOID *par) + { + _phand=p_new(CAT_HWIF_HWIF,C_HPRINTER); + if (!_phand) + return(E_GEN_NOMEMORY); + _phand->hprinter.sense=((GATE_PRINTER *)par)->f; + p_send2(_phand,O_LPR_INIT); + return(0); + } + +LOCAL_C INT HelpSubSystem(VOID *par) + { + p_send3(w_ws,O_WS_DO_HELP,(INT)par); + p_reclass(CAT_HWIF_HWIF,C_HHELPDLG,w_ws->wserv.dial); + p_send2(w_am,O_AM_START); + return(0); + } + +#define _dld ((GATE_OOD *)par) + +LOCAL_C INT LaunchDialog(VOID *par) + { + p_send5(w_ws,O_WS_DO_DIAL,_dld->catHand,_dld->class,&_dld->d); + return(0); + } + +#pragma restore + +LOCAL_C UINT ConsoleOff(UWORD state,UINT leavestate) +/* +Set the console read off or on dependent on state +Also enable or disable leaves from the Window Server. +Return the old value of the disable leaves status. +*/ + { + UINT func; + + func=P_SCR_DISABLE_READS; + p_iow4(DatGate->gate.concb,P_FSET,&func,&state); + return(wDisableLeaves(leavestate)); + } + +LOCAL_C VOID ViaGate( +#pragma save,ENTER_CALL + INT func(VOID *),VOID *par) +#pragma restore + { + INT leavestate; + INT ret; + PR_WAOTSTAT *waotstat; + + leavestate=ConsoleOff(TRUE,GATE_FORCE_WSERV_LEAVE); + w_ws->wserv.flags&=(~PR_WSERV_FROM_HWIF); + DatLocked++; + ret=p_enter2(func,par); + DatLocked--; + w_ws->wserv.flags|=PR_WSERV_FROM_HWIF; + ConsoleOff(FALSE,leavestate); + if (ret) + uErrorValue(ret); + waotstat=DatGate->gate.waotstat; + while (waotstat->waotstat.count) + { + p_iosignal(); + (waotstat->waotstat.count)--; + } + } + +LOCAL_C VOID ViaClearGate( +#pragma save,ENTER_CALL + INT func(VOID *),VOID *par) +#pragma restore +/* new function for 2.04, avoid trouble when HELP pressed */ + { + INT old; + + old=w_ws->wserv.help_index_id; + w_ws->wserv.help_index_id=0; + ViaGate(func,par); + w_ws->wserv.help_index_id=old; + } + +GLDEF_C VOID hPrintSetupDialog(VOID) + { + ViaClearGate(EditPrintContext,NULL); + } + +GLDEF_C VOID hPrint(INT sense(H_PRINT *)) + { + GATE_PRINTER g; + + g.f=(INT (*)(WDR_PRINT *))sense; + ViaClearGate(DoPrint,&g); + if (_phand) + { + p_send2(_phand,O_DESTROY); + _phand=NULL; + } + } + +GLDEF_C VOID hPrinterSetupDialog(VOID) + { + ViaClearGate(EditPrinterSetup,NULL); + } + +GLDEF_C VOID hHelpSubSystem(INT startid,INT indexid) + { + INT old; + + old=w_ws->wserv.help_index_id; + w_ws->wserv.help_index_id=indexid; + ViaGate(HelpSubSystem,(VOID *)startid); + w_ws->wserv.help_index_id=old; + } + +GLDEF_C VOID hOODialog(INT catHandle,INT class,INT resid,VOID *rbuf) + { + GATE_OOD dld; + + dld.catHand=catHandle; + dld.class=class; + dld.d.id=resid; + dld.d.rbuf=rbuf; + dld.d.pdlg=NULL; + ViaClearGate(LaunchDialog,&dld); + } + +GLDEF_C VOID hPrintSetSI(UINT subsqind) + { + _phand->lprinter.subsqind=subsqind; + } + +GLDEF_C INT hPrintSensePageWidth(VOID) + { + return(_phand->lprinter.width); + } + +GLDEF_C INT hPrintSenseBufWidth(TEXT *buf,INT blen) + { + return(p_send4(_phand,O_LPR_SENSE_BUF_WIDTH,buf,blen)); + } + +#define S_METHOD_CALL call(reg_param =>(bx,dx,si,di),reg_saved =>(ds)) + +#pragma S_METHOD_CALL + +METHOD INT hprinter_lpr_sense_text(PR_HPRINTER *self,WDR_PRINT *pr) + { + return((self->hprinter.sense)(pr)); + } + +METHOD VOID hprinter_lpr_read(PR_HPRINTER *self,INT x,WDR_PRINT *pr) + { /* added for Hwif 2.02 as workaround for lprinter bug */ + self->lprinter.defer.flags&=(~WDR_PRINT_PAGE); + p_supersend4(self,O_LPR_READ,x,pr); + } + +METHOD VOID hhelpdlg_destroy(PR_HHELPDLG *self) + { + p_supersend2(self,O_DESTROY); + p_send2(w_am,O_AM_STOP); + } diff --git a/code/SIBOSDK/hwifsrc/read.me b/code/SIBOSDK/hwifsrc/read.me new file mode 100644 index 0000000..cb78b3e --- /dev/null +++ b/code/SIBOSDK/hwifsrc/read.me @@ -0,0 +1,11 @@ +To build your own copy of HWIF.LIB +---------------------------------- + +Make sure that the OOP component of the SDK has been installed, +as well as the CORE and HWIFSRC components. + +In the HWIFSRC directory, type "MAKE". + +The HWIF.LIB created should differ in only four bytes - a date stamp in +the library header - from that installed into \SIBOSDK\LIB from the HWIF +component of the SDK. diff --git a/code/SIBOSDK/hwifsrc/release.txt b/code/SIBOSDK/hwifsrc/release.txt new file mode 100644 index 0000000..96efb91 --- /dev/null +++ b/code/SIBOSDK/hwifsrc/release.txt @@ -0,0 +1,48 @@ +Version 2.05 - 7th Dec 94 +------------------------- +Made by DavidW: +1. Re-wrote uCommonInit to support W_CTBY_S3_SCR mode (if the new + static _S3UseFullScreen is set), to remove all hard-wired sizes + (these are now calculated dynamically at run-time), to resize the + default graphics window to use every pixel on the screen, and to + simplify the overall logic of the routine. +2. Now test in hDlgOpen for whether a new static _SmallFontDialog is + set, and if so create the dialog using O_GT_DIAL_SOPEN instead of + O_GT_DIAL_OPEN (and clear the flag so that it won't affect any + subsequent dialogs). + +Version 2.04 - 1st Aug 94 +------------------------- +Made by DavidW: +1. Introduced new function ViaClearGate as a layer around ViaGate + that clears w_ws->wserv.help_index_id before entry, and restores + the original value on completion. This is to avoid problems if + the user presses HELP when inside (a) an OO dialog (b) a + sub-dialog of the Print Setup or Printer Setup suites (c) the + Printing dialog. (These problems would only show up if another + menu item has been highlighted last, apart from the first item in + the first menu.) + + +Version 2.03 - 31st July 94 +--------------------------- +Made by DavidW: +1. Now creates HWIFO.LIB as well as HWIF.LIB, to ease the task of + HWIF programmers who want to add OO features to their apps. + HWIF.CAT is now a separate releasable. + +Version 2.02 - 23rd Mar 94 +-------------------------- +Made by DavidW: +1. Added new replacement method lpr_read to hprinter class, to clear + PRINT_PAGE bit in defer.flags, to workaround bug in lprinter class + in which a line printed with PRINT_PAGE which needed to be + word-wrapped would throw a new page for each extra line generated. + +Version 2.01 - 7th Feb 94 +------------------------- +Made by DavidW: +1. Added function hEBPosToXL and struct definition H_SCRLAY_PLX + allowing access to the scrlay method O_SL_POS_TO_XL. +2. Changed "class" to "classno" in one function definition, to be + more C++ friendly. diff --git a/code/SIBOSDK/hwifsrc/rhwif.c b/code/SIBOSDK/hwifsrc/rhwif.c new file mode 100644 index 0000000..3ff22bc --- /dev/null +++ b/code/SIBOSDK/hwifsrc/rhwif.c @@ -0,0 +1,74 @@ +/* + RHWIF.C + +Started by DavidW, 1/11/92 + +Resource file extension to Hwif + +*/ + +#include +#include +#include +#include +#include +#include +#include + +GLREF_D PR_APPMAN *w_am; +GLREF_D WORD DatLocked; +GLREF_D VOID *DatCommandPtr; + + +GLDEF_C VOID hDeclareAppRcb(VOID *rcb) + { + w_am->appman.rcb=rcb; + } + +GLDEF_C VOID *hInitAppRcb(VOID) + { /* create and initialise resource file object */ + INT ret; + VOID *rcb; /* resource file object handle */ + + rcb=p_new(1,C_RSCFILE); + ret=p_entersend3(rcb,O_RS_INIT,DatCommandPtr); /* pass file name */ + if (ret<0) /* no resource file found */ + p_exit(ret); /* fatal (programmer) error */ + hDeclareAppRcb(rcb); + return(rcb); + } + +GLDEF_C INT hSetSystemResLang(INT lang) + { + TEXT name[12]; /* eg "ROM::s_.~04" */ + P_INFO junk; + VOID *srcb; + INT ret; + + p_atos(&name[0],"ROM::S_.~%02d",lang); + if (p_finfo(&name[0],&junk)) + return(E_FILE_NXIST); + srcb=p_new(CAT_HWIF_OLIB,C_RSCFILE); + if (!srcb) + return(E_GEN_NOMEMORY); + ret=p_entersend3(srcb,O_RS_INIT,&name[0]); + if (!ret) + { + p_send2(w_am->appman.srcb,O_DESTROY); + w_am->appman.srcb=srcb; + } + return(ret); + } + +GLDEF_C VOID hRequestReplacePack(VOID *rcb,TEXT *fname) + { + TEXT buf[50]; + + p_send4(w_am,O_AM_LOAD_RES_BUF,-SYS_REPLACE_DISK,&buf[0]); + do + { + DatLocked++; + wsAlertW(WS_ALERT_CLIENT,0,&buf[0],0); + DatLocked--; + } while (p_entersend3(rcb,O_RS_INIT,fname)<0); + } diff --git a/code/SIBOSDK/hwifsrc/thwif.c b/code/SIBOSDK/hwifsrc/thwif.c new file mode 100644 index 0000000..5e3195d --- /dev/null +++ b/code/SIBOSDK/hwifsrc/thwif.c @@ -0,0 +1,48 @@ +/* + THWIF.C + +Started by DavidW, 6/12/91 + +Time text extension to h layer of hwif + +*/ + +#include +#include +#include + + +GLDEF_C VOID *hTTOpen(VOID) + { + return(uCheckHandle(p_new(CAT_HWIF_HWIM,C_HTIME))); + } + +GLDEF_C INT hTTSetTime(VOID *handle,INT type,VOID *data) + { + return(p_send4(handle,O_TO_SET,type,data)); + } + +GLDEF_C INT hTTSenseString(VOID *handle,INT type,TEXT *buf) + { + return(p_send4(handle,O_TO_SENSE,type,buf)); + } + +#define TIME_DEFAULTS (PR_TIME_NO_SECS|PR_TIME_DAY_NAME|PR_TIME_SUFFIX_NAME|PR_TIME_MONTH_NAME|PR_TIME_FORCE_UPDATE_FORMAT) + +GLDEF_C VOID hTTSetFormat(VOID *handle,INT values) + { + p_send3(handle,O_TO_SET_FORMAT,NULL); + ((PR_TIME *)handle)->time.f.flags&=(~TIME_DEFAULTS); + ((PR_TIME *)handle)->time.f.flags|=values; + } + +GLDEF_C VOID hTTSetAbbreviations(VOID *handle,INT dayabb,INT monabb) + { + p_send4(handle,O_TO_SET_ABBREVIATIONS,dayabb,monabb); + ((PR_TIME *)handle)->time.f.flags|=PR_TIME_ABBREVIATE; + } + +GLDEF_C VOID hTTClose(VOID *handle) + { + p_send2(handle,O_DESTROY); + } diff --git a/code/SIBOSDK/hwifsrc/uhwif.c b/code/SIBOSDK/hwifsrc/uhwif.c new file mode 100644 index 0000000..3863edb --- /dev/null +++ b/code/SIBOSDK/hwifsrc/uhwif.c @@ -0,0 +1,385 @@ +/* + UHWIF.C + +Started by DavidW, 8/11/91 + +Utility layer of hwif + +*/ + +#include +#include +#include +#include +#include +#include + +GLREF_D UWORD DatLocked; + +GLREF_D WSERV_SPEC *wserv_channel; +GLREF_D VOID *winHandle; +GLREF_D UWORD _UseFullScreen; +GLDEF_D UWORD _S3UseFullScreen; + +GLREF_D TEXT ** _cmds; +GLREF_D H_MENU_DATA * _mdata; + +LOCAL_C VOID Check(INT val) + { + if (val) + p_exit(val); + } + +GLDEF_C VOID uCommonInit(VOID) + { + INT val; + UINT func; + CONSOLE_INFO cinfo; + W_WINDATA wd; + + p_linklib(0); + if (winHandle) + { + val=FALSE; + func=P_SCR_CURSOR; + Check(p_iow4(winHandle,P_FSET,&func,&val)); + goto exit; + } + Check(p_open(&winHandle,"CON:",0)); + if (_UseFullScreen || _S3UseFullScreen) + { + if ((wserv_channel->conn.info.version_id&WS_VERSION_MASK) + conn.info.pixels.x+1)/cinfo.char_width; + wd.extent.height=(wserv_channel->conn.info.pixels.y+1)/cinfo.line_height; + func=P_SCR_WSET; + Check(p_iow4(winHandle,P_FSET,&func,&wd.extent)); + wd.extent.width=wserv_channel->conn.info.pixels.x; + wd.extent.height=wserv_channel->conn.info.pixels.y; + wSetWindow(cinfo.window_handle,W_WIN_EXTENT,&wd); + Check(wCheckPoint()); +exit: + hIFInit(winHandle); + } + +GLDEF_C VOID uEnableGrey(VOID) + { + UINT func; + UINT flags; + + func=P_SCR_GREY; + flags=TRUE; + Check(p_iow4(winHandle,P_FSET,&func,&flags)); + } + +GLDEF_C VOID uGetKey(WMSG_KEY *pkey) + { + p_iow3(winHandle,P_EVENT_READ,pkey); + } + +GLDEF_C VOID uGetKeyA(WORD *pstat,WMSG_KEY *pkey) + { + p_ioc4(winHandle,P_EVENT_READ,pstat,pkey); + } + +GLDEF_C VOID uCancelGetKeyA(VOID) + { + p_iow2(winHandle,P_FCANCEL); + } + +GLDEF_C INT uKeyPressOutstanding(VOID) + { + UWORD flag; + + p_iow3(winHandle,P_FTEST,&flag); + return(flag); + } + +GLDEF_C VOID uEscape(UWORD flag) + { + UINT func; + + func=P_SCR_ESCAPE; + p_iow4(winHandle,P_FSET,&func,&flag); + } + +GLDEF_C UINT uFindMainWid(VOID) + { + CONSOLE_INFO info; + + p_iow3(winHandle,P_FINQ,&info); + return(info.window_handle); + } + +GLDEF_C VOID uForceToFront(VOID) + { + wClientPosition(0,0); + wFlush(); + } + +GLDEF_C VOID uErrorString(TEXT *message) + { + uForceToFront(); + DatLocked++; + wsAlertW(WS_ALERT_CLIENT,0,message,0); + DatLocked--; + } + +GLDEF_C INT uErrorValue(INT ret) + { + TEXT buf[64]; + + if (ret) + { + p_errs(&buf[0],ret); + uErrorString(&buf[0]); + } + return(ret); + } + +GLDEF_C VOID *uCheckHandle(VOID *hand) + { + if (!hand) + uErrorValue(E_GEN_NOMEMORY); + return(hand); + } + +GLDEF_C VOID uZTStoBCS(TEXT *bcs,TEXT *zts) + { + p_bcpy(bcs+1,zts,*bcs=p_slen(zts)); + } + +GLDEF_C INT uOpenDialog(TEXT *title) + { + TEXT buf[64]; + + if (title) + { + uZTStoBCS(&buf[0],title); + title=(&buf[0]); + } + return(uErrorValue(hDlgOpen(title))); + } + +GLDEF_C INT uAddDialogItem(INT type,TEXT *prompt,VOID *data) + { + TEXT buf[64]; + + if (prompt) + { + uZTStoBCS(&buf[0],prompt); + prompt=(&buf[0]); + } + return(uErrorValue(hDlgAdd(type,prompt,data))); + } + +GLDEF_C INT uRunDialog(VOID) + { + INT ret; + + DatLocked++; + ret=hDlgRun(); + DatLocked--; + if (ret<0) + uErrorValue(ret); + return(ret); + } + +GLDEF_C INT CDECL uAddButtonList(TEXT *but,INT code,...) + { + TEXT buf[40]; + INT count; + TEXT **pbut; + INT *pcode; + VOID *buts; + + buts=uCheckHandle(hButtonOpen()); + if (!buts) + return(-1); + count=1; + pbut=(&but); + pcode=(&code); + while (*pbut) + { + uZTStoBCS(&buf[0],*pbut); + if (uErrorValue(hButtonAdd(buts,count++,*pcode,&buf[0]))) + goto CleanUp; + pcode+=2; + pbut+=2; + } + if (!uAddDialogItem(H_DIALOG_BUTTONS,0,(VOID *)buts)) + return(0); +CleanUp: + hButtonClose(buts); + return(-1); + } + +GLDEF_C INT uBeginDCL(H_DI_CHOICE *pch) + { + pch->u.count=1; + pch->menu=uCheckHandle(hChoiceOpen()); + return(!(INT)pch->menu); + } + +GLDEF_C INT uGrowDCL(H_DI_CHOICE *pch,TEXT *choice) + { + TEXT buf[64]; + + uZTStoBCS(&buf[0],choice); + if (!uErrorValue(hChoiceAdd(pch->menu,pch->u.count++,&buf[0]))) + return(0); + hChoiceClose(pch->menu); + return(-1); + } + +GLDEF_C INT uAddDCL(TEXT *prompt,UWORD *nsel,H_DI_CHOICE *pch) + { + pch->u.sel=nsel; + if (!uAddDialogItem(H_DIALOG_CHOICE,prompt,pch)) + return(0); + hChoiceClose(pch->menu); + return(-1); + } + +GLDEF_C INT CDECL uAddChoiceList(TEXT *prompt,UWORD *nsel,TEXT *choice,...) + { + TEXT **pchoice; + H_DI_CHOICE ch; + + if (uBeginDCL(&ch)) + return(-1); + pchoice=(&choice); + while (*pchoice) + { + if (uGrowDCL(&ch,*pchoice++)) + return(-1); + } + return(uAddDCL(prompt,nsel,&ch)); + } + +GLDEF_C INT uLocateCommand(INT accel) + { + INT i; + TEXT **pcmd; + TEXT *cmd; + + i=0; + pcmd=_cmds; + while ((cmd=*pcmd++)!=0) + { + if (*cmd==accel) + return(i); + i++; + } + return(-1); + } + +GLDEF_C INT uPresentMenus(VOID) + { + INT ret; + VOID *card[16]; + VOID *loc; + INT cardindex; + TEXT **pcmd; + TEXT *cmd; + H_MENU_DATA *mdata; + INT pos; + INT nitems; + TEXT buf[64]; + + if (uErrorValue(hMenuOpen())) + return(0); + mdata=_mdata; + pcmd=_cmds; + cardindex=0; + while (mdata->title) + { + loc=uCheckHandle(hCardOpen()); + if (!loc) + goto TidyUp; + card[cardindex++]=loc; + nitems=mdata->nlines; + pos=1; + while (nitems--) + { + cmd=(*pcmd++); + uZTStoBCS(&buf[0],cmd+1); + if (uErrorValue(hCardAdd(loc,pos++,*cmd,&buf[0]))) + goto TidyUp; + } + uZTStoBCS(&buf[0],mdata->title); + if (uErrorValue(hMenuAdd(&buf[0],loc))) + goto TidyUp; + mdata++; + } + DatLocked++; + ret=hMenuRun(); + DatLocked--; + if (ret>=0) + goto CleanUp; + uErrorValue(ret); +TidyUp: + hMenuClose(); + ret=0; +CleanUp: + while (cardindex) + hCardClose(card[--cardindex]); + return(ret); + } + +GLDEF_C VOID uAddGreyUline(UBYTE accel,UWORD *plines) + { + *(plines+(accel/16))|=(1<<(accel%16)); + } + +GLDEF_C INT CDECL uDialogMenu(TEXT *title,TEXT *pb,...) + { + TEXT **ppb; + H_DI_TEXT txt; + TEXT buf[64]; + + if (uOpenDialog(title)) + return(0); + txt.type=H_DTEXT_ALIGN_LEFT|H_DTEXT_SELECTABLE; + txt.str=(&buf[0]); + ppb=(&pb); + while (*ppb) + { + uZTStoBCS(&buf[0],*ppb++); + if (uAddDialogItem(H_DIALOG_TEXT," ",&txt)) + return(0); + } + return(uRunDialog()); + } + +GLDEF_C VOID CDECL uDisplayText(TEXT *pb,...) + { + TEXT **ppb; + H_DI_TEXT txt; + TEXT buf[64]; + + if (uOpenDialog(NULL)) + return; + txt.type=H_DTEXT_ALIGN_LEFT; + txt.str=(&buf[0]); + ppb=(&pb); + while (*ppb) + { + uZTStoBCS(&buf[0],*ppb++); + if (uAddDialogItem(H_DIALOG_TEXT,NULL,&txt)) + return; + } + uRunDialog(); + } diff --git a/code/SIBOSDK/hwifsrc/xhwif.c b/code/SIBOSDK/hwifsrc/xhwif.c new file mode 100644 index 0000000..28e447d --- /dev/null +++ b/code/SIBOSDK/hwifsrc/xhwif.c @@ -0,0 +1,144 @@ +/* + XHWIF.C + +Started by DavidW, 8/11/91 + +Later additions to h layer of hwif + +*/ + +#include +#include +#include +#include +#include + +GLREF_D TEXT *DatUsedPathNamePtr; +GLREF_D TEXT *DatCommandPtr; +GLREF_D TEXT *DatProcessNamePtr; +GLREF_D TEXT *DatStatusNamePtr; + + +GLDEF_C VOID hEnsurePath(TEXT *fname) +/* +Ensure that the path of the specified path exists. +All errors are ignored. +*/ + { + P_FPARSE crk; + TEXT buf[P_FNAMESIZE]; + + if (!p_fparse(fname,NULL,&buf[0],&crk)) + { + buf[crk.system+crk.device+crk.path]=0; + p_mkdir(&buf[0]); + } + } + +GLDEF_C VOID hSetUpStatusNames(TEXT *pb) + { + TEXT buf[P_FNAMESIZE]; + P_FPARSE crk; + + DatUsedPathNamePtr=pb; + p_fparse(pb,0,&buf[0],&crk); + DatStatusNamePtr=pb+P_FSYSNAMESIZE+crk.device+crk.path; + } + +GLDEF_C INT hCrackCommandLine(VOID) + { + INT ret; + TEXT *pb; + + pb=DatCommandPtr; + pb+=p_slen(pb)+1; + if (!*pb++) + ret=0; + else + { + ret=(*pb++); + DatProcessNamePtr=pb; + pb+=p_slen(pb)+1; + pb+=p_slen(pb)+1; + if (*pb) + hSetUpStatusNames(pb); + else + DatStatusNamePtr=DatProcessNamePtr; + } + return(ret); + } + +GLDEF_C INT hIsDbfCompressible(VOID *dH) + { + return(*((UWORD *)dH+19)&P_FMEDIA_COMPRESSIBLE); + } + +typedef struct + { + UWORD toneLengthTicks; + UWORD delayLengthTicks; + UWORD pauseLengthTicks; + UBYTE dialOutCode[6]; + } DTMF_ENVAR; + +LOCAL_C VOID ReadDTMFEnvar(DTMF_ENVAR *penv) + { + INT len; + UBYTE buf[P_ENVMAX]; + + len=p_getenviron("D$X",3,&buf[0]); + if (len==sizeof(DTMF_ENVAR)) + p_bcpy(penv,&buf[0],sizeof(DTMF_ENVAR)); + else + { + penv->toneLengthTicks=8; + penv->delayLengthTicks=8; + penv->pauseLengthTicks=48; + } + } + +GLDEF_C INT hDTMFString(TEXT *zts) + { + E_DIAL c; + DTMF_ENVAR env; + INT oldsnd_state; + INT ret; + VOID *snd; + INT i; + + ReadDTMFEnvar(&env); + c.toneLengthTicks=env.toneLengthTicks; + c.delayLengthTicks=env.delayLengthTicks; + c.pauseLengthTicks=env.pauseLengthTicks; + oldsnd_state=p_getsnd(); + p_setsnd((oldsnd_state&~E_SOUND_DISABLE)|E_SOUND_DEVICE); + for (i=3;i;i--) + { + if (!(ret=p_open(&snd,"SND:",0))) + break; + p_sleep(1); + } + if (!ret) + { + p_iow4(snd,E_FDIAL,zts,&c); + p_close(snd); + } + p_setsnd(oldsnd_state); + return(ret); + } + +GLDEF_C INT hLoadOwnDyl(INT index) + { + INT DylHandle; + VOID *fcb; + INT ret; + + DylHandle=0; + ret=p_openlib(&fcb,DatCommandPtr); + if (!ret) + { + p_loadfilelib(fcb,index,&DylHandle,TRUE); + p_close(fcb); + } + return(DylHandle); + } diff --git a/code/SIBOSDK/hwimdemo/dat.afl b/code/SIBOSDK/hwimdemo/dat.afl new file mode 100644 index 0000000..dc6c66d --- /dev/null +++ b/code/SIBOSDK/hwimdemo/dat.afl @@ -0,0 +1,3 @@ +dat.pic +dat.rzc +dat.shd diff --git a/code/SIBOSDK/hwimdemo/dat.cat b/code/SIBOSDK/hwimdemo/dat.cat new file mode 100644 index 0000000..42d0df2 --- /dev/null +++ b/code/SIBOSDK/hwimdemo/dat.cat @@ -0,0 +1,58 @@ +IMAGE dat + +EXTERNAL olib +EXTERNAL hwim + +INCLUDE p_gen.h +INCLUDE p_file.h +INCLUDE epoc.h +INCLUDE wlib.h +INCLUDE olib.g +INCLUDE hwimman.g +INCLUDE mfne.g +INCLUDE time.g + +CLASS datcom comman + { + ADD com_date + } + +CLASS datwserv wserv + { + REPLACE ws_dyn_init + } + +CLASS datwin bwin + { + REPLACE wn_init + REPLACE wn_dodraw + REPLACE wn_draw + PROPERTY + { + PR_TIME *time; + } + } + +CLASS datedlg dlgbox + { + REPLACE dl_item_new + REPLACE dl_dyn_init + REPLACE dl_key + } + +CLASS date mfne + { + REPLACE wn_init + REPLACE wn_set + REPLACE wn_sense + REPLACE lg_self_check + PROPERTY + { + WORD dType; + UINT day; + UINT month; + UINT year; + ULONG min; + ULONG max; + } + } diff --git a/code/SIBOSDK/hwimdemo/dat.ms b/code/SIBOSDK/hwimdemo/dat.ms new file mode 100644 index 0000000..494eed9 --- /dev/null +++ b/code/SIBOSDK/hwimdemo/dat.ms @@ -0,0 +1,3 @@ +Dat + +1000 diff --git a/code/SIBOSDK/hwimdemo/dat.pic b/code/SIBOSDK/hwimdemo/dat.pic new file mode 100644 index 0000000..561851c Binary files /dev/null and b/code/SIBOSDK/hwimdemo/dat.pic differ diff --git a/code/SIBOSDK/hwimdemo/dat.pr b/code/SIBOSDK/hwimdemo/dat.pr new file mode 100644 index 0000000..e725c6b --- /dev/null +++ b/code/SIBOSDK/hwimdemo/dat.pr @@ -0,0 +1,39 @@ +#system epoc img +#set epocinit=iplib +#model small jpi + +#set version=0x118F +#set priority=0x80 +#set heapsize=0x48 + +#compile %main.cat + +#if %remake #or (%main.rg #older %main.re) #or (%main.rg #older %main.g) #then + #run "re %main" no_window no_abort +#endif + +#if (%main.rsg #older %main.rss) #or (%main.rsg #older %main.rg) #then + #file delete %main.rsg + #run "rs %main" no_window no_abort + #run "rch %main" no_window no_abort +#endif + +#compile datwserv.c +#compile datwin.c +#compile datcom.c +#compile date.c +#compile datdial.c + +#if %main.shd #older %main.ms #then + #run "makeshd %main" no_window no_abort + #file delete %main.img +#endif + +#if (%main.img #older %main.afl) #or (%main.img #older %main.pic) #then + #file delete %main.img +#endif + +#pragma link(olib.lib) +#pragma link(hwim.lib) + +#link %main diff --git a/code/SIBOSDK/hwimdemo/dat.re b/code/SIBOSDK/hwimdemo/dat.re new file mode 100644 index 0000000..e3e3fe6 --- /dev/null +++ b/code/SIBOSDK/hwimdemo/dat.re @@ -0,0 +1,6 @@ +#include + +_C_DATE +_O_COM_EXIT +_O_COM_DATE +_C_DATCOM diff --git a/code/SIBOSDK/hwimdemo/dat.rss b/code/SIBOSDK/hwimdemo/dat.rss new file mode 100644 index 0000000..b4e2de2 --- /dev/null +++ b/code/SIBOSDK/hwimdemo/dat.rss @@ -0,0 +1,69 @@ +/* +Resource file for timer demonstration program +*/ + +#include +#include +#include +#include + +RESOURCE WSERV_INFO tim_accs + { + menbar_id=tim_menu; + first_com=O_COM_EXIT; +/* follows order in cat file command manager */ + accel={'x', /* Exit */ + 's' /* Set current date */ + }; + } + +RESOURCE MENU_BAR tim_menu + { + items = + { + MENU_BAR_ITEM + { + menu_id=options_menu; + mb_item="Options"; + } + }; + } + +RESOURCE MENU options_menu + { + items = + { + MENU_ITEM + { + com_id=O_COM_DATE; + mn_item="Current date"; + }, + MENU_ITEM + { + com_id=O_COM_EXIT; + mn_item="Exit"; + } + }; + } + +RESOURCE STRING month_day_reset + { + str="Day exceeds days in month: reset"; + } + +RESOURCE DIALOG date_dl_res + { + title="Current date"; + flags=DLGBOX_NOTIFY_ENTER; + controls= + { + CONTROL + { + class=C_DATE; + flags=DLGBOX_ITEM_CENTRE|DLGBOX_ITEM_APPL_CAT; + } + }; + } + + + diff --git a/code/SIBOSDK/hwimdemo/datcom.c b/code/SIBOSDK/hwimdemo/datcom.c new file mode 100644 index 0000000..78954d2 --- /dev/null +++ b/code/SIBOSDK/hwimdemo/datcom.c @@ -0,0 +1,27 @@ +/* +kalcom.c +*/ + +#include +#include +#include + +GLREF_D PR_WSERV * const w_ws; + +LOCAL_C INT LaunchDial(VOID *buf,INT id,INT class) + { + DL_DATA dl_data; + + dl_data.id=id; + dl_data.rbuf=buf; + dl_data.pdlg=NULL; + return(p_send5(w_ws,O_WS_DO_DIAL,p_getlibh(CAT_DAT_DAT),class,&dl_data)); + } + +#pragma METHOD_CALL + +METHOD VOID datcom_com_date(PR_DATCOM *self) + { + LaunchDial(NULL,DATE_DL_RES,C_DATEDLG); + } + diff --git a/code/SIBOSDK/hwimdemo/datdial.c b/code/SIBOSDK/hwimdemo/datdial.c new file mode 100644 index 0000000..1a15c70 --- /dev/null +++ b/code/SIBOSDK/hwimdemo/datdial.c @@ -0,0 +1,31 @@ +#include +#include +#include + +GLREF_D PR_DATWSERV * const w_ws; + +#pragma METHOD_CALL + +METHOD VOID *datedlg_dl_item_new(PR_DATEDLG *self,AD_DLGBOX *par) + { + return(f_new(CAT_DAT_DAT,par->class)); + } + +METHOD VOID datedlg_dl_dyn_init(PR_DATEDLG *self) + { + P_DAYSEC ds; + + p_send4(((PR_DATWIN *)w_ws->wserv.cli)->datwin.time,O_TO_SENSE,SENSE_TIME_DAYSEC,&ds); + p_send4(self,O_WN_SET,1,&ds.day); + } + +METHOD INT datedlg_dl_key(PR_DATEDLG *self,INT index,INT keycode) + { + P_DAYSEC ds; + + p_send4(self,O_WN_SENSE,1,&ds.day); + ds.sec=0; + f_leave(p_send4(((PR_DATWIN *)w_ws->wserv.cli)->datwin.time,O_TO_SET,SET_TIME_DAYSEC,&ds)); + return(WN_KEY_CHANGED); + } + diff --git a/code/SIBOSDK/hwimdemo/date.c b/code/SIBOSDK/hwimdemo/date.c new file mode 100644 index 0000000..497f3bb --- /dev/null +++ b/code/SIBOSDK/hwimdemo/date.c @@ -0,0 +1,121 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include + +LOCAL_C VOID InitField(PR_DATE *self,UINT i,LONG val,LONG min,LONG max,UBYTE width) + { + self->mfne.f[i].value=val; + self->mfne.f[i].limits[MFNE_LOWER]=min; + self->mfne.f[i].limits[MFNE_UPPER]=max; + self->mfne.f[i].width=width; + } + +LOCAL_C VOID DayMonthYear(PR_DATE *self,INT i,INT j,INT k) + { + self->date.day=i; + self->date.month=j; + self->date.year=k; + } + +#pragma METHOD_CALL + +METHOD VOID date_wn_init(PR_DATE *self,VOID *par,PR_WIN *landlord) + { + P_DAYSEC ds; + P_DATE dt; + E_CONFIG cfg; + + p_getctd(&cfg); + self->lodger.landlord=landlord; + self->mfne.selected=FALSE; + self->mfne.changed=FALSE; + self->mfne.cField=0; + self->mfne.nField=3; + self->mfne.f[0].separator=cfg.dateSeparator; + self->mfne.f[1].separator=cfg.dateSeparator; + self->mfne.f[2].flags=MFNE_SUPPRESS_SEPARATOR; + self->date.dType=cfg.dateType; + if (self->date.dType==E_DATE_EUROPE) + { + DayMonthYear(self,0,1,2); + } + else if (self->date.dType==E_DATE_USA) + { + DayMonthYear(self,1,0,2); + } + else if (self->date.dType==E_DATE_JAPAN) + { + DayMonthYear(self,2,1,0); + } + InitField(self,self->date.day,1,1,31,2); + InitField(self,self->date.month,1,1,12,2); + InitField(self,self->date.year,1,1900,2154,4); + dt.year=254; + dt.month=11; + dt.day=30; + dt.hour=dt.minute=dt.second=dt.yrday=0; + p_dttods(&dt,&ds); + self->date.max=ds.day; + } + +METHOD VOID date_wn_set(PR_DATE *self,ULONG *par) + { + P_DAYSEC ds; + P_DATE dt; + + ds.day=*par; + ds.sec=0; + if (ds.day>self->date.max) + { + ds.day=self->date.max; + } + p_dstodt(&ds,&dt); + self->mfne.f[self->date.day].value=dt.day+1; + self->mfne.f[self->date.month].value=dt.month+1; + self->mfne.f[self->date.year].value=dt.year+1900; + p_supersend2(self,O_WN_SET); + } + +METHOD VOID date_wn_sense(PR_DATE *self,ULONG *par) + { + P_DATE dt; + P_DAYSEC ds; + + dt.second=0; + dt.minute=0; + dt.hour=0; + dt.day=self->mfne.f[self->date.day].value-1; + dt.month=self->mfne.f[self->date.month].value-1; + dt.year=self->mfne.f[self->date.year].value-1900; + p_dttods(&dt,&ds); + *par=ds.day; + } + +METHOD INT date_lg_self_check(PR_DATE *self,INT can_defer) + { + INT ret; + INT days; + + ret=p_supersend3(self,O_LG_SELF_CHECK,can_defer); + if ((can_defer==FALSE)&&(ret==LG_CHECK_OK_CHANGED)) + { + days=p_dayinm((INT)self->mfne.f[self->date.year].value-1900, + (INT)self->mfne.f[self->date.month].value-1); + if (self->mfne.f[self->date.day].value>(LONG)days) + { + hBeep(); + self->mfne.cField=self->date.day; + self->mfne.f[self->date.day].value=(LONG)days; + p_supersend3(self,O_LG_SELF_CHECK,TRUE); + hInfoPrint(MONTH_DAY_RESET); + ret=LG_CHECK_FAILED_CHANGED; + } + } + return(ret); + } diff --git a/code/SIBOSDK/hwimdemo/date.h b/code/SIBOSDK/hwimdemo/date.h new file mode 100644 index 0000000..67a50a3 --- /dev/null +++ b/code/SIBOSDK/hwimdemo/date.h @@ -0,0 +1,18 @@ +typedef struct + { + WORD flags; + ULONG value; + ULONG min; + ULONG max; + } SE_DATE; + +typedef struct + { + ULONG value; + ULONG min; + ULONG max; + } IN_DATE; + +#define SE_DATE_VALUE 0x01 +#define SE_DATE_MIN 0x02 +#define SE_DATE_MAX 0x04 diff --git a/code/SIBOSDK/hwimdemo/datwin.c b/code/SIBOSDK/hwimdemo/datwin.c new file mode 100644 index 0000000..eff5c09 --- /dev/null +++ b/code/SIBOSDK/hwimdemo/datwin.c @@ -0,0 +1,51 @@ +/* Written by Leif November 1993 */ + +#include +#include +#include +#include +#include +#include +#include + +GLREF_D PR_WSERV * const w_ws; +GLREF_D PR_APPMAN * const w_am; + +#pragma METHOD_CALL + +METHOD VOID datwin_wn_draw(PR_DATWIN *self) + { + TEXT buf[LN_TIME_DATE_STR]; + G_FONT_INFO fontinfo; + W_WINDATA windata; + P_RECT r; + + p_supersend2(self,O_WN_DRAW); + wInquireWindow(self->win.id,&windata); + gFontInfo(WS_FONT_SYSTEM,0,&fontinfo); + r.tl.x=2; + r.br.x=windata.extent.width-2; + r.tl.y=(windata.extent.height-fontinfo.height)>>1; + r.br.y=r.tl.y+fontinfo.height; + f_leave(p_send4(self->datwin.time,O_TO_SENSE,SENSE_TIME_DATESTR,&buf[0])); + gPrintBoxText(&r,fontinfo.ascent,G_TEXT_ALIGN_CENTRE,0,&buf[0],p_slen(&buf[0])); + } + +METHOD VOID datwin_wn_dodraw(PR_DATWIN *self) + { + gCreateTempGC0(self->win.id); + datwin_wn_draw(self); + gFreeTempGC(); + wFlush(); + } + +METHOD VOID datwin_wn_init(PR_DATWIN *self,PR_WIN *par,UINT fields,W_WINDATA *pwd) + { + p_supersend5(self,O_WN_CONNECT,par,fields,pwd); + p_send3(self,O_WN_VISIBLE,WV_INITVIS); + p_send3(self,O_WN_EMPHASISE,TRUE); + self->datwin.time=f_newsend(CAT_DAT_OLIB,C_TIME,O_TO_SET_FORMAT,NULL,NULL); + p_send4(self->datwin.time,O_TO_SET,SET_TIME_NOW,NULL); + datwin_wn_dodraw(self); + } + diff --git a/code/SIBOSDK/hwimdemo/datwserv.c b/code/SIBOSDK/hwimdemo/datwserv.c new file mode 100644 index 0000000..b8c28b5 --- /dev/null +++ b/code/SIBOSDK/hwimdemo/datwserv.c @@ -0,0 +1,38 @@ +#include +#include +#include +#include + +GLREF_D WSERV_SPEC *wserv_channel; + +GLDEF_C VOID main(VOID) + { + IN_HWIMMAN app; + IN_WSERV ws; + + p_linklib(0); + app.flags=FLG_APPMAN_FULLSCREEN|FLG_APPMAN_RSCFILE|FLG_APPMAN_CLEAN| + FLG_APPMAN_SRSCFILE; + app.wserv_cat=ws.com_cat=p_getlibh(CAT_DAT_DAT); + app.wserv_class=C_DATWSERV; + ws.com_class=C_DATCOM; + p_send4(p_new(CAT_DAT_HWIM,C_HWIMMAN),O_AM_INIT,&app,&ws); + } + +#pragma METHOD_CALL + +METHOD VOID datwserv_ws_dyn_init(PR_DATWSERV *self) + { + W_WINDATA wd; + + wd.extent.tl.y=0; + wd.extent.tl.x=0; + wd.extent.width=wserv_channel->conn.info.pixels.x; + wd.extent.height=wserv_channel->conn.info.pixels.y; + wd.background=W_WIN_BACK_CLR|W_WIN_BACK_GREY_CLR; + self->wserv.cli=f_newsend(CAT_DAT_DAT,C_DATWIN,O_WN_INIT,NULL,W_WIN_EXTENT|W_WIN_BACKGROUND,&wd); + } + + + + diff --git a/code/SIBOSDK/hwimdemo/gaugedem.afl b/code/SIBOSDK/hwimdemo/gaugedem.afl new file mode 100644 index 0000000..04ce7a2 --- /dev/null +++ b/code/SIBOSDK/hwimdemo/gaugedem.afl @@ -0,0 +1,3 @@ +gaugedem.pic +gaugedem.rzc +gaugedem.shd diff --git a/code/SIBOSDK/hwimdemo/gaugedem.cat b/code/SIBOSDK/hwimdemo/gaugedem.cat new file mode 100644 index 0000000..79de7f1 --- /dev/null +++ b/code/SIBOSDK/hwimdemo/gaugedem.cat @@ -0,0 +1,43 @@ +IMAGE gaugedem + +EXTERNAL olib +EXTERNAL hwim + +INCLUDE hwimman.g +INCLUDE timer.g + +CLASS gaugewsv wserv + { + REPLACE ws_dyn_init + } + +CLASS gaugewin bwin +main window + { + REPLACE wn_init + REPLACE wn_draw + } + +CLASS gaugecom comman +command manager + { + ADD com_run + } + +CLASS gaugetim timer + { + REPLACE ao_init + REPLACE ao_queue + REPLACE ao_run + PROPERTY + { + ULONG count; + ULONG total; + } + } + +CLASS gaugedlg dlgbox + { + REPLACE dl_dyn_init + } + diff --git a/code/SIBOSDK/hwimdemo/gaugedem.ms b/code/SIBOSDK/hwimdemo/gaugedem.ms new file mode 100644 index 0000000..f7a2a78 --- /dev/null +++ b/code/SIBOSDK/hwimdemo/gaugedem.ms @@ -0,0 +1,3 @@ +Gauge + +1000 diff --git a/code/SIBOSDK/hwimdemo/gaugedem.pic b/code/SIBOSDK/hwimdemo/gaugedem.pic new file mode 100644 index 0000000..561851c Binary files /dev/null and b/code/SIBOSDK/hwimdemo/gaugedem.pic differ diff --git a/code/SIBOSDK/hwimdemo/gaugedem.pr b/code/SIBOSDK/hwimdemo/gaugedem.pr new file mode 100644 index 0000000..56dd738 --- /dev/null +++ b/code/SIBOSDK/hwimdemo/gaugedem.pr @@ -0,0 +1,41 @@ +#system epoc img +#set epocinit=iplib +#model small jpi + +#abort on + +#set version=0x100F +#set priority=0x80 +#set heapsize=0x80 + +#compile %main.cat + +#if %remake #or (%main.rg #older %main.re) #or (%main.rg #older %main.g) #then + #run "re %main" no_window no_abort +#endif + +#if (%main.rsg #older %main.rss) #or (%main.rsg #older %main.rg) #then + #file delete %main.rsg + #run "rs %main" no_window no_abort +#endif + +#if %main.rzc #older %main.rsg #then + #run "rch %main" no_window no_abort +#endif + +#compile o_gauge.c + +#if %main.shd #older %main.ms #then + #run "makeshd %main" no_window no_abort + #file delete %main.img +#endif + +#if (%main.img #older %main.afl) #or (%main.img #older %main.pic) #then + #file delete %main.img +#endif + +#pragma link(olib.lib) +#pragma link(hwim.lib) + +#link %main + diff --git a/code/SIBOSDK/hwimdemo/gaugedem.re b/code/SIBOSDK/hwimdemo/gaugedem.re new file mode 100644 index 0000000..25ce936 --- /dev/null +++ b/code/SIBOSDK/hwimdemo/gaugedem.re @@ -0,0 +1,5 @@ +#include +#include + +_O_COM_RUN +_O_COM_EXIT diff --git a/code/SIBOSDK/hwimdemo/gaugedem.rss b/code/SIBOSDK/hwimdemo/gaugedem.rss new file mode 100644 index 0000000..64f21f6 --- /dev/null +++ b/code/SIBOSDK/hwimdemo/gaugedem.rss @@ -0,0 +1,106 @@ +/* + GAUGEDEM.RSS + +English resource file for GAUGEDEM demonstration app + +*/ + +#include +#include +#include + +RESOURCE WSERV_INFO hello_accs + { + menbar_id=gauge3_menbar; + first_com=O_COM_EXIT; + accel={'x', /* Exit */ + 'r' /* Run */ + }; + } + +RESOURCE MENU_BAR gauge3_menbar + { + items= + { + MENU_BAR_ITEM + { + menu_id=gauge_menu; + mb_item="Gauge"; + }, + MENU_BAR_ITEM + { + menu_id=special_menu; + mb_item="Special"; + } + }; + } + +RESOURCE MENU gauge_menu + { + items = + { + MENU_ITEM + { + com_id=O_COM_RUN; + mn_item="Run"; + } + }; + } + +RESOURCE MENU special_menu + { + items = + { + MENU_ITEM + { + com_id=O_COM_EXIT; + mn_item="Exit"; + } + }; + } + +RESOURCE STRING title_res {str="Welcome to GAUGEDEM";} + +RESOURCE ACLIST_ARRAY escape_ac + { + button= + { + PUSH_BUT + { + keycode=W_KEY_ESCAPE; + str="Cancel"; + } + }; + } + +RESOURCE DIALOG gauge_dl_res + { + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_RBUF_FILLED; + controls= + { + CONTROL + { + class=C_TEXTWIN; + flags=DLGBOX_ITEM_CENTRE|DLGBOX_ITEM_DEAD; + info=TXTMESS + { + flags=IN_TEXTWIN_AL_CENTRE; + str="Loading data"; + }; + }, + CONTROL + { + class=C_DONEWN; + }, + CONTROL + { + class=C_ACLIST; + info=ACLIST + { + rid=escape_ac; + }; + } + }; + } + + diff --git a/code/SIBOSDK/hwimdemo/o_gauge.c b/code/SIBOSDK/hwimdemo/o_gauge.c new file mode 100644 index 0000000..9a1cdde --- /dev/null +++ b/code/SIBOSDK/hwimdemo/o_gauge.c @@ -0,0 +1,140 @@ +/* +O_GAUGE: demonstrates a gauge used to monitor the progress + of a lengthy operation simulated using a timer. +*/ + + +#include +#include +#include +#include +#include +#include +#include + +GLREF_D WSERV_SPEC *wserv_channel; +GLREF_D PR_HWIMMAN *w_am; +GLREF_D PR_WSERV *w_ws; + +GLDEF_C VOID main(VOID) + { + IN_HWIMMAN app; + IN_WSERV ws; + + p_linklib(0); + app.flags=FLG_APPMAN_FULLSCREEN|FLG_APPMAN_RSCFILE|FLG_APPMAN_CLEAN| + FLG_APPMAN_SRSCFILE; + app.wserv_cat=p_getlibh(CAT_GAUGEDEM_GAUGEDEM); + ws.com_cat=p_getlibh(CAT_GAUGEDEM_GAUGEDEM); + app.wserv_class=C_GAUGEWSV; + ws.com_class=C_GAUGECOM; + p_send4(p_new(CAT_GAUGEDEM_HWIM,C_HWIMMAN),O_AM_INIT,&app,&ws); + } + +LOCAL_C INT LaunchDial(VOID *buf,INT id,INT class) + { + DL_DATA dl_data; + + dl_data.id=id; + dl_data.rbuf=buf; + dl_data.pdlg=NULL; + return(p_send5(w_ws,O_WS_DO_DIAL,p_getlibh(CAT_GAUGEDEM_GAUGEDEM),class,&dl_data)); + } + +#pragma METHOD_CALL + +METHOD VOID gaugewsv_ws_dyn_init(PR_GAUGEWSV *self) + { + self->wserv.cli=f_new(CAT_GAUGEDEM_GAUGEDEM,C_GAUGEWIN); + p_send2(self->wserv.cli,O_WN_INIT); + } + +METHOD VOID gaugewin_wn_init(PR_GAUGEWIN *self) + { + W_WINDATA wd; + + wd.extent.tl.x=0; + wd.extent.tl.y=0; + wd.extent.width=wserv_channel->conn.info.pixels.x; + wd.extent.height=wserv_channel->conn.info.pixels.y; + p_send5(self,O_WN_CONNECT,NULL,W_WIN_EXTENT,&wd); + p_send3(self,O_WN_VISIBLE,WV_INITVIS); + p_send3(self,O_WN_EMPHASISE,TRUE); + } + +METHOD VOID gaugewin_wn_draw(PR_GAUGEWIN *self) + { + G_FONT_INFO fontinfo; + W_WINDATA windata; + TEXT buf[40]; + P_RECT r; + INT w,len; + + p_supersend2(self,O_WN_DRAW); + len=p_send(w_am,O_AM_LOAD_RES_BUF,TITLE_RES,&buf[0]); + w=gTextWidth(WS_FONT_SYSTEM,0,&buf[0],--len); + wInquireWindow(self->win.id,&windata); + r.tl.x=(windata.extent.width-w)/2; + r.br.x=r.tl.x+w; + gFontInfo(WS_FONT_SYSTEM,0,&fontinfo); + r.tl.y=(windata.extent.height-fontinfo.height)/2; + r.br.y=r.tl.y+fontinfo.height; + gPrintBoxText(&r,fontinfo.ascent,G_TEXT_ALIGN_CENTRE,0,&buf[0],len); + } + +METHOD VOID gaugecom_com_run(PR_GAUGECOM *self) + { + ULONG duration; + + duration=100; + f_newsend(CAT_GAUGEDEM_GAUGEDEM,C_GAUGETIM,O_AO_INIT,&duration); + LaunchDial(&duration,GAUGE_DL_RES,C_GAUGEDLG); + } + +METHOD VOID gaugedlg_dl_dyn_init(PR_GAUGEDLG *self) + { + SE_DONEWN se_donewn; + + se_donewn.val=0L; + se_donewn.range=*(ULONG *)self->dlgbox.rbuf; + se_donewn.flags=SE_DONEWN_RANGE|SE_DONEWN_VALUE; + p_send4(self,O_WN_SET,1,&se_donewn); + } + +METHOD VOID gaugetim_ao_queue(PR_GAUGETIM *self,UINT lsw,UINT msw) + { + self->active.stat=E_FILE_PENDING; + self->active.isactive=TRUE; + p_supersend4(self,O_AO_QUEUE,lsw,msw); + } + +METHOD VOID gaugetim_ao_init(PR_GAUGETIM *self,ULONG *ptotal) + { + p_send3(w_am,O_AM_ADD_TASK,self); + self->active.priority=PRIORITY_ACTIVE_WSERV-1; + self->gaugetim.count=0L; + self->gaugetim.total=*ptotal; + p_supersend2(self,O_AO_INIT); + p_send4(self,O_AO_QUEUE,1,0); + } + +METHOD INT gaugetim_ao_run(PR_GAUGETIM *self) + { + SE_DONEWN se_donewn; + + self->gaugetim.count++; + if (w_ws->wserv.dial) + { + se_donewn.flags=SE_DONEWN_INCREMENT; + p_send4(w_ws->wserv.dial,O_WN_SET,1,&se_donewn); + if (self->gaugetim.countgaugetim.total) + { + p_send4(self,O_AO_QUEUE,1,0); + return(RUN_ACTIVE_USED); + } + else + p_send2(w_ws->wserv.dial,O_DESTROY); + } + p_send2(self,O_DESTROY); + return(RUN_ACTIVE_USED); + } diff --git a/code/SIBOSDK/include/aclist.g b/code/SIBOSDK/include/aclist.g new file mode 100644 index 0000000..817cc9a --- /dev/null +++ b/code/SIBOSDK/include/aclist.g @@ -0,0 +1,60 @@ +/* Generated by Ctran from aclist.cl */ +#define ACLIST_G +#ifndef LODGER_G +#include +#endif +#ifndef VARES_G +#include +#endif +/* Class Numbers */ +#define C_SMACLIST 22 +#define C_ACLIST 23 +/* Method Numbers */ +/* Constants for smaclist */ +#define SMACLIST_MAX_STRING 80 +/* Types for smaclist */ +typedef struct +{ +short int width; +short int x; +} BUT_POS; +typedef struct +{ +short int rid; +} IN_ACLIST; +/* Property of smaclist */ +typedef struct { +PR_VARES *data; +BUT_POS *pos; +unsigned short int totalwidth; +unsigned short int num; +unsigned short int lwidth; +} PRS_SMACLIST; +typedef struct pr_smaclist +{ +PRS_ROOT root; +PRS_WIN win; +PRS_LODGER lodger; +PRS_SMACLIST smaclist; +} PR_SMACLIST; +/* Types for aclist */ +typedef struct +{ +short int keycode; +char str[1]; +} PUSH_BUT; +/* Property of aclist */ +typedef struct { +PR_VARES *text; +short int width; +unsigned short int y1; +unsigned short int y2; +} PRS_ACLIST; +typedef struct pr_aclist +{ +PRS_ROOT root; +PRS_WIN win; +PRS_LODGER lodger; +PRS_SMACLIST smaclist; +PRS_ACLIST aclist; +} PR_ACLIST; diff --git a/code/SIBOSDK/include/aclist.ing b/code/SIBOSDK/include/aclist.ing new file mode 100644 index 0000000..6297753 --- /dev/null +++ b/code/SIBOSDK/include/aclist.ing @@ -0,0 +1,55 @@ +; Generated by Ctran from aclist.cl +ACLIST_ING equ 1 +IFNDEF LODGER_ING + INCLUDE ..\inc\LODGER.ING +ENDIF +IFNDEF VARES_ING + INCLUDE ..\inc\VARES.ING +ENDIF +; Class Numbers +C_SMACLIST equ 22 +C_ACLIST equ 23 +; Method Numbers +; Constants for smaclist +SMACLIST_MAX_STRING equ (80) +; Types for smaclist +BUT_POS struc +BUT_POSWidth dw ? +BUT_POSX dw ? +BUT_POS ends +IN_ACLIST struc +IN_ACLISTRid dw ? +IN_ACLIST ends +; Property of smaclist +PRS_SMACLIST struc +SmaclistData dw ? +SmaclistPos dw ? +SmaclistTotalwidth dw ? +SmaclistNum dw ? +SmaclistLwidth dw ? +PRS_SMACLIST ends +PR_SMACLIST struc +SmaclistRoot PRS_ROOT <> +SmaclistWin PRS_WIN <> +SmaclistLodger PRS_LODGER <> +SmaclistSmaclist PRS_SMACLIST <> +PR_SMACLIST ends +; Types for aclist +PUSH_BUT struc +PUSH_BUTKeycode dw ? +PUSH_BUTStr db (1) * 1 dup (?) +PUSH_BUT ends +; Property of aclist +PRS_ACLIST struc +AclistText dw ? +AclistWidth dw ? +AclistY1 dw ? +AclistY2 dw ? +PRS_ACLIST ends +PR_ACLIST struc +AclistRoot PRS_ROOT <> +AclistWin PRS_WIN <> +AclistLodger PRS_LODGER <> +AclistSmaclist PRS_SMACLIST <> +AclistAclist PRS_ACLIST <> +PR_ACLIST ends diff --git a/code/SIBOSDK/include/agnsym.h b/code/SIBOSDK/include/agnsym.h new file mode 100644 index 0000000..1a7fea6 --- /dev/null +++ b/code/SIBOSDK/include/agnsym.h @@ -0,0 +1,17 @@ +/* +Symbols in the agn symbol fonts +*/ + +/* avoiding using 0 */ +#define AGN_SYM_BELL 1 +#define AGN_SYM_MEMO 2 +#define AGN_SYM_CHEVRON 3 /* could use CHAR 175 of standard fonts instead */ +#define AGN_SYM_CANDLE 4 +#define AGN_SYM_UNTIL_ARROW 5 +#define AGN_SYM_BULLET 6 +#define AGN_SYM_NONBRK_SPACE 7 +#define AGN_SYM_TODO_PTY(X) (11+X) +#define AGN_SYM_UP_ARROW 24 +#define AGN_SYM_DOWN_ARROW 25 +#define AGN_SYM_RIGHT_ARROW 26 +#define AGN_SYM_LEFT_ARROW 27 diff --git a/code/SIBOSDK/include/alloc.h b/code/SIBOSDK/include/alloc.h new file mode 100644 index 0000000..e618769 --- /dev/null +++ b/code/SIBOSDK/include/alloc.h @@ -0,0 +1,86 @@ +/* Release 3.00 */ + +/*-------------------------------------------------------------------------* +* * +* alloc.h - header file for memory allocation functions. * +* * +* COPYRIGHT (C) 1989 Jensen and Partners. All Rights Reserved * +* * +*--------------------------------------------------------------------------*/ +#include + +#ifndef _ALLOC_INC_ +#define _ALLOC_INC_ + +#ifndef _SIZE_T +#define _SIZE_T +typedef unsigned size_t; +#endif + +#ifndef NULL +#define NULL 0 +#endif + +struct _heapinfo { + int * _pentry; + size_t _size; + int _useflag; + void * _secret; +}; + +#ifndef __STDC__ +struct _nheapinfo { + int * _pentry; + size_t _size; + int _useflag; + void * _secret; +}; +#endif + +#define _HEAPOK 0 +#define _HEAPEMPTY -1 +#define _HEAPBADBEGIN -2 +#define _HEAPBADNODE -3 +#define _HEAPOVERFLOW -4 +#define _HEAPEND -5 +#define _HEAPBADPTR -6 + +#ifdef __cplusplus +extern "C" { +#endif +extern void * calloc(size_t _num, size_t _size); +extern void free(void *_block); +extern void * malloc(size_t _size); +extern void * realloc(void *_block, size_t _size); +extern size_t stackavail(void); +#ifdef __cplusplus +} +#endif + +#ifndef __STDC__ +#ifdef __cplusplus +extern "C" { +#endif +extern int _msize(void *_buffer); +extern size_t _memmax(void); +extern size_t _memavl(void); +extern int _heapchk(void); +extern int _heapset(int _fill); +extern int _heapwalk(struct _heapinfo *_entry); +extern unsigned _freect(size_t _size); +extern unsigned coreleft(void); +extern void * _ncalloc(size_t num, size_t _size); +extern void _nfree(void *_block); +extern void * _nmalloc(size_t _size); +extern void * _nrealloc(void *_block, size_t _size); +extern int _nheapchk(void); +extern int _nheapset(int _fill); +extern int _nheapwalk(struct _nheapinfo *_nearentry); +extern int _nmsize(void *_buffer); +extern unsigned nearcoreleft(void); +#ifdef __cplusplus +} +#endif +#endif + +#endif diff --git a/code/SIBOSDK/include/appman.g b/code/SIBOSDK/include/appman.g new file mode 100644 index 0000000..57da990 --- /dev/null +++ b/code/SIBOSDK/include/appman.g @@ -0,0 +1,180 @@ +/* Generated by Ctran from appman.cat */ +#define APPMAN_G +#ifndef VARRAY_G +#include +#endif +/* Class Numbers */ +#define C_CLEANUP 9 +#define C_ACTIVE 10 +#define C_AIDLE 11 +#define C_RSCFILE 12 +#define C_SYSTEM 13 +#define C_IPCS 14 +#define C_APPMAN 15 +/* Method Numbers */ +#define O_RS_READ_BUF 3 +#define O_CL_REMOVE 26 +#define O_CL_CLEAN_LEVEL 28 +#define O_SY_ICON_POS 2 +#define O_CL_INIT 24 +#define O_SY_LINK_PASTE 4 +#define O_CL_SET_LEVEL 29 +#define O_SY_LINK_SERVER 3 +#define O_AM_NOTIFYERR 10 +#define O_AM_ADD_TASK 4 +#define O_AM_WAIT 5 +#define O_AO_ABRUN 3 +#define O_AM_START 2 +#define O_AM_NOTIFY 9 +#define O_AM_CLEAN_UP 11 +#define O_AO_CANCEL 2 +#define O_AO_QUEUE 4 +#define O_AM_RSCNAME 8 +#define O_SY_EXEC_OPEN 5 +#define O_AO_INIT 1 +#define O_CL_CLEAN_ITEM 27 +#define O_RS_READ 2 +#define O_CL_ADD 25 +#define O_AM_ONLYONE 12 +#define O_SY_INIT 1 +#define O_IP_ADD_SERVER 6 +#define O_AM_FINDIMG 13 +#define O_RS_INIT 1 +#define O_AM_LOAD_RES_BUF 7 +#define O_AO_RUN 5 +#define O_AM_STOP 3 +#define O_AM_CHANGE_PRI 14 +#define O_AM_INIT 1 +#define O_AM_LOAD_RESOURCE 6 +/* Constants for cleanup */ +#define TY_CLEANUP_DYL -5 +#define TY_CLEANUP_SHARED -4 +#define TY_CLEANUP_VOID -3 +#define TY_CLEANUP_ALLOC -2 +#define TY_CLEANUP_IOCHAN -1 +#define TY_CLEANUP_OBJECT 0 +/* Types for cleanup */ +typedef struct +{ +char type; +unsigned char level; +int h; +} RC_CLEANUP; +typedef struct +{ +unsigned short int nref; +} SHARED_ALLOC; +/* Property of cleanup */ +typedef struct { +unsigned short int level; +} PRS_CLEANUP; +typedef struct pr_cleanup +{ +PRS_ROOT root; +PRS_VAROOT varoot; +PRS_VAFIX vafix; +PRS_VAFLAT vaflat; +PRS_CLEANUP cleanup; +} PR_CLEANUP; +/* Constants for active */ +#define PRIORITY_ACTIVE_POSTER 100 +#define PRIORITY_ACTIVE_IPCS 80 +#define PRIORITY_ACTIVE_VOICE 70 +#define PRIORITY_ACTIVE_WSERV 60 +#define PRIORITY_ACTIVE_COMMAND 40 +#define PRIORITY_ACTIVE_SERIAL 20 +#define PRIORITY_ACTIVE_ALARM 0 +#define PRIORITY_ACTIVE_FILES -20 +#define PRIORITY_ACTIVE_REPEATER -40 +#define PRIORITY_ACTIVE_PRINT -60 +#define PRIORITY_ACTIVE_COMPUTE -100 +/* Property of active */ +typedef struct { +P_QUE q; +char priority; +unsigned char isactive; +unsigned char *pcb; +short int stat; +} PRS_ACTIVE; +typedef struct pr_active +{ +PRS_ROOT root; +PRS_ACTIVE active; +} PR_ACTIVE; +/* Property of aidle */ +typedef struct pr_aidle +{ +PRS_ROOT root; +PRS_ACTIVE active; +} PR_AIDLE; +/* Types for rscfile */ +typedef struct +{ +unsigned short int pos; +unsigned short int len; +} PR_RSCFILE_HEAD; +/* Property of rscfile */ +typedef struct { +unsigned char *pcb; +PR_RSCFILE_HEAD ix; +unsigned short int offset; +unsigned long int hftree; +} PRS_RSCFILE; +typedef struct pr_rscfile +{ +PRS_ROOT root; +PRS_RSCFILE rscfile; +} PR_RSCFILE; +/* Constants for system */ +#define IC_SYSTEM_ALLOC 0 +#define IC_SYSTEM_REMOVE 1 +#define IC_SYSTEM_REPLACE 2 +/* Property of system */ +typedef struct { +unsigned short int pid; +} PRS_SYSTEM; +typedef struct pr_system +{ +PRS_ROOT root; +PRS_SYSTEM system; +} PR_SYSTEM; +/* Property of ipcs */ +typedef struct { +P_QUE hd; +} PRS_IPCS; +typedef struct pr_ipcs +{ +PRS_ROOT root; +PRS_ACTIVE active; +PRS_IPCS ipcs; +} PR_IPCS; +/* Constants for appman */ +#define FLG_APPMAN_CLEAN 0x01 +#define FLG_APPMAN_SYSTEM 0x02 +#define FLG_APPMAN_RSCFILE 0x04 +#define FLG_APPMAN_SRSCFILE 0x08 +#define FLG_APPMAN_IPCS 0x10 +#define FLG_APPMAN_ONLYONE 0x20 +#define FLG_APPMAN_NODBG 0x40 +#define RUN_ACTIVE_UNUSED 0 +#define RUN_ACTIVE_USED 1 +#define ERR_APPMAN_APPL -512 +/* Property of appman */ +typedef struct { +PR_CLEANUP *clean; +PR_SYSTEM *system; +PR_RSCFILE *rcb; +PR_RSCFILE *srcb; +PR_IPCS *ipcs; +P_QUE task; +unsigned short int stop; +short int nrid; +short int err; +unsigned char *spare1; +unsigned char *spare2; +} PRS_APPMAN; +typedef struct pr_appman +{ +PRS_ROOT root; +PRS_APPMAN appman; +} PR_APPMAN; diff --git a/code/SIBOSDK/include/appman.ing b/code/SIBOSDK/include/appman.ing new file mode 100644 index 0000000..dc987e5 --- /dev/null +++ b/code/SIBOSDK/include/appman.ing @@ -0,0 +1,170 @@ +; Generated by Ctran from appman.cat +APPMAN_ING equ 1 +IFNDEF VARRAY_ING + INCLUDE ..\inc\VARRAY.ING +ENDIF +; Class Numbers +C_CLEANUP equ 9 +C_ACTIVE equ 10 +C_AIDLE equ 11 +C_RSCFILE equ 12 +C_SYSTEM equ 13 +C_IPCS equ 14 +C_APPMAN equ 15 +; Method Numbers +O_RS_READ_BUF equ 3 +O_CL_REMOVE equ 26 +O_CL_CLEAN_LEVEL equ 28 +O_SY_ICON_POS equ 2 +O_CL_INIT equ 24 +O_SY_LINK_PASTE equ 4 +O_CL_SET_LEVEL equ 29 +O_SY_LINK_SERVER equ 3 +O_AM_NOTIFYERR equ 10 +O_AM_ADD_TASK equ 4 +O_AM_WAIT equ 5 +O_AO_ABRUN equ 3 +O_AM_START equ 2 +O_AM_NOTIFY equ 9 +O_AM_CLEAN_UP equ 11 +O_AO_CANCEL equ 2 +O_AO_QUEUE equ 4 +O_AM_RSCNAME equ 8 +O_SY_EXEC_OPEN equ 5 +O_AO_INIT equ 1 +O_CL_CLEAN_ITEM equ 27 +O_RS_READ equ 2 +O_CL_ADD equ 25 +O_AM_ONLYONE equ 12 +O_SY_INIT equ 1 +O_IP_ADD_SERVER equ 6 +O_AM_FINDIMG equ 13 +O_RS_INIT equ 1 +O_AM_LOAD_RES_BUF equ 7 +O_AO_RUN equ 5 +O_AM_STOP equ 3 +O_AM_CHANGE_PRI equ 14 +O_AM_INIT equ 1 +O_AM_LOAD_RESOURCE equ 6 +; Constants for cleanup +TY_CLEANUP_DYL equ (-5) +TY_CLEANUP_SHARED equ (-4) +TY_CLEANUP_VOID equ (-3) +TY_CLEANUP_ALLOC equ (-2) +TY_CLEANUP_IOCHAN equ (-1) +TY_CLEANUP_OBJECT equ (0) +; Types for cleanup +RC_CLEANUP struc +RC_CLEANUPType db ? +RC_CLEANUPLevel db ? +RC_CLEANUPH dw ? +RC_CLEANUP ends +SHARED_ALLOC struc +SHARED_ALLOCNref dw ? +SHARED_ALLOC ends +; Property of cleanup +PRS_CLEANUP struc +CleanupLevel dw ? +PRS_CLEANUP ends +PR_CLEANUP struc +CleanupRoot PRS_ROOT <> +CleanupVaroot PRS_VAROOT <> +CleanupVafix PRS_VAFIX <> +CleanupVaflat PRS_VAFLAT <> +CleanupCleanup PRS_CLEANUP <> +PR_CLEANUP ends +; Constants for active +PRIORITY_ACTIVE_POSTER equ (100) +PRIORITY_ACTIVE_IPCS equ (80) +PRIORITY_ACTIVE_VOICE equ (70) +PRIORITY_ACTIVE_WSERV equ (60) +PRIORITY_ACTIVE_COMMAND equ (40) +PRIORITY_ACTIVE_SERIAL equ (20) +PRIORITY_ACTIVE_ALARM equ (0) +PRIORITY_ACTIVE_FILES equ (-20) +PRIORITY_ACTIVE_REPEATER equ (-40) +PRIORITY_ACTIVE_PRINT equ (-60) +PRIORITY_ACTIVE_COMPUTE equ (-100) +; Property of active +PRS_ACTIVE struc +ActiveQ P_QUE <> +ActivePriority db ? +ActiveIsactive db ? +ActivePcb dw ? +ActiveStat dw ? +PRS_ACTIVE ends +PR_ACTIVE struc +ActiveRoot PRS_ROOT <> +ActiveActive PRS_ACTIVE <> +PR_ACTIVE ends +; Property of aidle +PR_AIDLE struc +AidleRoot PRS_ROOT <> +AidleActive PRS_ACTIVE <> +PR_AIDLE ends +; Types for rscfile +PR_RSCFILE_HEAD struc +PR_RSCFILE_HEADPos dw ? +PR_RSCFILE_HEADLen dw ? +PR_RSCFILE_HEAD ends +; Property of rscfile +PRS_RSCFILE struc +RscfilePcb dw ? +RscfileIx PR_RSCFILE_HEAD <> +RscfileOffset dw ? +RscfileHftree dd ? +PRS_RSCFILE ends +PR_RSCFILE struc +RscfileRoot PRS_ROOT <> +RscfileRscfile PRS_RSCFILE <> +PR_RSCFILE ends +; Constants for system +IC_SYSTEM_ALLOC equ (0) +IC_SYSTEM_REMOVE equ (1) +IC_SYSTEM_REPLACE equ (2) +; Property of system +PRS_SYSTEM struc +SystemPid dw ? +PRS_SYSTEM ends +PR_SYSTEM struc +SystemRoot PRS_ROOT <> +SystemSystem PRS_SYSTEM <> +PR_SYSTEM ends +; Property of ipcs +PRS_IPCS struc +IpcsHd P_QUE <> +PRS_IPCS ends +PR_IPCS struc +IpcsRoot PRS_ROOT <> +IpcsActive PRS_ACTIVE <> +IpcsIpcs PRS_IPCS <> +PR_IPCS ends +; Constants for appman +FLG_APPMAN_CLEAN equ (001h) +FLG_APPMAN_SYSTEM equ (002h) +FLG_APPMAN_RSCFILE equ (004h) +FLG_APPMAN_SRSCFILE equ (008h) +FLG_APPMAN_IPCS equ (010h) +FLG_APPMAN_ONLYONE equ (020h) +FLG_APPMAN_NODBG equ (040h) +RUN_ACTIVE_UNUSED equ (0) +RUN_ACTIVE_USED equ (1) +ERR_APPMAN_APPL equ (-512) +; Property of appman +PRS_APPMAN struc +AppmanClean dw ? +AppmanSystem dw ? +AppmanRcb dw ? +AppmanSrcb dw ? +AppmanIpcs dw ? +AppmanTask P_QUE <> +AppmanStop dw ? +AppmanNrid dw ? +AppmanErr dw ? +AppmanSpare1 dw ? +AppmanSpare2 dw ? +PRS_APPMAN ends +PR_APPMAN struc +AppmanRoot PRS_ROOT <> +AppmanAppman PRS_APPMAN <> +PR_APPMAN ends diff --git a/code/SIBOSDK/include/assert.h b/code/SIBOSDK/include/assert.h new file mode 100644 index 0000000..1e161be --- /dev/null +++ b/code/SIBOSDK/include/assert.h @@ -0,0 +1,28 @@ +/* Release 3.00 */ + +/*-------------------------------------------------------------------------* +* * +* assert.h - assert macro. * +* * +* COPYRIGHT (C) 1989 Jensen and Partners. All Rights Reserved * +* * +*--------------------------------------------------------------------------*/ +#include + +#ifdef NDEBUG +#define assert(ignore) ((void) 0) +#else +#include + +#ifdef __cplusplus +extern "C" { +#endif +extern void abort(void); +#ifdef __cplusplus +} +#endif + +#define assert(p) ((p) ? ((void) 0) : (( (void) fprintf(stderr,\ + "Assertion failed: %s, file %s, line %d\n",\ + #p, __FILE__, __LINE__)), (abort()))) +#endif diff --git a/code/SIBOSDK/include/ats.h b/code/SIBOSDK/include/ats.h new file mode 100644 index 0000000..3e83d8d --- /dev/null +++ b/code/SIBOSDK/include/ats.h @@ -0,0 +1,68 @@ +/* + File: ATS.H + Copyright (C) Psion PLC 1993 + Started by : DavidW + Started on: 12/02/93 +*/ +#ifndef ATS_H +#define ATS_H + +#include +#include + +typedef struct + { + UWORD main; + UWORD mainlen; + UWORD buts; + WORD butslen; + } ATS_DIAL_DEF; + +typedef struct + { + UWORD key; + UWORD mod; + } ATS_KEY_DEF; + +typedef union + { + UWORD position; + ATS_KEY_DEF k; + ATS_DIAL_DEF d; + UWORD delay; + VOID *offs; + WORD par; + UWORD wid; + } ATS_MESS_BODY; + +typedef struct + { + E_MESSAGE mess; + ATS_MESS_BODY u; + } ATS_MESS; + +#define TY_ATS_CLIENT_POS 0x30 +#define TY_ATS_KEY 0x31 +#define TY_ATS_PAUSE 0x32 +#define TY_ATS_MESSAGE 0x33 +#define TY_ATS_DIALOG 0x34 +#define TY_ATS_SELF_CHECK 0x35 +#define TY_ATS_WINDOW_XSUM 0x36 +#define TY_ATS_RECORD 0x37 +#define TY_ATS_GET_KEY 0x38 +#define TY_ATS_ALLCOUNT 0x39 + +#define TY_ATS_START_RANGE 0x30 +#define TY_ATS_END_RANGE 0x3f + +typedef struct + { + UWORD time; + UWORD keycode; + UBYTE modifiers; + UBYTE count; + } ATS_KEY; + +#define ATS_MAX_EDITOR_LEN 256 /* includes trailing zero */ + +#endif // ATS_H \ No newline at end of file diff --git a/code/SIBOSDK/include/atssv.g b/code/SIBOSDK/include/atssv.g new file mode 100644 index 0000000..0242caa --- /dev/null +++ b/code/SIBOSDK/include/atssv.g @@ -0,0 +1,40 @@ +/* Generated by Ctran from atssv.cl */ +#define ATSSV_G +#ifndef IPC_G +#include +#endif +#ifndef TIMER_G +#include +#endif +#ifndef ATS_H +#include +#endif +/* Class Numbers */ +#define C_ATSSV 13 +#define C_ATSTIM 14 +/* Method Numbers */ +#define O_SV_KEY 5 +#define O_SV_FREE 4 +/* Property of atssv */ +typedef struct { +PR_TIMER *timer; +void *pm; +short int freed; +void *pm_key; +} PRS_ATSSV; +typedef struct pr_atssv +{ +PRS_ROOT root; +PRS_SERVER server; +PRS_ATSSV atssv; +} PR_ATSSV; +/* Property of atstim */ +typedef struct { +void *owner; +} PRS_ATSTIM; +typedef struct pr_atstim +{ +PRS_ROOT root; +PRS_ACTIVE active; +PRS_ATSTIM atstim; +} PR_ATSTIM; diff --git a/code/SIBOSDK/include/atssv.ing b/code/SIBOSDK/include/atssv.ing new file mode 100644 index 0000000..59e2912 --- /dev/null +++ b/code/SIBOSDK/include/atssv.ing @@ -0,0 +1,38 @@ +; Generated by Ctran from atssv.cl +ATSSV_ING equ 1 +IFNDEF IPC_ING + INCLUDE ..\inc\IPC.ING +ENDIF +IFNDEF TIMER_ING + INCLUDE ..\inc\TIMER.ING +ENDIF +IFNDEF ATS_INC + INCLUDE ..\inc\ATS.INC +ENDIF +; Class Numbers +C_ATSSV equ 13 +C_ATSTIM equ 14 +; Method Numbers +O_SV_KEY equ 5 +O_SV_FREE equ 4 +; Property of atssv +PRS_ATSSV struc +AtssvTimer dw ? +AtssvPm dw ? +AtssvFreed dw ? +AtssvPm_key dw ? +PRS_ATSSV ends +PR_ATSSV struc +AtssvRoot PRS_ROOT <> +AtssvServer PRS_SERVER <> +AtssvAtssv PRS_ATSSV <> +PR_ATSSV ends +; Property of atstim +PRS_ATSTIM struc +AtstimOwner dw ? +PRS_ATSTIM ends +PR_ATSTIM struc +AtstimRoot PRS_ROOT <> +AtstimActive PRS_ACTIVE <> +AtstimAtstim PRS_ATSTIM <> +PR_ATSTIM ends diff --git a/code/SIBOSDK/include/bcd.hpp b/code/SIBOSDK/include/bcd.hpp new file mode 100644 index 0000000..5e39a5c --- /dev/null +++ b/code/SIBOSDK/include/bcd.hpp @@ -0,0 +1,338 @@ +/* Release 3.10 */ +/*-------------------------------------------------------------------------* +* * +* BCD.HPP - header file for BCD math. * +* * +* COPYRIGHT (C) 1990..1992 Clarion Software Corporation * +* All Rights Reserved * +* * +*--------------------------------------------------------------------------*/ +#include + +#ifndef __BCD_INC_ +#define __BCD_INC_ + +#include +#include + +#define _BcdMaxDecimals 100 + +typedef enum { ExpZero, ExpNan }; + +class bcd { + +friend long double real(bcd&); + +friend bcd abs(bcd&); +friend bcd acos(bcd&); +friend bcd asin(bcd&); +friend bcd atan(bcd&); +friend bcd cos(bcd&); +friend bcd cosh(bcd&); +friend bcd exp(bcd&); +friend bcd log(bcd&); +friend bcd log10(bcd&); +friend bcd pow(bcd& base, bcd& expon); +friend bcd sin(bcd&); +friend bcd sinh(bcd&); +friend bcd sqrt(bcd&); +friend bcd tan(bcd&); +friend bcd tanh(bcd&); + +friend bcd operator+(bcd&, bcd&); +friend bcd operator+(long double, bcd&); +friend bcd operator+(bcd&, long double); +friend bcd operator-(bcd&, bcd&); +friend bcd operator-(long double, bcd&); +friend bcd operator-(bcd&, long double); +friend bcd operator*(bcd&, bcd&); +friend bcd operator*(long double, bcd&); +friend bcd operator*(bcd&, long double); +friend bcd operator/(bcd&, bcd&); +friend bcd operator/(long double, bcd&); +friend bcd operator/(bcd&, long double); +friend int operator==(bcd&, bcd&); +friend int operator!=(bcd&, bcd&); +friend int operator>=(bcd&, bcd&); +friend int operator<=(bcd&, bcd&); +friend int operator>(bcd&, bcd&); +friend int operator<(bcd&, bcd&); +friend ostream& operator<<(ostream&, bcd&); +friend istream& operator>>(istream&, bcd&); + +public: + + bcd(int x=0); + bcd(unsigned x); + bcd(long x); + bcd(unsigned long x); + bcd(double x, int decimals = _BcdMaxDecimals); + bcd(long double x, int decimals = _BcdMaxDecimals); + + bcd& operator+=(bcd&); + bcd& operator+=(long double); + bcd& operator-=(bcd&); + bcd& operator-=(long double); + bcd& operator*=(bcd&); + bcd& operator*=(long double); + bcd& operator/=(bcd&); + bcd& operator/=(long double); + bcd operator+(); + bcd operator-(); + + long double dec_to_real(); + void real_to_dec(long double num, int decimals = _BcdMaxDecimals); + +private: + + void int_to_dec(unsigned long); + void bcd_copy_from(unsigned char *dest); + void bcd_copy_to(unsigned char *source); + + unsigned char bcd_array[10]; + unsigned char exp; +}; + + +inline bcd::bcd(long double x, int decimals) { + + real_to_dec(x, decimals); +} + +inline bcd::bcd(double x, int decimals) { + + real_to_dec((long double) x, decimals); +} + + +inline long double real(bcd& z) { + + return z.dec_to_real(); +} + +inline bcd& bcd::operator+=(bcd& b) { + + real_to_dec(real(*this)+real(b)); + return *this; +} + +inline bcd& bcd::operator+=(long double b) { + + real_to_dec(real(*this)+b); + return *this; +} + +inline bcd& bcd::operator-=(bcd& b) { + + real_to_dec(real(*this)-real(b)); + return *this; +} + +inline bcd& bcd::operator-=(long double b) { + + real_to_dec(real(*this)-b); + return *this; +} + +inline bcd& bcd::operator*=(bcd& b) { + + real_to_dec(real(*this)*real(b)); + return *this; +} + +inline bcd& bcd::operator*=(long double b) { + + real_to_dec(real(*this)*b); + return *this; +} + +inline bcd& bcd::operator/=(bcd& b) { + + real_to_dec(real(*this)/real(b)); + return *this; +} + +inline bcd& bcd::operator/=(long double b) { + + real_to_dec(real(*this)/b); + return *this; +} + +inline bcd operator+(bcd& a, bcd& b) { + + return bcd(real(a)+real(b)); +} + +inline bcd operator+(long double a, bcd& b) { + + return bcd(a+real(b)); +} + +inline bcd operator+(bcd& a, long double b) { + + return bcd(real(a)+b); +} + +inline bcd operator-(bcd& a, bcd& b) { + + return bcd(real(a)-real(b)); +} + +inline bcd operator-(long double a, bcd& b) { + + return bcd(a-real(b)); +} + +inline bcd operator-(bcd& a, long double b) { + + return bcd(real(a)-b); +} + +inline bcd operator*(bcd& a, bcd& b) { + + return bcd(real(a)*real(b)); +} + +inline bcd operator*(long double a, bcd& b) { + + return bcd(a*real(b)); +} + +inline bcd operator*(bcd& a, long double b) { + + return bcd(real(a)*b); +} + +inline bcd operator/(bcd& a, bcd& b) { + + return bcd(real(a)/real(b)); +} + +inline bcd operator/(long double a, bcd& b) { + + return bcd(a/real(b)); +} + +inline bcd operator/(bcd& a, long double b) { + + return bcd(real(a)/b); +} + +inline int operator==(bcd& a, bcd& b) { + + return real(a) == real(b); +} + +inline int operator!=(bcd& a, bcd& b) { + + return real(a) != real(b); +} + +inline int operator>=(bcd& a, bcd& b) { + + return real(a) >= real(b); +} + +inline int operator<=(bcd& a, bcd& b) { + + return real(a) <= real(b); +} + +inline int operator<(bcd& a, bcd& b) { + + return real(a) < real(b); +} + +inline int operator>(bcd& a, bcd& b) { + + return real(a) > real(b); +} + +inline bcd bcd::operator+() { + + return *this; +} + +inline bcd abs(bcd& a) { + + return bcd(fabsl(real(a))); +} + +inline bcd acos(bcd& a) { + + return bcd(acosl(real(a))); +} + +inline bcd asin(bcd& a) { + + return bcd(asinl(real(a))); +} + +inline bcd atan(bcd& a) { + + return bcd(atanl(real(a))); +} + +inline bcd cos(bcd& a) { + + return bcd(cosl(real(a))); +} + +inline bcd cosh(bcd& a) { + + return bcd(coshl(real(a))); +} + +inline bcd exp(bcd& a) { + + return bcd(expl(real(a))); +} + +inline bcd log(bcd& a) { + + return bcd(logl(real(a))); +} + +inline bcd log10(bcd& a) { + + return bcd(log10l(real(a))); +} + +inline bcd sin(bcd& a) { + + return bcd(sinl(real(a))); +} + +inline bcd sinhl(bcd& a) { + + return bcd(sinhl(real(a))); +} + +inline bcd sqrt(bcd& a) { + + return bcd(sqrtl(real(a))); +} + +inline bcd tan(bcd& a) { + + return bcd(tanl(real(a))); +} + +inline bcd tanh(bcd& a) { + + return bcd(tanhl(real(a))); +} + +inline bcd pow(bcd& a, bcd& b) { + + return bcd(powl(real(a), real(b))); +} + +inline bcd pow10(int n, bcd& a) { + + return bcd( pow10(n) * real(a) ); +} + + +#endif + diff --git a/code/SIBOSDK/include/bwin.g b/code/SIBOSDK/include/bwin.g new file mode 100644 index 0000000..3c80d4b --- /dev/null +++ b/code/SIBOSDK/include/bwin.g @@ -0,0 +1,26 @@ +/* Generated by Ctran from bwin.cl */ +#define BWIN_G +#ifndef WIN_G +#include +#endif +/* Class Numbers */ +#define C_BWIN 2 +/* Method Numbers */ +/* Constants for bwin */ +#define IN_BWIN_CORNER_4 PR_BWIN_CORNER_4 +#define IN_BWIN_SHADOW_1 PR_BWIN_SHADOW_1 +#define IN_BWIN_SHADOW_2 PR_BWIN_SHADOW_2 +#define IN_BWIN_CUSHION PR_BWIN_CUSHION +#define IN_BWIN_OPEN PR_BWIN_OPEN +#define BWIN_CUSHION_X 1 +#define BWIN_CUSHION_Y 1 +#define BWIN_SHADOW_1_HEIGHT 1 +#define BWIN_SHADOW_1_WIDTH 1 +#define BWIN_SHADOW_2_HEIGHT 2 +#define BWIN_SHADOW_2_WIDTH 2 +/* Property of bwin */ +typedef struct pr_bwin +{ +PRS_ROOT root; +PRS_WIN win; +} PR_BWIN; diff --git a/code/SIBOSDK/include/bwin.ing b/code/SIBOSDK/include/bwin.ing new file mode 100644 index 0000000..ee1c516 --- /dev/null +++ b/code/SIBOSDK/include/bwin.ing @@ -0,0 +1,25 @@ +; Generated by Ctran from bwin.cl +BWIN_ING equ 1 +IFNDEF WIN_ING + INCLUDE ..\inc\WIN.ING +ENDIF +; Class Numbers +C_BWIN equ 2 +; Method Numbers +; Constants for bwin +IN_BWIN_CORNER_4 equ (PR_BWIN_CORNER_4) +IN_BWIN_SHADOW_1 equ (PR_BWIN_SHADOW_1) +IN_BWIN_SHADOW_2 equ (PR_BWIN_SHADOW_2) +IN_BWIN_CUSHION equ (PR_BWIN_CUSHION) +IN_BWIN_OPEN equ (PR_BWIN_OPEN) +BWIN_CUSHION_X equ (1) +BWIN_CUSHION_Y equ (1) +BWIN_SHADOW_1_HEIGHT equ (1) +BWIN_SHADOW_1_WIDTH equ (1) +BWIN_SHADOW_2_HEIGHT equ (2) +BWIN_SHADOW_2_WIDTH equ (2) +; Property of bwin +PR_BWIN struc +BwinRoot PRS_ROOT <> +BwinWin PRS_WIN <> +PR_BWIN ends diff --git a/code/SIBOSDK/include/calimg.g b/code/SIBOSDK/include/calimg.g new file mode 100644 index 0000000..1c2bad4 --- /dev/null +++ b/code/SIBOSDK/include/calimg.g @@ -0,0 +1,126 @@ +/* Generated by Ctran from calimg.cat */ +#define CALIMG_G +#ifndef WLIB_H +#include +#endif +/* Class Numbers */ +#define C_CALIMG 11 +/* Method Numbers */ +#define O_CI_SENSE 8 +#define O_CI_TODAY_CHANGED 11 +#define O_CI_MOVE_CURSOR 4 +#define O_CI_REDRAW 7 +#define O_CI_EMPHASISE 3 +#define O_CI_GOTO_DATE 5 +#define O_CI_POS_MXY 10 +#define O_CI_SET_TITLE 2 +#define O_CI_ADJUST_DATE 6 +#define O_CI_INIT 1 +#define O_CI_VIEW 9 +/* Constants for calimg */ +#define CI_MAX_MONTH 12 +#define CI_GRIDY TRUE +#define CI_GRIDX FALSE +#define CALIMG_CURSOR_NO_FLASH 0x01 +#define CALIMG_DOW_EVERY_ROW 0x02 +#define CALIMG_FONT_DATA_KNOWN 0x04 +#define CALIMG_LEFT 0x00 +#define CALIMG_HOME 0x01 +#define CALIMG_PREV_DAY 0x02 +#define CALIMG_PREV_MONTH 0x03 +#define CALIMG_RIGHT 0x04 +#define CALIMG_END 0x05 +#define CALIMG_NEXT_DAY 0x06 +#define CALIMG_NEXT_MONTH 0x07 +#define CALIMG_UP 0x08 +#define CALIMG_PAGEUP 0x09 +#define CALIMG_PREV_WEEK 0x0A +#define CALIMG_PREV_YEAR 0x0B +#define CALIMG_DOWN 0x0C +#define CALIMG_PAGEDN 0x0D +#define CALIMG_NEXT_WEEK 0x0E +#define CALIMG_NEXT_YEAR 0x0F +#define CALIMG_GOTO_TODAY 0x10 +#define CALIMG_WEST 0x01 +#define CALIMG_EAST 0x02 +#define CALIMG_NORTH 0x03 +#define CALIMG_SOUTH 0x04 +#define CALIMG_ADJ_DAY 0x01 +#define CALIMG_ADJ_MONTH 0x02 +#define CALIMG_ADJ_YEAR 0x04 +/* Types for calimg */ +typedef struct +{ +unsigned char title_ascent; +unsigned char title_lht; +unsigned char dow_ascent; +unsigned char dow_lht; +unsigned char mth_ascent; +unsigned char mth_lht; +unsigned char day_ascent; +unsigned char day_lht; +unsigned char daygapx; +unsigned char daywidth; +} CI_EXT_FONT; +typedef struct +{ +short int fid; +unsigned short int style; +unsigned short int leading; +} CI_FONT_DATA; +typedef struct +{ +unsigned short int wid; +unsigned short int width; +P_POINT tl; +unsigned char mrow; +unsigned char mcol; +unsigned short int flags; +CI_FONT_DATA title; +CI_FONT_DATA month; +CI_FONT_DATA dow; +CI_FONT_DATA day; +unsigned short int daygap; +unsigned char mthgapx; +unsigned char hscrlm; +unsigned short int startm; +unsigned long int days; +CI_EXT_FONT font; +} IN_CALIMG; +typedef struct +{ +unsigned char year; +unsigned char month; +P_POINT pos; +} CI_CURSOR; +typedef struct +{ +short int year; +short int month; +short int day; +}CI_DATE; +/* Property of calimg */ +typedef struct { +P_RECT rect[12]; +P_RECT title_rect; +CI_CURSOR crs; +char day; +unsigned char startOfWeek; +unsigned char thisyear; +unsigned char thismth; +unsigned char thisday; +unsigned char ystart; +unsigned char bwidth; +unsigned char filler; +char dayNameAbbrev[7]; +char deftitle[3]; +char *title; +short int emphasised; +IN_CALIMG img; +int bmid; +} PRS_CALIMG; +typedef struct pr_calimg +{ +PRS_ROOT root; +PRS_CALIMG calimg; +} PR_CALIMG; diff --git a/code/SIBOSDK/include/calimg.ing b/code/SIBOSDK/include/calimg.ing new file mode 100644 index 0000000..150d502 --- /dev/null +++ b/code/SIBOSDK/include/calimg.ing @@ -0,0 +1,120 @@ +; Generated by Ctran from calimg.cl +CALIMG_ING equ 1 +IFNDEF WLIB_INC + INCLUDE ..\inc\WLIB.INC +ENDIF +; Class Numbers +C_CALIMG equ 11 +; Method Numbers +O_CI_SENSE equ 8 +O_CI_TODAY_CHANGED equ 11 +O_CI_MOVE_CURSOR equ 4 +O_CI_REDRAW equ 7 +O_CI_EMPHASISE equ 3 +O_CI_GOTO_DATE equ 5 +O_CI_POS_MXY equ 10 +O_CI_SET_TITLE equ 2 +O_CI_ADJUST_DATE equ 6 +O_CI_INIT equ 1 +O_CI_VIEW equ 9 +; Constants for calimg +CI_MAX_MONTH equ (12) +CI_GRIDY equ (TRUE) +CI_GRIDX equ (FALSE) +CALIMG_CURSOR_NO_FLASH equ (001h) +CALIMG_DOW_EVERY_ROW equ (002h) +CALIMG_FONT_DATA_KNOWN equ (004h) +CALIMG_LEFT equ (000h) +CALIMG_HOME equ (001h) +CALIMG_PREV_DAY equ (002h) +CALIMG_PREV_MONTH equ (003h) +CALIMG_RIGHT equ (004h) +CALIMG_END equ (005h) +CALIMG_NEXT_DAY equ (006h) +CALIMG_NEXT_MONTH equ (007h) +CALIMG_UP equ (008h) +CALIMG_PAGEUP equ (009h) +CALIMG_PREV_WEEK equ (00Ah) +CALIMG_PREV_YEAR equ (00Bh) +CALIMG_DOWN equ (00Ch) +CALIMG_PAGEDN equ (00Dh) +CALIMG_NEXT_WEEK equ (00Eh) +CALIMG_NEXT_YEAR equ (00Fh) +CALIMG_GOTO_TODAY equ (010h) +CALIMG_WEST equ (001h) +CALIMG_EAST equ (002h) +CALIMG_NORTH equ (003h) +CALIMG_SOUTH equ (004h) +CALIMG_ADJ_DAY equ (001h) +CALIMG_ADJ_MONTH equ (002h) +CALIMG_ADJ_YEAR equ (004h) +; Types for calimg +CI_EXT_FONT struc +CI_EXT_FONTTitle_ascent db ? +CI_EXT_FONTTitle_lht db ? +CI_EXT_FONTDow_ascent db ? +CI_EXT_FONTDow_lht db ? +CI_EXT_FONTMth_ascent db ? +CI_EXT_FONTMth_lht db ? +CI_EXT_FONTDay_ascent db ? +CI_EXT_FONTDay_lht db ? +CI_EXT_FONTDaygapx db ? +CI_EXT_FONTDaywidth db ? +CI_EXT_FONT ends +CI_FONT_DATA struc +CI_FONT_DATAFid dw ? +CI_FONT_DATAStyle dw ? +CI_FONT_DATALeading dw ? +CI_FONT_DATA ends +IN_CALIMG struc +IN_CALIMGWid dw ? +IN_CALIMGWidth dw ? +IN_CALIMGTl P_POINT <> +IN_CALIMGMrow db ? +IN_CALIMGMcol db ? +IN_CALIMGFlags dw ? +IN_CALIMGTitle CI_FONT_DATA <> +IN_CALIMGMonth CI_FONT_DATA <> +IN_CALIMGDow CI_FONT_DATA <> +IN_CALIMGDay CI_FONT_DATA <> +IN_CALIMGDaygap dw ? +IN_CALIMGMthgapx db ? +IN_CALIMGHscrlm db ? +IN_CALIMGStartm dw ? +IN_CALIMGDays dd ? +IN_CALIMGFont CI_EXT_FONT <> +IN_CALIMG ends +CI_CURSOR struc +CI_CURSORYear db ? +CI_CURSORMonth db ? +CI_CURSORPos P_POINT <> +CI_CURSOR ends +CI_DATE struc +CI_DATEYear dw ? +CI_DATEMonth dw ? +CI_DATEDay dw ? +CI_DATE ends +; Property of calimg +PRS_CALIMG struc +CalimgRect db (size P_RECT)* 12 dup (?) +CalimgTitle_rect P_RECT <> +CalimgCrs CI_CURSOR <> +CalimgDay db ? +CalimgStartOfWeek db ? +CalimgThisyear db ? +CalimgThismth db ? +CalimgThisday db ? +CalimgYstart db ? +CalimgBwidth db ? +CalimgFiller db ? +CalimgDayNameAbbrev db (1) * 7 dup (?) +CalimgDeftitle db (1) * 3 dup (?) +CalimgTitle dw ? +CalimgEmphasised dw ? +CalimgImg IN_CALIMG <> +CalimgBmid dw ? +PRS_CALIMG ends +PR_CALIMG struc +CalimgRoot PRS_ROOT <> +CalimgCalimg PRS_CALIMG <> +PR_CALIMG ends diff --git a/code/SIBOSDK/include/calwin.g b/code/SIBOSDK/include/calwin.g new file mode 100644 index 0000000..6fccd7f --- /dev/null +++ b/code/SIBOSDK/include/calwin.g @@ -0,0 +1,48 @@ +/* Generated by Ctran from calwin.cl */ +#define CALWIN_G +#ifndef BWIN_G +#include +#endif +/* Class Numbers */ +#define C_CALIMGWN 9 +#define C_CALWIN 10 +/* Method Numbers */ +/* Property of calimgwn */ +typedef struct { +void *calimg; +} PRS_CALIMGWN; +typedef struct pr_calimgwn +{ +PRS_ROOT root; +PRS_WIN win; +PRS_CALIMGWN calimgwn; +} PR_CALIMGWN; +/* Constants for calwin */ +#define IN_CALWIN_1_MONTH 0x0001 +#define IN_CALWIN_3_MONTH 0x0002 +#define IN_CALWIN_12_MONTH 0x0004 +#define IN_CALWIN_STD_FLAGS 0x0007 +#define IN_CALWIN_USER_SPEC 0x0010 +#define PR_CALWIN_TODAY_HOOKED 0x0020 +/* Types for calwin */ +typedef struct +{ +unsigned short int flags; +unsigned long int days; +P_POINT pos; +void *calimg; +void **self_ptr; +} IN_CALWIN; +/* Property of calwin */ +typedef struct { +PR_CALIMGWN *calimgwn; +void *calimg; +unsigned short int flags; +void **self_ptr; +} PRS_CALWIN; +typedef struct pr_calwin +{ +PRS_ROOT root; +PRS_WIN win; +PRS_CALWIN calwin; +} PR_CALWIN; diff --git a/code/SIBOSDK/include/calwin.ing b/code/SIBOSDK/include/calwin.ing new file mode 100644 index 0000000..3aebe82 --- /dev/null +++ b/code/SIBOSDK/include/calwin.ing @@ -0,0 +1,45 @@ +; Generated by Ctran from calwin.cl +CALWIN_ING equ 1 +IFNDEF BWIN_ING + INCLUDE ..\inc\BWIN.ING +ENDIF +; Class Numbers +C_CALIMGWN equ 9 +C_CALWIN equ 10 +; Method Numbers +; Property of calimgwn +PRS_CALIMGWN struc +CalimgwnCalimg dw ? +PRS_CALIMGWN ends +PR_CALIMGWN struc +CalimgwnRoot PRS_ROOT <> +CalimgwnWin PRS_WIN <> +CalimgwnCalimgwn PRS_CALIMGWN <> +PR_CALIMGWN ends +; Constants for calwin +IN_CALWIN_1_MONTH equ (00001h) +IN_CALWIN_3_MONTH equ (00002h) +IN_CALWIN_12_MONTH equ (00004h) +IN_CALWIN_STD_FLAGS equ (00007h) +IN_CALWIN_USER_SPEC equ (00010h) +PR_CALWIN_TODAY_HOOKED equ (00020h) +; Types for calwin +IN_CALWIN struc +IN_CALWINFlags dw ? +IN_CALWINDays dd ? +IN_CALWINPos P_POINT <> +IN_CALWINCalimg dw ? +IN_CALWINSelf_ptr dw ? +IN_CALWIN ends +; Property of calwin +PRS_CALWIN struc +CalwinCalimgwn dw ? +CalwinCalimg dw ? +CalwinFlags dw ? +CalwinSelf_ptr dw ? +PRS_CALWIN ends +PR_CALWIN struc +CalwinRoot PRS_ROOT <> +CalwinWin PRS_WIN <> +CalwinCalwin PRS_CALWIN <> +PR_CALWIN ends diff --git a/code/SIBOSDK/include/chlist.g b/code/SIBOSDK/include/chlist.g new file mode 100644 index 0000000..642498d --- /dev/null +++ b/code/SIBOSDK/include/chlist.g @@ -0,0 +1,54 @@ +/* Generated by Ctran from chlist.cl */ +#define CHLIST_G +#ifndef LODGER_G +#include +#endif +#ifndef VARES_G +#include +#endif +#ifndef MATCHER_G +#include +#endif +#ifndef LISTBOX_G +#include +#endif +/* Class Numbers */ +#define C_CHLIST 21 +/* Method Numbers */ +/* Constants for chlist */ +#define SE_CHLIST_NSEL 0x01 +#define SE_CHLIST_DATA 0x02 +#define SE_CHLIST_RETAIN 0x04 +#define IN_CHLIST_INCREMENTAL 0x01 +#define PR_CHLIST_RETAIN 0x04 +#define PR_CHLIST_SUSPENDED 0x08 +#define PR_CHLIST_FIXED_WIDTH 0x10 +/* Types for chlist */ +typedef struct +{ +short int rid; +unsigned char nsel; +unsigned char flags; +} IN_CHLIST; +typedef struct +{ +unsigned short int set_flags; +PR_VAROOT *data; +unsigned short int nsel; +} SE_CHLIST; +/* Property of chlist */ +typedef struct { +PR_LISTBOX *pop; +PR_VMATCHER *matcher; +PR_VARES *data; +unsigned short int nsel; +unsigned short int flags; +unsigned short int matchlen; +} PRS_CHLIST; +typedef struct pr_chlist +{ +PRS_ROOT root; +PRS_WIN win; +PRS_LODGER lodger; +PRS_CHLIST chlist; +} PR_CHLIST; diff --git a/code/SIBOSDK/include/chlist.ing b/code/SIBOSDK/include/chlist.ing new file mode 100644 index 0000000..f07a616 --- /dev/null +++ b/code/SIBOSDK/include/chlist.ing @@ -0,0 +1,51 @@ +; Generated by Ctran from chlist.cl +CHLIST_ING equ 1 +IFNDEF LODGER_ING + INCLUDE ..\inc\LODGER.ING +ENDIF +IFNDEF VARES_ING + INCLUDE ..\inc\VARES.ING +ENDIF +IFNDEF MATCHER_ING + INCLUDE ..\inc\MATCHER.ING +ENDIF +IFNDEF LISTBOX_ING + INCLUDE ..\inc\LISTBOX.ING +ENDIF +; Class Numbers +C_CHLIST equ 21 +; Method Numbers +; Constants for chlist +SE_CHLIST_NSEL equ (001h) +SE_CHLIST_DATA equ (002h) +SE_CHLIST_RETAIN equ (004h) +IN_CHLIST_INCREMENTAL equ (001h) +PR_CHLIST_RETAIN equ (004h) +PR_CHLIST_SUSPENDED equ (008h) +PR_CHLIST_FIXED_WIDTH equ (010h) +; Types for chlist +IN_CHLIST struc +IN_CHLISTRid dw ? +IN_CHLISTNsel db ? +IN_CHLISTFlags db ? +IN_CHLIST ends +SE_CHLIST struc +SE_CHLISTSet_flags dw ? +SE_CHLISTData dw ? +SE_CHLISTNsel dw ? +SE_CHLIST ends +; Property of chlist +PRS_CHLIST struc +ChlistPop dw ? +ChlistMatcher dw ? +ChlistData dw ? +ChlistNsel dw ? +ChlistFlags dw ? +ChlistMatchlen dw ? +PRS_CHLIST ends +PR_CHLIST struc +ChlistRoot PRS_ROOT <> +ChlistWin PRS_WIN <> +ChlistLodger PRS_LODGER <> +ChlistChlist PRS_CHLIST <> +PR_CHLIST ends diff --git a/code/SIBOSDK/include/clib.h b/code/SIBOSDK/include/clib.h new file mode 100644 index 0000000..9994588 --- /dev/null +++ b/code/SIBOSDK/include/clib.h @@ -0,0 +1,290 @@ +/* Release 3.00 */ + +/*-------------------------------------------------------------------------* +* * +* clib.h - internal header file for C library. * +* * +* COPYRIGHT (C) 1989, 1990 Jensen and Partners. All Rights Reserved * +* * +*--------------------------------------------------------------------------*/ +#include + +#ifndef _CLIB_INC_ +#define _CLIB_INC_ + +#pragma warn(wall => on) /* enable all warnings */ + +#define _STATIC static /* hide local stuff */ + +#define _IO_MTF +#define _CT_MTF + +#define LONGDOUBLE long double +#define FLOORL(x) floorl(x) +#define LOG10L(x) log10l(x) + +#include +#include +#ifdef _USE_CONIO +#include +#endif +#include +#include +#include +#include +#include +#ifdef _USE_FLOAT +#include +#endif +#ifndef _NO_IO +#include +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef _USE_TIME +#include +#include +#endif + +typedef struct sfc { /* control structure for vscanner */ + FILE *_stream; /* file pointer */ + int (*_vs_fill)(FILE *st); /* filler function pointer */ + int _vs_count; /* character count */ + int _s_args; /* argument count */ + jmp_buf _EOFhandler; /* EOF jump environment */ +} SF ; + +typedef struct pf { + FILE *_stream; /* file pointer */ + int (*_vp_flush)(FILE *st); /* output function pointer */ + int _vp_ret; /* character count */ + } PF; + +extern int (*_vs_fill)(FILE *st); /* filler function pointer */ +extern int (*_vp_flush)(FILE *st); /* output function pointer */ + +#ifdef __cplusplus +extern "C" { +#endif +extern int _filler(FILE *st); +extern int _flusher(FILE *st); + +extern int _dup(int handle); /* low level I/O */ +extern int _dup2(int h1, int h2); +extern void _ioerr(int code); +extern unsigned lsl(unsigned sel); + +extern void _exit1(void); +extern void _exit2(void); +extern void _exitf(void); + +extern char *_d_cgets(char *s); +extern int _d_putch(int c); +extern int (*_i_putch)(int c); +extern char *(*_i_cgets)(char *s); + +extern char *_ld_format(char *fmt_buf, LONGDOUBLE num, int flag, int prec); +extern char *_v_format(unsigned long l, char *s); + +extern int _matherr(struct exception *x); +extern int _flsbuf(int ch, FILE *st); +extern int _filbuf(FILE *st); + +#ifdef _USE_TIME +extern clock_t _clock_time(void); +extern size_t _set_date(char *s, size_t scount, size_t lim, char *st); +extern unsigned long _t_calc(struct date dte, struct time tme); +extern int _t_to_struct(unsigned long val, struct date *dte, struct time *tme); +extern struct tm * _t_to_tm(unsigned long clock); +extern unsigned long _t_norm(struct tm *timeptr); +extern unsigned long _ytable(int n); +#endif + +extern va_list _rreal_out(va_list _v_argptr, int flag, int wid, int prec); +extern va_list _real_pdef(va_list _v_argptr, int flag, int wid, int prec); +extern va_list _rreal_in(int pmod, int smod, unsigned flag, int width, va_list _v_argptr); +extern va_list _real_sdef(int pmod, int smod, unsigned flag, int width, va_list _v_argptr); + +extern char *_f_fmt(char *_fmt_buf, LONGDOUBLE num, int flag, int prec); +extern char *_fptoa(unsigned long, char *s); + +extern double _atof(const char *s, int flag, int *pos); + +extern int _pf_entry(FILE *st); +extern void _pf_exit(FILE *st, int flag); +extern void _vp_setbuf(FILE *st, char *buf); +extern void _vp_freebuf(FILE *st); + +extern FILE *_alloc_stream(FILE *stream, int handle, int flag); +extern void _flushall(void); +extern int _free_stream(void); +extern int _getfmode(const char *path); +extern int _open_stream(const char *path, int *fptr, int mode); +extern int _scan_type(const char *type, int *fptr, int *mptr); +extern int _valid_stream(FILE *st); + +#pragma save +#pragma call(reg_saved=>(ds, di, si,st1,st2), reg_param=>(ax,bx,cx,dx)) +extern int _vgetc(void); +extern int _vungetc(int c); + +extern void _justify(char *s, int flag, int width); +extern void _str_out(char *s, int flag, int width, int precision); +extern void _vputc(int ch); +#pragma restore + +extern unsigned char _exists(const char *path); + +extern void _swap(void *b1, void *b2, size_t width); + +extern LONGDOUBLE _acvt(int flag, char *mbuf, int exp, int len); +extern void _cvt(LONGDOUBLE x, int n, int *dec, int *sign, char * buf); +extern void _seterrno(int type); + +extern LONGDOUBLE _pow_int(LONGDOUBLE x,int y); +extern LONGDOUBLE _round( LONGDOUBLE x ); +extern void _bcd(LONGDOUBLE x,char * p); + +extern void _FatalError(unsigned address, int code); +extern unsigned _FatalErrorPos(void); + +extern void (*_exit_stk[32])(void); /* at/onexit function stack */ + +#pragma save,check(index=>off) +extern void (**_exit_ptr)(void); +extern void (**_exit_top)(void); +#pragma restore + +extern void (*_exit_io)(void); +extern void (*_exit_tmp)(void); + +extern va_list (*_real_in)(int pmod, int smod, unsigned flag, int width, va_list _v_argptr); +extern va_list (*_real_out)(va_list _v_argptr, int flag, int wid, int prec); + +extern void (*_exit_proc)(void); +#ifdef __cplusplus +} +#endif + +/* Internal Data Declarations. */ + +extern char _cvt_buf[64]; /* real number conversion buffer */ +extern char _ctype[257]; /* ctype data */ +extern struct lconv _lconv; +#ifdef _USE_TIME +extern time_t _proc_time; /* time at beginning of process */ +#endif +extern char _sys_errbuf[128];/* error message buffer */ +extern char *sys_errlist[]; /* error messages */ +extern int sys_nerr; /* number of system error strings */ +extern double _tens[32]; +extern char _upperHex; /* conversion case */ + +extern jmp_buf _EOFhandler; /* EOF error jump environment */ +extern unsigned _fmask; +extern _iosetup; /* initialisation flag */ +extern int _p_init; +extern int _s_args; /* argument count */ +extern FILE *_stream; /* file pointer */ +extern int _ungotchar; /* temporary storage for console I/O */ +extern int _vp_ret; /* character count */ +extern int _vs_count; /* character count */ +extern int _open_max; /* maximum number of open files */ +extern char *_tmpfiles[]; +extern FILE *_tmpfptrs[]; + +extern char _argbuf[128]; /* command line buffer */ +extern unsigned _assign_init_magic; + +/*****************************************************************************/ +/* CPP Definitions. */ +/*****************************************************************************/ + +typedef void *(*ctor_t)(void *); +typedef void (*dtor_t)(void *); + +#pragma save, call(reg_param=>(), reg_saved=>(ds,si,di,st1,st2), near_call=>on, c_conv=>on) +#ifdef __cplusplus +extern "C" { +#endif +extern void _call_ctors(ctor_t, char *obj_ptr, int vbnum, int n, int siz); +extern void _call_dtors(dtor_t, char *obj_ptr, int vbnum, int n, int siz); +#ifdef __cplusplus +} +#endif +#pragma restore + +/* Macro Definitions. */ + +#define TRUE 1 +#define FALSE 0 + +#define _CTLZ 0x01A +#define _O_LRD 0x400 +#define _WRITE 2 +#define _NODEFMODE 4 +#define _READ 8 + +#define _MNEG 1 +#define _ENEG 2 +#define _STD 8 +#define _HMAX 54 +#define _HEX 1 +#define _OCT 2 +#define _NEG 4 +#define _OFL 8 + +#define _DAYSECS 86400L /* seconds in year */ +#define _SEVENTIES 315532800L /* seconds between 1970 and 1980 */ + +#define InternalError(c) _FatalError(_FatalErrorPos(), (c)) + +#define PF_VBSIZE 256 +#define PF_TEMP_BUF 128 + +#define DEC_POINT _lconv.decimal_point[0] + +#define PF_LEFT 0x0001 /* justification */ +#define PF_SIGN 0x0002 /* force leading PF_SIGN */ +#define PF_SPACE 0x0004 /* force leading PF_SPACE */ +#define PF_HASH 0x0008 /* PF_HASH flag */ +#define PF_NOPOINT 0x0010 /* supress radix point */ +#define PF_UPPER 0x0020 /* PF_UPPER case type */ +#define PF_IS_SIGNED 0x0040 /* signed data-type */ +#define PF_ZFLAG 0x0080 /* format with 0 */ +#define PF_HEX 0x0100 /* PF_HEX integer */ +#define PF_OCT 0x0200 /* octal integer */ +#define PF_GTYPE 0x0400 /* g real type */ +#define PF_EXP 0x0800 /* e real type */ +#define PF_PSET 0x1000 /* precison set */ +#define PF_LDMOD 0x2000 /* long real */ +#define PF_CPP 0x4000 /* C++ formatting rules */ + +#define SF_WILD 0x0004 /* any int type */ +#define SF_SUPRESS 0x0008 /* star flag */ +#define SF_UPPER 0x0010 /* upper case type */ +#define SF_NSIGNED 0x0020 /* unsigned data-type */ +#define SF_HEX 0x0040 /* hex integer */ +#define SF_OCT 0x0080 /* octal integer */ +#define SF_LDMOD 0x0100 /* LONGDOUBLE */ + +#endif + + + + + + diff --git a/code/SIBOSDK/include/comman.g b/code/SIBOSDK/include/comman.g new file mode 100644 index 0000000..d6c3a43 --- /dev/null +++ b/code/SIBOSDK/include/comman.g @@ -0,0 +1,24 @@ +/* Generated by Ctran from comman.cl */ +#define COMMAN_G +#ifndef OLIB_G +#include +#endif +/* Class Numbers */ +#define C_COMMAN 17 +/* Method Numbers */ +#define O_COM_MODE_CHANGE 5 +#define O_COM_INIT 1 +#define O_COM_STATWIN 2 +#define O_COM_MENU 4 +#define O_COM_EXIT 7 +#define O_COM_FILE_CHANGE 6 +#define O_COM_ACCL_CHECK 3 +/* Constants for comman */ +#define O_COM_SYS_LAST O_COM_EXIT +#define BREAK_LINE_FOLLOWS 0x80 +#define PURE_COM_ID 0x7f +/* Property of comman */ +typedef struct pr_comman +{ +PRS_ROOT root; +} PR_COMMAN; diff --git a/code/SIBOSDK/include/comman.ing b/code/SIBOSDK/include/comman.ing new file mode 100644 index 0000000..61106a1 --- /dev/null +++ b/code/SIBOSDK/include/comman.ing @@ -0,0 +1,23 @@ +; Generated by Ctran from comman.cl +COMMAN_ING equ 1 +IFNDEF OLIB_ING + INCLUDE ..\inc\OLIB.ING +ENDIF +; Class Numbers +C_COMMAN equ 17 +; Method Numbers +O_COM_MODE_CHANGE equ 5 +O_COM_INIT equ 1 +O_COM_STATWIN equ 2 +O_COM_MENU equ 4 +O_COM_EXIT equ 7 +O_COM_FILE_CHANGE equ 6 +O_COM_ACCL_CHECK equ 3 +; Constants for comman +O_COM_SYS_LAST equ (O_COM_EXIT) +BREAK_LINE_FOLLOWS equ (080h) +PURE_COM_ID equ (07fh) +; Property of comman +PR_COMMAN struc +CommanRoot PRS_ROOT <> +PR_COMMAN ends diff --git a/code/SIBOSDK/include/complex.hpp b/code/SIBOSDK/include/complex.hpp new file mode 100644 index 0000000..04c9884 --- /dev/null +++ b/code/SIBOSDK/include/complex.hpp @@ -0,0 +1,228 @@ +/* Release 3.10 */ +/*-------------------------------------------------------------------------* +* * +* COMPLEX.HPP - header file for complex math. * +* * +* COPYRIGHT (C) 1990..1992 Clarion Software Corporation * +* All Rights Reserved * +* * +*--------------------------------------------------------------------------*/ +#include + +#ifndef __COMPLEX_INC_ +#define __COMPLEX_INC_ + +#include +#include + +class complex { + +friend double real(const complex&); +friend double imag(const complex&); +friend complex conj(const complex&); +friend double norm(const complex&); +friend double arg(const complex&); +friend complex polar(double _mag, double _angle = 0.0); + +friend double abs(const complex&); +friend complex acos(const complex&); +friend complex asin(const complex&); +friend complex atan(const complex&); +friend complex cos(const complex&); +friend complex cosh(const complex&); +friend complex exp(const complex&); +friend complex log(const complex&); +friend complex log10(const complex&); +friend complex pow(const complex& _base, double _exp); +friend complex pow(double _base, const complex& _exp); +friend complex pow(const complex& _base, const complex& _exp); +friend complex sin(const complex&); +friend complex sinh(const complex&); +friend complex sqrt(const complex&); +friend complex tan(const complex&); +friend complex tanh(const complex&); + +friend complex operator+(const complex&, const complex&); +friend complex operator+(double, const complex&); +friend complex operator+(const complex&, double); +friend complex operator-(const complex&, const complex&); +friend complex operator-(double, const complex&); +friend complex operator-(const complex&, double); +friend complex operator*(const complex&, const complex&); +friend complex operator*(double, const complex&); +friend complex operator*(const complex&, double); +friend complex operator/(const complex&, const complex&); +friend complex operator/(double, const complex&); +friend complex operator/(const complex&, double); +friend int operator==(const complex&, const complex&); +friend int operator!=(const complex&, const complex&); + + + +public: + + complex(double _re_val, double _im_val=0); + complex(); + + const complex& operator+=(const complex&) ; + const complex& operator+=(double) ; + const complex& operator-=(const complex&) ; + const complex& operator-=(double) ; + const complex& operator*=(const complex&) ; + const complex& operator*=(double) ; + const complex& operator/=(const complex&) ; + const complex& operator/=(double) ; + complex operator+() const; + complex operator-() const; + +private: + + double re; + double im; + +}; + +inline complex::complex(double _re_val, double _im_val) { + + re = _re_val; + im = _im_val; +} + +inline complex::complex() { + + re = 0.0; + im = 0.0; +} + +inline complex complex::operator+() const { + + return *this; +} + +inline complex complex::operator-() const { + + return complex(-re, -im); +} + +inline const complex& complex::operator+=(const complex& _z) { + + re += _z.re; + im += _z.im; + return *this; +} + +inline const complex& complex::operator+=(double _r) { + + re += _r; + return *this; +} + +inline const complex& complex::operator-=(const complex& _z) { + + re -= _z.re; + im -= _z.im; + return *this; +} + +inline const complex& complex::operator-=(double _r) { + + re -= _r; + return *this; +} + +inline const complex& complex::operator*=(double _r) { + + re *= _r; + im *= _r; + return *this; +} + +inline const complex& complex::operator/=(double _r) { + + re /= _r; + im /= _r; + return *this; +} + + +inline double real(const complex& _z) { + + return _z.re; +} + +inline double imag(const complex& _z) { + + return _z.im; +} + +inline complex conj(const complex& _z) { + + return complex(_z.re, -_z.im); +} + +inline complex polar(double _mag, double _ang) { + + return complex(_mag*cos(_ang), _mag*sin(_ang)); +} + + +inline complex operator+(const complex& _z1, const complex& _z2) { + + return complex(_z1.re + _z2.re, _z1.im + _z2.im); +} + +inline complex operator+(double _r, const complex& _z) { + + return complex(_r + _z.re, _z.im); +} + +inline complex operator+(const complex& _z, double _r) { + + return complex(_r + _z.re, _z.im); +} + +inline complex operator-(const complex& _z1, const complex& _z2) { + + return complex(_z1.re - _z2.re, _z1.im - _z2.im); +} + +inline complex operator-(double _r, const complex& _z) { + + return complex(_r - _z.re, -_z.im); +} + +inline complex operator-(const complex& _z, double _r) { + + return complex(_r - _z.re, _z.im); +} + +inline complex operator*(double _r, const complex& _z) { + + return complex(_r * _z.re, _r * _z.im); +} + +inline complex operator*(const complex& _z, double _r) { + + return complex(_r * _z.re, _r * _z.im); +} + +inline complex operator/(const complex& _z, double _r) { + + return complex(_z.re/_r, _z.im/_r); +} + +inline int operator==(const complex& _z1, const complex& _z2) { + + return (_z1.re == _z2.re) && (_z1.im == _z2.im); +} + +inline int operator!=(const complex& _z1, const complex& _z2) { + + return (_z1.re != _z2.re) || (_z1.im != _z2.im); +} + +ostream& operator<<(ostream&, const complex&); +istream& operator>>(istream&, complex&); + +#endif + diff --git a/code/SIBOSDK/include/conio.h b/code/SIBOSDK/include/conio.h new file mode 100644 index 0000000..c55349b --- /dev/null +++ b/code/SIBOSDK/include/conio.h @@ -0,0 +1,102 @@ +/* Release 3.00 */ + +/*-------------------------------------------------------------------------* +* * +* conio.h - header file for console input and output. * +* * +* COPYRIGHT (C) 1989, 1990 Jensen and Partners. All Rights Reserved * +* * +*--------------------------------------------------------------------------*/ +#include + +#ifndef _CONIO_INC_ +#define _CONIO_INC_ + +#ifdef __cplusplus +extern "C" { +#endif +extern char * cgets(char *_str); +extern void cputs(const char *_str); +extern int cprintf(const char *_format, ...); +extern int cscanf(const char *_format, ...); +extern int getch(void); +extern int getche(void); +extern int kbhit(void); +extern int putch(int _ch); +extern int ungetch(unsigned _ch); + +#ifndef _PORTIO_DEF +#define _PORTIO_DEF +#if (defined _IL_MTF) | ( defined __STDC__) + +extern unsigned char inportb(int _portid); +extern void outportb(int _portid, unsigned char _value); +extern unsigned int inportw(int _portid); +extern void outportw(int _portid, unsigned int _value); +extern void _disable(void); +extern void _enable(void); + +#define inp(portid) inportb(portid) +#define outp(portid, v) outportb(portid, v) +#define inpw(portid) inportw(portid) +#define outpw(portid, v) outportw(portid, v) + +#else + +#define RET 0xC3 + +#pragma save,call(reg_param=>(dx,ax),reg_saved=>(bx,cx,si,di,es,ds,st1,st2), inline=>on) +static void __outportb__(int _port, unsigned char _byte) = +{ + 0xEE, RET /* out dx,al */ +}; + +static unsigned char __inportb__(int _port) = +{ + 0xEC, RET /* in dx,al */ +}; + +static void __outportw__(int _port, unsigned _word) = +{ + 0xEF, RET /* out dx,ax */ +}; + +static unsigned int __inportw__(int _port) = +{ + 0xED, RET /* in dx,ax */ +}; + +static void _enable(void)= +{ + 0xFB, RET +}; + +static void _disable(void)= +{ + 0xFA, RET +}; + +#pragma restore + +#define inportb(portid) __inportb__(portid) /* Byte IN instruction */ +#define outportb(portid, v) __outportb__(portid,v) /* Byte OUT instruction */ +#define inportw(portid) __inportw__(portid) /* Word IN instruction */ +#define outportw(portid, v) __outportw__(portid,v) /* Word OUT instruction */ + +/* some compilers use inp, outp for inportb, outportb */ + +#define inp(portid) __inportb__(portid) +#define outp(portid, v) __outportb__(portid, v) +#define inpw(portid) __inportw__(portid) +#define outpw(portid, v) __outportw__(portid, v) + +#endif +#define enable() _enable() +#define disable() _disable() +#endif + +#ifdef __cplusplus +} +#endif +#endif + diff --git a/code/SIBOSDK/include/coniostr.hpp b/code/SIBOSDK/include/coniostr.hpp new file mode 100644 index 0000000..a9c069b --- /dev/null +++ b/code/SIBOSDK/include/coniostr.hpp @@ -0,0 +1,36 @@ +/* Release 3.10 */ +/*-------------------------------------------------------------------------* +* * +* CONIOSTR.HPP - header file for console stream input and output. * +* * +* COPYRIGHT (C) 1990..1992 Clarion Software Corporation * +* All Rights Reserved * +* * +*--------------------------------------------------------------------------*/ +#include + +#ifndef _CONIOSTR_INC_ +#define _CONIOSTR_INC_ + +#include + + +class conbuf : public streambuf { + +public: + + virtual int underflow(); + virtual int pbackfail(int); + virtual int overflow(int _c = EOF); + virtual int sync(); + +private: + + unsigned flush_magic; + +}; + +extern istream conin; +extern ostream conout; + +#endif diff --git a/code/SIBOSDK/include/corelib.inc b/code/SIBOSDK/include/corelib.inc new file mode 100644 index 0000000..04b0f09 --- /dev/null +++ b/code/SIBOSDK/include/corelib.inc @@ -0,0 +1,271 @@ +frame = 4 (* standard stack frame, near call *) +bxframe = 2 (* bx stack frame, near call *) + +PopParam = 0 (* Dummy value for changing real return convention *) +DOSHUGESHIFT = 12 + +(***************************** Data Type Sizes *****************************) + +CodePtrSize = 2 (* Code pointer, near calls *) +DataPtrSize = 2 (* Data pointer, 16 bit data pointer models *) + +_ptr = 0 (* _iob structure *) +_cnt = 2 +_size = 4 +_base = 6 +_flag = 8 +_file = 10 +_pback = 12 +_iobSize = 14 (* size of _iob structure *) + +(***************************** OS Error Codes ******************************) + +EFAULT = -1 +ENOENT = -33 +ENOPATH = -42 +EMFILE = -18 +EACCESS = -39 +EBADF = -15 +E2BIG = -6 +ENOMEM = -10 +ENOSPC = -37 +EINVAL = -2 +EDOM = -2 +ERANGE = -7 + +(***************************** IO Constants*********************************) + +BUFSIZ = 512 (* IO Buffer size *) + +_IOFBF = 0 (* setvbuf - full buffering *) +_IOLBF = 1 (* setvbuf - line buffering *) +_IONBF = 2 (* setvbuf - no buffering *) + +_F_RDWR = 0003H (* Read/write *) +_F_READ = 0001H (* Read only file *) +_F_WRIT = 0002H (* Write only file *) +_F_UBUF = 0004H (* User allocated buffer *) +_F_APP = 0008H (* Append data *) +_F_ERR = 0010H (* Error *) +_F_EOF = 0020H (* EOF *) +_F_BIN = 0040H (* Binary file *) +_F_IN = 0080H (* Data is incoming *) +_F_OUT = 0100H (* Data is outgoing *) +_F_DEV = 0200H (* File is terminal *) +_F_RST = 0400H (* Newly opened stream *) +_F_LBUF = 0800H (* line buffered stream *) +_F_CTZ = 1000H + +SEEK_SET = 0 (* lseek - origin beginning of file *) +SEEK_CUR = 1 (* lseek - origin current position *) +SEEK_END = 2 (* lseek - origin end of file *) + +CTLZ = 1AH (* Text mode EOF character *) +EOF = -1 (* end of file return value *) + +O_RDONLY = 0 +O_WRONLY = 1 +O_RDWR = 2 + +O_CREAT = 0100H (* create and open file *) +O_TRUNC = 0200H (* open with truncation *) +O_EXCL = 0400H (* exclusive open *) + +_O_EOF = 0200H (* set when text file hits ^Z *) + +O_APPEND = 0800H (* write to end of file *) + +O_CHANGED = 1000H (* File has been written *) +O_DEVICE = 2000H (* user read only flag *) +O_TEXT = 4000H (* CR-LF translation *) +O_BINARY = 8000H (* no translation *) + +SH_NOINHERIT = 80H (* File sharing modes *) +SH_COMPAT = 00H +SH_DENYRW = 10H +SH_DENYWR = 20H +SH_DENYRD = 30H +SH_DENYNO = 40H + +SH_DENYNONE = SH_DENYNO (* MS documentation uses both *) + +S_IFDIR = 4000H (* directory *) +S_IFCHR = 2000H (* character device *) +S_IFREG = 8000H (* regular file *) +S_IREAD = 0100H (* owner may read *) +S_IWRITE = 0080H (* owner may write *) +S_IEXEC = 0040H (* owner may execute directory search *) + +FA_NORMAL = 00H (* normal file *) +FA_RDONLY = 01H (* Read only attribute *) +FA_HIDDEN = 02H (* Hidden file *) +FA_SYSTEM = 04H (* System file *) +FA_LABEL = 08H (* Volume label *) +FA_DIREC = 10H (* Directory *) +FA_ARCH = 20H (* Archive *) +FA_TEXT = 100H (* Open in text mode *) +FA_SHARE = 200H (* Open with sharing *) + +E_CONS = 8000H (* The console channel *) +E_DEVICE = 4000H (* Its a character device *) + +(************************ OS2 structures and constants ********************) + +fdateCreation = 0 +ftimeCreation = 2 +fdateLastAccess = 4 +ftimeLastAccess = 6 +fdateLastWrite = 8 +ftimeLastWrite = 10 +cbFile = 12 +cbFileAlloc = 16 +attrFile = 20 + +FileInfoSize = 22 + +IO_WAIT = 0 +IO_NOWAIT = 1 + +hours = 0 +minutes = 1 +seconds = 2 +hundredths = 3 +day = 4 +month = 5 +year = 6 +timezone = 8 +weekday = 10 + +DateTimeSize = 11 + +EXIT_THREAD = 0 +EXIT_PROCESS = 1 +EXLST_EXIT = 3 +EXLST_ADD = 1 + +(* Signal Numbers for DosSetSigHandler *) + +SIG_CTRLC = 1 (* Control C *) +SIG_BROKENPIPE = 2 (* Broken Pipe *) +SIG_KILLPROCESS = 3 (* Program Termination *) +SIG_CTRLBREAK = 4 (* Control Break *) +SIG_PFLG_A = 5 (* Process Flag A *) +SIG_PFLG_B = 6 (* Process Flag B *) +SIG_PFLG_C = 7 (* Process Flag C *) +SIG_CSIGNALS = 8 (* number of signals plus one *) + + +(* Flag Numbers for DosFlagProcess *) + +PFLG_A = 0 (* Process Flag A *) +PFLG_B = 1 (* Process Flag B *) +PFLG_C = 2 (* Process Flag C *) + +(* Signal actions *) + +SIGA_KILL = 0 +SIGA_IGNORE = 1 +SIGA_ACCEPT = 2 +SIGA_ERROR = 3 +SIGA_ACKNOWLEDGE = 4 + + +SIG_DFL = 0 +SIG_IGN = 1 +SIG_SGE = 3 +SIG_ACK = 4 + + +(************************ Library Internal Constants ***********************) +(* *) +(* These constants are internal to the run-time library and may NOT *) +(* changed. *) +(* *) +(***************************************************************************) + +TRUE = 1 +FALSE = 0 + +math_saved_regs = 8 + +ExpNeg = 80H +magic = 01234H (* value to flag exception handler *) +MAGIC = 01234H (* value to flag exception handler *) + +f_st5 = 10H (* arg1 is in st5 *) +f_two = 20H (* two arguments *) + +_DOMAIN = 1 (* parameter not in valid domain *) +_SING = 2 (* function is incalculable at this place *) +_OVERFLOW = 3 (* result exceeds representable range *) +_UNDERFLOW = 4 (* result too close to zero to be represented *) +_TLOSS = 5 (* total loss of precision (eg. Sine (2**65)) *) +_PLOSS = 6 (* partial precision loss *) + +ZFLAG = 80H (* Zero pad flag from printf *) + +stream = 0 +flush = 2 +count = 4 +args = 6 +handler = 8 + +InMathLib = 0 + +(* Priority = 0 *) +(* ProcVar = 2 *) +(* InitSize = 4 *) + +Priority = 2 +ProcVar = 3 +InitSize = 5 + +PR0 = 30 +PR1 = 29 +PR2 = 28 +PR3 = 27 +PR4 = 26 +PR5 = 25 +PRL = 20 + +PRMAX = 32 + +emu_fraction = 0 +emu_exponent = 8 +emu_sign = 10 +emu_spare = 11 +emu_temp_size = 12 + +by0 = 0 +by1 = 1 + +w0 = 0 +w1 = 2 +w2 = 4 +w3 = 6 + +dd0 = 0 +dd1 = 4 + +STACK_GUARD = 1234H + +GETSTATE_START = 0 +GETSTATE_END = 2 +GETSTATE_FIRST = 4 + +_j_flag = 0 +_j_ip = 2 +_j_sp = 4 +_j_bp = 6 +_j_si = 8 +_j_di = 10 +_j_dx = 12 +_j_cx = 14 +_j_bx = 16 +_j_classHandle = 18 +_j_classPtr = 20 +_j_enterFrame = 22 +_j_osFrame = 24 +_j_st1 = 26 +_j_st2 = 36 + diff --git a/code/SIBOSDK/include/ctype.h b/code/SIBOSDK/include/ctype.h new file mode 100644 index 0000000..25e7ffb --- /dev/null +++ b/code/SIBOSDK/include/ctype.h @@ -0,0 +1,81 @@ +/* Release 3.00 */ + +/*-------------------------------------------------------------------------* +* * +* ctype.h - header file for ctype macro definitions. * +* * +* COPYRIGHT (C) 1989, 1990 Jensen and Partners. All Rights Reserved. * +* * +*--------------------------------------------------------------------------*/ +#include + +#ifndef _CTYPE_INC_ +#define _CTYPE_INC_ + +#define _IS_SP 1 /* is space */ +#define _IS_DIG 2 /* is digit indicator */ +#define _IS_UPP 4 /* is upper case */ +#define _IS_LOW 8 /* is lower case */ +#define _IS_HEX 16 /* [A-F or [a-f] */ +#define _IS_CTL 32 /* Control */ +#define _IS_PUN 64 /* punctuation */ + +extern char _ctype[257]; /* Character type array */ + +#ifdef __cplusplus +extern "C" { +#endif +extern int isalnum(int _c); +extern int isalpha(int _c); +extern int isascii(int _c); +extern int iscntrl(int _c); +extern int isdigit(int _c); +extern int isgraph(int _c); +extern int islower(int _c); +extern int isprint(int _c); +extern int ispunct(int _c); +extern int isspace(int _c); +extern int isupper(int _c); +extern int isxdigit(int _c); + +extern int _toupper(int _c); +extern int _tolower(int _c); +extern int toascii(int _c); +extern int tolower(int _ch); /* function prototypes */ +extern int toupper(int _ch); +#ifdef __cplusplus +} +#endif + +#ifndef __STDC__ + +#ifdef _CT_FTM +#define toupper(c) ((islower(c)) ? _toupper(c) : (c) ) +#define tolower(c) ((isupper(c)) ? _tolower(c) : (c) ) +#endif + +#ifndef _CT_MTF /* defines conversion macros */ + +#define isalnum(c) (_ctype[(c)+1] & (_IS_DIG | _IS_UPP | _IS_LOW)) +#define isalpha(c) (_ctype[(c)+1] & (_IS_UPP | _IS_LOW)) +#define isascii(c) ((unsigned)((c)) < 0x80) +#define iscntrl(c) (_ctype[(c)+1] & _IS_CTL) +#define isdigit(c) (_ctype[(c)+1] & _IS_DIG) +#define isgraph(c) ((c) >= 0x21 && (c) <= 0x7e) +#define islower(c) (_ctype[(c)+1] & _IS_LOW) +#define isprint(c) ((c) >= 0x20 && (c) <= 0x7e) +#define ispunct(c) (_ctype[(c)+1] & _IS_PUN) +#define isspace(c) (_ctype[(c)+1] & _IS_SP) +#define isupper(c) (_ctype[(c)+1] & _IS_UPP) +#define isxdigit(c) (_ctype[(c)+1] & (_IS_DIG | _IS_HEX)) + +#define iscsymf(c) (isalpha(c) || ((c) == '_')) +#define iscsym(c) (isalnum(c) || ((c) == '_')) + +#define _toupper(c) ((c) + 'A' - 'a') +#define _tolower(c) ((c) + 'a' - 'A') +#define toascii(c) ((c) & 0x7f) + +#endif +#endif +#endif diff --git a/code/SIBOSDK/include/dialdlgs.g b/code/SIBOSDK/include/dialdlgs.g new file mode 100644 index 0000000..667160b --- /dev/null +++ b/code/SIBOSDK/include/dialdlgs.g @@ -0,0 +1,96 @@ +/* Generated by Ctran from dialdlgs.cl */ +#define DIALDLGS_G +#ifndef DLGBOX_G +#include +#endif +#ifndef WR_IO_H +#include +#endif +/* Class Numbers */ +#define C_DIALDLG 59 +#define C_FREEDIAL 60 +#define C_FDIALDLG 61 +#define C_CNTRYDLG 62 +#define C_SDIALDLG 63 +/* Method Numbers */ +/* Property of dialdlg */ +typedef struct { +void *dialao; +} PRS_DIALDLG; +typedef struct pr_dialdlg +{ +PRS_ROOT root; +PRS_WIN win; +PRS_DLGCHAIN dlgchain; +PRS_DLGBOX dlgbox; +PRS_DIALDLG dialdlg; +} PR_DIALDLG; +/* Property of freedial */ +typedef struct { +short int current; +char str[WR_MAX_DIAL_STRING+2]; +} PRS_FREEDIAL; +typedef struct pr_freedial +{ +PRS_ROOT root; +PRS_WIN win; +PRS_LODGER lodger; +PRS_FREEDIAL freedial; +} PR_FREEDIAL; +/* Property of fdialdlg */ +typedef struct pr_fdialdlg +{ +PRS_ROOT root; +PRS_WIN win; +PRS_DLGCHAIN dlgchain; +PRS_DLGBOX dlgbox; +PRS_DIALDLG dialdlg; +} PR_FDIALDLG; +/* Property of cntrydlg */ +typedef struct pr_cntrydlg +{ +PRS_ROOT root; +PRS_WIN win; +PRS_DLGCHAIN dlgchain; +PRS_DLGBOX dlgbox; +} PR_CNTRYDLG; +/* Constants for sdialdlg */ +#define PAN_TONE_LENGTH_TICKS 4 +#define PAN_DELAY_LENGTH_TICKS 4 +#define PAN_PAUSE_LENGTH_TICKS 32 +#define PC_TONE_LENGTH_TICKS 6 +#define PC_DELAY_LENGTH_TICKS 4 +#define PC_PAUSE_LENGTH_TICKS 18 +#define SMART_DIAL_MAX_PROMPT 11 +/* Types for sdialdlg */ +typedef struct +{ +char pmt[SMART_DIAL_MAX_PROMPT+1]; +char str[WR_MAX_IN_STRING+2]; +} SMART_DIAL_ITEM; +typedef struct +{ +short int count; +SMART_DIAL_ITEM it[DLGBOX_MAX_ITEM-3]; +} SMART_DIAL_DATA; +typedef struct +{ +short int count; +SMART_DIAL_ITEM it; +} SMART_DIAL_DATA_S; +typedef struct +{ +unsigned short int toneLengthTicks; +unsigned short int delayLengthTicks; +unsigned short int pauseLengthTicks; +unsigned char dialOutCode[17]; +} DIAL_ENVAR; +/* Property of sdialdlg */ +typedef struct pr_sdialdlg +{ +PRS_ROOT root; +PRS_WIN win; +PRS_DLGCHAIN dlgchain; +PRS_DLGBOX dlgbox; +PRS_DIALDLG dialdlg; +} PR_SDIALDLG; diff --git a/code/SIBOSDK/include/dialdlgs.ing b/code/SIBOSDK/include/dialdlgs.ing new file mode 100644 index 0000000..e59c0c9 --- /dev/null +++ b/code/SIBOSDK/include/dialdlgs.ing @@ -0,0 +1,87 @@ +; Generated by Ctran from dialdlgs.cl +DIALDLGS_ING equ 1 +IFNDEF DLGBOX_ING + INCLUDE ..\inc\DLGBOX.ING +ENDIF +IFNDEF WR_IO_INC + INCLUDE ..\inc\WR_IO.INC +ENDIF +; Class Numbers +C_DIALDLG equ 59 +C_FREEDIAL equ 60 +C_FDIALDLG equ 61 +C_CNTRYDLG equ 62 +C_SDIALDLG equ 63 +; Method Numbers +; Property of dialdlg +PRS_DIALDLG struc +DialdlgDialao dw ? +PRS_DIALDLG ends +PR_DIALDLG struc +DialdlgRoot PRS_ROOT <> +DialdlgWin PRS_WIN <> +DialdlgDlgchain PRS_DLGCHAIN <> +DialdlgDlgbox PRS_DLGBOX <> +DialdlgDialdlg PRS_DIALDLG <> +PR_DIALDLG ends +; Property of freedial +PRS_FREEDIAL struc +FreedialCurrent dw ? +FreedialStr db (1) * WR_MAX_DIAL_STRING+2 dup (?) +PRS_FREEDIAL ends +PR_FREEDIAL struc +FreedialRoot PRS_ROOT <> +FreedialWin PRS_WIN <> +FreedialLodger PRS_LODGER <> +FreedialFreedial PRS_FREEDIAL <> +PR_FREEDIAL ends +; Property of fdialdlg +PR_FDIALDLG struc +FdialdlgRoot PRS_ROOT <> +FdialdlgWin PRS_WIN <> +FdialdlgDlgchain PRS_DLGCHAIN <> +FdialdlgDlgbox PRS_DLGBOX <> +FdialdlgDialdlg PRS_DIALDLG <> +PR_FDIALDLG ends +; Property of cntrydlg +PR_CNTRYDLG struc +CntrydlgRoot PRS_ROOT <> +CntrydlgWin PRS_WIN <> +CntrydlgDlgchain PRS_DLGCHAIN <> +CntrydlgDlgbox PRS_DLGBOX <> +PR_CNTRYDLG ends +; Constants for sdialdlg +PAN_TONE_LENGTH_TICKS equ (4) +PAN_DELAY_LENGTH_TICKS equ (4) +PAN_PAUSE_LENGTH_TICKS equ (32) +PC_TONE_LENGTH_TICKS equ (6) +PC_DELAY_LENGTH_TICKS equ (4) +PC_PAUSE_LENGTH_TICKS equ (18) +SMART_DIAL_MAX_PROMPT equ (11) +; Types for sdialdlg +SMART_DIAL_ITEM struc +SMART_DIAL_ITEMPmt db (1) * SMART_DIAL_MAX_PROMPT+1 dup (?) +SMART_DIAL_ITEMStr db (1) * WR_MAX_IN_STRING+2 dup (?) +SMART_DIAL_ITEM ends +SMART_DIAL_DATA struc +SMART_DIAL_DATACount dw ? +SMART_DIAL_DATAIt db (size SMART_DIAL_ITEM)* DLGBOX_MAX_ITEM-3 dup (?) +SMART_DIAL_DATA ends +SMART_DIAL_DATA_S struc +SMART_DIAL_DATA_SCount dw ? +SMART_DIAL_DATA_SIt SMART_DIAL_ITEM <> +SMART_DIAL_DATA_S ends +DIAL_ENVAR struc +DIAL_ENVARToneLengthTicks dw ? +DIAL_ENVARDelayLengthTicks dw ? +DIAL_ENVARPauseLengthTicks dw ? +DIAL_ENVARDialOutCode db (1) * 17 dup (?) +DIAL_ENVAR ends +; Property of sdialdlg +PR_SDIALDLG struc +SdialdlgRoot PRS_ROOT <> +SdialdlgWin PRS_WIN <> +SdialdlgDlgchain PRS_DLGCHAIN <> +SdialdlgDlgbox PRS_DLGBOX <> +SdialdlgDialdlg PRS_DIALDLG <> +PR_SDIALDLG ends diff --git a/code/SIBOSDK/include/dir.h b/code/SIBOSDK/include/dir.h new file mode 100644 index 0000000..ed4693c --- /dev/null +++ b/code/SIBOSDK/include/dir.h @@ -0,0 +1,73 @@ +/* Release 3.00 */ + +/*-------------------------------------------------------------------------* +* * +* dir.h - structure and function definitions for MSDOS pathnames * +* and directories. * +* * +* COPYRIGHT (C) 1989, 1990 Jensen and Partners. All Rights Reserved. * +* * +*--------------------------------------------------------------------------*/ +#include + +#ifndef _DIR_INC_ +#define _DIR_INC_ + +#ifdef __cplusplus +extern "C" { +#endif +extern int chdir(const char *_path); +extern int getcurdir(int _drive, char *_buf); +extern char * getcwd(char *_buf, int _maxlen); +extern int _getdrive(void); +extern int mkdir(const char *_path); +extern int rmdir(const char *_path); +#ifdef __cplusplus +} +#endif + +#define WILDCARDS 0x01 +#define EXTENSION 0x02 +#define FILENAME 0x04 +#define DIRECTORY 0x08 +#define DRIVE 0x10 + +#define MAXPATH 80 +#define MAXDRIVE 4 +#define MAXDIR 66 +#define MAXFILE 9 +#define MAXEXT 5 + +#ifndef _FFBLK_DEF +#define _FFBLK_DEF + +struct ffblk { + char ff_reserved[21]; + char ff_attrib; + int ff_ftime; + int ff_fdate; + long ff_fsize; + char ff_name[13]; +}; +#endif + +#ifdef __cplusplus +extern "C" { +#endif +extern int findfirst(const char *_path, struct ffblk *_ffblk,int _attrib); +extern int findnext(struct ffblk *_ffblk); +extern void fnmerge(char *_path, const char *_drive,const char *_dir, + const char *_name, const char *_ext); +extern int fnsplit(const char *_path, char *_drive, char *_dir, + char *_name, char *_ext); +extern void _makepath(char *_path, const char *_drive, const char *_dir, + const char *_name, const char *_ext); +extern void _splitpath(const char *_path, char *_drive, char *_dir, + char *_name, char *_ext); +extern int getdisk(void); +extern char * searchpath(const char *_path); +extern int setdisk(int _drive); +#ifdef __cplusplus +} +#endif +#endif diff --git a/code/SIBOSDK/include/direct.h b/code/SIBOSDK/include/direct.h new file mode 100644 index 0000000..00cb4c5 --- /dev/null +++ b/code/SIBOSDK/include/direct.h @@ -0,0 +1,2 @@ +#include + \ No newline at end of file diff --git a/code/SIBOSDK/include/dlgbox.g b/code/SIBOSDK/include/dlgbox.g new file mode 100644 index 0000000..89cc33f --- /dev/null +++ b/code/SIBOSDK/include/dlgbox.g @@ -0,0 +1,165 @@ +/* Generated by Ctran from dlgbox.cl */ +#define DLGBOX_G +#ifndef BWIN_G +#include +#endif +#ifndef TEXTWIN_G +#include +#endif +/* Class Numbers */ +#define C_DLGCHAIN 12 +#define C_DLGBOX 13 +#define C_ERRORDLG 14 +#define C_QUERYDLG 15 +#define C_FLISTDLG 16 +/* Method Numbers */ +#define O_DL_SET_SIZE 27 +#define O_DL_DIMMED_MESSAGE 25 +#define O_DL_INQ_MINSIZE 28 +#define O_DL_ITEM_REPLACE 22 +#define O_DL_ITEM_APPEND 23 +#define O_DL_HANDLE_TO_INDEX 20 +#define O_DL_CLR_ITEM_FLAGS 17 +#define O_DL_TAKE_FOCUS 19 +#define O_DL_ITEM_ADD 26 +#define O_DL_FOCUS 32 +#define O_DL_SET_ITEM_FLAGS 16 +#define O_DL_ITEM_DIM 15 +#define O_DL_ITEM_NEW 34 +#define O_DL_INIT 24 +#define O_DL_KEY 30 +#define O_DL_DYN_INIT 29 +#define O_DL_INDEX_TO_HANDLE 21 +#define O_DL_CHANGED 31 +#define O_DL_LAUNCH_SUB 33 +#define O_DL_ITEM_LOCK 14 +#define O_DL_SET_PROMPT 18 +/* Constants for dlgchain */ +#define PR_WIN_NO_DDP PR_WIN_FORCE_TOP +#define HELPDLG_BASIC_HELP PR_WIN_FORCE_RIGHT +#define HELPDLG_HELP_INDEX PR_WIN_FORCE_LEFT +#define DLGCHAIN_WITH_MENU PR_WIN_FORCE_BOTTOM +/* Property of dlgchain */ +typedef struct { +PR_BWIN *next; +} PRS_DLGCHAIN; +typedef struct pr_dlgchain +{ +PRS_ROOT root; +PRS_WIN win; +PRS_DLGCHAIN dlgchain; +} PR_DLGCHAIN; +/* Constants for dlgbox */ +#define DLGBOX_NOTIFY_ENTER 0x0001 +#define DLGBOX_NOTIFY_ESCAPE 0x0002 +#define DLGBOX_RBUF_FILLED 0x0004 +#define DLGBOX_ACTION_LIST 0x0008 +#define DLGBOX_FROM_HWIF 0x0010 +#define DLGBOX_SMALL_FONT DLGBOX_FROM_HWIF +#define DLGBOX_NO_WAIT 0x0020 +#define DLGBOX_NOTIFY_ALL_ACT 0x0040 +#define DLGBOX_REPORT_ACT_HORIZ 0x0080 +#define DLGBOX_APPEND_UNITS_TITLE 0x0100 +#define DLGBOX_SMALL_ACTION_LIST 0x0200 +#define DLGBOX_NO_SHADOW 0x0400 +#define DLGBOX_NO_DDP 0x0800 +#define DLGBOX_ITEM_NOTIFY_CHANGED 0x0001 +#define DLGBOX_ITEM_DIMMED 0x0002 +#define DLGBOX_ITEM_UNDERLINED 0x0004 +#define DLGBOX_ITEM_APPL_CAT 0x0008 +#define DLGBOX_ITEM_CENTRE 0x0010 +#define DLGBOX_ITEM_DEAD 0x0020 +#define DLGBOX_ITEM_NOTIFY_FOCUS 0x0080 +#define DLGBOX_ITEM_NEEDS_PACK 0x0100 +#define DLGBOX_ITEM_LOCKED 0x0200 +#define DLGBOX_ITEM_CAN_DEFER_X 0x0400 +#define DLGBOX_ITEM_X_PENDING 0x0800 +#define DLGBOX_ITEM_ACLIST 0x1000 +#define DLGBOX_LEFT_GAP (BWIN_CUSHION_X+7) +#define DLGBOX_BULLET_GAP 3 +#define DLGBOX_VERT_GAP (BWIN_CUSHION_Y+2) +#define DLGBOX_MAX_ITEM 9 +#define DLGBOX_MAX_ITEM_VINE 11 +#define UNDERLINE_DEPTH 3 +#define EXTRA_GUTTER_WIDTH 4 +#define DLGBOX_ROMAN8_FONT 5 +/* Types for dlgbox */ +typedef struct +{ +unsigned short int flags; +char title[1]; +} HD_DLGBOX_RSC; +typedef struct +{ +short int flags; +unsigned char class; +char prompt[1]; +} AD_DLGBOX; +typedef struct +{ +PR_LODGER *hand; +PR_TEXTWIN *prompt; +short int flags; +} DLGBOX_ITEM; +typedef union +{ +DLGBOX_ITEM item[7]; +DLGBOX_ITEM *pitm; +} DLGBOX_ITEM_UNION; +/* Property of dlgbox */ +typedef struct { +DLGBOX_ITEM_UNION u; +void *rbuf; +short int dimrid; +short int helprid; +unsigned short int flags; +unsigned char focus; +unsigned char count; +unsigned char current; +unsigned char font; +unsigned char absorb; +unsigned char changed; +} PRS_DLGBOX; +typedef struct pr_dlgbox +{ +PRS_ROOT root; +PRS_WIN win; +PRS_DLGCHAIN dlgchain; +PRS_DLGBOX dlgbox; +} PR_DLGBOX; +/* Types for errordlg */ +typedef struct +{ +short int error; +char message[80]; +} RBUF_ERROR; +/* Property of errordlg */ +typedef struct pr_errordlg +{ +PRS_ROOT root; +PRS_WIN win; +PRS_DLGCHAIN dlgchain; +PRS_DLGBOX dlgbox; +} PR_ERRORDLG; +/* Types for querydlg */ +typedef struct +{ +short int result; +char message[100]; +} RBUF_QUERY; +/* Property of querydlg */ +typedef struct pr_querydlg +{ +PRS_ROOT root; +PRS_WIN win; +PRS_DLGCHAIN dlgchain; +PRS_DLGBOX dlgbox; +} PR_QUERYDLG; +/* Property of flistdlg */ +typedef struct pr_flistdlg +{ +PRS_ROOT root; +PRS_WIN win; +PRS_DLGCHAIN dlgchain; +PRS_DLGBOX dlgbox; +} PR_FLISTDLG; diff --git a/code/SIBOSDK/include/dlgbox.ing b/code/SIBOSDK/include/dlgbox.ing new file mode 100644 index 0000000..58ea0d4 --- /dev/null +++ b/code/SIBOSDK/include/dlgbox.ing @@ -0,0 +1,153 @@ +; Generated by Ctran from dlgbox.cl +DLGBOX_ING equ 1 +IFNDEF BWIN_ING + INCLUDE ..\inc\BWIN.ING +ENDIF +IFNDEF TEXTWIN_ING + INCLUDE ..\inc\TEXTWIN.ING +ENDIF +; Class Numbers +C_DLGBOX equ 12 +C_ERRORDLG equ 13 +C_QUERYDLG equ 14 +C_FLISTDLG equ 15 +; Method Numbers +O_DL_SET_SIZE equ 27 +O_DL_DIMMED_MESSAGE equ 25 +O_DL_INQ_MINSIZE equ 28 +O_DL_ITEM_REPLACE equ 22 +O_DL_ITEM_APPEND equ 23 +O_DL_HANDLE_TO_INDEX equ 20 +O_DL_CLR_ITEM_FLAGS equ 17 +O_DL_TAKE_FOCUS equ 19 +O_DL_ITEM_ADD equ 26 +O_DL_FOCUS equ 32 +O_DL_SET_ITEM_FLAGS equ 16 +O_DL_ITEM_DIM equ 15 +O_DL_ITEM_NEW equ 34 +O_DL_INIT equ 24 +O_DL_KEY equ 30 +O_DL_DYN_INIT equ 29 +O_DL_INDEX_TO_HANDLE equ 21 +O_DL_CHANGED equ 31 +O_DL_LAUNCH_SUB equ 33 +O_DL_ITEM_LOCK equ 14 +O_DL_SET_PROMPT equ 18 +; Constants for dlgchain +PR_WIN_NO_DDP equ (PR_WIN_FORCE_TOP) +HELPDLG_BASIC_HELP equ (PR_WIN_FORCE_RIGHT) +HELPDLG_HELP_INDEX equ (PR_WIN_FORCE_LEFT) +DLGCHAIN_WITH_MENU equ (PR_WIN_FORCE_BOTTOM) +; Property of dlgchain +PRS_DLGCHAIN struc +DlgchainNext dw ? +PRS_DLGCHAIN ends +PR_DLGCHAIN struc +DlgchainRoot PRS_ROOT <> +DlgchainWin PRS_WIN <> +DlgchainDlgchain PRS_DLGCHAIN <> +PR_DLGCHAIN ends +; Constants for dlgbox +DLGBOX_NOTIFY_ENTER equ (00001h) +DLGBOX_NOTIFY_ESCAPE equ (00002h) +DLGBOX_RBUF_FILLED equ (00004h) +DLGBOX_ACTION_LIST equ (00008h) +DLGBOX_FROM_HWIF equ (00010h) +DLGBOX_SMALL_FONT equ (DLGBOX_FROM_HWIF) +DLGBOX_NO_WAIT equ (00020h) +DLGBOX_NOTIFY_ALL_ACT equ (00040h) +DLGBOX_REPORT_ACT_HORIZ equ (00080h) +DLGBOX_APPEND_UNITS_TITLE equ (00100h) +DLGBOX_SMALL_ACTION_LIST equ (00200h) +DLGBOX_NO_SHADOW equ (00400h) +DLGBOX_NO_DDP equ (00800h) +DLGBOX_ITEM_NOTIFY_CHANGED equ (00001h) +DLGBOX_ITEM_DIMMED equ (00002h) +DLGBOX_ITEM_UNDERLINED equ (00004h) +DLGBOX_ITEM_APPL_CAT equ (00008h) +DLGBOX_ITEM_CENTRE equ (00010h) +DLGBOX_ITEM_DEAD equ (00020h) +DLGBOX_ITEM_NOTIFY_FOCUS equ (00080h) +DLGBOX_ITEM_NEEDS_PACK equ (00100h) +DLGBOX_ITEM_LOCKED equ (00200h) +DLGBOX_ITEM_CAN_DEFER_X equ (00400h) +DLGBOX_ITEM_X_PENDING equ (00800h) +DLGBOX_ITEM_ACLIST equ (01000h) +DLGBOX_LEFT_GAP equ (BWIN_CUSHION_X+7) +DLGBOX_BULLET_GAP equ (3) +DLGBOX_VERT_GAP equ (BWIN_CUSHION_Y+2) +DLGBOX_MAX_ITEM equ (9) +DLGBOX_MAX_ITEM_VINE equ (11) +UNDERLINE_DEPTH equ (3) +EXTRA_GUTTER_WIDTH equ (4) +DLGBOX_ROMAN8_FONT equ (5) +; Types for dlgbox +HD_DLGBOX_RSC struc +HD_DLGBOX_RSCFlags dw ? +HD_DLGBOX_RSCTitle db (1) * 1 dup (?) +HD_DLGBOX_RSC ends +AD_DLGBOX struc +AD_DLGBOXFlags dw ? +AD_DLGBOXClass db ? +AD_DLGBOXPrompt db (1) * 1 dup (?) +AD_DLGBOX ends +DLGBOX_ITEM struc +DLGBOX_ITEMHand dw ? +DLGBOX_ITEMPrompt dw ? +DLGBOX_ITEMFlags dw ? +DLGBOX_ITEM ends +DLGBOX_ITEM_UNION union +DLGBOX_ITEM_UNIONItem db (size DLGBOX_ITEM)* 7 dup (?) +DLGBOX_ITEM_UNIONPitm dw ? +DLGBOX_ITEM_UNION ends +; Property of dlgbox +PRS_DLGBOX struc +DlgboxU DLGBOX_ITEM_UNION <> +DlgboxRbuf dw ? +DlgboxDimrid dw ? +DlgboxHelprid dw ? +DlgboxFlags dw ? +DlgboxFocus db ? +DlgboxCount db ? +DlgboxCurrent db ? +DlgboxFont db ? +DlgboxAbsorb db ? +DlgboxChanged db ? +PRS_DLGBOX ends +PR_DLGBOX struc +DlgboxRoot PRS_ROOT <> +DlgboxWin PRS_WIN <> +DlgboxDlgchain PRS_DLGCHAIN <> +DlgboxDlgbox PRS_DLGBOX <> +PR_DLGBOX ends +; Types for errordlg +RBUF_ERROR struc +RBUF_ERRORError dw ? +RBUF_ERRORMessage db (1) * 80 dup (?) +RBUF_ERROR ends +; Property of errordlg +PR_ERRORDLG struc +ErrordlgRoot PRS_ROOT <> +ErrordlgWin PRS_WIN <> +ErrordlgDlgchain PRS_DLGCHAIN <> +ErrordlgDlgbox PRS_DLGBOX <> +PR_ERRORDLG ends +; Types for querydlg +RBUF_QUERY struc +RBUF_QUERYResult dw ? +RBUF_QUERYMessage db (1) * 100 dup (?) +RBUF_QUERY ends +; Property of querydlg +PR_QUERYDLG struc +QuerydlgRoot PRS_ROOT <> +QuerydlgWin PRS_WIN <> +QuerydlgDlgchain PRS_DLGCHAIN <> +QuerydlgDlgbox PRS_DLGBOX <> +PR_QUERYDLG ends +; Property of flistdlg +PR_FLISTDLG struc +FlistdlgRoot PRS_ROOT <> +FlistdlgWin PRS_WIN <> +FlistdlgDlgchain PRS_DLGCHAIN <> +FlistdlgDlgbox PRS_DLGBOX <> +PR_FLISTDLG ends diff --git a/code/SIBOSDK/include/donewn.g b/code/SIBOSDK/include/donewn.g new file mode 100644 index 0000000..0723b74 --- /dev/null +++ b/code/SIBOSDK/include/donewn.g @@ -0,0 +1,33 @@ +/* Generated by Ctran from donewn.cl */ +#define DONEWN_G +#ifndef GAUGE_G +#include +#endif +/* Class Numbers */ +#define C_DONEWN 25 +/* Method Numbers */ +/* Constants for donewn */ +#define SE_DONEWN_RANGE 0x01 +#define SE_DONEWN_VALUE 0x02 +#define SE_DONEWN_INCREMENT 0x04 +#define SE_DONEWN_INC_VAL 0x08 +/* Types for donewn */ +typedef struct +{ +unsigned short int flags; +unsigned long int val; +unsigned long int range; +} SE_DONEWN; +/* Property of donewn */ +typedef struct { +unsigned long int val; +unsigned long int range; +} PRS_DONEWN; +typedef struct pr_donewn +{ +PRS_ROOT root; +PRS_WIN win; +PRS_LODGER lodger; +PRS_GAUGE gauge; +PRS_DONEWN donewn; +} PR_DONEWN; diff --git a/code/SIBOSDK/include/donewn.ing b/code/SIBOSDK/include/donewn.ing new file mode 100644 index 0000000..162144f --- /dev/null +++ b/code/SIBOSDK/include/donewn.ing @@ -0,0 +1,31 @@ +; Generated by Ctran from donewn.cl +DONEWN_ING equ 1 +IFNDEF GAUGE_ING + INCLUDE ..\inc\GAUGE.ING +ENDIF +; Class Numbers +C_DONEWN equ 25 +; Method Numbers +; Constants for donewn +SE_DONEWN_RANGE equ (001h) +SE_DONEWN_VALUE equ (002h) +SE_DONEWN_INCREMENT equ (004h) +SE_DONEWN_INC_VAL equ (008h) +; Types for donewn +SE_DONEWN struc +SE_DONEWNFlags dw ? +SE_DONEWNVal dd ? +SE_DONEWNRange dd ? +SE_DONEWN ends +; Property of donewn +PRS_DONEWN struc +DonewnVal dd ? +DonewnRange dd ? +PRS_DONEWN ends +PR_DONEWN struc +DonewnRoot PRS_ROOT <> +DonewnWin PRS_WIN <> +DonewnLodger PRS_LODGER <> +DonewnGauge PRS_GAUGE <> +DonewnDonewn PRS_DONEWN <> +PR_DONEWN ends diff --git a/code/SIBOSDK/include/dos.h b/code/SIBOSDK/include/dos.h new file mode 100644 index 0000000..2d0c1b8 --- /dev/null +++ b/code/SIBOSDK/include/dos.h @@ -0,0 +1,205 @@ +/* Release 3.00 */ + +/*-------------------------------------------------------------------------* +* * +* dos.h - structure, union, macro and function definitions for MSDOS and * +* Intel IAPX86 family. * +* * +* COPYRIGHT (C) 1989 Jensen and Partners. All Rights Reserved * +* * +*--------------------------------------------------------------------------*/ +#include + +#ifndef _DOS_INC_ +#define _DOS_INC_ + +#ifndef __STDC__ +extern unsigned int _osmajor; +extern unsigned int _osminor; +extern int _argc; +extern char *_argv[32]; +#endif + +#define FA_NORMAL 0x00 /* normal file */ +#define FA_RDONLY 0x01 /* Read only attribute */ +#define FA_HIDDEN 0x02 /* Hidden file */ +#define FA_SYSTEM 0x04 /* System file */ +#define FA_LABEL 0x08 /* Volume label */ +#define FA_DIREC 0x10 /* Directory */ +#define FA_ARCH 0x20 /* Archive */ +#define FA_TEXT 0x100 /* Open in text mode */ +#define FA_SHARE 0x200 /* Open with sharing */ + +struct WORDREGS { + unsigned int ax, bx, cx, dx, si, di, cflag, flags; +}; + +struct BYTEREGS { + unsigned char al, ah, bl, bh, cl, ch, dl, dh; +}; + +union REGS { + struct WORDREGS x; + struct BYTEREGS h; +}; + +struct SREGS { + unsigned int es; + unsigned int cs; + unsigned int ss; + unsigned int ds; +}; + +struct REGPACK { + unsigned r_ax, r_bx, r_cx, r_dx; + unsigned r_bp, r_si, r_di, r_ds, r_es, r_flags; +}; + +#ifdef __cplusplus +extern "C" { +#endif +extern int int86(int _intno, const union REGS * _inregs, union REGS * _outregs); +extern int int86x(int _intno, const union REGS * _inregs, union REGS * _outregs, + struct SREGS * _segregs); +extern void intr(int _intno, struct REGPACK * _preg); +extern void segread(struct SREGS * _segs); +#ifdef __cplusplus +} +#endif + +#ifndef _FFBLK_DEF +#define _FFBLK_DEF + +struct ffblk { + char ff_reserved[21]; + char ff_attrib; + int ff_ftime; + int ff_fdate; + long ff_fsize; + char ff_name[13]; +}; +#endif + +#ifdef __cplusplus +extern "C" { +#endif +extern int findfirst(const char * _path, struct ffblk * _buffer, int _attrib); +extern int findnext(struct ffblk * _buffer); +#ifdef __cplusplus +} +#endif + +#ifndef _PORTIO_DEF +#define _PORTIO_DEF + +#if (defined _IL_MTF) | ( defined __STDC__) + +#ifdef __cplusplus +extern "C" { +#endif +extern unsigned char inportb(int _portid); +extern void outportb(int _portid, unsigned char _value); +extern unsigned int inportw(int _portid); +extern void outportw(int _portid, unsigned int _value); +extern void _disable(void); +extern void _enable(void); +#ifdef __cplusplus +} +#endif + +#define inp(portid) inportb(portid) +#define outp(portid, v) outportb(portid, v) +#define inpw(portid) inportw(portid) +#define outpw(portid, v) outportw(portid, v) +#else + +#define RET 0xC3 + +#ifdef __cplusplus +extern "C" { +#endif +#pragma save,call(reg_param=>(dx,ax),reg_saved=>(bx,cx,si,di,es,ds,st1,st2), inline=>on) +static void __outportb__(int _port, unsigned char _byte) = +{ + 0xEE, RET /* out dx,al */ +}; + +static unsigned char __inportb__(int _port) = +{ + 0xEC, RET /* in dx,al */ +}; + +static void __outportw__(int _port,int unsigned _word) = +{ + 0xEF, RET /* out dx,ax */ +}; + +static unsigned int __inportw__(int _port) = +{ + 0xED, RET /* in dx,ax */ +}; + +static void _enable(void)= +{ + 0xFB, RET +}; + +static void _disable(void)= +{ + 0xFA, RET +}; +#ifdef __cplusplus +} +#endif + +#pragma restore + +#define inportb(portid) __inportb__(portid) /* Byte IN instruction */ +#define outportb(portid, v) __outportb__(portid,v)/* Byte OUT instruction */ +#define inportw(portid) __inportw__(portid) /* Word IN instruction */ +#define outportw(portid, v) __outportw__(portid,v)/* Word OUT instruction */ + +/* some compilers use inp, outp for inportb, outportb */ + +#define inp(portid) __inportb__(portid) +#define outp(portid, v) __outportb__(portid, v) +#define inpw(portid) __inportw__(portid) +#define outpw(portid, v) __outportw__(portid, v) +#endif +#define enable() _enable() +#define disable() _disable() +#endif + +#define NFDS 20 /* Maximum number of fds */ + +#ifndef _TMT_DEF +#define _TMT_DEF +struct date { + int da_year; + unsigned char da_day; + unsigned char da_mon; +}; + +struct time { + unsigned char ti_hour; + unsigned char ti_min; + unsigned char ti_sec; + unsigned char ti_hund; +}; +#endif + +#ifdef __cplusplus +extern "C" { +#endif +extern void getdate(struct date * _dptr); +extern void gettime(struct time * _tptr); +extern void setdate(const struct date * _dptr); +extern void settime(const struct time * _tptr); +extern void sleep(unsigned _secs); +extern void *getRealHandle(int handle); +#ifdef __cplusplus +} +#endif +#endif + + diff --git a/code/SIBOSDK/include/dtedit.g b/code/SIBOSDK/include/dtedit.g new file mode 100644 index 0000000..4ead35a --- /dev/null +++ b/code/SIBOSDK/include/dtedit.g @@ -0,0 +1,61 @@ +/* Generated by Ctran from dtedit.cl */ +#define DTEDIT_G +#ifndef LODGER_G +#include +#endif +#ifndef MFNE_G +#include +#endif +/* Class Numbers */ +#define C_DTEDIT 31 +/* Method Numbers */ +/* Constants for dtedit */ +#define SE_DTEDIT_VALUE 0x01 +#define SE_DTEDIT_LOW 0x02 +#define SE_DTEDIT_HIGH 0x04 +#define PR_DTEDIT_DATE 0x0000 +#define PR_DTEDIT_TIME 0x0100 +#define PR_DTEDIT_DURATION 0x0200 +#define PR_DTEDIT_SECONDS 0x1000 +#define PR_DTEDIT_NEGATIVE 0x2000 +#define PR_DTEDIT_AMPM 0x4000 +#define PR_DTEDIT_NEG_DURATION (PR_DTEDIT_DURATION|PR_DTEDIT_NEGATIVE) +#define IN_DTEDIT_INIT (SE_DTEDIT_VALUE|SE_DTEDIT_LOW|SE_DTEDIT_HIGH) +#define IN_DTEDIT_DDMMYYYY (PR_DTEDIT_DATE) +#define IN_DTEDIT_HHMMSS (PR_DTEDIT_TIME|PR_DTEDIT_SECONDS) +#define IN_DTEDIT_HHMM (PR_DTEDIT_TIME) +#define IN_DTEDIT_HHMMSS_D (PR_DTEDIT_TIME|PR_DTEDIT_DURATION|PR_DTEDIT_SECONDS) +#define IN_DTEDIT_HHMM_D (PR_DTEDIT_TIME|PR_DTEDIT_DURATION) +#define IN_DTEDIT_HHMMSS_ND (PR_DTEDIT_TIME|PR_DTEDIT_NEG_DURATION|PR_DTEDIT_SECONDS) +#define IN_DTEDIT_HHMM_ND (PR_DTEDIT_TIME|PR_DTEDIT_NEG_DURATION) +/* Types for dtedit */ +typedef struct +{ +unsigned short int flags; +long int value; +long int low; +long int high; +} IN_DTEDIT; +typedef struct +{ +unsigned short int flags; +long int value; +long int low; +long int high; +} SE_DTEDIT; +/* Property of dtedit */ +typedef struct { +void *cal; +short int dType; +unsigned char changed; +unsigned char inSelfCheck; +IN_DTEDIT in; +} PRS_DTEDIT; +typedef struct pr_dtedit +{ +PRS_ROOT root; +PRS_WIN win; +PRS_LODGER lodger; +PRS_MFNE mfne; +PRS_DTEDIT dtedit; +} PR_DTEDIT; diff --git a/code/SIBOSDK/include/dtedit.ing b/code/SIBOSDK/include/dtedit.ing new file mode 100644 index 0000000..53458bc --- /dev/null +++ b/code/SIBOSDK/include/dtedit.ing @@ -0,0 +1,58 @@ +; Generated by Ctran from dtedit.cl +DTEDIT_ING equ 1 +IFNDEF LODGER_ING + INCLUDE ..\inc\LODGER.ING +ENDIF +IFNDEF MFNE_ING + INCLUDE ..\inc\MFNE.ING +ENDIF +; Class Numbers +C_DTEDIT equ 31 +; Method Numbers +; Constants for dtedit +SE_DTEDIT_VALUE equ (001h) +SE_DTEDIT_LOW equ (002h) +SE_DTEDIT_HIGH equ (004h) +PR_DTEDIT_DATE equ (00000h) +PR_DTEDIT_TIME equ (00100h) +PR_DTEDIT_DURATION equ (00200h) +PR_DTEDIT_SECONDS equ (01000h) +PR_DTEDIT_NEGATIVE equ (02000h) +PR_DTEDIT_AMPM equ (04000h) +PR_DTEDIT_NEG_DURATION equ (PR_DTEDIT_DURATION or PR_DTEDIT_NEGATIVE) +IN_DTEDIT_INIT equ (SE_DTEDIT_VALUE or SE_DTEDIT_LOW or SE_DTEDIT_HIGH) +IN_DTEDIT_DDMMYYYY equ (PR_DTEDIT_DATE) +IN_DTEDIT_HHMMSS equ (PR_DTEDIT_TIME or PR_DTEDIT_SECONDS) +IN_DTEDIT_HHMM equ (PR_DTEDIT_TIME) +IN_DTEDIT_HHMMSS_D equ (PR_DTEDIT_TIME or PR_DTEDIT_DURATION or PR_DTEDIT_SECONDS) +IN_DTEDIT_HHMM_D equ (PR_DTEDIT_TIME or PR_DTEDIT_DURATION) +IN_DTEDIT_HHMMSS_ND equ (PR_DTEDIT_TIME or PR_DTEDIT_NEG_DURATION or PR_DTEDIT_SECONDS) +IN_DTEDIT_HHMM_ND equ (PR_DTEDIT_TIME or PR_DTEDIT_NEG_DURATION) +; Types for dtedit +IN_DTEDIT struc +IN_DTEDITFlags dw ? +IN_DTEDITValue dd ? +IN_DTEDITLow dd ? +IN_DTEDITHigh dd ? +IN_DTEDIT ends +SE_DTEDIT struc +SE_DTEDITFlags dw ? +SE_DTEDITValue dd ? +SE_DTEDITLow dd ? +SE_DTEDITHigh dd ? +SE_DTEDIT ends +; Property of dtedit +PRS_DTEDIT struc +DteditCal dw ? +DteditDType dw ? +DteditChanged db ? +DteditInSelfCheck db ? +DteditIn IN_DTEDIT <> +PRS_DTEDIT ends +PR_DTEDIT struc +DteditRoot PRS_ROOT <> +DteditWin PRS_WIN <> +DteditLodger PRS_LODGER <> +DteditMfne PRS_MFNE <> +DteditDtedit PRS_DTEDIT <> +PR_DTEDIT ends diff --git a/code/SIBOSDK/include/edit.g b/code/SIBOSDK/include/edit.g new file mode 100644 index 0000000..272fd4b --- /dev/null +++ b/code/SIBOSDK/include/edit.g @@ -0,0 +1,102 @@ +/* Generated by Ctran from edit.cat */ +#define EDIT_G +#ifndef VARRAY_G +#include +#endif +/* Class Numbers */ +#define C_EPROOT 51 +#define C_EPFLAT 52 +#define C_EPSEG 53 +#define C_VTAB 54 +/* Method Numbers */ +#define O_EP_CAPACITY 14 +#define O_EP_MOD_CHARS 12 +#define O_EP_COPY_TO_BACK 10 +#define O_EP_SET_TEXT 1 +#define O_EP_SCAN_BLOCK 6 +#define O_EP_EXTRACT 22 +#define O_EP_INIT 16 +#define O_EP_COPY_INDENT 8 +#define O_EP_SCAN_WORD 2 +#define O_EP_SENSE_LEN 17 +#define O_EP_CLEAR 23 +#define O_EP_WORD_COUNT 3 +#define O_VT_STRIP 28 +#define O_EP_DELETE 21 +#define O_VT_SET 27 +#define O_EP_ADD_PARA 7 +#define O_EP_INSERT 20 +#define O_EP_SENSE_CHARS 18 +#define O_EP_SCAN_PARA 4 +#define O_EP_COPY_TO_FRONT 9 +#define O_EP_PASTE 11 +#define O_EF_SENSE_BUF 25 +#define O_EP_PARA_COUNT 5 +#define O_VT_GAPTONEXT 24 +#define O_VT_SET_COLWID 25 +#define O_EP_COMPRESS 15 +#define O_VT_SETINTV 26 +#define O_EP_BACK_CHARS 19 +#define O_EF_GRANULARITY 24 +#define O_EP_SENSE_TEXT 13 +/* Constants for eproot */ +#define EP_SCAN_BACKWARDS 0x01 +#define EP_SCAN_STAY 0x02 +#define EP_SCAN_TO_BEGIN 0x04 +#define EP_SCAN_TO_END 0x08 +#define EP_SCAN_JOIN_DELIM 0x10 +#define EP_SCAN_NOT_TO_END 0x20 +#define EP_RETURN_LENGTH -1 +#define EP_MOD_TOLOWER 0 +#define EP_MOD_TOUPPER 1 +#define EP_MOD_WRAP 2 +/* Property of eproot */ +typedef struct { +unsigned short int maxlen; +} PRS_EPROOT; +typedef struct pr_eproot +{ +PRS_ROOT root; +PRS_EPROOT eproot; +} PR_EPROOT; +/* Property of epflat */ +typedef struct { +unsigned short int alen; +unsigned short int gran; +unsigned short int len; +char *buf; +} PRS_EPFLAT; +typedef struct pr_epflat +{ +PRS_ROOT root; +PRS_EPROOT eproot; +PRS_EPFLAT epflat; +} PR_EPFLAT; +/* Property of epseg */ +typedef struct { +PR_SGBUF *b; +} PRS_EPSEG; +typedef struct pr_epseg +{ +PRS_ROOT root; +PRS_EPROOT eproot; +PRS_EPSEG epseg; +} PR_EPSEG; +/* Types for vtab */ +typedef struct +{ +short int *ploff1; +short int *ploff2; +} TABS_STRIP_OFFS; +/* Property of vtab */ +typedef struct { +unsigned short int c; +} PRS_VTAB; +typedef struct pr_vtab +{ +PRS_ROOT root; +PRS_VAROOT varoot; +PRS_VAFIX vafix; +PRS_VAFLAT vaflat; +PRS_VTAB vtab; +} PR_VTAB; diff --git a/code/SIBOSDK/include/edit.ing b/code/SIBOSDK/include/edit.ing new file mode 100644 index 0000000..55b063f --- /dev/null +++ b/code/SIBOSDK/include/edit.ing @@ -0,0 +1,97 @@ +; Generated by Ctran from edit.cat +EDIT_ING equ 1 +IFNDEF VARRAY_ING + INCLUDE ..\inc\VARRAY.ING +ENDIF +; Class Numbers +C_EPROOT equ 51 +C_EPFLAT equ 52 +C_EPSEG equ 53 +C_VTAB equ 54 +; Method Numbers +O_EP_CAPACITY equ 14 +O_EP_MOD_CHARS equ 12 +O_EP_COPY_TO_BACK equ 10 +O_EP_SET_TEXT equ 1 +O_EP_SCAN_BLOCK equ 6 +O_EP_EXTRACT equ 22 +O_EP_INIT equ 16 +O_EP_COPY_INDENT equ 8 +O_EP_SCAN_WORD equ 2 +O_EP_SENSE_LEN equ 17 +O_EP_CLEAR equ 23 +O_EP_WORD_COUNT equ 3 +O_VT_STRIP equ 28 +O_EP_DELETE equ 21 +O_VT_SET equ 27 +O_EP_ADD_PARA equ 7 +O_EP_INSERT equ 20 +O_EP_SENSE_CHARS equ 18 +O_EP_SCAN_PARA equ 4 +O_EP_COPY_TO_FRONT equ 9 +O_EP_PASTE equ 11 +O_EF_SENSE_BUF equ 25 +O_EP_PARA_COUNT equ 5 +O_VT_GAPTONEXT equ 24 +O_VT_SET_COLWID equ 25 +O_EP_COMPRESS equ 15 +O_VT_SETINTV equ 26 +O_EP_BACK_CHARS equ 19 +O_EF_GRANULARITY equ 24 +O_EP_SENSE_TEXT equ 13 +; Constants for eproot +EP_SCAN_BACKWARDS equ (001h) +EP_SCAN_STAY equ (002h) +EP_SCAN_TO_BEGIN equ (004h) +EP_SCAN_TO_END equ (008h) +EP_SCAN_JOIN_DELIM equ (010h) +EP_SCAN_NOT_TO_END equ (020h) +EP_RETURN_LENGTH equ (-1) +EP_MOD_TOLOWER equ (0) +EP_MOD_TOUPPER equ (1) +EP_MOD_WRAP equ (2) +; Property of eproot +PRS_EPROOT struc +EprootMaxlen dw ? +PRS_EPROOT ends +PR_EPROOT struc +EprootRoot PRS_ROOT <> +EprootEproot PRS_EPROOT <> +PR_EPROOT ends +; Property of epflat +PRS_EPFLAT struc +EpflatAlen dw ? +EpflatGran dw ? +EpflatLen dw ? +EpflatBuf dw ? +PRS_EPFLAT ends +PR_EPFLAT struc +EpflatRoot PRS_ROOT <> +EpflatEproot PRS_EPROOT <> +EpflatEpflat PRS_EPFLAT <> +PR_EPFLAT ends +; Property of epseg +PRS_EPSEG struc +EpsegB dw ? +PRS_EPSEG ends +PR_EPSEG struc +EpsegRoot PRS_ROOT <> +EpsegEproot PRS_EPROOT <> +EpsegEpseg PRS_EPSEG <> +PR_EPSEG ends +; Types for vtab +TABS_STRIP_OFFS struc +TABS_STRIP_OFFSPloff1 dw ? +TABS_STRIP_OFFSPloff2 dw ? +TABS_STRIP_OFFS ends +; Property of vtab +PRS_VTAB struc +VtabC dw ? +PRS_VTAB ends +PR_VTAB struc +VtabRoot PRS_ROOT <> +VtabVaroot PRS_VAROOT <> +VtabVafix PRS_VAFIX <> +VtabVaflat PRS_VAFLAT <> +VtabVtab PRS_VTAB <> +PR_VTAB ends diff --git a/code/SIBOSDK/include/edwin.g b/code/SIBOSDK/include/edwin.g new file mode 100644 index 0000000..f51ca7f --- /dev/null +++ b/code/SIBOSDK/include/edwin.g @@ -0,0 +1,157 @@ +/* Generated by Ctran from edwin.cl */ +#define EDWIN_G +#ifndef LODGER_G +#include +#endif +#ifndef SCRLAY_G +#include +#endif +/* Class Numbers */ +#define C_EDWIN 34 +#define C_PUNCTUED 35 +#define C_EWLINKSV 36 +/* Method Numbers */ +#define O_EW_SET 21 +#define O_EWLS_INIT 1 +#define O_EW_REPLACE_CLIP 30 +#define O_EW_INSERT 23 +#define O_EW_BRING_IN 32 +#define O_EW_REPLACE 28 +#define O_EW_SENSE 22 +#define O_EW_SNUGGLE_INSERT 24 +#define O_EW_RETURN_KEY 34 +#define O_EW_EP_INSERT 33 +#define O_EW_TAB_KEY 35 +#define O_EW_PASTE_CLIP 31 +#define O_EW_FIND 27 +#define O_EW_SET_SIZE 20 +#define O_EW_LEAVE 26 +#define O_EWLS_EXTRACT 2 +#define O_EW_READONLY 37 +#define O_EW_SET_FONT 25 +#define O_EW_SENSE_SIZE 19 +#define O_EW_INIT_STYLE 36 +#define O_EW_EVALUATE 29 +/* Constants for edwin */ +#define PR_EDWIN_DIALLABLE 0x0001 +#define PR_EDWIN_ACCEPT_TABS 0x0002 +#define PR_EDWIN_ACCEPT_SOFT_HYPHENS 0x0004 +#define PR_EDWIN_AUTO_CUR_END 0x0008 +#define PR_EDWIN_AUTO_SELECT 0x0010 +#define PR_EDWIN_DOC_SUPPLIED 0x0020 +#define PR_EDWIN_CLIPBOARD 0x0040 +#define PR_EDWIN_NOTIFY_OVERFLOW 0x0080 +#define PR_EDWIN_READONLY 0x8000 +#define IN_EDWIN_DIALLABLE PR_EDWIN_DIALLABLE +#define IN_EDWIN_ACCEPT_TABS PR_EDWIN_ACCEPT_TABS +#define IN_EDWIN_ACCEPT_SOFT_HYPHENS PR_EDWIN_ACCEPT_SOFT_HYPHENS +#define IN_EDWIN_AUTO_CUR_END (PR_EDWIN_AUTO_CUR_END|PR_EDWIN_AUTO_SELECT) +#define IN_EDWIN_NO_AUTOSELECT PR_EDWIN_AUTO_SELECT +#define IN_EDWIN_DOC_SUPPLIED PR_EDWIN_DOC_SUPPLIED +#define IN_EDWIN_CLIPBOARD PR_EDWIN_CLIPBOARD +#define IN_EDWIN_VULEN 0x0080 +#define IN_EDWIN_VULEN_NOSCALE 0x0100 +#define IN_EDWIN_VULEN_CHARACTERS IN_EDWIN_VULEN +#define IN_EDWIN_VULEN_PIXELS (IN_EDWIN_VULEN|IN_EDWIN_VULEN_NOSCALE) +#define IN_EDWIN_LEFT_CURSOR 0x0200 +#define IN_EDWIN_TEXT_SEGMENTED 0x0400 +#define IN_EDWIN_POSITION_SUPPLIED 0x0800 +#define IN_EDWIN_FONT_SUPPLIED 0x1000 +#define IN_EDWIN_LEADING_SUPPLIED 0x2000 +#define IN_EDWIN_VISLINES_SUPPLIED 0x4000 +#define IN_EDWIN_PAGINATABLE 0x8000 +#define SET_EDWIN_TXT 0x01 +#define SET_EDWIN_EMPTY 0x02 +#define SET_EDWIN_CUR_END 0x04 +#define SET_EDWIN_SEL_ALL 0x08 +#define SET_EDWIN_CURSOR 0x10 +#define SET_EDWIN_ANCHOR 0x20 +#define EWF_BACKWARDS 0x0001 +#define EWF_CASESENS 0x0002 +#define EW_CHANGE_SINCE_SAVED 0x01 +#define EW_CHANGE_SINCE_PAGINATE 0x02 +#define EW_CHANGE 0xffff +#define EW_BRING_SINGLE_SHOT 0xf000 +/* Types for edwin */ +typedef struct +{ +unsigned short int vulen; +unsigned short int flags; +unsigned short int maxlen; +char contents[1]; +} IN_EDWIN; +typedef struct +{ +short int total; +short int top; +} EDWIN_LEADING; +typedef struct +{ +unsigned short int vislines; +P_POINT pos; +short int font; +unsigned short int style; +EDWIN_LEADING leading; +void *doc; +void *clip; +} IN_EDWIN_X; +typedef struct +{ +char *buf; +unsigned short int len; +} SE_EDWIN; +typedef struct +{ +unsigned short int flags; +SE_EDWIN txt; +unsigned short int cursor; +unsigned short int anchor; +} SET_EDWIN; +typedef struct +{ +unsigned short int cursor; +unsigned short int anchor; +} SENSE_EDWIN; +/* Property of edwin */ +typedef struct { +void *scrimg; +void *scrlay; +void *doc; +unsigned short int cpos; +unsigned short int clen; +void *clip; +unsigned short int select; +unsigned short int change; +unsigned short int flags; +SCRLAY_MARGINS margins; +SCRLAY_FONT font; +} PRS_EDWIN; +typedef struct pr_edwin +{ +PRS_ROOT root; +PRS_WIN win; +PRS_LODGER lodger; +PRS_EDWIN edwin; +} PR_EDWIN; +/* Property of punctued */ +typedef struct pr_punctued +{ +PRS_ROOT root; +PRS_WIN win; +PRS_LODGER lodger; +PRS_EDWIN edwin; +} PR_PUNCTUED; +/* Property of ewlinksv */ +typedef struct { +void *doc; +short int state; +unsigned short int pos; +unsigned short int parend; +unsigned short int posend; +char buf[256]; +} PRS_EWLINKSV; +typedef struct pr_ewlinksv +{ +PRS_ROOT root; +PRS_EWLINKSV ewlinksv; +} PR_EWLINKSV; diff --git a/code/SIBOSDK/include/edwin.ing b/code/SIBOSDK/include/edwin.ing new file mode 100644 index 0000000..3aec3b0 --- /dev/null +++ b/code/SIBOSDK/include/edwin.ing @@ -0,0 +1,148 @@ +; Generated by Ctran from edwin.cl +EDWIN_ING equ 1 +IFNDEF LODGER_ING + INCLUDE ..\inc\LODGER.ING +ENDIF +IFNDEF SCRLAY_ING + INCLUDE ..\inc\SCRLAY.ING +ENDIF +; Class Numbers +C_EDWIN equ 34 +C_PUNCTUED equ 35 +C_EWLINKSV equ 36 +; Method Numbers +O_EW_SET equ 21 +O_EWLS_INIT equ 1 +O_EW_REPLACE_CLIP equ 30 +O_EW_INSERT equ 23 +O_EW_BRING_IN equ 32 +O_EW_REPLACE equ 28 +O_EW_SENSE equ 22 +O_EW_SNUGGLE_INSERT equ 24 +O_EW_RETURN_KEY equ 34 +O_EW_EP_INSERT equ 33 +O_EW_TAB_KEY equ 35 +O_EW_PASTE_CLIP equ 31 +O_EW_FIND equ 27 +O_EW_SET_SIZE equ 20 +O_EW_LEAVE equ 26 +O_EWLS_EXTRACT equ 2 +O_EW_READONLY equ 37 +O_EW_SET_FONT equ 25 +O_EW_SENSE_SIZE equ 19 +O_EW_INIT_STYLE equ 36 +O_EW_EVALUATE equ 29 +; Constants for edwin +PR_EDWIN_DIALLABLE equ (00001h) +PR_EDWIN_ACCEPT_TABS equ (00002h) +PR_EDWIN_ACCEPT_SOFT_HYPHENS equ (00004h) +PR_EDWIN_AUTO_CUR_END equ (00008h) +PR_EDWIN_AUTO_SELECT equ (00010h) +PR_EDWIN_DOC_SUPPLIED equ (00020h) +PR_EDWIN_CLIPBOARD equ (00040h) +PR_EDWIN_NOTIFY_OVERFLOW equ (00080h) +PR_EDWIN_READONLY equ (08000h) +IN_EDWIN_DIALLABLE equ (PR_EDWIN_DIALLABLE) +IN_EDWIN_ACCEPT_TABS equ (PR_EDWIN_ACCEPT_TABS) +IN_EDWIN_ACCEPT_SOFT_HYPHENS equ (PR_EDWIN_ACCEPT_SOFT_HYPHENS) +IN_EDWIN_AUTO_CUR_END equ (PR_EDWIN_AUTO_CUR_END or PR_EDWIN_AUTO_SELECT) +IN_EDWIN_NO_AUTOSELECT equ (PR_EDWIN_AUTO_SELECT) +IN_EDWIN_DOC_SUPPLIED equ (PR_EDWIN_DOC_SUPPLIED) +IN_EDWIN_CLIPBOARD equ (PR_EDWIN_CLIPBOARD) +IN_EDWIN_VULEN equ (00080h) +IN_EDWIN_VULEN_NOSCALE equ (00100h) +IN_EDWIN_VULEN_CHARACTERS equ (IN_EDWIN_VULEN) +IN_EDWIN_VULEN_PIXELS equ (IN_EDWIN_VULEN or IN_EDWIN_VULEN_NOSCALE) +IN_EDWIN_LEFT_CURSOR equ (00200h) +IN_EDWIN_TEXT_SEGMENTED equ (00400h) +IN_EDWIN_POSITION_SUPPLIED equ (00800h) +IN_EDWIN_FONT_SUPPLIED equ (01000h) +IN_EDWIN_LEADING_SUPPLIED equ (02000h) +IN_EDWIN_VISLINES_SUPPLIED equ (04000h) +IN_EDWIN_PAGINATABLE equ (08000h) +SET_EDWIN_TXT equ (001h) +SET_EDWIN_EMPTY equ (002h) +SET_EDWIN_CUR_END equ (004h) +SET_EDWIN_SEL_ALL equ (008h) +SET_EDWIN_CURSOR equ (010h) +SET_EDWIN_ANCHOR equ (020h) +EWF_BACKWARDS equ (00001h) +EWF_CASESENS equ (00002h) +EW_CHANGE_SINCE_SAVED equ (001h) +EW_CHANGE_SINCE_PAGINATE equ (002h) +EW_CHANGE equ (0ffffh) +EW_BRING_SINGLE_SHOT equ (0f000h) +; Types for edwin +IN_EDWIN struc +IN_EDWINVulen dw ? +IN_EDWINFlags dw ? +IN_EDWINMaxlen dw ? +IN_EDWINContents db (1) * 1 dup (?) +IN_EDWIN ends +EDWIN_LEADING struc +EDWIN_LEADINGTotal dw ? +EDWIN_LEADINGTop dw ? +EDWIN_LEADING ends +IN_EDWIN_X struc +IN_EDWIN_XVislines dw ? +IN_EDWIN_XPos P_POINT <> +IN_EDWIN_XFont dw ? +IN_EDWIN_XStyle dw ? +IN_EDWIN_XLeading EDWIN_LEADING <> +IN_EDWIN_XDoc dw ? +IN_EDWIN_XClip dw ? +IN_EDWIN_X ends +SE_EDWIN struc +SE_EDWINBuf dw ? +SE_EDWINLen dw ? +SE_EDWIN ends +SET_EDWIN struc +SET_EDWINFlags dw ? +SET_EDWINTxt SE_EDWIN <> +SET_EDWINCursor dw ? +SET_EDWINAnchor dw ? +SET_EDWIN ends +SENSE_EDWIN struc +SENSE_EDWINCursor dw ? +SENSE_EDWINAnchor dw ? +SENSE_EDWIN ends +; Property of edwin +PRS_EDWIN struc +EdwinScrimg dw ? +EdwinScrlay dw ? +EdwinDoc dw ? +EdwinCpos dw ? +EdwinClen dw ? +EdwinClip dw ? +EdwinSelect dw ? +EdwinChange dw ? +EdwinFlags dw ? +EdwinMargins SCRLAY_MARGINS <> +EdwinFont SCRLAY_FONT <> +PRS_EDWIN ends +PR_EDWIN struc +EdwinRoot PRS_ROOT <> +EdwinWin PRS_WIN <> +EdwinLodger PRS_LODGER <> +EdwinEdwin PRS_EDWIN <> +PR_EDWIN ends +; Property of punctued +PR_PUNCTUED struc +PunctuedRoot PRS_ROOT <> +PunctuedWin PRS_WIN <> +PunctuedLodger PRS_LODGER <> +PunctuedEdwin PRS_EDWIN <> +PR_PUNCTUED ends +; Property of ewlinksv +PRS_EWLINKSV struc +EwlinksvDoc dw ? +EwlinksvState dw ? +EwlinksvPos dw ? +EwlinksvParend dw ? +EwlinksvPosend dw ? +EwlinksvBuf db (1) * 256 dup (?) +PRS_EWLINKSV ends +PR_EWLINKSV struc +EwlinksvRoot PRS_ROOT <> +EwlinksvEwlinksv PRS_EWLINKSV <> +PR_EWLINKSV ends diff --git a/code/SIBOSDK/include/epdoc.g b/code/SIBOSDK/include/epdoc.g new file mode 100644 index 0000000..b4f2841 --- /dev/null +++ b/code/SIBOSDK/include/epdoc.g @@ -0,0 +1,37 @@ +/* Generated by Ctran from epdoc.cat */ +#define EPDOC_G +#ifndef EDIT_G +#include +#endif +/* Class Numbers */ +#define C_EPFDOC 4 +#define C_EPDOC 5 +/* Method Numbers */ +#define O_EPFDOC_PARA_START 26 +#define O_EPFDOC_SENSE_CHARS 27 +#define O_EPDOC_POS_FILTER 30 +#define O_EPDOC_SENSE_CHARS 25 +#define O_EPDOC_SET_PAGES 26 +#define O_EPDOC_PARA_START 24 +#define O_EPDOC_GOTO_PAGE 28 +#define O_EPDOC_SET_FILTER 29 +#define O_EPDOC_ENQ_PAGE 27 +/* Property of epfdoc */ +typedef struct pr_epfdoc +{ +PRS_ROOT root; +PRS_EPROOT eproot; +PRS_EPFLAT epflat; +} PR_EPFDOC; +/* Property of epdoc */ +typedef struct { +PR_SGBUF *b; +PR_VAFLAT *pages; +PR_VAFLAT *filter; +} PRS_EPDOC; +typedef struct pr_epdoc +{ +PRS_ROOT root; +PRS_EPROOT eproot; +PRS_EPDOC epdoc; +} PR_EPDOC; diff --git a/code/SIBOSDK/include/epdoc.ing b/code/SIBOSDK/include/epdoc.ing new file mode 100644 index 0000000..bfd97bd --- /dev/null +++ b/code/SIBOSDK/include/epdoc.ing @@ -0,0 +1,35 @@ +; Generated by Ctran from epdoc.cl +EPDOC_ING equ 1 +IFNDEF EDIT_ING + INCLUDE ..\inc\EDIT.ING +ENDIF +; Class Numbers +C_EPFDOC equ 4 +C_EPDOC equ 5 +; Method Numbers +O_EPFDOC_PARA_START equ 26 +O_EPFDOC_SENSE_CHARS equ 27 +O_EPDOC_POS_FILTER equ 30 +O_EPDOC_SENSE_CHARS equ 25 +O_EPDOC_SET_PAGES equ 26 +O_EPDOC_PARA_START equ 24 +O_EPDOC_GOTO_PAGE equ 28 +O_EPDOC_SET_FILTER equ 29 +O_EPDOC_ENQ_PAGE equ 27 +; Property of epfdoc +PR_EPFDOC struc +EpfdocRoot PRS_ROOT <> +EpfdocEproot PRS_EPROOT <> +EpfdocEpflat PRS_EPFLAT <> +PR_EPFDOC ends +; Property of epdoc +PRS_EPDOC struc +EpdocB dw ? +EpdocPages dw ? +EpdocFilter dw ? +PRS_EPDOC ends +PR_EPDOC struc +EpdocRoot PRS_ROOT <> +EpdocEproot PRS_EPROOT <> +EpdocEpdoc PRS_EPDOC <> +PR_EPDOC ends diff --git a/code/SIBOSDK/include/epoc.h b/code/SIBOSDK/include/epoc.h new file mode 100644 index 0000000..5b4acb7 --- /dev/null +++ b/code/SIBOSDK/include/epoc.h @@ -0,0 +1,552 @@ +/* HEADER - EPOC.H +Copyright (C) Psion PLC 1991 + VER DATE BY DESCRIPTION +===== ======== === =========== +1.00F 26/04/90 NSM First relase +*/ +#ifndef EPOC_H +#define EPOC_H + +#include + +#define E_PRIORITY_TIME_SUPERVISOR 0xf8 +#define E_PRIORITY_TIME_FSERV 0xf0 +#define E_PRIORITY_TIME_CRITICAL 0xb0 +#define E_PRIORITY_WSERV_MOUSE 0xa8 +#define E_PRIORITY_WSERV 0xa0 +#define E_PRIORITY_NOTIFY 0x90 +#define E_PRIORITY_FORE 0x80 +#define E_PRIORITY_BACK 0x70 +#define E_LCD_UNKNOWN (-1) +#define E_LCD_640_400 0 +#define E_LCD_640_200_SMALL 1 +#define E_LCD_640_200_BIG 2 +#define E_LCD_720_348 3 +#define E_LCD_160_80 4 +#define E_LCD_240_80 5 +#define E_PC_HERC E_LCD_720_348 +#define E_PC_CGA E_LCD_640_200_BIG +#define E_PC_MDA 6 +#define E_PC_EGA_MONO 7 +#define E_PC_EGA_COLOUR 8 +#define E_PC_VGA_MONO 9 +#define E_PC_VGA_COLOUR 10 +#define E_LCD_480_160 11 +#define E_LCD_240_100 12 +#define E_LCD_240_120 13 +#define E_LCD_240_160 14 +#define E_LCD_640_200 15 +#define E_PSU_OLD 0 +#define E_PSU_MAXIM 1 +#define E_PSU_S3 2 +#define E_PSU_S3_A9 3 +#define E_IS_A_COLD_START 0 +#define E_IS_A_POWERFAIL_START 1 +#define E_IS_A_RESET_START 2 +#define E_IS_A_KERNEL_FAULT 3 +#define E_IS_A_NEW_OS_START 4 +#define E_MAX_PROCESSES 24 +#define E_MAX_PRIORITY 0xc0 +#define E_MIN_PRIORITY 0x40 +#define E_MAX_NAME 12 +#define E_PIDMASK 0xfff +#define E_MAX_ERROR_TEXT_SIZE 64 +#define E_MAX_NOTIFY_TEXT_SIZE 64 +#define E_MAX_OPTION_TEXT_SIZE 16 +#define E_MAX_ENV_SIZE 16 +#define E_MAX_SUFFIXES 31 +#define E_MAX_MONTH_NAME 32 +#define E_MAX_DAY_NAME 32 +#define E_MAX_COMMAND_BUFFER 127 +#define E_MAX_GROWBY 0x400 +#define E_MAX_PASSWORD 8 +#define E_GROWBY_DEFAULT 0x80 +#define E_SEGMENT_LOW 0 +#define E_SEGMENT_HIGH 1 +#define E_SEGMENT_DEVICE 2 +#define E_LDD 0xdd01 +#define E_PDD 0xdd21 +#define E_NORMAL_EXIT 0 +#define E_PANIC_EXIT 1 +#define E_TASK_PANIC_EXIT 2 +#define E_FILE_SYSTEM_NAMESIZE 5 +#define E_SOUND_KEYBOARD 0x0001 +#define E_SOUND_BUZZER 0x0002 +#define E_SOUND_DEVICE 0x0004 +#define E_SOUND_LOUD 0x0008 +#define E_SOUND_LOUD_BUZZER 0x0010 +#define E_SOUND_DISABLE 0x8000 +#define E_SOUND_MAX_VOLUME 0 +#define E_SOUND_MIN_VOLUME 5 +#define E_SOUND_MAX_BPM 240 +#define E_SOUND_MIN_BPM 2 +#define E_MAX_ALARMS 2 +#define E_MAX_DTMF_DIAL 24 +#define E_MAX_DTMF_DIAL_B 40 +#define E_BATTERY_UNKNOWN 0 +#define E_BATTERY_ALKALINE 1 +#define E_BATTERY_NICAD_600 2 +#define E_BATTERY_NICAD_1000 3 +#define E_BATTERY_NICAD_500 4 +#define E_BATTERY_NICAD_850 5 +#define E_TICKS_PER_SECOND 32 +#define E_OPL_TEXT_MESSAGE 24 +#define E_BACKLIGHT_DISABLE 0x8000 +#define E_BACKLIGHT_OFF 0 +#define E_BACKLIGHT_ON 1 +#define E_BACKLIGHT_TOGGLE 2 +#define E_BACKLIGHT_QUERY 3 +#define E_FMEDIA_BATTERY_VALID 0x0400 +#define E_FMEDIA_BATTERY_GOOD 0x0200 +#define E_FRC_COUNTING 0 +#define E_FRC_REPEATING 1 +#define E_FSSOUNDCHANNEL1 1 +#define E_FSSOUNDCHANNEL2 2 +#define E_FRELATIVE 1 +#define E_FABSOLUTE 2 +#define E_FALARM 9 +#define E_FDIAL 10 +#define E_FSOUND_PLAY 0x10 +#define E_FSOUND_RECORD 0x11 + +#define E_KEY_DELETE_LEFT 0x0008 +#define E_KEY_TAB 0x0009 +#define E_KEY_RETURN 0x000d +#define E_KEY_ESCAPE 0x001b +#define E_KEY_DELETE_RIGHT 0x007f +#define E_KEY_UP 0x0100 +#define E_KEY_DOWN 0x0101 +#define E_KEY_RIGHT 0x0102 +#define E_KEY_LEFT 0x0103 +#define E_KEY_PAGE_UP 0x0104 +#define E_KEY_PAGE_DOWN 0x0105 +#define E_KEY_HOME 0x0106 +#define E_KEY_END 0x0107 +#define E_KEY_INSERT 0x0108 +#define E_KEY_VOICE 0x0109 +#define E_KEY_PSION_DOWN 0x010a +#define E_KEY_PSION_UP 0x010b +#define E_KEY_CAPS 0x10c +#define E_KEY_PSION 0x200 +#define E_KEY_BACKLIGHT 0x120 +#define E_KEY_INFO 0x121 +#define E_KEY_MENU 0x122 +#define E_KEY_HELP 0x123 +#define E_KEY_DIAMOND 0x124 + +#define E_KEY_APP1 0x131 +#define E_KEY_APP2 0x132 +#define E_KEY_APP3 0x133 +#define E_KEY_APP4 0x134 +#define E_KEY_APP5 0x135 +#define E_KEY_APP6 0x136 +#define E_KEY_APP7 0x137 +#define E_KEY_APP8 0x138 + +#define E_KEY_LCD 0x2000 +#define E_KEY_LCD_MINUS 0x2001 +#define E_KEY_ON 0x2002 +#define E_KEY_OFF 0x2003 + +#define E_STATE_KEY_VALID 0x0001 +#define E_STATE_SHIFT 0x0002 +#define E_STATE_CONTROL 0x0004 +#define E_STATE_PSION 0x0008 +#define E_STATE_CAPS_LOCKED 0x0010 +#define E_STATE_NUM_LOCKED 0x0020 +#define E_STATE_MOUSE_VALID 0x0040 +#define E_STATE_MOUSE_DOWN 0x0080 +#define E_STATE_MOUSE_MOVED 0x0100 +#define E_STATE_MOUSE_CHANGED 0x0200 +#define E_STATE_MOUSE_GONE 0x0400 +#define E_STATE_KEY_REPEATED 0x0800 +#define E_STATE_FN 0x0080 + +/* Additional I/O functions */ +#define P_FTIMER_RELATIVE 1 +#define P_FTIMER_ABSOLUTE 2 +#define P_FSOUND_CHANNEL1 1 +#define P_FSOUND_CHANNEL2 2 +#define P_FSOUND_PLAY P_FTEST +#define P_FSOUND_RECORD P_FCTRL + +typedef struct + { + unsigned char beatsPerMinute; + unsigned char volume; + } E_SOUND; + +typedef struct + { + unsigned short int code; + unsigned short int state; + unsigned short int tick; + unsigned short int mouseX; + unsigned short int mouseY; + } E_KEYS; + +typedef struct + { + unsigned char toneLengthTicks; + unsigned char delayLengthTicks; + unsigned short int pauseLengthTicks; + } E_DIAL; + +typedef struct message + { + struct message *next; + unsigned char *status; + unsigned int type; + int pid; + } E_MESSAGE; + +typedef struct + { + unsigned short int codeParagraphs; + unsigned short int initialIp; + unsigned short int stackParagraphs; + unsigned short int dataParagraphs; + unsigned short int heapParagraphs; + unsigned char *commandLine; + unsigned short int checkSum; + unsigned short int minHeap; + unsigned char priority; + unsigned char ramOrRom; + unsigned char name[E_MAX_NAME]; + } E_CPB; + +#define E_PROC_FREE 0xff +#define E_PROC_CURRENT 0x01 +#define E_PROC_READY 0x02 +#define E_PROC_DELTA 0x03 +#define E_PROC_SUSPENDED 0x04 +#define E_PROC_SEMAPHORE 0x05 +typedef struct e_proc + { + struct e_proc *next; + struct e_proc *prev; + short int queKey; + short int queData; + unsigned char deltaType; + unsigned char addressTrap; + unsigned char status; + unsigned char sstatus; + unsigned char priority; + unsigned char priorityH; + unsigned char ramOrRom; + unsigned char isTask; + unsigned char name[E_MAX_NAME+1]; + unsigned char active; + unsigned short int semaphore; + unsigned char *semHead; + unsigned char *memBasePtr; + unsigned short int memGrowBy; + unsigned char *mCtrlPtr; + unsigned short int minHeap; + int fServer; + int dataSeg; + int codeSeg; + unsigned char *saveSP; + unsigned char *saveBP; + unsigned char notify; + unsigned char sndSem; + unsigned short int magic; + unsigned short int checkSum; + unsigned short int terminate; + unsigned short int bankState; + } E_PROC; +typedef struct + { + unsigned short int mainBatteryReading; + unsigned short int lithiumBatteryReading; + short int mainsPresent; + } E_SUPPLY; +typedef struct + { + unsigned short int mainBatteryWarning; + unsigned short int lithiumBatteryWarning; + unsigned short int mainBatteryMax; + unsigned short int lithiumBatteryMax; + } E_SUPPLY_WARNINGS; +#define E_MBAT_ZERO 0 +#define E_MBAT_VERY_LOW 1 +#define E_MBAT_LOW 2 +#define E_MBAT_GOOD 3 +#define E_SUPPLY_SOUND_WARNING 0x0001 +#define E_SUPPLY_FLASH_WARNING 0x0002 +#define E_SUPPLY_SYSTEM_TIME_CHANGED 0x0004 +typedef struct + { + unsigned char mainBatteryLevel; + unsigned char mainBatteryStatus; + unsigned char backupBatteryLevel; + unsigned char dcLevel; + unsigned short int warningFlags; + unsigned long int insertionDate; + unsigned long int ticksInUseBattery; + unsigned long int ticksInUseDc; + unsigned long int maTicks; + } E_SUPPLY_INFO; +#define ImgVersion 0x200f +#define DevVersion 0x200f +#define SignatureSize 16 +#define ImageSignature "ImageFileType**" +#define LDDSignature "LDDFileType****" +#define PDDSignature "PDDFileType****" +#define LIBSignature "LIBFileType****" +#define HeaderSize 0x40 +#define MagicLandSize 0x40 +#define MaxAddFiles 4 +typedef struct + { + unsigned short int offset; + unsigned short int length; + } ADDFILE; +typedef struct + { + unsigned char name[E_MAX_NAME+2]; /* Dyl name zero terminated */ + unsigned long int offset; /* Offset in File */ + } DYLENTRY; +typedef struct + { + unsigned char Signature[SignatureSize]; + unsigned short int ImageVersion; + unsigned short int HeaderSizeBytes; + unsigned short int CodeParas; + unsigned short int InitialIP; + unsigned short int StackParas; + unsigned short int DataParas; + unsigned short int HeapParas; + unsigned short int InitializedData; + unsigned short int CodeCheckSum; + unsigned short int DataCheckSum; + unsigned short int CodeVersion; + unsigned short int Priority; + ADDFILE Add[MaxAddFiles]; + unsigned short int DylCount; + unsigned long int DylTableOffset; + unsigned short int Spare; + } ImgHeader; +typedef struct + { + unsigned char Signature[SignatureSize]; + unsigned short int DeviceVersion; + unsigned short int HeaderSizeBytes; + unsigned short int CodeParas; + unsigned short int CodeCheckSum; + unsigned short int CodeVersion; + } DevHeader; +#define ALawSignature "ALawSoundFile**" +typedef struct + { + char Signature[SignatureSize]; + unsigned short int Version; + unsigned long int Samples; + unsigned short int SilenceInTicks; + unsigned short int Repeats; + unsigned short int Spare[3]; + } SndFile; +#ifdef __cplusplus +extern "C" { +#endif +typedef void (*_CALL)(void); +#pragma save,call(reg_param =>(bx),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int p_attachfile(char *); +extern int p_detachfile(char *); +#pragma call(reg_param =>(cx,ax),reg_saved =>(bx,dx,si,di,EPOC_SAVE)) +extern int p_dayinm(int,int); +#pragma call(reg_param =>(bx,dx),reg_saved =>(bx,dx,si,di,EPOC_SAVE)) +extern int p_devdel(const char *,int); +#pragma call(reg_param =>(bx,di,dx,si),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int p_devfnd(int,const char *,int,char *); +#pragma call(reg_param =>(bx),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int p_devqu(const char *); +#pragma restore +extern int cdecl p_exec(const char *); +extern int cdecl p_execasync(const char *,short int *,int *); +extern int cdecl p_execc(const char *,void *,int); +extern int cdecl p_execcasync(const char *,void *,int,short int *,int *); +#pragma save,call(reg_param =>(),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int p_totalK(void); +extern int p_getauto(void); +extern int p_getautomains(void); +extern int p_getsnd(void); +extern int p_getbat(void); +extern int p_detectsoaktestfixture(void); +extern int p_relogpacks(void); +extern int p_getlanguage(void); +extern int p_getlcd(void); +extern int p_getlcdcontrast(void); +extern int p_getpsu(void); +extern int p_getpid(void); +extern unsigned int p_getbacklight(void); +extern unsigned int p_getram(void); +extern int p_getres(void); +extern int p_getshiftstate(void); +extern int p_getnotify(void); +extern int p_getalarmid(void); +extern void p_allowoff(void); +extern unsigned int p_returntickcount(void); +extern unsigned int p_returnexpansionportinfo(void); +#pragma call(reg_param =>(bx),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern void p_setbacklight(unsigned int); +extern void p_setconfig(unsigned int); +extern unsigned int p_setirpowerlevel(unsigned int); +extern unsigned int p_setcapslockmode(int); +#pragma call(reg_param =>(di,si,cx),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern void p_getosd(void *,void *,unsigned int); +#pragma call(reg_param =>(bx),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int p_getpri(int); +extern int p_getowner(int); +extern void p_getscancodes(unsigned short int *); +#pragma call(reg_param =>(bx,cx,dx),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int p_getpthbyid(int,char *); +extern int p_getpthbyidasync(int,char *,short int *); +extern int p_locdevice(int,unsigned short int *); +extern int p_locdeviceasync(int,unsigned short int *,short int *); +#pragma call(reg_param =>(bx,cx,di,si,dx),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int p_locreadpdd(int,long int *,void *,unsigned int); +extern int p_locreadpddasync(int,long int *,void *,unsigned int,short int *); +#pragma call(reg_param =>(ax),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern void p_setautomains(int); +extern void p_setnotify(int); +extern int p_backlight(int); +extern int p_setonevent(int); +extern int p_setbat(int); +extern void p_hwexit(void); +extern void p_lcdcontrastdelta(int); +extern void p_marka(void); +extern void p_mcancel(void); +extern void p_unmarka(void); +extern void p_notifyunhook(void); +extern void p_alarmunhook(void); +extern void p_osdummy(void); +extern unsigned int p_version(void); +extern unsigned int p_romversion(void); +#pragma call(reg_param =>(ax,bx),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int p_gettext(int,char *); +#pragma call(reg_param =>(bx),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int p_hgran(int); +#pragma call(reg_param =>(bx),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern void p_iogetkm(E_KEYS *); +extern void p_iogetkmasync(E_KEYS *); +extern int p_iosignalbypid(int); +#pragma call(reg_param =>(bx,dx),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int p_loadldd(const char *); +extern int p_loadlddasync(const char *,short int *); +extern int p_loadpdd(const char *); +extern int p_loadpddasync(const char *,short int *); +#pragma call(reg_param =>(bx,cx),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int p_logon(int,int); +extern int p_logoff(int,int); +extern int p_logoffx(int,int); +#pragma call(reg_param =>(bx,di),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int p_logona(int,short int *); +extern int p_logoffa(int); +#pragma call(reg_param =>(bx,cx),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern void p_mfree(void *,int); +#pragma call(reg_param =>(bx,ax),reg_saved =>(cx,dx,si,di,EPOC_SAVE)) +extern int p_minit(int,int); +#pragma call(reg_param =>(di,bx),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern void p_mreceive(short int *,void *); +#pragma call(reg_param =>(bx),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern void p_mreceivew(void *); +#pragma call(reg_param =>(bx,cx,si,di),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int p_msend(int,unsigned int,void *); +extern int p_msendreceivew(int,unsigned int,void *); +extern int p_msendreceivea(int,unsigned int,void *,short int *); +#pragma call(reg_param =>(bx,cx,dx,di,si),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int p_notify(const char *,const char *,const char *,const char *,const char *); +#pragma call(reg_param =>(ax,bx,dx,di,si),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int p_notifyerr(int,const char *,const char *,const char *,const char *); +#pragma call(reg_param =>(bx),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int p_notifyhook(int); +extern int p_alarmhook(int); +#pragma call(reg_param =>(bx),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern void p_onterminate(int); +#pragma call(reg_param =>(cx),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern void p_off(unsigned int); +#pragma call(reg_param =>(bx,di,si,cx),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int p_pcpyto(int,void *,void *,unsigned int); +#pragma call(reg_param =>(bx,si,di,cx),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int p_pcpyfr(int,void *,void *,unsigned int); +extern int p_piscpyfr(int,void *,char *,unsigned int); +#pragma call(reg_param =>(bx),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int p_pcreate(E_CPB *); +extern int p_locchg(int mask); +#pragma call(reg_param =>(bx,di,si),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int p_pfind(int,const char *,char *); +#pragma call(reg_param =>(bx),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int p_pidfind(const char *); +#pragma call(reg_param =>(bx,ax),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int p_pkill(int,int); +#pragma call(reg_param =>(bx,cx),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int p_pterminate(int,int); +#pragma call(reg_param =>(bx,di),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int p_prename(int,const char *); +#pragma call(reg_param =>(bx,di),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int p_pname(int,char *); +#pragma call(reg_param =>(bx,ax),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int p_ppanic(int,int); +#pragma call(reg_param =>(bx),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int p_presume(int); +extern int p_psuspend(int); +#pragma call(reg_param =>(bx,cx,si,di),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int p_ptask(char *,int,_CALL,void *); +#pragma call(reg_param =>(dx,cx),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern void p_sdate(unsigned long int); +#pragma call(reg_param =>(bx,dx),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern void p_setauto(int); +extern void p_setsnd(int); +extern int p_setdefaultpath(const char *); +#pragma call(reg_param =>(bx,ax),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int p_setpri(int,int); +#pragma call(reg_param =>(bx,cx),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern void p_signaln(int,int); +extern void p_signalnr(int); +#pragma call(reg_param =>(dx,cx),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int p_sleept(long int); +#pragma call(reg_param =>(bx,cx),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern void p_supply(E_SUPPLY *); +extern void p_supplyinfo(E_SUPPLY_INFO *); +extern void p_wsupply(E_SUPPLY_WARNINGS *); +#pragma call(reg_param =>(bx,dx),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern void p_wait(int); +extern int p_watchall(unsigned int); +#pragma call(reg_param =>(si,di),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int p_setpass(char *,char *); +#pragma call(reg_param =>(si),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int p_testpass(char *); +#pragma call(reg_param =>(si,ax),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int p_controlpass(char *,int); +#pragma call(reg_param =>(),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int p_querypass(void); +extern void p_tickle(void); +extern void p_nexthalfsecond(void); +#pragma call(reg_param =>(),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE),inline =>on) +static int p_iostatkm(void) = {0xcd,0xda}; +static int p_nexthalfsecondstatus(void) = {0xcd,0xdd}; +#pragma call(reg_param =>(ax),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE),inline =>on) +static unsigned int p_setrombank(unsigned int) = {0xcd,0xdf}; +static unsigned int p_getrombank(void) = {0xcd,0xe0}; +#pragma restore +#pragma save,call(reg_param =>(bx,cx,dx,di),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern void p_playsounda(const char *,unsigned int,unsigned int,short int *); +extern int p_playsoundw(const char *,unsigned int,unsigned int); +extern void p_playsoundcancel(void); +#pragma call(reg_param =>(bx,cx,dx,di,si),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern void p_playsoundao(const char *,unsigned int,unsigned int,short int *,unsigned int); +extern int p_playsoundwo(const char *,unsigned int,unsigned int,unsigned int); +#pragma call(reg_param =>(bx,cx,di),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern void p_recordsounda(const char *,unsigned int,short int *); +extern int p_recordsoundw(const char *,unsigned int); +extern void p_recordsoundcancel(void); +#pragma call(reg_param =>(bx,ax),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern void p_nmdaya(char *,int); +extern void p_nmmona(char *,int); +#pragma restore +#ifdef __cplusplus +} +#endif + +#endif // EPOC_H diff --git a/code/SIBOSDK/include/epocdefs.h b/code/SIBOSDK/include/epocdefs.h new file mode 100644 index 0000000..4261fff --- /dev/null +++ b/code/SIBOSDK/include/epocdefs.h @@ -0,0 +1,326 @@ +/* Release 3.00 */ + +/*-------------------------------------------------------------------------* +* * +* string.h - Definitions for string and memory functions. * +* * +* COPYRIGHT (C) 1991 Psion PLC. All Rights Reserved. * +* * +*--------------------------------------------------------------------------*/ +#include + +#ifndef EPOCDEFS_H +#define EPOCDEFS_H + +#ifndef _TIME_DEF +#define _TIME_DEF +typedef long time_t; +#endif + +typedef int INT,HANDLE; +typedef unsigned int UINT; +typedef signed char BYTE; +typedef unsigned char UBYTE; +typedef short int WORD; +typedef unsigned short int UWORD; +typedef long int LONG; +typedef unsigned long int ULONG; +typedef double DOUBLE; +typedef float FLOAT; +typedef char TEXT; + +typedef struct _mblock + { + unsigned int mlen; + struct _mblock *mnext; + } _MBLOCK; + +#define P_FOPEN 0x0000 +#define P_FCREATE 0x0001 +#define P_FREPLACE 0x0002 +#define P_FAPPEND 0x0003 +#define P_FUNIQUE 0x0004 +#define P_FSER_MASK 0x000f +#define P_FSTREAM 0x0000 +#define P_FSTREAM_TEXT 0x0010 +#define P_FTEXT 0x0020 +#define P_FDIR 0x0030 +#define P_FFORMAT 0x0040 +#define P_FDEVICE 0x0050 +#define P_FNODE 0x0060 +#define P_FMT_MASK 0x00f0 +#define P_FUPDATE 0x0100 +#define P_FRANDOM 0x0200 +#define P_FSHARE 0x0400 +#define P_FACC_MASK 0x0f00 +#define P_FLOWDENSITY 0x1000 + +#define P_FPANIC 0 +#define P_FREAD 1 +#define P_FWRITE 2 +#define P_FCLOSE 3 +#define P_FCANCEL 4 +#define P_FATTACH 5 +#define P_FDETACH 6 +#define P_FSET 7 +#define P_FSENSE 8 +#define P_FFLUSH 9 +#define P_FRELATIVE P_FREAD +#define P_FABSOLUTE P_FWRITE +#define P_FSEEK 10 +#define P_FSETEOF 11 +#define P_FWRITE_REPLY 12 +#define P_FTEST 10 +#define P_FCTRL 11 +#define P_FINQ 12 +#define P_FRSUPER 13 +#define P_FSTOP 14 +#define P_FSTART 15 +#define P_FENABLE 16 +#define P_FSETINT 17 +#define P_FABS 1 +#define P_FEND 2 +#define P_FCUR 3 +#define P_FRSENSE 4 +#define P_FRSET 5 +#define P_FREWIND 6 + +#define NoErr 0 +#define FailErr (-1) +#define ArgumentErr (-2) +#define OsErr (-3) +#define NotSupportedErr (-4) +#define UnderflowErr (-5) +#define OverflowErr (-6) +#define RangeErr (-7) +#define DivideByZeroErr (-8) +#define InUseErr (-9) +#define NoMemoryErr (-10) +#define NoSegmentsErr (-11) +#define NoSemaphoreErr (-12) +#define NoProcessErr (-13) +#define AlreadyOpenErr (-14) +#define NotOpenErr (-15) +#define ImageErr (-16) +#define NoReceiverErr (-17) +#define NoDevicesErr (-18) +#define NoFileSystemErr (-19) +#define FailedToStartErr (-20) +#define ExistsErr (-32) +#define NotExistsErr (-33) +#define WriteErr (-34) +#define ReadErr (-35) +#define EofErr (-36) +#define FullErr (-37) +#define NameErr (-38) +#define AccessErr (-39) +#define LockedErr (-40) +#define DeviceErr (-41) +#define DirErr (-42) +#define RecordErr (-43) +#define ReadOnlyErr (-44) +#define IoInvalidErr (-45) +#define PendingErr (-46) +#define VolumeErr (-47) +#define CancelErr (-48) +#define IoAllocErr (-10) +#define DisconnectErr (-50) +#define ConnectErr (-51) +#define ReTransmitErr (-52) +#define LineErr (-53) +#define InActivityErr (-54) +#define ParityErr (-55) +#define FrameErr (-56) +#define OverrunErr (-57) +#define ModemConnectErr (-58) +#define ModemBusyErr (-59) +#define ModemNoAnswerErr (-60) +#define ModemBlacklistErr (-61) +#define NotReadyErr (-62) +#define UnknownErr (-63) +#define DirFullErr (-64) +#define WriteProtectErr (-65) +#define CorruptMediaErr (-66) +#define AbortErr (-67) +#define EraseErr (-68) +#define InvalidFileErr (-69) + +#define P_CD_ROOT 0 +#define P_CD_PARENT 1 +#define P_CD_SUBDIR 2 + +#define P_FAWRITE 0x01 +#define P_FAHIDDEN 0x02 +#define P_FASYSTEM 0x04 +#define P_FAVOLUME 0x08 +#define P_FADIR 0x10 +#define P_FAMOD 0x20 +#define P_FAREAD 0x100 +#define P_FAEXEC 0x200 +#define P_FASTREAM 0x400 +#define P_FATEXT 0x800 + +typedef struct + { + UWORD version; + UWORD status; + ULONG size; + ULONG modst; + UBYTE spare[4]; + } P_INFO; + +#define P_VOLUMENAME 32 +#define P_FMEDIA_UNKNOWN 0 +#define P_FMEDIA_FLOPPY 1 +#define P_FMEDIA_HARDDISK 2 +#define P_FMEDIA_FLASH 3 +#define P_FMEDIA_RAM 4 +#define P_FMEDIA_ROM 5 +#define P_FMEDIA_WRITEPROTECTED 6 +#define P_FMEDIA_COMPRESSIBLE 0x8000 +#define P_FMEDIA_DYNAMIC 0x4000 +#define P_FMEDIA_INTERNAL 0x2000 +#define P_FMEDIA_DUAL_DENSITY 0x1000 +#define P_FMEDIA_FORMATTABLE 0x800 + +typedef struct { + UWORD version; + UWORD mediatype; + UWORD removable; + ULONG size; + ULONG free; + UBYTE name[P_VOLUMENAME]; + WORD batterystate; + UBYTE spare[16]; + } P_DINFO; + +#define P_FSYSTYPE_FLAT 0 +#define P_FSYSTYPE_HIER 1 +typedef struct { + UWORD version; + UWORD type; + UWORD formattable; + UBYTE spare[26]; + } P_NINFO; + +#define P_PWILD_ANY 0x01 +#define P_PWILD_NAME 0x02 +#define P_PWILD_EXT 0x04 +#define P_FSYSNAMESIZE 5 + +typedef struct { + UBYTE system; + UBYTE device; + UBYTE path; + UBYTE name; + UBYTE ext; + UBYTE flags; + } P_FPARSE; + +#define P_FBLKSHIFT 9 +#define P_FBLKSIZE 0x200 +#define P_FMAXRSIZE 0x100 +#define P_FMAXSSIZE 0x4000 +#define P_FSIZRPOS sizeof(LONG) +#define P_MAXDEV 128 +#define P_MAXPATH 128 +#define P_MAXNAME 128 +#define P_MAXEXTN 128 +#define P_FNAMESIZE 128 + +typedef struct + { + ULONG day; + ULONG sec; + } P_DAYSEC; + +typedef struct + { + UBYTE year; + UBYTE month; + UBYTE day; + UBYTE hour; + UBYTE minute; + UBYTE second; + UWORD yrday; + } P_DATE; + +#define P_SCR_ATTRB 0 +#define P_SCR_SCROLL 1 +#define P_SCR_CLR 2 +#define P_SCR_POSA 3 +#define P_SCR_POSR 4 +#define P_SCR_WSET 5 +#define P_SCR_SLOCK 6 +#define P_SCR_WLOCK 7 +#define P_SCR_NEL 8 +#define P_SCR_CURSOR 9 +#define P_SCR_ESCAPE 10 + +typedef struct + { + short int x; /* Horizontal coordinate */ + short int y; /* Vertical coordinate */ + } P_POINT; +typedef struct + { + P_POINT tl; /* Top left point */ + P_POINT br; /* Bottom right point */ + } P_RECT; +typedef struct + { + P_RECT r; /* Rectangle */ + P_POINT p; /* Point */ + } P_RECTP; +typedef struct + { + P_POINT tl; /* Top left point */ + unsigned short int width; /* Width */ + unsigned short int height; /* Height */ + } P_EXTENT; + +#define _E_SEARCH 0x10 +#define _E_EXEC 0x20 + +extern char _pname[P_FNAMESIZE]; +extern P_FPARSE _pinfo; +extern void *winHandle; + +#ifdef __cplusplus +extern "C" { +#endif +extern int _allocInfo(_MBLOCK **,_MBLOCK **); +extern _MBLOCK *_heapTop(void); +extern int _iopen(char **_handle,char *_name,int _mode); +extern int _iow2(char *handle,int _func); +extern int _iow3(char *handle,int _func,void *); +extern int _iow4(char *handle,int _func,void *,void *); +extern int _parse(const char *_in,char *_rel,char *_out,P_FPARSE *_info); +extern void _convTimeToDos(ULONG t,int *date,int *time); +extern void _FsChanToName(void *handle,char *name); +extern int _FsChanToMode(void *handle); +extern int _isloc(const char *path); +extern void _systemTimeToDaySeconds(time_t secs,P_DAYSEC *pDs); +extern time_t _daySecondsToSystemTime(P_DAYSEC *pDs); +extern void _daySecondsToDate(P_DAYSEC *pDs,P_DATE *pDate); +extern int _dateToDaySeconds(P_DATE *pDate,P_DAYSEC *pDs); +extern int _fileInfo(const char *path,P_INFO *pI); +extern int _fileSetModTime(const char *path,time_t time); +extern void _getPath(char *path); +extern void _setPath(char *path); +extern time_t _date(void); +extern void _sleepTenths(unsigned long tenths); +extern int _execc(const char *path,char **argv,int mode); +extern int __execc(char *path,char *command); +extern int _logon(int handle,WORD *stat); +extern void _waitStat(WORD *stat); +extern int _resume(int pid); +extern char *_getErrorText(int error,char *buffer); +#pragma save,call(inline=>on) +static void _dummy(void) = {0xCD,0xD4}; +#pragma restore +#ifdef __cplusplus +} +#endif +#endif + diff --git a/code/SIBOSDK/include/epocdefs.inc b/code/SIBOSDK/include/epocdefs.inc new file mode 100644 index 0000000..277c969 --- /dev/null +++ b/code/SIBOSDK/include/epocdefs.inc @@ -0,0 +1,867 @@ +OldPsu = 0 +MaximPsu = 1 +PanPsu = 2 +BatteryUnknown = 0 +BatteryAlkaline = 1 +BatteryNicad600 = 2 +BatteryNicad1000 = 3 +BatteryNicad500 = 4 +LcdUnknown = -1 +Lcd640X400 = 0 +Lcd640X200Small = 1 +Lcd640X200Big = 2 +Lcd720X348 = 3 +Lcd160X80 = 4 +Lcd240X80 = 5 +PcHerc = Lcd720X348 +PcCga = Lcd640X200Big +PcMda = 6 +PcEgaMono = 7 +PcEgaColour = 8 +PcVgaMono = 9 +PcVgaColour = 10 +Lcd480X160 = 11 +Lcd240X100 = 12 +Lcd240X120 = 13 +Lcd240X160 = 14 +Lcd640X200 = 15 +IsAColdStart = 0 +IsAPowerFailStart = 1 +IsAResetStart = 2 +IsAKernelFault = 3 +IsANewOsStart = 4 + +HwInt0Revector = 0 +HwInt1Revector = 1 +HwInt2Revector = 2 +HwInt3Revector = 3 +HwInt4Revector = 4 +HwIrq0Revector = 5 +HwIrq1Revector = 6 +HwIrq2Revector = 7 +HwIrq3Revector = 8 +HwIrq4Revector = 9 +HwIrq5Revector = 10 +HwIrq6Revector = 11 +HwIrq7Revector = 12 +FileSystemNameSize = 5 +MaxDeviceSize = 8 +MaxNameSize = 8 +MaxExtSize = 4 +MaxNameESize = (MaxNameSize+MaxExtSize) +MaxPathSize = 080H +DeviceSeparator = ':' +ExtSeparator = '.' +MatchAny = '*' +MatchSingle = '?' +MaxErrorTextSize = 64 +MaxNotifyTextSize = 64 +MaxOptionTextSize = 16 +MaxSuffixes = 31 +MaxCommandBuffer = 127 +PidMask = 0FFFH +MaxEnvNameSize = 16 +MaxAlarms = 2 + +SoundKeyboardEnable = 00001H +SoundBuzzerEnable = 00002H +SoundDeviceEnable = 00004H +SoundLoud = 00008H +SoundDisable = 08000H +SoundMaxVolume = 0 +SoundMinVolume = 5 +SoundMaxBpm = 240 +SoundMinBpm = 2 + +CPBInRom = 0 +CPBInRam = 1 +CPBMaxPriority = 0C0H +CPBMinPriority = 040H +MaxHeapGrowBy = 0400H +HeapGrowByDefault = 080H +MaxProcesses = 018H + +CreateSegmentLow = 0 +CreateSegmentHigh = 1 +CreateSegmentDevice = 2 +CreateSegmentLocked = 3 + +IoFuncPanic = 000H +IoFuncRead = 001H +TimerRelative = 001H +IoFuncWrite = 002H +TimerAbsolute = 002H +IoFuncClose = 003H +IoFuncCancel = 004H +IoFuncAttach = 005H +IoFuncDetach = 006H +IoFuncSet = 007H +IoFuncSense = 008H +IoFuncFlush = 009H +IoFuncAlarm = 009H +IoFuncSeek = 00AH +IoFuncSetEof = 00BH +IoFuncConnect = 00AH +IoFuncDisconnect = 00BH +IoFuncWriteReply = 00CH +IoFuncTest = 00AH +IoFuncControl = 00BH +IoFuncInquire = 00CH +IoFuncSuperFrame = 00DH +IoFuncStop = 00EH +IoFuncStart = 00FH +IoFuncEnable = 010H +IoFuncSetDevice = 011H +IoFuncModemInit = 010H +IoFuncModemDial = 011H +IoFuncModemWaitCall = 012H +IoFuncModemSense = 013H +IoFuncModemSet = 014H +IoFuncModemCancel = 015H +IoFuncModemWrite = 016H + +ModeOpen = 00000H +ModeCreate = 00001H +ModeReplace = 00002H +ModeAppend = 00003H +ModeUnique = 00004H +ModeStream = 00000H +ModeStreamText = 00010H +ModeText = 00020H +ModeDir = 00030H +ModeFormat = 00040H +ModeDevice = 00050H +ModeNode = 00060H +ModeUpdate = 00100H +ModeRandom = 00200H +ModeShare = 00400H +ModeLowDensity = 01000H +ModeServiceMask = 0000FH +ModeFormatMask = 000F0H +ModeAccessMask = 00F00H + +SeekAddress = 00H +SeekFromStart = 01H +SeekFromEnd = 02H +SeekFromCurrent = 03H +SeekRecordSense = 04H +SeekRecordSet = 05H +SeekRewind = 06H + +FileAttWrite = 00001H +FileAttHidden = 00002H +FileAttSystem = 00004H +FileAttVolume = 00008H +FileAttDirectory = 00010H +FileAttModified = 00020H +FileAttRead = 00100H +FileAttExecute = 00200H +FileAttStream = 00400H +FileAttText = 00800H + +FileChangeDirRoot = 0 +FileChangeDirParent = 1 +FileChangeDirSubdir = 2 + +MaxVolumeName = 32 +FileMediaUnknown = 0 +FileMediaFloppy = 1 +FileMediaHardDisk = 2 +FileMediaFlash = 3 +FileMediaRam = 4 +FileMediaRom = 5 +FileMediaWriteProtected = 6 +FileMediaCompressible = 08000H +FileMediaDynamic = 04000H +FileMediaInternal = 02000H +FileMediaDualDensity = 01000H +FileMediaFormattable = 00800H + +FileNodeFlat = 0 +FileNodeHierarchical = 1 + +FileBlockShift = 9 +FileBlockSize = 00200H +FileMaxRecordSize = 00100H +FileMaxStreamSize = 04000H + +JustifyLeft = 0 +JustifyRight = 1 +JustifyCentre = 2 + +ParseWildAny = 00001H +ParseWildName = 00002H +ParseWildExt = 00004H + +DtobTypeFixed = 00H +DtobTypeExponent = 01H +DtobTypeGeneral = 02H +DtobMaxExponent = 99 +FloatSignificantDigits = 15 + +IoChanSignature = 01101H +IoHandlerSignature = 01121H +DbfChanSignature = 01141H +LIBChanSignature = 01161H +LDDSignature = 0DD01H +PDDSignature = 0DD21H +LIBSignature = 0DD41H +VectorInfoSize = 8 + +KillExit = 0 +PanicExit = 1 +TaskPanicExit = 2 + +PointX = 0 +PointY = 2 +PointEnt = 4 +RectTl = 0 +RectBr = 4 +RectEnt = 8 + +NoErr = 0 +FailErr = -1 +ArgumentErr = -2 +OsErr = -3 +NotSupportedErr = -4 +UnderflowErr = -5 +OverflowErr = -6 +RangeErr = -7 +DivideByZeroErr = -8 +InUseErr = -9 +NoMemoryErr = -10 +IoAllocErr = -10 +NoSegmentsErr = -11 +NoSemaphoreErr = -12 +NoProcessErr = -13 +AlreadyOpenErr = -14 +NotOpenErr = -15 +ImageErr = -16 +NoReceiverErr = -17 +NoDevicesErr = -18 +NoFileSystemErr = -19 +FailedToStartErr = -20 +FontNotLoadedErr = -21 + +ExistsErr = -32 +NotExistsErr = -33 +WriteErr = -34 +ReadErr = -35 +EofErr = -36 +FullErr = -37 +NameErr = -38 +AccessErr = -39 +LockedErr = -40 +DeviceErr = -41 +DirErr = -42 +RecordErr = -43 +ReadOnlyErr = -44 +IoInvalidErr = -45 +PendingErr = -46 +VolumeErr = -47 +CancelErr = -48 +ReservedErr = -49 +DisconnectErr = -50 +ConnectErr = -51 +ReTransmitErr = -52 +LineErr = -53 +InActivityErr = -54 +ParityErr = -55 +FrameErr = -56 +OverrunErr = -57 +ModemConnectErr = -58 +ModemBusyErr = -59 +ModemNoAnswerErr = -60 +ModemBlacklistErr = -61 +NotReadyErr = -62 +UnknownErr = -63 +DirFullErr = -64 +WriteProtectErr = -65 +CorruptMediaErr = -66 +AbortErr = -67 +EraseErr = -68 +InvalidFileErr = -69 + +CDataCountryCode = 000H +CDataGmtOffset = 002H +CDataDateType = 004H +CDataTimeType = 005H +CDataCurrencySymbolPosition = 006H +CDataCurrencySpaceRequired = 007H +CDataCurrencyDecimalPlaces = 008H +CDataCurrencyNegativeInBrackets = 009H +CDataCurrencyTriadsAllowed = 00AH +CDataThousandsSeparator = 00BH +CDataDecimalSeparator = 00CH +CDataDateSeparator = 00DH +CDataTimeSeparator = 00EH +CDataCurrencySymbol = 00FH +CDataStartOfWeek = 018H +CDataSpare = 019H +CDataEnt = 028H +DateYear = 000H +DateMonth = 001H +DateDay = 002H +DateHour = 003H +DateMinute = 004H +DateSecond = 005H +DateYearDay = 006H +DateEnt = 008H +DeviceVersionNo = 000H +DeviceMediaType = 002H +DeviceIsRemovable = 004H +DeviceStatusSize = 006H +DeviceStatusFree = 00AH +DeviceStatusName = 00EH +DeviceBatteryState = 02EH +DeviceSpare = 030H +DeviceEnt = 040H +DtobType = 000H +DtobWidth = 001H +DtobNdec = 002H +DtobPoint = 003H +DtobTriad = 004H +DtobTrilen = 005H +DtobEnt = 006H +DyScDays = 000H +DyScSeconds = 004H +DyScEnt = 008H +FileVersionNo = 000H +FileAtt = 002H +FileSize = 004H +FileModDate = 008H +FileSpare = 00CH +FileEnt = 010H +FullParseSystem = 000H +FullParseDevice = 001H +FullParsePath = 002H +FullParseName = 003H +FullParseExt = 004H +FullParseFlags = 005H +FullParseEnt = 006H +GenParseSourceNamePtr = 000H +GenParseRelatedNamePtr = 002H +GenParseDefaultsPtr = 004H +GenParseTargetNamePtr = 006H +GenParseInfoPtr = 008H +GenParseDeviceSeparator = 00AH +GenParsePathSeparator = 00BH +GenParseExtSeparator = 00CH +GenParseMaxDeviceSize = 00DH +GenParseMaxPathSize = 00EH +GenParseMaxNameSize = 00FH +GenParseMaxExtSize = 010H +GenParseDummy = 011H +GenParseEnt = 012H +MemLength = 000H +MemNext = 002H +MemEnt = 004H +MessNext = 000H +MessStatusPtr = 002H +MessType = 004H +MessPid = 006H +MessEnt = 008H +NodeVersionNo = 000H +NodeType = 002H +NodeSupportsFormat = 004H +NodeStatusSpare = 006H +NodeEnt = 020H +ProcQue = 000H +ProcDeltaType = 008H +ProcAddressTrap = 009H +ProcStatus = 00AH +ProcSStatus = 00BH +ProcPriority = 00CH +ProcPriorityH = 00DH +ProcRamOrRom = 00EH +ProcTask = 00FH +ProcName = 010H +ProcActive = 01DH +ProcSemaphore = 01EH +ProcSemHead = 020H +ProcMemBasePtr = 022H +ProcMemGrowBy = 024H +ProcMCtrlPtr = 026H +ProcMinHeap = 028H +ProcFServer = 02AH +ProcDataSeg = 02CH +ProcCodeSeg = 02EH +ProcSavedSP = 030H +ProcSavedBP = 032H +ProcNotify = 034H +ProcSpare = 035H +ProcMagicNumber = 036H +ProcChecksum = 038H +ProcMTerminate = 03AH +ProcEnt = 03CH +QueNext = 000H +QuePrev = 002H +QueKey = 004H +QueData = 006H +QueEnt = 008H +SegBase = 000H +SegAccessCount = 002H +SegName = 004H +SegEnt = 012H +ConKeyValue = 000H +ConModifiers = 002H +ConCount = 003H +ConEnt = 004H +FsyFileQ = 000H +FsyFileSystem = 004H +FsyFileName = 006H +FsyFileMode = 008H +ChanSignature = 000H +ChanNext = 002H +ChanLibHandle = 004H +ChanEnt = 006H +FilChan = 000H +FilHandle = ChanEnt + +BufferCompare = 0A3H +BufferCompareFolded = 0A4H +BufferCopy = 0A1H +BufferJustify = 0ABH +BufferLocate = 0A7H +BufferLocateFolded = 0A8H +BufferMatch = 0A5H +BufferMatchFolded = 0A6H +BufferSubBuffer = 0A9H +BufferSubBufferFolded = 0AAH +BufferSwap = 0A2H +CharIsAlphaNumeric = 097H +CharIsAlphabetic = 096H +CharIsControl = 09DH +CharIsDigit = 093H +CharIsGraphic = 09CH +CharIsHexDigit = 094H +CharIsLowerCase = 099H +CharIsPrintable = 095H +CharIsPunctuation = 09BH +CharIsSpace = 09AH +CharIsUpperCase = 098H +CharToFoldedChar = 0A0H +CharToLowerChar = 09FH +CharToUpperChar = 09EH +ConvManager = 08AH +DbfManager = 0D8H +DevManager = 085H +WservOpcodes = 08DH +Dummy = 0D4H +FilManager = 087H +FloatAdd = 0C1H +FloatCompare = 0C5H +FloatDivide = 0C4H +FloatManager = 08CH +FloatMultiply = 0C3H +FloatNegate = 0C6H +FloatSubtract = 0C2H +FloatToInt = 0C7H +FloatToLong = 0C9H +FloatToUnsignedInt = 0C8H +FloatToUnsignedLong = 0CAH +GenDataSegment = 08FH +GenIntByNumber = 0D5H +GenManager = 08BH +HardwareManager = 08EH +HeapManager = 081H +IntToFloat = 0CBH +IoManager = 086H +IoNextHalfSecondStatus = 0DDH +IoSerManager = 0DEH +LibEnter = 0D2H +LibEnterSend = 0D9H +LibLeave = 0D3H +LibManager = 084H +LibSend = 0CFH +LibSendExact = 0D1H +LibSendExit = 0D7H +LibSendSuper = 0D0H +LongIntCompare = 0BBH +LongIntDivide = 0BDH +LongIntMultiply = 0BCH +LongToFloat = 0CDH +LongUnsignedIntCompare = 0BEH +LongUnsignedIntDivide = 0C0H +LongUnsignedIntMultiply = 0BFH +MessManager = 083H +ProcCopyFromById = 091H +ProcCopyToById = 092H +ProcIndStringCopyFromById = 0DCH +ProcManager = 088H +ProcPanic = 090H +SegManager = 080H +SemManager = 082H +StringCapitilise = 0DBH +StringCompare = 0AFH +StringCompareFolded = 0B0H +StringConvertToFolded = 0AEH +StringCopy = 0ACH +StringCopyFolded = 0ADH +StringLength = 0B9H +StringLocate = 0B3H +StringLocateFolded = 0B4H +StringLocateInReverse = 0B5H +StringLocateInReverseFolded = 0B6H +StringMatch = 0B1H +StringMatchFolded = 0B2H +StringSubString = 0B7H +StringSubStringFolded = 0B8H +StringValidateName = 0BAH +TimManager = 089H +UnsignedIntToFloat = 0CCH +UnsignedLongToFloat = 0CEH +WservFunctions = 0D6H +WservOpcodes = 08DH +NmConvArgumentsToBuffer = 004H +NmConvFloatToBuffer = 009H +NmConvIntToBuffer = 002H +NmConvLongIntToBuffer = 003H +NmConvStringToFloat = 00AH +NmConvStringToInt = 007H +NmConvStringToLongInt = 008H +NmConvStringToUnsignedInt = 005H +NmConvStringToUnsignedLongInt = 006H +NmConvUnsignedIntToBuffer = 000H +NmConvUnsignedLongIntToBuffer = 001H +NmDbfAbsRead = 00CH +NmDbfAbsReadSense = 00BH +NmDbfAppend = 011H +NmDbfBackRead = 00EH +NmDbfClose = 001H +NmDbfCompress = 005H +NmDbfCopyDown = 004H +NmDbfCopyFile = 006H +NmDbfCount = 016H +NmDbfDescRecordRead = 017H +NmDbfDescRecordWrite = 018H +NmDbfEraseRead = 012H +NmDbfExtHeaderRead = 008H +NmDbfExtHeaderWrite = 009H +NmDbfFileSize = 007H +NmDbfFindRead = 014H +NmDbfFirstRead = 00FH +NmDbfFlush = 002H +NmDbfLastRead = 010H +NmDbfNextRead = 00DH +NmDbfOpen = 000H +NmDbfSense = 015H +NmDbfTrash = 003H +NmDbfUpdate = 013H +NmDbfVersion = 00AH +NmDevDelete = 008H +NmDevFind = 00AH +NmDevGetPDDAddress = 002H +NmDevHold = 004H +NmDevInstall = 003H +NmDevLoadLDD = 006H +NmDevLoadPDD = 007H +NmDevOpenPDD = 001H +NmDevQueryUnits = 009H +NmDevRemove = 00BH +NmDevResume = 005H +NmDevVector = 00CH +NmFilChangeDirectory = 011H +NmFilConnect = 000H +NmFilDelete = 006H +NmFilExecute = 001H +NmFilLocChanged = 014H +NmFilLocDevice = 015H +NmFilLocReadPdd = 016H +NmFilMakeDirectory = 00CH +NmFilOpenUnique = 00DH +NmFilParse = 002H +NmFilPathGet = 003H +NmFilPathGetById = 010H +NmFilPathSet = 004H +NmFilPathTest = 005H +NmFilRename = 007H +NmFilSetFileDate = 013H +NmFilSetInitialPath = 012H +NmFilStatusDevice = 00AH +NmFilStatusGet = 008H +NmFilStatusSet = 009H +NmFilStatusSystem = 00BH +NmFilSystemAttach = 00EH +NmFilSystemDetach = 00FH +NmFloatACos = 004H +NmFloatASin = 003H +NmFloatATan = 005H +NmFloatCos = 001H +NmFloatExp = 006H +NmFloatInt = 00DH +NmFloatLn = 007H +NmFloatLog = 008H +NmFloatMod = 00CH +NmFloatPow = 00AH +NmFloatRand = 00BH +NmFloatSin = 000H +NmFloatSqrt = 009H +NmFloatTan = 002H + +NmGenVersion = 000H +NmGenLcdType = 001H +NmGenStartReason = 002H +NmGenParse = 003H +NmGenGetCountryData = 005H +NmGenGetErrorText = 006H +NmGenGetOsData = 007H +NmGenDeferredMode = 008H +NmGenNotify = 009H +NmGenNotifyError = 00AH +NmGenNotifyHook = 00BH +NmGenNotifyUnHook = 00CH +NmGenGetRamSizeInParas = 00DH +NmGenGetCommandLine = 00EH +NmGenGetSoundFlags = 00FH +NmGenSetSoundFlags = 010H +NmGenSound = 011H +NmGenMarkActive = 012H +NmGenMarkNonActive = 013H +NmGenGetText = 014H +NmGenGetNotifyState = 015H +NmGenSetNotifyState = 016H +NmGenGetAutoSwitchOffValue = 017H +NmGenSetAutoSwitchOffValue = 018H +NmGenSetRevector = 019H +NmGenResetRevector = 01AH +NmGenGetLanguageCode = 01BH +NmGenGetSuffixes = 01CH +NmGenGetAmPmText = 01DH +NmGenSetCountryData = 01EH +NmGenGetBatteryType = 01FH +NmGenSetBatteryType = 020H +NmGenEnvBufferGet = 021H +NmGenEnvBufferSet = 022H +NmGenEnvBufferDelete = 023H +NmGenEnvBufferFind = 024H +NmGenEnvStringGet = 025H +NmGenEnvStringSet = 026H +NmGenEnvStringDelete = 027H +NmGenEnvStringFind = 028H +NmGenCrc = 029H +NmGenRomVersion = 02AH +NmGenMaskInit = 034H +NmGenMaskEncrypt = 035H +NmGenMaskDecrypt = 036H +NmGenSetOnEvents = 037H +NmGenSetCapsLockMode = 03CH + +NmHeapAllocateCell = 000H +NmHeapReAllocateCell = 001H +NmHeapAdjustCellSize = 002H +NmHeapFreeCell = 003H +NmHeapCellSize = 004H +NmHeapSetGranularity = 005H +NmHeapFreeMemory = 006H + +NmHwComboOn = 000H +NmHwComboOff = 001H +NmHwPacksOn = 002H +NmHwPacksOff = 003H +NmHwSetA2Control1Bits = 004H +NmHwClearA2Control1Bits = 005H +NmHwReadA2Control1 = 006H +NmHwWriteA2Control1 = 007H +NmHwSetA2Control2Bits = 008H +NmHwClearA2Control2Bits = 009H +NmHwReadA2Control2 = 00AH +NmHwWriteA2Control2 = 00BH +NmHwSetA2Control3Bits = 00CH +NmHwClearA2Control3Bits = 00DH +NmHwReadA2Control3 = 00EH +NmHwWriteA2Control3 = 00FH +NmHwSelectChannel = 010H +NmHwGetSupplyStatus = 011H +NmHwLcdContrastDelta = 012H +NmHwReadLcdContrast = 013H +NmHwSwitchOff = 014H +NmHwNullFrame = 015H +NmHwExit = 016H +NmHwGetCombo = 017H +NmHwFreeCombo = 018H +NmHwGetChannel = 019H +NmHwFreeChannel = 01AH +NmHwGetPsuType = 01BH +NmHwSupplyWarnings = 01CH +NmHwForceSupplyReading = 01DH +NmHwGetBackLight = 01EH +NmHwSetBackLight = 01FH +NmHwBackLight = 020H +NmHwComboOnInput = 021H +NmHwSupplyInfo = 022H +NmHwScreenSeg = 023H +NmHwGetScreenMode = 024H +NmHwSetScreenMode = 025H +NmHwSetPCurrent = 026H +NmHwSetFCurrent = 027H +NmHwGetScanCodes = 028H +NmHwHwGetSsdData = 029H +NmHwResetBatteryStatus = 02AH +NmHwEnableAutoBatReset = 02BH +NmHwGetBatData = 02CH +NmHwDetectSoakTestFixture = 02DH +NmHwReLogPacks = 02EH +NmHwSetIRPowerLevel = 02FH +NmHwReturnTickCount = 030H +NmHwReturnExpansionPortState = 031H +NmHwExpansionOn = 032H +NmHwExpansionOff = 033H + +NmIoOpen = 000H +NmIoAsynchronous = 000H +NmIoAsynchronousNoError = 001H +NmIoWithWait = 002H +NmIoRoot = 003H +NmIoSuper = 004H +NmIoWaitForSignal = 005H +NmIoWaitForStatus = 006H +NmIoYield = 007H +NmIoSignal = 008H +NmIoSignalByPid = 009H +NmIoSignalByPidNoReSched = 00AH +NmIoAddHandler = 00BH +NmIoRemoveHandler = 00CH +NmIoEnableHandler = 00DH +NmIoRequestReset = 00EH +NmIoRequestResetCancel = 00FH +NmIoClose = 010H +NmIoRead = 011H +NmIoWrite = 012H +NmIoSeek = 013H +NmIoKeyAndMouseWithWait = 014H +NmIoAddApplicationHandler = 015H +NmIoRemoveApplicationHandler = 016H +NmIoEnableApplicationHandler = 017H +NmIoShiftStates = 018H +NmIoWaitForSignalNoHandler = 019H +NmIoSignalKillAsynchronous = 01AH +NmIoSignalKillCancel = 01BH +NmIoNextHalfSecond = 01DH +NmIoPlaySoundA = 01EH +NmIoPlaySoundW = 01FH +NmIoPlaySoundCancel = 020H +NmIoRecordSoundA = 021H +NmIoRecordSoundW = 022H +NmIoRecordSoundCancel = 023H +NmIoPlaySoundAO = 024H +NmIoPlaySoundWO = 025H + +NmIoSerAddHandler = 001H +NmIoSerAttachOnOpenChan = 00DH +NmIoSerCancelAllSignalUser = 01CH +NmIoSerCancelIoRequest = 01BH +NmIoSerCheckReadSi = 011H +NmIoSerCheckWriteSi = 010H +NmIoSerCloseTimerHandler = 008H +NmIoSerDetachFree = 009H +NmIoSerFree = 007H +NmIoSerHandlerSaveError = 004H +NmIoSerOnOpenChan = 00FH +NmIoSerOpen = 000H +NmIoSerOpenHandler = 005H +NmIoSerOpenTimerHandler = 006H +NmIoSerQueueRead = 017H +NmIoSerQueueSuper = 019H +NmIoSerQueueTimer = 01AH +NmIoSerQueueWrite = 018H +NmIoSerRemoveHandler = 002H +NmIoSerSenseOnOpenChan = 00EH +NmIoSerSetHandler = 003H +NmIoSerSignalComplete = 01EH +NmIoSerSignalCompleteOk = 01DH +NmIoSerSignalUser = 016H +NmIoSerSignalUserRead = 015H +NmIoSerSignalUserReadOk = 014H +NmIoSerSignalUserWrite = 013H +NmIoSerSignalUserWriteOk = 012H +NmIoSerSyncWrite = 01FH +NmIoSerTimerCancel = 00BH +NmIoSerTimerClose = 00CH +NmIoSerTimerOpen = 00AH +NmLibCopy = 008H +NmLibCreate = 005H +NmLibCreateByHandle = 006H +NmLibDestroy = 007H +NmLibFind = 003H +NmLibHandle = 004H +NmLibLink = 002H +NmLibLoad = 000H +NmLibLoadFile = 00AH +NmLibOpen = 009H +NmLibReClass = 00BH +NmLibReClassByHandle = 00CH +NmLibUnLoad = 001H +NmLongUnsignedIntRandom = 004H +NmMessFree = 007H +NmMessInit = 000H +NmMessReceiveAsynchronous = 001H +NmMessReceiveCancel = 003H +NmMessReceiveWithWait = 002H +NmMessSend = 004H +NmMessSendReceiveAsynchronous = 005H +NmMessSendReceiveWithWait = 006H +NmMessSignal = 008H +NmMessSignalCancel = 009H +NmProcCreate = 004H +NmProcCreateTask = 005H +NmProcFind = 00BH +NmProcGetOwner = 010H +NmProcGetPriority = 002H +NmProcId = 000H +NmProcIdByName = 001H +NmProcKill = 008H +NmProcNameById = 00AH +NmProcOnTerminate = 00EH +NmProcPanicById = 009H +NmProcRename = 00CH +NmProcResume = 006H +NmProcSetPriority = 003H +NmProcSuspend = 007H +NmProcTerminate = 00DH +NmProcWatchAllExits = 00FH +NmSegAdjustSize = 006H +NmSegClose = 004H +NmSegCloseLockedOrDevice = 00DH +NmSegCopyFrom = 009H +NmSegCopyTo = 008H +NmSegCreate = 001H +NmSegDelete = 002H +NmSegFind = 007H +NmSegFreeMemory = 000H +NmSegLock = 00AH +NmSegOpen = 003H +NmSegRamDiskUsed = 00CH +NmSegSize = 005H +NmSegUnLock = 00BH +NmSemCreate = 000H +NmSemDelete = 001H +NmSemSignalMany = 004H +NmSemSignalOnce = 003H +NmSemSignalOnceNoReSched = 005H +NmSemWait = 002H +NmTimDateToDaySeconds = 007H +NmTimDayOfWeek = 009H +NmTimDaySecondsToDate = 006H +NmTimDaySecondsToSystemTime = 005H +NmTimDaysInMonth = 008H +NmTimGetSystemTime = 002H +NmTimNameOfDay = 00AH +NmTimNameOfMonth = 00BH +NmTimSetSystemTime = 003H +NmTimSleepForTenths = 000H +NmTimSleepForTicks = 001H +NmTimSystemTimeToDaySeconds = 004H +NmTimWaitAbsolute = 00CH +NmTimWeekNumber = 00DH + +FatalOpenConsole = -1 +FatalMathException = -2 +FatalStackCheck = -3 +FatalSignal = -4 +FatalInitIo = -5 +FatalConIo = -6 + +wserv_spec_info_version = 13 + +Datawserv_channel = 24 diff --git a/code/SIBOSDK/include/errno.h b/code/SIBOSDK/include/errno.h new file mode 100644 index 0000000..08a2db2 --- /dev/null +++ b/code/SIBOSDK/include/errno.h @@ -0,0 +1,108 @@ +/* Release 3.00 */ + +/*-------------------------------------------------------------------------* +* * +* errno.h - defines variable errno and associated error codes. * +* * +* COPYRIGHT (C) 1989 Jensen and Partners. All Rights Reserved * +* * +*--------------------------------------------------------------------------*/ +#include + +#ifndef _ERRNO_INC_ +#define _ERRNO_INC_ + +/* Dos Error Codes */ + +#ifdef OLDERRORS +#define EZERO 0 /* No Error */ +#define EINVFN 1 /* Invalid function code */ +#define ENOENT 2 /* File not found */ +#define ENOPATH 3 /* Path not found */ +#define EMFILE 4 /* Too many open files */ +#define EACCES 5 /* Access denied */ +#define EBADF 6 /* Invalid handle */ +#define E2BIG 7 /* Memory blocks destroyed */ +#define ENOMEM 8 /* Insufficient Memory */ +#define EINVMEM 9 /* Invalid memory block address */ +#define EINVENV 10 /* Invalid environment */ +#define EINVFMT 11 /* Invalid format */ +#define EINVACC 12 /* Invalid access code */ +#define EINVDAT 13 /* Invalid data */ +#define ENODEV 15 /* Invalid drive */ +#define ECURDIR 16 /* Attempt to remove CurDir */ +#define ENOTSAM 17 /* Not same device */ +#define ENMFILE 18 /* No more files */ + +/* RTL error codes */ + +#define EINVAL 19 /* Invalid argument */ +#define ENOTDIR 20 /* Not directory */ +#define EISDIR 21 /* Is directory */ +#define ENOEXEC 22 /* Corrupted exec file */ +#define EMLINK 32 /* Cross-device link */ + +#define EDOM 33 /* Math argument */ +#define ERANGE 34 /* Result too large */ +#define EDEADLOCK 36 /* file locking deadlock */ +#define EEXIST 80 /* File exists MSDOS 3.0 + */ +#define ENOSPC -1 /* UNIX - not in MSDOS */ +#else +#define EZERO 0 /* No Error */ +#define ENOENT (-33) /* File not found */ +#define ENOPATH (-42) /* Path not found */ +#define EMFILE (-18) /* Too many open files */ +#define EACCES (-39) /* Access denied */ +#define EBADF (-15) /* Invalid handle */ +#define E2BIG (-6) /* Memory blocks destroyed */ +#define ENOMEM (-10) /* Insufficient Memory */ +#define ENODEV (-41) /* Invalid drive */ +#define ECURDIR (-9) /* Attempt to remove CurDir */ +#define ENMFILE (-36) /* No more files */ +#define ENOSPC (-37) /* Disk full */ + +/* RTL error codes */ + +#define EINVAL (-2) /* Invalid argument */ +#define ENOEXEC (-16) /* Corrupted exec file */ +#define EMLINK (-66) /* Cross-device link */ + +#define EDOM (-2) /* Math argument */ +#define ERANGE (-7) /* Result too large */ +#define EDEADLOCK (-40) /* file locking deadlock */ +#define EEXIST (-32) /* File exists MSDOS 3.0 + */ + +#define ENOTSAM (-1) /* Not same device */ +#define ENOTDIR (-1) /* Not directory */ +#define EISDIR (-1) /* Is directory */ +#define EINVFN (-1) /* Invalid function code */ +#define EINVMEM (-1) /* Invalid memory block address */ +#define EINVENV (-1) /* Invalid environment */ +#define EINVFMT (-1) /* Invalid format */ +#define EINVACC (-1) /* Invalid access code */ +#define EINVDAT (-1) /* Invalid data */ +#endif + +#define EFAULT (-1) /* Unknown error */ +#define EPERM (-1) /* UNIX - not in MSDOS */ +#define ESRCH (-1) /* UNIX - not in MSDOS */ +#define EINTR (-1) /* UNIX - not in MSDOS */ +#define EIO (-1) /* UNIX - not in MSDOS */ +#define ENXIO (-1) /* UNIX - not in MSDOS */ +#define ECHILD (-1) /* UNIX - not in MSDOS */ +#define EAGAIN (-1) /* UNIX - not in MSDOS */ +#define ENOTBLK (-1) /* UNIX - not in MSDOS */ +#define EBUSY (-1) /* UNIX - not in MSDOS */ +#define ENFILE (-1) /* UNIX - not in MSDOS */ +#define ENOTTY (-1) /* UNIX - not in MSDOS */ +#define ETXTBSY (-1) /* UNIX - not in MSDOS */ +#define EFBIG (-1) /* UNIX - not in MSDOS */ +#define ESPIPE (-1) /* UNIX - not in MSDOS */ +#define EROFS (-1) /* UNIX - not in MSDOS */ +#define EPIPE (-1) /* UNIX - not in MSDOS */ +#define EUCLEAN (-1) /* UNIX - not in MSDOS */ + +extern int _doserrno; /* global DOS error variable */ +extern int errno; /* global error variable */ + +#endif diff --git a/code/SIBOSDK/include/evaldlg.g b/code/SIBOSDK/include/evaldlg.g new file mode 100644 index 0000000..4fb6ca4 --- /dev/null +++ b/code/SIBOSDK/include/evaldlg.g @@ -0,0 +1,30 @@ +/* Generated by Ctran from evaldlg.cl */ +#define EVALDLG_G +#ifndef DLGBOX_G +#include +#endif +#ifndef P_SYS_H +#include +#endif +#ifndef H_EVAL_H +#include +#endif +/* Class Numbers */ +#define C_EVALDLG 58 +/* Method Numbers */ +/* Constants for evaldlg */ +#define EVALDLG_CALCULATOR_EVALUATOR 0 +#define EVALDLG_GENERAL_EVALUATOR 1 +/* Property of evaldlg */ +typedef struct { +short int isEval; +EXTENDED_MEM_VALUES eMem; +} PRS_EVALDLG; +typedef struct pr_evaldlg +{ +PRS_ROOT root; +PRS_WIN win; +PRS_DLGCHAIN dlgchain; +PRS_DLGBOX dlgbox; +PRS_EVALDLG evaldlg; +} PR_EVALDLG; diff --git a/code/SIBOSDK/include/evaldlg.ing b/code/SIBOSDK/include/evaldlg.ing new file mode 100644 index 0000000..f61e3cc --- /dev/null +++ b/code/SIBOSDK/include/evaldlg.ing @@ -0,0 +1,29 @@ +; Generated by Ctran from evaldlg.cl +EVALDLG_ING equ 1 +IFNDEF DLGBOX_ING + INCLUDE ..\inc\DLGBOX.ING +ENDIF +IFNDEF P_SYS_INC + INCLUDE ..\inc\P_SYS.INC +ENDIF +IFNDEF H_EVAL_INC + INCLUDE ..\inc\H_EVAL.INC +ENDIF +; Class Numbers +C_EVALDLG equ 58 +; Method Numbers +; Constants for evaldlg +EVALDLG_CALCULATOR_EVALUATOR equ (0) +EVALDLG_GENERAL_EVALUATOR equ (1) +; Property of evaldlg +PRS_EVALDLG struc +EvaldlgIsEval dw ? +EvaldlgEMem EXTENDED_MEM_VALUES <> +PRS_EVALDLG ends +PR_EVALDLG struc +EvaldlgRoot PRS_ROOT <> +EvaldlgWin PRS_WIN <> +EvaldlgDlgchain PRS_DLGCHAIN <> +EvaldlgDlgbox PRS_DLGBOX <> +EvaldlgEvaldlg PRS_EVALDLG <> +PR_EVALDLG ends diff --git a/code/SIBOSDK/include/factive.g b/code/SIBOSDK/include/factive.g new file mode 100644 index 0000000..bf7c1bb --- /dev/null +++ b/code/SIBOSDK/include/factive.g @@ -0,0 +1,348 @@ +/* Generated by Ctran from factive.cat */ +#define FACTIVE_G +#ifndef APPMAN_G +#include +#endif +#ifndef P_FILE_H +#include +#endif +/* Class Numbers */ +#define C_FACTIVE 25 +#define C_FSCAN 26 +#define C_FNODE 27 +#define C_PNODE 28 +#define C_PSELVAR 29 +#define C_PSEL 30 +#define C_FCASY 31 +#define C_FCSYNC 32 +#define C_FMMK 33 +#define C_FMSRC 34 +#define C_FMTARG 35 +#define C_FMFMT 36 +#define C_FMSCAN 37 +#define C_FMAN 38 +#define C_LOCS 39 +/* Method Numbers */ +#define O_FMAN_DELETE 4 +#define O_FMAN_ERROR 17 +#define O_FS_MATCHNAME 7 +#define O_LS_MATCHNAME 1 +#define O_FS_DIRNAME 10 +#define O_PS_SET_PATH 16 +#define O_FMAN_NAME 10 +#define O_FMAN_FORMAT 9 +#define O_PS_SETTAG 20 +#define O_FMAN_ATTRIB 12 +#define O_FS_END_DIRLIST 12 +#define O_FC_REQUEST_COMP 9 +#define O_FMAN_FILEEXIST 16 +#define O_FN_LIST 7 +#define O_FMAN_RENAME 5 +#define O_FMAN_UPDATE 15 +#define O_FMAN_NEWNAME 14 +#define O_PS_SELECT_DIRENTRY 18 +#define O_FMAN_COMPLETE 13 +#define O_LS_SCAN 2 +#define O_PS_DRIVES 19 +#define O_FS_FSCAN 8 +#define O_FMAN_INFO 11 +#define O_PS_NEW_LIST 23 +#define O_FC_OPEN 8 +#define O_PS_SENSE_FILENAME 17 +#define O_PS_GETTAG 21 +#define O_FMAN_COPY 3 +#define O_PS_DESCEND_PATH 15 +#define O_FMAN_MAKE 6 +#define O_FMAN_CANCEL 2 +#define O_PS_ASCEND_PATH 14 +#define O_PS_ORDER 22 +#define O_FN_END_LIST 8 +#define O_FMAN_REMOVE 7 +#define O_FN_NODENAME 9 +#define O_FC_WRITE 7 +#define O_FS_FILENAME 11 +#define O_PS_GET_FILE 13 +#define O_LS_FILENAME 3 +#define O_FMAN_INIT 1 +#define O_FA_CLOSE 6 +#define O_FMAN_COPYDEV 8 +#define O_FS_FSCAN_END 9 +/* Property of factive */ +typedef struct { +unsigned char *owner; +} PRS_FACTIVE; +typedef struct pr_factive +{ +PRS_ROOT root; +PRS_ACTIVE active; +PRS_FACTIVE factive; +} PR_FACTIVE; +/* Constants for fscan */ +#define FS_WRITABLE P_FAWRITE +#define FS_HIDDEN P_FAHIDDEN +#define FS_SYSTEM P_FASYSTEM +#define FS_DIRECTORIES P_FADIR +#define FS_MODIFIED P_FAMOD +#define FS_ALL_FILES P_FAREAD +#define FS_FILE_TYPE (FS_HIDDEN|FS_SYSTEM) +#define FS_INCLUDE_SUBDIRECTORIES 0x1000 +#define FS_INCLUDE 0x2000 +#define FS_END_DIRLIST 0x4000 +#define FS_PARSE_NAME 0x8000 +#define FS_MAX_DIRLEVELS 32 +/* Property of fscan */ +typedef struct { +unsigned short int flags; +unsigned short int index; +unsigned char *pname; +unsigned char *match; +unsigned char delim[2]; +P_INFO finfo; +P_FPARSE crk; +unsigned char *pcbarr[FS_MAX_DIRLEVELS]; +unsigned char name[P_FNAMESIZE]; +} PRS_FSCAN; +typedef struct pr_fscan +{ +PRS_ROOT root; +PRS_ACTIVE active; +PRS_FACTIVE factive; +PRS_FSCAN fscan; +} PR_FSCAN; +/* Constants for fnode */ +#define FNODE_NODE_ARRAY 0x01 +#define FNODE_DEVICE_ARRAY 0x02 +#define FNODE_LOCAL_ONLY 0x04 +/* Property of fnode */ +typedef struct { +unsigned short int flags; +unsigned char *pname; +unsigned char *oldname; +unsigned char *pcb; +} PRS_FNODE; +typedef struct pr_fnode +{ +PRS_ROOT root; +PRS_ACTIVE active; +PRS_FACTIVE factive; +PRS_FNODE fnode; +} PR_FNODE; +/* Property of pnode */ +typedef struct pr_pnode +{ +PRS_ROOT root; +PRS_ACTIVE active; +PRS_FACTIVE factive; +PRS_FNODE fnode; +} PR_PNODE; +/* Constants for pselvar */ +#define PSEL_FLAG_TAG 0x1 +#define PSEL_ORDER_NAME 0 +#define PSEL_ORDER_TIME 1 +#define PSEL_ORDER_DATE 2 +#define PSEL_ORDER_SIZE 3 +#define PSEL_ORDER_EXT 4 +/* Types for pselvar */ +typedef struct +{ +unsigned short int flags; +unsigned short int namlen; +P_INFO info; +unsigned char name[P_FNAMESIZE]; +} PSEL_REC; +/* Property of pselvar */ +typedef struct pr_pselvar +{ +PRS_ROOT root; +PRS_VAROOT varoot; +PRS_VAFIX vafix; +PRS_VAFLAT vaflat; +} PR_PSELVAR; +/* Constants for psel */ +#define PSEL_RESET_DIR_ARRAY 0x01 +#define PSEL_RESET_FILE_ARRAY 0x02 +#define PSEL_RESET_FSPEC 0x04 +#define PSEL_DEVICE_ARRAY 0x10 +#define PSEL_DIR_ARRAY 0x20 +#define PSEL_FILE_ARRAY 0x40 +#define PSEL_DESCEND 0x80 +#define PSEL_ASCEND 0x100 +#define PSEL_SETPATH 0x200 +#define PSEL_INIT 0x400 +#define PSEL_SELDIR 0x800 +#define PSEL_ANOTHER_CMD 0x1000 +#define PSEL_GENERATE_DEF 0x2000 +#define PSEL_QUEUED_CMD 0x4000 +#define PSEL_CURRENTLY_BUSY (0x100|0x80|0x400|0x200|0x800) +#define PSEL_SET_TAG -1 +#define PSEL_CLEAR_TAG 0 +#define PSEL_TOGGLE_TAG 1 +/* Property of psel */ +typedef struct { +PR_PSELVAR *pfile; +PR_VASTR *pdir; +PR_PNODE *pnode; +unsigned short int dirent; +unsigned short int flags; +unsigned short int asccnt; +unsigned short int dirnum; +unsigned char *setpath; +short int builderr; +P_FPARSE fck; +char fspec[P_FNAMESIZE]; +} PRS_PSEL; +typedef struct pr_psel +{ +PRS_ROOT root; +PRS_ACTIVE active; +PRS_FACTIVE factive; +PRS_FSCAN fscan; +PRS_PSEL psel; +} PR_PSEL; +/* Constants for fcasy */ +#define FCOPY_DISP_SFTYPE 0x01 +#define FCOPY_DISP_SFSIZE 0x02 +#define FCOPY_DISP_SFDATE 0x04 +#define FCOPY_DISP_SFNAME 0x08 +#define FCOPY_DISP_RFTYPE 0x10 +#define FCOPY_DISP_RFSIZE 0x20 +#define FCOPY_DISP_RFDATE 0x40 +#define FCOPY_DISP_RFNAME 0x80 +#define FCOPY_DISP_BLKSIZ 0x100 +#define FCOPY_DISP_BLKNO 0x200 +#define FCOPY_DISP_PROTOCOL 0x400 +#define FCASY_READ_QUEUED 0x01 +#define FCASY_WRITE_QUEUED 0x02 +/* Types for fcasy */ +typedef struct +{ +unsigned short int flags; +unsigned short int protocol; +unsigned short int blksiz; +unsigned short int blkno; +unsigned short int sftype; +unsigned short int rftype; +unsigned long int sfsize; +unsigned long int rfsize; +unsigned long int sfdate; +unsigned long int rfdate; +unsigned char *sfname; +unsigned char *rfname; +} FCOPY_DISP; +/* Property of fcasy */ +typedef struct { +unsigned char *recvname; +unsigned short int flags; +} PRS_FCASY; +typedef struct pr_fcasy +{ +PRS_ROOT root; +PRS_ACTIVE active; +PRS_FACTIVE factive; +PRS_FCASY fcasy; +} PR_FCASY; +/* Property of fcsync */ +typedef struct pr_fcsync +{ +PRS_ROOT root; +PRS_ACTIVE active; +PRS_FACTIVE factive; +PRS_FCASY fcasy; +} PR_FCSYNC; +/* Property of fmmk */ +typedef struct pr_fmmk +{ +PRS_ROOT root; +PRS_ACTIVE active; +PRS_FACTIVE factive; +} PR_FMMK; +/* Property of fmsrc */ +typedef struct pr_fmsrc +{ +PRS_ROOT root; +PRS_ACTIVE active; +PRS_FACTIVE factive; +PRS_FCASY fcasy; +} PR_FMSRC; +/* Property of fmtarg */ +typedef struct pr_fmtarg +{ +PRS_ROOT root; +PRS_ACTIVE active; +PRS_FACTIVE factive; +PRS_FCASY fcasy; +} PR_FMTARG; +/* Constants for fmfmt */ +#define FMFMT_NAME 0x01 +/* Property of fmfmt */ +typedef struct { +unsigned short int rdword; +unsigned short int rdlen; +unsigned short int flags; +} PRS_FMFMT; +typedef struct pr_fmfmt +{ +PRS_ROOT root; +PRS_ACTIVE active; +PRS_FACTIVE factive; +PRS_FMFMT fmfmt; +} PR_FMFMT; +/* Property of fmscan */ +typedef struct pr_fmscan +{ +PRS_ROOT root; +PRS_ACTIVE active; +PRS_FACTIVE factive; +PRS_FSCAN fscan; +} PR_FMSCAN; +/* Constants for fman */ +#define FMAN_READ_SIZE 0x800 +#define FMAN_COPYING 0 +#define FMAN_DELETE 1 +#define FMAN_RENAME 2 +#define FMAN_MAKE 3 +#define FMAN_REMOVE 4 +#define FMAN_FORMAT 5 +#define FMAN_NAME 6 +#define FMAN_ATTRIB 7 +/* Property of fman */ +typedef struct { +PR_FMSRC *srcfile; +PR_FMTARG *targfile; +PR_FMSCAN *fmscan; +PR_FMMK *fmmk; +PR_FMFMT *fmfmt; +unsigned short int action; +unsigned short int mode; +unsigned short int srclen; +FCOPY_DISP dispinfo; +unsigned char targname[P_FNAMESIZE]; +unsigned char wildsrcname[P_FNAMESIZE]; +unsigned char wildtargname[P_FNAMESIZE]; +unsigned char buf[FMAN_READ_SIZE]; +} PRS_FMAN; +typedef struct pr_fman +{ +PRS_ROOT root; +PRS_FMAN fman; +} PR_FMAN; +/* Constants for locs */ +#define LOCS_FLG_ROM 0x1000 +#define LOCS_FLG_LOC 0x2000 +#define LOCS_FLG_ROOT (0x4000|LOCS_FLG_LOC) +#define LOCS_FLG_ROOT_ONLY 0x4000 +/* Property of locs */ +typedef struct { +unsigned short int flags; +unsigned char *pcb; +unsigned char *pname; +unsigned char *match; +P_INFO info; +unsigned char name[P_FNAMESIZE]; +unsigned char wildname[P_FNAMESIZE]; +} PRS_LOCS; +typedef struct pr_locs +{ +PRS_ROOT root; +PRS_LOCS locs; +} PR_LOCS; diff --git a/code/SIBOSDK/include/factive.ing b/code/SIBOSDK/include/factive.ing new file mode 100644 index 0000000..4dfcac2 --- /dev/null +++ b/code/SIBOSDK/include/factive.ing @@ -0,0 +1,331 @@ +; Generated by Ctran from factive.cat +FACTIVE_ING equ 1 +IFNDEF APPMAN_ING + INCLUDE ..\inc\APPMAN.ING +ENDIF +IFNDEF P_FILE_INC + INCLUDE ..\inc\P_FILE.INC +ENDIF +; Class Numbers +C_FACTIVE equ 25 +C_FSCAN equ 26 +C_FNODE equ 27 +C_PNODE equ 28 +C_PSELVAR equ 29 +C_PSEL equ 30 +C_FCASY equ 31 +C_FCSYNC equ 32 +C_FMMK equ 33 +C_FMSRC equ 34 +C_FMTARG equ 35 +C_FMFMT equ 36 +C_FMSCAN equ 37 +C_FMAN equ 38 +C_LOCS equ 39 +; Method Numbers +O_FMAN_DELETE equ 4 +O_FMAN_ERROR equ 17 +O_FS_MATCHNAME equ 7 +O_LS_MATCHNAME equ 1 +O_FS_DIRNAME equ 10 +O_PS_SET_PATH equ 16 +O_FMAN_NAME equ 10 +O_FMAN_FORMAT equ 9 +O_PS_SETTAG equ 20 +O_FMAN_ATTRIB equ 12 +O_FS_END_DIRLIST equ 12 +O_FC_REQUEST_COMP equ 9 +O_FMAN_FILEEXIST equ 16 +O_FN_LIST equ 7 +O_FMAN_RENAME equ 5 +O_FMAN_UPDATE equ 15 +O_FMAN_NEWNAME equ 14 +O_PS_SELECT_DIRENTRY equ 18 +O_FMAN_COMPLETE equ 13 +O_LS_SCAN equ 2 +O_PS_DRIVES equ 19 +O_FS_FSCAN equ 8 +O_FMAN_INFO equ 11 +O_PS_NEW_LIST equ 23 +O_FC_OPEN equ 8 +O_PS_SENSE_FILENAME equ 17 +O_PS_GETTAG equ 21 +O_FMAN_COPY equ 3 +O_PS_DESCEND_PATH equ 15 +O_FMAN_MAKE equ 6 +O_FMAN_CANCEL equ 2 +O_PS_ASCEND_PATH equ 14 +O_PS_ORDER equ 22 +O_FN_END_LIST equ 8 +O_FMAN_REMOVE equ 7 +O_FN_NODENAME equ 9 +O_FC_WRITE equ 7 +O_FS_FILENAME equ 11 +O_PS_GET_FILE equ 13 +O_LS_FILENAME equ 3 +O_FMAN_INIT equ 1 +O_FA_CLOSE equ 6 +O_FMAN_COPYDEV equ 8 +O_FS_FSCAN_END equ 9 +; Property of factive +PRS_FACTIVE struc +FactiveOwner dw ? +PRS_FACTIVE ends +PR_FACTIVE struc +FactiveRoot PRS_ROOT <> +FactiveActive PRS_ACTIVE <> +FactiveFactive PRS_FACTIVE <> +PR_FACTIVE ends +; Constants for fscan +FS_WRITABLE equ (P_FAWRITE) +FS_HIDDEN equ (P_FAHIDDEN) +FS_SYSTEM equ (P_FASYSTEM) +FS_DIRECTORIES equ (P_FADIR) +FS_MODIFIED equ (P_FAMOD) +FS_ALL_FILES equ (P_FAREAD) +FS_FILE_TYPE equ (FS_HIDDEN or FS_SYSTEM) +FS_INCLUDE_SUBDIRECTORIES equ (01000h) +FS_INCLUDE equ (02000h) +FS_END_DIRLIST equ (04000h) +FS_PARSE_NAME equ (08000h) +FS_MAX_DIRLEVELS equ (32) +; Property of fscan +PRS_FSCAN struc +FscanFlags dw ? +FscanIndex dw ? +FscanPname dw ? +FscanMatch dw ? +FscanDelim db (1) * 2 dup (?) +FscanFinfo P_INFO <> +FscanCrk P_FPARSE <> +FscanPcbarr dw FS_MAX_DIRLEVELS dup (?) +FscanName db (1) * P_FNAMESIZE dup (?) +PRS_FSCAN ends +PR_FSCAN struc +FscanRoot PRS_ROOT <> +FscanActive PRS_ACTIVE <> +FscanFactive PRS_FACTIVE <> +FscanFscan PRS_FSCAN <> +PR_FSCAN ends +; Constants for fnode +FNODE_NODE_ARRAY equ (001h) +FNODE_DEVICE_ARRAY equ (002h) +FNODE_LOCAL_ONLY equ (004h) +; Property of fnode +PRS_FNODE struc +FnodeFlags dw ? +FnodePname dw ? +FnodeOldname dw ? +FnodePcb dw ? +PRS_FNODE ends +PR_FNODE struc +FnodeRoot PRS_ROOT <> +FnodeActive PRS_ACTIVE <> +FnodeFactive PRS_FACTIVE <> +FnodeFnode PRS_FNODE <> +PR_FNODE ends +; Property of pnode +PR_PNODE struc +PnodeRoot PRS_ROOT <> +PnodeActive PRS_ACTIVE <> +PnodeFactive PRS_FACTIVE <> +PnodeFnode PRS_FNODE <> +PR_PNODE ends +; Constants for pselvar +PSEL_FLAG_TAG equ (01h) +PSEL_ORDER_NAME equ (0) +PSEL_ORDER_TIME equ (1) +PSEL_ORDER_DATE equ (2) +PSEL_ORDER_SIZE equ (3) +PSEL_ORDER_EXT equ (4) +; Types for pselvar +PSEL_REC struc +PSEL_RECFlags dw ? +PSEL_RECNamlen dw ? +PSEL_RECInfo P_INFO <> +PSEL_RECName db (1) * P_FNAMESIZE dup (?) +PSEL_REC ends +; Property of pselvar +PR_PSELVAR struc +PselvarRoot PRS_ROOT <> +PselvarVaroot PRS_VAROOT <> +PselvarVafix PRS_VAFIX <> +PselvarVaflat PRS_VAFLAT <> +PR_PSELVAR ends +; Constants for psel +PSEL_RESET_DIR_ARRAY equ (001h) +PSEL_RESET_FILE_ARRAY equ (002h) +PSEL_RESET_FSPEC equ (004h) +PSEL_DEVICE_ARRAY equ (010h) +PSEL_DIR_ARRAY equ (020h) +PSEL_FILE_ARRAY equ (040h) +PSEL_DESCEND equ (080h) +PSEL_ASCEND equ (0100h) +PSEL_SETPATH equ (0200h) +PSEL_INIT equ (0400h) +PSEL_SELDIR equ (0800h) +PSEL_ANOTHER_CMD equ (01000h) +PSEL_GENERATE_DEF equ (02000h) +PSEL_QUEUED_CMD equ (04000h) +PSEL_CURRENTLY_BUSY equ (0100h or 080h or 0400h or 0200h or 0800h) +PSEL_SET_TAG equ (-1) +PSEL_CLEAR_TAG equ (0) +PSEL_TOGGLE_TAG equ (1) +; Property of psel +PRS_PSEL struc +PselPfile dw ? +PselPdir dw ? +PselPnode dw ? +PselDirent dw ? +PselFlags dw ? +PselAsccnt dw ? +PselDirnum dw ? +PselSetpath dw ? +PselBuilderr dw ? +PselFck P_FPARSE <> +PselFspec db (1) * P_FNAMESIZE dup (?) +PRS_PSEL ends +PR_PSEL struc +PselRoot PRS_ROOT <> +PselActive PRS_ACTIVE <> +PselFactive PRS_FACTIVE <> +PselFscan PRS_FSCAN <> +PselPsel PRS_PSEL <> +PR_PSEL ends +; Constants for fcasy +FCOPY_DISP_SFTYPE equ (001h) +FCOPY_DISP_SFSIZE equ (002h) +FCOPY_DISP_SFDATE equ (004h) +FCOPY_DISP_SFNAME equ (008h) +FCOPY_DISP_RFTYPE equ (010h) +FCOPY_DISP_RFSIZE equ (020h) +FCOPY_DISP_RFDATE equ (040h) +FCOPY_DISP_RFNAME equ (080h) +FCOPY_DISP_BLKSIZ equ (0100h) +FCOPY_DISP_BLKNO equ (0200h) +FCOPY_DISP_PROTOCOL equ (0400h) +FCASY_READ_QUEUED equ (001h) +FCASY_WRITE_QUEUED equ (002h) +; Types for fcasy +FCOPY_DISP struc +FCOPY_DISPFlags dw ? +FCOPY_DISPProtocol dw ? +FCOPY_DISPBlksiz dw ? +FCOPY_DISPBlkno dw ? +FCOPY_DISPSftype dw ? +FCOPY_DISPRftype dw ? +FCOPY_DISPSfsize dd ? +FCOPY_DISPRfsize dd ? +FCOPY_DISPSfdate dd ? +FCOPY_DISPRfdate dd ? +FCOPY_DISPSfname dw ? +FCOPY_DISPRfname dw ? +FCOPY_DISP ends +; Property of fcasy +PRS_FCASY struc +FcasyRecvname dw ? +FcasyFlags dw ? +PRS_FCASY ends +PR_FCASY struc +FcasyRoot PRS_ROOT <> +FcasyActive PRS_ACTIVE <> +FcasyFactive PRS_FACTIVE <> +FcasyFcasy PRS_FCASY <> +PR_FCASY ends +; Property of fcsync +PR_FCSYNC struc +FcsyncRoot PRS_ROOT <> +FcsyncActive PRS_ACTIVE <> +FcsyncFactive PRS_FACTIVE <> +FcsyncFcasy PRS_FCASY <> +PR_FCSYNC ends +; Property of fmmk +PR_FMMK struc +FmmkRoot PRS_ROOT <> +FmmkActive PRS_ACTIVE <> +FmmkFactive PRS_FACTIVE <> +PR_FMMK ends +; Property of fmsrc +PR_FMSRC struc +FmsrcRoot PRS_ROOT <> +FmsrcActive PRS_ACTIVE <> +FmsrcFactive PRS_FACTIVE <> +FmsrcFcasy PRS_FCASY <> +PR_FMSRC ends +; Property of fmtarg +PR_FMTARG struc +FmtargRoot PRS_ROOT <> +FmtargActive PRS_ACTIVE <> +FmtargFactive PRS_FACTIVE <> +FmtargFcasy PRS_FCASY <> +PR_FMTARG ends +; Constants for fmfmt +FMFMT_NAME equ (001h) +; Property of fmfmt +PRS_FMFMT struc +FmfmtRdword dw ? +FmfmtRdlen dw ? +FmfmtFlags dw ? +PRS_FMFMT ends +PR_FMFMT struc +FmfmtRoot PRS_ROOT <> +FmfmtActive PRS_ACTIVE <> +FmfmtFactive PRS_FACTIVE <> +FmfmtFmfmt PRS_FMFMT <> +PR_FMFMT ends +; Property of fmscan +PR_FMSCAN struc +FmscanRoot PRS_ROOT <> +FmscanActive PRS_ACTIVE <> +FmscanFactive PRS_FACTIVE <> +FmscanFscan PRS_FSCAN <> +PR_FMSCAN ends +; Constants for fman +FMAN_READ_SIZE equ (0800h) +FMAN_COPYING equ (0) +FMAN_DELETE equ (1) +FMAN_RENAME equ (2) +FMAN_MAKE equ (3) +FMAN_REMOVE equ (4) +FMAN_FORMAT equ (5) +FMAN_NAME equ (6) +FMAN_ATTRIB equ (7) +; Property of fman +PRS_FMAN struc +FmanSrcfile dw ? +FmanTargfile dw ? +FmanFmscan dw ? +FmanFmmk dw ? +FmanFmfmt dw ? +FmanAction dw ? +FmanMode dw ? +FmanSrclen dw ? +FmanDispinfo FCOPY_DISP <> +FmanTargname db (1) * P_FNAMESIZE dup (?) +FmanWildsrcname db (1) * P_FNAMESIZE dup (?) +FmanWildtargname db (1) * P_FNAMESIZE dup (?) +FmanBuf db (1) * FMAN_READ_SIZE dup (?) +PRS_FMAN ends +PR_FMAN struc +FmanRoot PRS_ROOT <> +FmanFman PRS_FMAN <> +PR_FMAN ends +; Constants for locs +LOCS_FLG_ROM equ (01000h) +LOCS_FLG_LOC equ (02000h) +LOCS_FLG_ROOT equ (04000h or LOCS_FLG_LOC) +LOCS_FLG_ROOT_ONLY equ (04000h) +; Property of locs +PRS_LOCS struc +LocsFlags dw ? +LocsPcb dw ? +LocsPname dw ? +LocsMatch dw ? +LocsInfo P_INFO <> +LocsName db (1) * P_FNAMESIZE dup (?) +LocsWildname db (1) * P_FNAMESIZE dup (?) +PRS_LOCS ends +PR_LOCS struc +LocsRoot PRS_ROOT <> +LocsLocs PRS_LOCS <> +PR_LOCS ends diff --git a/code/SIBOSDK/include/fcharge.h b/code/SIBOSDK/include/fcharge.h new file mode 100644 index 0000000..0099c96 --- /dev/null +++ b/code/SIBOSDK/include/fcharge.h @@ -0,0 +1,32 @@ +#define P_FCHG_UNKNOWN 0 +#define P_FCHG_NOTCHARGING 1 +#define P_FCHG_FASTCHARGING 2 +#define P_FCHG_TOPPINGOFF 3 +#define P_FCHG_TRICKLE 4 + +#define P_FCHG_DEFAULTCC 0x0000 +#define P_FCHG_CC100mA 0x1000 +#define P_FCHG_CC200mA 0x2000 +#define P_FCHG_CC350mA 0x3000 +#define P_FCHG_CC500mA 0x4000 +#define P_FCHG_CC650mA 0x5000 +#define P_FCHG_CC800mA 0x8000 +#define P_FCHG_CC1000mA 0xa000 +#define P_FCHG_CC1200mA 0xc000 +#define P_FCHG_CC1400mA 0xe000 + +#define P_FCHG_CTIME1C 2 +#define P_FCHG_CTIME2C 6 +#define P_FCHG_CTIMEC2 4 +#define P_FCHG_CTIMEC4 0 + +#define P_FCHG_SETCHARGEMODE 0 +#define P_FCHG_READCHARGEMODE 1 +#define P_FCHG_READSTATUS 2 +#define P_FCHG_CLOSE 3 +#define P_FCHG_CANCEL 4 +#define P_FCHG_FASTCHARGE1 5 +#define P_FCHG_FASTCHARGE2 6 +#define P_FCHG_DISCHARGE 7 +#define P_FCHG_ASYNCHREAD 8 +#define P_FCHG_RESETBOTH 9 diff --git a/code/SIBOSDK/include/fcntl.h b/code/SIBOSDK/include/fcntl.h new file mode 100644 index 0000000..608a2d1 --- /dev/null +++ b/code/SIBOSDK/include/fcntl.h @@ -0,0 +1,50 @@ +/* Release 3.00 */ + +/*-------------------------------------------------------------------------* +* * +* fcntl.h - definitions for opening files. * +* * +* COPYRIGHT (C) 1989 Jensen and Partners. All Rights Reserved * +* * +*--------------------------------------------------------------------------*/ +#include + +#ifndef _FCNTL_INC_ +#define _FCNTL_INC_ + +extern unsigned _fmode; + +/* Flag values for open */ + +#define O_RDONLY 0 +#define O_WRONLY 1 +#define O_RDWR 2 + +#define O_CREAT 0x0100 /* create and open file */ +#define O_TRUNC 0x0200 /* open with truncation */ +#define O_EXCL 0x0400 /* exclusive open */ + +#define _O_EOF 0x0200 /* set when text file hits ^Z */ + +/* A file in append mode may be written to only at its end. */ + +#define O_APPEND 0x0800 /* to end of file */ + +/* File mode special bits. User may only read these bits */ + +#define O_CHANGED 0x1000 /* File has been written */ +#define O_DEVICE 0x2000 /* user read only flag */ +#define O_TEXT 0x4000 /* CR-LF translation */ +#define O_BINARY 0x8000 /* no translation */ + +/* DOS 3.x file sharing options */ + +#define SH_NOINHERIT 0x80 +#define SH_COMPAT 0x00 +#define SH_DENYRW 0x10 +#define SH_DENYWR 0x20 +#define SH_DENYRD 0x30 +#define SH_DENYNO 0x40 + +#define SH_DENYNONE SH_DENYNO /* MS documentation uses both */ +#endif diff --git a/code/SIBOSDK/include/filelist.g b/code/SIBOSDK/include/filelist.g new file mode 100644 index 0000000..007d810 --- /dev/null +++ b/code/SIBOSDK/include/filelist.g @@ -0,0 +1,100 @@ +/* Generated by Ctran from filelist.cl */ +#define FILELIST_G +#ifndef FACTIVE_G +#include +#endif +#ifndef H_FILE_H +#include +#endif +#ifndef LISTBOX_G +#include +#endif +#ifndef TIME_G +#include +#endif +/* Class Numbers */ +#define C_NONODE 39 +#define C_HPSEL 40 +#define C_FILELIST 41 +/* Method Numbers */ +#define O_FL_LOCCHG 23 +#define O_FL_LIST_COMPLETE 22 +/* Property of nonode */ +typedef struct pr_nonode +{ +PRS_ROOT root; +PRS_ACTIVE active; +PRS_FACTIVE factive; +PRS_FNODE fnode; +} PR_NONODE; +/* Property of hpsel */ +typedef struct { +PR_ROOT *owner; +} PRS_HPSEL; +typedef struct pr_hpsel +{ +PRS_ROOT root; +PRS_ACTIVE active; +PRS_FACTIVE factive; +PRS_FSCAN fscan; +PRS_PSEL psel; +PRS_HPSEL hpsel; +} PR_HPSEL; +/* Constants for filelist */ +#define PR_FILELIST_ISFILE 0x100 +#define PR_FILELIST_TAGS_CHANGED 0x0200 +#define PR_FILELIST_NOSCAN 0x0400 +#define PR_FILELIST_SCANNING 0x0800 +#define PR_FILELIST_LOCAL 0x1000 +#define PR_FILELIST_WILDCARDED 0x2000 +#define PR_FILELIST_SET_UNMARKED 0x4000 +#define IN_FILELIST_ALLOW_DIRS H_FILE_ALLOW_DIRS +#define IN_FILELIST_JUST_DIRS H_FILE_JUST_DIRS +#define IN_FILELIST_CAN_TAG H_FILE_CAN_TAG +#define IN_FILELIST_CAN_WILDCARD H_FILE_CAN_WILDCARD +#define IN_FILELIST_NO_FORCE_WILD 0x8000 +#define FILENAME_WIDTH 12 +#define FILESIZE_WIDTH 7 +#define FILETIME_WIDTH 7 +#define FILEDATE_WIDTH 9 +/* Types for filelist */ +typedef struct +{ +short int dtype; +void *vadev; +short int ascoff; +unsigned short int tagoff; +unsigned short int sizeoff; +unsigned short int timeoff; +unsigned short int dateoff; +unsigned short int dateendoff; +char asc[P_FNAMESIZE]; +} PR_FILELIST_X; +/* Property of filelist */ +typedef struct { +PR_HPSEL *hpsel; +PR_VASTR *contexts; +PR_TIME *date; +PR_VASTR *tags; +PR_VASTR **ptags; +PR_ROOT *next; +unsigned short int locmask; +unsigned short int flags; +short int parent; +short int thisdir; +P_FPARSE crk; +short int derr; +PR_FILELIST_X *x; +unsigned long int dfree; +char wild[P_FNAMESIZE]; +char subd[P_FNAMESIZE]; +char scr[P_FNAMESIZE]; +char targ[P_FNAMESIZE]; +} PRS_FILELIST; +typedef struct pr_filelist +{ +PRS_ROOT root; +PRS_WIN win; +PRS_LISTBOX listbox; +PRS_FILELIST filelist; +} PR_FILELIST; diff --git a/code/SIBOSDK/include/filelist.ing b/code/SIBOSDK/include/filelist.ing new file mode 100644 index 0000000..8dbd308 --- /dev/null +++ b/code/SIBOSDK/include/filelist.ing @@ -0,0 +1,96 @@ +; Generated by Ctran from filelist.cl +FILELIST_ING equ 1 +IFNDEF FACTIVE_ING + INCLUDE ..\inc\FACTIVE.ING +ENDIF +IFNDEF H_FILE_INC + INCLUDE ..\inc\H_FILE.INC +ENDIF +IFNDEF LISTBOX_ING + INCLUDE ..\inc\LISTBOX.ING +ENDIF +IFNDEF TIME_ING + INCLUDE ..\inc\TIME.ING +ENDIF +; Class Numbers +C_NONODE equ 39 +C_HPSEL equ 40 +C_FILELIST equ 41 +; Method Numbers +O_FL_LOCCHG equ 23 +O_FL_LIST_COMPLETE equ 22 +; Property of nonode +PR_NONODE struc +NonodeRoot PRS_ROOT <> +NonodeActive PRS_ACTIVE <> +NonodeFactive PRS_FACTIVE <> +NonodeFnode PRS_FNODE <> +PR_NONODE ends +; Property of hpsel +PRS_HPSEL struc +HpselOwner dw ? +PRS_HPSEL ends +PR_HPSEL struc +HpselRoot PRS_ROOT <> +HpselActive PRS_ACTIVE <> +HpselFactive PRS_FACTIVE <> +HpselFscan PRS_FSCAN <> +HpselPsel PRS_PSEL <> +HpselHpsel PRS_HPSEL <> +PR_HPSEL ends +; Constants for filelist +PR_FILELIST_ISFILE equ (0100h) +PR_FILELIST_TAGS_CHANGED equ (00200h) +PR_FILELIST_NOSCAN equ (00400h) +PR_FILELIST_SCANNING equ (00800h) +PR_FILELIST_LOCAL equ (01000h) +PR_FILELIST_WILDCARDED equ (02000h) +PR_FILELIST_SET_UNMARKED equ (04000h) +IN_FILELIST_ALLOW_DIRS equ (H_FILE_ALLOW_DIRS) +IN_FILELIST_JUST_DIRS equ (H_FILE_JUST_DIRS) +IN_FILELIST_CAN_TAG equ (H_FILE_CAN_TAG) +IN_FILELIST_CAN_WILDCARD equ (H_FILE_CAN_WILDCARD) +IN_FILELIST_NO_FORCE_WILD equ (08000h) +FILENAME_WIDTH equ (12) +FILESIZE_WIDTH equ (7) +FILETIME_WIDTH equ (7) +FILEDATE_WIDTH equ (9) +; Types for filelist +PR_FILELIST_X struc +PR_FILELIST_XDtype dw ? +PR_FILELIST_XVadev dw ? +PR_FILELIST_XAscoff dw ? +PR_FILELIST_XTagoff dw ? +PR_FILELIST_XSizeoff dw ? +PR_FILELIST_XTimeoff dw ? +PR_FILELIST_XDateoff dw ? +PR_FILELIST_XDateendoff dw ? +PR_FILELIST_XAsc db (1) * P_FNAMESIZE dup (?) +PR_FILELIST_X ends +; Property of filelist +PRS_FILELIST struc +FilelistHpsel dw ? +FilelistContexts dw ? +FilelistDate dw ? +FilelistTags dw ? +FilelistPtags dw ? +FilelistNext dw ? +FilelistLocmask dw ? +FilelistFlags dw ? +FilelistParent dw ? +FilelistThisdir dw ? +FilelistCrk P_FPARSE <> +FilelistDerr dw ? +FilelistX dw ? +FilelistDfree dd ? +FilelistWild db (1) * P_FNAMESIZE dup (?) +FilelistSubd db (1) * P_FNAMESIZE dup (?) +FilelistScr db (1) * P_FNAMESIZE dup (?) +FilelistTarg db (1) * P_FNAMESIZE dup (?) +PRS_FILELIST ends +PR_FILELIST struc +FilelistRoot PRS_ROOT <> +FilelistWin PRS_WIN <> +FilelistListbox PRS_LISTBOX <> +FilelistFilelist PRS_FILELIST <> +PR_FILELIST ends diff --git a/code/SIBOSDK/include/files.g b/code/SIBOSDK/include/files.g new file mode 100644 index 0000000..a16c769 --- /dev/null +++ b/code/SIBOSDK/include/files.g @@ -0,0 +1,127 @@ +/* Generated by Ctran from files.cl */ +#define FILES_G +#ifndef CHLIST_G +#include +#endif +#ifndef EDWIN_G +#include +#endif +#ifndef VARES_G +#include +#endif +#ifndef TIME_G +#include +#endif +#ifndef P_FILE_H +#include +#endif +#ifndef H_FILE_H +#include +#endif +/* Class Numbers */ +#define C_VADEV 42 +#define C_PACKSEL 43 +#define C_FNEDIT 44 +#define C_FNSELWN 45 +/* Method Numbers */ +#define O_FNS_INSERT_TAGS 19 +#define O_FNS_EXTRACT_TAGS 20 +#define O_FNS_VALIDATE_FLIST 22 +#define O_FNS_SUBSET 21 +/* Property of vadev */ +typedef struct { +char buf[20]; +} PRS_VADEV; +typedef struct pr_vadev +{ +PRS_ROOT root; +PRS_VAROOT varoot; +PRS_VASTR vastr; +PRS_VADEV vadev; +} PR_VADEV; +/* Constants for packsel */ +#define PR_CHLIST_PACKSEL_DODINFO 0x8000 +/* Property of packsel */ +typedef struct { +PR_LODGER *filsel; +short int err; +} PRS_PACKSEL; +typedef struct pr_packsel +{ +PRS_ROOT root; +PRS_WIN win; +PRS_LODGER lodger; +PRS_CHLIST chlist; +PRS_PACKSEL packsel; +} PR_PACKSEL; +/* Constants for fnedit */ +#define IN_FNEDIT_STANDARD H_FILE_STANDARD_INIT +#define IN_FNEDIT_ALLOW_DIRS H_FILE_ALLOW_DIRS +#define IN_FNEDIT_JUST_DIRS H_FILE_JUST_DIRS +#define IN_FNEDIT_FORCE_NXIST H_FILE_FORCE_NXIST +#define IN_FNEDIT_NO_AUTOQUERY H_FILE_NO_AUTOQUERY +#define IN_FNEDIT_ACCEPT_NULL H_FILE_ACCEPT_NULL +#define IN_FNEDIT_SET_DEFEXT H_FILE_SET_DEFEXT +#define IN_FNEDIT_CAN_WILDCARD H_FILE_CAN_WILDCARD +/* Types for fnedit */ +typedef struct +{ +unsigned char flags; +char fname[1]; +} IN_FNEDIT; +/* Property of fnedit */ +typedef struct { +PR_LISTBOX *pop; +PR_PACKSEL *pack; +unsigned short int flags; +char *defext; +char extbuf[6]; +char buf[P_FNAMESIZE]; +} PRS_FNEDIT; +typedef struct pr_fnedit +{ +PRS_ROOT root; +PRS_WIN win; +PRS_LODGER lodger; +PRS_EDWIN edwin; +PRS_FNEDIT fnedit; +} PR_FNEDIT; +/* Constants for fnselwn */ +#define IN_FNSELWN_STANDARD H_FILE_STANDARD_INIT +#define IN_FNSELWN_SHOW_DIRS H_FILE_ALLOW_DIRS +#define IN_FNSELWN_HIDE_FILES H_FILE_JUST_DIRS +#define IN_FNSELWN_RESTRICT_LIST H_FILE_RESTRICT_LIST +#define IN_FNSELWN_CAN_TAG H_FILE_CAN_TAG +#define IN_FNSELWN_ACCEPT_NULL H_FILE_ACCEPT_NULL +#define IN_FNSELWN_SET_DEFEXT H_FILE_SET_DEFEXT +#define IN_FNSELWN_CAN_WILDCARD H_FILE_CAN_WILDCARD +#define PR_FNSELWN_TAGSHERE 0x100 +#define PR_FNSELWN_AT_ROOT 0x200 +#define PR_FNSELWN_WILDCARDED 0x400 +#define PR_FNSELWN_PRESERVE_TAGS 0x800 +#define PR_FNSELWN_ON_DIR 0x1000 +#define PR_FNSELWN_CHANGED_DIR 0x8000 +/* Types for fnselwn */ +typedef struct +{ +unsigned char flags; +char fname[1]; +} IN_FNSELWN; +/* Property of fnselwn */ +typedef struct { +PR_VASTR *tags; +PR_PACKSEL *pack; +unsigned short int flags; +char *defext; +char extbuf[6]; +P_FPARSE crk; +char buf[P_FNAMESIZE]; +} PRS_FNSELWN; +typedef struct pr_fnselwn +{ +PRS_ROOT root; +PRS_WIN win; +PRS_LODGER lodger; +PRS_CHLIST chlist; +PRS_FNSELWN fnselwn; +} PR_FNSELWN; diff --git a/code/SIBOSDK/include/files.ing b/code/SIBOSDK/include/files.ing new file mode 100644 index 0000000..bc42583 --- /dev/null +++ b/code/SIBOSDK/include/files.ing @@ -0,0 +1,121 @@ +; Generated by Ctran from files.cl +FILES_ING equ 1 +IFNDEF CHLIST_ING + INCLUDE ..\inc\CHLIST.ING +ENDIF +IFNDEF EDWIN_ING + INCLUDE ..\inc\EDWIN.ING +ENDIF +IFNDEF VARES_ING + INCLUDE ..\inc\VARES.ING +ENDIF +IFNDEF TIME_ING + INCLUDE ..\inc\TIME.ING +ENDIF +IFNDEF P_FILE_INC + INCLUDE ..\inc\P_FILE.INC +ENDIF +IFNDEF H_FILE_INC + INCLUDE ..\inc\H_FILE.INC +ENDIF +; Class Numbers +C_VADEV equ 42 +C_PACKSEL equ 43 +C_FNEDIT equ 44 +C_FNSELWN equ 45 +; Method Numbers +O_FNS_INSERT_TAGS equ 19 +O_FNS_EXTRACT_TAGS equ 20 +O_FNS_VALIDATE_FLIST equ 22 +O_FNS_SUBSET equ 21 +; Property of vadev +PRS_VADEV struc +VadevBuf db (1) * 20 dup (?) +PRS_VADEV ends +PR_VADEV struc +VadevRoot PRS_ROOT <> +VadevVaroot PRS_VAROOT <> +VadevVastr PRS_VASTR <> +VadevVadev PRS_VADEV <> +PR_VADEV ends +; Constants for packsel +PR_CHLIST_PACKSEL_DODINFO equ (08000h) +; Property of packsel +PRS_PACKSEL struc +PackselFilsel dw ? +PackselErr dw ? +PRS_PACKSEL ends +PR_PACKSEL struc +PackselRoot PRS_ROOT <> +PackselWin PRS_WIN <> +PackselLodger PRS_LODGER <> +PackselChlist PRS_CHLIST <> +PackselPacksel PRS_PACKSEL <> +PR_PACKSEL ends +; Constants for fnedit +IN_FNEDIT_STANDARD equ (H_FILE_STANDARD_INIT) +IN_FNEDIT_ALLOW_DIRS equ (H_FILE_ALLOW_DIRS) +IN_FNEDIT_JUST_DIRS equ (H_FILE_JUST_DIRS) +IN_FNEDIT_FORCE_NXIST equ (H_FILE_FORCE_NXIST) +IN_FNEDIT_NO_AUTOQUERY equ (H_FILE_NO_AUTOQUERY) +IN_FNEDIT_ACCEPT_NULL equ (H_FILE_ACCEPT_NULL) +IN_FNEDIT_SET_DEFEXT equ (H_FILE_SET_DEFEXT) +IN_FNEDIT_CAN_WILDCARD equ (H_FILE_CAN_WILDCARD) +; Types for fnedit +IN_FNEDIT struc +IN_FNEDITFlags db ? +IN_FNEDITFname db (1) * 1 dup (?) +IN_FNEDIT ends +; Property of fnedit +PRS_FNEDIT struc +FneditPop dw ? +FneditPack dw ? +FneditFlags dw ? +FneditDefext dw ? +FneditExtbuf db (1) * 6 dup (?) +FneditBuf db (1) * P_FNAMESIZE dup (?) +PRS_FNEDIT ends +PR_FNEDIT struc +FneditRoot PRS_ROOT <> +FneditWin PRS_WIN <> +FneditLodger PRS_LODGER <> +FneditEdwin PRS_EDWIN <> +FneditFnedit PRS_FNEDIT <> +PR_FNEDIT ends +; Constants for fnselwn +IN_FNSELWN_STANDARD equ (H_FILE_STANDARD_INIT) +IN_FNSELWN_SHOW_DIRS equ (H_FILE_ALLOW_DIRS) +IN_FNSELWN_HIDE_FILES equ (H_FILE_JUST_DIRS) +IN_FNSELWN_RESTRICT_LIST equ (H_FILE_RESTRICT_LIST) +IN_FNSELWN_CAN_TAG equ (H_FILE_CAN_TAG) +IN_FNSELWN_ACCEPT_NULL equ (H_FILE_ACCEPT_NULL) +IN_FNSELWN_SET_DEFEXT equ (H_FILE_SET_DEFEXT) +IN_FNSELWN_CAN_WILDCARD equ (H_FILE_CAN_WILDCARD) +PR_FNSELWN_TAGSHERE equ (0100h) +PR_FNSELWN_AT_ROOT equ (0200h) +PR_FNSELWN_WILDCARDED equ (0400h) +PR_FNSELWN_PRESERVE_TAGS equ (0800h) +PR_FNSELWN_ON_DIR equ (01000h) +PR_FNSELWN_CHANGED_DIR equ (08000h) +; Types for fnselwn +IN_FNSELWN struc +IN_FNSELWNFlags db ? +IN_FNSELWNFname db (1) * 1 dup (?) +IN_FNSELWN ends +; Property of fnselwn +PRS_FNSELWN struc +FnselwnTags dw ? +FnselwnPack dw ? +FnselwnFlags dw ? +FnselwnDefext dw ? +FnselwnExtbuf db (1) * 6 dup (?) +FnselwnCrk P_FPARSE <> +FnselwnBuf db (1) * P_FNAMESIZE dup (?) +PRS_FNSELWN ends +PR_FNSELWN struc +FnselwnRoot PRS_ROOT <> +FnselwnWin PRS_WIN <> +FnselwnLodger PRS_LODGER <> +FnselwnChlist PRS_CHLIST <> +FnselwnFnselwn PRS_FNSELWN <> +PR_FNSELWN ends diff --git a/code/SIBOSDK/include/float.h b/code/SIBOSDK/include/float.h new file mode 100644 index 0000000..f1cd1ef --- /dev/null +++ b/code/SIBOSDK/include/float.h @@ -0,0 +1,114 @@ +/* Release 3.00 */ + +/*-------------------------------------------------------------------------* +* * +* float.h - Implementation specific macros for floating point. * +* * +* COPYRIGHT (C) 1989, 1990 Jensen and Partners. All Rights Reserved. * +* * +*--------------------------------------------------------------------------*/ +#include + +#ifndef _FLOAT_INC_ +#define _FLOAT_INC_ + +#define DBL_DIG 15 /* number of decimal digits of precision */ +#define DBL_MANT_DIG 53 /* number of bits in mantissa */ +#define DBL_MAX_10_EXP 308 /* maximum decimal exponent */ +#define DBL_MAX_EXP 1024 /* maximum binary exponent */ +#define DBL_MIN_10_EXP -307 /* minimum decimal exponent */ +#define DBL_MIN_EXP -1021 /* minimum binary exponent */ +#define DBL_RADIX 2 /* exponent radix */ +#define DBL_ROUNDS 1 /* addition rounding */ +#define DBL_EPSILON 2.2204460492503131e-016 /* 1.0+DBL_EPSILON != 1.0 */ +#define DBL_MAX 1.7976931348623151e+308 /* maximum value */ +#define DBL_MIN 2.2250738585072014e-308 /* minimum positive value */ + +#define FLT_DIG 6 /* number of decimal digits of precision */ +#define FLT_GUARD 0 +#define FLT_MANT_DIG 24 /* number of bits in mantissa */ +#define FLT_MAX_10_EXP 38 /* maximum decimal exponent */ +#define FLT_MAX_EXP 128 /* maximum binary exponent */ +#define FLT_MIN_10_EXP -37 /* minimum decimal exponent */ +#define FLT_MIN_EXP -125 /* minimum binary exponent */ +#define FLT_NORMALIZE 0 +#define FLT_RADIX 2 /* exponent radix */ +#define FLT_ROUNDS 1 /* addition rounding chops */ +#define FLT_EPSILON 1.192092896e-07 /* smallest such that 1.0+FLT_EPSILON != 1.0 */ +#define FLT_MAX 3.402823466e+38 /* maximum value */ +#define FLT_MIN 1.175494351e-38 /* minimum positive value */ + +#define LDBL_DIG 19 /* number of decimal digits of precision */ +#define LDBL_EPSILON 5.4210108624275221706e-20 /* smallest such that 1.0+LDBL_EPSILON != 1.0 */ +#define LDBL_MANT_DIG 64 /* number of bits in mantissa */ +#define LDBL_MAX 1.189731495357231765e+4932L /* maximum value */ +#define LDBL_MAX_10_EXP 4932 /* maximum decimal exponent */ +#define LDBL_MAX_EXP 16384 /* maximum binary exponent */ +#define LDBL_MIN 3.3621031431120935063e-4932L /* minimum positive value */ +#define LDBL_MIN_10_EXP (-4931) /* minimum deimal exponent */ +#define LDBL_MIN_EXP (-16381) /* minimum binary exponent */ +#define LDBL_RADIX 2 /* exponent radix */ +#define LDBL_ROUNDS DBL_ROUNDS /* addition rounding */ + +/* X087 math control information */ + +/* Control Word Mask and bit definitions */ + +#define MCW_EM 0x003f /* interrupt Exception Masks */ +#define EM_INVALID 0x0001 /* invalid */ +#define EM_DENORMAL 0x0002 /* denormal */ +#define EM_ZERODIVIDE 0x0004 /* zero divide */ +#define EM_OVERFLOW 0x0008 /* overflow */ +#define EM_UNDERFLOW 0x0010 /* underflow */ +#define EM_INEXACT 0x0020 /* inexact */ + +#define MCW_IC 0x1000 /* Infinity Control */ +#define IC_AFFINE 0x1000 /* affine */ +#define IC_PROJECTIVE 0x0000 /* projective */ + +#define MCW_RC 0x0c00 /* Rounding Control */ +#define RC_CHOP 0x0c00 /* chop */ +#define RC_UP 0x0800 /* up */ +#define RC_DOWN 0x0400 /* down */ +#define RC_NEAR 0x0000 /* near */ + +#define MCW_PC 0x0300 /* Precision Control */ +#define PC_24 0x0000 /* 24 bits */ +#define PC_53 0x0200 /* 53 bits */ +#define PC_64 0x0300 /* 64 bits */ + +/* Initial Control Word value */ + +#define CW_DEFAULT ( IC_AFFINE + RC_NEAR + PC_64 + EM_DENORMAL + EM_UNDERFLOW + EM_INEXACT ) + +/* user Status Word bit definitions */ + +#define SW_INVALID 0x0001 /* invalid */ +#define SW_DENORMAL 0x0002 /* denormal */ +#define SW_ZERODIVIDE 0x0004 /* zero divide */ +#define SW_OVERFLOW 0x0008 /* overflow */ +#define SW_UNDERFLOW 0x0010 /* underflow */ +#define SW_INEXACT 0x0020 /* precision inexact */ + +/* Floating point error signals */ + +#define FPE_INVALID 0x81 +#define FPE_DENORMAL 0x82 +#define FPE_ZERODIVIDE 0x83 +#define FPE_OVERFLOW 0x84 +#define FPE_UNDERFLOW 0x85 +#define FPE_INEXACT 0x86 + +/* X087 control function prototypes */ + +#ifdef __cplusplus +extern "C" { +#endif +extern unsigned int _clear87(void); +extern unsigned int _control87(unsigned int _new, unsigned int _mask); +extern void _fpreset(void); +extern unsigned int _status87(void); +#ifdef __cplusplus +} +#endif +#endif diff --git a/code/SIBOSDK/include/fltedit.g b/code/SIBOSDK/include/fltedit.g new file mode 100644 index 0000000..8b37978 --- /dev/null +++ b/code/SIBOSDK/include/fltedit.g @@ -0,0 +1,45 @@ +/* Generated by Ctran from fltedit.cl */ +#define FLTEDIT_G +#ifndef EDWIN_G +#include +#endif +/* Class Numbers */ +#define C_FLTEDIT 46 +/* Method Numbers */ +/* Constants for fltedit */ +#define FLTEDIT_MAX_CHAR 20 +#define SE_FLTEDIT_CURRENT 0x01 +#define SE_FLTEDIT_HIGH 0x02 +#define SE_FLTEDIT_LOW 0x04 +/* Types for fltedit */ +typedef struct +{ +double current; +double low; +double high; +unsigned char vulen; +unsigned char format; +} IN_FLTEDIT; +typedef struct +{ +double current; +double low; +double high; +short int set_flags; +} SE_FLTEDIT; +/* Property of fltedit */ +typedef struct { +double current; +double low; +double high; +unsigned char point; +unsigned char format; +} PRS_FLTEDIT; +typedef struct pr_fltedit +{ +PRS_ROOT root; +PRS_WIN win; +PRS_LODGER lodger; +PRS_EDWIN edwin; +PRS_FLTEDIT fltedit; +} PR_FLTEDIT; diff --git a/code/SIBOSDK/include/fltedit.ing b/code/SIBOSDK/include/fltedit.ing new file mode 100644 index 0000000..db1e45b --- /dev/null +++ b/code/SIBOSDK/include/fltedit.ing @@ -0,0 +1,42 @@ +; Generated by Ctran from fltedit.cl +FLTEDIT_ING equ 1 +IFNDEF EDWIN_ING + INCLUDE ..\inc\EDWIN.ING +ENDIF +; Class Numbers +C_FLTEDIT equ 46 +; Method Numbers +; Constants for fltedit +FLTEDIT_MAX_CHAR equ (20) +SE_FLTEDIT_CURRENT equ (001h) +SE_FLTEDIT_HIGH equ (002h) +SE_FLTEDIT_LOW equ (004h) +; Types for fltedit +IN_FLTEDIT struc +IN_FLTEDITCurrent db 8 dup (?) +IN_FLTEDITLow db 8 dup (?) +IN_FLTEDITHigh db 8 dup (?) +IN_FLTEDITVulen db ? +IN_FLTEDITFormat db ? +IN_FLTEDIT ends +SE_FLTEDIT struc +SE_FLTEDITCurrent db 8 dup (?) +SE_FLTEDITLow db 8 dup (?) +SE_FLTEDITHigh db 8 dup (?) +SE_FLTEDITSet_flags dw ? +SE_FLTEDIT ends +; Property of fltedit +PRS_FLTEDIT struc +FlteditCurrent db 8 dup (?) +FlteditLow db 8 dup (?) +FlteditHigh db 8 dup (?) +FlteditPoint db ? +FlteditFormat db ? +PRS_FLTEDIT ends +PR_FLTEDIT struc +FlteditRoot PRS_ROOT <> +FlteditWin PRS_WIN <> +FlteditLodger PRS_LODGER <> +FlteditEdwin PRS_EDWIN <> +FlteditFltedit PRS_FLTEDIT <> +PR_FLTEDIT ends diff --git a/code/SIBOSDK/include/fontdlg.g b/code/SIBOSDK/include/fontdlg.g new file mode 100644 index 0000000..f20e590 --- /dev/null +++ b/code/SIBOSDK/include/fontdlg.g @@ -0,0 +1,34 @@ +/* Generated by Ctran from fontdlg.cl */ +#define FONTDLG_G +#ifndef DLGBOX_G +#include +#endif +#ifndef SCRLAY_G +#include +#endif +/* Class Numbers */ +#define C_FONTSEL 64 +/* Method Numbers */ +/* Types for fontsel */ +typedef struct +{ +void *wdr; +SCRLAY_FONT *pf; +unsigned short int ret; +} FONTSEL_DATA; +/* Property of fontsel */ +typedef struct { +PR_ROOT *names; +PR_ROOT *sizes; +void *wdr; +SCRLAY_FONT *pf; +SCRLAY_FONT f; +} PRS_FONTSEL; +typedef struct pr_fontsel +{ +PRS_ROOT root; +PRS_WIN win; +PRS_DLGCHAIN dlgchain; +PRS_DLGBOX dlgbox; +PRS_FONTSEL fontsel; +} PR_FONTSEL; diff --git a/code/SIBOSDK/include/fontdlg.ing b/code/SIBOSDK/include/fontdlg.ing new file mode 100644 index 0000000..0cdb4b4 --- /dev/null +++ b/code/SIBOSDK/include/fontdlg.ing @@ -0,0 +1,32 @@ +; Generated by Ctran from fontdlg.cl +FONTDLG_ING equ 1 +IFNDEF DLGBOX_ING + INCLUDE ..\inc\DLGBOX.ING +ENDIF +IFNDEF SCRLAY_ING + INCLUDE ..\inc\SCRLAY.ING +ENDIF +; Class Numbers +C_FONTSEL equ 64 +; Method Numbers +; Types for fontsel +FONTSEL_DATA struc +FONTSEL_DATAWdr dw ? +FONTSEL_DATAPf dw ? +FONTSEL_DATARet dw ? +FONTSEL_DATA ends +; Property of fontsel +PRS_FONTSEL struc +FontselNames dw ? +FontselSizes dw ? +FontselWdr dw ? +FontselPf dw ? +FontselF SCRLAY_FONT <> +PRS_FONTSEL ends +PR_FONTSEL struc +FontselRoot PRS_ROOT <> +FontselWin PRS_WIN <> +FontselDlgchain PRS_DLGCHAIN <> +FontselDlgbox PRS_DLGBOX <> +FontselFontsel PRS_FONTSEL <> +PR_FONTSEL ends diff --git a/code/SIBOSDK/include/fonts.h b/code/SIBOSDK/include/fonts.h new file mode 100644 index 0000000..364adb0 --- /dev/null +++ b/code/SIBOSDK/include/fonts.h @@ -0,0 +1,105 @@ +/* + File: FONTS.H + Copyright (C) Psion PLC 1993 + Started by : DavidW + Started in: April 1993 (derived from earlier contents of Hwim.cat) + + The fonts listed in sxwim.rom (and in egclient.par), in order: + + S3.FON 6000,1,2,3 (SYS$NORM,SYS$BOLD,SYS$DIGT,*) + SA13S.FON 6004,5,6,7 (SA13SN,SA13SNM,SA13SB,*) + SA13R.FON 6008,9,a (SA13RN,SA13RB,*) + SA16RN.FON 600b + SA16SN.FON 600c + SA11S.FON 600d,e,f (SA11SN,SA11SB,*) + SA11R.FON 6010,11,12 (SA11RN,SA11RB,*) + SA08S.FON 6013,14,15 (SA08SN,SA08SB,*) + SA08RND4.FON 6016 + SA08RBD4.FON 6017 + SA37SND.FON 6018 + SA08SN5.FON 6019 + SA07RBA.FON 601a + SA05RND.FON 601b + AGN8SYM.FON 601c + AGN13SYM.FON 601d + SA08RNM8.FON 601e + SA06RNM6.FON 601f + SPR05RN4.FON 6020 + SA15SND.FON 6021 + SA11SYM.FON 6022 + WORLD.FON 6023 + + The numerical contents of sys$wsrv.fsu (defines the 4000 numbered fonts): + + 0,1,2, Series3 fonts + 1e, 8x8 mono + 3,12,a,b, 4 Roman fonts: 8/11/13/16 + 15,f,7,c, 4 Swiss fonts: 8/11/13/16 + 1f 6x6 mono + + "Server fonts" in egclient.par (and in xhhenv.ini) (all are 6000 numbers): + 7 S3b system font + 4 S3b notifer/alert message font ("internal font") + 13 (d) status window diamond bar text font + 13 (d) status window diamond bar symbol font + 24 (18) "medium 2" digital clock font + 13 (d) "medium 2" date font + 4 button text in notifiers and alerts + 33 (21) small digital clock font +*/ + +/* +Series 3 fonts +*/ +#define FONT_ID_S3 WS_FONT_BASE +#define FONT_ID_S3BOLD (WS_FONT_BASE+0x1) +#define FONT_ID_S3DIGITS (WS_FONT_BASE+0x2) + +/* +Series 3B supported fonts +*/ +#define FONT_ID_MONO_8x8 (WS_FONT_BASE+0x3) +#define FONT_ID_ROMAN_8 (WS_FONT_BASE+0x4) +#define FONT_ID_ROMAN_11 (WS_FONT_BASE+0x5) +#define FONT_ID_ROMAN_13 (WS_FONT_BASE+0x6) +#define FONT_ID_ROMAN_16 (WS_FONT_BASE+0x7) +#define FONT_ID_SWISS_8 (WS_FONT_BASE+0x8) +#define FONT_ID_SWISS_11 (WS_FONT_BASE+0x9) +#define FONT_ID_SWISS_13 (WS_FONT_BASE+0xa) +#define FONT_ID_SWISS_16 (WS_FONT_BASE+0xb) +#define FONT_ID_MONO_6x6 (WS_FONT_BASE+0xc) + +/* +Series 3B specialised fonts, not necessarily supported on future machines +*/ +#define FONT_ID_DIGITS_8x4 (WS_FONT_BASE2+0x16) +#define FONT_ID_DIGITS_8x4B (WS_FONT_BASE2+0x17) +#define FONT_ID_CLOCK_37 (WS_FONT_BASE2+0x18) +#define FONT_ID_SWISS_8_THIN (WS_FONT_BASE2+0x19) +#define FONT_ID_ALPHA_UC_7B (WS_FONT_BASE2+0x1a) +#define FONT_ID_DIGITS_5x4 (WS_FONT_BASE2+0x1b) +#define FONT_ID_AGN_SYM_8 (WS_FONT_BASE2+0x1c) +#define FONT_ID_AGN_SYM_13 (WS_FONT_BASE2+0x1d) +#define FONT_ID_SPR_5x4 (WS_FONT_BASE2+0x20) +#define FONT_ID_CLOCK_15 (WS_FONT_BASE2+0x21) + +/* +Vine and s3d fonts +*/ +#define FONT_ID_SA_11_SYM (WS_FONT_BASE2+0x22) +#define FONT_ID_WORLD (WS_FONT_BASE2+0x23) + +/* +Font ids that are component parts of configured groups +*/ +#define FONT_ID_13_S (WS_FONT_BASE2+0x4) +#define FONT_ID_13M_S (WS_FONT_BASE2+0x5) +#define FONT_ID_13B_S (WS_FONT_BASE2+0x6) +#define FONT_ID_13_R (WS_FONT_BASE2+0x8) +#define FONT_ID_13B_R (WS_FONT_BASE2+0x9) +#define FONT_ID_11_S (WS_FONT_BASE2+0xd) +#define FONT_ID_11B_S (WS_FONT_BASE2+0xe) +#define FONT_ID_11_R (WS_FONT_BASE2+0x10) +#define FONT_ID_11B_R (WS_FONT_BASE2+0x11) +#define FONT_ID_8_S (WS_FONT_BASE2+0x13) +#define FONT_ID_8B_S (WS_FONT_BASE2+0x14) diff --git a/code/SIBOSDK/include/form.ext b/code/SIBOSDK/include/form.ext new file mode 100644 index 0000000..16ab7c3 --- /dev/null +++ b/code/SIBOSDK/include/form.ext @@ -0,0 +1,188 @@ +Generated by Ctran from form.cat +LIBRARY form +CLASS scrlay root +{ +DECLARE sl_init +DECLARE sl_set +DECLARE sl_sense +DECLARE sl_line_ends +DECLARE sl_pos_to_xl +DECLARE sl_xl_to_pos +DECLARE sl_begin_read +DECLARE sl_read +DECLARE sl_format_line +DECLARE sl_scroll +DECLARE sl_view +DECLARE sl_discard_layout +DECLARE sl_set_lines +DECLARE sl_para_changed +DECLARE sl_rescale +HAS_METHOD +HAS_PROPERTY +} +CLASS prnlay scrlay +{ +DECLARE sl_print_read +DECLARE sl_print_pos +HAS_METHOD +HAS_PROPERTY +} +CLASS wrap active +{ +HAS_METHOD +HAS_PROPERTY +} +CLASS scrimg root +{ +DECLARE si_init +DECLARE si_set +DECLARE si_sense +DECLARE si_emphasize +DECLARE si_get_select +DECLARE si_pan +DECLARE si_scroll +DECLARE si_view +DECLARE si_move_cursor +DECLARE si_redraw +DECLARE si_doc_changed +DECLARE si_doc_reset +DECLARE si_para_changed +DECLARE si_style_changed +DECLARE si_delprep +DECLARE si_fwd_change +HAS_METHOD +HAS_PROPERTY +} +CLASS epfdoc epflat +{ +DECLARE epfdoc_para_start +DECLARE epfdoc_sense_chars +HAS_METHOD +} +CLASS epdoc eproot +{ +DECLARE epdoc_para_start +DECLARE epdoc_sense_chars +DECLARE epdoc_set_pages +DECLARE epdoc_enq_page +DECLARE epdoc_goto_page +DECLARE epdoc_set_filter +DECLARE epdoc_pos_filter +HAS_METHOD +HAS_PROPERTY +} +CLASS wdr root +{ +DECLARE wdr_init +DECLARE wdr_count_models +DECLARE wdr_sense_model_name +DECLARE wdr_set_model +DECLARE wdr_sense_model +DECLARE wdr_typeface +DECLARE wdr_search_typeface +DECLARE wdr_font_height +DECLARE wdr_search_height +DECLARE wdr_get_width_table +DECLARE wdr_sense_width +DECLARE wdr_twips_to_xy +DECLARE wdr_open_print +DECLARE wdr_load_record +HAS_METHOD +HAS_PROPERTY +} +CLASS pdr root +{ +DECLARE pdr_init +DECLARE pdr_print +DECLARE pdr_add_command +DECLARE pdr_destroy +DECLARE pdr_start +DECLARE pdr_end +DECLARE pdr_page +DECLARE pdr_text +DECLARE pdr_line +DECLARE pdr_right +DECLARE pdr_font +DECLARE pdr_style +HAS_METHOD +HAS_PROPERTY +} +CLASS pages active +{ +HAS_METHOD +HAS_PROPERTY +} +CLASS printer root +{ +DECLARE pr_init +DECLARE pr_store_srchar +DECLARE pr_store_file +DECLARE pr_set_port_type +DECLARE pr_set_model +DECLARE pr_port_data +DECLARE pr_sense_port +DECLARE pr_sense_model +DECLARE pr_get_params +DECLARE pr_set_hd +DECLARE pr_get_hd +DECLARE pr_open_wdr +DECLARE pr_close_wdr +DECLARE pr_open_port +DECLARE pr_print +DECLARE pr_paginate +DECLARE pr_preview_start +DECLARE pr_preview +DECLARE pr_preview_end +DECLARE pr_preview_data +HAS_METHOD +HAS_PROPERTY +} +CLASS prvpdr pdr +{ +HAS_METHOD +HAS_PROPERTY +} +CLASS calimg root +{ +DECLARE ci_init +DECLARE ci_set_title +DECLARE ci_emphasise +DECLARE ci_move_cursor +DECLARE ci_goto_date +DECLARE ci_adjust_date +DECLARE ci_redraw +DECLARE ci_sense +DECLARE ci_view +DECLARE ci_pos_mxy +DECLARE ci_today_changed +HAS_METHOD +HAS_PROPERTY +} +CLASS ptroot root +{ +DECLARE pt_init +DECLARE pt_reset +DECLARE pt_append +DECLARE pt_put_lintab +DECLARE pt_pbuf +DECLARE pt_add_phrase +DECLARE pt_wrap +DECLARE pt_display_line +DECLARE pt_set_fonts +DECLARE pt_mod_by_num +DECLARE pt_mod_by_attrib +DECLARE pt_find +DECLARE pt_inquire +HAS_METHOD +HAS_PROPERTY +} +CLASS ptseg ptroot +{ +HAS_METHOD +HAS_PROPERTY +} +CLASS ptflat ptroot +{ +HAS_METHOD +HAS_PROPERTY +} diff --git a/code/SIBOSDK/include/form.g b/code/SIBOSDK/include/form.g new file mode 100644 index 0000000..83be76f --- /dev/null +++ b/code/SIBOSDK/include/form.g @@ -0,0 +1,12 @@ +/* Generated by Ctran from form.cat */ +#define FORM_G +#ifndef P_STD_H +#include +#endif +#ifndef P_OBJECT_H +#include +#endif +/* Category Numbers */ +/* EPOC */ +#define CAT_FORM_FORM 0 +#define CAT_FORM_OLIB 1 diff --git a/code/SIBOSDK/include/form.ing b/code/SIBOSDK/include/form.ing new file mode 100644 index 0000000..d4faa2d --- /dev/null +++ b/code/SIBOSDK/include/form.ing @@ -0,0 +1,11 @@ +; Generated by Ctran from form.cat +FORM_ING equ 1 +IFNDEF P_STD_INC + INCLUDE ..\inc\P_STD.INC +ENDIF +IFNDEF P_OBJECT_INC + INCLUDE ..\inc\P_OBJECT.INC +ENDIF +; Category Numbers +CAT_FORM_FORM equ 0 +CAT_FORM_OLIB equ 1 diff --git a/code/SIBOSDK/include/form.lis b/code/SIBOSDK/include/form.lis new file mode 100644 index 0000000..5ab59e1 --- /dev/null +++ b/code/SIBOSDK/include/form.lis @@ -0,0 +1,69 @@ +Generated by Ctran from form.cat + +LIBRARY form + +********** form ********** + +********** scrlay ********** +scrlay + Derived from root + Subclassed by prnlay + Referenced by scrimg +prnlay + Derived from scrlay,root + Referenced by pages + +********** scrimg ********** +wrap + Derived from active,root + Referenced by scrimg +scrimg + Derived from root + References wrap,scrlay + +********** epdoc ********** +epfdoc + Derived from epflat,eproot,root + Referenced by pages +epdoc + Derived from eproot,root + References sgbuf,vaflat,vaflat + +********** prdrv ********** +wdr + Derived from root + References rscfile + Referenced by printer +pdr + Derived from root + Subclassed by prvpdr + Referenced by pages + +********** pages ********** +pages + Derived from active,root + References vaflat,vaseg,epfdoc,prnlay,pdr + +********** printer ********** +printer + Derived from root + References wdr + +********** prvpdr ********** +prvpdr + Derived from pdr,root + References root + +********** calimg ********** +calimg + Derived from root + +********** polytext ********** +ptroot + Derived from root + Subclassed by ptflat,ptseg +ptseg + Derived from ptroot,root + References vaxvar +ptflat + Derived from ptroot,root diff --git a/code/SIBOSDK/include/fstream.hpp b/code/SIBOSDK/include/fstream.hpp new file mode 100644 index 0000000..6f56cd1 --- /dev/null +++ b/code/SIBOSDK/include/fstream.hpp @@ -0,0 +1,135 @@ +/* Release 3.10 */ +/*-------------------------------------------------------------------------* +* * +* FSTREAM.HPP - header file for file stream input and output. * +* * +* COPYRIGHT (C) 1990..1992 Clarion Software Corporation * +* All Rights Reserved * +* * +*--------------------------------------------------------------------------*/ +#include + +#ifndef __FSTREAM_INC_ +#define __FSTREAM_INC_ + +#include + +class filebuf : public streambuf { + +public: + static const int openprot; + + filebuf(); + filebuf(int); + filebuf(int _f, char*, int); + ~filebuf(); + + int is_open(); + int fd(); + + filebuf* open(const char*, int, int = filebuf::openprot); + + filebuf* close(); + filebuf* attach(int); + virtual int overflow(int = EOF); + virtual int underflow(); + virtual int sync(); + virtual streampos seekoff(streamoff, ios::seek_dir, int); + virtual streambuf* setbuf(char*, int); + +protected: + + int last_op(); + int xfd; + int mode; + short opened; + streampos last_seek; + char* in_start; + char lahead[2]; +}; + +inline int filebuf::is_open() { return opened; } +inline int filebuf::fd() { return xfd; } + +class fstreambase : virtual public ios { + +public: + + fstreambase(); + fstreambase(const char*, int, int = filebuf::openprot); + fstreambase(int); + fstreambase(int _f, char*, int); + ~fstreambase(); + + void open(const char*, int, int = filebuf::openprot); + void attach(int); + void close(); + void setbuf(char*, int); + filebuf* rdbuf(); + +private: + + filebuf buf; + +}; + +inline filebuf* fstreambase::rdbuf() { return &buf; } + + +class ifstream : public fstreambase, public istream { + +public: + ifstream(); + ifstream(const char*, int = ios::in, int = filebuf::openprot); + ifstream(int); + ifstream(int _f, char*, int); + ~ifstream(); + + filebuf* rdbuf(); + void open(const char*, int = ios::in, int = filebuf::openprot); + +}; + +inline filebuf* ifstream::rdbuf() { return fstreambase::rdbuf(); } +inline void ifstream::open(const char* name, int m, int prot) { + fstreambase::open(name, m | ios::in, prot); } + + +class ofstream : public fstreambase, public ostream { + +public: + ofstream(); + ofstream(const char*, int = ios::out, int = filebuf::openprot); + ofstream(int); + ofstream(int _f, char*, int); + ~ofstream(); + + filebuf* rdbuf(); + void open(const char*, int = ios::out, int = filebuf::openprot); + +}; + +inline filebuf* ofstream::rdbuf() { return fstreambase::rdbuf(); } +inline void ofstream::open(const char* name, int m, int prot) { + fstreambase::open(name, m | ios::out, prot); } + + +class fstream : public fstreambase, public iostream { + +public: + fstream(); + fstream(const char*, int, int = filebuf::openprot); + fstream(int); + fstream(int _f, char*, int); + ~fstream(); + + filebuf* rdbuf(); + void open(const char *, int, int = filebuf::openprot); + +}; + +inline filebuf* fstream::rdbuf() { return fstreambase::rdbuf(); } +inline void fstream::open(const char* name, int m, int prot) { + fstreambase::open(name, m, prot); } + +#endif \ No newline at end of file diff --git a/code/SIBOSDK/include/gate.g b/code/SIBOSDK/include/gate.g new file mode 100644 index 0000000..6819f9b --- /dev/null +++ b/code/SIBOSDK/include/gate.g @@ -0,0 +1,122 @@ +/* Generated by Ctran from gate.cl */ +#define GATE_G +#ifndef OLIB_G +#include +#endif +/* Class Numbers */ +#define C_GATE 0 +/* Method Numbers */ +#define O_GT_XW_ENABLE 20 +#define O_GT_DIAL_RUN 8 +#define O_GT_MENU_CLOSE 5 +#define O_GT_BUTTON_ADD 17 +#define O_GT_DIAL_ADD 7 +#define O_GT_CHOICE_CLOSE 15 +#define O_GT_MENU_RUN 4 +#define O_GT_MENU_ADD 3 +#define O_GT_WDR_PRINT_SETUP 25 +#define O_GT_DIAL_SOPEN 28 +#define O_GT_CHOICE_ADD 14 +#define O_GT_LAST_KEY 23 +#define O_GT_CARD_OPEN 10 +#define O_GT_INIT 1 +#define O_GT_SET_RSCFILE 27 +#define O_GT_DIAL_POSITION 19 +#define O_GT_CARD_CLOSE 12 +#define O_GT_BUTTON_OPEN 16 +#define O_GT_DIAL_OPEN 6 +#define O_GT_RETURN_SIGNALS 21 +#define O_GT_DO_HELP 26 +#define O_GT_CARD_ADD 11 +#define O_GT_MENU_OPEN 2 +#define O_GT_WDR_PRINT 24 +#define O_GT_CHECK_ATS_ON 22 +#define O_GT_BUTTON_CLOSE 18 +#define O_GT_DIAL_CLOSE 9 +#define O_GT_CHOICE_OPEN 13 +/* Constants for gate */ +#define PR_XWSERV_SHUTDOWN 0x01 +#define PR_XWSERV_QUERY_ALERT 0x02 +#define PR_XWSERV_S3FS 0x04 +#define PR_XWSERV_FROM_OVAL 0x08 +#define PVV_TEXT_MAX_LEN 50 +#define OPRINTER_DO_PREVIEW 1 +#define OPRINTER_PRINT_AFTER 2 +/* Types for gate */ +typedef struct +{ +short int class; +void *data; +} DITEM_LIST; +typedef struct +{ +unsigned short int xwim; +unsigned short int nmenus; +void **menus; +unsigned short int ulines[16]; +unsigned short int count; +DITEM_LIST dialret[9]; +unsigned short int nrec; +void *orec; +unsigned short int preview; +} PURE_GATE; +typedef struct +{ +unsigned char Mode; +unsigned char Flags; +} PVV_DISPLAY; +typedef struct +{ +unsigned short int fht; +unsigned short int fds; +unsigned short int fas; +unsigned short int fnw; +unsigned short int fmw; +unsigned short int cht; +unsigned short int mbht; +unsigned short int bfid; +unsigned short int bulyo; +unsigned short int bulht; +unsigned short int ninlb; +unsigned short int ssww; +unsigned short int bsww; +unsigned short int hllg; +unsigned short int samo; +unsigned short int damo; +} X_CONSTANTS; +typedef struct +{ +unsigned short int fht; +unsigned short int fds; +unsigned short int fas; +unsigned short int fnw; +unsigned short int fmw; +unsigned short int cht; +unsigned short int bulyo; +unsigned short int bulht; +unsigned short int ninlb; +} DLG_X_CONSTANTS; +/* Property of gate */ +typedef struct { +void *waotstat; +void *concb; +int xadd; +unsigned short int flags; +unsigned short int dialres; +X_CONSTANTS x; +void *getkeys; +unsigned short int lastkey; +unsigned short int lastmods; +unsigned short int atpid; +unsigned short int atson; +void *today_hook; +char shift_txt[10]; +PVV_DISPLAY prevdisp; +DLG_X_CONSTANTS dx; +PURE_GATE g; +} PRS_GATE; +typedef struct pr_gate +{ +PRS_ROOT root; +PRS_GATE gate; +} PR_GATE; diff --git a/code/SIBOSDK/include/gate.ing b/code/SIBOSDK/include/gate.ing new file mode 100644 index 0000000..eb2dbe3 --- /dev/null +++ b/code/SIBOSDK/include/gate.ing @@ -0,0 +1,116 @@ +; Generated by Ctran from gate.cl +GATE_ING equ 1 +IFNDEF OLIB_ING + INCLUDE ..\inc\OLIB.ING +ENDIF +; Class Numbers +C_GATE equ 0 +; Method Numbers +O_GT_XW_ENABLE equ 20 +O_GT_DIAL_RUN equ 8 +O_GT_MENU_CLOSE equ 5 +O_GT_BUTTON_ADD equ 17 +O_GT_DIAL_ADD equ 7 +O_GT_CHOICE_CLOSE equ 15 +O_GT_MENU_RUN equ 4 +O_GT_MENU_ADD equ 3 +O_GT_WDR_PRINT_SETUP equ 25 +O_GT_DIAL_SOPEN equ 28 +O_GT_CHOICE_ADD equ 14 +O_GT_LAST_KEY equ 23 +O_GT_CARD_OPEN equ 10 +O_GT_INIT equ 1 +O_GT_SET_RSCFILE equ 27 +O_GT_DIAL_POSITION equ 19 +O_GT_CARD_CLOSE equ 12 +O_GT_BUTTON_OPEN equ 16 +O_GT_DIAL_OPEN equ 6 +O_GT_RETURN_SIGNALS equ 21 +O_GT_DO_HELP equ 26 +O_GT_CARD_ADD equ 11 +O_GT_MENU_OPEN equ 2 +O_GT_WDR_PRINT equ 24 +O_GT_CHECK_ATS_ON equ 22 +O_GT_BUTTON_CLOSE equ 18 +O_GT_DIAL_CLOSE equ 9 +O_GT_CHOICE_OPEN equ 13 +; Constants for gate +PR_XWSERV_SHUTDOWN equ (001h) +PR_XWSERV_QUERY_ALERT equ (002h) +PR_XWSERV_S3FS equ (004h) +PR_XWSERV_FROM_OVAL equ (008h) +PVV_TEXT_MAX_LEN equ (50) +OPRINTER_DO_PREVIEW equ (1) +OPRINTER_PRINT_AFTER equ (2) +; Types for gate +DITEM_LIST struc +DITEM_LISTClass dw ? +DITEM_LISTData dw ? +DITEM_LIST ends +PURE_GATE struc +PURE_GATEXwim dw ? +PURE_GATENmenus dw ? +PURE_GATEMenus dw ? +PURE_GATEUlines db (2) * 16 dup (?) +PURE_GATECount dw ? +PURE_GATEDialret db (size DITEM_LIST)* 9 dup (?) +PURE_GATENrec dw ? +PURE_GATEOrec dw ? +PURE_GATEPreview dw ? +PURE_GATE ends +PVV_DISPLAY struc +PVV_DISPLAYMode db ? +PVV_DISPLAYFlags db ? +PVV_DISPLAY ends +X_CONSTANTS struc +X_CONSTANTSFht dw ? +X_CONSTANTSFds dw ? +X_CONSTANTSFas dw ? +X_CONSTANTSFnw dw ? +X_CONSTANTSFmw dw ? +X_CONSTANTSCht dw ? +X_CONSTANTSMbht dw ? +X_CONSTANTSBfid dw ? +X_CONSTANTSBulyo dw ? +X_CONSTANTSBulht dw ? +X_CONSTANTSNinlb dw ? +X_CONSTANTSSsww dw ? +X_CONSTANTSBsww dw ? +X_CONSTANTSHllg dw ? +X_CONSTANTSSamo dw ? +X_CONSTANTSDamo dw ? +X_CONSTANTS ends +DLG_X_CONSTANTS struc +DLG_X_CONSTANTSFht dw ? +DLG_X_CONSTANTSFds dw ? +DLG_X_CONSTANTSFas dw ? +DLG_X_CONSTANTSFnw dw ? +DLG_X_CONSTANTSFmw dw ? +DLG_X_CONSTANTSCht dw ? +DLG_X_CONSTANTSBulyo dw ? +DLG_X_CONSTANTSBulht dw ? +DLG_X_CONSTANTSNinlb dw ? +DLG_X_CONSTANTS ends +; Property of gate +PRS_GATE struc +GateWaotstat dw ? +GateConcb dw ? +GateXadd dw ? +GateFlags dw ? +GateDialres dw ? +GateX X_CONSTANTS <> +GateGetkeys dw ? +GateLastkey dw ? +GateLastmods dw ? +GateAtpid dw ? +GateAtson dw ? +GateToday_hook dw ? +GateShift_txt db (1) * 10 dup (?) +GatePrevdisp PVV_DISPLAY <> +GateDx DLG_X_CONSTANTS <> +GateG PURE_GATE <> +PRS_GATE ends +PR_GATE struc +GateRoot PRS_ROOT <> +GateGate PRS_GATE <> +PR_GATE ends diff --git a/code/SIBOSDK/include/gauge.g b/code/SIBOSDK/include/gauge.g new file mode 100644 index 0000000..8d25c52 --- /dev/null +++ b/code/SIBOSDK/include/gauge.g @@ -0,0 +1,30 @@ +/* Generated by Ctran from gauge.cl */ +#define GAUGE_G +#ifndef LODGER_G +#include +#endif +/* Class Numbers */ +#define C_GAUGE 24 +/* Method Numbers */ +/* Constants for gauge */ +#define GAUGE_WHITE 1 +#define GAUGE_GREY 2 +#define GAUGE_BLACK 3 +/* Types for gauge */ +typedef struct +{ +unsigned short int size[4]; +unsigned char colour[4]; +} SE_GAUGE; +/* Property of gauge */ +typedef struct { +unsigned short int size[4]; +unsigned char colour[4]; +} PRS_GAUGE; +typedef struct pr_gauge +{ +PRS_ROOT root; +PRS_WIN win; +PRS_LODGER lodger; +PRS_GAUGE gauge; +} PR_GAUGE; diff --git a/code/SIBOSDK/include/gauge.ing b/code/SIBOSDK/include/gauge.ing new file mode 100644 index 0000000..30a7ab4 --- /dev/null +++ b/code/SIBOSDK/include/gauge.ing @@ -0,0 +1,28 @@ +; Generated by Ctran from gauge.cl +GAUGE_ING equ 1 +IFNDEF LODGER_ING + INCLUDE ..\inc\LODGER.ING +ENDIF +; Class Numbers +C_GAUGE equ 24 +; Method Numbers +; Constants for gauge +GAUGE_WHITE equ (1) +GAUGE_GREY equ (2) +GAUGE_BLACK equ (3) +; Types for gauge +SE_GAUGE struc +SE_GAUGESize db (2) * 4 dup (?) +SE_GAUGEColour db (1) * 4 dup (?) +SE_GAUGE ends +; Property of gauge +PRS_GAUGE struc +GaugeSize db (2) * 4 dup (?) +GaugeColour db (1) * 4 dup (?) +PRS_GAUGE ends +PR_GAUGE struc +GaugeRoot PRS_ROOT <> +GaugeWin PRS_WIN <> +GaugeLodger PRS_LODGER <> +GaugeGauge PRS_GAUGE <> +PR_GAUGE ends diff --git a/code/SIBOSDK/include/generic.hpp b/code/SIBOSDK/include/generic.hpp new file mode 100644 index 0000000..abea23c --- /dev/null +++ b/code/SIBOSDK/include/generic.hpp @@ -0,0 +1,47 @@ +/* Release 3.10 */ +/*-------------------------------------------------------------------------* +* * +* GENERIC.HPP - header file for creating generic classes. * +* * +* COPYRIGHT (C) 1990..1992 Clarion Software Corporation * +* All Rights Reserved * +* * +*--------------------------------------------------------------------------*/ +#include + +#ifndef _GENERIC_INC_ +#define _GENERIC_INC_ + +#define _PASTE2(x, y) _PASTE2_x(x, y) +#define _PASTE2_x(x, y) x##y +#define _PASTE3(x, y, z) _PASTE3_x(x, y, z) +#define _PASTE3_x(x, y, z) x##y##z +#define _PASTE4(w, x, y, z) _PASTE4_x(w, x, y, z) +#define _PASTE4_x(w, x, y, z) w##x##y##z + +#define _ALT_PASTE2(x, y) _ALT_PASTE2_x(x, y) +#define _ALT_PASTE2_x(x, y) x##y +#define _ALT_PASTE3(x, y, z) _ALT_PASTE3_x(x, y, z) +#define _ALT_PASTE3_x(x, y, z) x##y##z +#define _ALT_PASTE4(w, x, y, z) _ALT_PASTE4_x(w, x, y, z) +#define _ALT_PASTE4_x(w, x, y, z) w##x##y##z + +// macros for the declaration and implementation of classes +#define declare(x, y) _PASTE2(x, declare)(y) +#define implement(x, y) _PASTE2(x, implement)(y) +#define declare2(x, y, z) _PASTE2(x, declare2)(y, z) +#define implement2(x, y, z) _PASTE2(x, implement2)(y, z) + +// macros for the declaration of error-handling functions + +extern genericerror(int, char*); +typedef int (*GPT)(int, char*); +#define set_handler(generic, type, x) _PASTE4(set_, type, generic, _handler)(x) +#define errorhandler(generic, type) _PASTE3(type, generic, handler) +#define callerror(generic, type, x, y) (*errorhandler(generic, type))(x, y) + +#define name2(x, y) _ALT_PASTE2_x(x, y) +#define name3(x, y, z) _ALT_PASTE3_x(x, y, z) +#define name4(w, x, y, z) _ALT_PASTE4_x(w, x, y, z) + +#endif diff --git a/code/SIBOSDK/include/gridwin.g b/code/SIBOSDK/include/gridwin.g new file mode 100644 index 0000000..f4c3260 --- /dev/null +++ b/code/SIBOSDK/include/gridwin.g @@ -0,0 +1,80 @@ +/* Generated by Ctran from gridwin.cl */ +#define GRIDWIN_G +#ifndef BWIN_G +#include +#endif +/* Class Numbers */ +#define C_GRIDWIN 20 +/* Method Numbers */ +#define O_GW_GET_CURRENT 19 +#define O_GW_SET_ROW_HEIGHT 18 +#define O_GW_HIGHLIGHT 21 +#define O_GW_SET_COL_WIDTH 17 +#define O_GW_DRAW_CELLS 15 +#define O_GW_MOVE_TO 16 +#define O_GW_ZOOM 20 +#define O_GW_GET_DATA 22 +#define O_GW_GET_CELL_RECT 14 +/* Constants for gridwin */ +#define PR_GRIDWIN_MIN_COL_WIDTH 4 +#define PR_GRIDWIN_CELL_HGAP 2 +#define PR_GRIDWIN_CELL_LGAP 2 +#define PR_GRIDWIN_BORDER_WIDTH 1 +#define PR_GRIDWIN_SCROLL_SMALL 6 +#define PR_GRIDWIN_SCROLL_LARGE 9 +#define PR_GRIDWIN_SCROLL_ARROW 15 +#define PR_GRIDWIN_PLOT_X 0 +#define PR_GRIDWIN_PLOT_Y 2 +#define PR_GRIDWIN_ALLOC_THRESH 16 +#define PR_GRIDWIN_COMPLETE_ONLY 0x01 +#define PR_GRIDWIN_GRIDLINES 0x02 +#define PR_GRIDWIN_FREE_SIZES 0x04 +#define PR_GRIDWIN_GRID_SIZE 0x01 +#define PR_GRIDWIN_LOCK 0x02 +#define PR_GRIDWIN_SIZES 0x04 +#define PR_GRIDWIN_FLAGS 0x08 +#define PR_GRIDWIN_XPLANE 0x10 +#define PR_GRIDWIN_YPLANE 0x20 +#define PR_GRIDWIN_ZOOMBASE 0x40 +#define PR_GRIDWIN_SCROLL 0x80 +/* Types for gridwin */ +typedef struct +{ +int locked; +int anchor; +int current; +int visible; +unsigned char clipped; +unsigned char full; +int total; +int *psize; +int defsize; +int numspec; +int scroll; +int gutter; +int max; +int plot; +unsigned short int flags; +void *ptr; +} GRID_PLANE; +typedef struct +{ +GRID_PLANE xplane; +GRID_PLANE yplane; +int zoombase; +int zoom; +unsigned short int flags; +} IN_GRIDWIN; +/* Property of gridwin */ +typedef struct { +IN_GRIDWIN params; +P_EXTENT wextent; +unsigned short int fascent; +unsigned char fstyle; +} PRS_GRIDWIN; +typedef struct pr_gridwin +{ +PRS_ROOT root; +PRS_WIN win; +PRS_GRIDWIN gridwin; +} PR_GRIDWIN; diff --git a/code/SIBOSDK/include/gridwin.ing b/code/SIBOSDK/include/gridwin.ing new file mode 100644 index 0000000..e525d64 --- /dev/null +++ b/code/SIBOSDK/include/gridwin.ing @@ -0,0 +1,77 @@ +; Generated by Ctran from gridwin.cl +GRIDWIN_ING equ 1 +IFNDEF BWIN_ING + INCLUDE ..\inc\BWIN.ING +ENDIF +; Class Numbers +C_GRIDWIN equ 20 +; Method Numbers +O_GW_GET_CURRENT equ 19 +O_GW_SET_ROW_HEIGHT equ 18 +O_GW_HIGHLIGHT equ 21 +O_GW_SET_COL_WIDTH equ 17 +O_GW_DRAW_CELLS equ 15 +O_GW_MOVE_TO equ 16 +O_GW_ZOOM equ 20 +O_GW_GET_DATA equ 22 +O_GW_GET_CELL_RECT equ 14 +; Constants for gridwin +PR_GRIDWIN_MIN_COL_WIDTH equ (4) +PR_GRIDWIN_CELL_HGAP equ (2) +PR_GRIDWIN_CELL_LGAP equ (2) +PR_GRIDWIN_BORDER_WIDTH equ (1) +PR_GRIDWIN_SCROLL_SMALL equ (6) +PR_GRIDWIN_SCROLL_LARGE equ (9) +PR_GRIDWIN_SCROLL_ARROW equ (15) +PR_GRIDWIN_PLOT_X equ (0) +PR_GRIDWIN_PLOT_Y equ (2) +PR_GRIDWIN_ALLOC_THRESH equ (16) +PR_GRIDWIN_COMPLETE_ONLY equ (001h) +PR_GRIDWIN_GRIDLINES equ (002h) +PR_GRIDWIN_FREE_SIZES equ (004h) +PR_GRIDWIN_GRID_SIZE equ (001h) +PR_GRIDWIN_LOCK equ (002h) +PR_GRIDWIN_SIZES equ (004h) +PR_GRIDWIN_FLAGS equ (008h) +PR_GRIDWIN_XPLANE equ (010h) +PR_GRIDWIN_YPLANE equ (020h) +PR_GRIDWIN_ZOOMBASE equ (040h) +PR_GRIDWIN_SCROLL equ (080h) +; Types for gridwin +GRID_PLANE struc +GRID_PLANELocked dw ? +GRID_PLANEAnchor dw ? +GRID_PLANECurrent dw ? +GRID_PLANEVisible dw ? +GRID_PLANEClipped db ? +GRID_PLANEFull db ? +GRID_PLANETotal dw ? +GRID_PLANEPsize dw ? +GRID_PLANEDefsize dw ? +GRID_PLANENumspec dw ? +GRID_PLANEScroll dw ? +GRID_PLANEGutter dw ? +GRID_PLANEMax dw ? +GRID_PLANEPlot dw ? +GRID_PLANEFlags dw ? +GRID_PLANEPtr dw ? +GRID_PLANE ends +IN_GRIDWIN struc +IN_GRIDWINXplane GRID_PLANE <> +IN_GRIDWINYplane GRID_PLANE <> +IN_GRIDWINZoombase dw ? +IN_GRIDWINZoom dw ? +IN_GRIDWINFlags dw ? +IN_GRIDWIN ends +; Property of gridwin +PRS_GRIDWIN struc +GridwinParams IN_GRIDWIN <> +GridwinWextent P_EXTENT <> +GridwinFascent dw ? +GridwinFstyle db ? +PRS_GRIDWIN ends +PR_GRIDWIN struc +GridwinRoot PRS_ROOT <> +GridwinWin PRS_WIN <> +GridwinGridwin PRS_GRIDWIN <> +PR_GRIDWIN ends diff --git a/code/SIBOSDK/include/h_eval.h b/code/SIBOSDK/include/h_eval.h new file mode 100644 index 0000000..fb288c0 --- /dev/null +++ b/code/SIBOSDK/include/h_eval.h @@ -0,0 +1,39 @@ +/* HEADER - H_EVAL.H +Epoc/Os structures and constants. +Copyright (c) Psion PLC 1991. + + VER DATE BY DESCRIPTION +----- -------- ---- ----------- +1.00F 12/03/91 PST Final release +*/ + +#define EVAL_DEFAULT_PLACES 2 +#define EVAL_DEFAULT_FMT_TYPE P_DTOB_FIXED +#define CALC_MAX_PLACES 12 +#define CALC_DEFAULT_PLACES CALC_MAX_PLACES +#define CALC_DEFAULT_FMT_TYPE P_DTOB_GENERAL +#define MAX_MEMORIES 10 + +typedef struct + { + UBYTE evalFormat; /* Dtob format code for all except calc */ + UBYTE evalDPlaces; /* Decimal places for all except calc */ + UBYTE calcFormat; /* Dtob format code */ + UBYTE calcDPlaces; /* Decimal places, if relevant */ + DOUBLE values[MAX_MEMORIES]; + } MEM_VALUES; + +typedef struct + { + UBYTE nameLbc; + UBYTE name[3]; + UBYTE valueLbc; + MEM_VALUES value; + } MEM_ENV; + +typedef struct + { + UBYTE evalDegrees; + UBYTE calcDegrees; + MEM_VALUES memVal; + } EXTENDED_MEM_VALUES; diff --git a/code/SIBOSDK/include/h_eval.inc b/code/SIBOSDK/include/h_eval.inc new file mode 100644 index 0000000..4470134 --- /dev/null +++ b/code/SIBOSDK/include/h_eval.inc @@ -0,0 +1,43 @@ + .xlist +; Include file - H_EVAL.INC +; Epoc/Os OPL runtime include file +; Copyright (c) Psion PLC 1988. +; VER DATE BY DESCRIPTION +; ----- -------- ---- ----------- +; 1.00A 04/06/91 HP First release +; +H_EVAL_INC equ 1 + .xlist +; +EVAL_DEFAULT_PLACES equ 2 +EVAL_DEFAULT_FMT_TYPE equ DtobTypeFixed +CALC_MAX_PLACES equ 12 +CALC_DEFAULT_PLACES equ CALC_MAX_PLACES +CALC_DEFAULT_FMT_TYPE equ DtobTypeGeneral +MAX_MEMORIES equ 10 +; +MEM_VALUES struc +memValuesEvalFormat db ? +memValuesEvalDPlaces db ? +memValuesCalcFormat db ? +memValuesCalcDPlaces db ? +memValuesMemories dq MAX_MEMORIES dup (?) +MEM_VALUES ends +; +; Memory environment variable structure (name M$V) +; +MEM_ENV struc +memEnvNameLbc db ? +memEnvName db 3 dup (?) +memEnvValueLbc db ? +memEnvValue MEM_VALUES <> +MEM_ENV ends +; +sizeMemName = memEnvValueLbc-memEnvName ; M$V +; +EXTENDED_MEM_VALUES struc +exMemValuesEvalDegrees db ? +exMemValuesCalcDegrees db ? +exMemValuesMemValues MEM_VALUES <> +EXTENDED_MEM_VALUES ends + diff --git a/code/SIBOSDK/include/h_file.h b/code/SIBOSDK/include/h_file.h new file mode 100644 index 0000000..a900311 --- /dev/null +++ b/code/SIBOSDK/include/h_file.h @@ -0,0 +1,25 @@ +/* +HEADER - H_FILE.H +*/ + +#define H_FILE_H + +#define H_FILE_ALLOW_DIRS 0x02 +#define H_FILE_JUST_DIRS 0x04 +#define H_FILE_FORCE_NXIST 0x08 +#define H_FILE_NO_AUTOQUERY 0x10 +#define H_FILE_ACCEPT_NULL 0x20 +#define H_FILE_SET_DEFEXT 0x40 +#define H_FILE_CAN_WILDCARD 0x80 + +#define H_FILE_STANDARD_INIT 0x01 +#define H_FILE_RESTRICT_LIST H_FILE_FORCE_NXIST +#define H_FILE_CAN_TAG H_FILE_NO_AUTOQUERY + +#define H_FILE_HWIF_MASK 0xfe +#define H_FILE_PICK_SELECTOR 0 +#define H_FILE_NEW_EDITOR 0x01 + +#define H_FILE_IS_DIR 0x01 +#define H_FILE_AT_ROOT 0x02 +#define H_FILE_IS_ROOT 0x03 diff --git a/code/SIBOSDK/include/h_file.inc b/code/SIBOSDK/include/h_file.inc new file mode 100644 index 0000000..377eb3c --- /dev/null +++ b/code/SIBOSDK/include/h_file.inc @@ -0,0 +1,29 @@ + .xlist +; Include file - H_FILE.INC +; Flags for Hwif file selector and editor +; Copyright (c) Psion PLC 1988. +; VER DATE BY DESCRIPTION +; ----- -------- ---- ----------- +; 28/08/91 HP First release +; +H_FILE_INC equ 1 +; +H_FILE_ALLOW_DIRS equ 02h +H_FILE_JUST_DIRS equ 04h +H_FILE_FORCE_NXIST equ 08h +H_FILE_NO_AUTOQUERY equ 10h +H_FILE_ACCEPT_NULL equ 20h +H_FILE_SET_DEFEXT equ 40h +H_FILE_CAN_WILDCARD equ 80h + +H_FILE_STANDARD_INIT equ 01h +H_FILE_RESTRICT_LIST equ H_FILE_FORCE_NXIST +H_FILE_CAN_TAG equ H_FILE_NO_AUTOQUERY + +H_FILE_HWIF_MASK equ 0feh +H_FILE_PICK_SELECTOR equ 0h +H_FILE_NEW_EDITOR equ 01h + +H_FILE_IS_DIR equ 01h +H_FILE_AT_ROOT equ 02h +H_FILE_IS_ROOT equ 03h diff --git a/code/SIBOSDK/include/hactive.g b/code/SIBOSDK/include/hactive.g new file mode 100644 index 0000000..93bb036 --- /dev/null +++ b/code/SIBOSDK/include/hactive.g @@ -0,0 +1,53 @@ +/* Generated by Ctran from hactive.cl */ +#define HACTIVE_G +#ifndef APPMAN_G +#include +#endif +/* Class Numbers */ +#define C_SHUTTER 49 +#define C_WAOTSTAT 50 +#define C_HAIDLE 51 +#define C_DIALAO 52 +/* Method Numbers */ +#define O_HAI_KEY 6 +/* Constants for shutter */ +#define SHUTTER_BUFFER_LEN 128 +#define SHUTTER_COUNT_MAX 32 +/* Property of shutter */ +typedef struct { +short int count; +unsigned char buf[128]; +} PRS_SHUTTER; +typedef struct pr_shutter +{ +PRS_ROOT root; +PRS_ACTIVE active; +PRS_SHUTTER shutter; +} PR_SHUTTER; +/* Property of waotstat */ +typedef struct { +unsigned short int count; +} PRS_WAOTSTAT; +typedef struct pr_waotstat +{ +PRS_ROOT root; +PRS_ACTIVE active; +PRS_WAOTSTAT waotstat; +} PR_WAOTSTAT; +/* Property of haidle */ +typedef struct { +void *rbuf; +} PRS_HAIDLE; +typedef struct pr_haidle +{ +PRS_ROOT root; +PRS_ACTIVE active; +PRS_HAIDLE haidle; +} PR_HAIDLE; +/* Property of dialao */ +typedef struct pr_dialao +{ +PRS_ROOT root; +PRS_ACTIVE active; +PRS_HAIDLE haidle; +} PR_DIALAO; diff --git a/code/SIBOSDK/include/hactive.ing b/code/SIBOSDK/include/hactive.ing new file mode 100644 index 0000000..6cf1fac --- /dev/null +++ b/code/SIBOSDK/include/hactive.ing @@ -0,0 +1,49 @@ +; Generated by Ctran from hactive.cl +HACTIVE_ING equ 1 +IFNDEF APPMAN_ING + INCLUDE ..\inc\APPMAN.ING +ENDIF +; Class Numbers +C_SHUTTER equ 49 +C_WAOTSTAT equ 50 +C_HAIDLE equ 51 +C_DIALAO equ 52 +; Method Numbers +O_HAI_KEY equ 6 +; Constants for shutter +SHUTTER_BUFFER_LEN equ (128) +SHUTTER_COUNT_MAX equ (32) +; Property of shutter +PRS_SHUTTER struc +ShutterCount dw ? +ShutterBuf db (1) * 128 dup (?) +PRS_SHUTTER ends +PR_SHUTTER struc +ShutterRoot PRS_ROOT <> +ShutterActive PRS_ACTIVE <> +ShutterShutter PRS_SHUTTER <> +PR_SHUTTER ends +; Property of waotstat +PRS_WAOTSTAT struc +WaotstatCount dw ? +PRS_WAOTSTAT ends +PR_WAOTSTAT struc +WaotstatRoot PRS_ROOT <> +WaotstatActive PRS_ACTIVE <> +WaotstatWaotstat PRS_WAOTSTAT <> +PR_WAOTSTAT ends +; Property of haidle +PRS_HAIDLE struc +HaidleRbuf dw ? +PRS_HAIDLE ends +PR_HAIDLE struc +HaidleRoot PRS_ROOT <> +HaidleActive PRS_ACTIVE <> +HaidleHaidle PRS_HAIDLE <> +PR_HAIDLE ends +; Property of dialao +PR_DIALAO struc +DialaoRoot PRS_ROOT <> +DialaoActive PRS_ACTIVE <> +DialaoHaidle PRS_HAIDLE <> +PR_DIALAO ends diff --git a/code/SIBOSDK/include/hasrv.h b/code/SIBOSDK/include/hasrv.h new file mode 100644 index 0000000..41c6627 --- /dev/null +++ b/code/SIBOSDK/include/hasrv.h @@ -0,0 +1,39 @@ +/* INCLUDE - HASRV.H +Consumer Handheld alarm server constants. +Copyright (c) Psion PLC 1991 - 1996. + +*/ +#define HASRV_H +#ifndef P_FILE_H +#include +#endif + +#define TypeTimedAlarm 1 /* Timed diary type alarm */ +#define TypeUnTimedAlarm 2 /* Untimed diary type alarm */ +#define OldMaxAlarmText 65 /* S3 Maximum size of alarm text including zts */ +#define MaxAlarmText 161 /* Maximum size of alarm text including zts */ + +/* ALM: i/o functions as well as P_FCLOSE and P_FCANCEL */ +#define A_FUNTIMED P_FREAD +#define A_FTIMED P_FWRITE +#define A_FUNTIMED_X P_FSEEK +#define A_FTIMED_X P_FSETEOF + +#define TIME_TO_ALERT 0 /* First time is when to raise the alert */ +#define TIME_EVENT_DUE 1 /* Second time is when the actual event is due */ + +typedef struct + { + UBYTE len; + TEXT name[8]; + UBYTE zero_term; + } SE_SND; + +typedef struct + { + ULONG absTime; /* Alarm time in seconds */ + ULONG dueTime; /* Actual time alarm is due for */ + SE_SND sound; /* The sound to play */ + } AXDATA; + + diff --git a/code/SIBOSDK/include/help.g b/code/SIBOSDK/include/help.g new file mode 100644 index 0000000..b2ad184 --- /dev/null +++ b/code/SIBOSDK/include/help.g @@ -0,0 +1,43 @@ +/* Generated by Ctran from help.cl */ +#define HELP_G +#ifndef DLGBOX_G +#include +#endif +#ifndef LISTBOX_G +#include +#endif +/* Class Numbers */ +#define C_HELPLIST 47 +#define C_HELPDLG 48 +/* Method Numbers */ +/* Types for helplist */ +typedef struct +{ +unsigned short int topic_id; +char topic[1]; +} HELP_RSC; +/* Property of helplist */ +typedef struct { +PR_VASTR *list; +PR_VAFLAT *ids; +unsigned short int firsttop; +char title[50]; +} PRS_HELPLIST; +typedef struct pr_helplist +{ +PRS_ROOT root; +PRS_WIN win; +PRS_LISTBOX listbox; +PRS_HELPLIST helplist; +} PR_HELPLIST; +/* Property of helpdlg */ +typedef struct { +PR_HELPLIST *listbox; +} PRS_HELPDLG; +typedef struct pr_helpdlg +{ +PRS_ROOT root; +PRS_WIN win; +PRS_DLGCHAIN dlgchain; +PRS_HELPDLG helpdlg; +} PR_HELPDLG; diff --git a/code/SIBOSDK/include/help.ing b/code/SIBOSDK/include/help.ing new file mode 100644 index 0000000..f7c3a94 --- /dev/null +++ b/code/SIBOSDK/include/help.ing @@ -0,0 +1,40 @@ +; Generated by Ctran from help.cl +HELP_ING equ 1 +IFNDEF DLGBOX_ING + INCLUDE ..\inc\DLGBOX.ING +ENDIF +IFNDEF LISTBOX_ING + INCLUDE ..\inc\LISTBOX.ING +ENDIF +; Class Numbers +C_HELPLIST equ 47 +C_HELPDLG equ 48 +; Method Numbers +; Types for helplist +HELP_RSC struc +HELP_RSCTopic_id dw ? +HELP_RSCTopic db (1) * 1 dup (?) +HELP_RSC ends +; Property of helplist +PRS_HELPLIST struc +HelplistList dw ? +HelplistIds dw ? +HelplistFirsttop dw ? +HelplistTitle db (1) * 50 dup (?) +PRS_HELPLIST ends +PR_HELPLIST struc +HelplistRoot PRS_ROOT <> +HelplistWin PRS_WIN <> +HelplistListbox PRS_LISTBOX <> +HelplistHelplist PRS_HELPLIST <> +PR_HELPLIST ends +; Property of helpdlg +PRS_HELPDLG struc +HelpdlgListbox dw ? +PRS_HELPDLG ends +PR_HELPDLG struc +HelpdlgRoot PRS_ROOT <> +HelpdlgWin PRS_WIN <> +HelpdlgDlgchain PRS_DLGCHAIN <> +HelpdlgHelpdlg PRS_HELPDLG <> +PR_HELPDLG ends diff --git a/code/SIBOSDK/include/htime.g b/code/SIBOSDK/include/htime.g new file mode 100644 index 0000000..8379cc4 --- /dev/null +++ b/code/SIBOSDK/include/htime.g @@ -0,0 +1,29 @@ +/* Generated by Ctran from htime.cl */ +#define HTIME_G +#ifndef TIME_G +#include +#endif +/* Class Numbers */ +#define C_HTIME 11 +/* Method Numbers */ +#define O_TO_SET_ABBREVIATIONS 10 +/* Constants for htime */ +#define PR_TIME_ABBREVIATE 0x1000 +#define PR_TIME_FORCE_UPDATE_FORMAT 0x2000 +#define HTIME_FIRST_DAY 29219L +#define HTIME_LAST_DAY 54786L +#define HTIME_FIRST_SEC 0L +#define HTIME_LAST_SEC 86399L +#define HTIME_FIRST_MIN 0L +#define HTIME_LAST_MIN 86340L +/* Property of htime */ +typedef struct { +unsigned char tDay; +unsigned char tMonth; +} PRS_HTIME; +typedef struct pr_htime +{ +PRS_ROOT root; +PRS_TIME time; +PRS_HTIME htime; +} PR_HTIME; diff --git a/code/SIBOSDK/include/htime.ing b/code/SIBOSDK/include/htime.ing new file mode 100644 index 0000000..6f3803e --- /dev/null +++ b/code/SIBOSDK/include/htime.ing @@ -0,0 +1,28 @@ +; Generated by Ctran from htime.cl +HTIME_ING equ 1 +IFNDEF TIME_ING + INCLUDE ..\inc\TIME.ING +ENDIF +; Class Numbers +C_HTIME equ 11 +; Method Numbers +O_TO_SET_ABBREVIATIONS equ 10 +; Constants for htime +PR_TIME_ABBREVIATE equ (01000h) +PR_TIME_FORCE_UPDATE_FORMAT equ (02000h) +HTIME_FIRST_DAY equ (29219L) +HTIME_LAST_DAY equ (54786L) +HTIME_FIRST_SEC equ (0L) +HTIME_LAST_SEC equ (86399L) +HTIME_FIRST_MIN equ (0L) +HTIME_LAST_MIN equ (86340L) +; Property of htime +PRS_HTIME struc +HtimeTDay db ? +HtimeTMonth db ? +PRS_HTIME ends +PR_HTIME struc +HtimeRoot PRS_ROOT <> +HtimeTime PRS_TIME <> +HtimeHtime PRS_HTIME <> +PR_HTIME ends diff --git a/code/SIBOSDK/include/hwif.h b/code/SIBOSDK/include/hwif.h new file mode 100644 index 0000000..5dd66fe --- /dev/null +++ b/code/SIBOSDK/include/hwif.h @@ -0,0 +1,341 @@ +/* HEADER - HWIF.H +Copyright (C) Psion PLC 1992 + VER DATE BY DESCRIPTION +===== ======== === =========== +1.20F 08/11/92 DWW New version for Developers Conference +2.00F 01/12/93 DWW Version 2 C SDK +*/ +#define HWIF_H +#ifndef P_GRAF_H +#include +#endif +#ifndef WLIB_H +#include +#endif +#ifdef STDEPOC_H +# ifndef P_CONS_H +# include +# endif +#else +# ifndef EPOCCONS_H +# include +# endif +#endif + +typedef struct + { + char *title; + unsigned short int nlines; + } H_MENU_DATA; +#define H_DIALOG_TEXT 0 +#define H_DIALOG_CHOICE 1 +#define H_DIALOG_NUMBER 2 +#define H_DIALOG_FLOAT 3 +#define H_DIALOG_TIME 4 +#define H_DIALOG_DATE 5 +#define H_DIALOG_EDIT 6 +#define H_DIALOG_SEDIT 7 +#define H_DIALOG_XINPUT 8 +#define H_DIALOG_FSEL 9 +#define H_DIALOG_BUTTONS 10 +typedef struct + { + char *str; + unsigned short int type; + } H_DI_TEXT; +#define H_DTEXT_ALIGN_LEFT 0 +#define H_DTEXT_ALIGN_RIGHT 1 +#define H_DTEXT_ALIGN_CENTRE 2 +#define H_DTEXT_BOLD 0x100 +#define H_DTEXT_UNDERLINE 0x200 +#define H_DTEXT_SELECTABLE 0x400 +typedef struct + { + union + { + unsigned short int *sel; + unsigned short int count; + } u; + void *menu; + } H_DI_CHOICE; +typedef struct + { + long int *value; + long int low; + long int high; + } H_DI_NUMBER; +typedef struct + { + double *value; + double low; + double high; + } H_DI_FLOAT; +typedef struct + { + unsigned long int *value; + unsigned long int low; + unsigned long int high; + unsigned short int type; + } H_DI_TIME; +#define H_DTIME_SHOW_SECONDS 1 +#define H_DTIME_DURATION 2 +typedef struct + { + unsigned long int *value; + unsigned long int low; + unsigned long int high; + } H_DI_DATE; +#define H_LAST_DAY 93501l +#define H_FIRST_SYS_DAY 25567l +#define H_LAST_SYS_DAY 75276l +typedef struct + { + char *str; + unsigned short int len; + } H_DI_EDIT; +typedef struct + { + char *str; + unsigned short int len; + unsigned short int width; + } H_DI_SEDIT; +typedef struct + { + char *str; + } H_DI_XINPUT; +typedef struct + { + char *fname; + unsigned short int flags; + } H_DI_FSEL; +typedef struct + { + char *str; + short int accel; + } H_CARD; +typedef struct + { + char *str; + } H_CHOICE; +typedef struct + { + char *str; + unsigned short int keycode; + } H_BUTTON; +#define W_EVENT_KEY (CONS_SPECIAL_EVENT*256) +#define H_FILE_ALLOW_DIRS 0x02 +#define H_FILE_JUST_DIRS 0x04 +#define H_FILE_FORCE_NXIST 0x08 +#define H_FILE_NO_AUTOQUERY 0x10 +#define H_FILE_ACCEPT_NULL 0x20 +#define H_FILE_SET_DEFEXT 0x40 +#define H_FILE_CAN_WILDCARD 0x80 +#define H_FILE_RESTRICT_LIST H_FILE_FORCE_NXIST +#define H_FILE_PICK_SELECTOR 0 +#define H_FILE_NEW_EDITOR 0x01 +#define H_PRINT_PAGE 0x01 +#define H_PRINT_LINE 0x02 +#define H_PRINT_RIGHT 0x04 +#define H_PRINT_TEXT 0x10 +#define H_PRINT_KEEP 0x8000 +#define H_PRINT_STY_UNDERLINE 0x01 +#define H_PRINT_STY_BOLD 0x02 +#define H_PRINT_STY_ITALIC 0x04 +#define H_PRINT_STY_SUPER 0x08 +#define H_PRINT_STY_SUB 0x10 +typedef struct + { + short int flags; + short int typf; + short int fheight; + short int style; + short int down; + short int indent; + short int height; + short int right; + char *buf; + unsigned short int blen; + } H_PRINT; +#define H_TIME_SET_SDATE 0 +#define H_TIME_SET_DATE 1 +#define H_TIME_SET_DAYSEC 2 +#define H_TIME_SET_NOW 3 +#define H_TIME_SENSE_BOTH 3 +#define H_TIME_SENSE_DATE 4 +#define H_TIME_SENSE_TIME 5 +#define H_TIME_FORMAT_NO_DAY 0x0004 +#define H_TIME_FORMAT_NO_MONTH 0x0008 +#define H_TIME_FORMAT_NO_YEAR 0x0010 +#define H_TIME_FORMAT_MONTH_NAME 0x0020 +#define H_TIME_FORMAT_SUFFIX 0x0040 +#define H_TIME_FORMAT_DAY_NAME 0x0080 +#define H_TIME_FORMAT_NO_CENTURY 0x0100 +#define H_TIME_FORMAT_NO_SECONDS 0x0200 +#define H_ALARM_TIMED 2 +#define H_ALARM_UNTIMED 1 +typedef struct + { + unsigned short int maxchars; + unsigned short int vulen; + unsigned short int vislines; + P_POINT pos; + unsigned short int win; + unsigned short int font; + unsigned short int style; + unsigned short int lead_tot; + unsigned short int lead_top; + } H_EDIT_BOX; +typedef struct + { + unsigned short int pos; + short int line; + short int x; + } H_SCRLAY_PLX; +#define H_EDIT_BOX_CLIPBOARD 0x0040 +#define H_EDIT_BOX_LEFT_CURSOR 0x0200 +#define H_EDIT_BOX_FONT 0x1000 +#define H_EDIT_BOX_LEADING 0x2000 +#define H_EDIT_BOX_VISLINES 0x4000 +#define HEB_FIND_BACKWARDS 0x01 +#define HEB_FIND_CASESENS 0x02 +#define H_DTEDIT_DDMMYYYY 0x0000 +#define H_DTEDIT_HHMMSS 0x1100 +#define H_DTEDIT_HHMM 0x0100 +#define H_DTEDIT_HHMMSS_D 0x1300 +#define H_DTEDIT_HHMM_D 0x0300 +#define H_DTEDIT_SET_VALUE 0x0001 +#define H_DTEDIT_SET_LOW 0x0002 +#define H_DTEDIT_SET_HIGH 0x0004 +typedef struct + { + unsigned short int flags; + long int value; + long int low; + long int high; + P_POINT pos; + unsigned short int win; + unsigned short int width; + unsigned short int emph; + } H_DTEDIT; +typedef struct + { + unsigned short int flags; + long int value; + long int low; + long int high; + } H_SE_DTEDIT; +#ifdef __cplusplus +extern "C" { +#endif +extern int hIFInit(void *); +extern int hMenuOpen(void); +extern int hMenuAdd(char *,void *); +extern int hMenuRun(void); +extern void hMenuClose(void); +extern int hDlgOpen(char *); +extern int hDlgAdd(unsigned short int,char *,void *); +extern int hDlgRun(void); +extern void hDlgClose(void); +extern int hDlgPosition(int x,int y); +extern void *hCardOpen(void); +extern int hCardAdd(void *,int,int,char *); +extern void hCardClose(void *); +extern void *hChoiceOpen(void); +extern int hChoiceAdd(void *,int,char *); +extern void hChoiceClose(void *); +extern void *hButtonOpen(void); +extern int hButtonAdd(void *,int,int,char *); +extern void hButtonClose(void *); +extern void hEnsurePath(char *fname); +extern void hSetUpStatusNames(char *pb); +extern int hCrackCommandLine(void); +extern int hIsDbfCompressible(void *dH); +extern int hDTMFString(char *zts); +extern unsigned int hLastSystemKey(unsigned int *pmodifiers); +extern void uCommonInit(void); +extern void uEnableGrey(void); +extern void uGetKey(WMSG_KEY *pkey); +extern void uGetKeyA(short int *pstat,WMSG_KEY *pkey); +extern void uCancelGetKeyA(void); +extern int uKeyPressOutstanding(void); +extern void uEscape(unsigned short int flag); +extern unsigned int uFindMainWid(void); +extern void uForceToFront(void); +extern void uErrorString(char *message); +extern int uErrorValue(int ret); +extern void *uCheckHandle(void *handle); +extern void uZTStoBCS(char *bcs,char *zts); +extern int uOpenDialog(char *title); +extern int uAddDialogItem(int type,char *prompt,void *data); +extern int uRunDialog(void); +extern int cdecl uAddButtonList(char *but,int code,...); +extern int uBeginDCL(H_DI_CHOICE *pch); +extern int uGrowDCL(H_DI_CHOICE *pch,char *choice); +extern int uAddDCL(char *prompt,unsigned short int *nsel,H_DI_CHOICE *pch); +extern int cdecl uAddChoiceList(char *prompt,unsigned short int *nsel,char *choice,...); +extern int cdecl uDialogMenu(char *title,char *pb,...); +extern void cdecl uDisplayText(char *pb,...); +extern int uPresentMenus(void); +extern void uAddGreyUline(unsigned char,unsigned short int *plines); +extern void uSetDialogUline(int pos,int on); +extern int uLocateCommand(int accel); +extern void hPrintSetupDialog(void); +extern void hPrint(int printline(H_PRINT *)); +extern void hPrinterSetupDialog(void); +extern void hPrintSetSI(unsigned int subsqind); +extern int hPrintSensePageWidth(void); +extern int hPrintSenseBufWidth(char *buf,int blen); +extern void hHelpSubSystem(int startid,int indexid); +extern void *hTTOpen(void); +extern int hTTSetTime(void *handle,int type,void *data); +extern int hTTSenseString(void *handle,int type,char *buf); +extern void hTTSetFormat(void *handle,int values); +extern void hTTSetAbbreviations(void *handle,int dayabb,int monabb); +extern void hTTClose(void *handle); +extern int hEBHandleKey(void *ebH,int keycode,int modifier); +extern int hEBCompleteFormat(void *ebH); +extern char *hEBSenseText(void *ebH); +extern int hEBSetText(void *ebH,char *pb,int blen); +extern void hEBEmphasise(void *ebH,int flag); +extern int hEBSetSelect(void *ebH,int aoff,int coff); +extern int hEBSenseSelect(void *ebH,unsigned short int *top); +extern int hEBSetClipText(void *ebH,char *pb,int blen); +extern char *hEBSenseClipText(void *ebH); +extern int hEBEvaluate(void *ebH); +extern int hEBSetMargin(void *ebH,unsigned int right); +extern unsigned int hEBSenseMargin(void *ebH); +extern int hEBChangeWidth(void *ebH,int width); +extern void hEBSetCWidth(void *ebH,int cwidth); +extern int hEBInsert(void *ebH,char *pb,int blen); +extern int hEBReplace(void *ebH,char *replace,int backwards); +extern int hEBCopy(void *ebH); +extern int hEBPaste(void *ebH); +extern int hEBFind(void *ebH,char *str,int flags); +extern int hEBSenseChanged(void *ebH); +extern void hEBClearChanged(void *ebH); +extern int hEBShowSymbols(void *ebH,int flag); +extern void *hEBOpen(int flags,H_EDIT_BOX *heb); +extern void hEBClose(void *ebH); +extern void *hEBSenseDoc(void *ebH); +extern int hEDCapacity(void *doc,unsigned int maxlen); +extern int hEDInsert(void *doc,unsigned int pos,void *buf,unsigned int len); +extern int hEBDocChanged(void *ebH); +extern int hEBPosToXL(void *ebH,H_SCRLAY_PLX *plx); +extern void hDeclareAppRcb(void *rcb); +extern void *hInitAppRcb(void); +extern int hSetSystemResLang(int lang); +extern void hRequestReplacePack(void *rcb,char *fname); +extern void *hDTOpen(H_DTEDIT *dte); +extern void hDTClose(void *dte); +extern void hDTSet(void *dte,H_SE_DTEDIT *sdte); +extern void hDTSense(void *dte,H_SE_DTEDIT *sdte); +extern int hDTSelfCheck(void *dte); +extern int hDTHandleKey(void *dte,int keycode,int modifier); +extern void hDTEmphasise(void *dte,int flag); +extern void hSetVarrayInChlist(int index,int nsel,void *varray); +extern void hOODialog(int catHandle,int classno,int resid,void *rbuf); +extern int hLoadOwnDyl(int index); +#ifdef __cplusplus +} +#endif + diff --git a/code/SIBOSDK/include/hwim.ext b/code/SIBOSDK/include/hwim.ext new file mode 100644 index 0000000..9ce47cf --- /dev/null +++ b/code/SIBOSDK/include/hwim.ext @@ -0,0 +1,577 @@ +Generated by Ctran from hwim.cat +LIBRARY hwim +CLASS gate root +{ +DECLARE gt_init +DECLARE gt_menu_open +DECLARE gt_menu_add +DECLARE gt_menu_run +DECLARE gt_menu_close +DECLARE gt_dial_open +DECLARE gt_dial_add +DECLARE gt_dial_run +DECLARE gt_dial_close +DECLARE gt_card_open +DECLARE gt_card_add +DECLARE gt_card_close +DECLARE gt_choice_open +DECLARE gt_choice_add +DECLARE gt_choice_close +DECLARE gt_button_open +DECLARE gt_button_add +DECLARE gt_button_close +DECLARE gt_dial_position +DECLARE gt_xw_enable +DECLARE gt_return_signals +DECLARE gt_check_ats_on +DECLARE gt_last_key +DECLARE gt_wdr_print +DECLARE gt_wdr_print_setup +DECLARE gt_do_help +DECLARE gt_set_rscfile +DECLARE gt_dial_sopen +HAS_METHOD +HAS_PROPERTY +} +CLASS win root +{ +DECLARE wn_redraw +DECLARE wn_dodraw +DECLARE wn_connect +DECLARE wn_position +DECLARE wn_calc_position +DECLARE wn_key +DECLARE wn_visible +DECLARE wn_emphasise +DECLARE wn_sense_help +DECLARE wn_set +DECLARE wn_sense +DECLARE wn_draw +DECLARE wn_init +HAS_METHOD +HAS_PROPERTY +} +CLASS bwin win +{ +HAS_METHOD +} +CLASS lodger win +{ +DECLARE lg_set_id_pos +DECLARE lg_draw +DECLARE lg_self_check +DECLARE lg_sense_width +DECLARE lg_update +HAS_METHOD +HAS_PROPERTY +} +CLASS textwin lodger +{ +HAS_METHOD +HAS_PROPERTY +} +CLASS matcher root +{ +DECLARE im_init +DECLARE im_set_buf +DECLARE im_sense_buf +DECLARE im_set_val +DECLARE im_sense_val +DECLARE im_try_match +DECLARE im_transition +DECLARE im_key +HAS_METHOD +HAS_PROPERTY +} +CLASS vmatcher matcher +{ +DECLARE im_set_range +HAS_METHOD +HAS_PROPERTY +} +CLASS listbox bwin +{ +DECLARE lb_draw_item +DECLARE lb_draw_emphasis +DECLARE lb_size_window +DECLARE lb_item_width +DECLARE lb_take_focus +DECLARE lb_inquire_focus +DECLARE lb_inquire_item +DECLARE lb_inquire_last +HAS_METHOD +HAS_PROPERTY +} +CLASS pulldown listbox +{ +HAS_METHOD +} +CLASS menutab bwin +{ +HAS_METHOD +HAS_PROPERTY +} +CLASS menubar bwin +{ +DECLARE mb_add_menu +HAS_METHOD +HAS_PROPERTY +} +CLASS htime time +{ +DECLARE to_set_abbreviations +HAS_METHOD +HAS_PROPERTY +} +CLASS dlgchain bwin +{ +HAS_PROPERTY +} +CLASS dlgbox dlgchain +{ +DECLARE dl_item_lock +DECLARE dl_item_dim +DECLARE dl_set_item_flags +DECLARE dl_clr_item_flags +DECLARE dl_set_prompt +DECLARE dl_take_focus +DECLARE dl_handle_to_index +DECLARE dl_index_to_handle +DECLARE dl_item_replace +DECLARE dl_item_append +DECLARE dl_init +DECLARE dl_dimmed_message +DECLARE dl_item_add +DECLARE dl_set_size +DECLARE dl_inq_minsize +DECLARE dl_dyn_init +DECLARE dl_key +DECLARE dl_changed +DECLARE dl_focus +DECLARE dl_launch_sub +DECLARE dl_item_new +HAS_METHOD +HAS_PROPERTY +} +CLASS errordlg dlgbox +{ +HAS_METHOD +} +CLASS querydlg dlgbox +{ +HAS_METHOD +} +CLASS flistdlg dlgbox +{ +HAS_METHOD +} +CLASS comman root +{ +DECLARE com_init +DECLARE com_statwin +DECLARE com_accl_check +DECLARE com_menu +DECLARE com_mode_change +DECLARE com_file_change +DECLARE com_exit +HAS_METHOD +} +CLASS wserv active +{ +DECLARE ws_do_dial +DECLARE ws_add_dial +DECLARE ws_remove_dial +DECLARE ws_sense_accel +DECLARE ws_change_cliwin +DECLARE ws_cancel +DECLARE ws_wrap_para +DECLARE ws_error_dialog +DECLARE ws_query_dialog +DECLARE ws_do_help +DECLARE ws_do_submenu +DECLARE ws_set_menubar +DECLARE ws_reset_menubar +DECLARE ws_load_chlist_res +DECLARE ws_append_country +DECLARE ws_free_dial +DECLARE ws_smart_dial +DECLARE ws_dial_env +DECLARE ws_lock +DECLARE ws_format_dialog +DECLARE ws_evaluate +DECLARE ws_eval_env +DECLARE ws_sense_pdev_text +DECLARE ws_edit_pdev_setup +DECLARE ws_edit_print_context +DECLARE ws_ens_print_context +DECLARE ws_add_filelist +DECLARE ws_remove_filelist +DECLARE ws_anim_tick +DECLARE ws_switch_files +DECLARE ws_alert +DECLARE ws_unknown_wm +DECLARE ws_foreground +DECLARE ws_background +DECLARE ws_dyn_init +DECLARE ws_process_key +DECLARE ws_date_changed +DECLARE ws_launch_dyl +DECLARE ws_define_fnbar +DECLARE ws_hook_today_changed +DECLARE ws_get_alloc_info +DECLARE ws_get_print_context +DECLARE ws_self_check +DECLARE ws_hide_app +DECLARE ws_attach_app +DECLARE ws_file_info_print +DECLARE ws_run_memo +DECLARE ws_do_remote_dial +DECLARE ws_user_abandoned +HAS_METHOD +HAS_PROPERTY +} +CLASS hwimman appman +{ +DECLARE am_new_filename +DECLARE am_yield +DECLARE am_ensure_ipcs +HAS_METHOD +HAS_PROPERTY +} +CLASS vares varoot +{ +HAS_METHOD +HAS_PROPERTY +} +CLASS chlist lodger +{ +HAS_METHOD +HAS_PROPERTY +} +CLASS smaclist lodger +{ +HAS_METHOD +HAS_PROPERTY +} +CLASS aclist smaclist +{ +HAS_METHOD +HAS_PROPERTY +} +CLASS gauge lodger +{ +HAS_METHOD +HAS_PROPERTY +} +CLASS donewn gauge +{ +HAS_METHOD +HAS_PROPERTY +} +CLASS xedit lodger +{ +HAS_METHOD +HAS_PROPERTY +} +CLASS mfne lodger +{ +DECLARE mf_range_beep +HAS_METHOD +HAS_PROPERTY +} +CLASS lncedit mfne +{ +HAS_METHOD +} +CLASS ncedit lncedit +{ +HAS_METHOD +} +CLASS wncedit lncedit +{ +HAS_METHOD +} +CLASS dtedit mfne +{ +HAS_METHOD +HAS_PROPERTY +} +CLASS rgedit mfne +{ +HAS_METHOD +HAS_PROPERTY +} +CLASS lledit mfne +{ +HAS_METHOD +} +CLASS edwin lodger +{ +DECLARE ew_sense_size +DECLARE ew_set_size +DECLARE ew_set +DECLARE ew_sense +DECLARE ew_insert +DECLARE ew_snuggle_insert +DECLARE ew_set_font +DECLARE ew_leave +DECLARE ew_find +DECLARE ew_replace +DECLARE ew_evaluate +DECLARE ew_replace_clip +DECLARE ew_paste_clip +DECLARE ew_bring_in +DECLARE ew_ep_insert +DECLARE ew_return_key +DECLARE ew_tab_key +DECLARE ew_init_style +DECLARE ew_readonly +HAS_METHOD +HAS_PROPERTY +} +CLASS punctued edwin +{ +HAS_METHOD +} +CLASS ewlinksv root +{ +DECLARE ewls_init +DECLARE ewls_extract +HAS_METHOD +HAS_PROPERTY +} +CLASS wmatcher matcher +{ +HAS_METHOD +HAS_PROPERTY +} +CLASS wldselwn lodger +{ +DECLARE wld_restrict +HAS_METHOD +HAS_PROPERTY +} +CLASS nonode pnode +{ +HAS_METHOD +} +CLASS hpsel psel +{ +HAS_METHOD +HAS_PROPERTY +} +CLASS filelist listbox +{ +DECLARE fl_list_complete +DECLARE fl_locchg +HAS_METHOD +HAS_PROPERTY +} +CLASS vadev vastr +{ +HAS_METHOD +HAS_PROPERTY +} +CLASS packsel chlist +{ +HAS_METHOD +HAS_PROPERTY +} +CLASS fnedit edwin +{ +HAS_METHOD +HAS_PROPERTY +} +CLASS fnselwn chlist +{ +DECLARE fns_insert_tags +DECLARE fns_extract_tags +DECLARE fns_subset +DECLARE fns_validate_flist +HAS_METHOD +HAS_PROPERTY +} +CLASS fltedit edwin +{ +HAS_METHOD +HAS_PROPERTY +} +CLASS helplist listbox +{ +HAS_METHOD +HAS_PROPERTY +} +CLASS helpdlg dlgchain +{ +HAS_METHOD +HAS_PROPERTY +} +CLASS shutter active +{ +HAS_METHOD +HAS_PROPERTY +} +CLASS waotstat active +{ +HAS_METHOD +HAS_PROPERTY +} +CLASS haidle aidle +{ +DECLARE hai_key +HAS_METHOD +HAS_PROPERTY +} +CLASS dialao haidle +{ +HAS_METHOD +} +CLASS progtran server +{ +DECLARE pt_start +DECLARE pt_getline +DECLARE pt_complete +HAS_METHOD +HAS_PROPERTY +} +CLASS progexec active +{ +HAS_METHOD +HAS_PROPERTY +} +CLASS progfind locs +{ +HAS_METHOD +HAS_PROPERTY +} +CLASS setportdlg dlgbox +{ +HAS_METHOD +} +CLASS sethshkdlg dlgbox +{ +HAS_METHOD +} +CLASS evaldlg dlgbox +{ +HAS_METHOD +HAS_PROPERTY +} +CLASS dialdlg dlgbox +{ +HAS_METHOD +HAS_PROPERTY +} +CLASS freedial lodger +{ +HAS_METHOD +HAS_PROPERTY +} +CLASS fdialdlg dialdlg +{ +HAS_METHOD +} +CLASS cntrydlg dlgbox +{ +HAS_METHOD +} +CLASS sdialdlg dialdlg +{ +HAS_METHOD +} +CLASS fontsel dlgbox +{ +HAS_METHOD +HAS_PROPERTY +} +CLASS pdevdlg dlgbox +{ +HAS_METHOD +HAS_PROPERTY +} +CLASS prnctrl dlgbox +{ +HAS_METHOD +HAS_PROPERTY +} +CLASS pagectrl dlgbox +{ +HAS_METHOD +} +CLASS margins dlgbox +{ +HAS_METHOD +} +CLASS headfoot dlgbox +{ +HAS_METHOD +HAS_PROPERTY +} +CLASS prnmodel dlgbox +{ +HAS_METHOD +HAS_PROPERTY +} +CLASS pagesize dlgbox +{ +HAS_METHOD +} +CLASS printing dlgbox +{ +DECLARE printing_set_title +DECLARE printing_do_print +DECLARE printing_done +HAS_METHOD +HAS_PROPERTY +} +CLASS pmodlocs locs +{ +HAS_METHOD +HAS_PROPERTY +} +CLASS lprinter root +{ +DECLARE lpr_init +DECLARE lpr_read +DECLARE lpr_sense_buf_width +DECLARE lpr_sense_text +HAS_METHOD +HAS_PROPERTY +} +CLASS sndlist chlist +{ +HAS_METHOD +HAS_PROPERTY +} +CLASS sndlocs locs +{ +HAS_METHOD +HAS_PROPERTY +} +CLASS fsoundao haidle +{ +HAS_METHOD +HAS_PROPERTY +} +CLASS vanumber varoot +{ +DECLARE van_set_max +HAS_METHOD +HAS_PROPERTY +} +CLASS nchlist chlist +{ +HAS_METHOD +} +CLASS prnprev dlgbox +{ +HAS_METHOD +} +CLASS xpulldwn pulldown +{ +HAS_METHOD +} +CLASS vilastmoddlg dlgbox +{ +HAS_METHOD +} diff --git a/code/SIBOSDK/include/hwim.g b/code/SIBOSDK/include/hwim.g new file mode 100644 index 0000000..eef9c98 --- /dev/null +++ b/code/SIBOSDK/include/hwim.g @@ -0,0 +1,11 @@ +/* Generated by Ctran from hwim.cat */ +#define HWIM_G +#ifndef OLIB_G +#include +#endif +/* Category Numbers */ +/* EPOC */ +#define CAT_HWIM_HWIM 0 +#define CAT_HWIM_OLIB 1 +#define CAT_HWIM_OPL 2 +#define CAT_HWIM_FORM 3 diff --git a/code/SIBOSDK/include/hwim.h b/code/SIBOSDK/include/hwim.h new file mode 100644 index 0000000..c075a6a --- /dev/null +++ b/code/SIBOSDK/include/hwim.h @@ -0,0 +1,89 @@ +/* HEADER - HWIM.H +Hwim utilities constants, structures and function prototypes +Copyright (c) Psion PLC 1991 - 1996. +*/ + +#define HWIM_H + +#define PTR_CALL call(reg_param =>(bx,ax,cx,dx,si,di),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) + +#ifndef HWIMMAN_G +#include /* for the definition of DL_DATA */ +#endif + +GLREF_C INT CDECL hConfirm(INT rid,...); +GLREF_C INT CDECL h2LineConfirm(INT secondrid,INT rid,...); +GLREF_C INT CDECL hErrorDialog(INT err,INT rid,...); +GLREF_C VOID CDECL hInfoPrint(INT rid,...); +GLREF_C VOID CDECL hBusyPrint(INT delay,INT rid,...); +GLREF_C TEXT * CDECL hAtos(TEXT *buf,INT frid,...); +#pragma save,call(reg_param =>(bx),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +GLREF_C VOID hDestroy(VOID *hand); +#pragma call(reg_param =>(bx,ax,cx),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +GLREF_C INT hLaunchDial(P_CATID cat,INT class,DL_DATA *data); +#pragma call(reg_param =>(dx,si),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +GLREF_C INT hLoadResBuf(INT id,VOID *pb); +GLREF_C INT hLoadResource(INT id,VOID *ppdata); +#pragma call(reg_param =>(cx,dx,bx),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +GLREF_C INT hAtob(TEXT *pb,INT rid,INT *pargs); +#pragma call(reg_param =>(bx,ax),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +GLREF_C VOID hErrs(TEXT *buf,INT err); +#pragma call(reg_param =>(ax),reg_saved =>(bx,dx,si,di,EPOC_SAVE)) +GLREF_C VOID hInfoPrintErr(INT err); +#pragma call(reg_param =>(dx,si,di),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +GLREF_C TEXT *hLoadChlistResBuf(INT rid,INT choice,TEXT *buf); +#pragma call(reg_param =>(cx),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +GLREF_C VOID hWservComSend(INT comid); +#pragma call(reg_param =>(bx),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +GLREF_C VOID hInitVis(VOID *win); +GLREF_C VOID hAppendEllipsis(TEXT *buf); +GLREF_C VOID hSetGStyle(UINT style); +GLREF_C VOID hEnsurePath(TEXT *filename); +#pragma call(reg_param =>(),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +GLREF_C VOID hBeep(VOID); +#pragma call(reg_param =>(ax),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +GLREF_C VOID hSetGTmode(UINT tmode); +#pragma call(reg_param =>(cx),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +GLREF_C VOID hSetGFont(UINT fid); +GLREF_C INT hGetSWid(TEXT *pzts); +#pragma call(reg_param =>(cx,ax),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +GLREF_C INT hGetBWid(TEXT *pb,INT blen); +GLREF_C INT hGetBBWid(TEXT *pb,INT blen); +#pragma call(reg_param =>(bx,ax),reg_saved =>(cx,dx,si,di,EPOC_SAVE)) +GLREF_C VOID hTwipsToBuf(TEXT *pbuf,UINT val); +GLREF_C UINT hDoubleToTwips(DOUBLE *val); +GLREF_C VOID hTwipsToDouble(DOUBLE *dd,UINT value); +#pragma call(reg_param =>(dx,ax),reg_saved =>(si,di,EPOC_SAVE)) +GLREF_C VOID hDlgSet(UBYTE index,VOID *set); +GLREF_C VOID hDlgSense(UBYTE index,VOID *sense); +#pragma call(reg_param =>(dx,ax),reg_saved =>(si,di,EPOC_SAVE)) +GLREF_C VOID hDlgSetPrompt(UBYTE index,TEXT *pmt); +GLREF_C VOID hDlgSetText(UBYTE index,TEXT *buf); +GLREF_C VOID hDlgSetEdwin(UBYTE index,TEXT *buf); +GLREF_C VOID hDlgSetChlist(UBYTE index,INT nsel); +GLREF_C VOID hDlgSetChlistOn(UBYTE index); +GLREF_C VOID hDlgSetNcedit(UBYTE index,UINT value); +GLREF_C VOID hDlgSetLledit(UBYTE index,INT value); +GLREF_C VOID hDlgSetPtedit(UBYTE index,UBYTE ch); +GLREF_C VOID hDlgSetFledit(UBYTE index,DOUBLE *value); +GLREF_C VOID hDlgSetTwips(UBYTE index,UINT value); +GLREF_C VOID hDlgSenseRgedit(UBYTE index,UWORD *values); +GLREF_C VOID hDlgSenseFledit(UBYTE index,DOUBLE *value); +GLREF_C VOID hDlgItemDim(UBYTE index,INT flag); +GLREF_C VOID hDlgItemLock(UBYTE index,INT flag); +#pragma call(reg_param =>(dx,ax,bx),reg_saved =>(si,di,EPOC_SAVE)) +GLREF_C VOID hDlgSetDtedit(UBYTE index,ULONG value); +GLREF_C VOID hDlgSetRgedit(UBYTE index,UINT value1,UINT value2); +#pragma call(reg_param =>(dx),reg_saved =>(si,di,EPOC_SAVE)) +GLREF_C VOID hDlgSetTitleByRid(INT rid); +GLREF_C TEXT *hDlgSenseEdwin(UBYTE index); +GLREF_C INT hDlgSenseChlist(UBYTE index); +GLREF_C UINT hDlgSenseNcedit(UBYTE index); +GLREF_C INT hDlgSenseLledit(UBYTE index); +GLREF_C INT hDlgSensePtedit(UBYTE index); +GLREF_C UINT hDlgSenseTwips(UBYTE index); +GLREF_C ULONG hDlgSenseDtedit(UBYTE index); +GLREF_C VOID hDlgTakeFocus(UBYTE index); +#pragma METHOD_CALL +GLREF_C VOID hDlgInit(VOID *dlg,HD_DLGBOX_RSC *head,VOID *rbuf); +#pragma restore diff --git a/code/SIBOSDK/include/hwim.ing b/code/SIBOSDK/include/hwim.ing new file mode 100644 index 0000000..bac2b35 --- /dev/null +++ b/code/SIBOSDK/include/hwim.ing @@ -0,0 +1,13 @@ +; Generated by Ctran from hwim.cat +HWIM_ING equ 1 +IFNDEF OLIB_ING + INCLUDE ..\inc\OLIB.ING +ENDIF +IFNDEF NOSEND_INC + INCLUDE ..\inc\NOSEND.INC +ENDIF +; Category Numbers +CAT_HWIM_HWIM equ 0 +CAT_HWIM_OLIB equ 1 +CAT_HWIM_OPL equ 2 +CAT_HWIM_FORM equ 3 diff --git a/code/SIBOSDK/include/hwim.rg b/code/SIBOSDK/include/hwim.rg new file mode 100644 index 0000000..6c4b273 --- /dev/null +++ b/code/SIBOSDK/include/hwim.rg @@ -0,0 +1,115 @@ +#define O_PVC_PREVIEW_PRINT 8 +#define O_PVC_PREVIEW_MARGINS 9 +#define O_PVC_PREVIEW_OPTIONS 10 +#define O_PVC_PREVIEW_JUMP 11 +#define O_PVC_PREVIEW_EXIT 12 +#define BREAK_LINE_FOLLOWS 0x80 +#define C_ACLIST 23 +#define C_CHLIST 21 +#define C_DONEWN 25 +#define C_DTEDIT 31 +#define C_EDWIN 34 +#define C_FLTEDIT 46 +#define C_FNEDIT 44 +#define C_FNSELWN 45 +#define C_FREEDIAL 60 +#define C_GAUGE 24 +#define C_LLEDIT 33 +#define C_LNCEDIT 28 +#define C_NCEDIT 29 +#define C_PUNCTUED 35 +#define C_RGEDIT 32 +#define C_TEXTWIN 4 +#define C_WLDSELWN 38 +#define C_WNCEDIT 30 +#define C_XEDIT 26 +#define C_SMACLIST 22 +#define C_SNDLIST 75 +#define C_NCHLIST 79 +#define DLGBOX_NOTIFY_ENTER 0x0001 +#define DLGBOX_NOTIFY_ESCAPE 0x0002 +#define DLGBOX_RBUF_FILLED 0x0004 +#define DLGBOX_ACTION_LIST 0x0008 +#define DLGBOX_SMALL_FONT 0x0010 +#define DLGBOX_NO_WAIT 0x0020 +#define DLGBOX_NOTIFY_ALL_ACT 0x0040 +#define DLGBOX_REPORT_ACT_HORIZ 0x0080 +#define DLGBOX_APPEND_UNITS_TITLE 0x0100 +#define DLGBOX_SMALL_ACTION_LIST 0x0200 +#define DLGBOX_NO_SHADOW 0x0400 +#define DLGBOX_NO_DDP 0x0800 +#define PR_WIN_FORCE_TOP 0x8000 +#define PR_WIN_FORCE_BOTTOM 0x4000 +#define PR_WIN_FORCE_LEFT 0x2000 +#define PR_WIN_FORCE_RIGHT 0x1000 +#define DLGBOX_ITEM_NOTIFY_FOCUS 0x0080 +#define DLGBOX_ITEM_NOTIFY_CHANGED 0x0001 +#define DLGBOX_ITEM_UNDERLINED 0x0004 +#define DLGBOX_ITEM_DIMMED 0x0002 +#define DLGBOX_ITEM_CENTRE 0x0010 +#define DLGBOX_ITEM_DEAD 0x0020 +#define DLGBOX_ITEM_APPL_CAT 0x0008 +#define DLGBOX_ITEM_NEEDS_PACK 0x0100 +#define DLGBOX_ITEM_LOCKED 0x0200 +#define IN_TEXTWIN_AL_LEFT 0x00 +#define IN_TEXTWIN_AL_CENTRE 0x02 +#define IN_TEXTWIN_AL_RIGHT 0x01 +#define IN_TEXTWIN_BOLD 0x04 +#define IN_TEXTWIN_POPOUT 0x40 +#define IN_CHLIST_INCREMENTAL 0x01 +#define HTIME_FIRST_DAY 29219L +#define HTIME_LAST_DAY 54786L +#define HTIME_FIRST_SEC 0L +#define HTIME_LAST_SEC 86399L +#define HTIME_FIRST_MIN 0L +#define HTIME_LAST_MIN 86340L +#define IN_DTEDIT_INIT (0x01 |0x02 |0x04 ) +#define IN_DTEDIT_DDMMYYYY (0x0000 ) +#define IN_DTEDIT_HHMMSS (0x0100 |0x1000 ) +#define IN_DTEDIT_HHMM (0x0100 ) +#define IN_DTEDIT_HHMMSS_D (0x0100 |0x0200 |0x1000 ) +#define IN_DTEDIT_HHMM_D (0x0100 |0x0200 ) +#define IN_DTEDIT_HHMMSS_ND (0x0100 |(0x0200 |0x2000 ) |0x1000 ) +#define IN_DTEDIT_HHMM_ND (0x0100 |(0x0200 |0x2000 ) ) +#define IN_LLEDIT_LATITUDE 0 +#define IN_LLEDIT_LONGITUDE 1 +#define IN_WLDSELWN_CITY 0 +#define IN_WLDSELWN_COUNTRY 0x01 +#define IN_WLDSELWN_SECOND_PARTNER 0x10 +#define IN_WLDSELWN_FIRST_PARTNER 0x02 +#define IN_WLDSELWN_SETHOME 0x20 +#define IN_WLDSELWN_SETDFLT 0x40 +#define IN_EDWIN_VULEN_CHARACTERS 0x0080 +#define IN_EDWIN_VULEN_PIXELS (0x0080 |0x0100 ) +#define IN_EDWIN_NO_AUTOSELECT 0x0010 +#define IN_EDWIN_AUTO_CUR_END (0x0008 |0x0010 ) +#define IN_EDWIN_ACCEPT_TABS 0x0002 +#define IN_EDWIN_DIALLABLE 0x0001 +#define IN_FNSELWN_STANDARD 0x01 +#define IN_FNSELWN_SHOW_DIRS 0x02 +#define IN_FNSELWN_HIDE_FILES 0x04 +#define IN_FNSELWN_RESTRICT_LIST 0x08 +#define IN_FNSELWN_CAN_TAG 0x10 +#define IN_FNSELWN_ACCEPT_NULL 0x20 +#define IN_FNSELWN_SET_DEFEXT 0x40 +#define IN_FNSELWN_CAN_WILDCARD 0x80 +#define IN_FNEDIT_STANDARD 0x01 +#define IN_FNEDIT_ALLOW_DIRS 0x02 +#define IN_FNEDIT_JUST_DIRS 0x04 +#define IN_FNEDIT_FORCE_NXIST 0x08 +#define IN_FNEDIT_NO_AUTOQUERY 0x10 +#define IN_FNEDIT_ACCEPT_NULL 0x20 +#define IN_FNEDIT_SET_DEFEXT 0x40 +#define IN_FNEDIT_CAN_WILDCARD 0x80 +#define WR_MAX_DIAL_STRING 24 +#define P_FNAMESIZE 128 +#define W_KEY_RETURN 13 +#define W_KEY_ESCAPE 27 +#define W_KEY_TAB 9 +#define W_KEY_DELETE_LEFT 8 +#define W_KEY_UP 0x0100 +#define W_KEY_DOWN 0x0101 +#define W_KEY_RIGHT 0x0102 +#define W_KEY_LEFT 0x0103 +#define W_KEY_SPACE 32 +#define W_KEY_MENU 0x0122 diff --git a/code/SIBOSDK/include/hwim.rh b/code/SIBOSDK/include/hwim.rh new file mode 100644 index 0000000..14058c8 --- /dev/null +++ b/code/SIBOSDK/include/hwim.rh @@ -0,0 +1,207 @@ +/* +HWIM.RH - Resource file common header +Started by Carol, December 1990 +*/ + +STRUCT STRING + { + TEXT str; /* zero terminated text string */ + } + +STRUCT STRING_ARRAY + { + STRUCT strlst[]; + } + +STRUCT STRING_ARRAY_SMALL + { + LEN BYTE STRUCT strlst[]; + } + +/* +Accelerators, Menu bars and menus +*/ + +STRUCT WSERV_INFO + { + BYTE menu=0; /* which menu to start with */ + BYTE mnitem=0; /* which item to start with in that menu */ + LINK menbar_id; /* resource id of menu bar */ + BYTE first_com; /* method number of first command */ + LEN BYTE BYTE accel[]; /* acc key only */ + } + +STRUCT MENU_ITEM + BYTE { + BYTE com_id; /* method in command manager */ + TEXT mn_item; /* menu item text */ + } + +STRUCT MENU + { + LEN BYTE STRUCT items[]; /* menu items only */ + } + +STRUCT MENU_BAR_ITEM + { + LINK menu_id; /* resource id of associated menu */ + TEXT mb_item; /* menu header */ + } + +STRUCT MENU_BAR + { + LEN BYTE STRUCT items[]; /* menu bar item only */ + } + +/* +Dialog boxes +*/ + +STRUCT CHLIST + { + LINK rid=0; + BYTE nsel=0; + BYTE flags=0; + } + +STRUCT TXTMESS + { + WORD flags=0; + TEXT str=""; + } + +STRUCT EDWIN /* edit box */ + { + WORD vulen; /* ignored unless either _VULEN_ flag set */ + WORD flags=0; + WORD maxlen; + TEXT str=""; + } + +STRUCT PUSH_BUT + BYTE { + WORD keycode; + TEXT str; /* text associated with button */ + } + +STRUCT ACLIST_ARRAY + { + LEN BYTE STRUCT button[]; /* array of push_buttons */ + } + +STRUCT ACLIST /* Initialising struct for action list */ + { + LINK rid; + } + +STRUCT CHOICE_ITEM /* choice list item */ + BYTE { + TEXT str=""; /* identification text */ + } + +STRUCT LNCEDIT /* long number edit box */ + { + LONG current = 0; + LONG low = 0; /* lowest allowed value */ + LONG high = 10000000; /* highest allowed value */ + } + +STRUCT NCEDIT /* numeric control edit box (unsigned words) */ + { + WORD current = 0; + WORD low = 0; /* lowest allowed value */ + WORD high = 65535; /* highest allowed value */ + } + +STRUCT WNCEDIT /* numeric control edit box (signed words) */ + { + WORD current = 0; + WORD low = -32768; /* lowest allowed value */ + WORD high = 32767; /* highest allowed value */ + } + +STRUCT FLTEDIT /* floating point edit box */ + { + DOUBLE current=0.0; + DOUBLE low =-9.9999999999e99; /* lower bound */ + DOUBLE high =9.9999999999e99; /* upper bound */ + BYTE vulen=5; /* width of editor in characters */ + BYTE ndec=0; /* P_DTOB_GENERAL */ + } + +STRUCT DTEDIT /* combined date/time editor */ + { + WORD flags; + LONG current; + LONG low; /* lowest allowed value */ + LONG high; /* highest allowed value */ + } + +STRUCT RGEDIT /* range editor */ + { + WORD low=1; /* lowest allowed value */ + WORD value_1=1; /* lower value of range */ + WORD value_2=9999; /* higher value of range */ + WORD high=9999; /* highest allowed value */ + } + +STRUCT LLEDIT /* lat long editor */ + { + WORD flags; /* Latitude or longitude */ + WORD value=0; /* The default value */ + } + +STRUCT WLDSELWN + { + WORD flags; + } + +STRUCT FNEDIT /* filename editor */ + { + BYTE flags=0; + TEXT fname=""; + } + +STRUCT FNSELWN /* filename selector */ + { + BYTE flags=0; + TEXT fname=""; + } + +STRUCT CONTROL + LEN { + WORD flags=0; + BYTE class; /* class of control */ + TEXT prompt=""; /* Prompt for item */ + STRUCT info; /* eg CHLIST, TXTMESS, EDWIN, or NCEDIT */ + } + +STRUCT DIALOG + { + WORD flags=0; + TEXT title=""; + LEN BYTE STRUCT controls[]; /* CONTROL only */ + } + +STRUCT TOPIC_ARRAY + { + LEN BYTE LINK id_lst[]; /* ids of topics or related topics */ + } + +STRUCT HELP_ARRAY + { + LINK topic_id=0; /* id of array of related topics */ + TEXT topic; + LEN BYTE STRUCT strlst[]; + } + +STRUCT PAGE_SIZE + { + WORD width; + WORD length; + } + +STRUCT PAGE_SIZE_ARRAY + { + LEN WORD STRUCT page_size[]; + } diff --git a/code/SIBOSDK/include/hwimman.g b/code/SIBOSDK/include/hwimman.g new file mode 100644 index 0000000..64aa0a7 --- /dev/null +++ b/code/SIBOSDK/include/hwimman.g @@ -0,0 +1,236 @@ +/* Generated by Ctran from hwimman.cl */ +#define HWIMMAN_G +#ifndef PULLDOWN_G +#include +#endif +#ifndef APPMAN_G +#include +#endif +#ifndef DLGBOX_G +#include +#endif +#ifndef COMMAN_G +#include +#endif +#ifndef MENUBAR_G +#include +#endif +/* Class Numbers */ +#define C_WSERV 18 +#define C_HWIMMAN 19 +/* Method Numbers */ +#define O_WS_SMART_DIAL 22 +#define O_AM_YIELD 16 +#define O_WS_GET_ALLOC_INFO 46 +#define O_WS_SELF_CHECK 48 +#define O_WS_BACKGROUND 39 +#define O_WS_REMOVE_DIAL 8 +#define O_WS_LOAD_CHLIST_RES 19 +#define O_WS_SET_MENUBAR 17 +#define O_WS_UNKNOWN_WM 37 +#define O_WS_GET_PRINT_CONTEXT 47 +#define O_WS_DIAL_ENV 23 +#define O_WS_DO_REMOTE_DIAL 53 +#define O_WS_REMOVE_FILELIST 33 +#define O_WS_ANIM_TICK 34 +#define O_WS_ERROR_DIALOG 13 +#define O_WS_SWITCH_FILES 35 +#define O_WS_FILE_INFO_PRINT 51 +#define O_WS_HIDE_APP 49 +#define O_WS_PROCESS_KEY 41 +#define O_WS_CHANGE_CLIWIN 10 +#define O_WS_ADD_DIAL 7 +#define O_WS_WRAP_PARA 12 +#define O_AM_ENSURE_IPCS 17 +#define O_WS_DYN_INIT 40 +#define O_WS_SENSE_PDEV_TEXT 28 +#define O_WS_EVAL_ENV 27 +#define O_WS_DO_SUBMENU 16 +#define O_WS_HOOK_TODAY_CHANGED 45 +#define O_WS_ENS_PRINT_CONTEXT 31 +#define O_WS_LOCK 24 +#define O_WS_APPEND_COUNTRY 20 +#define O_WS_LAUNCH_DYL 43 +#define O_WS_FOREGROUND 38 +#define O_WS_RUN_MEMO 52 +#define O_WS_ALERT 36 +#define O_WS_DO_HELP 15 +#define O_WS_DO_DIAL 6 +#define O_WS_ATTACH_APP 50 +#define O_WS_EDIT_PRINT_CONTEXT 30 +#define O_WS_ADD_FILELIST 32 +#define O_WS_CANCEL 11 +#define O_WS_SENSE_ACCEL 9 +#define O_WS_FORMAT_DIALOG 25 +#define O_WS_QUERY_DIALOG 14 +#define O_WS_DATE_CHANGED 42 +#define O_WS_FREE_DIAL 21 +#define O_WS_USER_ABANDONED 54 +#define O_AM_NEW_FILENAME 15 +#define O_WS_RESET_MENUBAR 18 +#define O_WS_DEFINE_FNBAR 44 +#define O_WS_EVALUATE 26 +#define O_WS_EDIT_PDEV_SETUP 29 +/* Constants for wserv */ +#define PR_WSERV_CONNECT_AT_BACK W_CONNECT_AT_BACK +#define PR_WSERV_FOREGROUND 0x02 +#define PR_WSERV_CLIWIN_KEY 0x04 +#define PR_WSERV_CANCELLING 0x08 +#define PR_WSERV_BASIC_HELP 0x10 +#define PR_WSERV_FREEFORM_DIALLING 0x20 +#define PR_WSERV_INSERT_MODE 0x40 +#define PR_WSERV_INSERT_PENDING 0x80 +#define PR_WSERV_OWN_DEFAULT_FONT 0x100 +#define PR_WSERV_RECEIVED_KEY 0x200 +#define PR_WSERV_HIDDEN 0x400 +#define PR_WSERV_METRIC 0x800 +#define PR_WSERV_FULLSCREEN 0x1000 +#define PR_WSERV_CANCELLING_DIALOG 0x2000 +#define PR_WSERV_FROM_HWIF 0x4000 +#define PR_WSERV_OWNPRIO 0x8000 +#define PR_WSERV_HELP_INDEX 0x01 +#define WSERV_DTOB_HEX 3 +#define DEGREES_MODE 0x80 +#define DTOB_MAX_WIDTH 20 +#define WS_EVAL_ENV_SET 0 +#define WS_EVAL_ENV_GET 1 +#define WS_DIAL_ENV_SET 0 +#define WS_DIAL_ENV_GET 1 +#define PDEV_TEXT_MAX_LEN 14 +#define WS_LOCCHG_LOW 0x0100 +#define WS_LOCCHG_HIGH 0x4000 +#define WS_EM_STYLES 0x01 +#define WS_EM_PRINT_CONTEXT 0x02 +#define WS_EM_REUSE_BODY_BUFFER 0x04 +#define WS_EM_REUSE_STYLES_BUFFER 0x08 +#define WS_EM_CALLBACK 0x40 +#define MEMO_NO_CHANGE 0 +#define MEMO_NULL_LENGTH 1 +#define MEMO_STANDARD_CHANGE 2 +/* Types for wserv */ +typedef struct +{ +int com_cat; +unsigned short int com_class; +} IN_WSERV; +typedef struct +{ +unsigned char menu; +unsigned char mnitem; +unsigned short int menubar_id; +unsigned char first_com; +unsigned char count; +unsigned char accel[1]; +} WSERV_INFO; +typedef struct +{ +unsigned short int id; +void *rbuf; +PR_DLGBOX **pdlg; +} DL_DATA; +typedef struct +{ +char *dupnp; +char hidden[6]; +} WS_HIDE_APP_DATA; +typedef struct +{ +unsigned short int margin; +unsigned short int fmargin; +short int font; +unsigned short int style; +short int nlines; +unsigned char *ptable; +} WRAP_DATA; +typedef struct +{ +unsigned short int ncells; +unsigned short int nbytes; +} WS_ALLOC_INFO; +typedef struct +{ +void *next; +void *object; +unsigned short int message; +} WS_TODAY_HOOK; +typedef struct +{ +unsigned short int len; +void *p; +} MEMO_DATA_PART; +typedef struct +{ +MEMO_DATA_PART body; +MEMO_DATA_PART styles; +MEMO_DATA_PART title; +} MEMO_DATA; +typedef struct +{ +void *owner; +unsigned short int method; +} MEMO_CALLBACK; +/* Property of wserv */ +typedef struct { +WS_EVENT_X ws; +PR_COMMAN *com; +PR_DLGCHAIN *dial; +PR_MENUBAR *bar; +PR_WIN *cli; +WSERV_INFO *info; +WSERV_INFO *oldinfo; +PR_WIN *filter; +int filmethod; +unsigned short int flags; +unsigned short int help_index_id; +unsigned short int help; +unsigned char lock; +unsigned char subdial; +char sc[10]; +unsigned short int locmask; +PR_ROOT *filelist; +PR_ROOT *anim; +PR_ROOT *printer; +} PRS_WSERV; +typedef struct pr_wserv +{ +PRS_ROOT root; +PRS_ACTIVE active; +PRS_WSERV wserv; +} PR_WSERV; +/* Constants for hwimman */ +#define H_COMMAND_DEFAULT_FILE 'D' +#define H_COMMAND_OPEN_FILE 'O' +#define H_COMMAND_CREATE_FILE 'C' +#define H_COMMAND_EXIT 'X' +#define H_COMMAND_TRANSLATE_FILE 'T' +#define H_COMMAND_RUN_FILE 'R' +#define H_COMMAND_LAUNCH_DYL 'L' +#define H_COMMAND_BYPASS 'Z' +#define FLG_APPMAN_FULLSCREEN 0x1000 +#define FLG_APPMAN_LINKING 0x2000 +#define FLG_APPMAN_FROM_HWIF 0x4000 +#define FLG_APPMAN_OWNPRIO 0x8000 +#define FLG_APPMAN_S3FS 0x0100 +#define FLG_APPMAN_WSERV_MASK (PR_WSERV_FROM_HWIF|PR_WSERV_OWNPRIO|PR_WSERV_FULLSCREEN) +#define RUN_ACTIVE_CLEANUP_NONOTIFY -1 +/* Types for hwimman */ +typedef struct +{ +unsigned short int flags; +int wserv_cat; +unsigned short int wserv_class; +} IN_HWIMMAN; +/* Property of hwimman */ +typedef struct { +unsigned char contig; +unsigned char command; +char *defext; +char *aliasinfo; +PR_AIDLE *yield; +} PRS_HWIMMAN; +typedef struct pr_hwimman +{ +PRS_ROOT root; +PRS_APPMAN appman; +PRS_HWIMMAN hwimman; +} PR_HWIMMAN; diff --git a/code/SIBOSDK/include/hwimman.ing b/code/SIBOSDK/include/hwimman.ing new file mode 100644 index 0000000..16df6d8 --- /dev/null +++ b/code/SIBOSDK/include/hwimman.ing @@ -0,0 +1,223 @@ +; Generated by Ctran from hwimman.cl +HWIMMAN_ING equ 1 +IFNDEF PULLDOWN_ING + INCLUDE ..\inc\PULLDOWN.ING +ENDIF +IFNDEF APPMAN_ING + INCLUDE ..\inc\APPMAN.ING +ENDIF +IFNDEF DLGBOX_ING + INCLUDE ..\inc\DLGBOX.ING +ENDIF +IFNDEF COMMAN_ING + INCLUDE ..\inc\COMMAN.ING +ENDIF +IFNDEF MENUBAR_ING + INCLUDE ..\inc\MENUBAR.ING +ENDIF +; Class Numbers +C_WSERV equ 18 +C_HWIMMAN equ 19 +; Method Numbers +O_WS_SMART_DIAL equ 22 +O_AM_YIELD equ 16 +O_WS_GET_ALLOC_INFO equ 46 +O_WS_SELF_CHECK equ 48 +O_WS_BACKGROUND equ 39 +O_WS_REMOVE_DIAL equ 8 +O_WS_LOAD_CHLIST_RES equ 19 +O_WS_SET_MENUBAR equ 17 +O_WS_UNKNOWN_WM equ 37 +O_WS_GET_PRINT_CONTEXT equ 47 +O_WS_DIAL_ENV equ 23 +O_WS_DO_REMOTE_DIAL equ 53 +O_WS_REMOVE_FILELIST equ 33 +O_WS_ANIM_TICK equ 34 +O_WS_ERROR_DIALOG equ 13 +O_WS_SWITCH_FILES equ 35 +O_WS_FILE_INFO_PRINT equ 51 +O_WS_HIDE_APP equ 49 +O_WS_PROCESS_KEY equ 41 +O_WS_CHANGE_CLIWIN equ 10 +O_WS_ADD_DIAL equ 7 +O_WS_WRAP_PARA equ 12 +O_AM_ENSURE_IPCS equ 17 +O_WS_DYN_INIT equ 40 +O_WS_SENSE_PDEV_TEXT equ 28 +O_WS_EVAL_ENV equ 27 +O_WS_DO_SUBMENU equ 16 +O_WS_HOOK_TODAY_CHANGED equ 45 +O_WS_ENS_PRINT_CONTEXT equ 31 +O_WS_LOCK equ 24 +O_WS_APPEND_COUNTRY equ 20 +O_WS_LAUNCH_DYL equ 43 +O_WS_FOREGROUND equ 38 +O_WS_RUN_MEMO equ 52 +O_WS_ALERT equ 36 +O_WS_DO_HELP equ 15 +O_WS_DO_DIAL equ 6 +O_WS_ATTACH_APP equ 50 +O_WS_EDIT_PRINT_CONTEXT equ 30 +O_WS_ADD_FILELIST equ 32 +O_WS_CANCEL equ 11 +O_WS_SENSE_ACCEL equ 9 +O_WS_FORMAT_DIALOG equ 25 +O_WS_QUERY_DIALOG equ 14 +O_WS_DATE_CHANGED equ 42 +O_WS_FREE_DIAL equ 21 +O_WS_USER_ABANDONED equ 54 +O_AM_NEW_FILENAME equ 15 +O_WS_RESET_MENUBAR equ 18 +O_WS_DEFINE_FNBAR equ 44 +O_WS_EVALUATE equ 26 +O_WS_EDIT_PDEV_SETUP equ 29 +; Constants for wserv +PR_WSERV_CONNECT_AT_BACK equ (W_CONNECT_AT_BACK) +PR_WSERV_FOREGROUND equ (002h) +PR_WSERV_CLIWIN_KEY equ (004h) +PR_WSERV_CANCELLING equ (008h) +PR_WSERV_BASIC_HELP equ (010h) +PR_WSERV_FREEFORM_DIALLING equ (020h) +PR_WSERV_INSERT_MODE equ (040h) +PR_WSERV_INSERT_PENDING equ (080h) +PR_WSERV_OWN_DEFAULT_FONT equ (0100h) +PR_WSERV_RECEIVED_KEY equ (0200h) +PR_WSERV_HIDDEN equ (0400h) +PR_WSERV_METRIC equ (0800h) +PR_WSERV_FULLSCREEN equ (01000h) +PR_WSERV_CANCELLING_DIALOG equ (02000h) +PR_WSERV_FROM_HWIF equ (04000h) +PR_WSERV_OWNPRIO equ (08000h) +PR_WSERV_HELP_INDEX equ (001h) +WSERV_DTOB_HEX equ (3) +DEGREES_MODE equ (080h) +DTOB_MAX_WIDTH equ (20) +WS_EVAL_ENV_SET equ (0) +WS_EVAL_ENV_GET equ (1) +WS_DIAL_ENV_SET equ (0) +WS_DIAL_ENV_GET equ (1) +PDEV_TEXT_MAX_LEN equ (14) +WS_LOCCHG_LOW equ (00100h) +WS_LOCCHG_HIGH equ (04000h) +WS_EM_STYLES equ (001h) +WS_EM_PRINT_CONTEXT equ (002h) +WS_EM_REUSE_BODY_BUFFER equ (004h) +WS_EM_REUSE_STYLES_BUFFER equ (008h) +WS_EM_CALLBACK equ (040h) +MEMO_NO_CHANGE equ (0) +MEMO_NULL_LENGTH equ (1) +MEMO_STANDARD_CHANGE equ (2) +; Types for wserv +IN_WSERV struc +IN_WSERVCom_cat dw ? +IN_WSERVCom_class dw ? +IN_WSERV ends +WSERV_INFO struc +WSERV_INFOMenu db ? +WSERV_INFOMnitem db ? +WSERV_INFOMenubar_id dw ? +WSERV_INFOFirst_com db ? +WSERV_INFOCount db ? +WSERV_INFOAccel db (1) * 1 dup (?) +WSERV_INFO ends +DL_DATA struc +DL_DATAId dw ? +DL_DATARbuf dw ? +DL_DATAPdlg dw ? +DL_DATA ends +WS_HIDE_APP_DATA struc +WS_HIDE_APP_DATADupnp dw ? +WS_HIDE_APP_DATAHidden db (1) * 6 dup (?) +WS_HIDE_APP_DATA ends +WRAP_DATA struc +WRAP_DATAMargin dw ? +WRAP_DATAFmargin dw ? +WRAP_DATAFont dw ? +WRAP_DATAStyle dw ? +WRAP_DATANlines dw ? +WRAP_DATAPtable dw ? +WRAP_DATA ends +WS_ALLOC_INFO struc +WS_ALLOC_INFONcells dw ? +WS_ALLOC_INFONbytes dw ? +WS_ALLOC_INFO ends +WS_TODAY_HOOK struc +WS_TODAY_HOOKNext dw ? +WS_TODAY_HOOKObject dw ? +WS_TODAY_HOOKMessage dw ? +WS_TODAY_HOOK ends +MEMO_DATA_PART struc +MEMO_DATA_PARTLen dw ? +MEMO_DATA_PARTP dw ? +MEMO_DATA_PART ends +MEMO_DATA struc +MEMO_DATABody MEMO_DATA_PART <> +MEMO_DATAStyles MEMO_DATA_PART <> +MEMO_DATATitle MEMO_DATA_PART <> +MEMO_DATA ends +MEMO_CALLBACK struc +MEMO_CALLBACKOwner dw ? +MEMO_CALLBACKMethod dw ? +MEMO_CALLBACK ends +; Property of wserv +PRS_WSERV struc +WservWs WS_EVENT_X <> +WservCom dw ? +WservDial dw ? +WservBar dw ? +WservCli dw ? +WservInfo dw ? +WservOldinfo dw ? +WservFilter dw ? +WservFilmethod dw ? +WservFlags dw ? +WservHelp_index_id dw ? +WservHelp dw ? +WservLock db ? +WservSubdial db ? +WservSc db (1) * 10 dup (?) +WservLocmask dw ? +WservFilelist dw ? +WservAnim dw ? +WservPrinter dw ? +PRS_WSERV ends +PR_WSERV struc +WservRoot PRS_ROOT <> +WservActive PRS_ACTIVE <> +WservWserv PRS_WSERV <> +PR_WSERV ends +; Constants for hwimman +H_COMMAND_DEFAULT_FILE equ ('D') +H_COMMAND_OPEN_FILE equ ('O') +H_COMMAND_CREATE_FILE equ ('C') +H_COMMAND_EXIT equ ('X') +H_COMMAND_TRANSLATE_FILE equ ('T') +H_COMMAND_RUN_FILE equ ('R') +H_COMMAND_LAUNCH_DYL equ ('L') +H_COMMAND_BYPASS equ ('Z') +FLG_APPMAN_FULLSCREEN equ (01000h) +FLG_APPMAN_LINKING equ (02000h) +FLG_APPMAN_FROM_HWIF equ (04000h) +FLG_APPMAN_OWNPRIO equ (08000h) +FLG_APPMAN_S3FS equ (00100h) +FLG_APPMAN_WSERV_MASK equ (PR_WSERV_FROM_HWIF or PR_WSERV_OWNPRIO or PR_WSERV_FULLSCREEN) +RUN_ACTIVE_CLEANUP_NONOTIFY equ (-1) +; Types for hwimman +IN_HWIMMAN struc +IN_HWIMMANFlags dw ? +IN_HWIMMANWserv_cat dw ? +IN_HWIMMANWserv_class dw ? +IN_HWIMMAN ends +; Property of hwimman +PRS_HWIMMAN struc +HwimmanContig db ? +HwimmanCommand db ? +HwimmanDefext dw ? +HwimmanAliasinfo dw ? +HwimmanYield dw ? +PRS_HWIMMAN ends +PR_HWIMMAN struc +HwimmanRoot PRS_ROOT <> +HwimmanAppman PRS_APPMAN <> +HwimmanHwimman PRS_HWIMMAN <> +PR_HWIMMAN ends diff --git a/code/SIBOSDK/include/io.h b/code/SIBOSDK/include/io.h new file mode 100644 index 0000000..2187c69 --- /dev/null +++ b/code/SIBOSDK/include/io.h @@ -0,0 +1,72 @@ +/* Release 3.00 */ + +/*-------------------------------------------------------------------------* +* * +* io.h - Definitions for low level I/O functions. * +* * +* COPYRIGHT (C) 1989, 1990 Jensen and Partners. All Rights Reserved. * +* * +*--------------------------------------------------------------------------*/ +#include + +#ifndef _IO_INC_ +#define _IO_INC_ + +struct ftime { + unsigned ft_tsec : 5; /* Two second interval */ + unsigned ft_min : 6; /* Minutes */ + unsigned ft_hour : 5; /* Hours */ + unsigned ft_day : 5; /* Days */ + unsigned ft_month : 4; /* Months */ + unsigned ft_year : 7; /* Year */ +}; + +#define HANDLE_MAX 20U +#define SEEK_SET 0 +#define SEEK_CUR 1 +#define SEEK_END 2 + +extern unsigned _openfd[HANDLE_MAX]; + +#ifdef __cplusplus +extern "C" { +#endif +extern int access(const char *_path, int _access); +extern int chmod(const char *_path, int _mode); +extern int _chmod(const char *_path, int _func, int _mode); +extern int chsize(int _handle, long _size); +extern int close(int _handle); +extern int _close(int _handle); +extern int creat(const char *_path, int _access); +extern int _creat(const char *_path, int _permission); +extern int _creat_trunc(const char *_path, int _permission); +extern int creatnew(const char *_path, int _premission); +extern int _creat_new(const char *_path, int _permission); +extern int creattemp(const char *_path, int _permission); +extern int _creat_temp(char *_path, int _permission); +extern int dup(int _handle); +extern int dup2(int _oldhandle, int _newhandle); +extern int eof(int _handle); +extern int _dup(int _handle); +extern int _dup2(int _oldhandle, int _newhandle); +extern int _eof(int _handle); +extern long filelength(int _handle); +extern int _filedrive(int _handle); +extern int getftime(int _handle, struct ftime *_ftimep); +extern int isatty(int _handle); +extern long lseek(int _handle, long _offset, int _fromwhere); +extern int open(const char *_path, int _access,... /*unsigned mode*/); +extern int _open(const char *_path, int _oflags); +extern int read(int _handle, void *_buf, unsigned _num); +extern int _read(int _handle, void *_buf, unsigned _num); +extern int setmode(int _handle, unsigned _mode); +extern int sopen(const char *_path, int _access, int _shflag, ... /*unsigned mode*/); +extern long tell(int _handle); +extern unsigned umask(unsigned _cmask); +extern int unlink(const char *_path); +extern int write(int _handle, void *_buf, unsigned _num); +extern int _write(int _handle, const void *_buf, unsigned _num); +#ifdef __cplusplus +} +#endif +#endif diff --git a/code/SIBOSDK/include/iomanip.hpp b/code/SIBOSDK/include/iomanip.hpp new file mode 100644 index 0000000..95ffff4 --- /dev/null +++ b/code/SIBOSDK/include/iomanip.hpp @@ -0,0 +1,113 @@ +/* Release 3.10 */ +/*-------------------------------------------------------------------------* +* * +* IOMANIP.HPP - header file for pasting I/O manipulators. * +* * +* COPYRIGHT (C) 1990..1992 Clarion Software Corporation * +* All Rights Reserved * +* * +*--------------------------------------------------------------------------*/ +#include + +#ifndef __IOMANIP_INC_ +#define __IOMANIP_INC_ + +#include +#include + +#define SMANIP(type) _PASTE2(smanip_, type) +#define SAPP(type) _PASTE2(sapply_, type) +#define IMANIP(type) _PASTE2(imanip_, type) +#define OMANIP(type) _PASTE2(omanip_, type) +#define IOMANIP(type) _PASTE2(iomanip_, type) +#define IAPP(type) _PASTE2(iapply_, type) +#define OAPP(type) _PASTE2(oapply_, type) +#define IOAPP(type) _PASTE2(ioapply_, type) + +#define IOMANIPdeclare(type) \ +class SMANIP(type) { \ + ios& (*_fn)(ios&, type); \ + type _ag; \ +public: \ + SMANIP(type)(ios& (*_f)(ios&, type), type _a) : _fn(_f), _ag(_a) { } \ + friend istream& operator>>(istream& _s, const SMANIP(type)& _f) { \ + (*_f._fn)(_s, _f._ag); return _s; } \ + friend ostream& operator<<(ostream& _s, const SMANIP(type)& _f) { \ + (*_f._fn)(_s, _f._ag); return _s; } \ +}; \ +class SAPP(type) { \ + ios& (*_fn)(ios&, type); \ +public: \ + SAPP(type)(ios& (*_f)(ios&, type)) : _fn(_f) { } \ + SMANIP(type) operator()(type _z) { return SMANIP(type)(_fn, _z); } \ +}; \ +class IMANIP(type) { \ + istream& (*_fn)(istream&, type); \ + type _ag; \ +public: \ + IMANIP(type)(istream& (*_f)(istream&, type), type _z ) : \ + _fn(_f), _ag(_z) { } \ + friend istream& operator>>(istream& _s, const IMANIP(type)& _f) { \ + return(*_f._fn)(_s, _f._ag); } \ +}; \ +class IAPP(type) { \ + istream& (*_fn)(istream&, type); \ +public: \ + IAPP(type)(istream& (*_f)(istream&, type)) : _fn(_f) { } \ + IMANIP(type) operator()(type _z) { \ + return IMANIP(type)(_fn, _z); } \ +}; \ +class OMANIP(type) { \ + ostream& (*_fn)(ostream&, type); \ + type _ag; \ +public: \ + OMANIP(type)(ostream& (*_f)(ostream&, type), type _z ) : \ + _fn(_f), _ag(_z) { } \ + friend ostream& operator<<(ostream& _s, const OMANIP(type)& _f) { \ + return(*_f._fn)(_s, _f._ag); } \ +}; \ +class OAPP(type) { \ + ostream& (*_fn)(ostream&, type); \ +public: \ + OAPP(type)(ostream& (*_f)(ostream&, type)) : _fn(_f) { } \ + OMANIP(type) operator()(type _z) { return OMANIP(type)(_fn, _z); } \ +}; \ +class IOMANIP(type) { \ + iostream& (*_fn)(iostream&, type); \ + type _ag; \ +public: \ + IOMANIP(type)(iostream& (*_f)(iostream&, type), type _z ) : \ + _fn(_f), _ag(_z) { } \ + friend istream& operator>>(iostream& _s, const IOMANIP(type)& _f) { \ + return(*_f._fn)(_s, _f._ag); } \ + friend ostream& operator<<(iostream& _s, const IOMANIP(type)& _f) { \ + return(*_f._fn)(_s, _f._ag); } \ +}; \ +class IOAPP(type) { \ + iostream& (*_fn)(iostream&, type); \ +public: \ + IOAPP(type)(iostream& (*_f)(iostream&, type)) : _fn(_f) { } \ + IOMANIP(type) operator()(type _z) { return IOMANIP(type)(_fn, _z); } \ +} + + +//CEP 6/7/91 +#pragma save,warn(wpnu=>off) +IOMANIPdeclare(int); +IOMANIPdeclare(long); +#pragma restore + +smanip_int setbase(int _b); + +smanip_long resetiosflags(long _b); + +smanip_long setiosflags(long _b); + +smanip_int setfill(int _f); + +smanip_int setprecision(int _n); + +smanip_int setw(int _n); + +#endif + \ No newline at end of file diff --git a/code/SIBOSDK/include/iostream.hpp b/code/SIBOSDK/include/iostream.hpp new file mode 100644 index 0000000..0448aa1 --- /dev/null +++ b/code/SIBOSDK/include/iostream.hpp @@ -0,0 +1,700 @@ +/* Release 3.10 */ +/*-------------------------------------------------------------------------* +* * +* IOSTREAM.HPP - header file for stream input and output. * +* * +* COPYRIGHT (C) 1990..1992 Clarion Software Corporation * +* All Rights Reserved * +* * +*--------------------------------------------------------------------------*/ +#include + +#ifndef _IOSTREAM_INC_ +#define _IOSTREAM_INC_ + +#include + +#ifdef EOF +#if EOF != -1 +#undef EOF +#define EOF (-1) +#endif +#else +#define EOF (-1) +#endif + +#define zapeof(c) ((c)&0xFF) + +typedef long streampos; +typedef long streamoff; + +class streambuf; +class ostream; + +class ios { + +public: + enum io_state { + goodbit = 0x00, + eofbit = 0x01, + failbit = 0x02, + badbit = 0x04, + hardfail = 0x80 + }; + + enum open_mode { + in = 0x01, + out = 0x02, + ate = 0x04, + app = 0x08, + trunc = 0x10, + nocreate = 0x20, + noreplace = 0x40, + binary = 0x80 + }; + + enum seek_dir { + beg=0, + cur=1, + end=2 + }; + + enum { + skipws = 0x0001, + left = 0x0002, + right = 0x0004, + internal = 0x0008, + dec = 0x0010, + oct = 0x0020, + hex = 0x0040, + showbase = 0x0080, + showpoint = 0x0100, + uppercase = 0x0200, + showpos = 0x0400, + scientific = 0x0800, + fixed = 0x1000, + unitbuf = 0x2000, + stdio = 0x4000 + }; + + static const long basefield; + static const long adjustfield; + static const long floatfield; + + ios(streambuf* _buffer); + virtual ~ios(); + + long flags(); + long flags(long _fl); + long setf(long _setbits, long _fld); + long setf(long _fld); + long unsetf(long _fld); + + int width(); + int width(int _w); + + char fill(); + char fill(char _f); + + int precision(); + int precision(int _p); + + ostream* tie(); + ostream* tie(ostream* _ost); + + int rdstate(); + int eof(); + int fail(); + int bad(); + int good(); + void clear(int = 0); + operator void* (); + int operator! (); + streambuf* rdbuf(); + + static long bitalloc(); + static int xalloc(); + long& iword(int); + void*& pword(int); + + static void sync_with_stdio(); + + int skip(int); + +protected: + + enum { + translate = 0x080, + skipping = 0x100, + tied = 0x200 + }; + + streambuf *_bp; + ostream* x_tie; + int state; + int ispecial; + int ospecial; + long x_flags; + int x_precision; + int x_width; + int x_fill; + int isfx_special; + int osfx_special; + int delbuf; + int assign_private; + + ios(); + void init(streambuf* _buffer); + void setstate(int); + static void (*stdioflush)(); + +private: + + union ios_user_union { + long x; + void *p; + }; + + static long nextbit; + static int usercount; + union ios_user_union *userwords; + int nwords; + void uresize(int); + + ios(ios&); // not implemented + void operator= (ios&); // not implemented +}; + +#ifdef _SMALL_INLINE +inline streambuf* ios::rdbuf() { return _bp;} +inline ostream* ios::tie() { return x_tie;} +inline char ios::fill() { return x_fill; } +inline int ios::precision() { return x_precision; } +inline int ios::rdstate() { return state; } +inline int ios::eof() { return (state&eofbit); } +inline int ios::fail() { return (state&(failbit|badbit|hardfail)); } +inline int ios::bad() { return (state&(badbit|hardfail)); } +inline int ios::good() { return (state == 0); } +inline long ios::flags() { return x_flags; } +inline int ios::width() { return x_width; } +inline int ios::width(int _w) { int _temp = x_width; + x_width = _w; + return _temp; } +inline char ios::fill(char _w) { char _temp = x_fill; + x_fill = _w; + return _temp; } +inline int ios::precision(int _w) { int _temp = x_precision; + x_precision = _w; + return _temp; } + +inline ios::operator void* () {return (fail()|eof()) ? 0 : this; } +inline ios::operator! () {return (fail()|eof()); } +#endif + + +class streambuf { + +public: + + streambuf(); + streambuf(char * _buf, int _size); + virtual ~streambuf(); + + virtual streambuf* setbuf(char * _buf, int _size); + virtual streambuf* setbuf(char * _buf, int , int); + + int sgetc(); + int snextc(); + int sbumpc(); + void stossc(); + int sgetn(char *_s, int _num); + virtual int do_sgetn(char *_s, int _num); + virtual int underflow(); + int sputbackc(char _c); + virtual int pbackfail(int); + int in_avail(); + + int sputc(int _c); + virtual int do_sputn(const char *_s, int _num); + int sputn(const char *_s, int _num); + virtual int overflow(int _c = EOF); + int out_waiting(); + + virtual streampos seekoff(streamoff, ios::seek_dir, int = (ios::in | ios::out)); + virtual streampos seekpos(streamoff, int = (ios::in | ios::out)); + virtual int sync(); + int dbp(); + +protected: + + char *base(); + char *ebuf(); + int blen(); + char *pbase(); + char *pptr(); + char *epptr(); + char *eback(); + char *gptr(); + char *egptr(); + void setp(char *, char *); + void setg(char *, char *, char *); + void pbump(int); + void gbump(int); + void setb(char *, char *, int = 0); + void unbuffered(int); + int unbuffered(); + int allocate(); + virtual int doallocate(); + +private: + short _alloc; + short _unbuf; + char *_base; + char *_ebuf; + char *_pbase; + char *_pptr; + char *_epptr; + char *_eback; + char *_gptr; + char *_egptr; + + streambuf(streambuf&); + void operator= (streambuf&); + + int do_snextc(); +}; +#ifdef _SMALL_INLINE +inline char * streambuf::base() { return _base; } +inline char * streambuf::pbase() { return _pbase; } +inline char * streambuf::pptr() { return _pptr; } +inline char * streambuf::epptr() { return _epptr; } +inline char * streambuf::gptr() { return _gptr; } +inline char * streambuf::egptr() { return _egptr; } +inline char * streambuf::eback() { return _eback; } +inline char * streambuf::ebuf() { return _ebuf; } + +inline int streambuf::unbuffered() { return _unbuf; } +inline int streambuf::blen() { return (int) (_ebuf - _base); } + +inline void streambuf::pbump(int _n) { _pptr += _n; } +inline void streambuf::gbump(int _n) { _gptr += _n; } +inline void streambuf::unbuffered(int _ub) { _unbuf = (_ub != 0); } +inline int streambuf::in_avail() { return (_egptr > _gptr) ? + (int)(_egptr - _gptr): 0; } +inline int streambuf::out_waiting() { return _pptr ? + (int)(_pptr - _pbase): 0; } +inline int streambuf::allocate() { return((_base || _unbuf) ? 0 : doallocate()); } + +inline int streambuf::sgetc() { return ((_gptr >= _egptr) ? underflow() : + (unsigned char) *_gptr); } + +inline int streambuf::snextc() { return ((++_gptr >= _egptr) ? + do_snextc() : + (unsigned char) *_gptr); } + +inline int streambuf::sbumpc() { return ((_gptr >= _egptr) + && (underflow() == EOF) ? + EOF : + (unsigned char) *_gptr++); } +inline void streambuf::stossc() { if (_gptr >= _egptr) + underflow(); + else + ++_gptr; } + +inline int streambuf::sputbackc(char _c) { return (_gptr > _eback) ? + *--_gptr = _c : + pbackfail(_c) ; } + +inline int streambuf::sputc(int _c) { return (_pptr >= _epptr) ? + overflow(_c) : + (*_pptr++=_c, _c); } + +#ifdef _BIG_INLINE +inline int streambuf::sputn(const char *_s, int _n) { + if(_n <= (_epptr - _pptr)) { + memcpy(_pptr, _s, _n); + pbump(_n); + return _n; + } + return do_sputn(_s, _n); } + +inline int streambuf::sgetn(char *_s, int _n) { + if(_n <= (_egptr - _gptr)) { + memcpy(_s, _gptr, _n); + gbump(_n); + return _n; + } + return do_sgetn(_s, _n); } + +#endif +#endif +class istream : virtual public ios { + +public: + + istream(streambuf*); + istream(streambuf*, int _sk, ostream* _t=NULL); + istream(int _sz, char *, int _sk=1); + istream(int _fd, int _sk=1, ostream* _t=NULL); + virtual ~istream(); + + int ipfx(int = 0); + int ipfx0(); + int ipfx1(); + void isfx() {} + + istream& seekg(streampos); + istream& seekg(streamoff, ios::seek_dir); + streampos tellg(); + + int sync(); + + istream& get( signed char*, int, char = '\n'); + istream& get(unsigned char*, int, char = '\n'); + istream& get( char*, int, char = '\n'); + istream& read( signed char*, int); + istream& read(unsigned char*, int); + istream& read( char*, int); + istream& getline( signed char*, int, char = '\n'); + istream& getline(unsigned char*, int, char = '\n'); + istream& getline( char*, int, char = '\n'); + + istream& get(streambuf&, char = '\n'); + istream& get( signed char&); + istream& get(unsigned char&); + istream& get( char&); + int get(); + + int peek(); + int gcount(); + istream& putback(char); + istream& ignore(int = 1, int = EOF); + + istream& operator>> (istream& (*_f)(istream&)); + istream& operator>> (ios& (*_f)(ios&)); + istream& operator>> ( signed char*); + istream& operator>> (unsigned char*); + istream& operator>> ( char*); + istream& operator>> ( signed char&); + istream& operator>> (unsigned char&); + istream& operator>> ( char&); + istream& operator>> (short&); + istream& operator>> (int&); + istream& operator>> (long&); + istream& operator>> (unsigned short&); + istream& operator>> (unsigned int&); + istream& operator>> (unsigned long&); + istream& operator>> (float&); + istream& operator>> (double&); + istream& operator>> (long double&); + + istream& operator>> (streambuf*); + +protected: + + istream(); + int do_ipfx(int); + void eatwhite(); + +private: + + int _gcount; + int do_get(); +}; + +#ifdef _SMALL_INLINE +inline int istream::gcount() { return _gcount; } + +inline int istream::ipfx(int _need) { if( _need ? (ispecial&~skipping) : + ispecial) + return do_ipfx(_need); + return 1; } + +inline int istream::ipfx0() { return ispecial ? do_ipfx(0) : 1; } + +inline int istream::ipfx1() { return (ispecial&~skipping) ? do_ipfx(1) : 1; } + +inline istream& istream::operator>>(unsigned char& _c) { + if(ipfx0()) { + if(_bp->in_avail()) + _c = _bp->sbumpc(); + else + _c = do_get(); + } + return *this; } + +inline istream& istream::operator>>(signed char& _c) { + if(ipfx0()) { + if(_bp->in_avail()) + _c = _bp->sbumpc(); + else + _c = do_get(); + } + return *this; } + +inline istream& istream::operator>>( char& _c) { + if(ipfx0()) { + if(_bp->in_avail()) + _c = _bp->sbumpc(); + else + _c = do_get(); + } + return *this; } + +inline istream& istream::operator>>(unsigned char* _s) { + return *this>>(signed char *) _s; } + +inline istream& istream::operator>>( char* _s) { + return *this>>(signed char *) _s; } + +inline istream& istream::get(unsigned char* _s, int _l, char _t) { + return get((signed char *)_s, _l, _t); } + +inline istream& istream::get( char* _s, int _l, char _t) { + return get((signed char *)_s, _l, _t); } + +#ifdef _BIG_INLINE_ +inline istream& istream::get(unsigned char& _c) { + if( ipfx1() ) { + if( _bp->in_avail() ) { + _gcount = 1; + _c = _bp->sbumpc(); + } + else + _c = do_get(); + } + return *this; } + +inline istream& istream::get(signed char& _c) { + if( ipfx1() ) { + if( _bp->in_avail()) { + _gcount = 1; + _c = _bp->sbumpc(); + } + else + _c = do_get(); + } + return *this; } + + +inline istream& istream::get( char& _c) { + if( ipfx1() ) { + if( _bp->in_avail()) { + _gcount = 1; + _c = _bp->sbumpc(); + } + else + _c = do_get(); + } + return *this; } + +inline int istream::get() { + if( ipfx1() ) { + int _c = _bp->sbumpc(); + if( _c == EOF ) + setstate(eofbit); + else _gcount = 1; + return _c; + } + return EOF; } + +#endif + +inline istream& istream::read(unsigned char* _s, int _l) { + return read((signed char *)_s, _l); } + +inline istream& istream::read( char* _s, int _l) { + return read((signed char *)_s, _l); } + +inline istream& istream::getline(unsigned char* _s, int _l, char _t) { + return getline((signed char *)_s, _l, _t); } + +inline istream& istream::getline( char* _s, int _l, char _t) { + return getline((signed char *)_s, _l, _t); } + +inline int istream::sync() { return _bp->sync(); } + +inline istream& istream::operator>> (istream& (*_f)(istream&)) { + return (*_f)(*this); } + +inline int istream::peek() { return ipfx1() ? _bp->sgetc() : EOF; } + +#endif + +class ostream : virtual public ios { + +public: + + + ostream(streambuf *); + ~ostream(); + + ostream(int _fd); + ostream(int _sz, char *); + + int opfx(); + void osfx(); + ostream& flush(); + + ostream& seekp(streampos); + ostream& seekp(streamoff, ios::seek_dir); + streampos tellp(); + + ostream& put(char); + ostream& write(const char*, int); + ostream& write(const signed char*, int); + ostream& write(const unsigned char*, int); + + ostream& operator<<( signed char); + ostream& operator<<(unsigned char); + ostream& operator<<( char); + ostream& operator<<( signed short); + ostream& operator<<(unsigned short); + ostream& operator<<( signed int); + ostream& operator<<(unsigned int); + ostream& operator<<( signed long); + ostream& operator<<(unsigned long); + ostream& operator<<(float); + ostream& operator<<(double); + ostream& operator<<(long double); + ostream& operator<<(const char *); + ostream& operator<<(const signed char *); + ostream& operator<<(const unsigned char *); + ostream& operator<<(void *); + + ostream& operator<<(streambuf*); + ostream& operator<<(ostream& (*_f)(ostream&)); + ostream& operator<<(ios& (*_f)(ios&)); + +protected: + + ostream(); + int do_opfx(); + int do_osfx(); + +private: + + void outlong(unsigned long, int); + void outstr(const char *); +}; + +#ifdef _SMALL_INLINE +inline int ostream::opfx() { return ospecial ? do_opfx() : 1; } + +inline void ostream::osfx() { if((x_flags&(stdio|unitbuf)) || (ospecial)) do_osfx(); } + +inline ostream& ostream::operator<<(unsigned char _c) { + return *this <<(signed char ) _c; } + +inline ostream& ostream::operator<<( char _c) { + return *this <<(signed char ) _c; } + +inline ostream& ostream::operator<<(short _i) { return *this<<(long)_i; } + +inline ostream& ostream::operator<<(unsigned short _i) { + return *this<<(unsigned long)_i; } + +inline ostream& ostream::operator<<(int _i) { return *this<<(long)_i; } + +inline ostream& ostream::operator<<(unsigned int _i) { + return *this<<(unsigned long)_i; } + +inline ostream& ostream::operator<<(float _f) { + return *this<<(long double)_f; } + +inline ostream& ostream::operator<<(double _f) { + return *this<<(long double)_f; } + +inline ostream& ostream::operator<<(ostream& (*_f)(ostream&)) { + return (*_f)(*this); } + +inline ostream& ostream::write(const signed char *_s, int _n) { + return write((const char *)_s, _n); } + +inline ostream& ostream::write(const unsigned char *_s, int _n) { + return write((const char *)_s, _n); } + +inline ostream& ostream::put(char _c) { + if(_bp->sputc(_c) == EOF) + setstate(badbit); + return *this; } + +inline ostream& ostream::operator<<(const signed char *_s) { + return *this<<(const char *) _s; } + +inline ostream& ostream::operator<<(const unsigned char *_s) { + return *this<<(const char *) _s; } +#endif + +class iostream : public istream , public ostream { + +public: + + iostream(streambuf*); + virtual ~iostream(); + +protected: + iostream(); + +}; + + +class istream_withassign : public istream { + +public: + + istream_withassign(); + virtual ~istream_withassign(); + + istream_withassign& operator= (istream&); + istream_withassign& operator= (streambuf*); + +private: + + unsigned assign_const; +}; + +class ostream_withassign : public ostream { + +public: + + ostream_withassign(); + virtual ~ostream_withassign(); + + ostream_withassign& operator= (ostream&); + ostream_withassign& operator= (streambuf*); + +private: + + unsigned assign_const; +}; + +class iostream_withassign : public iostream { + +public: + + iostream_withassign(); + virtual ~iostream_withassign(); + + iostream_withassign& operator= (ios&); + iostream_withassign& operator= (streambuf*); + +private: + + unsigned assign_const; +}; + +extern istream_withassign cin; +extern ostream_withassign cout; +extern ostream_withassign cerr; +extern ostream_withassign clog; + +ostream& endl(ostream&); +ostream& ends(ostream&); +ostream& flush(ostream&); +istream& ws(istream&); +ios& dec(ios&); +ios& hex(ios&); +ios& oct(ios&); +#endif + diff --git a/code/SIBOSDK/include/ipc.g b/code/SIBOSDK/include/ipc.g new file mode 100644 index 0000000..cfd8f1b --- /dev/null +++ b/code/SIBOSDK/include/ipc.g @@ -0,0 +1,266 @@ +/* Generated by Ctran from ipc.cat */ +#define IPC_G +#ifndef APPMAN_G +#include +#endif +#ifndef P_FILE_H +#include +#endif +/* Class Numbers */ +#define C_SERVER 16 +#define C_LINKSV 17 +#define C_LINKCL 18 +#define C_TOPLIP 19 +#define C_EXOPL 20 +#define C_CMAP 21 +#define C_VOICE 22 +#define C_NOTIFY 23 +#define C_CONSOL 24 +/* Method Numbers */ +#define O_CM_AUTOWRAP 9 +#define O_NO_DRAW 7 +#define O_CO_DRAW 6 +#define O_CO_KEY 4 +#define O_CM_INSERT 2 +#define O_SV_INIT 2 +#define O_LC_START 1 +#define O_CM_ATTRIB 12 +#define O_CO_EDIT 10 +#define O_CM_RECT 3 +#define O_TIP_COMPLETE 6 +#define O_CM_SENSE_SIZE 7 +#define O_CO_SIZE 8 +#define O_CM_ENQ_DRAW 4 +#define O_CO_ESC 9 +#define O_SV_RUN 3 +#define O_CM_SENSE_CPOS 5 +#define O_CM_SCROLL 11 +#define O_CO_EXTRA 5 +#define O_TIP_GETLINE 5 +#define O_TIP_START 4 +#define O_LS_GET_DATA 5 +#define O_CM_SET_CPOS 6 +#define O_CO_CURSOR 7 +#define O_LC_GET_DATA 2 +#define O_LC_STOP 3 +#define O_CM_POINT_ROW 8 +#define O_LS_SET_FORMAT 4 +#define O_CM_SCROLLOCK 10 +#define O_CM_INIT 1 +#define O_SV_ABRUN 1 +/* Property of server */ +typedef struct { +P_QUE q; +unsigned short int t1; +unsigned short int t2; +unsigned short int cid; +} PRS_SERVER; +typedef struct pr_server +{ +PRS_ROOT root; +PRS_SERVER server; +} PR_SERVER; +/* Constants for linksv */ +#define TY_LINKSV_STEP 0x21 +#define TY_LINKSV_DEATH 0x22 +#define DF_LINK_NATIVE 0 +#define DF_LINK_TEXT 1 +#define DF_LINK_TABTEXT 2 +#define DF_LINK_VOICE 3 +#define DF_LINK_PARAS 4 +#define DF_LINK_SPR 5 +#define DF_LINK_WRD 6 +#define DF_LINK_AGD 7 +/* Property of linksv */ +typedef struct { +unsigned char *buf; +unsigned short int len; +} PRS_LINKSV; +typedef struct pr_linksv +{ +PRS_ROOT root; +PRS_SERVER server; +PRS_LINKSV linksv; +} PR_LINKSV; +/* Property of linkcl */ +typedef struct { +unsigned short int pid; +} PRS_LINKCL; +typedef struct pr_linkcl +{ +PRS_ROOT root; +PRS_LINKCL linkcl; +} PR_LINKCL; +/* Constants for toplip */ +#define TY_TOPLIP_LINE 0x10 +#define TY_TOPLIP_DEATH 0x11 +/* Types for toplip */ +typedef struct +{ +short int stat; +unsigned short int mode; +unsigned short int line; +unsigned short int offset; +} PR_TOPLIP_STATUS; +typedef struct +{ +unsigned short int pid; +char *bofs; +PR_TOPLIP_STATUS *sofs; +} PR_TOPLIP_SOURCE; +/* Property of toplip */ +typedef struct { +PR_TOPLIP_STATUS st; +char buf[256]; +} PRS_TOPLIP; +typedef struct pr_toplip +{ +PRS_ROOT root; +PRS_SERVER server; +PRS_TOPLIP toplip; +} PR_TOPLIP; +/* Constants for exopl */ +#define EXOPL_ISEXP 0x01 +#define EXOPL_SIGNAL 0x02 +#define EXOPL_NTFY 0x04 +/* Types for exopl */ +typedef struct +{ +double value; +short int error; +unsigned short int line; +unsigned short int offset; +char src[P_FNAMESIZE]; +} EXOPL_RESBUF; +typedef struct +{ +unsigned short int flags; +short int cid; +unsigned char *qofs; +unsigned short int qlen; +EXOPL_RESBUF *rofs; +} EXOPL_PAR; +/* Property of exopl */ +typedef struct { +EXOPL_RESBUF result; +} PRS_EXOPL; +typedef struct pr_exopl +{ +PRS_ROOT root; +PRS_ACTIVE active; +PRS_EXOPL exopl; +} PR_EXOPL; +/* Constants for cmap */ +#define DR_CMAP_END 0 +#define DR_CMAP_TEXT 1 +#define DR_CMAP_SPACES 2 +#define DR_CMAP_SCROLL 3 +#define OP_CMAP_CLEAR 1 +#define OP_CMAP_INVALID 2 +/* Types for cmap */ +typedef struct +{ +unsigned short int len; +unsigned char *buf; +unsigned char row; +unsigned char col; +} PR_CMAP_DRAW; +/* Property of cmap */ +typedef struct { +unsigned char *base; +unsigned short int toprow; +unsigned short int width; +unsigned short int height; +unsigned short int row; +unsigned short int col; +short int scroll; +unsigned char wrap; +unsigned char slock; +} PRS_CMAP; +typedef struct pr_cmap +{ +PRS_ROOT root; +PRS_CMAP cmap; +} PR_CMAP; +/* Constants for voice */ +#define TY_VOICE_PLAY 0 +#define TY_VOICE_EDIT 1 +#define TY_VOICE_CANCEL 2 +/* Types for voice */ +typedef struct +{ +short int *pstat; +unsigned char *buf; +unsigned short int len; +unsigned short int maxlen; +} RQ_VOICE_MSG; +/* Property of voice */ +typedef struct { +PR_ROOT *owner; +unsigned short int method; +} PRS_VOICE; +typedef struct pr_voice +{ +PRS_ROOT root; +PRS_ACTIVE active; +PRS_VOICE voice; +} PR_VOICE; +/* Constants for notify */ +#define NOTIFY_MESS_TYPE 0 +#define NOTIFY_MESS_ARGS 5 +#define NOTIFY_MESS_SIZE 64 +/* Property of notify */ +typedef struct { +unsigned char err0text[NOTIFY_MESS_SIZE]; +unsigned char err1text[NOTIFY_MESS_SIZE]; +unsigned char but0text[NOTIFY_MESS_SIZE]; +unsigned char but1text[NOTIFY_MESS_SIZE]; +unsigned char but2text[NOTIFY_MESS_SIZE]; +unsigned char pname[NOTIFY_MESS_SIZE]; +} PRS_NOTIFY; +typedef struct pr_notify +{ +PRS_ROOT root; +PRS_ACTIVE active; +PRS_IPCS ipcs; +PRS_NOTIFY notify; +} PR_NOTIFY; +/* Constants for consol */ +#define CONSOL_MESS_READ 0 +#define CONSOL_MESS_WRITE 1 +#define CONSOL_MESS_CLOSE 2 +#define CONSOL_MESS_SET 3 +#define CONSOL_MESS_SENSE 4 +#define CONSOL_MESS_TEST 5 +#define CONSOL_MESS_FLUSH 6 +#define CONSOL_MESS_CANCEL 7 +#define CONSOL_MESS_EDIT 8 +#define CONSOL_MESS_SPARE1 9 +#define CONSOL_MESS_SPARE2 10 +#define CONSOL_MESS_SPARE3 11 +#define CONSOL_MESS_SPARE4 12 +#define CONSOL_MESS_DIED 13 +#define CONSOL_KEY_TYPE_AHEAD 32 +#define CONSOL_MAX_STRING 255 +/* Types for consol */ +typedef struct +{ +unsigned short int keycode; +unsigned char modifiers; +unsigned char count; +} PR_CONSOL_WMSG_KEY; +/* Property of consol */ +typedef struct { +PR_CMAP *cmap; +unsigned short int rcomp; +unsigned char *rmess; +PR_CONSOL_WMSG_KEY *head; +PR_CONSOL_WMSG_KEY *tail; +PR_CONSOL_WMSG_KEY list[CONSOL_KEY_TYPE_AHEAD]; +} PRS_CONSOL; +typedef struct pr_consol +{ +PRS_ROOT root; +PRS_SERVER server; +PRS_CONSOL consol; +} PR_CONSOL; diff --git a/code/SIBOSDK/include/ipc.ing b/code/SIBOSDK/include/ipc.ing new file mode 100644 index 0000000..cd3c934 --- /dev/null +++ b/code/SIBOSDK/include/ipc.ing @@ -0,0 +1,250 @@ +; Generated by Ctran from ipc.cat +IPC_ING equ 1 +IFNDEF APPMAN_ING + INCLUDE ..\inc\APPMAN.ING +ENDIF +IFNDEF P_FILE_INC + INCLUDE ..\inc\P_FILE.INC +ENDIF +; Class Numbers +C_SERVER equ 16 +C_LINKSV equ 17 +C_LINKCL equ 18 +C_TOPLIP equ 19 +C_EXOPL equ 20 +C_CMAP equ 21 +C_VOICE equ 22 +C_NOTIFY equ 23 +C_CONSOL equ 24 +; Method Numbers +O_CM_AUTOWRAP equ 9 +O_NO_DRAW equ 7 +O_CO_DRAW equ 6 +O_CO_KEY equ 4 +O_CM_INSERT equ 2 +O_SV_INIT equ 2 +O_LC_START equ 1 +O_CM_ATTRIB equ 12 +O_CO_EDIT equ 10 +O_CM_RECT equ 3 +O_TIP_COMPLETE equ 6 +O_CM_SENSE_SIZE equ 7 +O_CO_SIZE equ 8 +O_CM_ENQ_DRAW equ 4 +O_CO_ESC equ 9 +O_SV_RUN equ 3 +O_CM_SENSE_CPOS equ 5 +O_CM_SCROLL equ 11 +O_CO_EXTRA equ 5 +O_TIP_GETLINE equ 5 +O_TIP_START equ 4 +O_LS_GET_DATA equ 5 +O_CM_SET_CPOS equ 6 +O_CO_CURSOR equ 7 +O_LC_GET_DATA equ 2 +O_LC_STOP equ 3 +O_CM_POINT_ROW equ 8 +O_LS_SET_FORMAT equ 4 +O_CM_SCROLLOCK equ 10 +O_CM_INIT equ 1 +O_SV_ABRUN equ 1 +; Property of server +PRS_SERVER struc +ServerQ P_QUE <> +ServerT1 dw ? +ServerT2 dw ? +ServerCid dw ? +PRS_SERVER ends +PR_SERVER struc +ServerRoot PRS_ROOT <> +ServerServer PRS_SERVER <> +PR_SERVER ends +; Constants for linksv +TY_LINKSV_STEP equ (021h) +TY_LINKSV_DEATH equ (022h) +DF_LINK_NATIVE equ (0) +DF_LINK_TEXT equ (1) +DF_LINK_TABTEXT equ (2) +DF_LINK_VOICE equ (3) +DF_LINK_PARAS equ (4) +DF_LINK_SPR equ (5) +DF_LINK_WRD equ (6) +DF_LINK_AGD equ (7) +; Property of linksv +PRS_LINKSV struc +LinksvBuf dw ? +LinksvLen dw ? +PRS_LINKSV ends +PR_LINKSV struc +LinksvRoot PRS_ROOT <> +LinksvServer PRS_SERVER <> +LinksvLinksv PRS_LINKSV <> +PR_LINKSV ends +; Property of linkcl +PRS_LINKCL struc +LinkclPid dw ? +PRS_LINKCL ends +PR_LINKCL struc +LinkclRoot PRS_ROOT <> +LinkclLinkcl PRS_LINKCL <> +PR_LINKCL ends +; Constants for toplip +TY_TOPLIP_LINE equ (010h) +TY_TOPLIP_DEATH equ (011h) +; Types for toplip +PR_TOPLIP_STATUS struc +PR_TOPLIP_STATUSStat dw ? +PR_TOPLIP_STATUSMode dw ? +PR_TOPLIP_STATUSLine dw ? +PR_TOPLIP_STATUSOffset dw ? +PR_TOPLIP_STATUS ends +PR_TOPLIP_SOURCE struc +PR_TOPLIP_SOURCEPid dw ? +PR_TOPLIP_SOURCEBofs dw ? +PR_TOPLIP_SOURCESofs dw ? +PR_TOPLIP_SOURCE ends +; Property of toplip +PRS_TOPLIP struc +ToplipSt PR_TOPLIP_STATUS <> +ToplipBuf db (1) * 256 dup (?) +PRS_TOPLIP ends +PR_TOPLIP struc +ToplipRoot PRS_ROOT <> +ToplipServer PRS_SERVER <> +ToplipToplip PRS_TOPLIP <> +PR_TOPLIP ends +; Constants for exopl +EXOPL_ISEXP equ (001h) +EXOPL_SIGNAL equ (002h) +EXOPL_NTFY equ (004h) +; Types for exopl +EXOPL_RESBUF struc +EXOPL_RESBUFValue db 8 dup (?) +EXOPL_RESBUFError dw ? +EXOPL_RESBUFLine dw ? +EXOPL_RESBUFOffset dw ? +EXOPL_RESBUFSrc db (1) * P_FNAMESIZE dup (?) +EXOPL_RESBUF ends +EXOPL_PAR struc +EXOPL_PARFlags dw ? +EXOPL_PARCid dw ? +EXOPL_PARQofs dw ? +EXOPL_PARQlen dw ? +EXOPL_PARRofs dw ? +EXOPL_PAR ends +; Property of exopl +PRS_EXOPL struc +ExoplResult EXOPL_RESBUF <> +PRS_EXOPL ends +PR_EXOPL struc +ExoplRoot PRS_ROOT <> +ExoplActive PRS_ACTIVE <> +ExoplExopl PRS_EXOPL <> +PR_EXOPL ends +; Constants for cmap +DR_CMAP_END equ (0) +DR_CMAP_TEXT equ (1) +DR_CMAP_SPACES equ (2) +DR_CMAP_SCROLL equ (3) +OP_CMAP_CLEAR equ (1) +OP_CMAP_INVALID equ (2) +; Types for cmap +PR_CMAP_DRAW struc +PR_CMAP_DRAWLen dw ? +PR_CMAP_DRAWBuf dw ? +PR_CMAP_DRAWRow db ? +PR_CMAP_DRAWCol db ? +PR_CMAP_DRAW ends +; Property of cmap +PRS_CMAP struc +CmapBase dw ? +CmapToprow dw ? +CmapWidth dw ? +CmapHeight dw ? +CmapRow dw ? +CmapCol dw ? +CmapScroll dw ? +CmapWrap db ? +CmapSlock db ? +PRS_CMAP ends +PR_CMAP struc +CmapRoot PRS_ROOT <> +CmapCmap PRS_CMAP <> +PR_CMAP ends +; Constants for voice +TY_VOICE_PLAY equ (0) +TY_VOICE_EDIT equ (1) +TY_VOICE_CANCEL equ (2) +; Types for voice +RQ_VOICE_MSG struc +RQ_VOICE_MSGPstat dw ? +RQ_VOICE_MSGBuf dw ? +RQ_VOICE_MSGLen dw ? +RQ_VOICE_MSGMaxlen dw ? +RQ_VOICE_MSG ends +; Property of voice +PRS_VOICE struc +VoiceOwner dw ? +VoiceMethod dw ? +PRS_VOICE ends +PR_VOICE struc +VoiceRoot PRS_ROOT <> +VoiceActive PRS_ACTIVE <> +VoiceVoice PRS_VOICE <> +PR_VOICE ends +; Constants for notify +NOTIFY_MESS_TYPE equ (0) +NOTIFY_MESS_ARGS equ (5) +NOTIFY_MESS_SIZE equ (64) +; Property of notify +PRS_NOTIFY struc +NotifyErr0text db (1) * NOTIFY_MESS_SIZE dup (?) +NotifyErr1text db (1) * NOTIFY_MESS_SIZE dup (?) +NotifyBut0text db (1) * NOTIFY_MESS_SIZE dup (?) +NotifyBut1text db (1) * NOTIFY_MESS_SIZE dup (?) +NotifyBut2text db (1) * NOTIFY_MESS_SIZE dup (?) +NotifyPname db (1) * NOTIFY_MESS_SIZE dup (?) +PRS_NOTIFY ends +PR_NOTIFY struc +NotifyRoot PRS_ROOT <> +NotifyActive PRS_ACTIVE <> +NotifyIpcs PRS_IPCS <> +NotifyNotify PRS_NOTIFY <> +PR_NOTIFY ends +; Constants for consol +CONSOL_MESS_READ equ (0) +CONSOL_MESS_WRITE equ (1) +CONSOL_MESS_CLOSE equ (2) +CONSOL_MESS_SET equ (3) +CONSOL_MESS_SENSE equ (4) +CONSOL_MESS_TEST equ (5) +CONSOL_MESS_FLUSH equ (6) +CONSOL_MESS_CANCEL equ (7) +CONSOL_MESS_EDIT equ (8) +CONSOL_MESS_SPARE1 equ (9) +CONSOL_MESS_SPARE2 equ (10) +CONSOL_MESS_SPARE3 equ (11) +CONSOL_MESS_SPARE4 equ (12) +CONSOL_MESS_DIED equ (13) +CONSOL_KEY_TYPE_AHEAD equ (32) +CONSOL_MAX_STRING equ (255) +; Types for consol +PR_CONSOL_WMSG_KEY struc +PR_CONSOL_WMSG_KEYKeycode dw ? +PR_CONSOL_WMSG_KEYModifiers db ? +PR_CONSOL_WMSG_KEYCount db ? +PR_CONSOL_WMSG_KEY ends +; Property of consol +PRS_CONSOL struc +ConsolCmap dw ? +ConsolRcomp dw ? +ConsolRmess dw ? +ConsolHead dw ? +ConsolTail dw ? +ConsolList db (size PR_CONSOL_WMSG_KEY)* CONSOL_KEY_TYPE_AHEAD dup (?) +PRS_CONSOL ends +PR_CONSOL struc +ConsolRoot PRS_ROOT <> +ConsolServer PRS_SERVER <> +ConsolConsol PRS_CONSOL <> +PR_CONSOL ends diff --git a/code/SIBOSDK/include/isam.g b/code/SIBOSDK/include/isam.g new file mode 100644 index 0000000..e26638a --- /dev/null +++ b/code/SIBOSDK/include/isam.g @@ -0,0 +1,360 @@ +/* Generated by version 3.20 of Ctran from isam.cat */ +/* Thursday 05-03-1992 19:38:37 */ +#define ISAM_G +#ifndef P_STD_H +#include +#endif +#ifndef P_OBJECT_H +#include +#endif +#ifndef P_DBF_H +#include +#endif +#ifndef P_MATH_H +#include +#endif +/* Category Numbers */ +#ifndef EPOC +GLREF_D P_CLASS *ct_isam[]; +#endif /* EPOC */ +#ifdef EPOC +#define CAT_ISAM_ISAM 0 +#else +#define CAT_ISAM_ISAM (&ct_isam[0]) +#endif +/* Class Numbers */ +#define C_ISROOT 0 +#define C_IXREC 1 +#define C_ISAMAN 2 +#define C_BTDBF 3 +#define C_DADBF 4 +#define C_IXBTREE 5 +#define C_BLOCKER 6 +/* Method Numbers */ +#define O_IX_NEXT 13 +#define O_DA_READ 6 +#define O_IS_IERASE 27 +#define O_DA_SIZE 10 +#define O_IS_GET_FIELD 13 +#define O_IS_GET_KEYDEF 11 +#define O_IX_INSERT 6 +#define O_IS_ILAST 35 +#define O_IX_ERASEALL 9 +#define O_BL_INIT 1 +#define O_IX_GET_KEYDEF 20 +#define O_BL_ALLOC 8 +#define O_IS_DFLUSH 3 +#define O_IS_IQADD 26 +#define O_DA_ERASE 5 +#define O_IX_FLUSH 12 +#define O_IS_ICLOSE 18 +#define O_IS_IFLUSH 19 +#define O_BL_FREEALL 10 +#define O_DA_INIT 1 +#define O_IX_SET_NMATCH 3 +#define O_IS_UPDATE 39 +#define O_IS_ADD 37 +#define O_IX_UPDATE 10 +#define O_IS_DNEXT 6 +#define O_BL_DELETE 5 +#define O_BL_WRITE_HEADER 14 +#define O_IS_SET_DFORMAT 16 +#define O_IX_BACK 14 +#define O_IX_LAST 16 +#define O_IS_PUT_FIELD 12 +#define O_IS_DOPEN 2 +#define O_IS_INEXT 32 +#define O_DA_APPEND 4 +#define O_IS_IOPEN 17 +#define O_DA_NEXT 9 +#define O_IS_DSIZE 4 +#define O_IS_GET_TYPE 14 +#define O_IS_SET_FIELDDEF 8 +#define O_IX_DUP 2 +#define O_IX_OPEN 5 +#define O_IX_FIND 11 +#define O_IS_ISIZE 30 +#define O_BL_READ_HEADER 13 +#define O_BL_FREE 9 +#define O_IX_FIRST 15 +#define O_IX_COUNT 18 +#define O_IS_IDUP 21 +#define O_IX_FILTER 1 +#define O_IS_IFLAGS 22 +#define O_BL_FLUSH 4 +#define O_IS_ICOUNT 29 +#define O_BL_UPDATE 12 +#define O_DA_FLUSH 3 +#define O_IS_ICURRENT 36 +#define O_IS_IFIND 31 +#define O_IX_SIZE 19 +#define O_IX_CURRENT 17 +#define O_IS_DFIRST 5 +#define O_IS_GET_FIELDDEF 9 +#define O_IS_IADD 25 +#define O_BL_OPEN 2 +#define O_IS_ERASE 38 +#define O_DBF_HEADER 11 +#define O_IS_IFILTER 20 +#define O_IS_IFIRST 34 +#define O_BL_COUNT 7 +#define O_IS_INIT 1 +#define O_IX_ERASE 8 +#define O_IS_SET_KEYDEF 10 +#define O_BL_CLOSE 3 +#define O_IX_QINSERT 7 +#define O_IS_IERASEALL 28 +#define O_IS_IBUILD 23 +#define O_IX_INIT 4 +#define O_IS_SET_RADIX 15 +#define O_IS_IBACK 33 +#define O_BL_NFILES 6 +#define O_IS_DESTROY 0 +#define O_DA_OPEN 2 +#define O_IS_GET_RBUF 7 +#define O_DA_GET_SEQ 7 +#define O_DA_FIRST 8 +#define O_IS_IQBUILD 24 +#define O_IX_FLAGS 21 +#define O_BL_READ 11 +/* Property of isroot */ +typedef struct { +P_OBJECT pc; +} PRS_ISROOT; +typedef struct pr_isroot +{ +PRS_ISROOT isroot; +} PR_ISROOT; +/* Property of darec */ +typedef struct pr_darec +{ +PRS_ISROOT isroot; +} PR_DAREC; +/* Property of ixrec */ +typedef struct { +VOID *filterObj; +WORD filterMeth; +VOID *dupObj; +WORD dupMeth; +WORD nMatch; +} PRS_IXREC; +typedef struct pr_ixrec +{ +PRS_ISROOT isroot; +PRS_IXREC ixrec; +} PR_IXREC; +/* Constants for isaman */ +#define ISAM_MAX_INDEXES 8 +#define ISAM_MAX_KEY_LENGTH 64 +#define ISAM_MAX_DEFINED_FIELDS 32 +#define ISAM_MAX_KEYFIELDS 8 +#define ISAM_MAX_KEYDEF_LENGTH 66 +#define ISAM_MAX_FIELD_LENGTH 256 +#define ISAM_MAX_SEG_BLOCKS 1024 +#define ISAM_MIN_RECORD_BUFFER 512 +#define ISAM_MAX_RECORD_BUFFER 16384 +#define ISAM_MAX_RECORD_FIELDS 4094 +#define ISAM_RECORD_LENGTH_MASK 0xfff +#define ISAM_BLOCK_SIZE 512 +#define ISAM_BLOCK_SHIFTS 9 +#define ISAM_FIELDTYPE_WORD 0 +#define ISAM_FIELDTYPE_UWORD 0x80 +#define ISAM_FIELDTYPE_LONG 1 +#define ISAM_FIELDTYPE_ULONG 0x81 +#define ISAM_FIELDTYPE_DOUBLE 2 +#define ISAM_FIELDTYPE_STRING 3 +#define ISAM_FIELDTYPE_BYTE 4 +#define ISAM_FIELDTYPE_UBYTE 0x84 +#define ISAM_FIELDTYPE_LIMIT 4 +#define ISAM_CONVERT_NOFOLD 0 +#define ISAM_CONVERT_FOLD 1 +#define ISAM_CONVERT_UPPER 2 +#define ISAM_CONVERT_LOWER 3 +#define ISAM_FIELDFLAG_ASCEND 0 +#define ISAM_FIELDFLAG_DESCEND 1 +#define ISAM_FLAG_ALLOWDUP 1 +#define ISAM_FLAG_MANUAL 2 +#define ISAM_FLAG_MINIMIZE 4 +#define ISAM_DEFAULT_FIELD_COUNT 32 +#define ISAM_DEFAULT_FIELD_TYPE ISAM_FIELDTYPE_STRING +#define ISAM_DEFAULT_KEY_FIELD_COUNT 1 +#define ISAM_DEFAULT_KEY_STRING_LENGTH 8 +#define ISAM_DEFAULT_RADIX 10 +#define ISAM_DEFAULT_DTOB_WIDTH 20 +#define ISAM_DEFAULT_DTOB_POINT '.' +#define ISAM_PANIC_CALL 160 +#define ISAM_PANIC_PARAM 161 +/* Types for isaman */ +typedef struct +{ +WORD nFields; +UBYTE type[ISAM_MAX_DEFINED_FIELDS]; +} ISAM_FIELDDEF; +typedef struct +{ +WORD field; +UBYTE type; +UBYTE flags; +UBYTE offset; +UBYTE len; +WORD convert; +} ISAM_KEY_FIELD; +typedef struct +{ +WORD nKeyFields; +ISAM_KEY_FIELD keyField[ISAM_MAX_KEYFIELDS]; +} ISAM_KEYDEF; +/* Property of isaman */ +typedef struct { +PR_DAREC *daRec; +PR_IXREC *ixRec[ISAM_MAX_INDEXES]; +WORD ixCat; +WORD ixClass; +WORD iBufBlocks; +LONG ref; +WORD radix; +P_DTOB dFormat; +WORD rBufSize; +UBYTE *rBuf; +ISAM_FIELDDEF fieldInfo; +ISAM_KEYDEF keyDef; +UBYTE zeroBuf[sizeof(DOUBLE)]; +UBYTE tempField[ISAM_MAX_FIELD_LENGTH]; +} PRS_ISAMAN; +typedef struct pr_isaman +{ +PRS_ISROOT isroot; +PRS_ISAMAN isaman; +} PR_ISAMAN; +/* Property of btdbf */ +typedef struct pr_btdbf +{ +PRS_ISROOT isroot; +PRS_ISAMAN isaman; +} PR_BTDBF; +/* Property of dadbf */ +typedef struct { +VOID *pfcb; +UBYTE *buffer; +WORD maxBufSize; +WORD currentBufSize; +WORD nextOffset; +UWORD recordType; +LONG dataStart; +LONG bufFilePos; +LONG ref; +DbfHeader header; +} PRS_DADBF; +typedef struct pr_dadbf +{ +PRS_ISROOT isroot; +PRS_DADBF dadbf; +} PR_DADBF; +/* Constants for ixbtree */ +#define BT_SIG_LENGTH 16 +#define BT_INDEXFILE_VERSION 0x100F +#define BT_INDEXFILE_TYPE1 1 +#define BT_MAX_LEVELS 10 +/* Types for ixbtree */ +typedef struct +{ +UBYTE signature[BT_SIG_LENGTH]; +UWORD version; +WORD type; +LONG count; +UWORD rootBlock; +WORD flags; +WORD keyLen; +WORD entryLen; +WORD maxEntries; +UBYTE keyDef[ISAM_MAX_KEYDEF_LENGTH]; +} IXBTREE_FILE_HEADER; +typedef struct +{ +UWORD child; +LONG ref; +UBYTE key[ISAM_MAX_KEY_LENGTH]; +} IXBTREE_ENTRY; +typedef struct +{ +WORD nEntries; +UBYTE entry[2]; +} IXBTREE_BLOCK; +typedef struct +{ +UWORD blockNum; +WORD entryNum; +} IXBTREE_STACK; +/* Property of ixbtree */ +typedef struct { +WORD fileId; +WORD level; +UWORD blockNum; +WORD entryNum; +LONG ref; +IXBTREE_BLOCK *pB; +IXBTREE_STACK stack[BT_MAX_LEVELS]; +IXBTREE_FILE_HEADER head; +} PRS_IXBTREE; +typedef struct pr_ixbtree +{ +PRS_ISROOT isroot; +PRS_IXREC ixrec; +PRS_IXBTREE ixbtree; +} PR_IXBTREE; +/* Constants for blocker */ +#define BL_BLOCK_SIZE 512 +#define BL_BLOCK_SHIFTS 9 +#define BL_SEG_BLOCKS 20 +#define BL_DS_BLOCKS 4 +#define BL_BLOCK_GRANULARITY 4 +#define BL_MAX_FILES 32 +#define BL_SIG_LENGTH 16 +#define BL_FILE_VERSION 0x100F +#define BL_LIST_SIZE 6 +/* Types for blocker */ +typedef struct +{ +WORD dirty; +UWORD totalBlocks; +UWORD ffBlock; +} BLOCKER_INFO; +typedef struct +{ +UBYTE signature[BL_SIG_LENGTH]; +UWORD version; +BLOCKER_INFO info; +UBYTE spare[8]; +} BLOCKER_FILE_HEADER; +typedef struct +{ +VOID *chan; +UWORD actualBlocks; +BLOCKER_INFO info; +} BLOCKER_FCB; +typedef struct +{ +WORD lru; +WORD fileId; +UWORD block; +UBYTE data[BL_BLOCK_SIZE]; +} BLOCKER_DS_BUF; +/* Property of blocker */ +typedef struct { +UWORD *pBlock; +UBYTE *pFileId; +UBYTE *pDirty; +WORD *pLru; +HANDLE segHandle; +WORD maxBlocks; +WORD nFiles; +WORD currBuf; +BLOCKER_FCB fileCB[BL_MAX_FILES]; +BLOCKER_DS_BUF dsBuf[BL_DS_BLOCKS]; +UBYTE temp[BL_BLOCK_SIZE]; +} PRS_BLOCKER; +typedef struct pr_blocker +{ +PRS_ISROOT isroot; +PRS_BLOCKER blocker; +} PR_BLOCKER; diff --git a/code/SIBOSDK/include/limits.h b/code/SIBOSDK/include/limits.h new file mode 100644 index 0000000..15ed55b --- /dev/null +++ b/code/SIBOSDK/include/limits.h @@ -0,0 +1,36 @@ +/* Release 3.00 */ + +/*-------------------------------------------------------------------------* +* * +* limits.h - Value ranges for common data types. * +* * +* COPYRIGHT (C) 1989 Jensen and Partners. All Rights Reserved. * +* * +*--------------------------------------------------------------------------*/ +#include + +#ifndef _LIMITS_INC_ +#define _LIMITS_INC_ + +#define CHAR_BIT 8 +#ifdef __CHAR_UNSIGNED__ +#define CHAR_MIN 0 +#define CHAR_MAX 255 +#else +#define CHAR_MIN (-128) +#define CHAR_MAX 127 +#endif +#define MB_LEN_MAX 1 +#define SCHAR_MAX 127 +#define SCHAR_MIN (-128) +#define UCHAR_MAX 255 +#define SHRT_MAX 32767 +#define SHRT_MIN (-32767-1) +#define USHRT_MAX 65535U +#define INT_MAX 32767 +#define INT_MIN (-32767-1) +#define UINT_MAX 0xFFFFU +#define LONG_MAX 2147483647L +#define LONG_MIN (-2147483647L-1) +#define ULONG_MAX 4294967295UL +#endif diff --git a/code/SIBOSDK/include/link_def.h b/code/SIBOSDK/include/link_def.h new file mode 100644 index 0000000..bec1723 --- /dev/null +++ b/code/SIBOSDK/include/link_def.h @@ -0,0 +1,8 @@ +/* +LINK_DEF.H - Link process message types +*/ + +#define LNKMSG_NONCP 2 /* if NCP dies this msg sent */ +#define LNKMSG_TERMINATE 3 /* Terminate everything */ +#define LNKMSG_LOADREMOTE 4 /* Load a remote process */ +#define LNKMSG_CONFIG 5 /* Re-configure serial channel */ diff --git a/code/SIBOSDK/include/listbox.g b/code/SIBOSDK/include/listbox.g new file mode 100644 index 0000000..541aa6c --- /dev/null +++ b/code/SIBOSDK/include/listbox.g @@ -0,0 +1,95 @@ +/* Generated by Ctran from listbox.cl */ +#define LISTBOX_G +#ifndef WIN_G +#include +#endif +#ifndef BWIN_G +#include +#endif +#ifndef MATCHER_G +#include +#endif +/* Class Numbers */ +#define C_LISTBOX 7 +/* Method Numbers */ +#define O_LB_DRAW_ITEM 14 +#define O_LB_DRAW_EMPHASIS 15 +#define O_LB_ITEM_WIDTH 17 +#define O_LB_INQUIRE_FOCUS 19 +#define O_LB_INQUIRE_LAST 21 +#define O_LB_INQUIRE_ITEM 20 +#define O_LB_SIZE_WINDOW 16 +#define O_LB_TAKE_FOCUS 18 +/* Constants for listbox */ +#define IN_LISTBOX_MATCHER 0x0001 +#define IN_LISTBOX_KEEP_ARRAY 0x0002 +#define IN_LISTBOX_TEXT_OFFSET 0x0004 +#define IN_LISTBOX_CUR_SET 0x0008 +#define IN_LISTBOX_FIRST_SET 0x0010 +#define IN_LISTBOX_LAST_SET 0x0020 +#define IN_LISTBOX_POS_ALIGN_X 0x0040 +#define IN_LISTBOX_POS_ALIGN_Y 0x0080 +#define IN_LISTBOX_MIN_WIDTH 0x0100 +#define IN_LISTBOX_AUTO_SIZE 0x0200 +#define IN_LISTBOX_FORCE_WIDE 0x0400 +#define IN_LISTBOX_WRAP_ROUND 0x0800 +#define IN_LISTBOX_FIXED_WIDTH 0x8000 +#define PR_LISTBOX_KEEP_ARRAY IN_LISTBOX_KEEP_ARRAY +#define PR_LISTBOX_FORCE_WIDE IN_LISTBOX_FORCE_WIDE +#define PR_LISTBOX_WRAP_ROUND IN_LISTBOX_WRAP_ROUND +#define PR_LISTBOX_UNSTABLE 0x1000 +#define PR_LISTBOX_BOLD_CURSOR 0x2000 +#define PR_LISTBOX_PLAQUE 0x4000 +#define PR_LISTBOX_FIXED_WIDTH IN_LISTBOX_FIXED_WIDTH +#define PR_LISTBOX_SMALL_FONT PR_WIN_FORCE_RIGHT +#define LISTBOX_TOP_EDGE (BWIN_CUSHION_Y+2) +#define LISTBOX_BOTTOM_EDGE (LISTBOX_TOP_EDGE+BWIN_SHADOW_1_HEIGHT) +#define LISTBOX_LEFT_EDGE (BWIN_CUSHION_X+2) +#define LISTBOX_RIGHT_EDGE (LISTBOX_LEFT_EDGE+BWIN_SHADOW_1_WIDTH) +#define XLISTBOX_TOP_EDGE (LISTBOX_TOP_EDGE+6) +#define XLISTBOX_BOTTOM_EDGE (LISTBOX_BOTTOM_EDGE+5) +#define XLISTBOX_LEFT_EDGE (LISTBOX_LEFT_EDGE+6) +#define XLISTBOX_RIGHT_EDGE (LISTBOX_RIGHT_EDGE+5) +#define VXLISTBOX_TOP_EDGE (LISTBOX_TOP_EDGE+4) +#define VXLISTBOX_BOTTOM_EDGE (LISTBOX_BOTTOM_EDGE+3) +#define VXLISTBOX_LEFT_EDGE (LISTBOX_LEFT_EDGE+4) +#define VXLISTBOX_RIGHT_EDGE (LISTBOX_RIGHT_EDGE+3) +#define LISTBOX_OBLOID_INDENT 2 +#define LISTBOX_TITLELINE_HEIGHT 3 +#define LISTBOX_SCROLL_GUTTER 7 +#define LISTBOX_SCROLL_OFFSET 1 +/* Types for listbox */ +typedef struct +{ +unsigned short int flags; +PR_VAROOT *array; +unsigned short int offset; +short int current; +unsigned short int top; +unsigned short int first; +unsigned short int last; +P_POINT pos; +unsigned short int minwid; +} IN_LISTBOX; +/* Property of listbox */ +typedef struct { +PR_VMATCHER *match; +PR_VAROOT *va; +unsigned short int flags; +short int width; +unsigned short int matchlen; +unsigned short int curoff; +unsigned short int offset; +short int current; +short int top; +short int first; +short int last; +short int vastart; +short int matchstart; +} PRS_LISTBOX; +typedef struct pr_listbox +{ +PRS_ROOT root; +PRS_WIN win; +PRS_LISTBOX listbox; +} PR_LISTBOX; diff --git a/code/SIBOSDK/include/listbox.ing b/code/SIBOSDK/include/listbox.ing new file mode 100644 index 0000000..b62c9d5 --- /dev/null +++ b/code/SIBOSDK/include/listbox.ing @@ -0,0 +1,93 @@ +; Generated by Ctran from listbox.cl +LISTBOX_ING equ 1 +IFNDEF WIN_ING + INCLUDE ..\inc\WIN.ING +ENDIF +IFNDEF BWIN_ING + INCLUDE ..\inc\BWIN.ING +ENDIF +IFNDEF MATCHER_ING + INCLUDE ..\inc\MATCHER.ING +ENDIF +; Class Numbers +C_LISTBOX equ 7 +; Method Numbers +O_LB_DRAW_ITEM equ 14 +O_LB_DRAW_EMPHASIS equ 15 +O_LB_ITEM_WIDTH equ 17 +O_LB_INQUIRE_FOCUS equ 19 +O_LB_INQUIRE_LAST equ 21 +O_LB_INQUIRE_ITEM equ 20 +O_LB_SIZE_WINDOW equ 16 +O_LB_TAKE_FOCUS equ 18 +; Constants for listbox +IN_LISTBOX_MATCHER equ (00001h) +IN_LISTBOX_KEEP_ARRAY equ (00002h) +IN_LISTBOX_TEXT_OFFSET equ (00004h) +IN_LISTBOX_CUR_SET equ (00008h) +IN_LISTBOX_FIRST_SET equ (00010h) +IN_LISTBOX_LAST_SET equ (00020h) +IN_LISTBOX_POS_ALIGN_X equ (00040h) +IN_LISTBOX_POS_ALIGN_Y equ (00080h) +IN_LISTBOX_MIN_WIDTH equ (00100h) +IN_LISTBOX_AUTO_SIZE equ (00200h) +IN_LISTBOX_FORCE_WIDE equ (00400h) +IN_LISTBOX_WRAP_ROUND equ (00800h) +IN_LISTBOX_FIXED_WIDTH equ (08000h) +PR_LISTBOX_KEEP_ARRAY equ (IN_LISTBOX_KEEP_ARRAY) +PR_LISTBOX_FORCE_WIDE equ (IN_LISTBOX_FORCE_WIDE) +PR_LISTBOX_WRAP_ROUND equ (IN_LISTBOX_WRAP_ROUND) +PR_LISTBOX_UNSTABLE equ (01000h) +PR_LISTBOX_BOLD_CURSOR equ (02000h) +PR_LISTBOX_PLAQUE equ (04000h) +PR_LISTBOX_FIXED_WIDTH equ (IN_LISTBOX_FIXED_WIDTH) +PR_LISTBOX_SMALL_FONT equ (PR_WIN_FORCE_RIGHT) +LISTBOX_TOP_EDGE equ (BWIN_CUSHION_Y+2) +LISTBOX_BOTTOM_EDGE equ (LISTBOX_TOP_EDGE+BWIN_SHADOW_1_HEIGHT) +LISTBOX_LEFT_EDGE equ (BWIN_CUSHION_X+2) +LISTBOX_RIGHT_EDGE equ (LISTBOX_LEFT_EDGE+BWIN_SHADOW_1_WIDTH) +XLISTBOX_TOP_EDGE equ (LISTBOX_TOP_EDGE+6) +XLISTBOX_BOTTOM_EDGE equ (LISTBOX_BOTTOM_EDGE+5) +XLISTBOX_LEFT_EDGE equ (LISTBOX_LEFT_EDGE+6) +XLISTBOX_RIGHT_EDGE equ (LISTBOX_RIGHT_EDGE+5) +VXLISTBOX_TOP_EDGE equ (LISTBOX_TOP_EDGE+4) +VXLISTBOX_BOTTOM_EDGE equ (LISTBOX_BOTTOM_EDGE+3) +VXLISTBOX_LEFT_EDGE equ (LISTBOX_LEFT_EDGE+4) +VXLISTBOX_RIGHT_EDGE equ (LISTBOX_RIGHT_EDGE+3) +LISTBOX_OBLOID_INDENT equ (2) +LISTBOX_TITLELINE_HEIGHT equ (3) +LISTBOX_SCROLL_GUTTER equ (7) +LISTBOX_SCROLL_OFFSET equ (1) +; Types for listbox +IN_LISTBOX struc +IN_LISTBOXFlags dw ? +IN_LISTBOXArray dw ? +IN_LISTBOXOffset dw ? +IN_LISTBOXCurrent dw ? +IN_LISTBOXTop dw ? +IN_LISTBOXFirst dw ? +IN_LISTBOXLast dw ? +IN_LISTBOXPos P_POINT <> +IN_LISTBOXMinwid dw ? +IN_LISTBOX ends +; Property of listbox +PRS_LISTBOX struc +ListboxMatch dw ? +ListboxVa dw ? +ListboxFlags dw ? +ListboxWidth dw ? +ListboxMatchlen dw ? +ListboxCuroff dw ? +ListboxOffset dw ? +ListboxCurrent dw ? +ListboxTop dw ? +ListboxFirst dw ? +ListboxLast dw ? +ListboxVastart dw ? +ListboxMatchstart dw ? +PRS_LISTBOX ends +PR_LISTBOX struc +ListboxRoot PRS_ROOT <> +ListboxWin PRS_WIN <> +ListboxListbox PRS_LISTBOX <> +PR_LISTBOX ends diff --git a/code/SIBOSDK/include/lledit.g b/code/SIBOSDK/include/lledit.g new file mode 100644 index 0000000..3296a4d --- /dev/null +++ b/code/SIBOSDK/include/lledit.g @@ -0,0 +1,32 @@ +/* Generated by Ctran from lledit.cl */ +#define LLEDIT_G +#ifndef LODGER_G +#include +#endif +#ifndef MFNE_G +#include +#endif +/* Class Numbers */ +#define C_LLEDIT 33 +/* Method Numbers */ +/* Constants for lledit */ +#define IN_LLEDIT_LATITUDE 0 +#define IN_LLEDIT_LONGITUDE 1 +/* Types for lledit */ +typedef struct +{ +short int flags; +short int value; +} IN_LLEDIT; +typedef struct +{ +short int value; +} SE_LLEDIT; +/* Property of lledit */ +typedef struct pr_lledit +{ +PRS_ROOT root; +PRS_WIN win; +PRS_LODGER lodger; +PRS_MFNE mfne; +} PR_LLEDIT; diff --git a/code/SIBOSDK/include/lledit.ing b/code/SIBOSDK/include/lledit.ing new file mode 100644 index 0000000..cf74c03 --- /dev/null +++ b/code/SIBOSDK/include/lledit.ing @@ -0,0 +1,29 @@ +; Generated by Ctran from lledit.cl +LLEDIT_ING equ 1 +IFNDEF LODGER_ING + INCLUDE ..\inc\LODGER.ING +ENDIF +IFNDEF MFNE_ING + INCLUDE ..\inc\MFNE.ING +ENDIF +; Class Numbers +C_LLEDIT equ 33 +; Method Numbers +; Constants for lledit +IN_LLEDIT_LATITUDE equ (0) +IN_LLEDIT_LONGITUDE equ (1) +; Types for lledit +IN_LLEDIT struc +IN_LLEDITFlags dw ? +IN_LLEDITValue dw ? +IN_LLEDIT ends +SE_LLEDIT struc +SE_LLEDITValue dw ? +SE_LLEDIT ends +; Property of lledit +PR_LLEDIT struc +LleditRoot PRS_ROOT <> +LleditWin PRS_WIN <> +LleditLodger PRS_LODGER <> +LleditMfne PRS_MFNE <> +PR_LLEDIT ends diff --git a/code/SIBOSDK/include/locale.h b/code/SIBOSDK/include/locale.h new file mode 100644 index 0000000..f2bc361 --- /dev/null +++ b/code/SIBOSDK/include/locale.h @@ -0,0 +1,55 @@ +/* Release 3.00 */ + +/*-------------------------------------------------------------------------* +* * +* locale.h - locale definitions and prototypes. * +* * +* COPYRIGHT (C) 1989, 1990 Jensen and Partners. All Rights Reserved. * +* * +*--------------------------------------------------------------------------*/ +#include + +#ifndef _LOCALE_INC_ +#define _LOCALE_INC_ + +#ifndef NULL +#define NULL 0 +#endif + +#define LC_ALL 0 +#define LC_COLLATE 1 +#define LC_CTYPE 2 +#define LC_NUMERIC 3 +#define LC_TIME 4 +#define LC_MONETARY 5 + +struct lconv { + char *decimal_point; + char *thousands_sep; + char *grouping; + char *int_curr_symbol; + char *currency_symbol; + char *mon_decimal_point; + char *mon_thousands_sep; + char *mon_grouping; + char *positive_sign; + char *negative_sign; + char int_frac_digits; + char frac_digits; + char p_cs_precedes; + char p_sep_by_space; + char n_cs_precedes; + char n_sep_by_space; + char p_sign_posn; + char n_sign_posn; +}; + +#ifdef __cplusplus +extern "C" { +#endif +extern struct lconv * localeconv(void); +extern char * setlocale(int _category, const char *_locale); +#ifdef __cplusplus +} +#endif +#endif diff --git a/code/SIBOSDK/include/lodger.g b/code/SIBOSDK/include/lodger.g new file mode 100644 index 0000000..c03ff92 --- /dev/null +++ b/code/SIBOSDK/include/lodger.g @@ -0,0 +1,30 @@ +/* Generated by Ctran from lodger.cl */ +#define LODGER_G +#ifndef WIN_G +#include +#endif +/* Class Numbers */ +#define C_LODGER 3 +/* Method Numbers */ +#define O_LG_SET_ID_POS 14 +#define O_LG_UPDATE 18 +#define O_LG_SENSE_WIDTH 17 +#define O_LG_SELF_CHECK 16 +#define O_LG_DRAW 15 +/* Constants for lodger */ +#define LG_CHECK_OK 1 +#define LG_CHECK_FAILED 0 +#define LG_CHECK_FAILED_CHANGED (-1) +#define LG_CHECK_OK_CHANGED (-2) +/* Property of lodger */ +typedef struct { +P_POINT offset; +unsigned short int width; +PR_WIN *landlord; +} PRS_LODGER; +typedef struct pr_lodger +{ +PRS_ROOT root; +PRS_WIN win; +PRS_LODGER lodger; +} PR_LODGER; diff --git a/code/SIBOSDK/include/lodger.ing b/code/SIBOSDK/include/lodger.ing new file mode 100644 index 0000000..55f0f6b --- /dev/null +++ b/code/SIBOSDK/include/lodger.ing @@ -0,0 +1,29 @@ +; Generated by Ctran from lodger.cl +LODGER_ING equ 1 +IFNDEF WIN_ING + INCLUDE ..\inc\WIN.ING +ENDIF +; Class Numbers +C_LODGER equ 3 +; Method Numbers +O_LG_SET_ID_POS equ 14 +O_LG_UPDATE equ 18 +O_LG_SENSE_WIDTH equ 17 +O_LG_SELF_CHECK equ 16 +O_LG_DRAW equ 15 +; Constants for lodger +LG_CHECK_OK equ (1) +LG_CHECK_FAILED equ (0) +LG_CHECK_FAILED_CHANGED equ (-1) +LG_CHECK_OK_CHANGED equ (-2) +; Property of lodger +PRS_LODGER struc +LodgerOffset P_POINT <> +LodgerWidth dw ? +LodgerLandlord dw ? +PRS_LODGER ends +PR_LODGER struc +LodgerRoot PRS_ROOT <> +LodgerWin PRS_WIN <> +LodgerLodger PRS_LODGER <> +PR_LODGER ends diff --git a/code/SIBOSDK/include/lprinter.g b/code/SIBOSDK/include/lprinter.g new file mode 100644 index 0000000..ae89a6c --- /dev/null +++ b/code/SIBOSDK/include/lprinter.g @@ -0,0 +1,31 @@ +/* Generated by Ctran from lprinter.cl */ +#define LPRINTER_G +#ifndef SCRLAY_G +#include +#endif +#ifndef PRDRV_G +#include +#endif +/* Class Numbers */ +#define C_LPRINTER 74 +/* Method Numbers */ +#define O_LPR_SENSE_TEXT 4 +#define O_LPR_INIT 1 +#define O_LPR_READ 2 +#define O_LPR_SENSE_BUF_WIDTH 3 +/* Property of lprinter */ +typedef struct { +void *pages; +void *wdr; +SCRLAY_FONT f; +WDR_PRINT defer; +unsigned char *wtab; +unsigned short int lheight; +unsigned short int width; +unsigned short int subsqind; +} PRS_LPRINTER; +typedef struct pr_lprinter +{ +PRS_ROOT root; +PRS_LPRINTER lprinter; +} PR_LPRINTER; diff --git a/code/SIBOSDK/include/lprinter.ing b/code/SIBOSDK/include/lprinter.ing new file mode 100644 index 0000000..09dd331 --- /dev/null +++ b/code/SIBOSDK/include/lprinter.ing @@ -0,0 +1,30 @@ +; Generated by Ctran from lprinter.cl +LPRINTER_ING equ 1 +IFNDEF SCRLAY_ING + INCLUDE ..\inc\SCRLAY.ING +ENDIF +IFNDEF PRDRV_ING + INCLUDE ..\inc\PRDRV.ING +ENDIF +; Class Numbers +C_LPRINTER equ 74 +; Method Numbers +O_LPR_SENSE_TEXT equ 4 +O_LPR_INIT equ 1 +O_LPR_READ equ 2 +O_LPR_SENSE_BUF_WIDTH equ 3 +; Property of lprinter +PRS_LPRINTER struc +LprinterPages dw ? +LprinterWdr dw ? +LprinterF SCRLAY_FONT <> +LprinterDefer WDR_PRINT <> +LprinterWtab dw ? +LprinterLheight dw ? +LprinterWidth dw ? +LprinterSubsqind dw ? +PRS_LPRINTER ends +PR_LPRINTER struc +LprinterRoot PRS_ROOT <> +LprinterLprinter PRS_LPRINTER <> +PR_LPRINTER ends diff --git a/code/SIBOSDK/include/malloc.h b/code/SIBOSDK/include/malloc.h new file mode 100644 index 0000000..8c3da28 --- /dev/null +++ b/code/SIBOSDK/include/malloc.h @@ -0,0 +1,2 @@ +#include + \ No newline at end of file diff --git a/code/SIBOSDK/include/matcher.g b/code/SIBOSDK/include/matcher.g new file mode 100644 index 0000000..e119a7b --- /dev/null +++ b/code/SIBOSDK/include/matcher.g @@ -0,0 +1,46 @@ +/* Generated by Ctran from matcher.cl */ +#define MATCHER_G +#ifndef VARRAY_G +#include +#endif +/* Class Numbers */ +#define C_MATCHER 5 +#define C_VMATCHER 6 +/* Method Numbers */ +#define O_IM_TRY_MATCH 6 +#define O_IM_SET_BUF 2 +#define O_IM_TRANSITION 7 +#define O_IM_SET_VAL 4 +#define O_IM_INIT 1 +#define O_IM_SENSE_BUF 3 +#define O_IM_SET_RANGE 9 +#define O_IM_SENSE_VAL 5 +#define O_IM_KEY 8 +/* Constants for matcher */ +#define IM_NEW_LEN 1 +#define IM_NEW_DISPLAY 2 +#define IM_NO_CHANGE 3 +/* Property of matcher */ +typedef struct { +char *ptyped; +unsigned char *plen; +} PRS_MATCHER; +typedef struct pr_matcher +{ +PRS_ROOT root; +PRS_MATCHER matcher; +} PR_MATCHER; +/* Property of vmatcher */ +typedef struct { +PR_VAROOT *va; +unsigned short int index; +unsigned short int first; +unsigned short int last; +unsigned short int txtoff; +} PRS_VMATCHER; +typedef struct pr_vmatcher +{ +PRS_ROOT root; +PRS_MATCHER matcher; +PRS_VMATCHER vmatcher; +} PR_VMATCHER; diff --git a/code/SIBOSDK/include/matcher.ing b/code/SIBOSDK/include/matcher.ing new file mode 100644 index 0000000..3f9bd02 --- /dev/null +++ b/code/SIBOSDK/include/matcher.ing @@ -0,0 +1,44 @@ +; Generated by Ctran from matcher.cl +MATCHER_ING equ 1 +IFNDEF VARRAY_ING + INCLUDE ..\inc\VARRAY.ING +ENDIF +; Class Numbers +C_MATCHER equ 5 +C_VMATCHER equ 6 +; Method Numbers +O_IM_TRY_MATCH equ 6 +O_IM_SET_BUF equ 2 +O_IM_TRANSITION equ 7 +O_IM_SET_VAL equ 4 +O_IM_INIT equ 1 +O_IM_SENSE_BUF equ 3 +O_IM_SET_RANGE equ 9 +O_IM_SENSE_VAL equ 5 +O_IM_KEY equ 8 +; Constants for matcher +IM_NEW_LEN equ (1) +IM_NEW_DISPLAY equ (2) +IM_NO_CHANGE equ (3) +; Property of matcher +PRS_MATCHER struc +MatcherPtyped dw ? +MatcherPlen dw ? +PRS_MATCHER ends +PR_MATCHER struc +MatcherRoot PRS_ROOT <> +MatcherMatcher PRS_MATCHER <> +PR_MATCHER ends +; Property of vmatcher +PRS_VMATCHER struc +VmatcherVa dw ? +VmatcherIndex dw ? +VmatcherFirst dw ? +VmatcherLast dw ? +VmatcherTxtoff dw ? +PRS_VMATCHER ends +PR_VMATCHER struc +VmatcherRoot PRS_ROOT <> +VmatcherMatcher PRS_MATCHER <> +VmatcherVmatcher PRS_VMATCHER <> +PR_VMATCHER ends diff --git a/code/SIBOSDK/include/matchwin.g b/code/SIBOSDK/include/matchwin.g new file mode 100644 index 0000000..b54bb71 --- /dev/null +++ b/code/SIBOSDK/include/matchwin.g @@ -0,0 +1,42 @@ +/* Generated by Ctran from matchwin.cl */ +#define MATCHWIN_G +#ifndef MATCHER_G +#include +#endif +#ifndef GRIDWIN_G +#include +#endif +/* Class Numbers */ +#define C_MATCHWIN 21 +/* Method Numbers */ +#define O_MW_STOP_MATCH 24 +#define O_MW_HIT_MAXLEN 25 +#define O_MW_START_MATCH 23 +/* Constants for matchwin */ +#define PR_MATCHWIN_UNSET (-1) +/* Types for matchwin */ +typedef struct +{ +PR_VAROOT *array; +unsigned int maxlen; +unsigned short int txtoff; +unsigned int minrec; +unsigned int maxrec; +int offset; +unsigned int column; +int position; +} IN_MATCHWIN; +/* Property of matchwin */ +typedef struct { +PR_VMATCHER *matcher; +IN_MATCHWIN params; +unsigned char matchlen; +unsigned char filler; +} PRS_MATCHWIN; +typedef struct pr_matchwin +{ +PRS_ROOT root; +PRS_WIN win; +PRS_GRIDWIN gridwin; +PRS_MATCHWIN matchwin; +} PR_MATCHWIN; diff --git a/code/SIBOSDK/include/matchwin.ing b/code/SIBOSDK/include/matchwin.ing new file mode 100644 index 0000000..224c8c0 --- /dev/null +++ b/code/SIBOSDK/include/matchwin.ing @@ -0,0 +1,40 @@ +; Generated by Ctran from matchwin.cl +MATCHWIN_ING equ 1 +IFNDEF MATCHER_ING + INCLUDE ..\inc\MATCHER.ING +ENDIF +IFNDEF GRIDWIN_ING + INCLUDE ..\inc\GRIDWIN.ING +ENDIF +; Class Numbers +C_MATCHWIN equ 21 +; Method Numbers +O_MW_STOP_MATCH equ 24 +O_MW_HIT_MAXLEN equ 25 +O_MW_START_MATCH equ 23 +; Constants for matchwin +PR_MATCHWIN_UNSET equ (-1) +; Types for matchwin +IN_MATCHWIN struc +IN_MATCHWINArray dw ? +IN_MATCHWINMaxlen dw ? +IN_MATCHWINTxtoff dw ? +IN_MATCHWINMinrec dw ? +IN_MATCHWINMaxrec dw ? +IN_MATCHWINOffset dw ? +IN_MATCHWINColumn dw ? +IN_MATCHWINPosition dw ? +IN_MATCHWIN ends +; Property of matchwin +PRS_MATCHWIN struc +MatchwinMatcher dw ? +MatchwinParams IN_MATCHWIN <> +MatchwinMatchlen db ? +MatchwinFiller db ? +PRS_MATCHWIN ends +PR_MATCHWIN struc +MatchwinRoot PRS_ROOT <> +MatchwinWin PRS_WIN <> +MatchwinGridwin PRS_GRIDWIN <> +MatchwinMatchwin PRS_MATCHWIN <> +PR_MATCHWIN ends diff --git a/code/SIBOSDK/include/math.h b/code/SIBOSDK/include/math.h new file mode 100644 index 0000000..e75d7fa --- /dev/null +++ b/code/SIBOSDK/include/math.h @@ -0,0 +1,159 @@ +/* Release 3.00 */ + +/*-------------------------------------------------------------------------* +* * +* math.h - floating point definitions and prototypes. * +* * +* COPYRIGHT (C) 1989, 1990 Jensen and Partners. All Rights Reserved. * +* * +*--------------------------------------------------------------------------*/ +#include + +#ifndef _MATH_INC_ +#define _MATH_INC_ + +#ifndef _ERRNOM_INC_ +#define _ERRNOM_INC_ + +extern int _doserrno; /* global DOS error variable */ +extern int errno; /* global error variable */ +#endif + +#define EDOM (-2) /* Math argument */ +#define ERANGE (-7) /* Result too large */ + + +#define DOMAIN 1 /* parameter not in valid domain */ +#define SING 2 /* function is incalculable at this place */ +#define OVERFLOW 3 /* result exceeds representable range */ +#define UNDERFLOW 4 /* result too close to zero to be represented */ +#define TLOSS 5 /* total loss of precision (eg. Sine (2**65)) */ +#define PLOSS 6 /* partial precision loss */ + +#define HUGE_VAL HUGE +#define LHUGE_VAL LHUGE + +extern double HUGE; +extern double LHUGE; + +#ifdef __cplusplus +extern "C" { +#endif +extern int abs(int _x); +extern double acos(double _x); +extern double asin(double _x); +extern double atan(double _x); +extern double atan2(double _y, double _x); +extern double atof(const char *_s); +extern double ceil(double _x); +extern double cos(double _x); +extern double cosh(double _x); +extern double exp(double _x); +extern double fabs(double _x); +extern double floor(double _x); +extern double fmod(double _x, double _y); +extern double frexp(double _x, int *_exp); +extern long labs(long _x); +extern double ldexp(double _x, int _exp); +extern double log(double _x); +extern double log10(double _x); +extern double modf(double _x, double *_ipart); +extern double poly(double _x, int _degree, double _coeffs[]); +extern double pow(double _x, double _y); +extern double sin(double _x); +extern double sinh(double _x); +extern double sqrt(double _x); +extern double strtod(const char *_s, char **_eptr); +extern double tan(double _x); +extern double tanh(double _x); + +extern long double acosl(long double _x); +extern long double asinl(long double _x); +extern long double atanl(long double _x); +extern long double atan2l(long double _y, long double _x); +extern long double atofl(const char *_s); +extern long double ceill(long double _x); +extern long double cosl(long double _x); +extern long double coshl(long double _x); +extern long double expl(long double _x); +extern long double fabsl(long double _x); +extern long double floorl(long double _x); +extern long double fmodl(long double _x, long double _y); +extern long double frexpl(long double _x, int *_exp); +extern long double ldexpl(long double _x, int _exp); +extern long double logl(long double _x); +extern long double log10l(long double _x); +extern long double modfl(long double _x, long double *_ipart); +extern long double polyl(long double _x, int _degree, long double _coeffs[]); +extern long double powl(long double _x, long double _y); +extern long double sinl(long double _x); +extern long double sinhl(long double _x); +extern long double sqrtl(long double _x); +extern long double strtodl(const char *_s, char **_eptr); +extern long double tanl(long double _x); +extern long double tanhl(long double _x); +#ifdef __cplusplus +} +#endif + +struct exception { + int type; + char *name; + double arg1, + arg2, + retval; +}; + +extern int (* matherr)(struct exception *_x); +#ifdef __cplusplus +extern "C" { +#endif +extern double hypot(double _x, double _y); +extern long double hypotl(long double _x, long double _y); +extern double pow10(int _p); +extern void _fpreset(void); +#ifdef __cplusplus +} +#endif + +#ifdef __cplusplus +struct _complex { /* as used by cabs function */ + double x, + y; +}; + +struct _complexl { /* as used by cabsl function */ + long double x, + y; +}; +#else +struct complex { /* as used by cabs function */ + double x, + y; +}; + +struct complexl { /* as used by cabsl function */ + long double x, + y; +}; +#endif + +#define cabs(z) (hypot ((z).x, (z).y)) +#define cabsl(z) (hypotl((z).x, (z).y)) + +/* Constants rounded for 18 decimals. */ +#define MA_E 2.71828182845904524 +#define MA_LOG2E 1.44269504088896341 +#define MA_LOG10E 0.434294481903251828 +#define MA_LN2 0.693147180559945309 +#define MA_LN10 2.30258509299404568 +#define MA_PI 3.14159265358979324 +#define MA_PI_2 1.57079632679489662 +#define MA_PI_4 0.785398163397448310 +#define MA_1_PI 0.318309886183790672 +#define MA_2_PI 0.636619772367581343 +#define MA_1_SQRTPI 0.564189583547756287 +#define MA_2_SQRTPI 1.12837916709551257 +#define MA_SQRT2 1.41421356237309505 +#define MA_SQRT_2 0.707106781186547524 +#endif diff --git a/code/SIBOSDK/include/mem.h b/code/SIBOSDK/include/mem.h new file mode 100644 index 0000000..135c6e3 --- /dev/null +++ b/code/SIBOSDK/include/mem.h @@ -0,0 +1,42 @@ +/* Release 3.00 */ + +/*-------------------------------------------------------------------------* +* * +* mem.h - memory manipulation definitions and function prototypes. * +* * +* COPYRIGHT (C) 1989 Jensen and Partners. All Rights Reserved * +* * +*--------------------------------------------------------------------------*/ +#include + +#ifndef _MEM_INC_ +#define _MEM_INC_ + +#ifndef _SIZE_T +#define _SIZE_T +typedef unsigned size_t; +#endif + +#ifndef NULL +#define NULL 0 +#endif + +#ifdef __cplusplus +extern "C" { +#endif +extern int memcmp(const void *_s1, const void *_s2, size_t _num); +extern void * memcpy(void *_dest, const void *_source, size_t _num); +extern void * memset(void *_s, int _c, size_t _num); +extern void * memccpy(void *_dest, const void *_source, int _c, size_t _num); +extern void * memchr(const void *_s, int _c, size_t _num); +extern int memicmp(const void *_s1, const void *_s2, size_t _num); +extern void * memmove(void *_dest, const void *_source, size_t _num); +extern void movmem(void *src, void *_dest, unsigned _length); +extern void setmem(void *_dest, unsigned _length, char _value); +extern void * memwmove(void *_dest, const void *_source, size_t _num); +extern void * memwset(void *_s, int _c, size_t _num); +extern void * memwcpy(void *_dest, const void *_source, size_t _num); +#ifdef __cplusplus +} +#endif +#endif diff --git a/code/SIBOSDK/include/memory.h b/code/SIBOSDK/include/memory.h new file mode 100644 index 0000000..19bc761 --- /dev/null +++ b/code/SIBOSDK/include/memory.h @@ -0,0 +1,2 @@ +#include + \ No newline at end of file diff --git a/code/SIBOSDK/include/menubar.g b/code/SIBOSDK/include/menubar.g new file mode 100644 index 0000000..b05892c --- /dev/null +++ b/code/SIBOSDK/include/menubar.g @@ -0,0 +1,59 @@ +/* Generated by Ctran from menubar.cl */ +#define MENUBAR_G +#ifndef BWIN_G +#include +#endif +#ifndef PULLDOWN_G +#include +#endif +/* Class Numbers */ +#define C_MENUTAB 9 +#define C_MENUBAR 10 +/* Method Numbers */ +#define O_MB_ADD_MENU 14 +/* Property of menutab */ +typedef struct { +char *txt; +unsigned short int xoff; +} PRS_MENUTAB; +typedef struct pr_menutab +{ +PRS_ROOT root; +PRS_WIN win; +PRS_MENUTAB menutab; +} PR_MENUTAB; +/* Constants for menubar */ +#define MENUBAR_LEFT_SHOULD 4 +#define MENUBAR_RIGHT_SHOULD 4 +#define MENUBAR_MAX_MENU 15 +#define MENUBAR_MIN_GAP 3 +#define MENUBAR_MAX_GAP 10 +#define MENUBAR_3b_TAIL_WIDTH 18 +#define MENUBAR_FLG_PREBUILT 0x80 +/* Types for menubar */ +typedef struct +{ +unsigned short int menu_id; +char mb_txt[1]; +} MENUBAR_ITEM; +typedef struct +{ +unsigned char count; +} MENUBAR; +/* Property of menubar */ +typedef struct { +PR_MENUTAB *tab; +PR_PULLDOWN *menu; +MENUBAR *mb; +unsigned char num; +unsigned char xoff; +unsigned char toff; +unsigned char asc; +unsigned short int pos[MENUBAR_MAX_MENU+1]; +} PRS_MENUBAR; +typedef struct pr_menubar +{ +PRS_ROOT root; +PRS_WIN win; +PRS_MENUBAR menubar; +} PR_MENUBAR; diff --git a/code/SIBOSDK/include/menubar.ing b/code/SIBOSDK/include/menubar.ing new file mode 100644 index 0000000..672d26e --- /dev/null +++ b/code/SIBOSDK/include/menubar.ing @@ -0,0 +1,55 @@ +; Generated by Ctran from menubar.cl +MENUBAR_ING equ 1 +IFNDEF BWIN_ING + INCLUDE ..\inc\BWIN.ING +ENDIF +IFNDEF PULLDOWN_ING + INCLUDE ..\inc\PULLDOWN.ING +ENDIF +; Class Numbers +C_MENUTAB equ 9 +C_MENUBAR equ 10 +; Method Numbers +O_MB_ADD_MENU equ 14 +; Property of menutab +PRS_MENUTAB struc +MenutabTxt dw ? +MenutabXoff dw ? +PRS_MENUTAB ends +PR_MENUTAB struc +MenutabRoot PRS_ROOT <> +MenutabWin PRS_WIN <> +MenutabMenutab PRS_MENUTAB <> +PR_MENUTAB ends +; Constants for menubar +MENUBAR_LEFT_SHOULD equ (4) +MENUBAR_RIGHT_SHOULD equ (4) +MENUBAR_MAX_MENU equ (15) +MENUBAR_MIN_GAP equ (3) +MENUBAR_MAX_GAP equ (10) +MENUBAR_3b_TAIL_WIDTH equ (18) +MENUBAR_FLG_PREBUILT equ (080h) +; Types for menubar +MENUBAR_ITEM struc +MENUBAR_ITEMMenu_id dw ? +MENUBAR_ITEMMb_txt db (1) * 1 dup (?) +MENUBAR_ITEM ends +MENUBAR struc +MENUBARCount db ? +MENUBAR ends +; Property of menubar +PRS_MENUBAR struc +MenubarTab dw ? +MenubarMenu dw ? +MenubarMb dw ? +MenubarNum db ? +MenubarXoff db ? +MenubarToff db ? +MenubarAsc db ? +MenubarPos db (2) * MENUBAR_MAX_MENU+1 dup (?) +PRS_MENUBAR ends +PR_MENUBAR struc +MenubarRoot PRS_ROOT <> +MenubarWin PRS_WIN <> +MenubarMenubar PRS_MENUBAR <> +PR_MENUBAR ends diff --git a/code/SIBOSDK/include/mfne.g b/code/SIBOSDK/include/mfne.g new file mode 100644 index 0000000..e1c138c --- /dev/null +++ b/code/SIBOSDK/include/mfne.g @@ -0,0 +1,56 @@ +/* Generated by Ctran from mfne.cl */ +#define MFNE_G +#ifndef LODGER_G +#include +#endif +/* Class Numbers */ +#define C_MFNE 27 +/* Method Numbers */ +#define O_MF_RANGE_BEEP 19 +/* Constants for mfne */ +#define MFNE_MAX_FIELDS 4 +#define MFNE_MAX_WIDTH 10 +#define MFNE_MAX_TRAILER 3 +#define MFNE_LOWER 0 +#define MFNE_UPPER 1 +#define MFNE_CURSOR_WIDTH 3 +#define MFNE_SIGNED 0x01 +#define MFNE_LEFT_ALIGN 0x02 +#define MFNE_SUPPRESS_LEADING 0x04 +#define MFNE_SUPPRESS_SEPARATOR 0x08 +#define MFNE_TRAILER 0x10 +#define MFNE_SETS_NEXT 0x20 +#define MFNE_SETS_PREV 0x40 +#define MFNE_AUTO_SIZE 0x80 +#define MFNE_EMPHASISED_KLUDGE 0x20 +/* Types for mfne */ +typedef struct +{ +short int flags; +long int value; +unsigned char width; +unsigned char hWidth; +unsigned char hPos; +unsigned char separator; +long int limits[2]; +} MFNE_FIELD; +/* Property of mfne */ +typedef struct { +short int selected; +short int cField; +short int nField; +short int totWidth; +short int cPos; +short int changed; +char eStr[MFNE_MAX_WIDTH+2]; +char dStr[MFNE_MAX_FIELDS*(MFNE_MAX_WIDTH+1)+MFNE_MAX_TRAILER+2]; +char trail[2][MFNE_MAX_TRAILER+1]; +MFNE_FIELD f[MFNE_MAX_FIELDS]; +} PRS_MFNE; +typedef struct pr_mfne +{ +PRS_ROOT root; +PRS_WIN win; +PRS_LODGER lodger; +PRS_MFNE mfne; +} PR_MFNE; diff --git a/code/SIBOSDK/include/mfne.ing b/code/SIBOSDK/include/mfne.ing new file mode 100644 index 0000000..df0f37b --- /dev/null +++ b/code/SIBOSDK/include/mfne.ing @@ -0,0 +1,54 @@ +; Generated by Ctran from mfne.cl +MFNE_ING equ 1 +IFNDEF LODGER_ING + INCLUDE ..\inc\LODGER.ING +ENDIF +; Class Numbers +C_MFNE equ 27 +; Method Numbers +O_MF_RANGE_BEEP equ 19 +; Constants for mfne +MFNE_MAX_FIELDS equ (4) +MFNE_MAX_WIDTH equ (10) +MFNE_MAX_TRAILER equ (3) +MFNE_LOWER equ (0) +MFNE_UPPER equ (1) +MFNE_CURSOR_WIDTH equ (3) +MFNE_SIGNED equ (001h) +MFNE_LEFT_ALIGN equ (002h) +MFNE_SUPPRESS_LEADING equ (004h) +MFNE_SUPPRESS_SEPARATOR equ (008h) +MFNE_TRAILER equ (010h) +MFNE_SETS_NEXT equ (020h) +MFNE_SETS_PREV equ (040h) +MFNE_AUTO_SIZE equ (080h) +MFNE_EMPHASISED_KLUDGE equ (020h) +; Types for mfne +MFNE_FIELD struc +MFNE_FIELDFlags dw ? +MFNE_FIELDValue dd ? +MFNE_FIELDWidth db ? +MFNE_FIELDHWidth db ? +MFNE_FIELDHPos db ? +MFNE_FIELDSeparator db ? +MFNE_FIELDLimits db (4) * 2 dup (?) +MFNE_FIELD ends +; Property of mfne +PRS_MFNE struc +MfneSelected dw ? +MfneCField dw ? +MfneNField dw ? +MfneTotWidth dw ? +MfneCPos dw ? +MfneChanged dw ? +MfneEStr db (1) * MFNE_MAX_WIDTH+2 dup (?) +MfneDStr db (1) * MFNE_MAX_FIELDS*(MFNE_MAX_WIDTH+1)+MFNE_MAX_TRAILER+2 dup (?) +MfneTrail db (1) * 2 dup (?) +MfneF db (size MFNE_FIELD)* MFNE_MAX_FIELDS dup (?) +PRS_MFNE ends +PR_MFNE struc +MfneRoot PRS_ROOT <> +MfneWin PRS_WIN <> +MfneLodger PRS_LODGER <> +MfneMfne PRS_MFNE <> +PR_MFNE ends diff --git a/code/SIBOSDK/include/mux.h b/code/SIBOSDK/include/mux.h new file mode 100644 index 0000000..05f5353 --- /dev/null +++ b/code/SIBOSDK/include/mux.h @@ -0,0 +1,159 @@ +/* +MUX.H Defines for the Psion IRDA IRMUX implementation +Written by Jason J Robinson 1st November 1996 +PSION PLC 1995/96 +*/ + +/* Irmux user port defines */ +/* User can choose ports in range 1-126 */ +/* Port zero is always the IAS */ +/* Port number 128 is reserved for ports awaiting connection */ + +#define MaxPortNumber 126 +#define MUX_NOTCONNECTED 128 + +/* Irmux state machine states */ + +#define LM_SNIFF 0 +#define LM_DISCOVER 1 +#define LM_RESOLVEADDR 2 +#define LM_READY 3 +#define LM_READYPEND 4 +#define LM_EXCLUSIVEPEND 5 +#define LM_EXCLUSIVE 6 +#define LM_ROLEEXCHANGE 7 + +/* Client services */ +/* IPC call message numbers */ + +#define LM_Logon 1 +#define LM_Logoff 2 +#define LM_EmergencyLogoff 3 + +/* Irmux connectionless services */ +/* IPC call message numbers */ + +#define LM_CLReadRequest 4 +#define LM_CLWriteRequest 5 +#define LM_DiscoverDevicesRequest 6 +#define LM_SniffRequest 7 +#define LM_WaitForConnection 8 +#define LM_ConnectRequest 9 +#define LM_RegisterPort 10 +#define LM_UnRegisterPort 11 + +/* Irmux connection based services */ +/* IPC call message numbers */ + +#define LM_DisconnectRequest 20 +#define LM_StatusRequest 21 +#define LM_AccessModeRequest 22 +#define LM_IdleRequest 23 +#define LM_ReadRequest 24 +#define LM_WriteRequest 25 +#define LM_UReadRequest 26 +#define LM_UWriteRequest 27 +#define LM_SetHandshakingLevel 28 + +/* IAS services */ +/* Not implemented in current stack versions */ + +#define LM_GetValueByClass 32 +#define LM_GetInfoBaseDetails 33 +#define LM_GetObjects 34 +#define LM_GetValue 35 +#define LM_GetObjectInfo 36 +#define LM_GetAttributeNames 37 + +/* IPC call message numbers */ +/* Constants */ + +#define FirstConnectionBasedFunction LM_DisconnectRequest +#define MaxMessageNumber 38 + +/* IPC call message parameters and modes */ +/* Exclusive mode */ + +#define LM_ExclusiveMode 1 +#define LM_MultiplexMode 0 + +/* Connection mode */ + +#define MUX_PRIMARY 1 +#define MUX_SECONDARY 2 + +/* Mux level frame fromats */ +/* Control frame codes */ + +#define MUX_CONTROL_FRAME 0x80 +#define MUX_DISCONNECT_OPCODE 0x02 +#define MUX_CONNECT_OPCODE 0x01 +#define MUX_CONNECTCONFIRM_OPCODE 0x81 +#define MUX_ACCESS_OPCODE 0x03 +#define MUX_ACCESSCONFIRM_OPCODE 0x83 + +#define MUX_MODE_NOT_EXCLUSIVE 0x00 +#define MUX_MODE_EXCLUSIVE 0x01 + +#define CompleteRequest p_mfree + +/* Function returns */ + +#define OKAY 0 +#define MUX_DISCOVERY_COMPLETE 0 +#define MUX_CACHE_USED 1 + +/* Function error returns */ + +#define E_MUX_USERDISCONNECT -1 +#define E_MUX_LOGOFFDISCONNECT -2 +#define E_MUX_REMOTEDISCONNECT -3 +#define E_MUX_TIMEOUTDISCONNECT -4 +#define E_MUX_EXCLUSIVE -5 +#define E_MUX_BUSY -6 +#define E_MUX_LAP -7 +#define E_MUX_INUSE -8 +#define E_MUX_NOCONNECTION -9 +#define E_MUX_TIMEOUT -10 +#define E_MUX_ABORT -11 +#define E_MUX_LOGON -12 +#define E_GEN_BATIRDA -26 + +/* Irmux disconnect reasons */ +/* Errors returned in disconnect frames */ + +#define MUX_DISCONNECT_USER 0x01 +#define MUX_DISCONNECT_REASON_VAGUE 0x05 +#define MUX_DISCONNECT_NOT_CONNECTED_REASON 0x06 +#define MUX_DISCONNECT_NO_CLIENT 0x08 + +#define AccessModeTimeout 2000 +#define ConnectFrameTimeout 2000 + +#define DisconnectRequestLength 4 +#define ConnectRequestLength 64 +#define MuxConnectInfoLength 60 +#define ExclusiveRequestLength 5 +#define EndExclusiveRequestLength 5 +#define ConnectConfirmLength 64 +#define ExclusiveReplyLength 5 + +#define MuxMaxResetCountMinusOne 4 + +/* IRMUX panic numbers */ + +#define MUX_PANIC_NOTDISCOVERY 180 +#define PANIC_MUX_RESOLVE 181 +#define PANIC_MUX_STATUSINDICATION 182 +#define MUX_PANIC_NOFUNCTION 184 +#define PANIC_MUX_CONNECTCONFIRM 185 +#define PANIC_MUX_DISCONNECTINDICATION 186 +#define PANIC_MUX_DATAINDICATION 187 +#define PANIC_MUX_RESETCONFIRM 188 +#define PANIC_MUX_RESETINDICATION 190 +#define MUX_PANIC_LOSTLAPCONNECTION 191 +#define MUX_PANIC_MEMORY 196 + +#define IASLast 0x80 +#define IASAck 0x40 +#define IASGetValueByClass 0x04 diff --git a/code/SIBOSDK/include/ncedit.g b/code/SIBOSDK/include/ncedit.g new file mode 100644 index 0000000..f2eff60 --- /dev/null +++ b/code/SIBOSDK/include/ncedit.g @@ -0,0 +1,91 @@ +/* Generated by Ctran from ncedit.cl */ +#define NCEDIT_G +#ifndef LODGER_G +#include +#endif +#ifndef MFNE_G +#include +#endif +/* Class Numbers */ +#define C_LNCEDIT 28 +#define C_NCEDIT 29 +#define C_WNCEDIT 30 +/* Method Numbers */ +/* Constants for lncedit */ +#define SE_LNCEDIT_VALUE 0x01 +#define SE_LNCEDIT_LOW 0x02 +#define SE_LNCEDIT_HIGH 0x04 +/* Types for lncedit */ +typedef struct +{ +long int value; +long int low; +long int high; +} IN_LNCEDIT; +typedef struct +{ +long int value; +long int low; +long int high; +unsigned short int flags; +} SE_LNCEDIT; +/* Property of lncedit */ +typedef struct pr_lncedit +{ +PRS_ROOT root; +PRS_WIN win; +PRS_LODGER lodger; +PRS_MFNE mfne; +} PR_LNCEDIT; +/* Constants for ncedit */ +#define SE_NCEDIT_VALUE 0x01 +#define SE_NCEDIT_LOW 0x02 +#define SE_NCEDIT_HIGH 0x04 +/* Types for ncedit */ +typedef struct +{ +unsigned short int value; +unsigned short int low; +unsigned short int high; +} IN_NCEDIT; +typedef struct +{ +unsigned short int value; +unsigned short int low; +unsigned short int high; +unsigned short int flags; +} SE_NCEDIT; +/* Property of ncedit */ +typedef struct pr_ncedit +{ +PRS_ROOT root; +PRS_WIN win; +PRS_LODGER lodger; +PRS_MFNE mfne; +} PR_NCEDIT; +/* Constants for wncedit */ +#define SE_WNCEDIT_VALUE 0x01 +#define SE_WNCEDIT_LOW 0x02 +#define SE_WNCEDIT_HIGH 0x04 +/* Types for wncedit */ +typedef struct +{ +short int value; +short int low; +short int high; +} IN_WNCEDIT; +typedef struct +{ +short int value; +short int low; +short int high; +short int flags; +} SE_WNCEDIT; +/* Property of wncedit */ +typedef struct pr_wncedit +{ +PRS_ROOT root; +PRS_WIN win; +PRS_LODGER lodger; +PRS_MFNE mfne; +} PR_WNCEDIT; diff --git a/code/SIBOSDK/include/ncedit.ing b/code/SIBOSDK/include/ncedit.ing new file mode 100644 index 0000000..2997cb8 --- /dev/null +++ b/code/SIBOSDK/include/ncedit.ing @@ -0,0 +1,82 @@ +; Generated by Ctran from ncedit.cl +NCEDIT_ING equ 1 +IFNDEF LODGER_ING + INCLUDE ..\inc\LODGER.ING +ENDIF +IFNDEF MFNE_ING + INCLUDE ..\inc\MFNE.ING +ENDIF +; Class Numbers +C_LNCEDIT equ 28 +C_NCEDIT equ 29 +C_WNCEDIT equ 30 +; Method Numbers +; Constants for lncedit +SE_LNCEDIT_VALUE equ (001h) +SE_LNCEDIT_LOW equ (002h) +SE_LNCEDIT_HIGH equ (004h) +; Types for lncedit +IN_LNCEDIT struc +IN_LNCEDITValue dd ? +IN_LNCEDITLow dd ? +IN_LNCEDITHigh dd ? +IN_LNCEDIT ends +SE_LNCEDIT struc +SE_LNCEDITValue dd ? +SE_LNCEDITLow dd ? +SE_LNCEDITHigh dd ? +SE_LNCEDITFlags dw ? +SE_LNCEDIT ends +; Property of lncedit +PR_LNCEDIT struc +LnceditRoot PRS_ROOT <> +LnceditWin PRS_WIN <> +LnceditLodger PRS_LODGER <> +LnceditMfne PRS_MFNE <> +PR_LNCEDIT ends +; Constants for ncedit +SE_NCEDIT_VALUE equ (001h) +SE_NCEDIT_LOW equ (002h) +SE_NCEDIT_HIGH equ (004h) +; Types for ncedit +IN_NCEDIT struc +IN_NCEDITValue dw ? +IN_NCEDITLow dw ? +IN_NCEDITHigh dw ? +IN_NCEDIT ends +SE_NCEDIT struc +SE_NCEDITValue dw ? +SE_NCEDITLow dw ? +SE_NCEDITHigh dw ? +SE_NCEDITFlags dw ? +SE_NCEDIT ends +; Property of ncedit +PR_NCEDIT struc +NceditRoot PRS_ROOT <> +NceditWin PRS_WIN <> +NceditLodger PRS_LODGER <> +NceditMfne PRS_MFNE <> +PR_NCEDIT ends +; Constants for wncedit +SE_WNCEDIT_VALUE equ (001h) +SE_WNCEDIT_LOW equ (002h) +SE_WNCEDIT_HIGH equ (004h) +; Types for wncedit +IN_WNCEDIT struc +IN_WNCEDITValue dw ? +IN_WNCEDITLow dw ? +IN_WNCEDITHigh dw ? +IN_WNCEDIT ends +SE_WNCEDIT struc +SE_WNCEDITValue dw ? +SE_WNCEDITLow dw ? +SE_WNCEDITHigh dw ? +SE_WNCEDITFlags dw ? +SE_WNCEDIT ends +; Property of wncedit +PR_WNCEDIT struc +WnceditRoot PRS_ROOT <> +WnceditWin PRS_WIN <> +WnceditLodger PRS_LODGER <> +WnceditMfne PRS_MFNE <> +PR_WNCEDIT ends diff --git a/code/SIBOSDK/include/nchlist.g b/code/SIBOSDK/include/nchlist.g new file mode 100644 index 0000000..a1375c6 --- /dev/null +++ b/code/SIBOSDK/include/nchlist.g @@ -0,0 +1,28 @@ +/* Generated by Ctran from nchlist.cl */ +#define NCHLIST_G +#ifndef CHLIST_G +#include +#endif +/* Class Numbers */ +#define C_VANUMBER 78 +#define C_NCHLIST 79 +/* Method Numbers */ +#define O_VAN_SET_MAX 24 +/* Property of vanumber */ +typedef struct { +char data[8]; +} PRS_VANUMBER; +typedef struct pr_vanumber +{ +PRS_ROOT root; +PRS_VAROOT varoot; +PRS_VANUMBER vanumber; +} PR_VANUMBER; +/* Property of nchlist */ +typedef struct pr_nchlist +{ +PRS_ROOT root; +PRS_WIN win; +PRS_LODGER lodger; +PRS_CHLIST chlist; +} PR_NCHLIST; diff --git a/code/SIBOSDK/include/nchlist.ing b/code/SIBOSDK/include/nchlist.ing new file mode 100644 index 0000000..27009a2 --- /dev/null +++ b/code/SIBOSDK/include/nchlist.ing @@ -0,0 +1,26 @@ +; Generated by Ctran from nchlist.cl +NCHLIST_ING equ 1 +IFNDEF CHLIST_ING + INCLUDE ..\inc\CHLIST.ING +ENDIF +; Class Numbers +C_VANUMBER equ 78 +C_NCHLIST equ 79 +; Method Numbers +O_VAN_SET_MAX equ 24 +; Property of vanumber +PRS_VANUMBER struc +VanumberData db (1) * 8 dup (?) +PRS_VANUMBER ends +PR_VANUMBER struc +VanumberRoot PRS_ROOT <> +VanumberVaroot PRS_VAROOT <> +VanumberVanumber PRS_VANUMBER <> +PR_VANUMBER ends +; Property of nchlist +PR_NCHLIST struc +NchlistRoot PRS_ROOT <> +NchlistWin PRS_WIN <> +NchlistLodger PRS_LODGER <> +NchlistChlist PRS_CHLIST <> +PR_NCHLIST ends diff --git a/code/SIBOSDK/include/new.hpp b/code/SIBOSDK/include/new.hpp new file mode 100644 index 0000000..3fef8d0 --- /dev/null +++ b/code/SIBOSDK/include/new.hpp @@ -0,0 +1,21 @@ +/* Release 3.10 */ +/*-------------------------------------------------------------------------* +* * +* NEW.H - header file for C++ memory allocation operators. * +* * +* COPYRIGHT (C) 1990..1992 Clarion Software Corporation * +* All Rights Reserved * +* * +*--------------------------------------------------------------------------*/ +#include + +#ifndef _NEW_INC_ +#define _NEW_INC_ + +#include + +extern void (* set_new_handler(void(*)()))(); + +void * operator new(size_t _size, void *_place); + +#endif diff --git a/code/SIBOSDK/include/nosend.h b/code/SIBOSDK/include/nosend.h new file mode 100644 index 0000000..59cc7d8 --- /dev/null +++ b/code/SIBOSDK/include/nosend.h @@ -0,0 +1,8 @@ +#define p_send() THIS_WILL_NOT_COMPILE +#define p_supersend() THIS_WILL_NOT_COMPILE +#define p_entersend() THIS_WILL_NOT_COMPILE +#define f_send() THIS_WILL_NOT_COMPILE +#define p_enter() THIS_WILL_NOT_COMPILE +#define p_ioa() THIS_WILL_NOT_COMPILE +#define p_iow() THIS_WILL_NOT_COMPILE +#define p_ioc() THIS_WILL_NOT_COMPILE diff --git a/code/SIBOSDK/include/nosend.inc b/code/SIBOSDK/include/nosend.inc new file mode 100644 index 0000000..d3f5a12 --- /dev/null +++ b/code/SIBOSDK/include/nosend.inc @@ -0,0 +1 @@ + diff --git a/code/SIBOSDK/include/olib.ext b/code/SIBOSDK/include/olib.ext new file mode 100644 index 0000000..0d75de0 --- /dev/null +++ b/code/SIBOSDK/include/olib.ext @@ -0,0 +1,481 @@ +Generated by Ctran from olib.cat +LIBRARY olib +CLASS root +{ +DECLARE destroy +HAS_METHOD +HAS_PROPERTY +} +CLASS varoot root +{ +DECLARE va_count +DECLARE va_delete +DECLARE va_sort +DECLARE va_key +DECLARE va_findisq +DECLARE va_insertisq +DECLARE va_append +DECLARE va_insert +DECLARE va_search +DECLARE va_compare +DECLARE va_reset +DECLARE va_test +DECLARE va_replace +DECLARE va_copy +DECLARE va_reclen +DECLARE va_swap +DECLARE va_init +DECLARE va_deletem +DECLARE va_insertm +DECLARE va_prec +DECLARE va_pbuf +DECLARE va_capacity +DECLARE va_compress +HAS_METHOD +HAS_PROPERTY +} +CLASS vafix varoot +{ +HAS_METHOD +HAS_PROPERTY +} +CLASS vaflat vafix +{ +HAS_METHOD +HAS_PROPERTY +} +CLASS sgbuf root +{ +DECLARE sb_init +DECLARE sb_point +DECLARE sb_insert +DECLARE sb_delete +DECLARE sb_extract +DECLARE sb_compress +DECLARE sb_count +DECLARE sb_backpoint +DECLARE sb_allocseg +HAS_METHOD +HAS_PROPERTY +} +CLASS vaseg vafix +{ +HAS_METHOD +HAS_PROPERTY +} +CLASS vastr varoot +{ +HAS_METHOD +HAS_PROPERTY +} +CLASS vaxvar vaflat +{ +HAS_METHOD +} +CLASS vaxvars vaseg +{ +HAS_METHOD +} +CLASS cleanup vaflat +{ +DECLARE cl_init +DECLARE cl_add +DECLARE cl_remove +DECLARE cl_clean_item +DECLARE cl_clean_level +DECLARE cl_set_level +HAS_METHOD +HAS_PROPERTY +} +CLASS active root +{ +DECLARE ao_init +DECLARE ao_cancel +DECLARE ao_abrun +DECLARE ao_queue +DECLARE ao_run +HAS_METHOD +HAS_PROPERTY +} +CLASS aidle active +{ +HAS_METHOD +} +CLASS rscfile root +{ +DECLARE rs_init +DECLARE rs_read +DECLARE rs_read_buf +HAS_METHOD +HAS_PROPERTY +} +CLASS system root +{ +DECLARE sy_init +DECLARE sy_icon_pos +DECLARE sy_link_server +DECLARE sy_link_paste +DECLARE sy_exec_open +HAS_METHOD +HAS_PROPERTY +} +CLASS ipcs active +{ +DECLARE ip_add_server +HAS_METHOD +HAS_PROPERTY +} +CLASS appman root +{ +DECLARE am_init +DECLARE am_start +DECLARE am_stop +DECLARE am_add_task +DECLARE am_wait +DECLARE am_load_resource +DECLARE am_load_res_buf +DECLARE am_rscname +DECLARE am_notify +DECLARE am_notifyerr +DECLARE am_clean_up +DECLARE am_onlyone +DECLARE am_findimg +DECLARE am_change_pri +HAS_METHOD +HAS_PROPERTY +} +CLASS server root +{ +DECLARE sv_abrun +DECLARE sv_init +DECLARE sv_run +HAS_METHOD +HAS_PROPERTY +} +CLASS linksv server +{ +DECLARE ls_set_format +DECLARE ls_get_data +HAS_METHOD +HAS_PROPERTY +} +CLASS linkcl root +{ +DECLARE lc_start +DECLARE lc_get_data +DECLARE lc_stop +HAS_METHOD +HAS_PROPERTY +} +CLASS toplip server +{ +DECLARE tip_start +DECLARE tip_getline +DECLARE tip_complete +HAS_METHOD +HAS_PROPERTY +} +CLASS exopl active +{ +HAS_METHOD +HAS_PROPERTY +} +CLASS cmap root +{ +DECLARE cm_init +DECLARE cm_insert +DECLARE cm_rect +DECLARE cm_enq_draw +DECLARE cm_sense_cpos +DECLARE cm_set_cpos +DECLARE cm_sense_size +DECLARE cm_point_row +DECLARE cm_autowrap +DECLARE cm_scrollock +DECLARE cm_scroll +DECLARE cm_attrib +HAS_METHOD +HAS_PROPERTY +} +CLASS voice active +{ +HAS_METHOD +HAS_PROPERTY +} +CLASS notify ipcs +{ +DECLARE no_draw +HAS_METHOD +HAS_PROPERTY +} +CLASS consol server +{ +DECLARE co_key +DECLARE co_extra +DECLARE co_draw +DECLARE co_cursor +DECLARE co_size +DECLARE co_esc +DECLARE co_edit +HAS_METHOD +HAS_PROPERTY +} +CLASS factive active +{ +DECLARE fa_close +HAS_METHOD +HAS_PROPERTY +} +CLASS fscan factive +{ +DECLARE fs_matchname +DECLARE fs_fscan +DECLARE fs_fscan_end +DECLARE fs_dirname +DECLARE fs_filename +DECLARE fs_end_dirlist +HAS_METHOD +HAS_PROPERTY +} +CLASS fnode factive +{ +DECLARE fn_list +DECLARE fn_end_list +DECLARE fn_nodename +HAS_METHOD +HAS_PROPERTY +} +CLASS pnode fnode +{ +HAS_METHOD +} +CLASS pselvar vaxvar +{ +HAS_METHOD +} +CLASS psel fscan +{ +DECLARE ps_get_file +DECLARE ps_ascend_path +DECLARE ps_descend_path +DECLARE ps_set_path +DECLARE ps_sense_filename +DECLARE ps_select_direntry +DECLARE ps_drives +DECLARE ps_settag +DECLARE ps_gettag +DECLARE ps_order +DECLARE ps_new_list +HAS_METHOD +HAS_PROPERTY +} +CLASS fcasy factive +{ +DECLARE fc_write +DECLARE fc_open +DECLARE fc_request_comp +HAS_METHOD +HAS_PROPERTY +} +CLASS fcsync fcasy +{ +HAS_METHOD +} +CLASS fmmk factive +{ +HAS_METHOD +} +CLASS fmsrc fcasy +{ +HAS_METHOD +} +CLASS fmtarg fcasy +{ +HAS_METHOD +} +CLASS fmfmt factive +{ +HAS_METHOD +HAS_PROPERTY +} +CLASS fmscan fscan +{ +HAS_METHOD +} +CLASS fman root +{ +DECLARE fman_init +DECLARE fman_cancel +DECLARE fman_copy +DECLARE fman_delete +DECLARE fman_rename +DECLARE fman_make +DECLARE fman_remove +DECLARE fman_copydev +DECLARE fman_format +DECLARE fman_name +DECLARE fman_info +DECLARE fman_attrib +DECLARE fman_complete +DECLARE fman_newname +DECLARE fman_update +DECLARE fman_fileexist +DECLARE fman_error +HAS_METHOD +HAS_PROPERTY +} +CLASS locs root +{ +DECLARE ls_matchname +DECLARE ls_scan +DECLARE ls_filename +HAS_METHOD +HAS_PROPERTY +} +CLASS time root +{ +DECLARE to_set +DECLARE to_sense +DECLARE to_add_years +DECLARE to_add_months +DECLARE to_add_days +DECLARE to_add_secs +DECLARE to_set_format +DECLARE to_sense_format +DECLARE to_get_sysdat +HAS_METHOD +HAS_PROPERTY +} +CLASS timer active +{ +DECLARE tm_qabsolute +HAS_METHOD +} +CLASS buzsnd timer +{ +HAS_METHOD +HAS_PROPERTY +} +CLASS alarr vaxvar +{ +DECLARE va_confirm +DECLARE va_cancel +HAS_METHOD +HAS_PROPERTY +} +CLASS animator timer +{ +HAS_METHOD +HAS_PROPERTY +} +CLASS bfile root +{ +DECLARE fi_close +DECLARE fi_read +DECLARE fl_set_buf_len +DECLARE fl_sense_data +DECLARE fi_open +DECLARE fl_rewind +HAS_METHOD +HAS_PROPERTY +} +CLASS tlvfile bfile +{ +DECLARE fl_write_rec +DECLARE fl_delrec +DECLARE fl_count +DECLARE fl_read_by_type +DECLARE fl_set_rec +DECLARE fl_sense_rec +DECLARE fl_replace +HAS_METHOD +HAS_PROPERTY +} +CLASS tlvdata root +{ +DECLARE td_open +DECLARE td_save +DECLARE td_changed +DECLARE td_load_item +DECLARE td_save_item +DECLARE td_reset +DECLARE td_set_file +DECLARE td_set_item +DECLARE td_sense_item +HAS_METHOD +HAS_PROPERTY +} +CLASS serfile tlvdata +{ +HAS_METHOD +HAS_PROPERTY +} +CLASS print active +{ +DECLARE pr_get_data +HAS_METHOD +HAS_PROPERTY +} +CLASS serial active +{ +DECLARE sr_write +DECLARE sr_test +DECLARE sr_set +DECLARE sr_sense +DECLARE sr_flush +DECLARE sr_control +DECLARE sr_enquire +DECLARE sr_grab +HAS_METHOD +HAS_PROPERTY +} +CLASS eproot root +{ +DECLARE ep_set_text +DECLARE ep_scan_word +DECLARE ep_word_count +DECLARE ep_scan_para +DECLARE ep_para_count +DECLARE ep_scan_block +DECLARE ep_add_para +DECLARE ep_copy_indent +DECLARE ep_copy_to_front +DECLARE ep_copy_to_back +DECLARE ep_paste +DECLARE ep_mod_chars +DECLARE ep_sense_text +DECLARE ep_capacity +DECLARE ep_compress +DECLARE ep_init +DECLARE ep_sense_len +DECLARE ep_sense_chars +DECLARE ep_back_chars +DECLARE ep_insert +DECLARE ep_delete +DECLARE ep_extract +DECLARE ep_clear +HAS_METHOD +HAS_PROPERTY +} +CLASS epflat eproot +{ +DECLARE ef_granularity +DECLARE ef_sense_buf +HAS_METHOD +HAS_PROPERTY +} +CLASS epseg eproot +{ +HAS_METHOD +HAS_PROPERTY +} +CLASS vtab vaflat +{ +DECLARE vt_gaptonext +DECLARE vt_set_colwid +DECLARE vt_setintv +DECLARE vt_set +DECLARE vt_strip +HAS_METHOD +HAS_PROPERTY +} diff --git a/code/SIBOSDK/include/olib.g b/code/SIBOSDK/include/olib.g new file mode 100644 index 0000000..9add02a --- /dev/null +++ b/code/SIBOSDK/include/olib.g @@ -0,0 +1,23 @@ +/* Generated by Ctran from olib.cat */ +#define OLIB_G +#ifndef P_STD_H +#include +#endif +#ifndef P_OBJECT_H +#include +#endif +/* Category Numbers */ +/* EPOC */ +#define CAT_OLIB_OLIB 0 +/* Class Numbers */ +#define C_ROOT 0 +/* Method Numbers */ +#define O_DESTROY 0 +/* Property of root */ +typedef struct { +P_OBJECT pc; +} PRS_ROOT; +typedef struct pr_root +{ +PRS_ROOT root; +} PR_ROOT; diff --git a/code/SIBOSDK/include/olib.h b/code/SIBOSDK/include/olib.h new file mode 100644 index 0000000..fd6c0c9 --- /dev/null +++ b/code/SIBOSDK/include/olib.h @@ -0,0 +1,17 @@ +/* HEADER - OLIB.H +OLIB standard header +Copyright (c) Psion PLC 1991 - 1996. +*/ +#ifndef OLIB_H +#define OLIB_H + +GLREF_C INT cl_add(INT,VOID *); +GLREF_C INT cl_add_alloc(VOID *); +GLREF_C INT cl_add_iochan(VOID *); +GLREF_C INT cl_add_object(VOID *); +GLREF_C INT cl_add_shared(VOID *); +GLREF_C INT cl_add_dyl(HANDLE); +GLREF_C VOID cl_clean_item(INT); +GLREF_C VOID cl_remove(INT); + +#endif // OLIB_H diff --git a/code/SIBOSDK/include/olib.ing b/code/SIBOSDK/include/olib.ing new file mode 100644 index 0000000..e58e6be --- /dev/null +++ b/code/SIBOSDK/include/olib.ing @@ -0,0 +1,21 @@ +; Generated by Ctran from olib.cat +OLIB_ING equ 1 +IFNDEF P_STD_INC + INCLUDE ..\inc\P_STD.INC +ENDIF +IFNDEF P_OBJECT_INC + INCLUDE ..\inc\P_OBJECT.INC +ENDIF +; Category Numbers +CAT_OLIB_OLIB equ 0 +; Class Numbers +C_ROOT equ 0 +; Method Numbers +O_DESTROY equ 0 +; Property of root +PRS_ROOT struc +RootPc P_OBJECT <> +PRS_ROOT ends +PR_ROOT struc +RootRoot PRS_ROOT <> +PR_ROOT ends diff --git a/code/SIBOSDK/include/olib.lis b/code/SIBOSDK/include/olib.lis new file mode 100644 index 0000000..c635b42 --- /dev/null +++ b/code/SIBOSDK/include/olib.lis @@ -0,0 +1,171 @@ +Generated by Ctran from olib.cat + +LIBRARY olib + +********** olib ********** +root + +********** varray ********** +varoot + Derived from root + Subclassed by vastr,vafix +vafix + Derived from varoot,root + Subclassed by vaseg,vaflat +vaflat + Derived from vafix,varoot,root + Subclassed by vaxvar,vtab,cleanup +sgbuf + Derived from root + Referenced by vaseg,epseg +vaseg + Derived from vafix,varoot,root + References sgbuf + Subclassed by vaxvars +vastr + Derived from varoot,root + Referenced by psel +vaxvar + Derived from vaflat,vafix,varoot,root + Subclassed by alarr,pselvar +vaxvars + Derived from vaseg,vafix,varoot,root + +********** appman ********** +cleanup + Derived from vaflat,vafix,varoot,root + Referenced by appman +active + Derived from root + Subclassed by print,aidle,ipcs,timer,exopl,factive,voice,serial +aidle + Derived from active,root +rscfile + Derived from root + Referenced by appman +system + Derived from root + Referenced by appman +ipcs + Derived from active,root + Subclassed by notify + Referenced by appman +appman + Derived from root + References cleanup,system,rscfile,rscfile,ipcs + +********** ipc ********** +server + Derived from root + Subclassed by consol,toplip,linksv +linksv + Derived from server,root +linkcl + Derived from root +toplip + Derived from server,root +exopl + Derived from active,root +cmap + Derived from root + Referenced by consol +voice + Derived from active,root + References root +notify + Derived from ipcs,active,root +consol + Derived from server,root + References cmap + +********** factive ********** +factive + Derived from active,root + Subclassed by fcasy,fmfmt,fscan,fmmk,fnode +fscan + Derived from factive,active,root + Subclassed by fmscan,psel +fnode + Derived from factive,active,root + Subclassed by pnode +pnode + Derived from fnode,factive,active,root + Referenced by psel +pselvar + Derived from vaxvar,vaflat,vafix,varoot,root + Referenced by psel +psel + Derived from fscan,factive,active,root + References pselvar,vastr,pnode +fcasy + Derived from factive,active,root + Subclassed by fmsrc,fmtarg,fcsync +fcsync + Derived from fcasy,factive,active,root +fmmk + Derived from factive,active,root + Referenced by fman +fmsrc + Derived from fcasy,factive,active,root + Referenced by fman +fmtarg + Derived from fcasy,factive,active,root + Referenced by fman +fmfmt + Derived from factive,active,root + Referenced by fman +fmscan + Derived from fscan,factive,active,root + Referenced by fman +fman + Derived from root + References fmsrc,fmtarg,fmscan,fmmk,fmfmt +locs + Derived from root + +********** time ********** +time + Derived from root + +********** timer ********** +timer + Derived from active,root + Subclassed by animator,buzsnd +buzsnd + Derived from timer,active,root + References root +alarr + Derived from vaxvar,vaflat,vafix,varoot,root +animator + Derived from timer,active,root + References root + +********** tlvfile ********** +bfile + Derived from root + Subclassed by tlvfile +tlvfile + Derived from bfile,root + Referenced by tlvdata +tlvdata + Derived from root + References tlvfile + Subclassed by serfile +serfile + Derived from tlvdata,root +print + Derived from active,root +serial + Derived from active,root + +********** edit ********** +eproot + Derived from root + Subclassed by epseg,epflat +epflat + Derived from eproot,root +epseg + Derived from eproot,root + References sgbuf +vtab + Derived from vaflat,vafix,varoot,root diff --git a/code/SIBOSDK/include/oprinter.g b/code/SIBOSDK/include/oprinter.g new file mode 100644 index 0000000..2471948 --- /dev/null +++ b/code/SIBOSDK/include/oprinter.g @@ -0,0 +1,44 @@ +/* Generated by Ctran from oprinter.cl */ +#define OPRINTER_G +#ifndef XPRINTER_G +#include +#endif +#ifndef HELP_G +#include +#endif +/* Class Numbers */ +#define C_OPRINTER 15 +#define C_OHELPDLG 16 +/* Method Numbers */ +#define O_LPR_PRINT_COMMAND 5 +/* Types for oprinter */ +typedef struct +{ +short int style; +unsigned short int blen; +char *buf; +} OPRINT_REC; +/* Property of oprinter */ +typedef struct { +unsigned short int nrecs; +OPRINT_REC *first; +unsigned short int index; +OPRINT_REC *current; +short int comman_changed; +void *old_comman; +} PRS_OPRINTER; +typedef struct pr_oprinter +{ +PRS_ROOT root; +PRS_LPRINTER lprinter; +PRS_XPRINTER xprinter; +PRS_OPRINTER oprinter; +} PR_OPRINTER; +/* Property of ohelpdlg */ +typedef struct pr_ohelpdlg +{ +PRS_ROOT root; +PRS_WIN win; +PRS_DLGCHAIN dlgchain; +PRS_HELPDLG helpdlg; +} PR_OHELPDLG; diff --git a/code/SIBOSDK/include/oprinter.ing b/code/SIBOSDK/include/oprinter.ing new file mode 100644 index 0000000..c7445ef --- /dev/null +++ b/code/SIBOSDK/include/oprinter.ing @@ -0,0 +1,41 @@ +; Generated by Ctran from oprinter.cl +OPRINTER_ING equ 1 +IFNDEF XPRINTER_ING + INCLUDE ..\inc\XPRINTER.ING +ENDIF +IFNDEF HELP_ING + INCLUDE ..\inc\HELP.ING +ENDIF +; Class Numbers +C_OPRINTER equ 15 +C_OHELPDLG equ 16 +; Method Numbers +O_LPR_PRINT_COMMAND equ 5 +; Types for oprinter +OPRINT_REC struc +OPRINT_RECStyle dw ? +OPRINT_RECBlen dw ? +OPRINT_RECBuf dw ? +OPRINT_REC ends +; Property of oprinter +PRS_OPRINTER struc +OprinterNrecs dw ? +OprinterFirst dw ? +OprinterIndex dw ? +OprinterCurrent dw ? +OprinterComman_changed dw ? +OprinterOld_comman dw ? +PRS_OPRINTER ends +PR_OPRINTER struc +OprinterRoot PRS_ROOT <> +OprinterLprinter PRS_LPRINTER <> +OprinterXprinter PRS_XPRINTER <> +OprinterOprinter PRS_OPRINTER <> +PR_OPRINTER ends +; Property of ohelpdlg +PR_OHELPDLG struc +OhelpdlgRoot PRS_ROOT <> +OhelpdlgWin PRS_WIN <> +OhelpdlgDlgchain PRS_DLGCHAIN <> +OhelpdlgHelpdlg PRS_HELPDLG <> +PR_OHELPDLG ends diff --git a/code/SIBOSDK/include/p_8086.h b/code/SIBOSDK/include/p_8086.h new file mode 100644 index 0000000..8abd69d --- /dev/null +++ b/code/SIBOSDK/include/p_8086.h @@ -0,0 +1,53 @@ +/* HEADER - P_8086.H +Copyright (C) Psion PLC 1991-92 + VER DATE BY DESCRIPTION +===== ======== === =========== +1.00F 26/04/90 NSM First relase +1.10F 07/07/92 NSM Second release +1.11F 31/08/23 AB #ifndef fix +*/ +#ifndef P_8086_H +#define P_8086_H + +#include + +#define AX x.ax +#define BX x.bx +#define CX x.cx +#define DX x.dx +#define SI x.si +#define DI x.di +#define ES x.es +#define DS x.ds +#define AL h.al +#define AH h.ah +#define BL h.bl +#define BH h.bh +#define CL h.cl +#define CH h.ch +#define DL h.dl +#define DH h.dh +#define CF 0x0001 +#define PF 0x0004 +#define AF 0x0010 +#define ZF 0x0040 +#define SF 0x0080 +#define TF 0x0100 +#define IF 0x0200 +#define DF 0x0400 +#define OF 0x0800 +typedef struct +{ +short int ax,bx,cx,dx,si,di,es,ds; +} XREG; +typedef struct +{ +char al,ah,bl,bh,cl,ch,dl,dh; +} HREG; +typedef union +{ +XREG x; +HREG h; +} REGS; + +#endif // P_8086_H diff --git a/code/SIBOSDK/include/p_assert.h b/code/SIBOSDK/include/p_assert.h new file mode 100644 index 0000000..4e48d55 --- /dev/null +++ b/code/SIBOSDK/include/p_assert.h @@ -0,0 +1,27 @@ +/* HEADER - P_ASSERT.H +Copyright (C) Psion PLC 1991-92 + VER DATE BY DESCRIPTION +===== ======== === =========== +1.00F 26/04/90 NSM First relase +1.10F 07/07/92 NSM Second release +1.11F 31/08/23 AB #ifndef fix +*/ +#ifndef P_ASSERT_H +#define P_ASSERT_H + +#include + +#ifdef ASSERTIONS +#ifdef __cplusplus +extern "C" { +#endif +extern void p_assert(char *pAssert,char *pFile,int lineNo); +#ifdef __cplusplus +} +#endif +#define __ASSERT(p) ((p) ? ((void)0) : p_assert(#p,__FILE__,__LINE__)) +#else +#define __ASSERT(ignore) ((void)0) +#endif + +#endif // P_ASSERT_H diff --git a/code/SIBOSDK/include/p_config.h b/code/SIBOSDK/include/p_config.h new file mode 100644 index 0000000..dc6f700 --- /dev/null +++ b/code/SIBOSDK/include/p_config.h @@ -0,0 +1,92 @@ +/* HEADER - P_CONFIG.H +Copyright (C) Psion PLC 1991-92 + VER DATE BY DESCRIPTION +===== ======== === =========== +1.00F 26/04/90 NSM First relase +1.10F 07/07/92 NSM Second release +1.11F 31/08/23 AB #ifndef fix +*/ +#ifndef P_CONFIG_H +#define P_CONFIG_H + +#include + +#define E_DATE_USA 0 /* MM/DD/YY */ +#define E_DATE_EUROPE 1 /* DD/MM/YY */ +#define E_DATE_JAPAN 2 /* YY/MM/DD */ +#define E_CURRENCY_BEFORE 0 +#define E_CURRENCY_AFTER 1 +#define E_NOSPACE_BETWEEN 1 +#define E_SPACE_BETWEEN 0 +#define E_TIME_12 0 +#define E_TIME_24 1 +#define E_ANALOGUE_CLOCK 0 +#define E_DIGITAL_CLOCK 1 +#define E_DST_HOME 1 +#define E_DST_EUROPEAN 2 +#define E_DST_NORTHERN 4 +#define E_DST_SOUTHERN 8 +#define E_IMPERIAL 0 +#define E_METRIC 1 +#define P_LANGUAGE_TST 0 /* Test language */ +#define P_LANGUAGE_ENG 1 /* English */ +#define P_LANGUAGE_FRN 2 /* French */ +#define P_LANGUAGE_GRM 3 /* German */ +#define P_LANGUAGE_SPA 4 /* Spanish */ +#define P_LANGUAGE_ITA 5 /* Italian */ +#define P_LANGUAGE_SWE 6 /* Swedish */ +#define P_LANGUAGE_DAN 7 /* Danish */ +#define P_LANGUAGE_NOR 8 /* Norwegian */ +#define P_LANGUAGE_FIN 9 /* Finnish */ +#define P_LANGUAGE_USA 10 /* American */ +#define P_LANGUAGE_SWF 11 /* Swiss french */ +#define P_LANGUAGE_SWG 12 /* Swiss german */ +#define P_LANGUAGE_POR 13 /* Portuguese */ +#define P_LANGUAGE_TUR 14 /* Turkish */ +#define P_LANGUAGE_ICE 15 /* Icelandic */ +#define P_LANGUAGE_RUS 16 /* Russian */ +#define P_LANGUAGE_HUN 17 /* Hungarian */ +#define P_LANGUAGE_DUT 18 /* Dutch */ +#define P_LANGUAGE_FLE 19 /* Belgian Flemish */ +#define P_LANGUAGE_OZZ 20 /* Australian */ +#define P_LANGUAGE_NZL 21 /* New Zealand */ +#define P_LANGUAGE_OST 22 /* Austrian */ +#define P_LANGUAGE_BEF 23 /* Belgian french */ +#define P_MAX_LANGUAGES 24 +typedef struct +{ +unsigned short int countryCode; +short int gmtOffset; /* In minutes */ +unsigned char dateType; +unsigned char timeType; +unsigned char currencySymbolPosition; +unsigned char currencySpaceRequired; +unsigned char currencyDecimalPlaces; +unsigned char currencyNegativeInBrackets; +unsigned char currencyTriadsAllowed; +unsigned char thousandsSeparator; +unsigned char decimalSeparator; +unsigned char dateSeparator; +unsigned char timeSeparator; +unsigned char currencySymbol[9]; +unsigned char startOfWeek; +unsigned char summerTime; +unsigned char clockType; +unsigned char dayAbbreviation; +unsigned char monthAbbreviation; +unsigned char workDays; +unsigned char units; +unsigned char spare[9]; +} E_CONFIG; +#pragma save,call(reg_param =>(bx),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +#ifdef __cplusplus +extern "C" { +#endif +extern void p_setctd(const E_CONFIG *); +extern void p_getctd(E_CONFIG *); +#pragma restore +#ifdef __cplusplus +} +#endif + +#endif // P_CONFIG_H diff --git a/code/SIBOSDK/include/p_cons.h b/code/SIBOSDK/include/p_cons.h new file mode 100644 index 0000000..992b196 --- /dev/null +++ b/code/SIBOSDK/include/p_cons.h @@ -0,0 +1,99 @@ +/* HEADER - P_CONS.H +Copyright (C) Psion PLC 1991-92 + VER DATE BY DESCRIPTION +===== ======== === =========== +1.00F 26/04/90 NSM First relase +1.10F 07/07/92 NSM Second release +1.11F 31/08/23 AB #ifndef fix +*/ +#ifndef P_CONS_H +#define P_CONS_H + +#include + +#ifndef P_GRAF_H +#include +#endif +typedef struct +{ +unsigned int window_handle; +unsigned int font_handle; +unsigned int line_height; +unsigned int char_width; +} CONSOLE_INFO; +typedef struct +{ +unsigned short int code; +unsigned char modifier_mask; +unsigned char dont_care_mask; +} CONSOLE_CAPTURE_KEY; +typedef struct +{ +unsigned short int id; +unsigned short int style; +} P_SCR_SET_FONT; +typedef struct +{ +P_EXTENT extent; +P_SCR_SET_FONT font; +} P_SCR_SET_FONT_EXT; +#ifndef _P_CON_KBREC +#define _P_CON_KBREC +typedef struct +{ +unsigned short int keycode; +unsigned char modifiers; +unsigned char count; +} P_CON_KBREC; +#endif +#define P_MAXEDITSTR 256 +#ifndef _P_CEDIT +#define _P_CEDIT +typedef struct +{ +unsigned char cursorpos; +unsigned char trap; +unsigned char string[P_MAXEDITSTR]; +} P_CEDIT; +#endif +#define CONS_SPECIAL_EVENT 0x4 +#define CONS_EVENT_FOREGROUND ((CONS_SPECIAL_EVENT*256)+1) +#define CONS_EVENT_BACKGROUND ((CONS_SPECIAL_EVENT*256)+2) +#define CONS_EVENT_ON_OFF ((CONS_SPECIAL_EVENT*256)+3) +#define CONS_EVENT_COMMAND ((CONS_SPECIAL_EVENT*256)+4) +#define CONS_EVENT_DATE_CHANGED ((CONS_SPECIAL_EVENT*256)+5) +#define CONS_EVENT_OTHER ((CONS_SPECIAL_EVENT*256)+255) +#define P_SCR_NORMAL 0 +#define P_SCR_BOLD 0x01 +#define P_SCR_REVERSE 0x02 +#define P_SCR_UNDLINE 0x04 +#define P_SCR_BLINK 0x08 +#define P_SCR_ITALIC 0x10 +#define P_SCR_ATTRB 0 +#define P_SCR_SCROLL 1 +#define P_SCR_CLR 2 +#define P_SCR_POSA 3 +#define P_SCR_POSR 4 +#define P_SCR_WSET 5 +#define P_SCR_SLOCK 6 +#define P_SCR_WLOCK 7 +#define P_SCR_NEL 8 +#define P_SCR_CURSOR 9 +#define P_SCR_ESCAPE 10 +#define P_SCR_FLUSH 11 +#define P_SCR_CSET 12 +#define P_SCR_CAPTURE_KEY 13 +#define P_SCR_CANCEL_CAPTURE_KEY 14 +#define P_SCR_CLIENT_FOREGROUND 15 +#define P_SCR_LAST_LINE_WRAP 16 +#define P_SCR_FONT 17 +#define P_SCR_DISABLE_READS 18 +#define P_SCR_SET_PRIORITY_CONTROL 19 +#define P_SCR_COMPATIBILITY 20 +#define P_SCR_GREY 21 +#define P_SCR_FONT_EXT 22 +#define P_FWFLUSH P_FRSUPER +#define P_EVENT_READ P_FSTOP +#define P_EVENT_TEST P_FSTART + +#endif // P_CONS_H diff --git a/code/SIBOSDK/include/p_crc.h b/code/SIBOSDK/include/p_crc.h new file mode 100644 index 0000000..4a045bb --- /dev/null +++ b/code/SIBOSDK/include/p_crc.h @@ -0,0 +1,37 @@ +/* HEADER - P_CRC.H +Copyright (C) Psion PLC 1991-92 + VER DATE BY DESCRIPTION +===== ======== === =========== +1.00F 26/04/90 NSM First relase +1.10F 07/07/92 NSM Second release +1.11F 31/08/23 AB #ifndef fix +*/ +#ifndef P_CRC_H +#define P_CRC_H + +#include + +typedef struct + { + unsigned char lo; /* CRC low byte*/ + unsigned char hi; /* CRC high byte*/ + } CRC; + +/* CRC as hi lo bytes or a word */ +typedef union + { + unsigned short int uw; + CRC hilo; + } P_CRC; + +#pragma save,call(reg_param =>(di,si,cx),reg_saved =>(bx,cx,si,di,EPOC_SAVE)) +#ifdef __cplusplus +extern "C" { +#endif +extern void p_crc(unsigned short int *,const unsigned char *,unsigned int); +#pragma restore +#ifdef __cplusplus +} +#endif + +#endif // P_CRC_H diff --git a/code/SIBOSDK/include/p_crypt.h b/code/SIBOSDK/include/p_crypt.h new file mode 100644 index 0000000..6697a48 --- /dev/null +++ b/code/SIBOSDK/include/p_crypt.h @@ -0,0 +1,22 @@ +/* HEADER - P_CRYPT.H +Copyright (C) Psion PLC 1991-92 + VER DATE BY DESCRIPTION +===== ======== === =========== +1.00F 26/04/90 NSM First relase +1.10F 07/07/92 NSM Second release +1.11F 31/08/23 AB #ifndef fix +*/ +#ifndef P_CRYPT_H +#define P_CRYPT_H + +#include + +#define P_MAX_PASS_LEN 16 /* maximum password length */ +typedef struct +{ +unsigned char len; /* length of mask */ +unsigned char pos; /* current position in mask */ +unsigned char msk[P_MAX_PASS_LEN]; /* the mask */ +} P_MASK; + +#endif // P_CRYPT_H diff --git a/code/SIBOSDK/include/p_date.h b/code/SIBOSDK/include/p_date.h new file mode 100644 index 0000000..5a87335 --- /dev/null +++ b/code/SIBOSDK/include/p_date.h @@ -0,0 +1,54 @@ +/* HEADER - P_DATE.H +Copyright (C) Psion PLC 1991-92 + VER DATE BY DESCRIPTION +===== ======== === =========== +1.00F 26/04/90 NSM First relase +1.10F 07/07/92 NSM Second release +1.11F 31/08/23 AB #ifndef fix +*/ +#ifndef P_DATE_H +#define P_DATE_H + +#include + +#define P_NSECDAY 86400l /* number of seconds in a day */ +/* +Convert day since 1900 to day in week, Monday=0 +*/ +#define P_WEEK(d) ((INT)((d)%7)) /* JAN 1 1900 was a Monday */ +typedef struct + { + unsigned long int day; /* day number since 1900, up to 2155, 0 to approx 93000 */ + unsigned long int sec; /* seconds in day, 0 to 86399 */ + } P_DAYSEC; +typedef struct + { + unsigned char year; /* Year - 1900 */ + unsigned char month; /* Month number in year, 0 to 11 */ + unsigned char day; /* Day number in month, 0 to 30 */ + unsigned char hour; /* Hour in day, 0 to 23 */ + unsigned char minute; /* Minute in hour, 0 to 59 */ + unsigned char second; /* Second in minute, 0 to 59 */ + unsigned short int yrday; /* day in year */ + } P_DATE; +#ifdef __cplusplus +extern "C" { +#endif +#pragma save,call(reg_param =>(si,di),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int p_dstodt(const P_DAYSEC *,P_DATE *); +extern int p_dttods(const P_DATE *,P_DAYSEC *); +#pragma call(reg_param =>(si,di),reg_saved =>(cx,dx,si,di,EPOC_SAVE)) +extern int p_dstost(const P_DAYSEC *,unsigned long int *); +#pragma call(reg_param =>(bx,di),reg_saved =>(bx,si,di,EPOC_SAVE)) +extern void p_sttods(const unsigned long int *,P_DAYSEC *); +#pragma call(reg_param =>(di,si,bx,cx),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int p_dt2str(char *str,const char *fmt,const P_DATE *dt); +extern int p_ds2str(char *str,const char *fmt,const P_DAYSEC *ds); +extern int p_now2str(char *str,const char *fmt); +extern int p_st2str(char *str,const char *fmt,const unsigned long int *st); +#pragma restore +#ifdef __cplusplus +} +#endif + +#endif // P_DATE_H diff --git a/code/SIBOSDK/include/p_dbf.h b/code/SIBOSDK/include/p_dbf.h new file mode 100644 index 0000000..859f76f --- /dev/null +++ b/code/SIBOSDK/include/p_dbf.h @@ -0,0 +1,112 @@ +/* HEADER - P_DBF.H +Copyright (C) Psion PLC 1991-92 + VER DATE BY DESCRIPTION +===== ======== === =========== +1.00F 26/04/90 NSM First relase +1.10F 07/07/92 NSM Second release +1.11F 31/08/23 AB #ifndef fix +*/ +#ifndef P_DBF_H +#define P_DBF_H + +#include + +#define DbfMaxRecords 0xfffe /* 0-fffd,1-fffe for OPL with ffff at eof */ +#define DbfRecordTypeMask 0xf000 /* Top nibble of header word */ +#define DbfRecordLengthMask 0x0fff /* Bottom 12 bits of header word */ +#define DbfFieldTypeWord 0 +#define DbfFieldTypeLong 1 +#define DbfFieldTypeDouble 2 +#define DbfFieldTypeString 3 +#define DbfFindAllStrings -1 /* for nStrings parameter to DbfFindRead */ +#define DbfFindBackwards 0x0000 +#define DbfFindForwards 0x0100 +#define DbfFindLast 0x0200 +#define DbfFindFirst 0x0300 +#define DbfFindCaseIndependent 0x0000 +#define DbfFindCaseDependent 0x1000 +#define DbfCopyFromHandle 0 +#define DbfCopyToHandle 1 +#define DbfStateCopyAbort -2 /* for DbfCopyFile only */ +#define DbfStateOpenNoIndex -2 /* for DbfOpen only */ +#define DbfStateDisabled -1 +#define DbfStateStart 0 +#define DbfStateScanBuffer 1 +#define DbfStateGetBuffer 2 +#define DbfStateFinished 3 +#define DbfHeaderNameSize 16 +#define DbfHeaderLength 22 /* Length of header without F.I.R */ +#define DbfMaxFirLength 32 /* 32 bytes */ +#define DbfMinBufferSize 512 /* Minimum buffer size */ +#define DbfMaxBufferSize 16384 /* Maximum buffer size */ +#define DbfMaxRecordLength 4094 /* Maximum record length,not inc. header */ +#define DbfRecordTypeFir 2 /* Record type for Field Information Record */ +#define DbfRecordTypeDesc 3 /* Record type for 'descriptive' record */ +#define DbfRecordTypeAll 15 /* Record type to match all records (except erased) */ +typedef struct +{ +unsigned char fileType[DbfHeaderNameSize]; /* Name of the file type */ +unsigned short int createVersion; /* software version used to create file */ +unsigned short int dataStart; /* Offset in file for start of data */ +unsigned short int needVersion; /* minimum software version needed to handle this file */ +unsigned short int firHeader; +unsigned char fir[DbfMaxFirLength]; +} DbfHeader; +typedef struct +{ +unsigned short int header; /* Record header word */ +unsigned char data[2]; /* Data follows... */ +} DbfRecord; +typedef struct +{ +void **pFcb; /* the address of the fcb */ +char *fName; /* the file name */ +unsigned int mode; /* the mode */ +DbfHeader *pHead; /* the address of the header */ +} DbfOpenArgs; +#ifdef __cplusplus +extern "C" { +#endif +#pragma save, call(reg_param=>(bx,dx),reg_saved=>(cx,si,di,EPOC_SAVE)) +extern int DbfFileSize(void *pHandle,unsigned long int *pos); +#pragma call(reg_param=>(di,bx,si,dx,cx,ax),reg_saved=>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int DbfQuickOpen(int *pState,DbfOpenArgs *pArgs,unsigned char *buffer,unsigned int length,unsigned int type); +extern int DbfCopyFile(unsigned int *state,void *sHandle,const char *targetName,unsigned int targetMode,unsigned int type,int dir); +extern int DbfEraseRead(int *state,void *pHandle,unsigned short int *pOffset); +extern int DbfCompress(unsigned int *state,void *pHandle); +#pragma call(reg_param=>(di,bx,si,cx,dx,ax),reg_saved=>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int DbfFindRead(unsigned int *state,void *pHandle,const void *buffer,unsigned int length,unsigned int findMode,unsigned int nStrings,unsigned short int *pOffset); +#pragma call(reg_param=>(di,bx,cx),reg_saved=>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int DbfUpdate(int *state,void *pHandle,unsigned int length); +#pragma call(reg_param=>(bx,cx,si),reg_saved=>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int DbfAbsRead(void *pHandle,unsigned int record,unsigned short int *pOffset); +extern int DbfAppend(void *pHandle,unsigned int length); +extern int DbfFlush(void *pHandle); +extern int DbfClose(void *pHandle); +extern unsigned int DbfDescRecordRead(void *pHandle); +extern int DbfDescRecordWrite(void *pHandle,unsigned int length); +#pragma call(reg_param=>(bx,cx,si,di),reg_saved=>(bx,cx,si,di,EPOC_SAVE)) +extern int DbfAbsReadSense(void *pHandle,unsigned int record,unsigned short int *pOffset,unsigned long int *pPos); +#pragma call(reg_param=>(bx,si),reg_saved=>(cx,dx,di,EPOC_SAVE)) +extern int DbfNextRead(void *pHandle,unsigned short int *pOffset); +extern int DbfBackRead(void *pHandle,unsigned short int *pOffset); +extern int DbfFirstRead(void *pHandle,unsigned short int *pOffset); +extern int DbfLastRead(void *pHandle,unsigned short int *pOffset); +#pragma call(reg_param=>(ax,bx,si,cx),reg_saved=>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int DbfExtHeaderRead(unsigned int x,void *pHandle,void *buffer,unsigned int len); +extern int DbfExtHeaderWrite(unsigned int x,void *pHandle,const void *buffer,unsigned int len); +#pragma call(reg_param=>(bx,si),reg_saved=>(bx,cx,dx,si,di,EPOC_SAVE),inline=>on) +static unsigned int DbfVersion(void)={0xb4,0x0a,0xcd,0xd8}; +static void DbfTrash(void *pHandle)={0xb4,0x03,0xcd,0xd8}; +static unsigned int DbfSense(void *pHandle)={0xb4,0x15,0xcd,0xd8}; +static unsigned int DbfCount(void *pHandle)={0xb4,0x16,0xcd,0xd8}; +static int DbfCopyDown(void *pHandle,unsigned int offset)={0xb4,0x04,0xcd,0xd8}; +#pragma restore +extern int cdecl DbfFindReadField(unsigned int *state,void *pHandle,const void *buffer,unsigned int length,unsigned int findMode,unsigned int nStrings,unsigned short int *pOffset,unsigned int startStr); +extern int cdecl DbfOpen(int *state,void **pHandle,const char *name,unsigned int mode, + DbfHeader *header,unsigned char *buffer,unsigned int length,unsigned int type); +#ifdef __cplusplus +} +#endif + +#endif // P_DBF_H diff --git a/code/SIBOSDK/include/p_file.h b/code/SIBOSDK/include/p_file.h new file mode 100644 index 0000000..a308583 --- /dev/null +++ b/code/SIBOSDK/include/p_file.h @@ -0,0 +1,298 @@ +/* HEADER - P_FILE.H +Copyright (C) Psion PLC 1991-92 + VER DATE BY DESCRIPTION +===== ======== === =========== +1.00F 26/04/90 NSM First relase +1.10F 07/07/92 NSM Second release +*/ +#ifndef P_FILE_H +#define P_FILE_H + +#include + +#define P_MAXDEVNAME 4 +typedef void (*P_DEVICE)(void); +typedef struct /* IO request packet */ +{ +short int *pstat; /* where to write completion status */ +unsigned char *a1; /* first parameter */ +unsigned char *a2; /* second parameter */ +} P_RQPKT; +/* all I/O control blocks must start with this header */ +typedef struct p_icb /* I/O control block header */ +{ +struct p_icb *picb; /* ptr to current ICB in chain */ +int (*vec)(); /* strategy entry point */ +} P_ICB; +/* IO request - as passed to strategy functions */ +typedef struct +{ +unsigned int func; /* function number */ +P_RQPKT r; /* request packet */ +} P_IRQ; +/* Wait Handler defines */ +#define P_SIGNAL_UNUSED 0 /* signal not used by waithandler */ +#define P_SIGNAL_ENABLE 1 /* signal used by handler,I/O's still pending */ +#define P_SIGNAL_DISABLE 2 /* signal used by handler,no I/O's pending */ +/* open service mode flags */ +#define P_FOPEN 0x0000 /* Open i/o service */ +#define P_FCREATE 0x0001 /* Create file */ +#define P_FREPLACE 0x0002 /* Replace file */ +#define P_FAPPEND 0x0003 /* Append records */ +#define P_FUNIQUE 0x0004 /* Unique file open */ +#define P_FSER_MASK 0x000f /* File service mask */ +#define P_FSTREAM 0x0000 /* Stream access to a binary file */ +#define P_FSTREAM_TEXT 0x0010 /* Stream access to a text file */ +#define P_FTEXT 0x0020 /* Record access to a text file */ +#define P_FDIR 0x0030 /* Record access to a directory file */ +#define P_FFORMAT 0x0040 /* Format a device */ +#define P_FDEVICE 0x0050 /* Record access to device name list */ +#define P_FNODE 0x0060 /* Record access to node name list */ +#define P_FMT_MASK 0x00f0 /* File format mask */ +#define P_FUPDATE 0x0100 /* Read and write access */ +#define P_FRANDOM 0x0200 /* Random access */ +#define P_FSHARE 0x0400 /* File can be shared */ +#define P_FACC_MASK 0x0f00 /* mask for access types */ +#define P_FLOWDENSITY 0x1000 +/* p_io/p_iow function constants */ +/* Generic I/O functions */ +#define P_FPANIC 0 /* Panic the device */ +#define P_FREAD 1 /* Read */ +#define P_FWRITE 2 /* Write */ +#define P_FCLOSE 3 /* Close */ +#define P_FCANCEL 4 /* Cancel io */ +#define P_FATTACH 5 /* attach this pseudo device */ +#define P_FDETACH 6 /* detach this pseudo device */ +#define P_FSET 7 /* set channel characteristics */ +#define P_FSENSE 8 /* sense channel characteristics */ +#define P_FFLUSH 9 /* Flush buffers */ +/* Now follows the device specific functions */ +/* Timer device driver */ +#define P_FRELATIVE P_FREAD /* Relative timer */ +#define P_FABSOLUTE P_FWRITE /* Absolute timer */ +/* Files */ +#define P_FSEEK 10 /* Seek */ +#define P_FSETEOF 11 /* Set end of file */ +/* Data Link I/O + wserv */ +#define P_FCONNECT 10 /* Queue a link connect request */ +#define P_FDISCONNECT 11 /* Disconnect the link */ +/* wserv functions */ +#define P_FWRITE_REPLY 12 /* P_FWRITE + read a reply from the server */ +/* Serial/llmac */ +#define P_FTEST 10 /* return no. of bytes in serial receieve buffer */ +#define P_FCTRL 11 /* serial port control lines */ +#define P_FINQ 12 /* inquire of device capabilities */ +#define P_FRSUPER 13 /* read a supervisory frame (p_llmac) */ +#define P_FSTOP 14 /* stop LLMAC mode */ +#define P_FSTART 15 /* start LLMAC mode */ +/* Serial LDD to Serial PDD I/O defines */ +#define P_FENABLE 16 /* Enable transmit interrupts */ +#define P_FSETINT 17 /* set the serial Interrupt code ptrs */ +/* modem functions */ +#define P_FMINIT 16 /* modem initialization function */ +#define P_FMDIAL 17 /* modem dial function */ +#define P_FMWAITCALL 18 /* wait for an incoming call */ +#define P_FMSENSE 19 /* Sense Modem characteristics */ +#define P_FMSET 20 /* Set Modem characteristics */ +#define P_FMCANCEL 21 /* Cancel outstanding mode request */ +#define P_FMWRITE 22 /* Write a configuration string to modem with timeout */ +/* p_seek() mode constants */ +#define P_FABS 1 /* Position absolute in the file */ +#define P_FEND 2 /* Position relative from the end of file */ +#define P_FCUR 3 /* Position relative to the current pos */ +#define P_FRSENSE 4 /* Sense the record position */ +#define P_FRSET 5 /* Set the record position */ +#define P_FREWIND 6 /* Rewind a text file */ + +/* IRDA Defines */ +#define P_FIRDISCONNECT 4 /* Disconnect from remote machine */ +#define P_FIRAWAITCONNECT 5 /* Wait for a connection from a remote machine */ +#define P_FIRDISCOVER 6 /* Discover remote machines */ +#define P_FIRSELECT 7 /* Select a remote machine */ +#define P_FIRMAKECONNECT 8 /* Make a connection to a remote machine */ + +/* file errors */ +#define ExistsErr (-32) +#define NotExistsErr (-33) +#define WriteErr (-34) +#define ReadErr (-35) +#define EofErr (-36) +#define FullErr (-37) +#define NameErr (-38) +#define AccessErr (-39) +#define LockedErr (-40) +#define DeviceErr (-41) +#define DirErr (-42) +#define RecordErr (-43) +#define ReadOnlyErr (-44) +#define IoInvalidErr (-45) +#define PendingErr (-46) +#define VolumeErr (-47) +#define CancelErr (-48) +#define IoAllocErr (-10) /* E_GEN_NOMEMORY */ +#define DisconnectErr (-50) +#define ConnectErr (-51) +#define ReTransmitErr (-52) +#define LineErr (-53) +#define InActivityErr (-54) +#define ParityErr (-55) +#define FrameErr (-56) +#define OverrunErr (-57) +#define ModemConnectErr (-58) +#define ModemBusyErr (-59) +#define ModemNoAnswerErr (-60) +#define ModemBlacklistErr (-61) +#define NotReadyErr (-62) +#define UnknownErr (-63) +#define DirFullErr (-64) +#define WriteProtectErr (-65) +#define CorruptMediaErr (-66) +#define AbortErr (-67) +#define EraseErr (-68) +#define InvalidFileErr (-69) +#define E_FILE_EXIST ExistsErr /* File already exists */ +#define E_FILE_NXIST NotExistsErr /* File does not exist */ +#define E_FILE_WRITE WriteErr /* Write to file failed */ +#define E_FILE_READ ReadErr /* Read from file failed */ +#define E_FILE_EOF EofErr /* Read past end of file */ +#define E_FILE_FULL FullErr /* Disk/serial read buffer full */ +#define E_FILE_NAME NameErr /* Invalid file name */ +#define E_FILE_ACCESS AccessErr /* Access denied */ +#define E_FILE_LOCKED LockedErr /* Record or file locked */ +#define E_FILE_DEVICE DeviceErr /* Device does not exist */ +#define E_FILE_DIR DirErr /* Directory does not exist */ +#define E_FILE_RECORD RecordErr /* Record too large */ +#define E_FILE_RDONLY ReadOnlyErr /* File has read only access */ +#define E_FILE_INV IoInvalidErr /* Invalid I/O operation */ +#define E_FILE_PENDING PendingErr /* I/O pending (not yet completed) */ +#define E_FILE_VOLUME VolumeErr /* Invalid volume */ +#define E_FILE_CANCEL CancelErr /* Async operation was cancelled */ +#define E_FILE_ALLOC IoAllocErr /* No memory for control block */ +#define E_FILE_DISC DisconnectErr /* link is disconnected */ +#define E_FILE_CONNECT ConnectErr /* link already connected */ +#define E_FILE_RETRAN ReTransmitErr /* Retransmission threshold exceeded */ +#define E_FILE_LINE LineErr /* Physical link failure */ +#define E_FILE_INACT InActivityErr /* Inactivity timer expired */ +#define E_FILE_PARITY ParityErr /* Serial parity error */ +#define E_FILE_FRAME FrameErr /* Serial framing error */ +#define E_FILE_OVERRUN OverrunErr /* Serial overrun error */ +#define E_MDM_CONFAIL ModemConnectErr /* modem can't connect to remote modem */ +#define E_MDM_BUSY ModemBusyErr /* remote number busy */ +#define E_MDM_NOANS ModemNoAnswerErr /* there was no answer */ +#define E_MDM_BLACKLIST ModemBlacklistErr /* number blacklisted by the modem*/ +#define E_FILE_NOTREADY NotReadyErr /* Drive not ready error */ +#define E_FILE_UNKNOWN UnknownErr /* Unknown media in drive */ +#define E_FILE_DIRFULL DirFullErr /* Root dir full error */ +#define E_FILE_PROTECT WriteProtectErr /* Device write protect */ +#define E_FILE_CORRUPT CorruptMediaErr /* Media is corrupt */ +#define E_FILE_ABORT AbortErr /* User aborted operation error */ +#define E_FILE_ERASE EraseErr /* Failed to Erase Flash pack */ +#define E_FILE_INVALID InvalidFileErr /* Invalid file for DBF system */ +/* defines for changing directories */ +#define P_CD_ROOT 0 /* goto root directory */ +#define P_CD_PARENT 1 /* goto parent directory */ +#define P_CD_SUBDIR 2 /* goto subdirectory */ +/* masks for status flag of P_INFO */ +#define P_FAWRITE 0x01 /* can the file be written to? */ +#define P_FAHIDDEN 0x02 /* set if file is hidden */ +#define P_FASYSTEM 0x04 /* set if file is a system file */ +#define P_FAVOLUME 0x08 /* set if the name is a volume name */ +#define P_FADIR 0x10 /* set if file is a directory file */ +#define P_FAMOD 0x20 /* has the file been modified? */ +#define P_FAREAD 0x100 /* can the file be read? */ +#define P_FAEXEC 0x200 /* is the file executable? */ +#define P_FASTREAM 0x400 /* is the file a byte stream file? */ +#define P_FATEXT 0x800 /* is it a text file? */ +/* File system File information - p_finfo() */ +typedef struct { +unsigned short int version; /* for future expansion */ +unsigned short int status; /* status bits */ +unsigned long int size; /* size of the file */ +unsigned long int modst; /* system time of last modification */ +unsigned char spare[4]; /* spare bytes for future expansion */ +} P_INFO; +#define P_VOLUMENAME 32 +#define P_FMEDIA_UNKNOWN 0 +#define P_FMEDIA_FLOPPY 1 +#define P_FMEDIA_HARDDISK 2 +#define P_FMEDIA_FLASH 3 +#define P_FMEDIA_RAM 4 +#define P_FMEDIA_ROM 5 +#define P_FMEDIA_WRITEPROTECTED 6 +#define P_FMEDIA_COMPRESSIBLE 0x8000 /* Worth compressing deleted records */ +#define P_FMEDIA_DYNAMIC 0x4000 /* Media size is dynamic */ +#define P_FMEDIA_INTERNAL 0x2000 /* Media is internal */ +#define P_FMEDIA_DUAL_DENSITY 0x1000 +#define P_FMEDIA_FORMATTABLE 0x800 +/* File System Device information - p_dinfo() */ +typedef struct { +unsigned short int version; /* for future expansion */ +unsigned short int mediatype; /* what type of device is this */ +unsigned short int removable; /* is device removable or not */ +unsigned long int size; /* size of the device */ +unsigned long int free; /* amount of device still free */ +char name[P_VOLUMENAME]; /* the volume name of the device */ +short int batterystate; /* Device battery status */ +unsigned char spare[16]; /* spare bytes for future expansion */ +} P_DINFO; +#define P_FSYSTYPE_FLAT 0 +#define P_FSYSTYPE_HIER 1 +/* File System Node information - p_ninfo() */ +typedef struct { +unsigned short int version; /* for future expansion */ +unsigned short int type; /* file system type (flat/hierarchical...) */ +unsigned short int formattable; /* TRUE if node supports format cmds else FALSE */ +unsigned char spare[26]; /* spare bytes for future expansion */ +} P_NINFO; +/* Flag defines for p_fparse */ +#define P_PWILD_ANY 0x01 /* contains one or more wildcards */ +#define P_PWILD_NAME 0x02 /* the name field contains wildcards */ +#define P_PWILD_EXT 0x04 /* the extension contains wildcards */ +/* Full file system parse - p_fparse() */ +#define P_FSYSNAMESIZE 5 +typedef struct { +unsigned char system; /* file system name length */ +unsigned char device; /* device name length */ +unsigned char path; /* path name length */ +unsigned char name; /* name length */ +unsigned char ext; /* extension length */ +unsigned char flags; /* information on the presence of wildcards */ +} P_FPARSE; +#define P_FBLKSHIFT 9 /* Block shift factor */ +#define P_FBLKSIZE 0x200 /* Block size */ +#define P_FMAXRSIZE 0x100 /* Maximum text record size */ +#define P_FMAXSSIZE 0x4000 /* Maximum stream read/write length */ +#define P_FSIZRPOS sizeof(long int) /* array size for storing r/w position */ +#define P_MAXDEV 128 /* Maximum device name size */ +#define P_MAXPATH 128 /* Maximum path size */ +#define P_MAXNAME 128 /* Maximum name size */ +#define P_MAXEXTN 128 /* Maximum extension size */ +#define P_FNAMESIZE 128 /* Maximum file name size */ +/* BINARY FILE SIGNATURE FOR APPLICATION FILES */ +typedef struct +{ +char app_id[3]; /* application id */ +unsigned char chk_sum; /* application id checksum */ +unsigned char file_vn; /* file version number */ +unsigned char app_vn; /* application version number */ +} P_FSIG; +#ifdef __cplusplus +extern "C" { +#endif +extern void cdecl p_inst(P_DEVICE *,...); +#pragma save,call(reg_param =>(bx,cx,di,si,dx),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int p_fparse(const char *,const char *,char *,P_FPARSE *); +extern int f_fparse(const char *,const char *,char *,P_FPARSE *); +extern int p_fparseasync(const char *,const char *,char *,P_FPARSE *,short int *); +extern int p_finfo(const char *,P_INFO *); +extern int p_finfoasync(const char *,P_INFO *,short int *); +extern int p_ninfo(const char *,P_NINFO *); +extern int p_ninfoasync(const char *,P_NINFO *,short int *); +extern int p_dinfo(const char *,P_DINFO *); +extern int p_dinfoasync(const char *,P_DINFO *,short int *); +#pragma restore +#ifdef __cplusplus +} +#endif + +#endif // P_FILE_H diff --git a/code/SIBOSDK/include/p_frame.h b/code/SIBOSDK/include/p_frame.h new file mode 100644 index 0000000..fa053b0 --- /dev/null +++ b/code/SIBOSDK/include/p_frame.h @@ -0,0 +1,37 @@ +/* HEADER - P_FRAME.H +Copyright (C) Psion PLC 1991-92 + VER DATE BY DESCRIPTION +===== ======== === =========== +1.00F 26/04/90 NSM First relase +1.10F 07/07/92 NSM Second release +*/ +#ifndef P_FRAME_H +#define P_FRAME_H + +#include +#include +#include + +typedef struct +{ +/* Transmit stuff */ +P_CRC tcrc; /* the CRC for the transmitted data */ +unsigned char *pbuf; /* where to extract next byte from transmit buffer */ +unsigned char *pend; /* ptr to end of data in transmit buffer */ +unsigned char tcntl; /* the control byte to transmit */ +unsigned char tstat; /* current transmit frame state */ +/* receive stuff */ +unsigned short int rlen; /* current received frame length */ +unsigned char rstat; /* current receive frame state */ +unsigned char rtyp; /* current receive frame type */ +unsigned char rseq; /* current receive frame sequence */ +unsigned char rfull; /* TRUE if a complete data frame is in buffer */ +P_CRC rcrc; /* the CRC for the received data */ +P_FRAME dfrm; /* the internal data frame */ +short int numfrm; /* number of frames currently in supervisory Q */ +P_FRAME *prfin; /* entry pt to supervisory frame Q */ +P_FRAME *prfout; /* removal pt of supervisory frame Q */ +P_FRAME rfrm[MAXFRM]; /* supervisory frame Q */ +} P_FRMCB; + +#endif // P_FRAME_H \ No newline at end of file diff --git a/code/SIBOSDK/include/p_gen.h b/code/SIBOSDK/include/p_gen.h new file mode 100644 index 0000000..13e770e --- /dev/null +++ b/code/SIBOSDK/include/p_gen.h @@ -0,0 +1,68 @@ +/* HEADER - P_GEN.H +Copyright (C) Psion PLC 1991-92 + VER DATE BY DESCRIPTION +===== ======== === =========== +1.00F 26/04/90 NSM First relase +1.10F 07/07/92 NSM Second release +*/ +#ifndef P_GEN_H +#define P_GEN_H + +#include + +/* general errors */ +#define NoErr 0 /* no error !! */ +#define FailErr (-1) /* Failure */ +#define ArgumentErr (-2) /* Invalid arguments */ +#define OsErr (-3) /* Operating system error */ +#define NotSupportedErr (-4) /* Not supported function */ +#define UnderflowErr (-5) /* Underflow */ +#define OverflowErr (-6) /* Overflow */ +#define E_GEN_FAIL FailErr +#define E_GEN_ARG ArgumentErr +#define E_GEN_OS OsErr +#define E_GEN_NSUP NotSupportedErr +#define E_GEN_UNDER UnderflowErr +#define E_GEN_OVER OverflowErr +#define RangeErr (-7) /* Argument range */ +#define DivideByZeroErr (-8) /* Divide by zero */ +#define InUseErr (-9) /* Resource in use */ +#define NoMemoryErr (-10) /* No memory left */ +#define NoSegmentsErr (-11) /* No segments left */ +#define NoSemaphoreErr (-12) /* No semaphores left */ +#define NoProcessErr (-13) /* No processes left */ +#define AlreadyOpenErr (-14) /* Resource already open */ +#define NotOpenErr (-15) /* Resource not open */ +#define ImageErr (-16) /* Invalid image file */ +#define NoReceiverErr (-17) /* No message receiver */ +#define NoDevicesErr (-18) /* No devices left */ +#define NoFileSystemErr (-19) /* No file system left */ +#define FailedToStartErr (-20) /* Failed to start application */ +#define FontNotLoadedErr (-21) +#define TooWideErr (-22) +#define TooManyItemsErr (-23) +#define BatLowSoundErr (-24) +#define BatLowFlashErr (-25) +#define E_GEN_RANGE RangeErr +#define E_GEN_DIVIDE DivideByZeroErr +#define E_GEN_INUSE InUseErr +#define E_GEN_NOMEMORY NoMemoryErr +#define E_GEN_NOSEGMENTS NoSegmentsErr +#define E_GEN_NOSEM NoSemaphoreErr +#define E_GEN_NOPROC NoProcessErr +#define E_GEN_OPEN AlreadyOpenErr +#define E_GEN_NOTOPEN NotOpenErr +#define E_GEN_IMAGE ImageErr +#define E_GEN_RECEIVER NoReceiverErr +#define E_GEN_DEVICE NoDevicesErr +#define E_GEN_FSYS NoFileSystemErr +#define E_GEN_START FailedToStartErr +#define E_GEN_NOFONT FontNotLoadedErr +#define E_GEN_TOOWIDE TooWideErr +#define E_GEN_TOOMANY TooManyItemsErr +#define E_GEN_BATSOUND BatLowSoundErr +#define E_GEN_BATFLASH BatLowFlashErr +#define E_KILLEXIT 0 /* Died by being killed */ +#define E_PANICEXIT 1 /* Died by a panic */ + +#endif // P_GEN_H \ No newline at end of file diff --git a/code/SIBOSDK/include/p_graf.h b/code/SIBOSDK/include/p_graf.h new file mode 100644 index 0000000..f1a7dd1 --- /dev/null +++ b/code/SIBOSDK/include/p_graf.h @@ -0,0 +1,62 @@ +/* HEADER - P_GRAF.H +Copyright (C) Psion PLC 1991-92 + VER DATE BY DESCRIPTION +===== ======== === =========== +1.00F 26/04/90 NSM First relase +1.10F 07/07/92 NSM Second release +*/ +#ifndef P_GRAF_H +#define P_GRAF_H + +#include + +typedef struct +{ +short int x; /* Horizontal coordinate */ +short int y; /* Vertical coordinate */ +} P_POINT; +typedef struct +{ +P_POINT tl; /* Top left point */ +P_POINT br; /* Bottom right point */ +} P_RECT; +typedef struct +{ +P_RECT r; /* Rectangle */ +P_POINT p; /* Point */ +} P_RECTP; +typedef struct +{ +P_POINT tl; /* Top left point */ +unsigned short int width; /* Width */ +unsigned short int height; /* Height */ +} P_EXTENT; +typedef struct +{ +unsigned short int *addr; /* address of 2-dimensional bit array */ +P_RECT area; /* area bounding the picture within bit array */ +unsigned short int bytewid; /* number of bytes in a row */ +} P_BITMAP; +#ifdef __cplusplus +extern "C" { +#endif +#pragma save,call(reg_param =>(si,di),reg_saved =>(bx,cx,si,di,EPOC_SAVE)) +extern void p_absrec(const P_RECT *,P_RECT *); +#pragma call(reg_param =>(bx),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int p_emprec(const P_RECT *); +#pragma call(reg_param =>(bx,ax,di),reg_saved =>(ax,bx,cx,dx,si,di,EPOC_SAVE)) +extern void p_insrec(P_RECT *,int,int); +#pragma call(reg_param =>(si,bx,di),reg_saved =>(EPOC_SAVE)) +extern int p_intrec(const P_RECT *,const P_RECT *,P_RECT *); +#pragma call(reg_param =>(bx,ax,dx),reg_saved =>(ax,bx,cx,dx,si,di,EPOC_SAVE)) +extern void p_offrec(P_RECT *,int,int); +#pragma call(reg_param =>(di,bx),reg_saved =>(bx,cx,si,di,EPOC_SAVE)) +extern int p_pinrec(const P_POINT *,const P_RECT *); +#pragma call(reg_param =>(si,bx,di),reg_saved =>(bx,EPOC_SAVE)) +extern void p_unirec(const P_RECT *,const P_RECT *,P_RECT *); +#pragma restore +#ifdef __cplusplus +} +#endif + +#endif // P_GRAF_H diff --git a/code/SIBOSDK/include/p_just.h b/code/SIBOSDK/include/p_just.h new file mode 100644 index 0000000..8c2631a --- /dev/null +++ b/code/SIBOSDK/include/p_just.h @@ -0,0 +1,18 @@ +/* HEADER - P_JUST.H +Copyright (C) Psion PLC 1991-92 + VER DATE BY DESCRIPTION +===== ======== === =========== +1.00F 26/04/90 NSM First relase +1.10F 07/07/92 NSM Second release +*/ +#ifndef P_JUST_H +#define P_JUST_H + +#include + +/* parameters to p_jtob */ +#define P_JLEFT 0 +#define P_JRIGHT 1 +#define P_JCENTRE 2 + +#endif // P_JUST_H diff --git a/code/SIBOSDK/include/p_keyb.h b/code/SIBOSDK/include/p_keyb.h new file mode 100644 index 0000000..d0baaa1 --- /dev/null +++ b/code/SIBOSDK/include/p_keyb.h @@ -0,0 +1,23 @@ +/* HEADER - P_KEYB.H +Copyright (C) Psion PLC 1991-92 + VER DATE BY DESCRIPTION +===== ======== === =========== +1.00F 26/04/90 NSM First relase +1.10F 07/07/92 NSM Second release +*/ +#ifndef P_KEYB_H +#define P_KEYB_H + +#include + +#ifndef _P_CON_KBREC +#define _P_CON_KBREC +typedef struct +{ +unsigned short int keycode; /* Code for the key pressed */ +unsigned char modifiers; /* A bit set for each modifier key held down */ +unsigned char count; +} P_CON_KBREC; +#endif + +#endif // P_KEYB_H diff --git a/code/SIBOSDK/include/p_link.h b/code/SIBOSDK/include/p_link.h new file mode 100644 index 0000000..84a9ca3 --- /dev/null +++ b/code/SIBOSDK/include/p_link.h @@ -0,0 +1,43 @@ +/* HEADER - P_LINK.H +Copyright (C) Psion PLC 1991-92 + VER DATE BY DESCRIPTION +===== ======== === =========== +1.00F 26/04/90 NSM First relase +1.10F 07/07/92 NSM Second release +*/ +#ifndef P_LINK_H +#define P_LINK_H + +#include +#include +#include + +/* P_FCONNECT service connection modes */ +#define P_LINK_ACCP 0 /* want link as acceptor */ +#define P_LINK_INIT 1 /* want link as initiator */ +/* Link layer states */ +#define P_LINK_IDLE 0 /* no connection - idle */ +#define P_LINK_IDLE_LR 1 /* no connection - awaiting LR */ +#define P_LINK_DATA_IDLE 2 /* connected - idle */ +#define P_LINK_DATA_LA 3 /* connected - awaiting LA */ +#define P_LINK_IDLE_LA 4 /* not connected - awaiting LA (or LT) to LR */ +/* State and event log record */ +typedef struct +{ +unsigned char state; +unsigned char event; +} P_LLLOG; +#define P_LINK_NLOG 32 /* Max number of debug events,states we record */ +#define P_LINK_LOG_MASK 0xC0 +#define P_LINK_LOG_PANIC 0xC0 /* panic number */ +#define P_LINK_LOG_MAC 0x00 /* MAC request or timer */ +#define P_LINK_LOG_REQ 0x80 /* User request */ +#define P_LINK_LOG_COMP 0x40 /* User completion */ +typedef struct +{ +P_LLMAC mac; /* LLMAC characteristics */ +unsigned short int br_cnt; /* count of broken frames */ +unsigned short int rx_cnt; /* re-transmission count */ +} P_LLDATA; + +#endif // P_LINK_H diff --git a/code/SIBOSDK/include/p_llmac.h b/code/SIBOSDK/include/p_llmac.h new file mode 100644 index 0000000..53d8073 --- /dev/null +++ b/code/SIBOSDK/include/p_llmac.h @@ -0,0 +1,37 @@ +/* HEADER - P_LLMAC.H +Copyright (C) Psion PLC 1991-92 + VER DATE BY DESCRIPTION +===== ======== === =========== +1.00F 26/04/90 NSM First relase +1.10F 07/07/92 NSM Second release +*/ +#ifndef P_LLMAC_H +#define P_LLMAC_H + +#include + +#define P_MAXILEN 300 /* maximum length of information field */ +#define MAXFRM 4 /* maximum number of frames in supervisory Q */ +#define SERNOCHAR (-1) /* no character to transmit */ +/* Frame type codes */ +#define LA_LPDU 0 /* The Link Acknowledge PDU */ +#define LD_LPDU 1 /* The Link disconnect PDU */ +#define LR_LPDU 2 /* The Link Request PDU*/ +#define LT_LPDU 3 /* The Link Data PDU */ +#define P_FRM_BROKEN 4 /* A broken frame */ +typedef struct +{ +unsigned char type; /* frame type or P_FRM_BROKEN for a broken frame */ +unsigned char seq; /* frame sequence */ +short int len; /* length of information field */ +unsigned char *pbuf; /* data buffer (INFO) */ +} P_FRAME; +/* LLMAC layer characteristics */ +typedef struct +{ +unsigned short int ilen; /* maximum information field length */ +unsigned short int speed; /* nominal speed in characters per second */ +unsigned short int rtint; /* suggested retransmission interval */ +} P_LLMAC; + +#endif // P_LLMAC_H diff --git a/code/SIBOSDK/include/p_math.h b/code/SIBOSDK/include/p_math.h new file mode 100644 index 0000000..dce34e4 --- /dev/null +++ b/code/SIBOSDK/include/p_math.h @@ -0,0 +1,103 @@ +/* HEADER - P_MATH.H +Copyright (C) Psion PLC 1991-92 + VER DATE BY DESCRIPTION +===== ======== === =========== +1.00F 26/04/90 NSM First relase +1.10F 07/07/92 NSM Second release +*/ +#ifndef P_MATH_H +#define P_MATH_H + +#include + +#define ABS(x) ((x)<0 ? -(x) : (x)) +#define MAX(a,b) ((a)>(b) ? (a) : (b)) +#define MIN(a,b) ((a)<(b) ? (a) : (b)) +#define P_FLT_MAXEXP 1023 /* maximum magnitude of float exponent */ +#define P_FLT_MANT 53 /* number of bits in mantissa (binary precission) */ +#define P_FLT_PREC 15 /* approximate precision in decimal digits */ +/* Cracked form of double float */ +typedef struct +{ +short int sign; /* P_FLT_ZERO,P_FLT_POS or P_FLT_NEG */ +short int exp; /* signed binary exponent */ +unsigned long int mant[2]; /* mantissa (least significant integer first) */ +} P_CRKFLT; +/* values for sign above */ +#define P_FLT_ZERO 0 /* value is zero */ +#define P_FLT_POS 1 /* value is positive */ +#define P_FLT_NEG 2 /* value is negative */ +/* format specification for p_dtob() */ +typedef struct +{ +unsigned char type; /* conversion type */ +unsigned char width; /* width of representation in characters */ +unsigned char ndec; /* number of decimal places */ +char point; /* decimal point character */ +char triad; /* triad separator character */ +unsigned char trilen; /* threshold for triad character use */ +} P_DTOB; +/* values for type in the above */ +#define P_DTOB_FIXED 0 /* fixed number of decimap points */ +#define P_DTOB_EXPONENT 1 /* exponent notation */ +#define P_DTOB_GENERAL 2 /* general format */ +/* Struct for p_poly() */ +typedef struct +{ +unsigned short int num; /* number of coefficients */ +double c[1]; /* coefficient table */ +} P_POLY; +/* DOUBLE constants */ +#define SQHF .70710678118654752440 /* Square root of a half */ +#define RLN2 1.4426950408889634 /* Reciprocal of ln 2 */ +#define RLN10 0.4342944819032518 /* Reciprocal of ln 10 */ +#define RLG2 0.3010299956639812 /* Reciprocal of log 2 */ +#define PI 3.1415926535897932 /* Pi */ +#define RPI 0.3183098861837907 /* Reciprocal of Pi */ +#define PIB2 1.5707963267948966 /* pi/2 */ +#define DRPI 0.6366197723675813 /* 2/pi */ +#define SQT3 1.7320508075688773 /* Square root of three */ +#define MSQ3 0.2679491924311227 /* 2 minus square root of three */ +#define RADTODEG 57.29577951308232 /* 1 radian in degrees (180/pi) */ +#define DEGTORAD 0.017453292519943296 /* 1 degree in radians */ +#ifdef __cplusplus +extern "C" { +#endif +#pragma save,call(reg_param =>(si,di,dx),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int p_stod(char **,double *,int); +#pragma call(reg_param =>(di,si,dx),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int p_dtob(char *,const double *,P_DTOB *); +extern int p_acos(double *,const double *); +extern int p_asin(double *,const double *); +extern int p_atan(double *,const double *); +extern int p_cos(double *,const double *); +extern int p_exp(double *,const double *); +extern int p_ln(double *,const double *); +extern int p_log(double *,const double *); +extern int p_mod(double *,const double *,const double *); +extern int p_pow(double *,const double *,const double *); +extern int p_sin(double *,const double *); +extern int p_sqrt(double *,const double *); +extern int p_tan(double *,const double *); +extern int p_int(double *,const double *); +extern int p_inti(short int *,const double *); +extern int p_fadd(double *,const double *); +extern int p_fsub(double *,const double *); +extern int p_fmul(double *,const double *); +extern int p_fdiv(double *,const double *); +extern int p_fcmp(double *,const double *); +extern void p_frand(double *,double *); +extern int p_fld(double *,const double *); +extern void p_itof(double *,const short int *); +extern int p_fneg(double *); +#pragma call(reg_param =>(di,si,dx),reg_saved =>(cx,dx,si,di,EPOC_SAVE)) +extern int p_intl(long int *,const double *); +extern void p_longtof(double *,const long int *); +#pragma call(reg_param =>(di,si,dx),reg_saved =>(si,EPOC_SAVE)) +extern double p_rand(unsigned long int *); +#pragma restore +#ifdef __cplusplus +} +#endif + +#endif // P_MATH_H diff --git a/code/SIBOSDK/include/p_modem.h b/code/SIBOSDK/include/p_modem.h new file mode 100644 index 0000000..fc03e59 --- /dev/null +++ b/code/SIBOSDK/include/p_modem.h @@ -0,0 +1,32 @@ +/* HEADER - P_MODEM.H +Copyright (C) Psion PLC 1991-92 + VER DATE BY DESCRIPTION +===== ======== === =========== +1.00F 26/04/90 NSM First relase +1.10F 07/07/92 NSM Second release +*/ +#ifndef P_MODEM_H +#define P_MODEM_H + +#include + +/* what options are selected */ +#define P_MDM_TONE 0x01 /* as opposed to PULSE dialling (default) */ +#define P_MDM_BELL 0x02 /* as opposed to CCITT (default) */ +#define P_MDM_NO_MODULATION 0x04 /* as opposed to CCITT or BELL */ +#define P_MDM_CONSTANT_SPEED 0x08 /* modem has constant speed interface */ +/* Error correction types */ +#define P_MDM_ERRCORRECT_NONE 0 /* NO error correction */ +#define P_MDM_ERRCORRECT 1 /* some form of error correction (ARQ)*/ +#define P_MDM_ERRCORRECT_MNP 2 /* MNP error correction being used */ +#define P_MDM_ERRCORRECT_V42 3 /* V42 error correction being used */ +typedef struct + { + unsigned short int supported; /* what baud rates are supported by modem */ + unsigned short int options; /* flags which options are selected */ + unsigned short int baudrate; /* baud rate currently running at/to run at */ + unsigned char chand; /* connected handshaking */ + unsigned char ichand; /* incoming call handshaking */ + } P_MDMCHR; + +#endif // P_MODEM_H diff --git a/code/SIBOSDK/include/p_ncp.h b/code/SIBOSDK/include/p_ncp.h new file mode 100644 index 0000000..e07c0ec --- /dev/null +++ b/code/SIBOSDK/include/p_ncp.h @@ -0,0 +1,131 @@ +/* HEADER - P_NCP.H +Copyright (C) Psion PLC 1991-92 + VER DATE BY DESCRIPTION +===== ======== === =========== +1.00F 26/04/90 NSM First relase +1.10F 07/07/92 NSM Second release +*/ +#ifndef P_NCP_H +#define P_NCP_H + +#include + +#define NCLINK_VERSION_NUMBER 3 +#define NCLINK_MINOR_VERNO 1 +typedef struct +{ +unsigned char *pcb; /* Handle to call */ +int handler; /* Handler handler */ +unsigned char *(*Install)(); /* Install server */ +void (*Remove)(); /* Remove the server */ +int (*WaitHandler)(); /* Wait handler function to call */ +unsigned char name[16]; /* name of the server */ +} P_NCP; +/* Informational data obtained by supervisory reads */ +#define PHYS_LINK_FAILED 0 /* Link layer has failed*/ +#define PHYS_CONNECT_FAILED 1 /* Waiting for connection failed */ +#define PHYS_CHARS_FAILED 2 /* Setting serial characteristics failed */ +#define PHYS_INIT_FAILED 3 /* Initialization of modem failed */ +#define PHYS_DIAL_FAILED 4 /* Dialling phone number failed */ +#define PHYS_MDMCONFIG_FAILED 5 /* additional modem config failed */ +#define PHYS_PHYS_LINK_ESTABLISHED 6 /* A physical link established */ +#define PHYS_WAITING_FOR_CALL 7 /* Physical layer waiting for call */ +#define PHYS_DIALLING_NUMBER 8 /* Physical layer dialling */ +#define PHYS_CONFIGURING_MODEM 9 /* configuring modem */ +#define PHYS_NCP_LINK_ESTAB_OK 10 /* Ncp link established OK */ +#define PHYS_NCP_LINK_ESTAB_NEW_NCP 11 /* Talking to different Ncp */ +#define PHYS_NCP_LINK_ESTAB_INVALID_VER 12 /* Remote NCP is V1.0 !!*/ +#define PHYS_NCP_LINK_END 13 /* remote NCP is terminating */ +#define PHYS_SERCONFIG_FAILED 14 /* serial port not there */ +/* type of message to add to the queue */ +#define NCONT_MSG_SEND 0 /* controller */ +#define NUSER_MSG_SEND 1 /* users */ +#define NEXPEDIATED_MSG_SEND 2 /* expediated */ +/***************************************************************************/ +/* NUCB flags defines */ +#define NUFLAG_WRITE_HELD 0x01 +#define NUFLAG_WRITE_OUTSTANDING 0x02 +#define NUFLAG_CONNECT_REQUEST 0x08 +#define NUFLAG_DISCONNECTED 0x10 +#define NUFLAG_ALLOCATED 0x20 +#define NUFLAG_CHANNEL_CLOSED 0x40 +#define NUFLAG_DISCONNECT_REQUEST 0x80 +#define NUFLAG_TEMPDISC 0x100 +#define NUFLAG_NO_CONNECTION (NUFLAG_TEMPDISC|NUFLAG_DISCONNECTED) +#define NC_VERSION_NUMBER 2 /* were version 2 */ +#define NC_MAX_USERCB 8 /* Max number of connected users */ +#define NC_MSG_SIZE 8 /* Max inter controller msg size */ +typedef struct nudata /* Network user data control block */ +{ +struct nudata *pnudata; /* next control blk in list */ +unsigned short int reclen; /* amount in buffer */ +unsigned char recbuf[1]; /* expands as required (for C offset) */ +} NUDATA; +typedef struct /* Network User control block */ +{ +P_ICB icb; /* I/O control block */ +unsigned short int flags; /* controlling flags */ +P_RQPKT read; /* read request block */ +P_RQPKT write; /* write request block */ +P_RQPKT super; /* supervisory read request blk */ +P_NCP *pncp; /* open channel control blk ptr */ +unsigned char localchanid; /* local channel id number */ +unsigned char remotechanid; /* remote channel id number */ +unsigned char *pncb; /* Network handle */ +unsigned char *handler; /* Network client wait handler handle */ +NUDATA *pnudata; /* Network users queued data */ +unsigned short int nclen; /* amount in the Network Controller msg buffer */ +unsigned char ncbuf[NC_MSG_SIZE]; /* message buffer */ +unsigned short int recvbytes; /* Number of bytes received (>1K) */ +unsigned short int xmitbytes; /* Number of bytes xmitted (>1K) */ +unsigned long int recvK; /* Number of K received */ +unsigned long int xmitK; /* Number of K transmitted */ +} NUCB; +/*************************************************************************/ +/* Inter controller message types */ +#define NCON_MSG_DATA_XOFF 1 +#define NCON_MSG_DATA_XON 2 +#define NCON_MSG_CONNECT_TO_SERVER 3 +#define NCON_MSG_CONNECT_RESPONSE 4 +#define NCON_MSG_CHANNEL_CLOSED 5 +#define NCON_MSG_NCP_INFO 6 /* MUST BE 6 for older versions*/ +#define NCON_MSG_CHANNEL_DISCONNECT 7 +#define NCON_MSG_NCP_END 8 +/* Inter Network user message types */ +#define NU_MSG_WRITECOMPLETE 1 +#define NU_MSG_WRITEPARTIAL 2 +#define NC_LINK_ACTIVE 0x01 +#define NC_READ_QUEUED 0x02 +#define NC_WRITE_QUEUED 0x04 +#define NC_TERMINATING 0x08 +#define NC_OWNER_CLOSE_REQUEST 0x10 +#define CONNECT_STATE_0 0 +#define CONNECT_STATE_1 1 +#define CONNECT_STATE_2 2 +typedef struct +{ +unsigned short int flags; /* Controlling flags */ +short int ctrlmsgqueue; /* Network users have controller messages queued */ +short int ctrllastxmit; /* Network users last transmitted a ctrl msg */ +short int usermsgqueue; /* Network users have queued write requests */ +short int userlastxmit; /* Network users last transmitted a user msg */ +unsigned short int maxfrmsize; /* maximum frame we can transmit/receive */ +short int wstat; /* Write completion status */ +short int rstat; /* Read completion status */ +unsigned short int wlen; /* Write length */ +unsigned short int rlen; /* Read length */ +unsigned char *handler; /* Network controller wait handler handle */ +unsigned char *plcb; /* link layer that were using */ +unsigned short int connected; /* connected state */ +unsigned short int remotencpver; /* the remote NCP version number */ +unsigned long int startdate; /* NCP start up date (logon id) */ +unsigned long int remotestartdate; /* the remote NCP logon id */ +unsigned short int expediatedlen; /* amount in expediated buf to transmit */ +unsigned char expediatedbuf[NC_MSG_SIZE]; +NUCB *lastnucb; /* last network user to do a write */ +unsigned char rbuf[P_MAXILEN]; /* read buffer */ +unsigned char wbuf[P_MAXILEN]; /* write buffer */ +NUCB usertable[NC_MAX_USERCB]; +} NCB; + +#endif // P_NCP_H diff --git a/code/SIBOSDK/include/p_nmsys.h b/code/SIBOSDK/include/p_nmsys.h new file mode 100644 index 0000000..aad40e6 --- /dev/null +++ b/code/SIBOSDK/include/p_nmsys.h @@ -0,0 +1,23 @@ +/* HEADER - P_NMSYS.H +Copyright (C) Psion PLC 1991-92 + VER DATE BY DESCRIPTION +===== ======== === =========== +1.00F 26/04/90 NSM First relase +1.10F 07/07/92 NSM Second release +*/ +#ifndef P_NMSYS_H +#define P_NMSYS_H + +#include + +#define P_SYSNAME_FIL 0 +#define P_SYSNAME_TIM 1 +#define P_SYSNAME_TTY 2 +#define P_SYSNAME_HMD 3 +#define P_SYSNAME_MAS 4 +#define P_SYSNAME_LLC 5 +#define P_SYSNAME_NLC 6 +#define P_SYSNAME_XMD 7 +#define P_SYSNAME_NCP 8 + +#endif // P_NMSYS_H diff --git a/code/SIBOSDK/include/p_object.h b/code/SIBOSDK/include/p_object.h new file mode 100644 index 0000000..40ab808 --- /dev/null +++ b/code/SIBOSDK/include/p_object.h @@ -0,0 +1,104 @@ +/* HEADER - P_OBJECT.H +Copyright (C) Psion PLC 1991-92 + VER DATE BY DESCRIPTION +===== ======== === =========== +1.00F 26/04/90 NSM First relase +1.10F 07/07/92 NSM Second release +*/ +#ifndef P_OBJECT_H +#define P_OBJECT_H + +#include + +#define METHOD +typedef struct p_class +{ +unsigned short int cat; /* category id */ +struct p_class *super; /* superclass class */ +unsigned short int len; /* length of instance */ +unsigned char base; /* base function number */ +unsigned char sig_6b; /* signature - should be 0x6b */ +unsigned char num; /* number of entries in vector table */ +unsigned char ncomp; /* number of component objects */ +} P_CLASS; +typedef struct +{ +int hcat; +int hclass; +} P_OBJECT; +typedef int P_CATID; /* category identifier */ +typedef struct +{ +P_CATID cat; /* category identifier */ +unsigned short int xclass; /* class number */ +} P_CLASSID; +#define METHOD_CALL call(reg_param =>(bx,dx,si,di),reg_saved =>(ds,st1,st2)) +#define p_send3(o,m,p1) _p_send3(o,m,(void *)(p1)) +#define p_send4(o,m,p1,p2) _p_send4(o,m,(void *)(p1),(void *)(p2)) +#define p_send5(o,m,p1,p2,p3) _p_send5(o,m,(void *)(p1),(void *)(p2),(void *)(p3)) +#define f_send3(o,m,p1) _f_send3(o,m,(void *)(p1)) +#define f_send4(o,m,p1,p2) _f_send4(o,m,(void *)(p1),(void *)(p2)) +#define f_send5(o,m,p1,p2,p3) _f_send5(o,m,(void *)(p1),(void *)(p2),(void *)(p3)) +#define p_entersend3(o,m,p1) _p_entersend3(o,m,(void *)(p1)) +#define p_entersend4(o,m,p1,p2) _p_entersend4(o,m,(void *)(p1),(void *)(p2)) +#define p_entersend5(o,m,p1,p2,p3) _p_entersend5(o,m,(void *)(p1),(void *)(p2),(void *)(p3)) +#define p_supersend3(o,m,p1) _p_supersend3(o,m,(void *)(p1)) +#define p_supersend4(o,m,p1,p2) _p_supersend4(o,m,(void *)(p1),(void *)(p2)) +#define p_supersend5(o,m,p1,p2,p3) _p_supersend5(o,m,(void *)(p1),(void *)(p2),(void *)(p3)) +#ifdef __cplusplus +extern "C" { +#endif +extern int cdecl p_send(void *,unsigned char,...); +extern int cdecl f_send(void *,unsigned char,...); +extern int cdecl p_qsend(void *,unsigned char,...); +extern void * cdecl f_newsend(int,int,unsigned char,...); +extern void * cdecl f_newlibhsend(int,int,unsigned char,...); +extern int cdecl p_entersend(void *,unsigned char,...); +extern int cdecl p_supersend(void *,unsigned char,...); +extern int cdecl p_exactsend(int,int,void *,unsigned char,...); +#pragma save,call(reg_param =>(bx,cx,dx,si,di),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int f_send2(void *,unsigned char); +extern int _f_send3(void *,unsigned char,void *); +extern int _f_send4(void *,unsigned char,void *,void *); +extern int _f_send5(void *,unsigned char,void *,void *,void *); +#pragma call(reg_param =>(bx,cx,dx,si,di),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE),inline =>on) +static int p_send2(void *,unsigned char) = {0xcd,0xcf}; +static int _p_send3(void *,unsigned char,void *) = {0xcd,0xcf}; +static int _p_send4(void *,unsigned char,void *,void *) = {0xcd,0xcf}; +static int _p_send5(void *,unsigned char,void *,void *,void *) = {0xcd,0xcf}; +static int p_entersend2(void *,unsigned char) = {0xcd,0xd9}; +static int _p_entersend3(void *,unsigned char,void *) = {0xcd,0xd9}; +static int _p_entersend4(void *,unsigned char,void *,void *) = {0xcd,0xd9}; +static int _p_entersend5(void *,unsigned char,void *,void *,void *) = {0xcd,0xd9}; +static int p_supersend2(void *,unsigned char) = {0xcd,0xd0}; +static int _p_supersend3(void *,unsigned char,void *) = {0xcd,0xd0}; +static int _p_supersend4(void *,unsigned char,void *,void *) = {0xcd,0xd0}; +static int _p_supersend5(void *,unsigned char,void *,void *,void *) = {0xcd,0xd0}; +#pragma restore +#pragma save,call(reg_param =>(bx,cx),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern void *p_new(int,int); +extern void *f_new(int,int); +extern int p_getlibh(int); +extern void *p_newlibh(int,int); +extern void *f_newlibh(int,int); +#pragma call(reg_param =>(bx,di),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int p_findlib(const char *,int *); +#pragma call(reg_param =>(bx,si,cx),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern void p_linklib(int); +extern int p_loadlib(const char *,int *,int); +extern int p_unloadlib(int); +#pragma call(reg_param =>(bx,ax,si,cx),reg_saved =>(bx,dx,si,di,EPOC_SAVE)) +extern int p_loadfilelib(void *,int,int *,int); +#pragma call(reg_param =>(si,bx),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int p_openlib(void **,const char *); +#pragma call(reg_param =>(bx,cx,di),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern void p_reclass(int,int,void *); +extern void p_reclassbyhandle(int,int,void *); +#pragma call(reg_param =>(bx,di,si,cx),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern void p_cpycat(int,void *,void *,unsigned int); +#pragma restore +#ifdef __cplusplus +} +#endif + +#endif // P_OBJECT_H diff --git a/code/SIBOSDK/include/p_par.h b/code/SIBOSDK/include/p_par.h new file mode 100644 index 0000000..cf133e3 --- /dev/null +++ b/code/SIBOSDK/include/p_par.h @@ -0,0 +1,22 @@ +/* HEADER - P_PAR.H +Copyright (C) Psion PLC 1991-92 + VER DATE BY DESCRIPTION +===== ======== === =========== +1.00F 22/10/93 SLT First relase +*/ +#ifndef P_PAR_H +#define P_PAR_H + +#include + +#define S_BUSY 0x10 +#define S_ACK 0x20 +#define S_ERROR 0x40 +#define S_PE 0x80 +#define S_SPARE 0x08 +#define S_STROBE 0x10 +#define S_INIT 0x20 +#define S_AUTOFD 0x40 +#define S_SELECT 0x80 + +#endif // P_PAR_H diff --git a/code/SIBOSDK/include/p_prdrv.h b/code/SIBOSDK/include/p_prdrv.h new file mode 100644 index 0000000..dd404d9 --- /dev/null +++ b/code/SIBOSDK/include/p_prdrv.h @@ -0,0 +1,58 @@ +/* HEADER - P_PRDRV.H +Copyright (C) Psion PLC 1991-92 + VER DATE BY DESCRIPTION +===== ======== === =========== +1.00F 26/04/90 NSM First relase +1.10F 07/07/92 NSM Second release +*/ +#ifndef P_PRDRV_H +#define P_PRDRV_H + +#include + +typedef struct + { + unsigned char topmarg; /* Number of lines in page's top margin */ + unsigned char bodylen; /* Total number of lines to print on the page */ + unsigned char lftmarg; /* Spaces in page's left margin */ + unsigned char bodywid; /* Total number of characters to print on each line */ + } P_LAYOUT_DATA; +typedef struct + { + unsigned char escapon; /* Escape processing enabled/disbaled */ + unsigned char escchar; /* Escape character */ + } P_ESCAPE_DATA; +#define P_PRNFLG_ESCAPE 1 /* Set if escape processing is enabled */ +#define P_PRNFLG_LAYOUT 2 /* Set if layout processing is enabled */ +#define P_PRNTYP_PAR 0 /* Parallel port type */ +#define P_PRNTYP_SER 1 /* Serial port type */ +#define P_PRNTYP_FIL 2 /* File port type */ +typedef struct + { + unsigned char port_type; /* P_PRNTYP_XXX */ + unsigned char nstack; /* number of devices in stack */ + unsigned char flags; /* P_PRNFLG_XXX bits */ + unsigned char escchar; /* Escape character */ + P_LAYOUT_DATA ld; /* Page layout */ + } P_PRN_INTF; +typedef struct + { + P_PRN_INTF *pintf; /* Interfacing information */ + char *label; /* user label */ + char *pname; /* port name */ + unsigned char *psetbuf; /* port setup data */ + char *driver; /* name of .prd file or NULL for no driver */ + } P_PRN_CRK; +#ifdef __cplusplus +extern "C" { +#endif +extern int p_prnset(int,void *,int); +extern int p_prnget(int,void *); +extern int p_prncur(int); +extern int p_prnbld(void *,P_PRN_CRK *); +extern void p_prncrk(void *,P_PRN_CRK *); +#ifdef __cplusplus +} +#endif + +#endif // P_PRDRV_H diff --git a/code/SIBOSDK/include/p_que.h b/code/SIBOSDK/include/p_que.h new file mode 100644 index 0000000..ec911db --- /dev/null +++ b/code/SIBOSDK/include/p_que.h @@ -0,0 +1,39 @@ +/* HEADER - P_QUE.H +Copyright (C) Psion PLC 1991-92 + VER DATE BY DESCRIPTION +===== ======== === =========== +1.00F 26/04/90 NSM First relase +1.10F 07/07/92 NSM Second release +*/ +#ifndef P_QUE_H +#define P_QUE_H + +#include + +#define P_ISEMPTYQ(q) ((q)==(q)->next) +#define P_INITQ(q) (q)->next=(q)->prev=(q) +#define P_DECLAREQ(q) P_QUE q = {&q,&q} +typedef struct p_que +{ +struct p_que *next; /* Next entry */ +struct p_que *prev; /* Previous entry */ +} P_QUE; +typedef struct +{ +P_QUE q; /* Que entry control */ +long int key; /* Delta key value */ +} P_DELTA; +#ifdef __cplusplus +extern "C" { +#endif +#pragma save,call(reg_param =>(si,di),reg_saved =>(ax,cx,dx,si,di,EPOC_SAVE)) +extern void p_enque(P_QUE *,P_QUE *); +extern void p_deque(P_QUE *); +#pragma restore +P_DELTA *p_enqued(P_QUE *,P_DELTA *,long int); +P_DELTA *p_dequed(P_QUE *,P_DELTA *); +#ifdef __cplusplus +} +#endif + +#endif // P_QUE_H diff --git a/code/SIBOSDK/include/p_screen.h b/code/SIBOSDK/include/p_screen.h new file mode 100644 index 0000000..95902ab --- /dev/null +++ b/code/SIBOSDK/include/p_screen.h @@ -0,0 +1,69 @@ +/* HEADER - P_SCREEN.H +Copyright (C) Psion PLC 1991-92 + VER DATE BY DESCRIPTION +===== ======== === =========== +1.00F 26/04/90 NSM First relase +1.10F 07/07/92 NSM Second release +*/ +#ifndef P_SCREEN_H +#define P_SCREEN_H + +#include +#include + +#define P_SCR_ATTRB 0 +#define P_SCR_SCROLL 1 +#define P_SCR_CLR 2 +#define P_SCR_POSA 3 +#define P_SCR_POSR 4 +#define P_SCR_WSET 5 +#define P_SCR_SLOCK 6 +#define P_SCR_WLOCK 7 +#define P_SCR_NEL 8 +#define P_SCR_CURSOR 9 +#define P_SCR_ESCAPE 10 +#define P_SCR_FLUSH 11 +#define P_SCR_CSET 12 +#define P_SCR_NORMAL 0 +#define P_SCR_BOLD 0x01 +#define P_SCR_REVERSE 0x02 +#define P_SCR_UNDLINE 0x04 +#define P_SCR_BLINK 0x08 +#define P_MAXEDITSTR 256 +#define P_FEDIT P_FCTRL /* invoke consol edit */ +#define P_FCONSP1 P_FINQ /* consol spare 1 */ +#define P_FCONSP2 P_FRSUPER /* consol spare 2 */ +#define P_FCONSP3 P_FSTOP /* consol spare 3 */ +#define P_FCONSP4 P_FSTART /* consol spare 4 */ +#define P_FWFLUSH P_FRSUPER +#define P_EVENT_READ P_FSTOP +#define P_EVENT_TEST P_FSTART +#ifndef _P_CEDIT +#define _P_CEDIT +typedef struct /* console driver line editor */ +{ +unsigned char cursorpos; /* initial cursor position */ +unsigned char trap; /* trap input errors or not */ +unsigned char string[P_MAXEDITSTR]; /* buffer to edit */ +} P_CEDIT; +#endif +typedef struct /* line editor control block */ +{ +unsigned char *le_scb; /* screen control block */ +P_RECT le_win; /* window dimensions (relative) */ +char *le_buf; /* edit buffer */ +unsigned char le_len; /* length of edit text */ +unsigned char le_max; /* max length of edit text */ +unsigned char le_pos; /* position of cursor in buffer */ +unsigned char spare; /* keep struct word aligned */ +} P_LECB; +#define P_LE_LEFT 0 +#define P_LE_RIGHT 1 +#define P_LE_UP 2 +#define P_LE_DOWN 3 +#define P_LE_START 4 +#define P_LE_END 5 +#define P_LE_DELETE 6 +#define P_LE_CLR 7 + +#endif // P_SCREEN_H diff --git a/code/SIBOSDK/include/p_serial.h b/code/SIBOSDK/include/p_serial.h new file mode 100644 index 0000000..494e671 --- /dev/null +++ b/code/SIBOSDK/include/p_serial.h @@ -0,0 +1,111 @@ +/* HEADER - P_SERIAL.H +Copyright (C) Psion PLC 1991-92 + VER DATE BY DESCRIPTION +===== ======== === =========== +1.00F 26/04/90 NSM First relase +1.10F 07/07/92 NSM Second release +*/ +#ifndef P_SERIAL_H +#define P_SERIAL_H +#include +#include + +/* Serial port characteristics */ +typedef struct +{ +unsigned char tbaud; /* transmit Baud rate selector */ +unsigned char rbaud; /* receive Baud rate selector */ +unsigned char frame; /* number of data,parity and stop bits */ +unsigned char parity; /* parity selector */ +unsigned char hand; /* handshake flags */ +unsigned char xon; /* XON character */ +unsigned char xoff; /* XOFF character */ +unsigned char flags; /* ignore parity errors/dont drive DTR changing chars */ +unsigned long int tmask; /* terminator mask */ +} P_SRCHAR; +/* Baud rates */ +#define P_BAUD_50 0x01 +#define P_BAUD_75 0x02 +#define P_BAUD_110 0x03 +#define P_BAUD_134 0x04 +#define P_BAUD_150 0x05 +#define P_BAUD_300 0x06 +#define P_BAUD_600 0x07 +#define P_BAUD_1200 0x08 +#define P_BAUD_1800 0x09 +#define P_BAUD_2000 0x0A +#define P_BAUD_2400 0x0B +#define P_BAUD_3600 0x0C +#define P_BAUD_4800 0x0D +#define P_BAUD_7200 0x0E +#define P_BAUD_9600 0x0F +#define P_BAUD_19200 0x10 +#define P_BAUD_38400 0x11 +#define P_BAUD_56000 0x12 +#define P_BAUD_115000 0x13 +/* allocation of frame bits */ +#define P_DATA_FRM 0x0f /* number of data bits mask */ +#define P_DATA_5 0 /* 5 data bits */ +#define P_DATA_6 1 /* 6 data bits */ +#define P_DATA_7 2 /* 7 data bits */ +#define P_DATA_8 3 /* 8 data bits */ +#define P_TWOSTOP 0x10 /* 2 stop bits if set,1 if clear */ +#define P_PARITY 0x20 /* 1 parity bit if set,0 if clear */ +/* parity - ignored unless P_PARITY is set */ +#define P_PAR_EVEN 1 /* even parity */ +#define P_PAR_ODD 2 /* odd parity */ +#define P_PAR_MARK 3 /* mark parity */ +#define P_PAR_SPACE 4 /* space parity */ +/* handshaking control */ +#define P_OBEY_XOFF 0x01 /* respond to received XOFF (and XON) if set */ +#define P_SEND_XOFF 0x02 /* send XOFF/XON to control receive buffer if set */ +#define P_IGN_CTS 0x04 /* ignore the state of CTS if set */ +#define P_OBEY_DSR 0x08 /* obey the state of DSR if set */ +#define P_FAIL_DSR 0x10 /* fail if DSR goes OFF if set */ +#define P_OBEY_DCD 0x20 /* obey the state of DCD if set */ +#define P_FAIL_DCD 0x40 /* fail if DCD goes OFF if set */ +/* flags control */ +#define P_IGNORE_PARITY 0x01 /* ignore parity errors */ +/* For P_FCTRL function */ +#define P_SRCTRL_CTS 0x01 +#define P_SRCTRL_DSR 0x02 +#define P_SRCTRL_DCD 0x04 +#define P_SRCTRL_RTS 0x08 +#define P_SRCTRL_DTR 0x10 +#define P_SRDTR_ON 1 /* to set DTR to MARK */ +#define P_SRDTR_OFF 2 /* to set DTR to SPACE */ +/* Bit masks for P_FINQ function */ +#define P_SRINQ_50 0x0001 +#define P_SRINQ_75 0x0002 +#define P_SRINQ_110 0x0004 +#define P_SRINQ_134 0x0008 +#define P_SRINQ_150 0x0010 +#define P_SRINQ_300 0x0020 +#define P_SRINQ_600 0x0040 +#define P_SRINQ_1200 0x0080 +#define P_SRINQ_1800 0x0100 +#define P_SRINQ_2000 0x0200 +#define P_SRINQ_2400 0x0400 +#define P_SRINQ_3600 0x0800 +#define P_SRINQ_4800 0x1000 +#define P_SRINQ_7200 0x2000 +#define P_SRINQ_9600 0x4000 +#define P_SRINQ_19200 0x8000 +/* second baud rate word */ +#define P_SRINQ_38400 0x0001 +#define P_SRINQ_56000 0x0002 +/* 2nd set of info */ +#define P_SRINQ_DATA5 0x0001 /* supports 5 data bits */ +#define P_SRINQ_DATA6 0x0002 /* supports 6 data bits */ +#define P_SRINQ_DATA7 0x0004 /* supports 7 data bits */ +#define P_SRINQ_DATA8 0x0008 /* supports 8 data bits */ +#define P_SRINQ_STOP2 0x0010 /* supports 2 stop bits (as well as 1) */ +#define P_SRINQ_PAREVEN 0x0020 /* supports even parity */ +#define P_SRINQ_PARODD 0x0040 /* supports odd parity */ +#define P_SRINQ_PARMARK 0x0080 /* supports mark parity */ +#define P_SRINQ_PARSPACE 0x0100 /* supports space parity */ +#define P_SRINQ_SETDTR 0x0200 /* can set DTR */ +#define P_SRINQ_SPLIT 0x400 /* supports split Baud rates */ +#define P_SRINQ_XONXOFF 0x800 /* Supports soft xon/xoff characters */ + +#endif // P_SERIAL_H diff --git a/code/SIBOSDK/include/p_std.h b/code/SIBOSDK/include/p_std.h new file mode 100644 index 0000000..e17618e --- /dev/null +++ b/code/SIBOSDK/include/p_std.h @@ -0,0 +1,350 @@ +/* HEADER - P_STD.H +Copyright (C) Psion PLC 1991-92 + VER DATE BY DESCRIPTION +===== ======== === =========== +1.00F 26/04/90 NSM First relase +1.10F 07/07/92 NSM Second release +*/ +#ifndef P_STD_H +#define P_STD_H + +#include + +#define GLREF_D extern +#define GLDEF_D +#define LOCAL_D static +#define GLREF_C extern +#define LOCAL_C static +#define GLDEF_C +#define CDECL cdecl +#define FOREVER for(;;) +#define TRUE 1 +#define FALSE 0 +#define NULL 0 +#define NULL_D ((VOID *)0) +#define NULL_C ((INT (*)(VOID))0) +#define VOID void +#define FAST register +#define CONST const +#define CLIB_CONST CONST +typedef int INT,HANDLE; +typedef unsigned int UINT; +typedef signed char BYTE; +typedef unsigned char UBYTE; +typedef char TEXT; +typedef short int WORD; +typedef unsigned short int UWORD; +typedef long int LONG; +typedef unsigned long int ULONG; +typedef double DOUBLE; +typedef float FLOAT; +typedef union + { + BYTE *b; UBYTE *ub; INT *i; UINT *ui; WORD *w; + UWORD *uw; LONG *l; ULONG *ul; UBYTE **a; TEXT *t; + } UPTR; +#ifdef __cplusplus +extern "C" { +#endif +#define ENTER_CALL call(reg_param =>(bx,cx,dx,si,di),reg_saved =>(ds,st1,st2)) +#define p_enter1(f) _p_enter1((void *)(f)) +#define p_enter2(f,p1) _p_enter2((void *)(f),(void *)(p1)) +#define p_enter3(f,p1,p2) _p_enter3((void *)(f),(void *)(p1),(void *)(p2)) +#define p_enter4(f,p1,p2,p3) _p_enter4((void *)(f),(void *)(p1),(void *)(p2),(void *)(p3)) +#define p_enter5(f,p1,p2,p3,p4) _p_enter5((void *)(f),(void *)(p1),(void *)(p2),(void *)(p3),(void *)(p4)) +#define p_enter6(f,p1,p2,p3,p4,p5) _p_enter6((void *)(f),(void *)(p1),(void *)(p2),(void *)(p3),(void *)(p4),(void *)(p5)) +extern int cdecl p_ioa(void *,int,short int *,...); +extern void cdecl p_ioc(void *,int,short int *,...); +extern int cdecl p_iow(void *,int,...); +extern int cdecl p_enter(void *,...); +#pragma save,call(reg_param =>(ax,bx,cx,dx,si,di),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE),inline =>on) +static int _p_enter1(void *) = {0xcd,0xd2}; +static int _p_enter2(void *,void *) = {0xcd,0xd2}; +static int _p_enter3(void *,void *,void *) = {0xcd,0xd2}; +static int _p_enter4(void *,void *,void *,void *) = {0xcd,0xd2}; +static int _p_enter5(void *,void *,void *,void *,void *) = {0xcd,0xd2}; +static int _p_enter6(void *,void *,void *,void *,void *,void *) = {0xcd,0xd2}; +#pragma call(reg_param =>(bx,ax,di,cx,dx),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE),inline=>off) +extern int p_ioa3(void *,unsigned char,short int *); +extern int p_ioa4(void *,unsigned char,short int *,void *); +extern int p_ioa5(void *,unsigned char,short int *,void *,void *); +extern void p_ioc3(void *,unsigned char,short int *); +extern void p_ioc4(void *,unsigned char,short int *,void *); +extern void p_ioc5(void *,unsigned char,short int *,void *,void *); +#pragma call(reg_param =>(bx,ax,cx,dx),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int p_iow2(void *,unsigned char); +extern int p_iow3(void *,unsigned char,void *); +extern int p_iow4(void *,unsigned char,void *,void *); +#pragma restore +extern void p_abort(void); +extern void cdecl p_atos(char *,const char *,...); +extern int cdecl p_getflg(char *,char *,...); +extern char * cdecl p_scatm(char *,...); +extern char * cdecl p_scpym(char *,...); +extern int cdecl p_stoa(char **,const char *,...); +#pragma save,call(reg_param =>(cx),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern void *f_alloc(unsigned int); +#pragma restore +extern int f_leave(int); +#pragma save,call(reg_param =>(bx,cx),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern void p_sound(unsigned int,unsigned int); +extern void *f_realloc(void *,unsigned int); +#pragma call(reg_param =>(bx,dx,cx),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern void *p_adjust(void *,unsigned int,int); +#pragma call(reg_param =>(bx),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int p_semcrt(int); +extern void p_semdel(int); +extern unsigned int p_alen(const void *); +extern int p_setpth(const char *); +#pragma restore +extern void p_allchk(int); +#pragma save,call(reg_param =>(cx),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern void *p_alloc(unsigned int); +#pragma call(reg_param =>(di),reg_saved =>(cx,dx,si,di,EPOC_SAVE)) +extern unsigned int p_allspc(void **); +#pragma restore +extern void p_allwalk(void (*)(void *,int,unsigned int),void *); +#pragma save,call(reg_param =>(di,si,bx),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int p_atob(char *,const char *,void *); +#pragma call(reg_param =>(si,cx,di,bx),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int p_bcmp(const void *,int,const void *,int); +extern int p_bcmpi(const char *,int,const char *,int); +#pragma call(reg_param =>(di,si,cx),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern unsigned char *p_bcpy(void *,const void *,unsigned int); +#pragma call(reg_param =>(di,cx,ax),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern unsigned char *p_bfil(void *,unsigned int,int); +#pragma call(reg_param =>(si,cx,ax),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int p_bloc(const void *,int,int); +extern int p_bloci(const char *,int,int); +#pragma call(reg_param =>(si,cx,di,dx),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int p_bmatch(const char *,int,const char *,int); +extern int p_bmatchi(const char *,int,const char *,int); +#pragma restore +extern unsigned char *p_brep(void *,int,const void *,int); +extern int p_bsrch(int,int (*)(int,void *),int *,void *); +#pragma save,call(reg_param =>(si,cx,di,bx),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int p_bsub(const void *,int,const void *,int); +extern int p_bsubi(const char *,int,const char *,int); +#pragma call(reg_param =>(di,si,cx),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern void p_bswap(void *,void *,int); +#pragma call(reg_param =>(di,si,cx),reg_saved =>(bx,dx,si,di,EPOC_SAVE)) +extern void p_ccpy(void *,void *,unsigned int); +#pragma call(reg_param =>(bx,cx,di,si,dx),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int p_chdir(const char *,char *,int,const char *); +extern int p_chdirasync(const char *,char *,int,const char *,short int *); +#pragma call(reg_param =>(bx),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int p_close(void *); +#pragma call(reg_param =>(),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE),reg_return =>(ax,bx)) +extern unsigned long int p_date(void); +#pragma restore +extern void p_dummy(void); +extern void p_decrypt(void *,void *,int); +extern int p_defdev(char *,int); +extern int p_defdir(char *,int); +#pragma save,call(reg_param =>(di,dx),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int p_delenv(const char *); +extern int p_delenviron(const char *,int); +#pragma call(reg_param =>(bx,dx),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int p_delete(const char *); +extern int p_deleteasync(const char *,short int *); +extern int p_setpthasync(const char *,short int *); +extern int p_testpthasync(const char *,short int *); +#pragma restore +extern void p_dummy(void); +extern void p_encrypt(void *,void *,int); +#pragma save,call(reg_param =>(bx,ax),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern void p_nmday(char *,int); +extern void p_nmmon(char *,int); +extern void p_getampmtext(char *,int); +extern void p_errs(char *,int); +#pragma call(reg_param =>(bx),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int p_testpth(const char *); +extern int p_getpth(char *); +extern void p_getsuffixes(char *); +extern void p_exit(int); +extern void p_signal(int); +#pragma call(reg_param =>(bx,cx,di,dx),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int p_fdate(const char *,unsigned long int); +extern int p_fdateasync(const char *,unsigned long int,short int *); +#pragma call(reg_param =>(di,dx,si,cx),reg_saved =>(cx,dx,si,di,EPOC_SAVE)) +extern int p_findenviron(const char *,int,unsigned char *,int *); +#pragma call(reg_param =>(di,si,cx,dx),reg_saved =>(cx,dx,si,di,EPOC_SAVE)) +extern int p_fndenv(const char *,char *,char *,int *); +#pragma call(reg_param =>(bx),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern void p_free(void *); +#pragma restore +extern void p_freemask(void *); +extern unsigned char *p_getcoml(void); +#pragma save,call(reg_param =>(di,si),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int p_getenv(const char *,char *); +#pragma call(reg_param =>(di,dx,si),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int p_getenviron(const char *,int,void *); +#pragma call(reg_param =>(di,bx,dx,cx),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int p_gltob(char *,unsigned long int,int); +#pragma call(reg_param =>(di,bx,cx),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int p_gtob(char *,unsigned int,int); +#pragma restore +extern void p_hdel(void *,char *); +extern unsigned char *p_hfind(void *,char *); +extern int p_hfins(void *,char *,char **); +extern void p_hfree(void *); +extern int p_hinit(void **,int,unsigned int ,int); +extern int p_hins(void *,char *); +extern int p_hvisit(void *,int (*)(char *)); +#pragma save,call(reg_param =>(ax),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern void p_iosignal(void); +extern void p_iowait(void); +extern void p_ioyield(void); +extern int p_isalnum(int); +extern int p_isalpha(int); +extern int p_iscntrl(int); +extern int p_isdigit(int); +extern int p_isgraph(int); +extern int p_islower(int); +extern int p_isprint(int); +extern int p_ispunct(int); +extern int p_isspace(int); +extern int p_isupper(int); +extern int p_isxdigit(int); +#pragma call(reg_param =>(di,bx),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int p_itob(char *,int); +#pragma call(reg_param =>(di,bx,si,cx,dx,ax),reg_saved =>(bx,dx,si,di,EPOC_SAVE)) +extern char *p_jtob(char *,int,char *,int,int,int); +#pragma call(reg_param =>(ax),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern void p_leave(int); +#pragma call(reg_param =>(di,bx,dx),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int p_ltob(char *,long int); +#pragma call(reg_param =>(bx,dx),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int p_mkdir(const char *); +extern int p_mkdirasync(const char *,short int *); +#pragma call(reg_param =>(di,bx,cx),reg_saved =>(bx,cx,si,di,EPOC_SAVE)) +extern int p_open(void **,const char *,unsigned int); +extern int f_open(void **,const char *,unsigned int); +#pragma call(reg_param =>(di,bx,cx),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int p_opent(void **,const char *,unsigned int); +#pragma call(reg_param =>(ax),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern void p_panic(int); +#pragma restore +extern int p_qsort(int,int (*)(int,int,void *),void (*)(int,int,void *),void *); +#pragma save,call(reg_param =>(bx),reg_saved =>(cx,dx,si,di,EPOC_SAVE),reg_return =>(ax,bx)) +extern unsigned long int p_randl(unsigned long int *); +#pragma restore +#pragma save,call(reg_param =>(bx,cx,dx),reg_saved =>(bx,cx,si,di,EPOC_SAVE)) +extern int p_read(void *,void *,unsigned int); +extern int f_read(void *,void *,unsigned int); +#pragma call(reg_param =>(bx,cx),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern void *p_realloc(void *,unsigned int); +#pragma call(reg_param =>(bx,cx,dx),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int p_rename(const char *,const char *); +extern int p_renameasync(const char *,const char *,short int *); +#pragma call(reg_param =>(di,si),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern char *p_scat(char *,const char *); +#pragma call(reg_param =>(si,di),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int p_scmp(const char *,const char *); +extern int p_scmpi(const char *,const char *); +extern void p_sconf(char *); +#pragma call(reg_param =>(di,si),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern char *p_scpy(char *,const char *); +extern char *p_scpyf(char *,const char *); +#pragma call(reg_param =>(bx,cx,dx),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int p_seek(void *,int,long int *); +extern int f_seek(void *,int,long int *); +#pragma call(reg_param =>(di,si),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int p_setenv(const char *,const char *); +#pragma call(reg_param =>(di,dx,si,cx),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int p_setenviron(const char *,int,const void *,int); +#pragma restore +extern int p_setmask(void **,char *); +#pragma save,call(reg_param =>(bx,di,cx,dx),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int p_sfstat(const char *,unsigned int,unsigned int); +extern int p_sfstatasync(const char *,unsigned int,unsigned int,short int *); +#pragma call(reg_param =>(si),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern void p_scap(char *); +extern char *p_skipch(const char *); +extern char *p_skipwh(const char *); +#pragma call(reg_param =>(dx,cx),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int p_sleepa(unsigned long int); +extern int p_sleep(unsigned long int); +extern int p_wkday(unsigned long int); +#pragma call(reg_param =>(di),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern unsigned int p_slen(const char *); +#pragma restore +extern void p_slfclose(void *); +extern int p_slfind(void *,char *,int); +extern int p_slfopen(void **,char *,int); +#pragma save,call(reg_param =>(si,ax),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int p_sloc(const char *,int); +extern int p_sloci(const char *,int); +extern int p_slocr(const char *,int); +extern int p_slocri(const char *,int); +#pragma call(reg_param =>(si,di),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int p_smatch(const char *,const char *); +extern int p_smatchi(const char *,const char *); +#pragma restore +extern char *p_srep(char *,int,const char *); +#pragma save,call(reg_param =>(si,di),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int p_ssub(const char *,const char *); +extern int p_ssubi(const char *,const char *); +#pragma call(reg_param =>(bx,di,cx),reg_saved =>(bx,cx,dx,di,EPOC_SAVE)) +extern int p_stog(char **,unsigned short int *,int); +#pragma call(reg_param =>(dx,di,cx),reg_saved =>(cx,dx,EPOC_SAVE)) +extern int p_stogl(char **,unsigned long int *,int); +#pragma call(reg_param =>(bx,di),reg_saved =>(bx,cx,dx,di,EPOC_SAVE)) +extern int p_stoi(char **,short int *); +#pragma call(reg_param =>(dx,di),reg_saved =>(cx,dx,EPOC_SAVE)) +extern int p_stol(char **,long int *); +#pragma restore +extern int p_strm(void *,int,long int,void *,int); +extern int p_strmf(void *); +extern void p_strmi(void *,int,int (*)(void *,int,void *,int,int),int,void *); +#pragma save,call(reg_param =>(cx,bx),reg_saved =>(bx,cx,si,di,EPOC_SAVE)) +extern int p_svecadd(void *,void *); +#pragma call(reg_param =>(bx,cx),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern void p_sveccall(int,int); +extern void p_svecrem(int); +#pragma call(reg_param =>(ax),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int p_tofold(int); +extern int p_tolower(int); +extern int p_toupper(int); +#pragma restore +extern int p_vradd(void *,void *); +extern int p_vrcnt(void *); +extern int p_vrdel(void *,int); +extern int p_vrfnd(void *,int (*)(void *,void *),void *,short int *); +extern void p_vrfree(void *); +extern void *p_vrinit(unsigned int,unsigned int); +extern int p_vrins(void *,void *,int); +extern int p_vrisq(void *,int (*)(void *,void *),void *,short int *,void *); +extern void *p_vrpnt(void *,int); +extern void p_vrset(void *,int); +extern void p_vrzero(void *); +#pragma save,call(reg_param =>(di),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern void p_waitstat(short int *); +#pragma call(reg_param =>(dx,cx),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int p_weekno(unsigned long int); +#pragma call(reg_param =>(bx,cx,dx),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int p_write(void *,void *,unsigned int); +extern int f_write(void *,void *,unsigned int); +#pragma call(reg_param =>(bx,cx),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int p_sgadjust(int,int); +extern int p_sgclose(int); +#pragma call(reg_param =>(bx,di,dx,si,cx),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int p_sgcopyfr(int,long int,void *,unsigned int); +extern int p_sgcopyto(int,long int,void *,unsigned int); +#pragma call(reg_param =>(bx,cx,ax),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int p_sgcreate(const char *,int,int); +extern int p_sgdelete(const char *); +#pragma call(reg_param =>(bx,di,si),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int p_sgfind(int,const char *,char *); +extern unsigned int p_sgfree(void); +extern void p_sglock(int); +extern void p_sgunlock(int); +extern int p_sgopen(const char *); +extern unsigned int p_sgramdisk(void); +extern unsigned int p_sgsize(int); +#pragma restore +#ifdef __cplusplus +} +#endif + +#endif // P_STD_H \ No newline at end of file diff --git a/code/SIBOSDK/include/p_strm.h b/code/SIBOSDK/include/p_strm.h new file mode 100644 index 0000000..07a9e85 --- /dev/null +++ b/code/SIBOSDK/include/p_strm.h @@ -0,0 +1,27 @@ +/* HEADER - P_STRM.H +Copyright (C) Psion PLC 1991-92 + VER DATE BY DESCRIPTION +===== ======== === =========== +1.00F 26/04/90 NSM First relase +1.10F 07/07/92 NSM Second release +*/ +#ifndef P_STRM_H +#define P_STRM_H + +#include + +#define STRM_READ 0 +#define STRM_WRITE 1 +typedef struct +{ +unsigned int bsiz; /* block size in bytes */ +unsigned int dirty; /* TRUE if active block is dirty */ +unsigned int blk; /* block number currently in buf */ +unsigned int ffblk; /* first free block */ +int (*iovec)(void *,int,void *,int,int); /* block io function */ +void *pcb; /* parameter to block io function */ +unsigned char buf[2]; /* buffer */ +} STRMCB; +#define STRMCBL (sizeof(STRMCB)-2) + +#endif // P_STRM_H diff --git a/code/SIBOSDK/include/p_sys.h b/code/SIBOSDK/include/p_sys.h new file mode 100644 index 0000000..8af7bae --- /dev/null +++ b/code/SIBOSDK/include/p_sys.h @@ -0,0 +1,39 @@ +/* HEADER - P_SYS.H +Copyright (C) Psion PLC 1991-92 + VER DATE BY DESCRIPTION +===== ======== === =========== +1.00F 26/04/90 NSM First relase +1.10F 07/07/92 NSM Second release +*/ +#ifndef P_SYS_H +#define P_SYS_H + +#include + +#define P_ENVMAX 256 /* Max size of an environment string */ +#define P_CMDMAX 258 /* Max buffer size for the input command line */ +#define P_MAXSYSIO 258 /* Max buffer size for p_gets() and p_puts() */ +/* For returning strings from p_getflg */ +typedef struct + { + unsigned short int argc; /* no. of argumets returned */ + unsigned short int argm; /* capacity of address table */ + char **argp; /* address of address table */ + } P_GETFLG; +#ifdef __cplusplus +extern "C" { +#endif +extern void cdecl p_printf(const char *,...); +extern void cdecl p_print(const char *,...); +extern void p_getdat(char *); +extern int p_getch(void); +extern int p_getl(const char *,char *,int); +extern int p_gets(char *); +extern void p_putch(int); +extern void p_puts(const char *); +extern void t_panic(const char *); +#ifdef __cplusplus +} +#endif + +#endif // P_SYS_H diff --git a/code/SIBOSDK/include/p_xmodem.h b/code/SIBOSDK/include/p_xmodem.h new file mode 100644 index 0000000..edc4cce --- /dev/null +++ b/code/SIBOSDK/include/p_xmodem.h @@ -0,0 +1,47 @@ +/* HEADER - P_XMODEM.H +Copyright (C) Psion PLC 1991-92 + VER DATE BY DESCRIPTION +===== ======== === =========== +1.00F 26/04/90 NSM First relase +1.10F 07/07/92 NSM Second release +*/ +#ifndef P_XMODEM_H +#define P_XMODEM_H + +#include + +/* P_FCONNECT service connection modes */ +#define P_XMDM_ACCP 0 /* want link as acceptor */ +#define P_XMDM_INIT 1 /* want link as initiator */ +/* Xmodem/Ymodem link connection types */ +#define P_XMDM_CRCORCHECKSUM 0 +#define P_XMDM_CRCMODE 1 +#define P_XMDM_CHECKSUMMODE 2 +#define P_YMODEM_MODE 3 +#define P_YMODEM_G_MODE 4 +#define P_XMDM_ONE_K 0x8000 +/* Xmodem/Ymodem supported flags */ +#define P_FXMDM_SENSE 0xff /* I/O function number */ +#define P_XSUP_XMODEM 0x01 /* original Xmodem checksum */ +#define P_XSUP_XMODEM_CRC 0x02 /* Xmodem with CRC */ +#define P_XSUP_ONE_K_OPTION 0x04 /* 1k frames */ +#define P_XSUP_YMODEM 0x08 /* Ymodem */ +#define P_XSUP_YMODEM_G 0x10 /* Ymodem-G */ +/* Connection states. */ +#define P_XMDM_IDLE 0 /* idle state (no connection) */ +#define P_XMDM_CONNECT_RECEIVE 1 /* receive connection state */ +#define P_XMDM_CONNECT_TRANSMIT 2 /* transmit connection state */ +#define P_XMDM_DATA_RECEIVE 3 /* recieve data state */ +#define P_XMDM_DATA_TRANSMIT 4 /* transmit data state */ +#define P_XMDM_NLOG 32 /* Max number of debug events,states we record */ +#define P_XMDM_LOG_PANIC 0xC0 /* panic number */ +#define P_XMDM_LOG_COMP 0x40 /* user completion */ +#define P_XMDM_LOG_REQ 0x80 /* user request */ +/* State and event log record */ +typedef struct + { + unsigned char state; + unsigned char event; + } P_XMLOG; + +#endif // P_XMODEM_H diff --git a/code/SIBOSDK/include/p_zmodem.h b/code/SIBOSDK/include/p_zmodem.h new file mode 100644 index 0000000..cd865ec --- /dev/null +++ b/code/SIBOSDK/include/p_zmodem.h @@ -0,0 +1,66 @@ +/* +P_ZMODEM.H - Header file for Zmodem protocol + +Written by John, August 1995 +*/ +#ifndef P_ZMODEM_H +#define P_ZMODEM_H + +/* ZDLE sequences */ +#define ZCRCE 'h' /* CRC next, frame ends, header packet follows */ +#define ZCRCG 'i' /* CRC next, frame continues nonstop */ +#define ZCRCQ 'j' /* CRC next, frame continues, ZACK expected */ +#define ZCRCW 'k' /* CRC next, ZACK expected, end of frame */ +#define ZRUB0 'l' /* Translate to rubout 0177 */ +#define ZRUB1 'm' /* Translate to rubout 0377 */ + +/* Zmodem frame byte defines */ +#define ZPAD 0x2A +#define ZDLE 0x18 +#define ZBIN 0x41 +#define ZHEX 0x42 +#define ZBIN_32 0x43 +#define CAN 0x18 /* Makes the ZDLE choice the worst possible */ + +/* P_FCONNECT service connection modes */ +#define P_ZMDM_RECV 0 /* want link as acceptor/receiver of files */ +#define P_ZMDM_SEND 1 /* want link as initiator/sendor of files */ + +#define P_ZMDM_NLOG 32 /* Max number of debug events,states we record */ +/* Event types */ +#define P_ZMDM_LOG_PANIC 0xC0 /* panic number */ +#define P_ZMDM_LOG_COMP 0x40 /* user completion */ +#define P_ZMDM_LOG_REQ 0x80 /* user request */ + +/* State and event log record */ +typedef struct + { + UBYTE state; + UBYTE event; + } P_ZMLOG; + +#define P_ZM_MAX_BUF 1030 + +/* Frame types that we received */ +#define P_ZM_FRAME_TYPE_RQ_INIT 0 +#define P_ZM_FRAME_TYPE_R_INIT 1 +#define P_ZM_FRAME_TYPE_S_INIT 2 +#define P_ZM_FRAME_TYPE_ACK 3 +#define P_ZM_FRAME_TYPE_FILE 4 +#define P_ZM_FRAME_TYPE_SKIP 5 +#define P_ZM_FRAME_TYPE_NAK 6 +#define P_ZM_FRAME_TYPE_ABORT 7 +#define P_ZM_FRAME_TYPE_FINISH 8 +#define P_ZM_FRAME_TYPE_R_POS 9 +#define P_ZM_FRAME_TYPE_DATA 10 +#define P_ZM_FRAME_TYPE_EOF 11 +#define P_ZM_FRAME_TYPE_FILE_ERR 12 +#define P_ZM_FRAME_TYPE_CRC 13 +#define P_ZM_FRAME_TYPE_CHALLENGE 14 +#define P_ZM_FRAME_TYPE_COMPLETE 15 +#define PSEUDO_IMPLEMENTATION_SPECIFIC_FRAME 16 +#define P_ZM_FRAME_TYPE_FREE_SIZE 17 +#define P_ZM_FRAME_TYPE_COMMAND 18 +#define P_ZM_FRAME_TYPE_STD_ERR 19 + +#endif // P_ZMODEM_H diff --git a/code/SIBOSDK/include/pages.g b/code/SIBOSDK/include/pages.g new file mode 100644 index 0000000..e6f57ab --- /dev/null +++ b/code/SIBOSDK/include/pages.g @@ -0,0 +1,148 @@ +/* Generated by Ctran from pages.cat */ +#define PAGES_G +#ifndef VARRAY_G +#include +#endif +#ifndef APPMAN_G +#include +#endif +#ifndef EPDOC_G +#include +#endif +#ifndef SCRLAY_G +#include +#endif +#ifndef TIME_G +#include +#endif +#ifndef PRDRV_G +#include +#endif +/* Class Numbers */ +#define C_PAGES 8 +/* Method Numbers */ +/* Constants for pages */ +#define PAGES_DONE_PAGE 0 +#define PAGES_DONE_DOC 1 +#define PAGES_DONE_END 2 +#define PAGES_DONE_ERROR 3 +#define PAGES_DOC_NEW_PAGE 0x01 +#define PAGES_DOC_RESET_PAGE_NUM 0x02 +#define PAGES_FLAGS_PRINTING 0x01 +#define PAGES_FLAGS_NOTFIRST 0x02 +#define PAGES_FLAGS_ZERODOWN 0x04 +#define PAGES_REGION_BODY 0 +#define PAGES_REGION_TOP 1 +#define PAGES_REGION_BOTTOM 2 +#define PAGES_REGION_LAST_BOTTOM 3 +#define PAGES_REGION_END 4 +#define PAGES_REGION_VERY_END 5 +#define PAGES_REGION_DOC_END 6 +#define PAGES_PAGENUM_ARABIC 0 +#define PAGES_PAGENUM_ROMAN_U 1 +#define PAGES_PAGENUM_ROMAN_L 2 +#define PAGES_HEADER_2_COLUMNS SCRLAY_ALIGN_JUSTIFY+1 +#define PAGES_HEADER_3_COLUMNS SCRLAY_ALIGN_JUSTIFY+2 +/* Types for pages */ +typedef struct +{ +unsigned short int x; +unsigned short int y; +} UPOINT; +typedef struct +{ +UPOINT tl; +unsigned short int width; +unsigned short int height; +} UEXTENT; +typedef struct +{ +short int event; +unsigned short int page; +PR_VAFLAT *pages; +} PAGES_DONE; +typedef struct +{ +SCRLAY_FONT f; +unsigned char align; +unsigned char first_page; +} PAGES_HEADER; +typedef struct +{ +unsigned short int width; +unsigned short int height; +UEXTENT body; +unsigned short int hdtop; +unsigned short int hdbot; +} PAGES_PAGE; +typedef struct +{ +short int offset; +short int last; +short int style; +} PAGES_PAGENUM; +typedef struct +{ +PAGES_PAGE pg; +short int pdrflags; +short int docflags; +unsigned short int pgbeg; +unsigned short int pgend; +PAGES_HEADER top; +PAGES_HEADER bot; +PAGES_PAGENUM pgnum; +} PAGES_PARAMS; +typedef struct +{ +void *hread; +short int mread; +void *hdone; +short int mdone; +} PAGES_CALLS; +typedef struct +{ +PR_WDR *wdr; +PAGES_CALLS c; +char *fname; +char *toptxt; +char *bottxt; +} PAGES_INIT; +/* Property of pages */ +typedef struct { +PR_VAFLAT *pagarr; +PR_VASEG *todo; +PR_EPFDOC *ephead; +PR_PRNLAY *prhead; +PR_PDR *pdr; +PAGES_INIT in; +PAGES_PARAMS par; +short int last_pos; +unsigned short int flags; +short int pheight; +short int brk_height; +short int brk_above; +unsigned short int brk_pos; +short int y; +short int nrec; +unsigned short int page; +unsigned char reset_page; +unsigned char newdoc; +unsigned char started; +unsigned char newpage; +short int region; +short int holding; +unsigned short int pos; +WDR_PRINT pr; +SCRLAY_TABS tabs; +SCRLAY_SPACING spacing; +SCRLAY_MARGINS margins; +char time[LN_TIME_DATE_STR]; +char date[LN_TIME_TIME_STR-2]; +unsigned short int ioclen; +} PRS_PAGES; +typedef struct pr_pages +{ +PRS_ROOT root; +PRS_ACTIVE active; +PRS_PAGES pages; +} PR_PAGES; diff --git a/code/SIBOSDK/include/pages.ing b/code/SIBOSDK/include/pages.ing new file mode 100644 index 0000000..e1b76f7 --- /dev/null +++ b/code/SIBOSDK/include/pages.ing @@ -0,0 +1,138 @@ +; Generated by Ctran from pages.cl +PAGES_ING equ 1 +IFNDEF VARRAY_ING + INCLUDE ..\inc\VARRAY.ING +ENDIF +IFNDEF APPMAN_ING + INCLUDE ..\inc\APPMAN.ING +ENDIF +IFNDEF EPDOC_ING + INCLUDE ..\inc\EPDOC.ING +ENDIF +IFNDEF SCRLAY_ING + INCLUDE ..\inc\SCRLAY.ING +ENDIF +IFNDEF TIME_ING + INCLUDE ..\inc\TIME.ING +ENDIF +IFNDEF PRDRV_ING + INCLUDE ..\inc\PRDRV.ING +ENDIF +; Class Numbers +C_PAGES equ 8 +; Method Numbers +; Constants for pages +PAGES_DONE_PAGE equ (0) +PAGES_DONE_DOC equ (1) +PAGES_DONE_END equ (2) +PAGES_DONE_ERROR equ (3) +PAGES_DOC_NEW_PAGE equ (001h) +PAGES_DOC_RESET_PAGE_NUM equ (002h) +PAGES_FLAGS_PRINTING equ (001h) +PAGES_FLAGS_NOTFIRST equ (002h) +PAGES_FLAGS_ZERODOWN equ (004h) +PAGES_REGION_BODY equ (0) +PAGES_REGION_TOP equ (1) +PAGES_REGION_BOTTOM equ (2) +PAGES_REGION_LAST_BOTTOM equ (3) +PAGES_REGION_END equ (4) +PAGES_REGION_VERY_END equ (5) +PAGES_REGION_DOC_END equ (6) +PAGES_PAGENUM_ARABIC equ (0) +PAGES_PAGENUM_ROMAN_U equ (1) +PAGES_PAGENUM_ROMAN_L equ (2) +PAGES_HEADER_2_COLUMNS equ (SCRLAY_ALIGN_JUSTIFY+1) +PAGES_HEADER_3_COLUMNS equ (SCRLAY_ALIGN_JUSTIFY+2) +; Types for pages +UPOINT struc +UPOINTX dw ? +UPOINTY dw ? +UPOINT ends +UEXTENT struc +UEXTENTTl UPOINT <> +UEXTENTWidth dw ? +UEXTENTHeight dw ? +UEXTENT ends +PAGES_DONE struc +PAGES_DONEEvent dw ? +PAGES_DONEPage dw ? +PAGES_DONEPages dw ? +PAGES_DONE ends +PAGES_HEADER struc +PAGES_HEADERF SCRLAY_FONT <> +PAGES_HEADERAlign db ? +PAGES_HEADERFirst_page db ? +PAGES_HEADER ends +PAGES_PAGE struc +PAGES_PAGEWidth dw ? +PAGES_PAGEHeight dw ? +PAGES_PAGEBody UEXTENT <> +PAGES_PAGEHdtop dw ? +PAGES_PAGEHdbot dw ? +PAGES_PAGE ends +PAGES_PAGENUM struc +PAGES_PAGENUMOffset dw ? +PAGES_PAGENUMLast dw ? +PAGES_PAGENUMStyle dw ? +PAGES_PAGENUM ends +PAGES_PARAMS struc +PAGES_PARAMSPg PAGES_PAGE <> +PAGES_PARAMSPdrflags dw ? +PAGES_PARAMSDocflags dw ? +PAGES_PARAMSPgbeg dw ? +PAGES_PARAMSPgend dw ? +PAGES_PARAMSTop PAGES_HEADER <> +PAGES_PARAMSBot PAGES_HEADER <> +PAGES_PARAMSPgnum PAGES_PAGENUM <> +PAGES_PARAMS ends +PAGES_CALLS struc +PAGES_CALLSHread dw ? +PAGES_CALLSMread dw ? +PAGES_CALLSHdone dw ? +PAGES_CALLSMdone dw ? +PAGES_CALLS ends +PAGES_INIT struc +PAGES_INITWdr dw ? +PAGES_INITC PAGES_CALLS <> +PAGES_INITFname dw ? +PAGES_INITToptxt dw ? +PAGES_INITBottxt dw ? +PAGES_INIT ends +; Property of pages +PRS_PAGES struc +PagesPagarr dw ? +PagesTodo dw ? +PagesEphead dw ? +PagesPrhead dw ? +PagesPdr dw ? +PagesIn PAGES_INIT <> +PagesPar PAGES_PARAMS <> +PagesLast_pos dw ? +PagesFlags dw ? +PagesPheight dw ? +PagesBrk_height dw ? +PagesBrk_above dw ? +PagesBrk_pos dw ? +PagesY dw ? +PagesNrec dw ? +PagesPage dw ? +PagesReset_page db ? +PagesNewdoc db ? +PagesStarted db ? +PagesNewpage db ? +PagesRegion dw ? +PagesHolding dw ? +PagesPos dw ? +PagesPr WDR_PRINT <> +PagesTabs SCRLAY_TABS <> +PagesSpacing SCRLAY_SPACING <> +PagesMargins SCRLAY_MARGINS <> +PagesTime db (1) * LN_TIME_TIME_STR dup (?) +PagesDate db (1) * LN_TIME_DATE_STR-2 dup (?) +PagesIoclen dw ? +PRS_PAGES ends +PR_PAGES struc +PagesRoot PRS_ROOT <> +PagesActive PRS_ACTIVE <> +PagesPages PRS_PAGES <> +PR_PAGES ends diff --git a/code/SIBOSDK/include/pagesize.h b/code/SIBOSDK/include/pagesize.h new file mode 100644 index 0000000..48fb29f --- /dev/null +++ b/code/SIBOSDK/include/pagesize.h @@ -0,0 +1,20 @@ +/* +PAGESIZE.H +*/ +#define PAGE_WIDTH_A4 11906 /* 210mm */ +#define PAGE_LENGTH_A4 16838 /* 297mm */ +#define PAGE_WIDTH_LEGAL 12240 /* 8.5in */ +#define PAGE_LENGTH_LEGAL 20160 /* 14in */ +#define PAGE_WIDTH_EXECUTIVE 10440 /* 7.25in */ +#define PAGE_LENGTH_EXECUTIVE 15120 /* 10.5in */ +#define PAGE_WIDTH_LETTER 12240 /* 8.5in */ +#define PAGE_LENGTH_LETTER 15840 /* 11in */ +#define PAGE_WIDTH_COM_10 5940 /* 4.125in */ +#define PAGE_LENGTH_COM_10 13680 /* 9.5in */ +#define PAGE_WIDTH_MONARCH 5580 /* 3.825in */ +#define PAGE_LENGTH_MONARCH 10800 /* 7.5in */ +#define PAGE_WIDTH_DL 6236 /* 110mm */ +#define PAGE_LENGTH_DL 12472 /* 220mm */ +#define PAGE_WIDTH_C5 9184 /* 162mm */ +#define PAGE_LENGTH_C5 12983 /* 229mm */ + diff --git a/code/SIBOSDK/include/plib.h b/code/SIBOSDK/include/plib.h new file mode 100644 index 0000000..1a133ac --- /dev/null +++ b/code/SIBOSDK/include/plib.h @@ -0,0 +1,23 @@ +/* HEADER - PLIB.H +Copyright (C) Psion PLC 1991-92 + VER DATE BY DESCRIPTION +===== ======== === =========== +1.00F 26/04/90 NSM First relase +1.10F 07/07/92 NSM Second release +*/ +#ifndef PLIB_H +#define PLIB_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif // PLIB_H \ No newline at end of file diff --git a/code/SIBOSDK/include/pmodlocs.g b/code/SIBOSDK/include/pmodlocs.g new file mode 100644 index 0000000..529b1f3 --- /dev/null +++ b/code/SIBOSDK/include/pmodlocs.g @@ -0,0 +1,21 @@ +/* Generated by Ctran from pmodlocs.cl */ +#define PMODLOCS_G +#ifndef FACTIVE_G +#include +#endif +#ifndef PRNTDLGS_G +#include +#endif +/* Class Numbers */ +#define C_PMODLOCS 73 +/* Method Numbers */ +/* Property of pmodlocs */ +typedef struct { +PR_PRNMODEL *dl; +} PRS_PMODLOCS; +typedef struct pr_pmodlocs +{ +PRS_ROOT root; +PRS_LOCS locs; +PRS_PMODLOCS pmodlocs; +} PR_PMODLOCS; diff --git a/code/SIBOSDK/include/pmodlocs.ing b/code/SIBOSDK/include/pmodlocs.ing new file mode 100644 index 0000000..e5eae88 --- /dev/null +++ b/code/SIBOSDK/include/pmodlocs.ing @@ -0,0 +1,20 @@ +; Generated by Ctran from pmodlocs.cl +PMODLOCS_ING equ 1 +IFNDEF FACTIVE_ING + INCLUDE ..\inc\FACTIVE.ING +ENDIF +IFNDEF PRNTDLGS_ING + INCLUDE ..\inc\PRNTDLGS.ING +ENDIF +; Class Numbers +C_PMODLOCS equ 73 +; Method Numbers +; Property of pmodlocs +PRS_PMODLOCS struc +PmodlocsDl dw ? +PRS_PMODLOCS ends +PR_PMODLOCS struc +PmodlocsRoot PRS_ROOT <> +PmodlocsLocs PRS_LOCS <> +PmodlocsPmodlocs PRS_PMODLOCS <> +PR_PMODLOCS ends diff --git a/code/SIBOSDK/include/polytext.g b/code/SIBOSDK/include/polytext.g new file mode 100644 index 0000000..c37f441 --- /dev/null +++ b/code/SIBOSDK/include/polytext.g @@ -0,0 +1,107 @@ +/* Generated by Ctran from polytext.cat */ +#define POLYTEXT_G +#ifndef P_STD_H +#include +#endif +#ifndef P_OBJECT_H +#include +#endif +#ifndef VARRAY_G +#include +#endif +/* Class Numbers */ +#define C_PTROOT 12 +#define C_PTSEG 13 +#define C_PTFLAT 14 +/* Method Numbers */ +#define O_PT_RESET 2 +#define O_PT_MOD_BY_ATTRIB 11 +#define O_PT_ADD_PHRASE 6 +#define O_PT_DISPLAY_LINE 8 +#define O_PT_INIT 1 +#define O_PT_PUT_LINTAB 4 +#define O_PT_INQUIRE 13 +#define O_PT_WRAP 7 +#define O_PT_MOD_BY_NUM 10 +#define O_PT_PBUF 5 +#define O_PT_FIND 12 +#define O_PT_APPEND 3 +#define O_PT_SET_FONTS 9 +/* Constants for ptroot */ +#define PT_FIND_DEFAULT 0x0000 +#define PT_FIND_BACKWARDS 0x0001 +#define PT_FIND_CAN_STAY 0x0002 +#define PT_STY_DEFAULT 0x00 +#define PT_STY_BREAK_AT_START 0x01 +#define PT_STY_BREAK_AT_END 0x02 +#define PT_STY_OSTRIKE_XLEFT 0x20 +#define PT_STY_OSTRIKE_XRIGHT 0x40 +#define PT_STY_OVERSTRIKE 0x80 +#define PT_MAX_PHRASE_LEN 236 +#define PT_DESCR_MOD_FONT 0x0001 +#define PT_DESCR_MOD_WS_STYLE 0x0002 +#define PT_DESCR_MOD_PT_STYLE 0x0004 +#define PT_DESCR_MOD_ATTRIB 0x0008 +#define PT_DESCR_MOD_TLEN 0x0010 +/* Types for ptroot */ +typedef struct +{ +unsigned short int font_id; +unsigned char attrib; +} PT_FONT_SPEC; +typedef struct +{ +int line; +int offset; +int width; +} PT_PHRASE_INFO; +typedef struct +{ +unsigned short int font_id; +unsigned char ws_style; +unsigned char pt_style; +unsigned char attrib; +unsigned char tlen; +} PT_PHRASE_DESCR; +typedef struct +{ +PT_PHRASE_DESCR descr; +char txt[1]; +} PT_PHRASE; +/* Property of ptroot */ +typedef struct { +unsigned int nphrases; +unsigned int nchars; +unsigned int nlines; +unsigned int wwidth; +unsigned int lmargin; +unsigned int ascent; +} PRS_PTROOT; +typedef struct pr_ptroot +{ +PRS_ROOT root; +PRS_PTROOT ptroot; +} PR_PTROOT; +/* Property of ptseg */ +typedef struct { +PR_VAXVAR *phrases; +} PRS_PTSEG; +typedef struct pr_ptseg +{ +PRS_ROOT root; +PRS_PTROOT ptroot; +PRS_PTSEG ptseg; +} PR_PTSEG; +/* Property of ptflat */ +typedef struct { +unsigned char *buffer; +unsigned short int bufsize; +unsigned short int granularity; +unsigned short int nextoff; +} PRS_PTFLAT; +typedef struct pr_ptflat +{ +PRS_ROOT root; +PRS_PTROOT ptroot; +PRS_PTFLAT ptflat; +} PR_PTFLAT; diff --git a/code/SIBOSDK/include/polytext.ing b/code/SIBOSDK/include/polytext.ing new file mode 100644 index 0000000..f0b652b --- /dev/null +++ b/code/SIBOSDK/include/polytext.ing @@ -0,0 +1,100 @@ +; Generated by Ctran from polytext.cl +POLYTEXT_ING equ 1 +IFNDEF P_STD_INC + INCLUDE ..\inc\P_STD.INC +ENDIF +IFNDEF P_OBJECT_INC + INCLUDE ..\inc\P_OBJECT.INC +ENDIF +IFNDEF VARRAY_ING + INCLUDE ..\inc\VARRAY.ING +ENDIF +; Class Numbers +C_PTROOT equ 12 +C_PTSEG equ 13 +C_PTFLAT equ 14 +; Method Numbers +O_PT_RESET equ 2 +O_PT_MOD_BY_ATTRIB equ 11 +O_PT_ADD_PHRASE equ 6 +O_PT_DISPLAY_LINE equ 8 +O_PT_INIT equ 1 +O_PT_PUT_LINTAB equ 4 +O_PT_INQUIRE equ 13 +O_PT_WRAP equ 7 +O_PT_MOD_BY_NUM equ 10 +O_PT_PBUF equ 5 +O_PT_FIND equ 12 +O_PT_APPEND equ 3 +O_PT_SET_FONTS equ 9 +; Constants for ptroot +PT_FIND_DEFAULT equ (00000h) +PT_FIND_BACKWARDS equ (00001h) +PT_FIND_CAN_STAY equ (00002h) +PT_STY_DEFAULT equ (000h) +PT_STY_BREAK_AT_START equ (001h) +PT_STY_BREAK_AT_END equ (002h) +PT_STY_OSTRIKE_XLEFT equ (020h) +PT_STY_OSTRIKE_XRIGHT equ (040h) +PT_STY_OVERSTRIKE equ (080h) +PT_MAX_PHRASE_LEN equ (236) +PT_DESCR_MOD_FONT equ (00001h) +PT_DESCR_MOD_WS_STYLE equ (00002h) +PT_DESCR_MOD_PT_STYLE equ (00004h) +PT_DESCR_MOD_ATTRIB equ (00008h) +PT_DESCR_MOD_TLEN equ (00010h) +; Types for ptroot +PT_FONT_SPEC struc +PT_FONT_SPECFont_id dw ? +PT_FONT_SPECAttrib db ? +PT_FONT_SPEC ends +PT_PHRASE_INFO struc +PT_PHRASE_INFOLine dw ? +PT_PHRASE_INFOOffset dw ? +PT_PHRASE_INFOWidth dw ? +PT_PHRASE_INFO ends +PT_PHRASE_DESCR struc +PT_PHRASE_DESCRFont_id dw ? +PT_PHRASE_DESCRWs_style db ? +PT_PHRASE_DESCRPt_style db ? +PT_PHRASE_DESCRAttrib db ? +PT_PHRASE_DESCRTlen db ? +PT_PHRASE_DESCR ends +PT_PHRASE struc +PT_PHRASEDescr PT_PHRASE_DESCR <> +PT_PHRASETxt db (1) * 1 dup (?) +PT_PHRASE ends +; Property of ptroot +PRS_PTROOT struc +PtrootNphrases dw ? +PtrootNchars dw ? +PtrootNlines dw ? +PtrootWwidth dw ? +PtrootLmargin dw ? +PtrootAscent dw ? +PRS_PTROOT ends +PR_PTROOT struc +PtrootRoot PRS_ROOT <> +PtrootPtroot PRS_PTROOT <> +PR_PTROOT ends +; Property of ptseg +PRS_PTSEG struc +PtsegPhrases dw ? +PRS_PTSEG ends +PR_PTSEG struc +PtsegRoot PRS_ROOT <> +PtsegPtroot PRS_PTROOT <> +PtsegPtseg PRS_PTSEG <> +PR_PTSEG ends +; Property of ptflat +PRS_PTFLAT struc +PtflatBuffer dw ? +PtflatBufsize dw ? +PtflatGranularity dw ? +PtflatNextoff dw ? +PRS_PTFLAT ends +PR_PTFLAT struc +PtflatRoot PRS_ROOT <> +PtflatPtroot PRS_PTROOT <> +PtflatPtflat PRS_PTFLAT <> +PR_PTFLAT ends diff --git a/code/SIBOSDK/include/prdrv.g b/code/SIBOSDK/include/prdrv.g new file mode 100644 index 0000000..e757ca3 --- /dev/null +++ b/code/SIBOSDK/include/prdrv.g @@ -0,0 +1,205 @@ +/* Generated by Ctran from prdrv.cat */ +#define PRDRV_G +#ifndef P_FILE_H +#include +#endif +#ifndef APPMAN_G +#include +#endif +/* Class Numbers */ +#define C_WDR 6 +#define C_PDR 7 +/* Method Numbers */ +#define O_WDR_SEARCH_TYPEFACE 7 +#define O_PDR_PAGE 7 +#define O_WDR_TYPEFACE 6 +#define O_PDR_STYLE 12 +#define O_PDR_PRINT 2 +#define O_WDR_TWIPS_TO_XY 12 +#define O_WDR_FONT_HEIGHT 8 +#define O_WDR_SENSE_MODEL 5 +#define O_WDR_SET_MODEL 4 +#define O_WDR_SENSE_WIDTH 11 +#define O_WDR_COUNT_MODELS 2 +#define O_PDR_END 6 +#define O_PDR_TEXT 8 +#define O_PDR_DESTROY 4 +#define O_PDR_START 5 +#define O_PDR_INIT 1 +#define O_WDR_INIT 1 +#define O_PDR_RIGHT 10 +#define O_PDR_ADD_COMMAND 3 +#define O_WDR_GET_WIDTH_TABLE 10 +#define O_WDR_OPEN_PRINT 13 +#define O_WDR_LOAD_RECORD 14 +#define O_WDR_SEARCH_HEIGHT 9 +#define O_PDR_FONT 11 +#define O_WDR_SENSE_MODEL_NAME 3 +#define O_PDR_LINE 9 +/* Constants for wdr */ +#define WDR_PRINT_PAGE 0x01 +#define WDR_PRINT_LINE 0x02 +#define WDR_PRINT_RIGHT 0x04 +#define WDR_PRINT_FONT 0x08 +#define WDR_PRINT_TEXT 0x10 +#define WDR_PRINT_START 0x20 +#define WDR_PRINT_END 0x40 +#define WDR_PRINT_IDLE 0x4000 +#define WDR_PRINT_KEEP 0x8000 +#define WDR_PDR_LANDSCAPE 0x01 +#define WDR_RSC_HEADER 1 +#define WDR_RSC_COMMANDS 2 +#define WDR_DYL_LOAD 0x01 +#define WDR_HP_PCL 0x02 +#define WDR_STYLE_NORMAL 0x0000 +#define WDR_STYLE_UNDERLINE 0x0001 +#define WDR_STYLE_BOLD 0x0002 +#define WDR_STYLE_ITALIC 0x0004 +#define WDR_STYLE_SUPER 0x0008 +#define WDR_STYLE_SUB 0x0010 +#define WDR_STYLE_MONOSPACE 0x8000 +#define WDR_STYLE_SANS_SERIF 0x4000 +#define WDR_TYPF_PROPORTIONAL 0x01 +#define WDR_TYPF_SCALED 0x02 +#define WDR_TYPF_SERIF 0x04 +#define WDR_MODEL_LANDSCAPE_AVAILABLE 1 +#define WDR_MODEL_MINX_IS_DOTS_PER_INCH 4 +#define WDR_SCALE_DEFAULT_HEIGHT 1000 +#define WDR_FONT_NAME_LEN 20 +#define PRINTER_NAME_LEN 24 +#define PRINT_TYPE_LEN 9 +#define PDR_FILE_LEN 9 +/* Types for wdr */ +typedef struct +{ +unsigned short int height; +unsigned short int height_max; +unsigned short int height_delta; +unsigned short int width_scale; +unsigned short int width_normal; +unsigned short int width_italic; +unsigned short int width_bold; +unsigned short int width_bold_italic; +unsigned short int command; +} WDR_FONT; +typedef struct +{ +char name[WDR_FONT_NAME_LEN]; +unsigned short int typeface; +unsigned short int type; +short int trans_rid; +unsigned short int num_heights; +WDR_FONT font[1]; +} WDR_TYPEFACE; +typedef struct +{ +unsigned short int minx; +unsigned short int miny; +unsigned short int skipx; +unsigned short int skipy; +unsigned short int flags; +unsigned short int num_typefaces; +WDR_TYPEFACE *typeface[1]; +} WDR_MODEL; +typedef struct +{ +unsigned short int rid; +char name[PRINTER_NAME_LEN]; +} WDR_MODEL_INDEX; +typedef struct +{ +char id[6]; +unsigned short int flags; +unsigned short int num_model; +WDR_MODEL_INDEX model[1]; +} WDR_HEADER; +typedef struct width_table +{ +struct width_table *next; +unsigned short int rid; +unsigned short int height; +unsigned char *table; +} WDR_WIDTH_TABLE; +typedef struct +{ +short int flags; +short int typf; +short int fheight; +short int style; +short int down; +short int indent; +short int height; +short int right; +char *buf; +unsigned short int blen; +} WDR_PRINT; +/* Property of wdr */ +typedef struct { +PR_RSCFILE *file; +WDR_HEADER *head; +WDR_MODEL *model; +WDR_WIDTH_TABLE *wid; +char wdrname[P_FNAMESIZE]; +} PRS_WDR; +typedef struct pr_wdr +{ +PRS_ROOT root; +PRS_WDR wdr; +} PR_WDR; +/* Constants for pdr */ +#define PDR_CMD_RESET 0 +#define PDR_CMD_FORM_LENGTH 1 +#define PDR_CMD_PREAMBLE 2 +#define PDR_CMD_POSTAMBLE 3 +#define PDR_CMD_UNDERLINE_ON 4 +#define PDR_CMD_UNDERLINE_OFF 5 +#define PDR_CMD_BOLD_ON 6 +#define PDR_CMD_BOLD_OFF 7 +#define PDR_CMD_ITALIC_ON 8 +#define PDR_CMD_ITALIC_OFF 9 +#define PDR_CMD_SUPERSCRIPT_ON 10 +#define PDR_CMD_SUPERSCRIPT_OFF 11 +#define PDR_CMD_SUBSCRIPT_ON 12 +#define PDR_CMD_SUBSCRIPT_OFF 13 +#define PDR_CMD_NEW_PAGE 14 +#define PDR_CMD_CARRIAGE_RETURN 15 +#define PDR_CMD_MOVE_DOWN 16 +#define PDR_CMD_MOVE_RIGHT_PREFIX 17 +#define PDR_CMD_MOVE_RIGHT 18 +#define PDR_CMD_MOVE_RIGHT_SUFFIX 19 +#define PDR_CMD_LANDSCAPE 20 +/* Types for pdr */ +typedef struct +{ +PR_WDR *wdr; +short int flags; +short int page_length; +int dyl; +WDR_HEADER *head; +WDR_MODEL *model; +} PDR_INIT; +typedef struct +{ +unsigned char *commands; +unsigned char *outbuf; +unsigned char *trans_res; +char **tix; +} PDR_ALLOC; +/* Property of pdr */ +typedef struct { +PDR_INIT par; +unsigned short int mode; +short int typfix; +short int fhix; +short int style; +short int lheight; +PDR_ALLOC a; +unsigned short int trans_rid; +short int outlen; +unsigned short int skipy; +} PRS_PDR; +typedef struct pr_pdr +{ +PRS_ROOT root; +PRS_PDR pdr; +} PR_PDR; diff --git a/code/SIBOSDK/include/prdrv.ing b/code/SIBOSDK/include/prdrv.ing new file mode 100644 index 0000000..cbb0c39 --- /dev/null +++ b/code/SIBOSDK/include/prdrv.ing @@ -0,0 +1,194 @@ +; Generated by Ctran from prdrv.cl +PRDRV_ING equ 1 +IFNDEF P_FILE_INC + INCLUDE ..\inc\P_FILE.INC +ENDIF +IFNDEF APPMAN_ING + INCLUDE ..\inc\APPMAN.ING +ENDIF +; Class Numbers +C_WDR equ 6 +C_PDR equ 7 +; Method Numbers +O_WDR_SEARCH_TYPEFACE equ 7 +O_PDR_PAGE equ 7 +O_WDR_TYPEFACE equ 6 +O_PDR_STYLE equ 12 +O_PDR_PRINT equ 2 +O_WDR_TWIPS_TO_XY equ 12 +O_WDR_FONT_HEIGHT equ 8 +O_WDR_SENSE_MODEL equ 5 +O_WDR_SET_MODEL equ 4 +O_WDR_SENSE_WIDTH equ 11 +O_WDR_COUNT_MODELS equ 2 +O_PDR_END equ 6 +O_PDR_TEXT equ 8 +O_PDR_DESTROY equ 4 +O_PDR_START equ 5 +O_PDR_INIT equ 1 +O_WDR_INIT equ 1 +O_PDR_RIGHT equ 10 +O_PDR_ADD_COMMAND equ 3 +O_WDR_GET_WIDTH_TABLE equ 10 +O_WDR_OPEN_PRINT equ 13 +O_WDR_LOAD_RECORD equ 14 +O_WDR_SEARCH_HEIGHT equ 9 +O_PDR_FONT equ 11 +O_WDR_SENSE_MODEL_NAME equ 3 +O_PDR_LINE equ 9 +; Constants for wdr +WDR_PRINT_PAGE equ (001h) +WDR_PRINT_LINE equ (002h) +WDR_PRINT_RIGHT equ (004h) +WDR_PRINT_FONT equ (008h) +WDR_PRINT_TEXT equ (010h) +WDR_PRINT_START equ (020h) +WDR_PRINT_END equ (040h) +WDR_PRINT_IDLE equ (04000h) +WDR_PRINT_KEEP equ (08000h) +WDR_PDR_LANDSCAPE equ (001h) +WDR_RSC_HEADER equ (1) +WDR_RSC_COMMANDS equ (2) +WDR_DYL_LOAD equ (001h) +WDR_HP_PCL equ (002h) +WDR_STYLE_NORMAL equ (00000h) +WDR_STYLE_UNDERLINE equ (00001h) +WDR_STYLE_BOLD equ (00002h) +WDR_STYLE_ITALIC equ (00004h) +WDR_STYLE_SUPER equ (00008h) +WDR_STYLE_SUB equ (00010h) +WDR_STYLE_MONOSPACE equ (08000h) +WDR_STYLE_SANS_SERIF equ (04000h) +WDR_TYPF_PROPORTIONAL equ (001h) +WDR_TYPF_SCALED equ (002h) +WDR_TYPF_SERIF equ (004h) +WDR_MODEL_LANDSCAPE_AVAILABLE equ (1) +WDR_MODEL_MINX_IS_DOTS_PER_INCH equ (4) +WDR_SCALE_DEFAULT_HEIGHT equ (1000) +WDR_FONT_NAME_LEN equ (20) +PRINTER_NAME_LEN equ (24) +PRINT_TYPE_LEN equ (9) +PDR_FILE_LEN equ (9) +; Types for wdr +WDR_FONT struc +WDR_FONTHeight dw ? +WDR_FONTHeight_max dw ? +WDR_FONTHeight_delta dw ? +WDR_FONTWidth_scale dw ? +WDR_FONTWidth_normal dw ? +WDR_FONTWidth_italic dw ? +WDR_FONTWidth_bold dw ? +WDR_FONTWidth_bold_italic dw ? +WDR_FONTCommand dw ? +WDR_FONT ends +WDR_TYPEFACE struc +WDR_TYPEFACEName db (1) * WDR_FONT_NAME_LEN dup (?) +WDR_TYPEFACETypeface dw ? +WDR_TYPEFACEType dw ? +WDR_TYPEFACETrans_rid dw ? +WDR_TYPEFACENum_heights dw ? +WDR_TYPEFACEFont db (size WDR_FONT)* 1 dup (?) +WDR_TYPEFACE ends +WDR_MODEL struc +WDR_MODELMinx dw ? +WDR_MODELMiny dw ? +WDR_MODELSkipx dw ? +WDR_MODELSkipy dw ? +WDR_MODELFlags dw ? +WDR_MODELNum_typefaces dw ? +WDR_MODELTypeface dw 1 dup (?) +WDR_MODEL ends +WDR_MODEL_INDEX struc +WDR_MODEL_INDEXRid dw ? +WDR_MODEL_INDEXName db (1) * PRINTER_NAME_LEN dup (?) +WDR_MODEL_INDEX ends +WDR_HEADER struc +WDR_HEADERId db (1) * 6 dup (?) +WDR_HEADERFlags dw ? +WDR_HEADERNum_model dw ? +WDR_HEADERModel db (size WDR_MODEL_INDEX)* 1 dup (?) +WDR_HEADER ends +WDR_WIDTH_TABLE struc +WDR_WIDTH_TABLENext dw ? +WDR_WIDTH_TABLERid dw ? +WDR_WIDTH_TABLEHeight dw ? +WDR_WIDTH_TABLETable dw ? +WDR_WIDTH_TABLE ends +WDR_PRINT struc +WDR_PRINTFlags dw ? +WDR_PRINTTypf dw ? +WDR_PRINTFheight dw ? +WDR_PRINTStyle dw ? +WDR_PRINTDown dw ? +WDR_PRINTIndent dw ? +WDR_PRINTHeight dw ? +WDR_PRINTRight dw ? +WDR_PRINTBuf dw ? +WDR_PRINTBlen dw ? +WDR_PRINT ends +; Property of wdr +PRS_WDR struc +WdrFile dw ? +WdrHead dw ? +WdrModel dw ? +WdrWid dw ? +WdrWdrname db (1) * P_FNAMESIZE dup (?) +PRS_WDR ends +PR_WDR struc +WdrRoot PRS_ROOT <> +WdrWdr PRS_WDR <> +PR_WDR ends +; Constants for pdr +PDR_CMD_RESET equ (0) +PDR_CMD_FORM_LENGTH equ (1) +PDR_CMD_PREAMBLE equ (2) +PDR_CMD_POSTAMBLE equ (3) +PDR_CMD_UNDERLINE_ON equ (4) +PDR_CMD_UNDERLINE_OFF equ (5) +PDR_CMD_BOLD_ON equ (6) +PDR_CMD_BOLD_OFF equ (7) +PDR_CMD_ITALIC_ON equ (8) +PDR_CMD_ITALIC_OFF equ (9) +PDR_CMD_SUPERSCRIPT_ON equ (10) +PDR_CMD_SUPERSCRIPT_OFF equ (11) +PDR_CMD_SUBSCRIPT_ON equ (12) +PDR_CMD_SUBSCRIPT_OFF equ (13) +PDR_CMD_NEW_PAGE equ (14) +PDR_CMD_CARRIAGE_RETURN equ (15) +PDR_CMD_MOVE_DOWN equ (16) +PDR_CMD_MOVE_RIGHT_PREFIX equ (17) +PDR_CMD_MOVE_RIGHT equ (18) +PDR_CMD_MOVE_RIGHT_SUFFIX equ (19) +PDR_CMD_LANDSCAPE equ (20) +; Types for pdr +PDR_INIT struc +PDR_INITWdr dw ? +PDR_INITFlags dw ? +PDR_INITPage_length dw ? +PDR_INITDyl dw ? +PDR_INITHead dw ? +PDR_INITModel dw ? +PDR_INIT ends +PDR_ALLOC struc +PDR_ALLOCCommands dw ? +PDR_ALLOCOutbuf dw ? +PDR_ALLOCTrans_res dw ? +PDR_ALLOCTix dw ? +PDR_ALLOC ends +; Property of pdr +PRS_PDR struc +PdrPar PDR_INIT <> +PdrMode dw ? +PdrTypfix dw ? +PdrFhix dw ? +PdrStyle dw ? +PdrLheight dw ? +PdrA PDR_ALLOC <> +PdrTrans_rid dw ? +PdrOutlen dw ? +PdrSkipy dw ? +PRS_PDR ends +PR_PDR struc +PdrRoot PRS_ROOT <> +PdrPdr PRS_PDR <> +PR_PDR ends diff --git a/code/SIBOSDK/include/prev.g b/code/SIBOSDK/include/prev.g new file mode 100644 index 0000000..2d63b5f --- /dev/null +++ b/code/SIBOSDK/include/prev.g @@ -0,0 +1,164 @@ +/* Generated by Ctran from prev.cl */ +#define PREV_G +#ifndef HWIMMAN_G +#include +#endif +#ifndef GATE_G +#include +#endif +#ifndef DLGBOX_G +#include +#endif +#ifndef PRVPDR_G +#include +#endif +#ifndef PAGES_G +#include +#endif +/* Class Numbers */ +#define C_PRVINFO 0 +#define C_PRVVIEW 1 +#define C_PRVPAGE 2 +#define C_PRVCOMM 3 +#define C_PRVJUMP_DLG 4 +#define C_PRVOPTIONS_DLG 5 +/* Method Numbers */ +#define O_PVV_NEW_PAGE 16 +#define O_PVV_PAGES_DONE 15 +#define O_PVC_PREVIEW_EXIT 12 +#define O_PVP_MARGINS 14 +#define O_PVV_MARGINS 17 +#define O_PVV_FALSE 19 +#define O_PVV_DONE 14 +#define O_PVC_PREVIEW_PRINT 8 +#define O_PVC_PREVIEW_OPTIONS 10 +#define O_PVC_PREVIEW_MARGINS 9 +#define O_PVV_INIT 18 +#define O_PVC_PREVIEW_JUMP 11 +/* Property of prvinfo */ +typedef struct { +int NoPages; +unsigned short int FontHeight; +unsigned short int FontAscent; +} PRS_PRVINFO; +typedef struct pr_prvinfo +{ +PRS_ROOT root; +PRS_WIN win; +PRS_PRVINFO prvinfo; +} PR_PRVINFO; +/* Constants for prvview */ +#define PVV_INTERPAGE_GAP 6 +#define PVV_TOP_GAP 4 +#define PVV_FOOTER_GAP 12 +#define PVV_PAGE_SHADOW 1 +#define PVV_SIDE_GAP 12 +#define PVV_PAGENO_DISP_GAP 60 +#define PVV_DISP_FACING 0 +#define PVV_DISP1 1 +#define PVV_DISP2 2 +#define PVV_DISP3 3 +#define PVV_DISP4 4 +#define PVV_MARGINS_ON 0x01 +#define PVV_PREVIEW_SET 0x80 +#define PVV_VIEW_MAX_PAGEVIEWS 4 +/* Types for prvview */ +typedef struct +{ +PAGES_CALLS Calls; +short int PrintMethod; +short int Spare1; +short int Spare2; +} IN_PRVVIEW; +typedef struct +{ +P_RECT Margins; +int HeadTop; +int HeadBot; +P_RECT Border; +P_RECT Footer; +} PVV_PAGE_DATA; +typedef struct +{ +PR_ROOT *pArray; +int NoPages; +int FirstPage; +int LastPage; +int PageOffset; +int PageNo; +PVV_DISPLAY Disp; +int UseGrey; +int LeftOffset; +int PageViewWidth; +PVV_PAGE_DATA Page; +unsigned char *pBitRow; +unsigned char *pLastRow; +BMP_RASTER_ROW_REC *pRowRec; +int PrvSegHandle; +PRV_BITMAP Bmp; +} PVV_PAGEVIEW_DATA; +/* Property of prvview */ +typedef struct { +PR_PAGES *pPages; +PR_PRVINFO *pPrvInfo; +PR_ROOT *pPageView[PVV_VIEW_MAX_PAGEVIEWS]; +WSERV_INFO *pOldMenu; +PR_COMMAN *pOldComman; +short int Started; +short int PrintMethod; +void *hdone; +short int mdone; +int NoPageViews; +int MaxNoPageViews; +P_RECT ScrollArea; +PVV_PAGEVIEW_DATA Pv; +} PRS_PRVVIEW; +typedef struct pr_prvview +{ +PRS_ROOT root; +PRS_WIN win; +PRS_DLGCHAIN dlgchain; +PRS_PRVVIEW prvview; +} PR_PRVVIEW; +/* Types for prvpage */ +typedef struct +{ +PR_PRVVIEW *pPrvView; +int Pos; +unsigned short int wid; +} IN_PRVPAGE; +/* Property of prvpage */ +typedef struct { +IN_PRVPAGE init; +} PRS_PRVPAGE; +typedef struct pr_prvpage +{ +PRS_ROOT root; +PRS_WIN win; +PRS_PRVPAGE prvpage; +} PR_PRVPAGE; +/* Property of prvcomm */ +typedef struct { +PR_PRVVIEW *pPrvView; +} PRS_PRVCOMM; +typedef struct pr_prvcomm +{ +PRS_ROOT root; +PRS_PRVCOMM prvcomm; +} PR_PRVCOMM; +/* Property of prvjump_dlg */ +typedef struct pr_prvjump_dlg +{ +PRS_ROOT root; +PRS_WIN win; +PRS_DLGCHAIN dlgchain; +PRS_DLGBOX dlgbox; +} PR_PRVJUMP_DLG; +/* Property of prvoptions_dlg */ +typedef struct pr_prvoptions_dlg +{ +PRS_ROOT root; +PRS_WIN win; +PRS_DLGCHAIN dlgchain; +PRS_DLGBOX dlgbox; +} PR_PRVOPTIONS_DLG; diff --git a/code/SIBOSDK/include/prev.ing b/code/SIBOSDK/include/prev.ing new file mode 100644 index 0000000..67dd2c4 --- /dev/null +++ b/code/SIBOSDK/include/prev.ing @@ -0,0 +1,154 @@ +; Generated by Ctran from prev.cl +PREV_ING equ 1 +IFNDEF HWIMMAN_ING + INCLUDE ..\inc\HWIMMAN.ING +ENDIF +IFNDEF GATE_ING + INCLUDE ..\inc\GATE.ING +ENDIF +IFNDEF DLGBOX_ING + INCLUDE ..\inc\DLGBOX.ING +ENDIF +IFNDEF PRVPDR_ING + INCLUDE ..\inc\PRVPDR.ING +ENDIF +IFNDEF PAGES_ING + INCLUDE ..\inc\PAGES.ING +ENDIF +; Class Numbers +C_PRVINFO equ 0 +C_PRVVIEW equ 1 +C_PRVPAGE equ 2 +C_PRVCOMM equ 3 +C_PRVJUMP_DLG equ 4 +C_PRVOPTIONS_DLG equ 5 +; Method Numbers +O_PVV_NEW_PAGE equ 16 +O_PVV_PAGES_DONE equ 15 +O_PVC_PREVIEW_EXIT equ 12 +O_PVP_MARGINS equ 14 +O_PVV_MARGINS equ 17 +O_PVV_FALSE equ 19 +O_PVV_DONE equ 14 +O_PVC_PREVIEW_PRINT equ 8 +O_PVC_PREVIEW_OPTIONS equ 10 +O_PVC_PREVIEW_MARGINS equ 9 +O_PVV_INIT equ 18 +O_PVC_PREVIEW_JUMP equ 11 +; Property of prvinfo +PRS_PRVINFO struc +PrvinfoNoPages dw ? +PrvinfoFontHeight dw ? +PrvinfoFontAscent dw ? +PRS_PRVINFO ends +PR_PRVINFO struc +PrvinfoRoot PRS_ROOT <> +PrvinfoWin PRS_WIN <> +PrvinfoPrvinfo PRS_PRVINFO <> +PR_PRVINFO ends +; Constants for prvview +PVV_INTERPAGE_GAP equ (6) +PVV_TOP_GAP equ (4) +PVV_FOOTER_GAP equ (12) +PVV_PAGE_SHADOW equ (1) +PVV_SIDE_GAP equ (12) +PVV_PAGENO_DISP_GAP equ (60) +PVV_DISP_FACING equ (0) +PVV_DISP1 equ (1) +PVV_DISP2 equ (2) +PVV_DISP3 equ (3) +PVV_DISP4 equ (4) +PVV_MARGINS_ON equ (001h) +PVV_PREVIEW_SET equ (080h) +PVV_VIEW_MAX_PAGEVIEWS equ (4) +; Types for prvview +IN_PRVVIEW struc +IN_PRVVIEWCalls PAGES_CALLS <> +IN_PRVVIEWPrintMethod dw ? +IN_PRVVIEWSpare1 dw ? +IN_PRVVIEWSpare2 dw ? +IN_PRVVIEW ends +PVV_PAGE_DATA struc +PVV_PAGE_DATAMargins P_RECT <> +PVV_PAGE_DATAHeadTop dw ? +PVV_PAGE_DATAHeadBot dw ? +PVV_PAGE_DATABorder P_RECT <> +PVV_PAGE_DATAFooter P_RECT <> +PVV_PAGE_DATA ends +PVV_PAGEVIEW_DATA struc +PVV_PAGEVIEW_DATAPArray dw ? +PVV_PAGEVIEW_DATANoPages dw ? +PVV_PAGEVIEW_DATAFirstPage dw ? +PVV_PAGEVIEW_DATALastPage dw ? +PVV_PAGEVIEW_DATAPageOffset dw ? +PVV_PAGEVIEW_DATAPageNo dw ? +PVV_PAGEVIEW_DATADisp PVV_DISPLAY <> +PVV_PAGEVIEW_DATAUseGrey dw ? +PVV_PAGEVIEW_DATALeftOffset dw ? +PVV_PAGEVIEW_DATAPageViewWidth dw ? +PVV_PAGEVIEW_DATAPage PVV_PAGE_DATA <> +PVV_PAGEVIEW_DATAPBitRow dw ? +PVV_PAGEVIEW_DATAPLastRow dw ? +PVV_PAGEVIEW_DATAPRowRec dw ? +PVV_PAGEVIEW_DATAPrvSegHandle dw ? +PVV_PAGEVIEW_DATABmp PRV_BITMAP <> +PVV_PAGEVIEW_DATA ends +; Property of prvview +PRS_PRVVIEW struc +PrvviewPPages dw ? +PrvviewPPrvInfo dw ? +PrvviewPPageView dw PVV_VIEW_MAX_PAGEVIEWS dup (?) +PrvviewPOldMenu dw ? +PrvviewPOldComman dw ? +PrvviewStarted dw ? +PrvviewPrintMethod dw ? +PrvviewHdone dw ? +PrvviewMdone dw ? +PrvviewNoPageViews dw ? +PrvviewMaxNoPageViews dw ? +PrvviewScrollArea P_RECT <> +PrvviewPv PVV_PAGEVIEW_DATA <> +PRS_PRVVIEW ends +PR_PRVVIEW struc +PrvviewRoot PRS_ROOT <> +PrvviewWin PRS_WIN <> +PrvviewDlgchain PRS_DLGCHAIN <> +PrvviewPrvview PRS_PRVVIEW <> +PR_PRVVIEW ends +; Types for prvpage +IN_PRVPAGE struc +IN_PRVPAGEPPrvView dw ? +IN_PRVPAGEPos dw ? +IN_PRVPAGEWid dw ? +IN_PRVPAGE ends +; Property of prvpage +PRS_PRVPAGE struc +PrvpageInit IN_PRVPAGE <> +PRS_PRVPAGE ends +PR_PRVPAGE struc +PrvpageRoot PRS_ROOT <> +PrvpageWin PRS_WIN <> +PrvpagePrvpage PRS_PRVPAGE <> +PR_PRVPAGE ends +; Property of prvcomm +PRS_PRVCOMM struc +PrvcommPPrvView dw ? +PRS_PRVCOMM ends +PR_PRVCOMM struc +PrvcommRoot PRS_ROOT <> +PrvcommPrvcomm PRS_PRVCOMM <> +PR_PRVCOMM ends +; Property of prvjump_dlg +PR_PRVJUMP_DLG struc +Prvjump_dlgRoot PRS_ROOT <> +Prvjump_dlgWin PRS_WIN <> +Prvjump_dlgDlgchain PRS_DLGCHAIN <> +Prvjump_dlgDlgbox PRS_DLGBOX <> +PR_PRVJUMP_DLG ends +; Property of prvoptions_dlg +PR_PRVOPTIONS_DLG struc +Prvoptions_dlgRoot PRS_ROOT <> +Prvoptions_dlgWin PRS_WIN <> +Prvoptions_dlgDlgchain PRS_DLGCHAIN <> +Prvoptions_dlgDlgbox PRS_DLGBOX <> +PR_PRVOPTIONS_DLG ends diff --git a/code/SIBOSDK/include/printer.g b/code/SIBOSDK/include/printer.g new file mode 100644 index 0000000..6b34e76 --- /dev/null +++ b/code/SIBOSDK/include/printer.g @@ -0,0 +1,91 @@ +/* Generated by Ctran from printer.cat */ +#define PRINTER_G +#ifndef PAGES_G +#include +#endif +/* Class Numbers */ +#define C_PRINTER 9 +/* Method Numbers */ +#define O_PR_PREVIEW_START 17 +#define O_PR_PAGINATE 16 +#define O_PR_SENSE_PORT 7 +#define O_PR_OPEN_WDR 12 +#define O_PR_SET_PORT_TYPE 4 +#define O_PR_PREVIEW 18 +#define O_PR_SET_MODEL 5 +#define O_PR_CLOSE_WDR 13 +#define O_PR_SET_HD 10 +#define O_PR_PREVIEW_END 19 +#define O_PR_STORE_SRCHAR 2 +#define O_PR_GET_HD 11 +#define O_PR_SENSE_MODEL 8 +#define O_PR_PORT_DATA 6 +#define O_PR_GET_PARAMS 9 +#define O_PR_STORE_FILE 3 +#define O_PR_PREVIEW_DATA 20 +#define O_PR_PRINT 15 +#define O_PR_OPEN_PORT 14 +#define O_PR_INIT 1 +/* Constants for printer */ +#define PRINTER_PORT_PARALLEL 0 +#define PRINTER_PORT_SERIAL 1 +#define PRINTER_PORT_FILE 2 +#define PRINTER_PORT_FAX 3 +#define PRINTER_PORT_NOT_SET 255 +#define PRINTER_HDR_TOP 0 +#define PRINTER_HDR_BOT 1 +#define PRINTER_PAGINATE 0 +#define PRINTER_PRINTING 1 +#define PRINTER_PREVIEW 2 +#define PRV_SEG_GRANULARITY 16 +/* Types for printer */ +typedef struct +{ +char *model; +char *hdtxt[2]; +} PRINTER_ALLOC; +typedef struct +{ +SCRLAY_FONT f; +unsigned char size_choice; +unsigned char wo_control; +unsigned short int spare[2]; +} PRINTER_DATA; +typedef struct +{ +PAGES_PARAMS p; +PRINTER_DATA d; +} PRINTER_PARAMS; +typedef struct +{ +unsigned char *pSegName; +PR_ROOT *pArray; +UPOINT PrvSize; +unsigned short int BitWidth; +void *hPrvDone; +short int mPrvDone; +} PREVIEW_INIT; +typedef struct +{ +int SegHandle; +PR_ROOT *pArray; +UPOINT Size; +unsigned short int BitWidth; +void *hPrvDone; +short int mPrvDone; +} PREVIEW_DATA; +/* Property of printer */ +typedef struct { +PR_WDR *wdr; +PRINTER_ALLOC a; +short int port_type; +char deftoptxt[3]; +char defbottxt[3]; +PRINTER_PARAMS p; +PREVIEW_DATA prv; +} PRS_PRINTER; +typedef struct pr_printer +{ +PRS_ROOT root; +PRS_PRINTER printer; +} PR_PRINTER; diff --git a/code/SIBOSDK/include/printer.ing b/code/SIBOSDK/include/printer.ing new file mode 100644 index 0000000..a65d9e7 --- /dev/null +++ b/code/SIBOSDK/include/printer.ing @@ -0,0 +1,86 @@ +; Generated by Ctran from printer.cl +PRINTER_ING equ 1 +IFNDEF PAGES_ING + INCLUDE ..\inc\PAGES.ING +ENDIF +; Class Numbers +C_PRINTER equ 9 +; Method Numbers +O_PR_PREVIEW_START equ 17 +O_PR_PAGINATE equ 16 +O_PR_SENSE_PORT equ 7 +O_PR_OPEN_WDR equ 12 +O_PR_SET_PORT_TYPE equ 4 +O_PR_PREVIEW equ 18 +O_PR_SET_MODEL equ 5 +O_PR_CLOSE_WDR equ 13 +O_PR_SET_HD equ 10 +O_PR_PREVIEW_END equ 19 +O_PR_STORE_SRCHAR equ 2 +O_PR_GET_HD equ 11 +O_PR_SENSE_MODEL equ 8 +O_PR_PORT_DATA equ 6 +O_PR_GET_PARAMS equ 9 +O_PR_STORE_FILE equ 3 +O_PR_PREVIEW_DATA equ 20 +O_PR_PRINT equ 15 +O_PR_OPEN_PORT equ 14 +O_PR_INIT equ 1 +; Constants for printer +PRINTER_PORT_PARALLEL equ (0) +PRINTER_PORT_SERIAL equ (1) +PRINTER_PORT_FILE equ (2) +PRINTER_PORT_FAX equ (3) +PRINTER_PORT_IR equ (4) +PRINTER_PORT_NOT_SET equ (255) +PRINTER_HDR_TOP equ (0) +PRINTER_HDR_BOT equ (1) +PRINTER_PAGINATE equ (0) +PRINTER_PRINTING equ (1) +PRINTER_PREVIEW equ (2) +PRV_SEG_GRANULARITY equ (16) +; Types for printer +PRINTER_ALLOC struc +PRINTER_ALLOCModel dw ? +PRINTER_ALLOCHdtxt dw 2 dup (?) +PRINTER_ALLOC ends +PRINTER_DATA struc +PRINTER_DATAF SCRLAY_FONT <> +PRINTER_DATASize_choice db ? +PRINTER_DATAWo_control db ? +PRINTER_DATASpare db (2) * 2 dup (?) +PRINTER_DATA ends +PRINTER_PARAMS struc +PRINTER_PARAMSP PAGES_PARAMS <> +PRINTER_PARAMSD PRINTER_DATA <> +PRINTER_PARAMS ends +PREVIEW_INIT struc +PREVIEW_INITPSegName dw ? +PREVIEW_INITPArray dw ? +PREVIEW_INITPrvSize UPOINT <> +PREVIEW_INITBitWidth dw ? +PREVIEW_INITHPrvDone dw ? +PREVIEW_INITMPrvDone dw ? +PREVIEW_INIT ends +PREVIEW_DATA struc +PREVIEW_DATASegHandle dw ? +PREVIEW_DATAPArray dw ? +PREVIEW_DATASize UPOINT <> +PREVIEW_DATABitWidth dw ? +PREVIEW_DATAHPrvDone dw ? +PREVIEW_DATAMPrvDone dw ? +PREVIEW_DATA ends +; Property of printer +PRS_PRINTER struc +PrinterWdr dw ? +PrinterA PRINTER_ALLOC <> +PrinterPort_type dw ? +PrinterDeftoptxt db (1) * 3 dup (?) +PrinterDefbottxt db (1) * 3 dup (?) +PrinterP PRINTER_PARAMS <> +PrinterPrv PREVIEW_DATA <> +PRS_PRINTER ends +PR_PRINTER struc +PrinterRoot PRS_ROOT <> +PrinterPrinter PRS_PRINTER <> +PR_PRINTER ends diff --git a/code/SIBOSDK/include/printing.g b/code/SIBOSDK/include/printing.g new file mode 100644 index 0000000..8f69834 --- /dev/null +++ b/code/SIBOSDK/include/printing.g @@ -0,0 +1,34 @@ +/* Generated by Ctran from printing.cl */ +#define PRINTING_G +#ifndef DLGBOX_G +#include +#endif +#ifndef PAGES_G +#include +#endif +/* Class Numbers */ +#define C_PRINTING 72 +/* Method Numbers */ +#define O_PRINTING_SET_TITLE 35 +#define O_PRINTING_DO_PRINT 36 +#define O_PRINTING_DONE 37 +/* Constants for printing */ +#define PR_WIN_WILL_SKIP 0x4000 +/* Types for printing */ +typedef struct +{ +PAGES_CALLS calls; +void **ppages; +} RBUF_PRINTING; +/* Property of printing */ +typedef struct { +void *pages; +} PRS_PRINTING; +typedef struct pr_printing +{ +PRS_ROOT root; +PRS_WIN win; +PRS_DLGCHAIN dlgchain; +PRS_DLGBOX dlgbox; +PRS_PRINTING printing; +} PR_PRINTING; diff --git a/code/SIBOSDK/include/printing.ing b/code/SIBOSDK/include/printing.ing new file mode 100644 index 0000000..066b91c --- /dev/null +++ b/code/SIBOSDK/include/printing.ing @@ -0,0 +1,32 @@ +; Generated by Ctran from printing.cl +PRINTING_ING equ 1 +IFNDEF DLGBOX_ING + INCLUDE ..\inc\DLGBOX.ING +ENDIF +IFNDEF PAGES_ING + INCLUDE ..\inc\PAGES.ING +ENDIF +; Class Numbers +C_PRINTING equ 72 +; Method Numbers +O_PRINTING_SET_TITLE equ 35 +O_PRINTING_DO_PRINT equ 36 +O_PRINTING_DONE equ 37 +; Constants for printing +PR_WIN_WILL_SKIP equ (04000h) +; Types for printing +RBUF_PRINTING struc +RBUF_PRINTINGCalls PAGES_CALLS <> +RBUF_PRINTINGPpages dw ? +RBUF_PRINTING ends +; Property of printing +PRS_PRINTING struc +PrintingPages dw ? +PRS_PRINTING ends +PR_PRINTING struc +PrintingRoot PRS_ROOT <> +PrintingWin PRS_WIN <> +PrintingDlgchain PRS_DLGCHAIN <> +PrintingDlgbox PRS_DLGBOX <> +PrintingPrinting PRS_PRINTING <> +PR_PRINTING ends diff --git a/code/SIBOSDK/include/prnprev.g b/code/SIBOSDK/include/prnprev.g new file mode 100644 index 0000000..eac516c --- /dev/null +++ b/code/SIBOSDK/include/prnprev.g @@ -0,0 +1,16 @@ +/* Generated by Ctran from prnprev.cl */ +#define PRNPREV_G +#ifndef DLGBOX_G +#include +#endif +/* Class Numbers */ +#define C_PRNPREV 80 +/* Method Numbers */ +/* Property of prnprev */ +typedef struct pr_prnprev +{ +PRS_ROOT root; +PRS_WIN win; +PRS_DLGCHAIN dlgchain; +PRS_DLGBOX dlgbox; +} PR_PRNPREV; diff --git a/code/SIBOSDK/include/prnprev.ing b/code/SIBOSDK/include/prnprev.ing new file mode 100644 index 0000000..be984ed --- /dev/null +++ b/code/SIBOSDK/include/prnprev.ing @@ -0,0 +1,15 @@ +; Generated by Ctran from prnprev.cl +PRNPREV_ING equ 1 +IFNDEF DLGBOX_ING + INCLUDE ..\inc\DLGBOX.ING +ENDIF +; Class Numbers +C_PRNPREV equ 80 +; Method Numbers +; Property of prnprev +PR_PRNPREV struc +PrnprevRoot PRS_ROOT <> +PrnprevWin PRS_WIN <> +PrnprevDlgchain PRS_DLGCHAIN <> +PrnprevDlgbox PRS_DLGBOX <> +PR_PRNPREV ends diff --git a/code/SIBOSDK/include/prntdlgs.g b/code/SIBOSDK/include/prntdlgs.g new file mode 100644 index 0000000..815411a --- /dev/null +++ b/code/SIBOSDK/include/prntdlgs.g @@ -0,0 +1,123 @@ +/* Generated by Ctran from prntdlgs.cl */ +#define PRNTDLGS_G +#ifndef DLGBOX_G +#include +#endif +#ifndef GATE_G +#include +#endif +#ifndef SCRLAY_G +#include +#endif +#ifndef P_FILE_H +#include +#endif +#ifndef P_SERIAL_H +#include +#endif +/* Class Numbers */ +#define C_PDEVDLG 65 +#define C_PRNCTRL 66 +#define C_PAGECTRL 67 +#define C_MARGINS 68 +#define C_HEADFOOT 69 +#define C_PRNMODEL 70 +#define C_PAGESIZE 71 +/* Method Numbers */ +/* Property of pdevdlg */ +typedef struct { +PR_ROOT *printer; +P_SRCHAR srchar; +short int filechanged; +short int own_printer; +PVV_DISPLAY Disp; +} PRS_PDEVDLG; +typedef struct pr_pdevdlg +{ +PRS_ROOT root; +PRS_WIN win; +PRS_DLGCHAIN dlgchain; +PRS_DLGBOX dlgbox; +PRS_PDEVDLG pdevdlg; +} PR_PDEVDLG; +/* Types for prnctrl */ +typedef struct +{ +unsigned short int tmarg; +unsigned short int lmarg; +unsigned short int rmarg; +unsigned short int bmarg; +} TMARG; +/* Property of prnctrl */ +typedef struct { +TMARG tm; +} PRS_PRNCTRL; +typedef struct pr_prnctrl +{ +PRS_ROOT root; +PRS_WIN win; +PRS_DLGCHAIN dlgchain; +PRS_DLGBOX dlgbox; +PRS_PRNCTRL prnctrl; +} PR_PRNCTRL; +/* Property of pagectrl */ +typedef struct pr_pagectrl +{ +PRS_ROOT root; +PRS_WIN win; +PRS_DLGCHAIN dlgchain; +PRS_DLGBOX dlgbox; +} PR_PAGECTRL; +/* Property of margins */ +typedef struct pr_margins +{ +PRS_ROOT root; +PRS_WIN win; +PRS_DLGCHAIN dlgchain; +PRS_DLGBOX dlgbox; +} PR_MARGINS; +/* Property of headfoot */ +typedef struct { +void *ph; +unsigned short int *offset; +} PRS_HEADFOOT; +typedef struct pr_headfoot +{ +PRS_ROOT root; +PRS_WIN win; +PRS_DLGCHAIN dlgchain; +PRS_DLGBOX dlgbox; +PRS_HEADFOOT headfoot; +} PR_HEADFOOT; +/* Types for prnmodel */ +typedef struct +{ +int path; +int index; +} MLIST_ITEM; +/* Property of prnmodel */ +typedef struct { +PR_VASTR *pm; +PR_VASTR *pf; +PR_VAFLAT *pi; +unsigned short int model; +short int nsel; +SCRLAY_FONT sf; +char wdrfile[P_FNAMESIZE]; +} PRS_PRNMODEL; +typedef struct pr_prnmodel +{ +PRS_ROOT root; +PRS_WIN win; +PRS_DLGCHAIN dlgchain; +PRS_DLGBOX dlgbox; +PRS_PRNMODEL prnmodel; +} PR_PRNMODEL; +/* Property of pagesize */ +typedef struct pr_pagesize +{ +PRS_ROOT root; +PRS_WIN win; +PRS_DLGCHAIN dlgchain; +PRS_DLGBOX dlgbox; +} PR_PAGESIZE; diff --git a/code/SIBOSDK/include/prntdlgs.ing b/code/SIBOSDK/include/prntdlgs.ing new file mode 100644 index 0000000..808accc --- /dev/null +++ b/code/SIBOSDK/include/prntdlgs.ing @@ -0,0 +1,114 @@ +; Generated by Ctran from prntdlgs.cl +PRNTDLGS_ING equ 1 +IFNDEF DLGBOX_ING + INCLUDE ..\inc\DLGBOX.ING +ENDIF +IFNDEF GATE_ING + INCLUDE ..\inc\GATE.ING +ENDIF +IFNDEF SCRLAY_ING + INCLUDE ..\inc\SCRLAY.ING +ENDIF +IFNDEF P_FILE_INC + INCLUDE ..\inc\P_FILE.INC +ENDIF +IFNDEF P_SERIAL_INC + INCLUDE ..\inc\P_SERIAL.INC +ENDIF +; Class Numbers +C_PDEVDLG equ 65 +C_PRNCTRL equ 66 +C_PAGECTRL equ 67 +C_MARGINS equ 68 +C_HEADFOOT equ 69 +C_PRNMODEL equ 70 +C_PAGESIZE equ 71 +; Method Numbers +; Property of pdevdlg +PRS_PDEVDLG struc +PdevdlgPrinter dw ? +PdevdlgSrchar P_SRCHAR <> +PdevdlgFilechanged dw ? +PdevdlgOwn_printer dw ? +PdevdlgDisp PVV_DISPLAY <> +PRS_PDEVDLG ends +PR_PDEVDLG struc +PdevdlgRoot PRS_ROOT <> +PdevdlgWin PRS_WIN <> +PdevdlgDlgchain PRS_DLGCHAIN <> +PdevdlgDlgbox PRS_DLGBOX <> +PdevdlgPdevdlg PRS_PDEVDLG <> +PR_PDEVDLG ends +; Types for prnctrl +TMARG struc +TMARGTmarg dw ? +TMARGLmarg dw ? +TMARGRmarg dw ? +TMARGBmarg dw ? +TMARG ends +; Property of prnctrl +PRS_PRNCTRL struc +PrnctrlTm TMARG <> +PRS_PRNCTRL ends +PR_PRNCTRL struc +PrnctrlRoot PRS_ROOT <> +PrnctrlWin PRS_WIN <> +PrnctrlDlgchain PRS_DLGCHAIN <> +PrnctrlDlgbox PRS_DLGBOX <> +PrnctrlPrnctrl PRS_PRNCTRL <> +PR_PRNCTRL ends +; Property of pagectrl +PR_PAGECTRL struc +PagectrlRoot PRS_ROOT <> +PagectrlWin PRS_WIN <> +PagectrlDlgchain PRS_DLGCHAIN <> +PagectrlDlgbox PRS_DLGBOX <> +PR_PAGECTRL ends +; Property of margins +PR_MARGINS struc +MarginsRoot PRS_ROOT <> +MarginsWin PRS_WIN <> +MarginsDlgchain PRS_DLGCHAIN <> +MarginsDlgbox PRS_DLGBOX <> +PR_MARGINS ends +; Property of headfoot +PRS_HEADFOOT struc +HeadfootPh dw ? +HeadfootOffset dw ? +PRS_HEADFOOT ends +PR_HEADFOOT struc +HeadfootRoot PRS_ROOT <> +HeadfootWin PRS_WIN <> +HeadfootDlgchain PRS_DLGCHAIN <> +HeadfootDlgbox PRS_DLGBOX <> +HeadfootHeadfoot PRS_HEADFOOT <> +PR_HEADFOOT ends +; Types for prnmodel +MLIST_ITEM struc +MLIST_ITEMPath dw ? +MLIST_ITEMIndex dw ? +MLIST_ITEM ends +; Property of prnmodel +PRS_PRNMODEL struc +PrnmodelPm dw ? +PrnmodelPf dw ? +PrnmodelPi dw ? +PrnmodelModel dw ? +PrnmodelNsel dw ? +PrnmodelSf SCRLAY_FONT <> +PrnmodelWdrfile db (1) * P_FNAMESIZE dup (?) +PRS_PRNMODEL ends +PR_PRNMODEL struc +PrnmodelRoot PRS_ROOT <> +PrnmodelWin PRS_WIN <> +PrnmodelDlgchain PRS_DLGCHAIN <> +PrnmodelDlgbox PRS_DLGBOX <> +PrnmodelPrnmodel PRS_PRNMODEL <> +PR_PRNMODEL ends +; Property of pagesize +PR_PAGESIZE struc +PagesizeRoot PRS_ROOT <> +PagesizeWin PRS_WIN <> +PagesizeDlgchain PRS_DLGCHAIN <> +PagesizeDlgbox PRS_DLGBOX <> +PR_PAGESIZE ends diff --git a/code/SIBOSDK/include/process.h b/code/SIBOSDK/include/process.h new file mode 100644 index 0000000..3d3f9d2 --- /dev/null +++ b/code/SIBOSDK/include/process.h @@ -0,0 +1,47 @@ +/* Release 3.00 */ + +/*-------------------------------------------------------------------------* +* * +* process.h - header for process control functions. * +* * +* COPYRIGHT (C) 1989, 1990 Jensen and Partners. All Rights Reserved. * +* * +*--------------------------------------------------------------------------*/ +#include + +#ifndef _PROCESS_INC_ +#define _PROCESS_INC_ + + +/* Modes available as first argument of the spawn? functions. */ + +#define P_WAIT 0 /* child runs separately, parent waits */ +#define P_NOWAIT 1 /* both concurrent */ +#define P_OVERLAY 2 /* parent dies, same as exec? */ + +#ifdef __cplusplus +extern "C" { +#endif +extern void abort(void); +extern int atexit(void (* func)(void)); +extern void (* onexit(void (* func)(void)))(); + +extern int execl(const char *_path, char *_arg0, ...); +extern int execlp(const char *_path, char *_arg0, ...); +extern int execv(const char *_path, char *_argv[]); +extern int execvp(const char *_path, char *_argv[]); + +extern void exit(int _status); +extern void _exit(int _status); +extern unsigned getpid(void); + +extern int spawnl(int _mode, const char *_path, char *_arg0, ...); +extern int spawnlp(int _mode, const char *_path, char *_arg0, ...); +extern int spawnv(int _mode, const char *_path, char *_argv[]); +extern int spawnvp(int _mode, const char *_path, char *_argv[]); +extern int system(const char *_command); +#ifdef __cplusplus +} +#endif + +#endif diff --git a/code/SIBOSDK/include/program.g b/code/SIBOSDK/include/program.g new file mode 100644 index 0000000..07d4768 --- /dev/null +++ b/code/SIBOSDK/include/program.g @@ -0,0 +1,65 @@ +/* Generated by Ctran from program.cl */ +#define PROGRAM_G +#ifndef P_STD_H +#include +#endif +#ifndef P_OBJECT_H +#include +#endif +#ifndef PROGRAM_H +#include +#endif +#ifndef OLIB_G +#include +#endif +#ifndef APPMAN_G +#include +#endif +#ifndef FACTIVE_G +#include +#endif +#ifndef IPC_G +#include +#endif +/* Class Numbers */ +#define C_PROGTRAN 53 +#define C_PROGEXEC 54 +#define C_PROGFIND 55 +/* Method Numbers */ +#define O_PT_START 4 +#define O_PT_COMPLETE 6 +#define O_PT_GETLINE 5 +/* Constants for progtran */ +#define PROGTRAN_PROG_TYPE_MASK 0x7fff +#define PROGTRAN_COMPATIBILITY_MODE 0x8000 +/* Property of progtran */ +typedef struct { +PROGTRAN_STATUS st; +char buf[256]; +} PRS_PROGTRAN; +typedef struct pr_progtran +{ +PRS_ROOT root; +PRS_SERVER server; +PRS_PROGTRAN progtran; +} PR_PROGTRAN; +/* Property of progexec */ +typedef struct { +PROGEXEC_RESBUF result; +} PRS_PROGEXEC; +typedef struct pr_progexec +{ +PRS_ROOT root; +PRS_ACTIVE active; +PRS_PROGEXEC progexec; +} PR_PROGEXEC; +/* Property of progfind */ +typedef struct { +unsigned char *pbuf; +} PRS_PROGFIND; +typedef struct pr_progfind +{ +PRS_ROOT root; +PRS_LOCS locs; +PRS_PROGFIND progfind; +} PR_PROGFIND; diff --git a/code/SIBOSDK/include/program.h b/code/SIBOSDK/include/program.h new file mode 100644 index 0000000..08786cc --- /dev/null +++ b/code/SIBOSDK/include/program.h @@ -0,0 +1,59 @@ +/* HEADER - PROGRAM.H +PROGRAM header +Copyright (c) Psion PLC 1993. + + VER DATE BY DESCRIPTION +----- -------- ---- ----------- +1.00A 03/03/93 HP Initial release +*/ +#ifndef PROGRAM_H +#define PROGRAM_H + +#include +#include + +/* Constants for progexec */ +#define PROGEXEC_SIGNAL 0x01 /* signal on completion */ +#define PROGEXEC_NOTIFY 0x02 /* call notifier on error */ +#define H_COMMAND_TRANSLATE_FILE 'T' +#define H_COMMAND_RUN_FILE 'R' +#define H_COMMAND_XTRANSLATE_FILE 't' + +/* Constants for progtran */ +#define PT_PROGTRAN_LINE 0x10 /* get a line of source */ +#define PT_PROGTRAN_DEATH 0x11 /* Opl translator death */ + +/* Types for progtran */ +typedef struct + { + WORD stat; /* completion status */ + UWORD mode; /* translation mode */ + UWORD line; /* line number */ + UWORD offset; /* offset to syntax error */ + } PROGTRAN_STATUS; + +typedef struct + { + UWORD pid; /* process id of source */ + TEXT *buffer_offset; /* offset of buffer in source process */ + PROGTRAN_STATUS *status_offset; /* offset of status block in source */ + } PROGTRAN_SOURCE; + +/* Types for progexec */ +typedef struct + { /* receives data from sys$prg?.img on completion */ + WORD error; /* runtime error */ + UWORD line; /* line no of start of proc containing error */ + UWORD offset; /* Q code offset to runtime error */ + TEXT err[40]; /* runtime error string */ + TEXT src[P_FNAMESIZE]; /* to take source module name */ + } PROGEXEC_RESBUF; + +typedef struct + { /* used to pass parameters to sys$prg?.img in p_execc() */ + UWORD flags; /* mode information */ + UWORD pid; /* requestor process id */ + PROGEXEC_RESBUF *result_offset; /* result buffer offset */ + } PROGEXEC_PAR; + +#endif // PROGRAM_H \ No newline at end of file diff --git a/code/SIBOSDK/include/program.inc b/code/SIBOSDK/include/program.inc new file mode 100644 index 0000000..ffb607f --- /dev/null +++ b/code/SIBOSDK/include/program.inc @@ -0,0 +1,53 @@ + title PROGRAM + subttl Copyright (c) Psion PLC 1993 + name PROGRAM +; +; VER DATE BY DESCRIPTION +; ----- -------- ---- ----------- +; 00.1A 03/03/93 HP First release +; +PROGRAM_INC equ 1 + +IFNDEF P_STD_INC + INCLUDE ..\inc\P_STD.INC +ENDIF +IFNDEF P_FILE_INC + INCLUDE ..\inc\P_FILE.INC +ENDIF + +; Constants for progexec +PROGEXEC_SIGNAL equ (001h) +PROGEXEC_NOTIFY equ (002h) +H_COMMAND_TRANSLATE_FILE equ ('T') +H_COMMAND_RUN_FILE equ ('R') + +; Constants for progtran +PT_PROGTRAN_LINE equ (010h) +PT_PROGTRAN_DEATH equ (011h) + +; Types for progtran +PROGTRAN_STATUS struc +PROGTRAN_STATUSStat dw ? +PROGTRAN_STATUSMode dw ? +PROGTRAN_STATUSLine dw ? +PROGTRAN_STATUSOffset dw ? +PROGTRAN_STATUS ends +; +PROGTRAN_SOURCE struc +PROGTRAN_SOURCEPid dw ? +PROGTRAN_SOURCEBuffer_offset dw ? +PROGTRAN_SOURCEStatus_offset dw ? +PROGTRAN_SOURCE ends +; +PROGEXEC_RESBUF struc +PROGEXEC_RESBUFError dw ? +PROGEXEC_RESBUFLine dw ? +PROGEXEC_RESBUFOffset dw ? +PROGEXEC_RESBUFErr db (1) * 40 dup (?) +PROGEXEC_RESBUFSrc db (1) * P_FNAMESIZE dup (?) +PROGEXEC_RESBUF ends +PROGEXEC_PAR struc +PROGEXEC_PARFlags dw ? +PROGEXEC_PARPid dw ? +PROGEXEC_PARResult_offset dw ? +PROGEXEC_PAR ends diff --git a/code/SIBOSDK/include/program.ing b/code/SIBOSDK/include/program.ing new file mode 100644 index 0000000..e0972bf --- /dev/null +++ b/code/SIBOSDK/include/program.ing @@ -0,0 +1,62 @@ +; Generated by Ctran from program.cl +PROGRAM_ING equ 1 +IFNDEF P_STD_INC + INCLUDE ..\inc\P_STD.INC +ENDIF +IFNDEF P_OBJECT_INC + INCLUDE ..\inc\P_OBJECT.INC +ENDIF +IFNDEF PROGRAM_INC + INCLUDE ..\inc\PROGRAM.INC +ENDIF +IFNDEF OLIB_ING + INCLUDE ..\inc\OLIB.ING +ENDIF +IFNDEF APPMAN_ING + INCLUDE ..\inc\APPMAN.ING +ENDIF +IFNDEF FACTIVE_ING + INCLUDE ..\inc\FACTIVE.ING +ENDIF +IFNDEF IPC_ING + INCLUDE ..\inc\IPC.ING +ENDIF +; Class Numbers +C_PROGTRAN equ 53 +C_PROGEXEC equ 54 +C_PROGFIND equ 55 +; Method Numbers +O_PT_START equ 4 +O_PT_COMPLETE equ 6 +O_PT_GETLINE equ 5 +; Constants for progtran +PROGTRAN_PROG_TYPE_MASK equ (07fffh) +PROGTRAN_COMPATIBILITY_MODE equ (08000h) +; Property of progtran +PRS_PROGTRAN struc +ProgtranSt PROGTRAN_STATUS <> +ProgtranBuf db (1) * 256 dup (?) +PRS_PROGTRAN ends +PR_PROGTRAN struc +ProgtranRoot PRS_ROOT <> +ProgtranServer PRS_SERVER <> +ProgtranProgtran PRS_PROGTRAN <> +PR_PROGTRAN ends +; Property of progexec +PRS_PROGEXEC struc +ProgexecResult PROGEXEC_RESBUF <> +PRS_PROGEXEC ends +PR_PROGEXEC struc +ProgexecRoot PRS_ROOT <> +ProgexecActive PRS_ACTIVE <> +ProgexecProgexec PRS_PROGEXEC <> +PR_PROGEXEC ends +; Property of progfind +PRS_PROGFIND struc +ProgfindPbuf dw ? +PRS_PROGFIND ends +PR_PROGFIND struc +ProgfindRoot PRS_ROOT <> +ProgfindLocs PRS_LOCS <> +ProgfindProgfind PRS_PROGFIND <> +PR_PROGFIND ends diff --git a/code/SIBOSDK/include/prvpdr.g b/code/SIBOSDK/include/prvpdr.g new file mode 100644 index 0000000..1a9d814 --- /dev/null +++ b/code/SIBOSDK/include/prvpdr.g @@ -0,0 +1,79 @@ +/* Generated by Ctran from prvpdr.cat */ +#define PRVPDR_G +#ifndef P_STD_H +#include +#endif +#ifndef P_OBJECT_H +#include +#endif +#ifndef P_FILE_H +#include +#endif +#ifndef P_GRAF_H +#include +#endif +#ifndef OLIB_G +#include +#endif +#ifndef PRINTER_G +#include +#endif +#ifndef PRDRV_G +#include +#endif +/* Class Numbers */ +#define C_PRVPDR 10 +/* Method Numbers */ +/* Types for prvpdr */ +typedef struct +{ +int Id; +int SegHandle; +UPOINT Size; +unsigned short int ByteWidth; +unsigned short int BitWidth; +} PRV_BITMAP; +typedef struct +{ +unsigned short int typeface; +unsigned short int height; +unsigned short int style; +} FONT_DESC; +typedef struct +{ +unsigned char Type; +unsigned char Length; +} BMP_RASTER_TL; +typedef struct +{ +BMP_RASTER_TL tl; +unsigned char Data[2]; +} BMP_RASTER_ROW_REC; +/* Property of prvpdr */ +typedef struct { +unsigned char *pChWidths; +unsigned short int SpaceWidth; +unsigned short int FontY; +unsigned short int TwipsRound; +unsigned short int PageHeight; +UPOINT Scale; +UPOINT Round; +UPOINT Pos; +void *hPrvDone; +short int mPrvDone; +PRV_BITMAP Bmp; +int SegHandle; +long int SegPos; +int SegHeight; +int SegSize; +PR_ROOT *pArray; +unsigned char *pBitRow; +unsigned char *pLastRow; +BMP_RASTER_ROW_REC *pRowRec; +} PRS_PRVPDR; +typedef struct pr_prvpdr +{ +PRS_ROOT root; +PRS_PDR pdr; +PRS_PRVPDR prvpdr; +} PR_PRVPDR; diff --git a/code/SIBOSDK/include/prvpdr.ing b/code/SIBOSDK/include/prvpdr.ing new file mode 100644 index 0000000..82f76ea --- /dev/null +++ b/code/SIBOSDK/include/prvpdr.ing @@ -0,0 +1,74 @@ +; Generated by Ctran from prvpdr.cl +PRVPDR_ING equ 1 +IFNDEF P_STD_INC + INCLUDE ..\inc\P_STD.INC +ENDIF +IFNDEF P_OBJECT_INC + INCLUDE ..\inc\P_OBJECT.INC +ENDIF +IFNDEF P_FILE_INC + INCLUDE ..\inc\P_FILE.INC +ENDIF +IFNDEF P_GRAF_INC + INCLUDE ..\inc\P_GRAF.INC +ENDIF +IFNDEF OLIB_ING + INCLUDE ..\inc\OLIB.ING +ENDIF +IFNDEF PRINTER_ING + INCLUDE ..\inc\PRINTER.ING +ENDIF +IFNDEF PRDRV_ING + INCLUDE ..\inc\PRDRV.ING +ENDIF +; Class Numbers +C_PRVPDR equ 10 +; Method Numbers +; Types for prvpdr +PRV_BITMAP struc +PRV_BITMAPId dw ? +PRV_BITMAPSegHandle dw ? +PRV_BITMAPSize UPOINT <> +PRV_BITMAPByteWidth dw ? +PRV_BITMAPBitWidth dw ? +PRV_BITMAP ends +FONT_DESC struc +FONT_DESCTypeface dw ? +FONT_DESCHeight dw ? +FONT_DESCStyle dw ? +FONT_DESC ends +BMP_RASTER_TL struc +BMP_RASTER_TLType db ? +BMP_RASTER_TLLength db ? +BMP_RASTER_TL ends +BMP_RASTER_ROW_REC struc +BMP_RASTER_ROW_RECTl BMP_RASTER_TL <> +BMP_RASTER_ROW_RECData db (1) * 2 dup (?) +BMP_RASTER_ROW_REC ends +; Property of prvpdr +PRS_PRVPDR struc +PrvpdrPChWidths dw ? +PrvpdrSpaceWidth dw ? +PrvpdrFontY dw ? +PrvpdrTwipsRound dw ? +PrvpdrPageHeight dw ? +PrvpdrScale UPOINT <> +PrvpdrRound UPOINT <> +PrvpdrPos UPOINT <> +PrvpdrHPrvDone dw ? +PrvpdrMPrvDone dw ? +PrvpdrBmp PRV_BITMAP <> +PrvpdrSegHandle dw ? +PrvpdrSegPos dd ? +PrvpdrSegHeight dw ? +PrvpdrSegSize dw ? +PrvpdrPArray dw ? +PrvpdrPBitRow dw ? +PrvpdrPLastRow dw ? +PrvpdrPRowRec dw ? +PRS_PRVPDR ends +PR_PRVPDR struc +PrvpdrRoot PRS_ROOT <> +PrvpdrPdr PRS_PDR <> +PrvpdrPrvpdr PRS_PRVPDR <> +PR_PRVPDR ends diff --git a/code/SIBOSDK/include/pulldown.g b/code/SIBOSDK/include/pulldown.g new file mode 100644 index 0000000..ec87d8b --- /dev/null +++ b/code/SIBOSDK/include/pulldown.g @@ -0,0 +1,21 @@ +/* Generated by Ctran from pulldown.cl */ +#define PULLDOWN_G +#ifndef LISTBOX_G +#include +#endif +/* Class Numbers */ +#define C_PULLDOWN 8 +/* Method Numbers */ +/* Types for pulldown */ +typedef struct +{ +unsigned char com_id; +char mn_txt[1]; +} MENU_ITEM; +/* Property of pulldown */ +typedef struct pr_pulldown +{ +PRS_ROOT root; +PRS_WIN win; +PRS_LISTBOX listbox; +} PR_PULLDOWN; diff --git a/code/SIBOSDK/include/pulldown.ing b/code/SIBOSDK/include/pulldown.ing new file mode 100644 index 0000000..a958d56 --- /dev/null +++ b/code/SIBOSDK/include/pulldown.ing @@ -0,0 +1,19 @@ +; Generated by Ctran from pulldown.cl +PULLDOWN_ING equ 1 +IFNDEF LISTBOX_ING + INCLUDE ..\inc\LISTBOX.ING +ENDIF +; Class Numbers +C_PULLDOWN equ 8 +; Method Numbers +; Types for pulldown +MENU_ITEM struc +MENU_ITEMCom_id db ? +MENU_ITEMMn_txt db (1) * 1 dup (?) +MENU_ITEM ends +; Property of pulldown +PR_PULLDOWN struc +PulldownRoot PRS_ROOT <> +PulldownWin PRS_WIN <> +PulldownListbox PRS_LISTBOX <> +PR_PULLDOWN ends diff --git a/code/SIBOSDK/include/rgedit.g b/code/SIBOSDK/include/rgedit.g new file mode 100644 index 0000000..86d3358 --- /dev/null +++ b/code/SIBOSDK/include/rgedit.g @@ -0,0 +1,42 @@ +/* Generated by Ctran from rgedit.cl */ +#define RGEDIT_G +#ifndef LODGER_G +#include +#endif +#ifndef MFNE_G +#include +#endif +/* Class Numbers */ +#define C_RGEDIT 32 +/* Method Numbers */ +/* Constants for rgedit */ +#define SE_RGEDIT_LOW 0x01 +#define SE_RGEDIT_VALUE_1 0x02 +#define SE_RGEDIT_VALUE_2 0x04 +#define SE_RGEDIT_HIGH 0x08 +#define IX_RGEDIT_LOW 0 +#define IX_RGEDIT_VALUE_1 1 +#define IX_RGEDIT_VALUE_2 2 +#define IX_RGEDIT_HIGH 3 +/* Types for rgedit */ +typedef struct +{ +unsigned short int value[4]; +} IN_RGEDIT; +typedef struct +{ +unsigned short int value[4]; +unsigned short int flags; +} SE_RGEDIT; +/* Property of rgedit */ +typedef struct { +IN_RGEDIT in; +} PRS_RGEDIT; +typedef struct pr_rgedit +{ +PRS_ROOT root; +PRS_WIN win; +PRS_LODGER lodger; +PRS_MFNE mfne; +PRS_RGEDIT rgedit; +} PR_RGEDIT; diff --git a/code/SIBOSDK/include/rgedit.ing b/code/SIBOSDK/include/rgedit.ing new file mode 100644 index 0000000..107ee99 --- /dev/null +++ b/code/SIBOSDK/include/rgedit.ing @@ -0,0 +1,39 @@ +; Generated by Ctran from rgedit.cl +RGEDIT_ING equ 1 +IFNDEF LODGER_ING + INCLUDE ..\inc\LODGER.ING +ENDIF +IFNDEF MFNE_ING + INCLUDE ..\inc\MFNE.ING +ENDIF +; Class Numbers +C_RGEDIT equ 32 +; Method Numbers +; Constants for rgedit +SE_RGEDIT_LOW equ (001h) +SE_RGEDIT_VALUE_1 equ (002h) +SE_RGEDIT_VALUE_2 equ (004h) +SE_RGEDIT_HIGH equ (008h) +IX_RGEDIT_LOW equ (0) +IX_RGEDIT_VALUE_1 equ (1) +IX_RGEDIT_VALUE_2 equ (2) +IX_RGEDIT_HIGH equ (3) +; Types for rgedit +IN_RGEDIT struc +IN_RGEDITValue db (2) * 4 dup (?) +IN_RGEDIT ends +SE_RGEDIT struc +SE_RGEDITValue db (2) * 4 dup (?) +SE_RGEDITFlags dw ? +SE_RGEDIT ends +; Property of rgedit +PRS_RGEDIT struc +RgeditIn IN_RGEDIT <> +PRS_RGEDIT ends +PR_RGEDIT struc +RgeditRoot PRS_ROOT <> +RgeditWin PRS_WIN <> +RgeditLodger PRS_LODGER <> +RgeditMfne PRS_MFNE <> +RgeditRgedit PRS_RGEDIT <> +PR_RGEDIT ends diff --git a/code/SIBOSDK/include/rscfile.xg b/code/SIBOSDK/include/rscfile.xg new file mode 100644 index 0000000..4d587ce --- /dev/null +++ b/code/SIBOSDK/include/rscfile.xg @@ -0,0 +1,11 @@ +/* HEADER - RSCFILE.XG +Copyright (C) Psion PLC 1992 + VER DATE BY DESCRIPTION +===== ======== === =========== +1.10F 31/05/92 DWW First release +*/ + +#define C_RSCFILE 12 +#define O_RS_READ_BUF 3 +#define O_RS_READ 2 +#define O_RS_INIT 1 diff --git a/code/SIBOSDK/include/rtcheck.h b/code/SIBOSDK/include/rtcheck.h new file mode 100644 index 0000000..ba7d711 --- /dev/null +++ b/code/SIBOSDK/include/rtcheck.h @@ -0,0 +1,42 @@ +/* Release 3.00 */ + +/*-------------------------------------------------------------------------* +* * +* rtcheck.h - run time check error handler interface. * +* * +* COPYRIGHT (C) 1989, 1990 Jensen and Partners. All Rights Reserved. * +* * +*--------------------------------------------------------------------------*/ +#include + +#ifndef _RTCHECK_INC_ +#define _RTCHECK_INC_ + +/* Values for code parameter */ +#define _CNS_STACK 1 /* Stack overflow */ +#define _CNS_NILPTR 2 /* Nil Ptr dereference */ +#define _CNS_INDEX 3 /* Index out of range */ +#define _CNS_OVERFLOW 4 /* Integer overflow */ +#define _CNS_RANGE 5 /* Integer out of range */ +#define _CNS_RETURN 6 /* No return in function */ +#define _CNS_CASE 7 /* No matching case */ +#define _CNS_DIVZERO 8 /* Long integer divide by zero */ +#define _CNS_PVC 10 /* Pure virtual function called */ + +/* return values for handler */ +#define _CNS_CONTINUE 1 +#define _CNS_TERMINATE 0 + +#ifdef __cplusplus +extern "C" { +#endif +#pragma save,call(reg_param=>(), reg_saved=>(ax,bx,cx,dx,ds,si,di,st1,st2)) +#pragma name(prefix=>"CoreSig@") +extern unsigned char (* CnsHandler)(unsigned code, unsigned IP, unsigned CS); +#pragma restore +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/code/SIBOSDK/include/runmemo.g b/code/SIBOSDK/include/runmemo.g new file mode 100644 index 0000000..7aca242 --- /dev/null +++ b/code/SIBOSDK/include/runmemo.g @@ -0,0 +1,60 @@ +/* Generated by Ctran from runmemo.cl */ +#define RUNMEMO_G +#ifndef HWIMMAN_G +#include +#endif +#ifndef XACTIVE_G +#include +#endif +/* Class Numbers */ +#define C_RUNMEMO 11 +#define C_IPCSTAT 12 +/* Method Numbers */ +#define O_IPCS_SET_MESSAGE 6 +#define O_IPCS_KEY 8 +#define O_IPCS_WAIT 7 +/* Types for runmemo */ +typedef struct +{ +void *self; +short int *stat; +unsigned short int appid; +unsigned short int flags; +} MEMO_ENV; +typedef struct +{ +MEMO_ENV e; +MEMO_DATA t; +} MEMO_CL; +/* Property of runmemo */ +typedef struct { +PR_LOGONA *logona; +unsigned short int mempid; +unsigned char command_byte; +unsigned char alias_info; +MEMO_CL cl; +MEMO_DATA in; +MEMO_CALLBACK cb; +unsigned short int hidflag; +unsigned short int callback; +PR_ACTIVE *active; +WS_HIDE_APP_DATA hidden; +} PRS_RUNMEMO; +typedef struct pr_runmemo +{ +PRS_ROOT root; +PRS_ACTIVE active; +PRS_RUNMEMO runmemo; +} PR_RUNMEMO; +/* Property of ipcstat */ +typedef struct { +int pid; +unsigned short int len; +unsigned char message[128]; +} PRS_IPCSTAT; +typedef struct pr_ipcstat +{ +PRS_ROOT root; +PRS_ACTIVE active; +PRS_IPCSTAT ipcstat; +} PR_IPCSTAT; diff --git a/code/SIBOSDK/include/runmemo.ing b/code/SIBOSDK/include/runmemo.ing new file mode 100644 index 0000000..f8ffa57 --- /dev/null +++ b/code/SIBOSDK/include/runmemo.ing @@ -0,0 +1,56 @@ +; Generated by Ctran from runmemo.cl +RUNMEMO_ING equ 1 +IFNDEF HWIMMAN_ING + INCLUDE ..\inc\HWIMMAN.ING +ENDIF +IFNDEF XACTIVE_ING + INCLUDE ..\inc\XACTIVE.ING +ENDIF +; Class Numbers +C_RUNMEMO equ 11 +C_IPCSTAT equ 12 +; Method Numbers +O_IPCS_SET_MESSAGE equ 6 +O_IPCS_KEY equ 8 +O_IPCS_WAIT equ 7 +; Types for runmemo +MEMO_ENV struc +MEMO_ENVSelf dw ? +MEMO_ENVStat dw ? +MEMO_ENVAppid dw ? +MEMO_ENVFlags dw ? +MEMO_ENV ends +MEMO_CL struc +MEMO_CLE MEMO_ENV <> +MEMO_CLT MEMO_DATA <> +MEMO_CL ends +; Property of runmemo +PRS_RUNMEMO struc +RunmemoLogona dw ? +RunmemoMempid dw ? +RunmemoCommand_byte db ? +RunmemoAlias_info db ? +RunmemoCl MEMO_CL <> +RunmemoIn MEMO_DATA <> +RunmemoCb MEMO_CALLBACK <> +RunmemoHidflag dw ? +RunmemoCallback dw ? +RunmemoActive dw ? +RunmemoHidden WS_HIDE_APP_DATA <> +PRS_RUNMEMO ends +PR_RUNMEMO struc +RunmemoRoot PRS_ROOT <> +RunmemoActive PRS_ACTIVE <> +RunmemoRunmemo PRS_RUNMEMO <> +PR_RUNMEMO ends +; Property of ipcstat +PRS_IPCSTAT struc +IpcstatPid dw ? +IpcstatLen dw ? +IpcstatMessage db (1) * 128 dup (?) +PRS_IPCSTAT ends +PR_IPCSTAT struc +IpcstatRoot PRS_ROOT <> +IpcstatActive PRS_ACTIVE <> +IpcstatIpcstat PRS_IPCSTAT <> +PR_IPCSTAT ends diff --git a/code/SIBOSDK/include/s3_.rsg b/code/SIBOSDK/include/s3_.rsg new file mode 100644 index 0000000..501d3b0 --- /dev/null +++ b/code/SIBOSDK/include/s3_.rsg @@ -0,0 +1,127 @@ +#define SYS_SPECIAL_CHARACTERS 1 +#define SYS_STRING 2 +#define SYS_DIMMED_MSG 3 +#define SYS_LOCKED_MSG 4 +#define SYS_BUSY 5 +#define SYS_SCANNING 6 +#define SYS_PRINTING_TO 7 +#define SYS_PAGE_IS 8 +#define SYS_COPIED_PROMPT 9 +#define SYS_COPYING_PROMPT 10 +#define SYS_LOADING_PROMPT 11 +#define SYS_MERGING_PROMPT 12 +#define SYS_NOTHING_TO_BRING 13 +#define SYS_NOT_FOUND 14 +#define SYS_NOTHING_TO_FIND 15 +#define SYS_COMPRESS_PROMPT 16 +#define SYS_NOT_COMPRESSIBLE 17 +#define SYS_PASSWORD_INCORRECT 18 +#define SYS_PASSWORD_NOT_CONFIRMED 19 +#define SYS_RANGE_RESET 20 +#define SYS_INVALID_NUM 21 +#define SYS_INVALID_MARGINS 22 +#define SYS_INVALID_CHAR 23 +#define SYS_OUT_OF_RANGE 24 +#define SYS_EDIT_NCHARS 25 +#define SYS_POPOUT_HELP 26 +#define SYS_HELP_STRING 27 +#define SYS_REPLACE_DISK 28 +#define SYS_NAME 29 +#define SYS_PACK 30 +#define SYS_FILELIST_DISK 31 +#define SYS_FLIST_RESET 32 +#define SYS_DEVICE_MEMORY 33 +#define SYS_PATH_IS 34 +#define SYS_CHOOSE_DIRECTORY 35 +#define SYS_CHOOSE_FILENAME 36 +#define SYS_CHOOSE_NEW_DIRECTORY 37 +#define SYS_EXISTS_OVER 38 +#define SYS_MAX 39 +#define SYS_MIN 40 +#define SYS_DEC_PLACES 41 +#define SYS_SIG_DIGITS 42 +#define SYS_EVALDLG_TITLE 43 +#define SYS_NOTHING_TO_EVAL 44 +#define SYS_TOOLONG_TO_EVAL 45 +#define SYS_XONXOFF_STRING 46 +#define SYS_HEADER_STR 47 +#define SYS_FOOTER_STR 48 +#define SYS_CENTIMETRES 49 +#define SYS_INCHES 50 +#define SYS_DEV_NOTREADY 51 +#define SYS_DEV_CORRUPT 52 +#define SYS_DEV_UNKNOWN 53 +#define SYS_DEV_INFO 54 +#define SYS_MTYPE_UNKNOWN 55 +#define SYS_MTYPE_FLOPPY 56 +#define SYS_MTYPE_HARD 57 +#define SYS_MTYPE_FLASH 58 +#define SYS_MTYPE_RAM 59 +#define SYS_MTYPE_ROM 60 +#define SYS_MTYPE_PROTECTED 61 +#define SYS_FILES_TAGGED 62 +#define SYS_NO_FILES 63 +#define SYS_NO_DISK 64 +#define SYS_UNFORMATTED 65 +#define SYS_UNRECOGNISED 66 +#define SYS_SOUND_FAIL 67 +#define SYS_BUTTON_TEXT 68 +#define SYS_AC_NO_YES 69 +#define SYS_AC_CONTINUE 70 +#define SYS_AC_ABANDON 71 +#define SYS_APPEND_ACLIST 72 +#define SYS_SMART_DIAL_ACLIST 73 +#define SYS_FREEDIAL_ACLIST 74 +#define SYS_NO_YES 75 +#define SYS_OFFON_MENU 76 +#define SYS_PRINTER_UNITS_CHLIST 77 +#define SYS_PRINTER_DEVICE_CHLIST 78 +#define SYS_BAUD_RATE_CHLIST 79 +#define SYS_DATA_BITS_CHLIST 80 +#define SYS_STOP_BITS_CHLIST 81 +#define SYS_PARITY_CHLIST 82 +#define SYS_FORMAT_CHLIST 83 +#define SYS_RAD_DEG 84 +#define SYS_PAGE_DIMENSIONS 85 +#define SYS_PAGE_SIZE 86 +#define SYS_ORIENT 87 +#define SYS_PRN_POS 88 +#define SYS_HEADFOOT_ALIGN 89 +#define SYS_PGNO_CHOICE 90 +#define SYS_ERROR_DIALOG 91 +#define SYS_QUERY_DIALOG 92 +#define SYS_PRINTING_DIALOG 93 +#define SYS_SET_PORT_DIALOG 94 +#define SYS_SET_HSHK_DIALOG 95 +#define SYS_PRINTER_CONFIG_DIALOG 96 +#define SYS_EVAL_DIALOG 97 +#define SYS_COUNTRY_SELECTOR_DIALOG 98 +#define SYS_SMART_DIAL_ITEM 99 +#define SYS_SMART_DIAL_DIALOG 100 +#define SYS_FREEDIAL_DIALOG 101 +#define SYS_FLIST_DIALOG 102 +#define SYS_PRINT_CONTROL_DL 103 +#define SYS_PAGING_CONTROL_DL 104 +#define SYS_PRINTER_MODEL 105 +#define SYS_MARGINS_DL 106 +#define SYS_HEADFOOT_DL 107 +#define SYS_PAGESIZE_DL 108 +#define SYS_FONT_DL 109 +#define SYS_TXTMESS 110 +#define SYS_HELP_INDEX_DATA 111 +#define SYS_HELP_INDEX 112 +#define SYS_HELP_ON_HELP 113 +#define SYS_HELP_DIALOG 114 +#define SYS_HELP_STATWIN 115 +#define SYS_HELP_DIALLING 116 +#define SYS_HELP_FILSELS 117 +#define SYS_HELP_EDIT 118 +#define SYS_HELP_X_HELP 119 +#define SYS_HELP_FILES 120 +#define SYS_HELP_PRINT 121 +#define SYS_TIME_BASICS 122 +#define SYS_HELP_ON_OFF 123 +#define SYS_HELP_X_INDEX 124 +#define SYS_WDR_GENERAL 125 +#define SYS_DIAL_OUT 126 +#define SYS_SKIPPING_PAGE 127 diff --git a/code/SIBOSDK/include/s3_.rsi b/code/SIBOSDK/include/s3_.rsi new file mode 100644 index 0000000..122ef7d --- /dev/null +++ b/code/SIBOSDK/include/s3_.rsi @@ -0,0 +1,127 @@ +SYS_SPECIAL_CHARACTERS equ 1 +SYS_STRING equ 2 +SYS_DIMMED_MSG equ 3 +SYS_LOCKED_MSG equ 4 +SYS_BUSY equ 5 +SYS_SCANNING equ 6 +SYS_PRINTING_TO equ 7 +SYS_PAGE_IS equ 8 +SYS_COPIED_PROMPT equ 9 +SYS_COPYING_PROMPT equ 10 +SYS_LOADING_PROMPT equ 11 +SYS_MERGING_PROMPT equ 12 +SYS_NOTHING_TO_BRING equ 13 +SYS_NOT_FOUND equ 14 +SYS_NOTHING_TO_FIND equ 15 +SYS_COMPRESS_PROMPT equ 16 +SYS_NOT_COMPRESSIBLE equ 17 +SYS_PASSWORD_INCORRECT equ 18 +SYS_PASSWORD_NOT_CONFIRMED equ 19 +SYS_RANGE_RESET equ 20 +SYS_INVALID_NUM equ 21 +SYS_INVALID_MARGINS equ 22 +SYS_INVALID_CHAR equ 23 +SYS_OUT_OF_RANGE equ 24 +SYS_EDIT_NCHARS equ 25 +SYS_POPOUT_HELP equ 26 +SYS_HELP_STRING equ 27 +SYS_REPLACE_DISK equ 28 +SYS_NAME equ 29 +SYS_PACK equ 30 +SYS_FILELIST_DISK equ 31 +SYS_FLIST_RESET equ 32 +SYS_DEVICE_MEMORY equ 33 +SYS_PATH_IS equ 34 +SYS_CHOOSE_DIRECTORY equ 35 +SYS_CHOOSE_FILENAME equ 36 +SYS_CHOOSE_NEW_DIRECTORY equ 37 +SYS_EXISTS_OVER equ 38 +SYS_MAX equ 39 +SYS_MIN equ 40 +SYS_DEC_PLACES equ 41 +SYS_SIG_DIGITS equ 42 +SYS_EVALDLG_TITLE equ 43 +SYS_NOTHING_TO_EVAL equ 44 +SYS_TOOLONG_TO_EVAL equ 45 +SYS_XONXOFF_STRING equ 46 +SYS_HEADER_STR equ 47 +SYS_FOOTER_STR equ 48 +SYS_CENTIMETRES equ 49 +SYS_INCHES equ 50 +SYS_DEV_NOTREADY equ 51 +SYS_DEV_CORRUPT equ 52 +SYS_DEV_UNKNOWN equ 53 +SYS_DEV_INFO equ 54 +SYS_MTYPE_UNKNOWN equ 55 +SYS_MTYPE_FLOPPY equ 56 +SYS_MTYPE_HARD equ 57 +SYS_MTYPE_FLASH equ 58 +SYS_MTYPE_RAM equ 59 +SYS_MTYPE_ROM equ 60 +SYS_MTYPE_PROTECTED equ 61 +SYS_FILES_TAGGED equ 62 +SYS_NO_FILES equ 63 +SYS_NO_DISK equ 64 +SYS_UNFORMATTED equ 65 +SYS_UNRECOGNISED equ 66 +SYS_SOUND_FAIL equ 67 +SYS_BUTTON_TEXT equ 68 +SYS_AC_NO_YES equ 69 +SYS_AC_CONTINUE equ 70 +SYS_AC_ABANDON equ 71 +SYS_APPEND_ACLIST equ 72 +SYS_SMART_DIAL_ACLIST equ 73 +SYS_FREEDIAL_ACLIST equ 74 +SYS_NO_YES equ 75 +SYS_OFFON_MENU equ 76 +SYS_PRINTER_UNITS_CHLIST equ 77 +SYS_PRINTER_DEVICE_CHLIST equ 78 +SYS_BAUD_RATE_CHLIST equ 79 +SYS_DATA_BITS_CHLIST equ 80 +SYS_STOP_BITS_CHLIST equ 81 +SYS_PARITY_CHLIST equ 82 +SYS_FORMAT_CHLIST equ 83 +SYS_RAD_DEG equ 84 +SYS_PAGE_DIMENSIONS equ 85 +SYS_PAGE_SIZE equ 86 +SYS_ORIENT equ 87 +SYS_PRN_POS equ 88 +SYS_HEADFOOT_ALIGN equ 89 +SYS_PGNO_CHOICE equ 90 +SYS_ERROR_DIALOG equ 91 +SYS_QUERY_DIALOG equ 92 +SYS_PRINTING_DIALOG equ 93 +SYS_SET_PORT_DIALOG equ 94 +SYS_SET_HSHK_DIALOG equ 95 +SYS_PRINTER_CONFIG_DIALOG equ 96 +SYS_EVAL_DIALOG equ 97 +SYS_COUNTRY_SELECTOR_DIALOG equ 98 +SYS_SMART_DIAL_ITEM equ 99 +SYS_SMART_DIAL_DIALOG equ 100 +SYS_FREEDIAL_DIALOG equ 101 +SYS_FLIST_DIALOG equ 102 +SYS_PRINT_CONTROL_DL equ 103 +SYS_PAGING_CONTROL_DL equ 104 +SYS_PRINTER_MODEL equ 105 +SYS_MARGINS_DL equ 106 +SYS_HEADFOOT_DL equ 107 +SYS_PAGESIZE_DL equ 108 +SYS_FONT_DL equ 109 +SYS_TXTMESS equ 110 +SYS_HELP_INDEX_DATA equ 111 +SYS_HELP_INDEX equ 112 +SYS_HELP_ON_HELP equ 113 +SYS_HELP_DIALOG equ 114 +SYS_HELP_STATWIN equ 115 +SYS_HELP_DIALLING equ 116 +SYS_HELP_FILSELS equ 117 +SYS_HELP_EDIT equ 118 +SYS_HELP_X_HELP equ 119 +SYS_HELP_FILES equ 120 +SYS_HELP_PRINT equ 121 +SYS_TIME_BASICS equ 122 +SYS_HELP_ON_OFF equ 123 +SYS_HELP_X_INDEX equ 124 +SYS_WDR_GENERAL equ 125 +SYS_DIAL_OUT equ 126 +SYS_SKIPPING_PAGE equ 127 diff --git a/code/SIBOSDK/include/sa_.rsg b/code/SIBOSDK/include/sa_.rsg new file mode 100644 index 0000000..d705dc2 --- /dev/null +++ b/code/SIBOSDK/include/sa_.rsg @@ -0,0 +1,179 @@ +#define SYS_SPECIAL_CHARACTERS 1 +#define SYS_STRING 2 +#define SYS_DIMMED_MSG 3 +#define SYS_LOCKED_MSG 4 +#define SYS_BUSY 5 +#define SYS_SCANNING 6 +#define SYS_PRINTING_TO 7 +#define SYS_PAGE_IS 8 +#define SYS_COPIED_PROMPT 9 +#define SYS_COPYING_PROMPT 10 +#define SYS_LOADING_PROMPT 11 +#define SYS_MERGING_PROMPT 12 +#define SYS_NOTHING_TO_BRING 13 +#define SYS_NOT_FOUND 14 +#define SYS_NOTHING_TO_FIND 15 +#define SYS_COMPRESS_PROMPT 16 +#define SYS_NOT_COMPRESSIBLE 17 +#define SYS_PASSWORD_INCORRECT 18 +#define SYS_PASSWORD_NOT_CONFIRMED 19 +#define SYS_RANGE_RESET 20 +#define SYS_INVALID_NUM 21 +#define SYS_INVALID_MARGINS 22 +#define SYS_INVALID_CHAR 23 +#define SYS_OUT_OF_RANGE 24 +#define SYS_EDIT_NCHARS 25 +#define SYS_POPOUT_HELP 26 +#define SYS_HELP_STRING 27 +#define SYS_REPLACE_DISK 28 +#define SYS_NAME 29 +#define SYS_PACK 30 +#define SYS_FILELIST_DISK 31 +#define SYS_FLIST_RESET 32 +#define SYS_DEVICE_MEMORY 33 +#define SYS_PATH_IS 34 +#define SYS_CHOOSE_DIRECTORY 35 +#define SYS_CHOOSE_FILENAME 36 +#define SYS_CHOOSE_NEW_DIRECTORY 37 +#define SYS_EXISTS_OVER 38 +#define SYS_MAX 39 +#define SYS_MIN 40 +#define SYS_DEC_PLACES 41 +#define SYS_SIG_DIGITS 42 +#define SYS_EVALDLG_TITLE 43 +#define SYS_NOTHING_TO_EVAL 44 +#define SYS_TOOLONG_TO_EVAL 45 +#define SYS_XONXOFF_STRING 46 +#define SYS_HEADER_STR 47 +#define SYS_FOOTER_STR 48 +#define SYS_CENTIMETRES 49 +#define SYS_INCHES 50 +#define SYS_DEV_NOTREADY 51 +#define SYS_DEV_CORRUPT 52 +#define SYS_DEV_UNKNOWN 53 +#define SYS_DEV_INFO 54 +#define SYS_MTYPE_UNKNOWN 55 +#define SYS_MTYPE_FLOPPY 56 +#define SYS_MTYPE_HARD 57 +#define SYS_MTYPE_FLASH 58 +#define SYS_MTYPE_RAM 59 +#define SYS_MTYPE_ROM 60 +#define SYS_MTYPE_PROTECTED 61 +#define SYS_FILES_TAGGED 62 +#define SYS_NO_FILES 63 +#define SYS_NO_DISK 64 +#define SYS_UNFORMATTED 65 +#define SYS_UNRECOGNISED 66 +#define SYS_SOUND_FAIL 67 +#define SYS_BUTTON_TEXT 68 +#define SYS_AC_NO_YES 69 +#define SYS_AC_CONTINUE 70 +#define SYS_AC_ABANDON 71 +#define SYS_APPEND_ACLIST 72 +#define SYS_SMART_DIAL_ACLIST 73 +#define SYS_FREEDIAL_ACLIST 74 +#define SYS_NO_YES 75 +#define SYS_OFFON_MENU 76 +#define SYS_PRINTER_UNITS_CHLIST 77 +#define SYS_PRINTER_DEVICE_CHLIST 78 +#define SYS_BAUD_RATE_CHLIST 79 +#define SYS_DATA_BITS_CHLIST 80 +#define SYS_STOP_BITS_CHLIST 81 +#define SYS_PARITY_CHLIST 82 +#define SYS_FORMAT_CHLIST 83 +#define SYS_RAD_DEG 84 +#define SYS_PAGE_DIMENSIONS 85 +#define SYS_PAGE_SIZE 86 +#define SYS_ORIENT 87 +#define SYS_PRN_POS 88 +#define SYS_HEADFOOT_ALIGN 89 +#define SYS_PGNO_CHOICE 90 +#define SYS_ERROR_DIALOG 91 +#define SYS_QUERY_DIALOG 92 +#define SYS_PRINTING_DIALOG 93 +#define SYS_SET_PORT_DIALOG 94 +#define SYS_SET_HSHK_DIALOG 95 +#define SYS_PRINTER_CONFIG_DIALOG 96 +#define SYS_EVAL_DIALOG 97 +#define SYS_COUNTRY_SELECTOR_DIALOG 98 +#define SYS_SMART_DIAL_ITEM 99 +#define SYS_SMART_DIAL_DIALOG 100 +#define SYS_FREEDIAL_DIALOG 101 +#define SYS_FLIST_DIALOG 102 +#define SYS_PRINT_CONTROL_DL 103 +#define SYS_PAGING_CONTROL_DL 104 +#define SYS_PRINTER_MODEL 105 +#define SYS_MARGINS_DL 106 +#define SYS_HEADFOOT_DL 107 +#define SYS_PAGESIZE_DL 108 +#define SYS_FONT_DL 109 +#define SYS_TXTMESS 110 +#define SYS_HELP_INDEX_DATA 111 +#define SYS_HELP_INDEX 112 +#define SYS_HELP_ON_HELP 113 +#define SYS_HELP_DIALOG 114 +#define SYS_HELP_STATWIN 115 +#define SYS_HELP_DIALLING 116 +#define SYS_HELP_FILSELS 117 +#define SYS_HELP_EDIT 118 +#define SYS_HELP_X_HELP 119 +#define SYS_HELP_FILES 120 +#define SYS_HELP_PRINT 121 +#define SYS_TIME_BASICS 122 +#define SYS_HELP_ON_OFF 123 +#define SYS_HELP_X_INDEX 124 +#define SYS_WDR_GENERAL 125 +#define SYS_DIAL_OUT 126 +#define SYS_SKIPPING_PAGE 127 +#define SYS_DEBUGGING_NUM_CELLS 128 +#define SYS_CALENDAR 129 +#define SYS_PAGE 130 +#define SYS_PAGES 131 +#define SYS_PREVIEW_BUSY 132 +#define SYS_DISPLAY_MARGINS 133 +#define SYS_HIDE_MARGINS 134 +#define SYS_OPENING_PROMPT 135 +#define SYS_PRINT_PREVIEW 136 +#define SYS_PREVIEW_MARGINS_CHLIST 137 +#define SYS_PREVIEW_OPTIONS_CHLIST 138 +#define SYS_PREVIEW_OPTIONS_DIALOG 139 +#define SYS_PREVIEW_JUMP_DIALOG 140 +#define SYS_PREVIEW_ACC 141 +#define SYS_PREVIEW_MENUBAR 142 +#define SYS_PREVIEW_MENU 143 +#define SYS_PRINTER_DEVICES 144 +#define SYS_PRINT_CONTROL_DEVICE 145 +#define SYS_PRINT_PREVIEW_SETTINGS 146 +#define SYS_PREVIEW_SETTINGS_DL 147 +#define SYS_STANDARD_SOUNDS 148 +#define SYS_ALARM_STANDARD_NAME 149 +#define SYS_SILENT_ALARM 150 +#define SYS_SOUND_DISABLED 151 +#define SYS_WORD_ROM 152 +#define SYS_RESTART_FROM_SYS 153 +#define SRT_FILE_CREATED 154 +#define SRT_FILE_OPENED 155 +#define SRT_FILE_SAVED 156 +#define SRT_FILE_COMPRESSED 157 +#define SRT_FILE_MERGED 158 +#define SYS_SAVING_PROMPT 159 +#define SYS_RELOADING_PROMPT 160 +#define SYS_CONVERTING_PROMPT 161 +#define SYS_NOT_CHANGED 162 +#define SYS_CONFIRM_CONTINUE 163 +#define SYS_CONFIRM_CHANGE_LOSS 164 +#define SYS_LOSING_CHANGES 165 +#define SYS_NOTHING_TO_PRINT 166 +#define SYS_NOTHING_TO_INSERT 167 +#define SYS_NOTHING_TO_COPY 168 +#define SYS_REVERT_TO_SAVED 169 +#define SYS_SHIFT_KEY_NAME 170 +#define SRT_SPACE_ONLY 171 +#define SYS_CHANGE_PASSWORD 172 +#define SYS_SET_PASSWORD_DL 173 +#define SYS_GET_PASSWORD_DL 174 +#define SYS_HELP_EVALUATE 175 +#define SYS_HELP_MEMO 176 +#define SYS_HELP_IN_USE 177 +#define SYS_HELP_NO_SYS_MEM 178 +#define SYS_HELP_CALENDAR 179 diff --git a/code/SIBOSDK/include/sa_.rsi b/code/SIBOSDK/include/sa_.rsi new file mode 100644 index 0000000..dd04974 --- /dev/null +++ b/code/SIBOSDK/include/sa_.rsi @@ -0,0 +1,179 @@ +SYS_SPECIAL_CHARACTERS equ 1 +SYS_STRING equ 2 +SYS_DIMMED_MSG equ 3 +SYS_LOCKED_MSG equ 4 +SYS_BUSY equ 5 +SYS_SCANNING equ 6 +SYS_PRINTING_TO equ 7 +SYS_PAGE_IS equ 8 +SYS_COPIED_PROMPT equ 9 +SYS_COPYING_PROMPT equ 10 +SYS_LOADING_PROMPT equ 11 +SYS_MERGING_PROMPT equ 12 +SYS_NOTHING_TO_BRING equ 13 +SYS_NOT_FOUND equ 14 +SYS_NOTHING_TO_FIND equ 15 +SYS_COMPRESS_PROMPT equ 16 +SYS_NOT_COMPRESSIBLE equ 17 +SYS_PASSWORD_INCORRECT equ 18 +SYS_PASSWORD_NOT_CONFIRMED equ 19 +SYS_RANGE_RESET equ 20 +SYS_INVALID_NUM equ 21 +SYS_INVALID_MARGINS equ 22 +SYS_INVALID_CHAR equ 23 +SYS_OUT_OF_RANGE equ 24 +SYS_EDIT_NCHARS equ 25 +SYS_POPOUT_HELP equ 26 +SYS_HELP_STRING equ 27 +SYS_REPLACE_DISK equ 28 +SYS_NAME equ 29 +SYS_PACK equ 30 +SYS_FILELIST_DISK equ 31 +SYS_FLIST_RESET equ 32 +SYS_DEVICE_MEMORY equ 33 +SYS_PATH_IS equ 34 +SYS_CHOOSE_DIRECTORY equ 35 +SYS_CHOOSE_FILENAME equ 36 +SYS_CHOOSE_NEW_DIRECTORY equ 37 +SYS_EXISTS_OVER equ 38 +SYS_MAX equ 39 +SYS_MIN equ 40 +SYS_DEC_PLACES equ 41 +SYS_SIG_DIGITS equ 42 +SYS_EVALDLG_TITLE equ 43 +SYS_NOTHING_TO_EVAL equ 44 +SYS_TOOLONG_TO_EVAL equ 45 +SYS_XONXOFF_STRING equ 46 +SYS_HEADER_STR equ 47 +SYS_FOOTER_STR equ 48 +SYS_CENTIMETRES equ 49 +SYS_INCHES equ 50 +SYS_DEV_NOTREADY equ 51 +SYS_DEV_CORRUPT equ 52 +SYS_DEV_UNKNOWN equ 53 +SYS_DEV_INFO equ 54 +SYS_MTYPE_UNKNOWN equ 55 +SYS_MTYPE_FLOPPY equ 56 +SYS_MTYPE_HARD equ 57 +SYS_MTYPE_FLASH equ 58 +SYS_MTYPE_RAM equ 59 +SYS_MTYPE_ROM equ 60 +SYS_MTYPE_PROTECTED equ 61 +SYS_FILES_TAGGED equ 62 +SYS_NO_FILES equ 63 +SYS_NO_DISK equ 64 +SYS_UNFORMATTED equ 65 +SYS_UNRECOGNISED equ 66 +SYS_SOUND_FAIL equ 67 +SYS_BUTTON_TEXT equ 68 +SYS_AC_NO_YES equ 69 +SYS_AC_CONTINUE equ 70 +SYS_AC_ABANDON equ 71 +SYS_APPEND_ACLIST equ 72 +SYS_SMART_DIAL_ACLIST equ 73 +SYS_FREEDIAL_ACLIST equ 74 +SYS_NO_YES equ 75 +SYS_OFFON_MENU equ 76 +SYS_PRINTER_UNITS_CHLIST equ 77 +SYS_PRINTER_DEVICE_CHLIST equ 78 +SYS_BAUD_RATE_CHLIST equ 79 +SYS_DATA_BITS_CHLIST equ 80 +SYS_STOP_BITS_CHLIST equ 81 +SYS_PARITY_CHLIST equ 82 +SYS_FORMAT_CHLIST equ 83 +SYS_RAD_DEG equ 84 +SYS_PAGE_DIMENSIONS equ 85 +SYS_PAGE_SIZE equ 86 +SYS_ORIENT equ 87 +SYS_PRN_POS equ 88 +SYS_HEADFOOT_ALIGN equ 89 +SYS_PGNO_CHOICE equ 90 +SYS_ERROR_DIALOG equ 91 +SYS_QUERY_DIALOG equ 92 +SYS_PRINTING_DIALOG equ 93 +SYS_SET_PORT_DIALOG equ 94 +SYS_SET_HSHK_DIALOG equ 95 +SYS_PRINTER_CONFIG_DIALOG equ 96 +SYS_EVAL_DIALOG equ 97 +SYS_COUNTRY_SELECTOR_DIALOG equ 98 +SYS_SMART_DIAL_ITEM equ 99 +SYS_SMART_DIAL_DIALOG equ 100 +SYS_FREEDIAL_DIALOG equ 101 +SYS_FLIST_DIALOG equ 102 +SYS_PRINT_CONTROL_DL equ 103 +SYS_PAGING_CONTROL_DL equ 104 +SYS_PRINTER_MODEL equ 105 +SYS_MARGINS_DL equ 106 +SYS_HEADFOOT_DL equ 107 +SYS_PAGESIZE_DL equ 108 +SYS_FONT_DL equ 109 +SYS_TXTMESS equ 110 +SYS_HELP_INDEX_DATA equ 111 +SYS_HELP_INDEX equ 112 +SYS_HELP_ON_HELP equ 113 +SYS_HELP_DIALOG equ 114 +SYS_HELP_STATWIN equ 115 +SYS_HELP_DIALLING equ 116 +SYS_HELP_FILSELS equ 117 +SYS_HELP_EDIT equ 118 +SYS_HELP_X_HELP equ 119 +SYS_HELP_FILES equ 120 +SYS_HELP_PRINT equ 121 +SYS_TIME_BASICS equ 122 +SYS_HELP_ON_OFF equ 123 +SYS_HELP_X_INDEX equ 124 +SYS_WDR_GENERAL equ 125 +SYS_DIAL_OUT equ 126 +SYS_SKIPPING_PAGE equ 127 +SYS_DEBUGGING_NUM_CELLS equ 128 +SYS_CALENDAR equ 129 +SYS_PAGE equ 130 +SYS_PAGES equ 131 +SYS_PREVIEW_BUSY equ 132 +SYS_DISPLAY_MARGINS equ 133 +SYS_HIDE_MARGINS equ 134 +SYS_OPENING_PROMPT equ 135 +SYS_PRINT_PREVIEW equ 136 +SYS_PREVIEW_MARGINS_CHLIST equ 137 +SYS_PREVIEW_OPTIONS_CHLIST equ 138 +SYS_PREVIEW_OPTIONS_DIALOG equ 139 +SYS_PREVIEW_JUMP_DIALOG equ 140 +SYS_PREVIEW_ACC equ 141 +SYS_PREVIEW_MENUBAR equ 142 +SYS_PREVIEW_MENU equ 143 +SYS_PRINTER_DEVICES equ 144 +SYS_PRINT_CONTROL_DEVICE equ 145 +SYS_PRINT_PREVIEW_SETTINGS equ 146 +SYS_PREVIEW_SETTINGS_DL equ 147 +SYS_STANDARD_SOUNDS equ 148 +SYS_ALARM_STANDARD_NAME equ 149 +SYS_SILENT_ALARM equ 150 +SYS_SOUND_DISABLED equ 151 +SYS_WORD_ROM equ 152 +SYS_RESTART_FROM_SYS equ 153 +SRT_FILE_CREATED equ 154 +SRT_FILE_OPENED equ 155 +SRT_FILE_SAVED equ 156 +SRT_FILE_COMPRESSED equ 157 +SRT_FILE_MERGED equ 158 +SYS_SAVING_PROMPT equ 159 +SYS_RELOADING_PROMPT equ 160 +SYS_CONVERTING_PROMPT equ 161 +SYS_NOT_CHANGED equ 162 +SYS_CONFIRM_CONTINUE equ 163 +SYS_CONFIRM_CHANGE_LOSS equ 164 +SYS_LOSING_CHANGES equ 165 +SYS_NOTHING_TO_PRINT equ 166 +SYS_NOTHING_TO_INSERT equ 167 +SYS_NOTHING_TO_COPY equ 168 +SYS_REVERT_TO_SAVED equ 169 +SYS_SHIFT_KEY_NAME equ 170 +SRT_SPACE_ONLY equ 171 +SYS_CHANGE_PASSWORD equ 172 +SYS_SET_PASSWORD_DL equ 173 +SYS_GET_PASSWORD_DL equ 174 +SYS_HELP_EVALUATE equ 175 +SYS_HELP_MEMO equ 176 +SYS_HELP_IN_USE equ 177 +SYS_HELP_NO_SYS_MEM equ 178 +SYS_HELP_CALENDAR equ 179 diff --git a/code/SIBOSDK/include/sc_.rsg b/code/SIBOSDK/include/sc_.rsg new file mode 100644 index 0000000..cab4c50 --- /dev/null +++ b/code/SIBOSDK/include/sc_.rsg @@ -0,0 +1,191 @@ +#define SYS_SPECIAL_CHARACTERS 1 +#define SYS_STRING 2 +#define SYS_DIMMED_MSG 3 +#define SYS_LOCKED_MSG 4 +#define SYS_BUSY 5 +#define SYS_SCANNING 6 +#define SYS_PRINTING_TO 7 +#define SYS_PAGE_IS 8 +#define SYS_COPIED_PROMPT 9 +#define SYS_COPYING_PROMPT 10 +#define SYS_LOADING_PROMPT 11 +#define SYS_MERGING_PROMPT 12 +#define SYS_NOTHING_TO_BRING 13 +#define SYS_NOT_FOUND 14 +#define SYS_NOTHING_TO_FIND 15 +#define SYS_COMPRESS_PROMPT 16 +#define SYS_NOT_COMPRESSIBLE 17 +#define SYS_PASSWORD_INCORRECT 18 +#define SYS_PASSWORD_NOT_CONFIRMED 19 +#define SYS_RANGE_RESET 20 +#define SYS_INVALID_NUM 21 +#define SYS_INVALID_MARGINS 22 +#define SYS_INVALID_CHAR 23 +#define SYS_OUT_OF_RANGE 24 +#define SYS_EDIT_NCHARS 25 +#define SYS_POPOUT_HELP 26 +#define SYS_HELP_STRING 27 +#define SYS_REPLACE_DISK 28 +#define SYS_NAME 29 +#define SYS_PACK 30 +#define SYS_FILELIST_DISK 31 +#define SYS_FLIST_RESET 32 +#define SYS_DEVICE_MEMORY 33 +#define SYS_PATH_IS 34 +#define SYS_CHOOSE_DIRECTORY 35 +#define SYS_CHOOSE_FILENAME 36 +#define SYS_CHOOSE_NEW_DIRECTORY 37 +#define SYS_EXISTS_OVER 38 +#define SYS_MAX 39 +#define SYS_MIN 40 +#define SYS_DEC_PLACES 41 +#define SYS_SIG_DIGITS 42 +#define SYS_EVALDLG_TITLE 43 +#define SYS_NOTHING_TO_EVAL 44 +#define SYS_TOOLONG_TO_EVAL 45 +#define SYS_XONXOFF_STRING 46 +#define SYS_HEADER_STR 47 +#define SYS_FOOTER_STR 48 +#define SYS_CENTIMETRES 49 +#define SYS_INCHES 50 +#define SYS_DEV_NOTREADY 51 +#define SYS_DEV_CORRUPT 52 +#define SYS_DEV_UNKNOWN 53 +#define SYS_DEV_INFO 54 +#define SYS_MTYPE_UNKNOWN 55 +#define SYS_MTYPE_FLOPPY 56 +#define SYS_MTYPE_HARD 57 +#define SYS_MTYPE_FLASH 58 +#define SYS_MTYPE_RAM 59 +#define SYS_MTYPE_ROM 60 +#define SYS_MTYPE_PROTECTED 61 +#define SYS_FILES_TAGGED 62 +#define SYS_NO_FILES 63 +#define SYS_NO_DISK 64 +#define SYS_UNFORMATTED 65 +#define SYS_UNRECOGNISED 66 +#define SYS_SOUND_FAIL 67 +#define SYS_BUTTON_TEXT 68 +#define SYS_AC_NO_YES 69 +#define SYS_AC_CONTINUE 70 +#define SYS_AC_ABANDON 71 +#define SYS_APPEND_ACLIST 72 +#define SYS_SMART_DIAL_ACLIST 73 +#define SYS_FREEDIAL_ACLIST 74 +#define SYS_NO_YES 75 +#define SYS_OFFON_MENU 76 +#define SYS_PRINTER_UNITS_CHLIST 77 +#define SYS_PRINTER_DEVICE_CHLIST 78 +#define SYS_BAUD_RATE_CHLIST 79 +#define SYS_DATA_BITS_CHLIST 80 +#define SYS_STOP_BITS_CHLIST 81 +#define SYS_PARITY_CHLIST 82 +#define SYS_FORMAT_CHLIST 83 +#define SYS_RAD_DEG 84 +#define SYS_PAGE_DIMENSIONS 85 +#define SYS_PAGE_SIZE 86 +#define SYS_ORIENT 87 +#define SYS_PRN_POS 88 +#define SYS_HEADFOOT_ALIGN 89 +#define SYS_PGNO_CHOICE 90 +#define SYS_ERROR_DIALOG 91 +#define SYS_QUERY_DIALOG 92 +#define SYS_PRINTING_DIALOG 93 +#define SYS_SET_PORT_DIALOG 94 +#define SYS_SET_HSHK_DIALOG 95 +#define SYS_PRINTER_CONFIG_DIALOG 96 +#define SYS_EVAL_DIALOG 97 +#define SYS_COUNTRY_SELECTOR_DIALOG 98 +#define SYS_SMART_DIAL_ITEM 99 +#define SYS_SMART_DIAL_DIALOG 100 +#define SYS_FREEDIAL_DIALOG 101 +#define SYS_FLIST_DIALOG 102 +#define SYS_PRINT_CONTROL_DL 103 +#define SYS_PAGING_CONTROL_DL 104 +#define SYS_PRINTER_MODEL 105 +#define SYS_MARGINS_DL 106 +#define SYS_HEADFOOT_DL 107 +#define SYS_PAGESIZE_DL 108 +#define SYS_FONT_DL 109 +#define SYS_TXTMESS 110 +#define SYS_HELP_INDEX_DATA 111 +#define SYS_HELP_INDEX 112 +#define SYS_HELP_ON_HELP 113 +#define SYS_HELP_DIALOG 114 +#define SYS_HELP_STATWIN 115 +#define SYS_HELP_DIALLING 116 +#define SYS_HELP_FILSELS 117 +#define SYS_HELP_EDIT 118 +#define SYS_HELP_X_HELP 119 +#define SYS_HELP_FILES 120 +#define SYS_HELP_PRINT 121 +#define SYS_TIME_BASICS 122 +#define SYS_HELP_ON_OFF 123 +#define SYS_HELP_X_INDEX 124 +#define SYS_WDR_GENERAL 125 +#define SYS_DIAL_OUT 126 +#define SYS_SKIPPING_PAGE 127 +#define SYS_DEBUGGING_NUM_CELLS 128 +#define SYS_CALENDAR 129 +#define SYS_PAGE 130 +#define SYS_PAGES 131 +#define SYS_PREVIEW_BUSY 132 +#define SYS_DISPLAY_MARGINS 133 +#define SYS_HIDE_MARGINS 134 +#define SYS_OPENING_PROMPT 135 +#define SYS_PRINT_PREVIEW 136 +#define SYS_PREVIEW_MARGINS_CHLIST 137 +#define SYS_PREVIEW_OPTIONS_CHLIST 138 +#define SYS_PREVIEW_OPTIONS_DIALOG 139 +#define SYS_PREVIEW_JUMP_DIALOG 140 +#define SYS_PREVIEW_ACC 141 +#define SYS_PREVIEW_MENUBAR 142 +#define SYS_PREVIEW_MENU 143 +#define SYS_PRINTER_DEVICES 144 +#define SYS_PRINT_CONTROL_DEVICE 145 +#define SYS_PRINT_PREVIEW_SETTINGS 146 +#define SYS_PREVIEW_SETTINGS_DL 147 +#define SYS_STANDARD_SOUNDS 148 +#define SYS_ALARM_STANDARD_NAME 149 +#define SYS_SILENT_ALARM 150 +#define SYS_SOUND_DISABLED 151 +#define SYS_WORD_ROM 152 +#define SYS_RESTART_FROM_SYS 153 +#define SRT_FILE_CREATED 154 +#define SRT_FILE_OPENED 155 +#define SRT_FILE_SAVED 156 +#define SRT_FILE_COMPRESSED 157 +#define SRT_FILE_MERGED 158 +#define SYS_SAVING_PROMPT 159 +#define SYS_RELOADING_PROMPT 160 +#define SYS_CONVERTING_PROMPT 161 +#define SYS_NOT_CHANGED 162 +#define SYS_CONFIRM_CONTINUE 163 +#define SYS_CONFIRM_CHANGE_LOSS 164 +#define SYS_LOSING_CHANGES 165 +#define SYS_NOTHING_TO_PRINT 166 +#define SYS_NOTHING_TO_INSERT 167 +#define SYS_NOTHING_TO_COPY 168 +#define SYS_REVERT_TO_SAVED 169 +#define SYS_SHIFT_KEY_NAME 170 +#define SRT_SPACE_ONLY 171 +#define SYS_CHANGE_PASSWORD 172 +#define SYS_SET_PASSWORD_DL 173 +#define SYS_GET_PASSWORD_DL 174 +#define SYS_HELP_EVALUATE 175 +#define SYS_HELP_MEMO 176 +#define SYS_HELP_IN_USE 177 +#define SYS_HELP_NO_SYS_MEM 178 +#define SYS_HELP_CALENDAR 179 +#define SYS_S3C_PRINT_CONTROL_DL 180 +#define SYS_S3C_PAGE_SETUP 181 +#define SYS_HELP_BATTERY 182 +#define SYS_VINE_FILE_INFO_DL 183 +#define SYS_RUSSIAN_KEYS 184 +#define SYS_HELP_INFRARED 185 +#define SYS_HELP_APPNOTREADY 186 +#define SYS_IR_DISABLED 187 +#define SYS_IR_POWER_LEVEL 188 +#define SYS_PRINTER_IR 189 +#define SYS_BAUD_RATE_CHLIST_X 190 +#define SYS_BAUD_CONTROL_X 191 diff --git a/code/SIBOSDK/include/sc_.rsi b/code/SIBOSDK/include/sc_.rsi new file mode 100644 index 0000000..20c7b76 --- /dev/null +++ b/code/SIBOSDK/include/sc_.rsi @@ -0,0 +1,191 @@ +SYS_SPECIAL_CHARACTERS equ 1 +SYS_STRING equ 2 +SYS_DIMMED_MSG equ 3 +SYS_LOCKED_MSG equ 4 +SYS_BUSY equ 5 +SYS_SCANNING equ 6 +SYS_PRINTING_TO equ 7 +SYS_PAGE_IS equ 8 +SYS_COPIED_PROMPT equ 9 +SYS_COPYING_PROMPT equ 10 +SYS_LOADING_PROMPT equ 11 +SYS_MERGING_PROMPT equ 12 +SYS_NOTHING_TO_BRING equ 13 +SYS_NOT_FOUND equ 14 +SYS_NOTHING_TO_FIND equ 15 +SYS_COMPRESS_PROMPT equ 16 +SYS_NOT_COMPRESSIBLE equ 17 +SYS_PASSWORD_INCORRECT equ 18 +SYS_PASSWORD_NOT_CONFIRMED equ 19 +SYS_RANGE_RESET equ 20 +SYS_INVALID_NUM equ 21 +SYS_INVALID_MARGINS equ 22 +SYS_INVALID_CHAR equ 23 +SYS_OUT_OF_RANGE equ 24 +SYS_EDIT_NCHARS equ 25 +SYS_POPOUT_HELP equ 26 +SYS_HELP_STRING equ 27 +SYS_REPLACE_DISK equ 28 +SYS_NAME equ 29 +SYS_PACK equ 30 +SYS_FILELIST_DISK equ 31 +SYS_FLIST_RESET equ 32 +SYS_DEVICE_MEMORY equ 33 +SYS_PATH_IS equ 34 +SYS_CHOOSE_DIRECTORY equ 35 +SYS_CHOOSE_FILENAME equ 36 +SYS_CHOOSE_NEW_DIRECTORY equ 37 +SYS_EXISTS_OVER equ 38 +SYS_MAX equ 39 +SYS_MIN equ 40 +SYS_DEC_PLACES equ 41 +SYS_SIG_DIGITS equ 42 +SYS_EVALDLG_TITLE equ 43 +SYS_NOTHING_TO_EVAL equ 44 +SYS_TOOLONG_TO_EVAL equ 45 +SYS_XONXOFF_STRING equ 46 +SYS_HEADER_STR equ 47 +SYS_FOOTER_STR equ 48 +SYS_CENTIMETRES equ 49 +SYS_INCHES equ 50 +SYS_DEV_NOTREADY equ 51 +SYS_DEV_CORRUPT equ 52 +SYS_DEV_UNKNOWN equ 53 +SYS_DEV_INFO equ 54 +SYS_MTYPE_UNKNOWN equ 55 +SYS_MTYPE_FLOPPY equ 56 +SYS_MTYPE_HARD equ 57 +SYS_MTYPE_FLASH equ 58 +SYS_MTYPE_RAM equ 59 +SYS_MTYPE_ROM equ 60 +SYS_MTYPE_PROTECTED equ 61 +SYS_FILES_TAGGED equ 62 +SYS_NO_FILES equ 63 +SYS_NO_DISK equ 64 +SYS_UNFORMATTED equ 65 +SYS_UNRECOGNISED equ 66 +SYS_SOUND_FAIL equ 67 +SYS_BUTTON_TEXT equ 68 +SYS_AC_NO_YES equ 69 +SYS_AC_CONTINUE equ 70 +SYS_AC_ABANDON equ 71 +SYS_APPEND_ACLIST equ 72 +SYS_SMART_DIAL_ACLIST equ 73 +SYS_FREEDIAL_ACLIST equ 74 +SYS_NO_YES equ 75 +SYS_OFFON_MENU equ 76 +SYS_PRINTER_UNITS_CHLIST equ 77 +SYS_PRINTER_DEVICE_CHLIST equ 78 +SYS_BAUD_RATE_CHLIST equ 79 +SYS_DATA_BITS_CHLIST equ 80 +SYS_STOP_BITS_CHLIST equ 81 +SYS_PARITY_CHLIST equ 82 +SYS_FORMAT_CHLIST equ 83 +SYS_RAD_DEG equ 84 +SYS_PAGE_DIMENSIONS equ 85 +SYS_PAGE_SIZE equ 86 +SYS_ORIENT equ 87 +SYS_PRN_POS equ 88 +SYS_HEADFOOT_ALIGN equ 89 +SYS_PGNO_CHOICE equ 90 +SYS_ERROR_DIALOG equ 91 +SYS_QUERY_DIALOG equ 92 +SYS_PRINTING_DIALOG equ 93 +SYS_SET_PORT_DIALOG equ 94 +SYS_SET_HSHK_DIALOG equ 95 +SYS_PRINTER_CONFIG_DIALOG equ 96 +SYS_EVAL_DIALOG equ 97 +SYS_COUNTRY_SELECTOR_DIALOG equ 98 +SYS_SMART_DIAL_ITEM equ 99 +SYS_SMART_DIAL_DIALOG equ 100 +SYS_FREEDIAL_DIALOG equ 101 +SYS_FLIST_DIALOG equ 102 +SYS_PRINT_CONTROL_DL equ 103 +SYS_PAGING_CONTROL_DL equ 104 +SYS_PRINTER_MODEL equ 105 +SYS_MARGINS_DL equ 106 +SYS_HEADFOOT_DL equ 107 +SYS_PAGESIZE_DL equ 108 +SYS_FONT_DL equ 109 +SYS_TXTMESS equ 110 +SYS_HELP_INDEX_DATA equ 111 +SYS_HELP_INDEX equ 112 +SYS_HELP_ON_HELP equ 113 +SYS_HELP_DIALOG equ 114 +SYS_HELP_STATWIN equ 115 +SYS_HELP_DIALLING equ 116 +SYS_HELP_FILSELS equ 117 +SYS_HELP_EDIT equ 118 +SYS_HELP_X_HELP equ 119 +SYS_HELP_FILES equ 120 +SYS_HELP_PRINT equ 121 +SYS_TIME_BASICS equ 122 +SYS_HELP_ON_OFF equ 123 +SYS_HELP_X_INDEX equ 124 +SYS_WDR_GENERAL equ 125 +SYS_DIAL_OUT equ 126 +SYS_SKIPPING_PAGE equ 127 +SYS_DEBUGGING_NUM_CELLS equ 128 +SYS_CALENDAR equ 129 +SYS_PAGE equ 130 +SYS_PAGES equ 131 +SYS_PREVIEW_BUSY equ 132 +SYS_DISPLAY_MARGINS equ 133 +SYS_HIDE_MARGINS equ 134 +SYS_OPENING_PROMPT equ 135 +SYS_PRINT_PREVIEW equ 136 +SYS_PREVIEW_MARGINS_CHLIST equ 137 +SYS_PREVIEW_OPTIONS_CHLIST equ 138 +SYS_PREVIEW_OPTIONS_DIALOG equ 139 +SYS_PREVIEW_JUMP_DIALOG equ 140 +SYS_PREVIEW_ACC equ 141 +SYS_PREVIEW_MENUBAR equ 142 +SYS_PREVIEW_MENU equ 143 +SYS_PRINTER_DEVICES equ 144 +SYS_PRINT_CONTROL_DEVICE equ 145 +SYS_PRINT_PREVIEW_SETTINGS equ 146 +SYS_PREVIEW_SETTINGS_DL equ 147 +SYS_STANDARD_SOUNDS equ 148 +SYS_ALARM_STANDARD_NAME equ 149 +SYS_SILENT_ALARM equ 150 +SYS_SOUND_DISABLED equ 151 +SYS_WORD_ROM equ 152 +SYS_RESTART_FROM_SYS equ 153 +SRT_FILE_CREATED equ 154 +SRT_FILE_OPENED equ 155 +SRT_FILE_SAVED equ 156 +SRT_FILE_COMPRESSED equ 157 +SRT_FILE_MERGED equ 158 +SYS_SAVING_PROMPT equ 159 +SYS_RELOADING_PROMPT equ 160 +SYS_CONVERTING_PROMPT equ 161 +SYS_NOT_CHANGED equ 162 +SYS_CONFIRM_CONTINUE equ 163 +SYS_CONFIRM_CHANGE_LOSS equ 164 +SYS_LOSING_CHANGES equ 165 +SYS_NOTHING_TO_PRINT equ 166 +SYS_NOTHING_TO_INSERT equ 167 +SYS_NOTHING_TO_COPY equ 168 +SYS_REVERT_TO_SAVED equ 169 +SYS_SHIFT_KEY_NAME equ 170 +SRT_SPACE_ONLY equ 171 +SYS_CHANGE_PASSWORD equ 172 +SYS_SET_PASSWORD_DL equ 173 +SYS_GET_PASSWORD_DL equ 174 +SYS_HELP_EVALUATE equ 175 +SYS_HELP_MEMO equ 176 +SYS_HELP_IN_USE equ 177 +SYS_HELP_NO_SYS_MEM equ 178 +SYS_HELP_CALENDAR equ 179 +SYS_S3C_PRINT_CONTROL_DL equ 180 +SYS_S3C_PAGE_SETUP equ 181 +SYS_HELP_BATTERY equ 182 +SYS_VINE_FILE_INFO_DL equ 183 +SYS_RUSSIAN_KEYS equ 184 +SYS_HELP_INFRARED equ 185 +SYS_HELP_APPNOTREADY equ 186 +SYS_IR_DISABLED equ 187 +SYS_IR_POWER_LEVEL equ 188 +SYS_PRINTER_IR equ 189 +SYS_BAUD_RATE_CHLIST_X equ 190 +SYS_BAUD_CONTROL_X equ 191 diff --git a/code/SIBOSDK/include/scprndlg.g b/code/SIBOSDK/include/scprndlg.g new file mode 100644 index 0000000..74dd373 --- /dev/null +++ b/code/SIBOSDK/include/scprndlg.g @@ -0,0 +1,48 @@ +/* Generated by Ctran from scprndlg.cl */ +#define SCPRNDLG_G +#ifndef DLGBOX_G +#include +#endif +#ifndef GATE_G +#include +#endif +#ifndef SCRLAY_G +#include +#endif +#ifndef FONTDLG_G +#include +#endif +#ifndef PRNTDLGS_G +#include +#endif +#ifndef P_FILE_H +#include +#endif +#ifndef P_SERIAL_H +#include +#endif +/* Class Numbers */ +#define C_SCPRNCTL 18 +#define C_SCPGSETUP 19 +/* Method Numbers */ +/* Property of scprnctl */ +typedef struct { +PVV_DISPLAY Disp; +} PRS_SCPRNCTL; +typedef struct pr_scprnctl +{ +PRS_ROOT root; +PRS_WIN win; +PRS_DLGCHAIN dlgchain; +PRS_DLGBOX dlgbox; +PRS_SCPRNCTL scprnctl; +} PR_SCPRNCTL; +/* Property of scpgsetup */ +typedef struct pr_scpgsetup +{ +PRS_ROOT root; +PRS_WIN win; +PRS_DLGCHAIN dlgchain; +PRS_DLGBOX dlgbox; +PRS_PRNCTRL prnctrl; +} PR_SCPGSETUP; diff --git a/code/SIBOSDK/include/scprndlg.ing b/code/SIBOSDK/include/scprndlg.ing new file mode 100644 index 0000000..a34e620 --- /dev/null +++ b/code/SIBOSDK/include/scprndlg.ing @@ -0,0 +1,46 @@ +; Generated by Ctran from scprndlg.cl +SCPRNDLG_ING equ 1 +IFNDEF DLGBOX_ING + INCLUDE ..\inc\DLGBOX.ING +ENDIF +IFNDEF GATE_ING + INCLUDE ..\inc\GATE.ING +ENDIF +IFNDEF SCRLAY_ING + INCLUDE ..\inc\SCRLAY.ING +ENDIF +IFNDEF FONTDLG_ING + INCLUDE ..\inc\FONTDLG.ING +ENDIF +IFNDEF PRNTDLGS_ING + INCLUDE ..\inc\PRNTDLGS.ING +ENDIF +IFNDEF P_FILE_INC + INCLUDE ..\inc\P_FILE.INC +ENDIF +IFNDEF P_SERIAL_INC + INCLUDE ..\inc\P_SERIAL.INC +ENDIF +; Class Numbers +C_SCPRNCTL equ 18 +C_SCPGSETUP equ 19 +; Method Numbers +; Property of scprnctl +PRS_SCPRNCTL struc +ScprnctlDisp PVV_DISPLAY <> +PRS_SCPRNCTL ends +PR_SCPRNCTL struc +ScprnctlRoot PRS_ROOT <> +ScprnctlWin PRS_WIN <> +ScprnctlDlgchain PRS_DLGCHAIN <> +ScprnctlDlgbox PRS_DLGBOX <> +ScprnctlScprnctl PRS_SCPRNCTL <> +PR_SCPRNCTL ends +; Property of scpgsetup +PR_SCPGSETUP struc +ScpgsetupRoot PRS_ROOT <> +ScpgsetupWin PRS_WIN <> +ScpgsetupDlgchain PRS_DLGCHAIN <> +ScpgsetupDlgbox PRS_DLGBOX <> +ScpgsetupPrnctrl PRS_PRNCTRL <> +PR_SCPGSETUP ends diff --git a/code/SIBOSDK/include/scrimg.g b/code/SIBOSDK/include/scrimg.g new file mode 100644 index 0000000..e619e56 --- /dev/null +++ b/code/SIBOSDK/include/scrimg.g @@ -0,0 +1,111 @@ +/* Generated by Ctran from scrimg.cat */ +#define SCRIMG_G +#ifndef SCRLAY_G +#include +#endif +#ifndef APPMAN_G +#include +#endif +#ifndef WLIB_H +#include +#endif +/* Class Numbers */ +#define C_WRAP 2 +#define C_SCRIMG 3 +/* Method Numbers */ +#define O_SI_SENSE 3 +#define O_SI_FWD_CHANGE 16 +#define O_SI_STYLE_CHANGED 14 +#define O_SI_DOC_RESET 12 +#define O_SI_MOVE_CURSOR 9 +#define O_SI_DELPREP 15 +#define O_SI_GET_SELECT 5 +#define O_SI_REDRAW 10 +#define O_SI_EMPHASIZE 4 +#define O_SI_SCROLL 7 +#define O_SI_PAN 6 +#define O_SI_PARA_CHANGED 13 +#define O_SI_SET 2 +#define O_SI_DOC_CHANGED 11 +#define O_SI_INIT 1 +#define O_SI_VIEW 8 +/* Property of wrap */ +typedef struct { +void *scrimg; +} PRS_WRAP; +typedef struct pr_wrap +{ +PRS_ROOT root; +PRS_ACTIVE active; +PRS_WRAP wrap; +} PR_WRAP; +/* Constants for scrimg */ +#define SCRIMG_LINEDN 0x00 +#define SCRIMG_LINEUP 0x01 +#define SCRIMG_PAGEDN 0x02 +#define SCRIMG_PAGEUP 0x03 +#define SCRIMG_LINBEG 0x04 +#define SCRIMG_LINEND 0x05 +#define SCRIMG_SETPOS 0x06 +#define SCRIMG_FORMAT_DELETE_LEFT 1 +#define SCRIMG_FORMAT_DELETE_RIGHT 2 +#define SCRIMG_FORMAT_TYPING 3 +#define SCRIMG_PAN_SETNOPAN 0 +#define SCRIMG_PAN_DELTA 1 +#define SCRIMG_PAN_ABS 2 +#define SCRIMG_STCHNG_DOC 0 +#define SCRIMG_STCHNG_PARA 1 +#define SCRIMG_STCHNG_LINE 2 +#define SCRIMG_FLAGS_PAGEBREAK 0x01 +#define SCRIMG_FLAGS_S3_COMPAT 0x02 +/* Types for scrimg */ +typedef struct +{ +unsigned short int wid; +P_POINT tl; +short int nlines; +unsigned char lheight; +unsigned char lascent; +short int width; +short int margin; +short int lcfont; +unsigned char cwidth; +unsigned char lcstyle; +unsigned char lccode; +unsigned char hscrlx; +unsigned char hscrlm; +unsigned char drawplabs; +} SCRIMG_WIN; +/* Property of scrimg */ +typedef struct { +PR_WRAP *wrap; +PR_SCRLAY *lay; +SCRIMG_WIN win; +SCRLAY_PLX anc; +SCRLAY_PLX crs; +SCRLAY_PLX oldcrs; +short int txwidth; +short int mrwidth; +short int xleft; +short int xright; +unsigned char lcwidth; +unsigned char lcline; +short int updownx; +unsigned char select; +unsigned char formatting; +unsigned char isredraw; +unsigned char GCcreated; +unsigned char emphasised; +unsigned char plabchange; +unsigned char nopan; +unsigned char flags; +short int lfmt; +short int lgood; +short int xo; +G_GC gc; +} PRS_SCRIMG; +typedef struct pr_scrimg +{ +PRS_ROOT root; +PRS_SCRIMG scrimg; +} PR_SCRIMG; diff --git a/code/SIBOSDK/include/scrimg.ing b/code/SIBOSDK/include/scrimg.ing new file mode 100644 index 0000000..a93aee8 --- /dev/null +++ b/code/SIBOSDK/include/scrimg.ing @@ -0,0 +1,108 @@ +; Generated by Ctran from scrimg.cl +SCRIMG_ING equ 1 +IFNDEF SCRLAY_ING + INCLUDE ..\inc\SCRLAY.ING +ENDIF +IFNDEF APPMAN_ING + INCLUDE ..\inc\APPMAN.ING +ENDIF +IFNDEF WLIB_INC + INCLUDE ..\inc\WLIB.INC +ENDIF +; Class Numbers +C_WRAP equ 2 +C_SCRIMG equ 3 +; Method Numbers +O_SI_SENSE equ 3 +O_SI_FWD_CHANGE equ 16 +O_SI_STYLE_CHANGED equ 14 +O_SI_DOC_RESET equ 12 +O_SI_MOVE_CURSOR equ 9 +O_SI_DELPREP equ 15 +O_SI_GET_SELECT equ 5 +O_SI_REDRAW equ 10 +O_SI_EMPHASIZE equ 4 +O_SI_SCROLL equ 7 +O_SI_PAN equ 6 +O_SI_PARA_CHANGED equ 13 +O_SI_SET equ 2 +O_SI_DOC_CHANGED equ 11 +O_SI_INIT equ 1 +O_SI_VIEW equ 8 +; Property of wrap +PRS_WRAP struc +WrapScrimg dw ? +PRS_WRAP ends +PR_WRAP struc +WrapRoot PRS_ROOT <> +WrapActive PRS_ACTIVE <> +WrapWrap PRS_WRAP <> +PR_WRAP ends +; Constants for scrimg +SCRIMG_LINEDN equ (000h) +SCRIMG_LINEUP equ (001h) +SCRIMG_PAGEDN equ (002h) +SCRIMG_PAGEUP equ (003h) +SCRIMG_LINBEG equ (004h) +SCRIMG_LINEND equ (005h) +SCRIMG_SETPOS equ (006h) +SCRIMG_FORMAT_DELETE_LEFT equ (1) +SCRIMG_FORMAT_DELETE_RIGHT equ (2) +SCRIMG_FORMAT_TYPING equ (3) +SCRIMG_PAN_SETNOPAN equ (0) +SCRIMG_PAN_DELTA equ (1) +SCRIMG_PAN_ABS equ (2) +SCRIMG_STCHNG_DOC equ (0) +SCRIMG_STCHNG_PARA equ (1) +SCRIMG_STCHNG_LINE equ (2) +SCRIMG_FLAGS_PAGEBREAK equ (001h) +SCRIMG_FLAGS_S3_COMPAT equ (002h) +; Types for scrimg +SCRIMG_WIN struc +SCRIMG_WINWid dw ? +SCRIMG_WINTl P_POINT <> +SCRIMG_WINNlines dw ? +SCRIMG_WINLheight db ? +SCRIMG_WINLascent db ? +SCRIMG_WINWidth dw ? +SCRIMG_WINMargin dw ? +SCRIMG_WINLcfont dw ? +SCRIMG_WINCwidth db ? +SCRIMG_WINLcstyle db ? +SCRIMG_WINLccode db ? +SCRIMG_WINHscrlx db ? +SCRIMG_WINHscrlm db ? +SCRIMG_WINDrawplabs db ? +SCRIMG_WIN ends +; Property of scrimg +PRS_SCRIMG struc +ScrimgWrap dw ? +ScrimgLay dw ? +ScrimgWin SCRIMG_WIN <> +ScrimgAnc SCRLAY_PLX <> +ScrimgCrs SCRLAY_PLX <> +ScrimgOldcrs SCRLAY_PLX <> +ScrimgTxwidth dw ? +ScrimgMrwidth dw ? +ScrimgXleft dw ? +ScrimgXright dw ? +ScrimgLcwidth db ? +ScrimgLcline db ? +ScrimgUpdownx dw ? +ScrimgSelect db ? +ScrimgFormatting db ? +ScrimgIsredraw db ? +ScrimgGCcreated db ? +ScrimgEmphasised db ? +ScrimgPlabchange db ? +ScrimgNopan db ? +ScrimgFlags db ? +ScrimgLfmt dw ? +ScrimgLgood dw ? +ScrimgXo dw ? +ScrimgGc G_GC <> +PRS_SCRIMG ends +PR_SCRIMG struc +ScrimgRoot PRS_ROOT <> +ScrimgScrimg PRS_SCRIMG <> +PR_SCRIMG ends diff --git a/code/SIBOSDK/include/scrlay.g b/code/SIBOSDK/include/scrlay.g new file mode 100644 index 0000000..5670dda --- /dev/null +++ b/code/SIBOSDK/include/scrlay.g @@ -0,0 +1,255 @@ +/* Generated by Ctran from scrlay.cat */ +#define SCRLAY_G +#ifndef OLIB_G +#include +#endif +#ifndef P_GRAF_H +#include +#endif +/* Class Numbers */ +#define C_SCRLAY 0 +#define C_PRNLAY 1 +/* Method Numbers */ +#define O_SL_FORMAT_LINE 9 +#define O_SL_POS_TO_XL 5 +#define O_SL_SCROLL 10 +#define O_SL_PARA_CHANGED 14 +#define O_SL_RESCALE 15 +#define O_SL_LINE_ENDS 4 +#define O_SL_SET 2 +#define O_SL_SET_LINES 13 +#define O_SL_INIT 1 +#define O_SL_PRINT_POS 17 +#define O_SL_VIEW 11 +#define O_SL_BEGIN_READ 7 +#define O_SL_SENSE 3 +#define O_SL_READ 8 +#define O_SL_PRINT_READ 16 +#define O_SL_XL_TO_POS 6 +#define O_SL_DISCARD_LAYOUT 12 +/* Constants for scrlay */ +#define SCRLAY_SYM_HARD_HYPHEN 7 +#define SCRLAY_SYM_SOFT_HYPHEN 14 +#define SCRLAY_SYM_HARD_SPACE 15 +#define SCRLAY_SYM_SHOW_SPACE 8 +#define SCRLAY_SHOW_TABS 0x01 +#define SCRLAY_SHOW_SPACES 0x02 +#define SCRLAY_SHOW_CRS 0x04 +#define SCRLAY_SHOW_HYPHENS 0x08 +#define SCRLAY_SHOW_LFS 0x10 +#define SCRLAY_WIDOW_ORPHAN 0x20 +#define SCRLAY_ALIGN_LEFT 0 +#define SCRLAY_ALIGN_RIGHT 1 +#define SCRLAY_ALIGN_CENTRE 2 +#define SCRLAY_ALIGN_JUSTIFY 3 +#define SCRLAY_REPEAT_TAB 3 +#define SCRLAY_NTABS_MAX 8 +#define SCRLAY_SCAN_POS 0 +#define SCRLAY_SCAN_XY 1 +#define SCRLAY_SCAN_LINE 2 +#define SCRLAY_SPACING_KEEP_NEXT 0x01 +#define SCRLAY_SPACING_KEEP_TOGETHER 0x02 +#define SCRLAY_SPACING_NEW_PAGE 0x04 +#define SCRLAY_TBOX_TAB 0x8000 +#define SCRLAY_TBOX_TAB_USED 0x4000 +#define SCRLAY_TBOX_TAB_LEFT 0x2000 +#define SCRLAY_TBOX_NO_STYLE 0x1000 +#define SCRLAY_TBOX_MASK_LEN 0xff +/* Types for scrlay */ +typedef struct +{ +unsigned short int x; +unsigned short int type; +} SCRLAY_TABSTOP; +typedef struct +{ +unsigned short int ntab; +SCRLAY_TABSTOP tab[SCRLAY_NTABS_MAX]; +} SCRLAY_TABS; +typedef struct +{ +unsigned short int left; +unsigned short int right; +unsigned short int indent; +unsigned short int align; +} SCRLAY_MARGINS; +typedef struct +{ +unsigned short int line; +unsigned short int above; +unsigned short int below; +unsigned short int flags; +} SCRLAY_SPACING; +typedef struct +{ +unsigned short int fid; +unsigned short int style; +unsigned short int height; +} SCRLAY_FONT; +typedef struct +{ +unsigned short int pos; +short int printer; +char *buf; +short int blen; +} SCRLAY_SENSECHARS; +typedef struct +{ +SCRLAY_MARGINS *margins; +SCRLAY_TABS *tabs; +SCRLAY_SPACING *spacing; +} SCRLAY_PDATA; +typedef struct +{ +SCRLAY_FONT font; +unsigned short int align; +char *buf; +short int blen; +} SCRLAY_PLABEL; +typedef struct +{ +unsigned short int len; +void *content; +short int sensechars; +short int sensepdata; +short int senseplabel; +short int toparst; +short int enqpage; +} SCRLAY_DOC; +typedef struct que_tbox +{ +struct scrlay_tbox *next; +struct scrlay_tbox *prev; +} QUE_TBOX; +typedef struct scrlay_tbox +{ +QUE_TBOX hd; +short int width; +unsigned short int tlen; +} SCRLAY_TBOX; +typedef struct que_line +{ +struct scrlay_line *next; +struct scrlay_line *prev; +} QUE_LINE; +typedef struct scrlay_line +{ +QUE_LINE hd; +QUE_TBOX tboxs; +short int indent; +unsigned short int len; +unsigned char islast; +unsigned char new_page; +} SCRLAY_LINE; +typedef struct que_para +{ +struct scrlay_para *next; +struct scrlay_para *prev; +} QUE_PARA; +typedef struct scrlay_para +{ +QUE_PARA hd; +QUE_LINE lines; +} SCRLAY_PARA; +typedef struct +{ +unsigned short int pos; +short int line; +short int x; +} SCRLAY_PLX; +typedef struct +{ +short int scan; +SCRLAY_PLX test; +SCRLAY_PLX pbeg; +SCRLAY_PLX lbeg; +SCRLAY_PLX tbeg; +SCRLAY_TBOX *pt; +SCRLAY_LINE *pl; +SCRLAY_PARA *pp; +} SCRLAY_SCAN; +typedef struct +{ +SCRLAY_PLABEL *label; +SCRLAY_FONT f; +unsigned short int width; +unsigned short int indent; +unsigned char blen; +unsigned char isfirst; +unsigned char islast; +unsigned char new_page; +} SCRLAY_READ; +typedef struct +{ +SCRLAY_PARA *pp; +SCRLAY_LINE *pl; +SCRLAY_TBOX *pt; +unsigned short int pos; +} SCRLAY_RD; +typedef struct +{ +SCRLAY_PARA *pp; +unsigned short int pos; +short int line; +unsigned short int pend; +short int lend; +} SCRLAY_FMT; +typedef struct +{ +unsigned char options; +unsigned char printer; +SCRLAY_PDATA pd; +SCRLAY_FONT *font; +unsigned char *fwtab; +unsigned short int scrpwidth; +SCRLAY_FONT *sfont; +} SCRLAY_STYLE; +/* Property of scrlay */ +typedef struct { +QUE_PARA paras; +SCRLAY_PLX first; +unsigned char nomemory; +unsigned char adjust; +SCRLAY_SCAN *scan; +SCRLAY_RD rd; +SCRLAY_FMT fmt; +SCRLAY_DOC doc; +short int slines; +short int spadjust; +SCRLAY_STYLE st; +} PRS_SCRLAY; +typedef struct pr_scrlay +{ +PRS_ROOT root; +PRS_SCRLAY scrlay; +} PR_SCRLAY; +/* Types for prnlay */ +typedef struct +{ +SCRLAY_PLABEL s; +unsigned char *wid; +unsigned short int margin; +unsigned short int gutter; +} PRNLAY_PLABEL; +/* Property of prnlay */ +typedef struct { +short int tbxlen; +short int senselen; +char *sensebuf; +unsigned short int pos; +short int line; +short int nlines; +short int below; +short int excess; +short int ngaps; +short int ngap; +short int used; +SCRLAY_TBOX *ptab; +short int plabel; +} PRS_PRNLAY; +typedef struct pr_prnlay +{ +PRS_ROOT root; +PRS_SCRLAY scrlay; +PRS_PRNLAY prnlay; +} PR_PRNLAY; diff --git a/code/SIBOSDK/include/scrlay.ing b/code/SIBOSDK/include/scrlay.ing new file mode 100644 index 0000000..e7a724d --- /dev/null +++ b/code/SIBOSDK/include/scrlay.ing @@ -0,0 +1,231 @@ +; Generated by Ctran from scrlay.cl +SCRLAY_ING equ 1 +IFNDEF OLIB_ING + INCLUDE ..\inc\OLIB.ING +ENDIF +IFNDEF P_GRAF_INC + INCLUDE ..\inc\P_GRAF.INC +ENDIF +; Class Numbers +C_SCRLAY equ 0 +C_PRNLAY equ 1 +; Method Numbers +O_SL_FORMAT_LINE equ 9 +O_SL_POS_TO_XL equ 5 +O_SL_SCROLL equ 10 +O_SL_PARA_CHANGED equ 14 +O_SL_RESCALE equ 15 +O_SL_LINE_ENDS equ 4 +O_SL_SET equ 2 +O_SL_SET_LINES equ 13 +O_SL_INIT equ 1 +O_SL_PRINT_POS equ 17 +O_SL_VIEW equ 11 +O_SL_BEGIN_READ equ 7 +O_SL_SENSE equ 3 +O_SL_READ equ 8 +O_SL_PRINT_READ equ 16 +O_SL_XL_TO_POS equ 6 +O_SL_DISCARD_LAYOUT equ 12 +; Constants for scrlay +SCRLAY_SYM_HARD_HYPHEN equ (7) +SCRLAY_SYM_SOFT_HYPHEN equ (14) +SCRLAY_SYM_HARD_SPACE equ (15) +SCRLAY_SYM_SHOW_SPACE equ (8) +SCRLAY_SHOW_TABS equ (001h) +SCRLAY_SHOW_SPACES equ (002h) +SCRLAY_SHOW_CRS equ (004h) +SCRLAY_SHOW_HYPHENS equ (008h) +SCRLAY_SHOW_LFS equ (010h) +SCRLAY_WIDOW_ORPHAN equ (020h) +SCRLAY_ALIGN_LEFT equ (0) +SCRLAY_ALIGN_RIGHT equ (1) +SCRLAY_ALIGN_CENTRE equ (2) +SCRLAY_ALIGN_JUSTIFY equ (3) +SCRLAY_REPEAT_TAB equ (3) +SCRLAY_NTABS_MAX equ (8) +SCRLAY_SCAN_POS equ (0) +SCRLAY_SCAN_XY equ (1) +SCRLAY_SCAN_LINE equ (2) +SCRLAY_SPACING_KEEP_NEXT equ (001h) +SCRLAY_SPACING_KEEP_TOGETHER equ (002h) +SCRLAY_SPACING_NEW_PAGE equ (004h) +SCRLAY_TBOX_TAB equ (08000h) +SCRLAY_TBOX_TAB_USED equ (04000h) +SCRLAY_TBOX_TAB_LEFT equ (02000h) +SCRLAY_TBOX_NO_STYLE equ (01000h) +SCRLAY_TBOX_MASK_LEN equ (0ffh) +; Types for scrlay +SCRLAY_TABSTOP struc +SCRLAY_TABSTOPX dw ? +SCRLAY_TABSTOPType dw ? +SCRLAY_TABSTOP ends +SCRLAY_TABS struc +SCRLAY_TABSNtab dw ? +SCRLAY_TABSTab db (size SCRLAY_TABSTOP)* SCRLAY_NTABS_MAX dup (?) +SCRLAY_TABS ends +SCRLAY_MARGINS struc +SCRLAY_MARGINSLeft dw ? +SCRLAY_MARGINSRight dw ? +SCRLAY_MARGINSIndent dw ? +SCRLAY_MARGINSAlign dw ? +SCRLAY_MARGINS ends +SCRLAY_SPACING struc +SCRLAY_SPACINGLine dw ? +SCRLAY_SPACINGAbove dw ? +SCRLAY_SPACINGBelow dw ? +SCRLAY_SPACINGFlags dw ? +SCRLAY_SPACING ends +SCRLAY_FONT struc +SCRLAY_FONTFid dw ? +SCRLAY_FONTStyle dw ? +SCRLAY_FONTHeight dw ? +SCRLAY_FONT ends +SCRLAY_SENSECHARS struc +SCRLAY_SENSECHARSPos dw ? +SCRLAY_SENSECHARSPrinter dw ? +SCRLAY_SENSECHARSBuf dw ? +SCRLAY_SENSECHARSBlen dw ? +SCRLAY_SENSECHARS ends +SCRLAY_PDATA struc +SCRLAY_PDATAMargins dw ? +SCRLAY_PDATATabs dw ? +SCRLAY_PDATASpacing dw ? +SCRLAY_PDATA ends +SCRLAY_PLABEL struc +SCRLAY_PLABELFont SCRLAY_FONT <> +SCRLAY_PLABELAlign dw ? +SCRLAY_PLABELBuf dw ? +SCRLAY_PLABELBlen dw ? +SCRLAY_PLABEL ends +SCRLAY_DOC struc +SCRLAY_DOCLen dw ? +SCRLAY_DOCContent dw ? +SCRLAY_DOCSensechars dw ? +SCRLAY_DOCSensepdata dw ? +SCRLAY_DOCSenseplabel dw ? +SCRLAY_DOCToparst dw ? +SCRLAY_DOCEnqpage dw ? +SCRLAY_DOC ends +QUE_TBOX struc +QUE_TBOXNext dw ? +QUE_TBOXPrev dw ? +QUE_TBOX ends +SCRLAY_TBOX struc +SCRLAY_TBOXHd QUE_TBOX <> +SCRLAY_TBOXWidth dw ? +SCRLAY_TBOXTlen dw ? +SCRLAY_TBOX ends +QUE_LINE struc +QUE_LINENext dw ? +QUE_LINEPrev dw ? +QUE_LINE ends +SCRLAY_LINE struc +SCRLAY_LINEHd QUE_LINE <> +SCRLAY_LINETboxs QUE_TBOX <> +SCRLAY_LINEIndent dw ? +SCRLAY_LINELen dw ? +SCRLAY_LINEIslast db ? +SCRLAY_LINENew_page db ? +SCRLAY_LINE ends +QUE_PARA struc +QUE_PARANext dw ? +QUE_PARAPrev dw ? +QUE_PARA ends +SCRLAY_PARA struc +SCRLAY_PARAHd QUE_PARA <> +SCRLAY_PARALines QUE_LINE <> +SCRLAY_PARA ends +SCRLAY_PLX struc +SCRLAY_PLXPos dw ? +SCRLAY_PLXLine dw ? +SCRLAY_PLXX dw ? +SCRLAY_PLX ends +SCRLAY_SCAN struc +SCRLAY_SCANScan dw ? +SCRLAY_SCANTest SCRLAY_PLX <> +SCRLAY_SCANPbeg SCRLAY_PLX <> +SCRLAY_SCANLbeg SCRLAY_PLX <> +SCRLAY_SCANTbeg SCRLAY_PLX <> +SCRLAY_SCANPt dw ? +SCRLAY_SCANPl dw ? +SCRLAY_SCANPp dw ? +SCRLAY_SCAN ends +SCRLAY_READ struc +SCRLAY_READLabel dw ? +SCRLAY_READF SCRLAY_FONT <> +SCRLAY_READWidth dw ? +SCRLAY_READIndent dw ? +SCRLAY_READBlen db ? +SCRLAY_READIsfirst db ? +SCRLAY_READIslast db ? +SCRLAY_READNew_page db ? +SCRLAY_READ ends +SCRLAY_RD struc +SCRLAY_RDPp dw ? +SCRLAY_RDPl dw ? +SCRLAY_RDPt dw ? +SCRLAY_RDPos dw ? +SCRLAY_RD ends +SCRLAY_FMT struc +SCRLAY_FMTPp dw ? +SCRLAY_FMTPos dw ? +SCRLAY_FMTLine dw ? +SCRLAY_FMTPend dw ? +SCRLAY_FMTLend dw ? +SCRLAY_FMT ends +SCRLAY_STYLE struc +SCRLAY_STYLEOptions db ? +SCRLAY_STYLEPrinter db ? +SCRLAY_STYLEPd SCRLAY_PDATA <> +SCRLAY_STYLEFont dw ? +SCRLAY_STYLEFwtab dw ? +SCRLAY_STYLEScrpwidth dw ? +SCRLAY_STYLESfont dw ? +SCRLAY_STYLE ends +; Property of scrlay +PRS_SCRLAY struc +ScrlayParas QUE_PARA <> +ScrlayFirst SCRLAY_PLX <> +ScrlayNomemory db ? +ScrlayAdjust db ? +ScrlayScan dw ? +ScrlayRd SCRLAY_RD <> +ScrlayFmt SCRLAY_FMT <> +ScrlayDoc SCRLAY_DOC <> +ScrlaySlines dw ? +ScrlaySpadjust dw ? +ScrlaySt SCRLAY_STYLE <> +PRS_SCRLAY ends +PR_SCRLAY struc +ScrlayRoot PRS_ROOT <> +ScrlayScrlay PRS_SCRLAY <> +PR_SCRLAY ends +; Types for prnlay +PRNLAY_PLABEL struc +PRNLAY_PLABELS SCRLAY_PLABEL <> +PRNLAY_PLABELWid dw ? +PRNLAY_PLABELMargin dw ? +PRNLAY_PLABELGutter dw ? +PRNLAY_PLABEL ends +; Property of prnlay +PRS_PRNLAY struc +PrnlayTbxlen dw ? +PrnlaySenselen dw ? +PrnlaySensebuf dw ? +PrnlayPos dw ? +PrnlayLine dw ? +PrnlayNlines dw ? +PrnlayBelow dw ? +PrnlayExcess dw ? +PrnlayNgaps dw ? +PrnlayNgap dw ? +PrnlayUsed dw ? +PrnlayPtab dw ? +PrnlayPlabel dw ? +PRS_PRNLAY ends +PR_PRNLAY struc +PrnlayRoot PRS_ROOT <> +PrnlayScrlay PRS_SCRLAY <> +PrnlayPrnlay PRS_PRNLAY <> +PR_PRNLAY ends diff --git a/code/SIBOSDK/include/search.h b/code/SIBOSDK/include/search.h new file mode 100644 index 0000000..84b1fcd --- /dev/null +++ b/code/SIBOSDK/include/search.h @@ -0,0 +1,42 @@ +/* Release 3.00 */ + +/*-------------------------------------------------------------------------* +* * +* search.h - search and sort function prototypes. * +* * +* COPYRIGHT (C) 1989, 1990 Jensen and Partners. All Rights Reserved. * +* * +*--------------------------------------------------------------------------*/ +#include + +#ifndef _SEARCH_INC_ +#define _SEARCH_INC_ + +#ifndef NULL +#define NULL 0 +#endif + +#ifndef _SIZE_T +#define _SIZE_T +typedef unsigned size_t; +#endif + +#ifdef __cplusplus +extern "C" { +#endif +extern void * bsearch(const void *_key, const void *_base, + size_t _num, size_t _width, + int ( *_compare)(const void *_e1, const void *_e2)); +extern void qsort(void *_base, size_t _num, size_t _width, + int ( *_compare)(const void *_e1, const void *_e2)); +extern char * lfind(const char *_key, const char *_base, + unsigned *_num, unsigned _width, + int ( *_compare)(const void *_e1, const void *_e2)); +extern char * lsearch(const char *_key, char *_base, + unsigned *_num, unsigned _width, + int ( *_compare)(const void *_e1, const void *_e2)); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/code/SIBOSDK/include/serdlgs.g b/code/SIBOSDK/include/serdlgs.g new file mode 100644 index 0000000..d756419 --- /dev/null +++ b/code/SIBOSDK/include/serdlgs.g @@ -0,0 +1,28 @@ +/* Generated by Ctran from serdlgs.cl */ +#define SERDLGS_G +#ifndef DLGBOX_G +#include +#endif +#ifndef P_SERIAL_H +#include +#endif +/* Class Numbers */ +#define C_SETPORTDLG 56 +#define C_SETHSHKDLG 57 +/* Method Numbers */ +/* Property of setportdlg */ +typedef struct pr_setportdlg +{ +PRS_ROOT root; +PRS_WIN win; +PRS_DLGCHAIN dlgchain; +PRS_DLGBOX dlgbox; +} PR_SETPORTDLG; +/* Property of sethshkdlg */ +typedef struct pr_sethshkdlg +{ +PRS_ROOT root; +PRS_WIN win; +PRS_DLGCHAIN dlgchain; +PRS_DLGBOX dlgbox; +} PR_SETHSHKDLG; diff --git a/code/SIBOSDK/include/serdlgs.ing b/code/SIBOSDK/include/serdlgs.ing new file mode 100644 index 0000000..78fe3e2 --- /dev/null +++ b/code/SIBOSDK/include/serdlgs.ing @@ -0,0 +1,26 @@ +; Generated by Ctran from serdlgs.cl +SERDLGS_ING equ 1 +IFNDEF DLGBOX_ING + INCLUDE ..\inc\DLGBOX.ING +ENDIF +IFNDEF P_SERIAL_INC + INCLUDE ..\inc\P_SERIAL.INC +ENDIF +; Class Numbers +C_SETPORTDLG equ 56 +C_SETHSHKDLG equ 57 +; Method Numbers +; Property of setportdlg +PR_SETPORTDLG struc +SetportdlgRoot PRS_ROOT <> +SetportdlgWin PRS_WIN <> +SetportdlgDlgchain PRS_DLGCHAIN <> +SetportdlgDlgbox PRS_DLGBOX <> +PR_SETPORTDLG ends +; Property of sethshkdlg +PR_SETHSHKDLG struc +SethshkdlgRoot PRS_ROOT <> +SethshkdlgWin PRS_WIN <> +SethshkdlgDlgchain PRS_DLGCHAIN <> +SethshkdlgDlgbox PRS_DLGBOX <> +PR_SETHSHKDLG ends diff --git a/code/SIBOSDK/include/setjmp.h b/code/SIBOSDK/include/setjmp.h new file mode 100644 index 0000000..459db94 --- /dev/null +++ b/code/SIBOSDK/include/setjmp.h @@ -0,0 +1,46 @@ +/* Release 3.00 */ + +/*-------------------------------------------------------------------------* +* * +* setjmp.h - typedef and function prototypes for setjmp and longjmp. * +* * +* COPYRIGHT (C) 1989, 1990 Jensen and Partners. All Rights Reserved. * +* * +*--------------------------------------------------------------------------*/ +#include + +#ifndef _SETJMP_INC_ +#define _SETJMP_INC_ + +#ifndef _JMPTYPE_DEF +#define _JMPTYPE_DEF + +typedef struct { + unsigned j_flag; + unsigned j_ip; + unsigned j_sp; + unsigned j_bp; + unsigned j_si; + unsigned j_di; + unsigned j_dx; + unsigned j_cx; + unsigned j_bx; + unsigned j_classHandle; + unsigned j_classPtr; + unsigned j_enterFrame; + unsigned j_osFrame; + char j_st[2][10]; +} jmp_buf[1]; +#endif + +#ifdef __cplusplus +extern "C" { +#endif +#pragma save,call(reg_saved=>(ax,bx,cx,dx,ds,es,si,di,st0,st1,st2,st3,st4,st5,st6)) +extern void longjmp(jmp_buf _env, int _val); +#pragma restore +extern int setjmp(jmp_buf _env); +#ifdef __cplusplus +} +#endif +#endif diff --git a/code/SIBOSDK/include/share.h b/code/SIBOSDK/include/share.h new file mode 100644 index 0000000..1fc6f67 --- /dev/null +++ b/code/SIBOSDK/include/share.h @@ -0,0 +1,25 @@ +/* Release 3.00 */ + +/*-------------------------------------------------------------------------* +* * +* share.h - header file for file sharing used with sopen. * +* * +* COPYRIGHT (C) 1989 Jensen and Partners. All Rights Reserved * +* * +*--------------------------------------------------------------------------*/ +#include + +#ifndef _SHARE_INC_ +#define _SHARE_INC_ + +#define SH_NOINHERIT 0x80 +#define SH_COMPAT 0x00 +#define SH_DENYRW 0x10 +#define SH_DENYWR 0x20 +#define SH_DENYRD 0x30 +#define SH_DENYNO 0x40 + +#define SH_ALL 0xF0 + +#define SH_DENYNONE SH_DENYNO /* MS documentation uses both */ +#endif diff --git a/code/SIBOSDK/include/signal.h b/code/SIBOSDK/include/signal.h new file mode 100644 index 0000000..cb03a22 --- /dev/null +++ b/code/SIBOSDK/include/signal.h @@ -0,0 +1,51 @@ +/* Release 3.00 */ + +/*-------------------------------------------------------------------------* +* * +* signal.h - software signalling definitions and prototypes. * +* * +* COPYRIGHT (C) 1989, 1990 Jensen and Partners. All Rights Reserved. * +* * +*--------------------------------------------------------------------------*/ +#include + +#ifndef _SIGNAL_INC_ +#define _SIGNAL_INC_ + +typedef int sig_atomic_t; +#define NSIG 23 /* maximum signal number + 1 */ + +/* signal types */ +#define SIGINT 2 /* interrupt - corresponds to DOS 3.x int 23H */ +#define SIGILL 4 /* illegal opcode */ +#define SIGFPE 8 /* floating point error */ +#define SIGSEGV 11 /* segment violation */ +#define SIGTERM 15 /* Software termination signal from kill */ +#define SIGUSR1 16 /* User defined signal 1 */ +#define SIGUSR2 17 /* User defined signal 2 */ +#define SIGUSR3 20 /* User defined signal 3 */ +#define SIGABRT 22 /* abnormal termination triggered by abort call */ + +/* signal action codes */ + +#define SIG_DFL (void (*)(int))0L /* default signal action */ +#define SIG_IGN (void (*)(int))1L /* ignore */ +#define SIG_SGE (void (*)(int))3L /* signal gets error */ +#define SIG_ACK (void (*)(int))4L /* error if handler not setup */ + +/* signal error value (returned by signal call on error) */ + +#define SIG_ERR (void (*)(int)) 0xFFFFL /* signal error value */ + +/* function prototypes */ + +#ifdef __cplusplus +extern "C" { +#endif +extern void ( * signal(int _sig, void (*_func)(int _signum)))(int _signum); +extern int raise(int _sig); +#ifdef __cplusplus +} +#endif +#endif + diff --git a/code/SIBOSDK/include/sndlist.g b/code/SIBOSDK/include/sndlist.g new file mode 100644 index 0000000..4eef6fe --- /dev/null +++ b/code/SIBOSDK/include/sndlist.g @@ -0,0 +1,53 @@ +/* Generated by Ctran from sndlist.cl */ +#define SNDLIST_G +#ifndef FACTIVE_G +#include +#endif +#ifndef CHLIST_G +#include +#endif +#ifndef HACTIVE_G +#include +#endif +/* Class Numbers */ +#define C_SNDLIST 75 +#define C_SNDLOCS 76 +#define C_FSOUNDAO 77 +/* Method Numbers */ +/* Constants for sndlist */ +#define SNDLIST_TWOTONE_SOUNDS 2 +#define SNDLIST_TWOTONE_SOUNDS_VINE 6 +/* Property of sndlist */ +typedef struct { +unsigned short int rom_count; +char rom_name_fmt[12]; +} PRS_SNDLIST; +typedef struct pr_sndlist +{ +PRS_ROOT root; +PRS_WIN win; +PRS_LODGER lodger; +PRS_CHLIST chlist; +PRS_SNDLIST sndlist; +} PR_SNDLIST; +/* Property of sndlocs */ +typedef struct { +PR_VARES *data; +} PRS_SNDLOCS; +typedef struct pr_sndlocs +{ +PRS_ROOT root; +PRS_LOCS locs; +PRS_SNDLOCS sndlocs; +} PR_SNDLOCS; +/* Property of fsoundao */ +typedef struct { +void *snd; +} PRS_FSOUNDAO; +typedef struct pr_fsoundao +{ +PRS_ROOT root; +PRS_ACTIVE active; +PRS_HAIDLE haidle; +PRS_FSOUNDAO fsoundao; +} PR_FSOUNDAO; diff --git a/code/SIBOSDK/include/sndlist.ing b/code/SIBOSDK/include/sndlist.ing new file mode 100644 index 0000000..44ceaa1 --- /dev/null +++ b/code/SIBOSDK/include/sndlist.ing @@ -0,0 +1,50 @@ +; Generated by Ctran from sndlist.cl +SNDLIST_ING equ 1 +IFNDEF FACTIVE_ING + INCLUDE ..\inc\FACTIVE.ING +ENDIF +IFNDEF CHLIST_ING + INCLUDE ..\inc\CHLIST.ING +ENDIF +IFNDEF HACTIVE_ING + INCLUDE ..\inc\HACTIVE.ING +ENDIF +; Class Numbers +C_SNDLIST equ 75 +C_SNDLOCS equ 76 +C_FSOUNDAO equ 77 +; Method Numbers +; Constants for sndlist +SNDLIST_TWOTONE_SOUNDS equ (2) +SNDLIST_TWOTONE_SOUNDS_VINE equ (6) +; Property of sndlist +PRS_SNDLIST struc +SndlistRom_count dw ? +SndlistRom_name_fmt db (1) * 12 dup (?) +PRS_SNDLIST ends +PR_SNDLIST struc +SndlistRoot PRS_ROOT <> +SndlistWin PRS_WIN <> +SndlistLodger PRS_LODGER <> +SndlistChlist PRS_CHLIST <> +SndlistSndlist PRS_SNDLIST <> +PR_SNDLIST ends +; Property of sndlocs +PRS_SNDLOCS struc +SndlocsData dw ? +PRS_SNDLOCS ends +PR_SNDLOCS struc +SndlocsRoot PRS_ROOT <> +SndlocsLocs PRS_LOCS <> +SndlocsSndlocs PRS_SNDLOCS <> +PR_SNDLOCS ends +; Property of fsoundao +PRS_FSOUNDAO struc +FsoundaoSnd dw ? +PRS_FSOUNDAO ends +PR_FSOUNDAO struc +FsoundaoRoot PRS_ROOT <> +FsoundaoActive PRS_ACTIVE <> +FsoundaoHaidle PRS_HAIDLE <> +FsoundaoFsoundao PRS_FSOUNDAO <> +PR_FSOUNDAO ends diff --git a/code/SIBOSDK/include/ss_.rsg b/code/SIBOSDK/include/ss_.rsg new file mode 100644 index 0000000..cab4c50 --- /dev/null +++ b/code/SIBOSDK/include/ss_.rsg @@ -0,0 +1,191 @@ +#define SYS_SPECIAL_CHARACTERS 1 +#define SYS_STRING 2 +#define SYS_DIMMED_MSG 3 +#define SYS_LOCKED_MSG 4 +#define SYS_BUSY 5 +#define SYS_SCANNING 6 +#define SYS_PRINTING_TO 7 +#define SYS_PAGE_IS 8 +#define SYS_COPIED_PROMPT 9 +#define SYS_COPYING_PROMPT 10 +#define SYS_LOADING_PROMPT 11 +#define SYS_MERGING_PROMPT 12 +#define SYS_NOTHING_TO_BRING 13 +#define SYS_NOT_FOUND 14 +#define SYS_NOTHING_TO_FIND 15 +#define SYS_COMPRESS_PROMPT 16 +#define SYS_NOT_COMPRESSIBLE 17 +#define SYS_PASSWORD_INCORRECT 18 +#define SYS_PASSWORD_NOT_CONFIRMED 19 +#define SYS_RANGE_RESET 20 +#define SYS_INVALID_NUM 21 +#define SYS_INVALID_MARGINS 22 +#define SYS_INVALID_CHAR 23 +#define SYS_OUT_OF_RANGE 24 +#define SYS_EDIT_NCHARS 25 +#define SYS_POPOUT_HELP 26 +#define SYS_HELP_STRING 27 +#define SYS_REPLACE_DISK 28 +#define SYS_NAME 29 +#define SYS_PACK 30 +#define SYS_FILELIST_DISK 31 +#define SYS_FLIST_RESET 32 +#define SYS_DEVICE_MEMORY 33 +#define SYS_PATH_IS 34 +#define SYS_CHOOSE_DIRECTORY 35 +#define SYS_CHOOSE_FILENAME 36 +#define SYS_CHOOSE_NEW_DIRECTORY 37 +#define SYS_EXISTS_OVER 38 +#define SYS_MAX 39 +#define SYS_MIN 40 +#define SYS_DEC_PLACES 41 +#define SYS_SIG_DIGITS 42 +#define SYS_EVALDLG_TITLE 43 +#define SYS_NOTHING_TO_EVAL 44 +#define SYS_TOOLONG_TO_EVAL 45 +#define SYS_XONXOFF_STRING 46 +#define SYS_HEADER_STR 47 +#define SYS_FOOTER_STR 48 +#define SYS_CENTIMETRES 49 +#define SYS_INCHES 50 +#define SYS_DEV_NOTREADY 51 +#define SYS_DEV_CORRUPT 52 +#define SYS_DEV_UNKNOWN 53 +#define SYS_DEV_INFO 54 +#define SYS_MTYPE_UNKNOWN 55 +#define SYS_MTYPE_FLOPPY 56 +#define SYS_MTYPE_HARD 57 +#define SYS_MTYPE_FLASH 58 +#define SYS_MTYPE_RAM 59 +#define SYS_MTYPE_ROM 60 +#define SYS_MTYPE_PROTECTED 61 +#define SYS_FILES_TAGGED 62 +#define SYS_NO_FILES 63 +#define SYS_NO_DISK 64 +#define SYS_UNFORMATTED 65 +#define SYS_UNRECOGNISED 66 +#define SYS_SOUND_FAIL 67 +#define SYS_BUTTON_TEXT 68 +#define SYS_AC_NO_YES 69 +#define SYS_AC_CONTINUE 70 +#define SYS_AC_ABANDON 71 +#define SYS_APPEND_ACLIST 72 +#define SYS_SMART_DIAL_ACLIST 73 +#define SYS_FREEDIAL_ACLIST 74 +#define SYS_NO_YES 75 +#define SYS_OFFON_MENU 76 +#define SYS_PRINTER_UNITS_CHLIST 77 +#define SYS_PRINTER_DEVICE_CHLIST 78 +#define SYS_BAUD_RATE_CHLIST 79 +#define SYS_DATA_BITS_CHLIST 80 +#define SYS_STOP_BITS_CHLIST 81 +#define SYS_PARITY_CHLIST 82 +#define SYS_FORMAT_CHLIST 83 +#define SYS_RAD_DEG 84 +#define SYS_PAGE_DIMENSIONS 85 +#define SYS_PAGE_SIZE 86 +#define SYS_ORIENT 87 +#define SYS_PRN_POS 88 +#define SYS_HEADFOOT_ALIGN 89 +#define SYS_PGNO_CHOICE 90 +#define SYS_ERROR_DIALOG 91 +#define SYS_QUERY_DIALOG 92 +#define SYS_PRINTING_DIALOG 93 +#define SYS_SET_PORT_DIALOG 94 +#define SYS_SET_HSHK_DIALOG 95 +#define SYS_PRINTER_CONFIG_DIALOG 96 +#define SYS_EVAL_DIALOG 97 +#define SYS_COUNTRY_SELECTOR_DIALOG 98 +#define SYS_SMART_DIAL_ITEM 99 +#define SYS_SMART_DIAL_DIALOG 100 +#define SYS_FREEDIAL_DIALOG 101 +#define SYS_FLIST_DIALOG 102 +#define SYS_PRINT_CONTROL_DL 103 +#define SYS_PAGING_CONTROL_DL 104 +#define SYS_PRINTER_MODEL 105 +#define SYS_MARGINS_DL 106 +#define SYS_HEADFOOT_DL 107 +#define SYS_PAGESIZE_DL 108 +#define SYS_FONT_DL 109 +#define SYS_TXTMESS 110 +#define SYS_HELP_INDEX_DATA 111 +#define SYS_HELP_INDEX 112 +#define SYS_HELP_ON_HELP 113 +#define SYS_HELP_DIALOG 114 +#define SYS_HELP_STATWIN 115 +#define SYS_HELP_DIALLING 116 +#define SYS_HELP_FILSELS 117 +#define SYS_HELP_EDIT 118 +#define SYS_HELP_X_HELP 119 +#define SYS_HELP_FILES 120 +#define SYS_HELP_PRINT 121 +#define SYS_TIME_BASICS 122 +#define SYS_HELP_ON_OFF 123 +#define SYS_HELP_X_INDEX 124 +#define SYS_WDR_GENERAL 125 +#define SYS_DIAL_OUT 126 +#define SYS_SKIPPING_PAGE 127 +#define SYS_DEBUGGING_NUM_CELLS 128 +#define SYS_CALENDAR 129 +#define SYS_PAGE 130 +#define SYS_PAGES 131 +#define SYS_PREVIEW_BUSY 132 +#define SYS_DISPLAY_MARGINS 133 +#define SYS_HIDE_MARGINS 134 +#define SYS_OPENING_PROMPT 135 +#define SYS_PRINT_PREVIEW 136 +#define SYS_PREVIEW_MARGINS_CHLIST 137 +#define SYS_PREVIEW_OPTIONS_CHLIST 138 +#define SYS_PREVIEW_OPTIONS_DIALOG 139 +#define SYS_PREVIEW_JUMP_DIALOG 140 +#define SYS_PREVIEW_ACC 141 +#define SYS_PREVIEW_MENUBAR 142 +#define SYS_PREVIEW_MENU 143 +#define SYS_PRINTER_DEVICES 144 +#define SYS_PRINT_CONTROL_DEVICE 145 +#define SYS_PRINT_PREVIEW_SETTINGS 146 +#define SYS_PREVIEW_SETTINGS_DL 147 +#define SYS_STANDARD_SOUNDS 148 +#define SYS_ALARM_STANDARD_NAME 149 +#define SYS_SILENT_ALARM 150 +#define SYS_SOUND_DISABLED 151 +#define SYS_WORD_ROM 152 +#define SYS_RESTART_FROM_SYS 153 +#define SRT_FILE_CREATED 154 +#define SRT_FILE_OPENED 155 +#define SRT_FILE_SAVED 156 +#define SRT_FILE_COMPRESSED 157 +#define SRT_FILE_MERGED 158 +#define SYS_SAVING_PROMPT 159 +#define SYS_RELOADING_PROMPT 160 +#define SYS_CONVERTING_PROMPT 161 +#define SYS_NOT_CHANGED 162 +#define SYS_CONFIRM_CONTINUE 163 +#define SYS_CONFIRM_CHANGE_LOSS 164 +#define SYS_LOSING_CHANGES 165 +#define SYS_NOTHING_TO_PRINT 166 +#define SYS_NOTHING_TO_INSERT 167 +#define SYS_NOTHING_TO_COPY 168 +#define SYS_REVERT_TO_SAVED 169 +#define SYS_SHIFT_KEY_NAME 170 +#define SRT_SPACE_ONLY 171 +#define SYS_CHANGE_PASSWORD 172 +#define SYS_SET_PASSWORD_DL 173 +#define SYS_GET_PASSWORD_DL 174 +#define SYS_HELP_EVALUATE 175 +#define SYS_HELP_MEMO 176 +#define SYS_HELP_IN_USE 177 +#define SYS_HELP_NO_SYS_MEM 178 +#define SYS_HELP_CALENDAR 179 +#define SYS_S3C_PRINT_CONTROL_DL 180 +#define SYS_S3C_PAGE_SETUP 181 +#define SYS_HELP_BATTERY 182 +#define SYS_VINE_FILE_INFO_DL 183 +#define SYS_RUSSIAN_KEYS 184 +#define SYS_HELP_INFRARED 185 +#define SYS_HELP_APPNOTREADY 186 +#define SYS_IR_DISABLED 187 +#define SYS_IR_POWER_LEVEL 188 +#define SYS_PRINTER_IR 189 +#define SYS_BAUD_RATE_CHLIST_X 190 +#define SYS_BAUD_CONTROL_X 191 diff --git a/code/SIBOSDK/include/ss_.rsi b/code/SIBOSDK/include/ss_.rsi new file mode 100644 index 0000000..20c7b76 --- /dev/null +++ b/code/SIBOSDK/include/ss_.rsi @@ -0,0 +1,191 @@ +SYS_SPECIAL_CHARACTERS equ 1 +SYS_STRING equ 2 +SYS_DIMMED_MSG equ 3 +SYS_LOCKED_MSG equ 4 +SYS_BUSY equ 5 +SYS_SCANNING equ 6 +SYS_PRINTING_TO equ 7 +SYS_PAGE_IS equ 8 +SYS_COPIED_PROMPT equ 9 +SYS_COPYING_PROMPT equ 10 +SYS_LOADING_PROMPT equ 11 +SYS_MERGING_PROMPT equ 12 +SYS_NOTHING_TO_BRING equ 13 +SYS_NOT_FOUND equ 14 +SYS_NOTHING_TO_FIND equ 15 +SYS_COMPRESS_PROMPT equ 16 +SYS_NOT_COMPRESSIBLE equ 17 +SYS_PASSWORD_INCORRECT equ 18 +SYS_PASSWORD_NOT_CONFIRMED equ 19 +SYS_RANGE_RESET equ 20 +SYS_INVALID_NUM equ 21 +SYS_INVALID_MARGINS equ 22 +SYS_INVALID_CHAR equ 23 +SYS_OUT_OF_RANGE equ 24 +SYS_EDIT_NCHARS equ 25 +SYS_POPOUT_HELP equ 26 +SYS_HELP_STRING equ 27 +SYS_REPLACE_DISK equ 28 +SYS_NAME equ 29 +SYS_PACK equ 30 +SYS_FILELIST_DISK equ 31 +SYS_FLIST_RESET equ 32 +SYS_DEVICE_MEMORY equ 33 +SYS_PATH_IS equ 34 +SYS_CHOOSE_DIRECTORY equ 35 +SYS_CHOOSE_FILENAME equ 36 +SYS_CHOOSE_NEW_DIRECTORY equ 37 +SYS_EXISTS_OVER equ 38 +SYS_MAX equ 39 +SYS_MIN equ 40 +SYS_DEC_PLACES equ 41 +SYS_SIG_DIGITS equ 42 +SYS_EVALDLG_TITLE equ 43 +SYS_NOTHING_TO_EVAL equ 44 +SYS_TOOLONG_TO_EVAL equ 45 +SYS_XONXOFF_STRING equ 46 +SYS_HEADER_STR equ 47 +SYS_FOOTER_STR equ 48 +SYS_CENTIMETRES equ 49 +SYS_INCHES equ 50 +SYS_DEV_NOTREADY equ 51 +SYS_DEV_CORRUPT equ 52 +SYS_DEV_UNKNOWN equ 53 +SYS_DEV_INFO equ 54 +SYS_MTYPE_UNKNOWN equ 55 +SYS_MTYPE_FLOPPY equ 56 +SYS_MTYPE_HARD equ 57 +SYS_MTYPE_FLASH equ 58 +SYS_MTYPE_RAM equ 59 +SYS_MTYPE_ROM equ 60 +SYS_MTYPE_PROTECTED equ 61 +SYS_FILES_TAGGED equ 62 +SYS_NO_FILES equ 63 +SYS_NO_DISK equ 64 +SYS_UNFORMATTED equ 65 +SYS_UNRECOGNISED equ 66 +SYS_SOUND_FAIL equ 67 +SYS_BUTTON_TEXT equ 68 +SYS_AC_NO_YES equ 69 +SYS_AC_CONTINUE equ 70 +SYS_AC_ABANDON equ 71 +SYS_APPEND_ACLIST equ 72 +SYS_SMART_DIAL_ACLIST equ 73 +SYS_FREEDIAL_ACLIST equ 74 +SYS_NO_YES equ 75 +SYS_OFFON_MENU equ 76 +SYS_PRINTER_UNITS_CHLIST equ 77 +SYS_PRINTER_DEVICE_CHLIST equ 78 +SYS_BAUD_RATE_CHLIST equ 79 +SYS_DATA_BITS_CHLIST equ 80 +SYS_STOP_BITS_CHLIST equ 81 +SYS_PARITY_CHLIST equ 82 +SYS_FORMAT_CHLIST equ 83 +SYS_RAD_DEG equ 84 +SYS_PAGE_DIMENSIONS equ 85 +SYS_PAGE_SIZE equ 86 +SYS_ORIENT equ 87 +SYS_PRN_POS equ 88 +SYS_HEADFOOT_ALIGN equ 89 +SYS_PGNO_CHOICE equ 90 +SYS_ERROR_DIALOG equ 91 +SYS_QUERY_DIALOG equ 92 +SYS_PRINTING_DIALOG equ 93 +SYS_SET_PORT_DIALOG equ 94 +SYS_SET_HSHK_DIALOG equ 95 +SYS_PRINTER_CONFIG_DIALOG equ 96 +SYS_EVAL_DIALOG equ 97 +SYS_COUNTRY_SELECTOR_DIALOG equ 98 +SYS_SMART_DIAL_ITEM equ 99 +SYS_SMART_DIAL_DIALOG equ 100 +SYS_FREEDIAL_DIALOG equ 101 +SYS_FLIST_DIALOG equ 102 +SYS_PRINT_CONTROL_DL equ 103 +SYS_PAGING_CONTROL_DL equ 104 +SYS_PRINTER_MODEL equ 105 +SYS_MARGINS_DL equ 106 +SYS_HEADFOOT_DL equ 107 +SYS_PAGESIZE_DL equ 108 +SYS_FONT_DL equ 109 +SYS_TXTMESS equ 110 +SYS_HELP_INDEX_DATA equ 111 +SYS_HELP_INDEX equ 112 +SYS_HELP_ON_HELP equ 113 +SYS_HELP_DIALOG equ 114 +SYS_HELP_STATWIN equ 115 +SYS_HELP_DIALLING equ 116 +SYS_HELP_FILSELS equ 117 +SYS_HELP_EDIT equ 118 +SYS_HELP_X_HELP equ 119 +SYS_HELP_FILES equ 120 +SYS_HELP_PRINT equ 121 +SYS_TIME_BASICS equ 122 +SYS_HELP_ON_OFF equ 123 +SYS_HELP_X_INDEX equ 124 +SYS_WDR_GENERAL equ 125 +SYS_DIAL_OUT equ 126 +SYS_SKIPPING_PAGE equ 127 +SYS_DEBUGGING_NUM_CELLS equ 128 +SYS_CALENDAR equ 129 +SYS_PAGE equ 130 +SYS_PAGES equ 131 +SYS_PREVIEW_BUSY equ 132 +SYS_DISPLAY_MARGINS equ 133 +SYS_HIDE_MARGINS equ 134 +SYS_OPENING_PROMPT equ 135 +SYS_PRINT_PREVIEW equ 136 +SYS_PREVIEW_MARGINS_CHLIST equ 137 +SYS_PREVIEW_OPTIONS_CHLIST equ 138 +SYS_PREVIEW_OPTIONS_DIALOG equ 139 +SYS_PREVIEW_JUMP_DIALOG equ 140 +SYS_PREVIEW_ACC equ 141 +SYS_PREVIEW_MENUBAR equ 142 +SYS_PREVIEW_MENU equ 143 +SYS_PRINTER_DEVICES equ 144 +SYS_PRINT_CONTROL_DEVICE equ 145 +SYS_PRINT_PREVIEW_SETTINGS equ 146 +SYS_PREVIEW_SETTINGS_DL equ 147 +SYS_STANDARD_SOUNDS equ 148 +SYS_ALARM_STANDARD_NAME equ 149 +SYS_SILENT_ALARM equ 150 +SYS_SOUND_DISABLED equ 151 +SYS_WORD_ROM equ 152 +SYS_RESTART_FROM_SYS equ 153 +SRT_FILE_CREATED equ 154 +SRT_FILE_OPENED equ 155 +SRT_FILE_SAVED equ 156 +SRT_FILE_COMPRESSED equ 157 +SRT_FILE_MERGED equ 158 +SYS_SAVING_PROMPT equ 159 +SYS_RELOADING_PROMPT equ 160 +SYS_CONVERTING_PROMPT equ 161 +SYS_NOT_CHANGED equ 162 +SYS_CONFIRM_CONTINUE equ 163 +SYS_CONFIRM_CHANGE_LOSS equ 164 +SYS_LOSING_CHANGES equ 165 +SYS_NOTHING_TO_PRINT equ 166 +SYS_NOTHING_TO_INSERT equ 167 +SYS_NOTHING_TO_COPY equ 168 +SYS_REVERT_TO_SAVED equ 169 +SYS_SHIFT_KEY_NAME equ 170 +SRT_SPACE_ONLY equ 171 +SYS_CHANGE_PASSWORD equ 172 +SYS_SET_PASSWORD_DL equ 173 +SYS_GET_PASSWORD_DL equ 174 +SYS_HELP_EVALUATE equ 175 +SYS_HELP_MEMO equ 176 +SYS_HELP_IN_USE equ 177 +SYS_HELP_NO_SYS_MEM equ 178 +SYS_HELP_CALENDAR equ 179 +SYS_S3C_PRINT_CONTROL_DL equ 180 +SYS_S3C_PAGE_SETUP equ 181 +SYS_HELP_BATTERY equ 182 +SYS_VINE_FILE_INFO_DL equ 183 +SYS_RUSSIAN_KEYS equ 184 +SYS_HELP_INFRARED equ 185 +SYS_HELP_APPNOTREADY equ 186 +SYS_IR_DISABLED equ 187 +SYS_IR_POWER_LEVEL equ 188 +SYS_PRINTER_IR equ 189 +SYS_BAUD_RATE_CHLIST_X equ 190 +SYS_BAUD_CONTROL_X equ 191 diff --git a/code/SIBOSDK/include/stat.h b/code/SIBOSDK/include/stat.h new file mode 100644 index 0000000..61a663c --- /dev/null +++ b/code/SIBOSDK/include/stat.h @@ -0,0 +1,50 @@ +/* Release 3.00 */ + +/*----------------------------------------------------------------------------* +* * +* stat.h - Definitions used for file status functions * +* * +* Copyright (c) 1989, 1990 Jensen and Partners. All Rights Reserved. * +* * +*-----------------------------------------------------------------------------*/ +#include + +#ifndef _STAT_INC_ +#define _STAT_INC_ + +#ifndef _STAT_H +#define _STAT_H + +#define S_IFMT 0170000 /* file type mask */ +#define S_IFDIR 0x4000 /* directory */ +#define S_IFCHR 0x2000 /* character device */ +#define S_IFREG 0x8000 /* regular file */ +#define S_IREAD 0x0100 /* owner may read */ +#define S_IWRITE 0x0080 /* owner may write */ +#define S_IEXEC 0x0040 /* owner may execute */ + +struct stat { + short st_dev; + short st_ino; + short st_mode; + short st_nlink; + int st_uid; + int st_gid; + short st_rdev; + long st_size; + long st_atime; + long st_mtime; + long st_ctime; +}; + +#ifdef __cplusplus +extern "C" { +#endif +extern int fstat (int _handle, struct stat *_statbuf); +extern int stat (const char *_path, struct stat *_statbuf); +#ifdef __cplusplus +} +#endif +#endif +#endif + diff --git a/code/SIBOSDK/include/stdarg.h b/code/SIBOSDK/include/stdarg.h new file mode 100644 index 0000000..a3d4f63 --- /dev/null +++ b/code/SIBOSDK/include/stdarg.h @@ -0,0 +1,24 @@ +/* Release 3.00 */ + +/*-------------------------------------------------------------------------* +* * +* stdarg.h - defines for ANSI macros for varaible argument functions * +* * +* COPYRIGHT (C) 1989 Jensen and Partners. All Rights Reserved * +* * +*--------------------------------------------------------------------------*/ +#include + +#ifndef _STDARG_INC_ +#define _STDARG_INC_ + +#ifndef NULL +#define NULL 0 +#endif + +typedef char *va_list; + +#define va_start(ap, plist) ap = (va_list)&plist + sizeof(plist) +#define va_arg(ap, t) (*(t*)((ap += sizeof(t)+(sizeof(t)&1))-(sizeof(t)+(sizeof(t)&1)))) +#define va_end(ap) ap = NULL +#endif diff --git a/code/SIBOSDK/include/stddef.h b/code/SIBOSDK/include/stddef.h new file mode 100644 index 0000000..c4d428f --- /dev/null +++ b/code/SIBOSDK/include/stddef.h @@ -0,0 +1,40 @@ +/* Release 3.00 */ + +/*-------------------------------------------------------------------------* +* * +* stddef.h - definitions of common types. * +* * +* COPYRIGHT (C) 1989 Jensen and Partners. All Rights Reserved * +* * +*--------------------------------------------------------------------------*/ +#include + +#ifndef _STDDEF_INC_ +#define _STDDEF_INC_ + +#ifndef _PTRDIFF_T + #define _PTRDIFF_T + typedef int ptrdiff_t; +#endif + +#ifndef _SIZE_T + #define _SIZE_T + typedef unsigned size_t; +#endif + + +#ifndef _WCHAR_T + #define _WCHAR_T + typedef unsigned char wchar_t; +#endif + +#ifndef _OFFSETOF_M + #define _OFFSETOF_M + #define offsetof(st, member) (size_t)(&((st*)0)->member) +#endif + +#ifndef NULL +#define NULL 0 +#endif + +#endif diff --git a/code/SIBOSDK/include/stdepoc.h b/code/SIBOSDK/include/stdepoc.h new file mode 100644 index 0000000..dab52e1 --- /dev/null +++ b/code/SIBOSDK/include/stdepoc.h @@ -0,0 +1,20 @@ +/* HEADER - STDEPOC.H +Epoc/Os standard C calling convention, structures and constants. +Copyright (c) Psion PLC 1991. + + VER DATE BY DESCRIPTION +----- -------- ---- ----------- +1.00F 26/04/91 NSM Final release +*/ +#ifndef STDEPOC_H +#define STDEPOC_H +#pragma call(reg_saved=>(ax,bx,cx,dx,di,si,ds,st1,st2),\ + reg_param=>(ax,bx,cx,dx,st0,st6,st5,st4,st3),\ + reg_return=>(ax,dx,st0),standard_float=>off,\ + opt_var_arg=>on,c_conv=>off) +#pragma call(seg_name =>null) +#pragma data(ss_in_dgroup =>on,seg_name =>null) +#pragma warn(wall=>on,wpnu=>off,wovr=>off) +#define EPOC_SAVE ds,st1,st2 +#endif + diff --git a/code/SIBOSDK/include/stdio.h b/code/SIBOSDK/include/stdio.h new file mode 100644 index 0000000..9e38a15 --- /dev/null +++ b/code/SIBOSDK/include/stdio.h @@ -0,0 +1,182 @@ +/* Release 3.00 */ + +/*-------------------------------------------------------------------------* +* * +* stdio.h - header file for stream input and output. * +* * +* COPYRIGHT (C) 1989, 1990 Jensen and Partners. All Rights Reserved. * +* * +*--------------------------------------------------------------------------*/ +#include + +#ifndef _STDIO_INC_ +#define _STDIO_INC_ + +#ifndef _SIZE_T +#define _SIZE_T +typedef unsigned size_t; +#endif + +#ifndef NULL +#define NULL 0 +#endif + +#ifndef _STDARG_INC_ +#include +#endif + +#ifndef _ERRNOS_INC_ +#define _ERRNOS_INC_ +extern int _doserrno; /* global DOS error variable */ +extern int errno; /* global error variable */ +#endif + +/* Number of files that can be open simultaneously */ + +#define OPEN_MAX 20 /* Total of 20 open files */ +#define SYS_OPEN 20 + +/* define file control block */ + +#ifndef _IOB +#define _IOB +typedef struct _iobuf { + char *_ptr; /* current char pointer */ + short _cnt; /* buffer free space */ + short _size; /* buffer size */ + char *_base; /* buffer address */ + int _flag; /* file attrib flag */ + int _file; /* file handle */ + int _pback; /* ungot char if no buffer */ +} FILE; +extern FILE _iob[OPEN_MAX]; +#endif + +/* Buffer type to be used as 3rd argument for "setvbuf" function */ + +#define _IOFBF 0 +#define _IOLBF 1 +#define _IONBF 2 + +/* End-of-file constant definition */ + +#define EOF (-1) + +/* Standard I/O predefined streams */ + +#define stdin (&_iob[0]) +#define stdout (&_iob[1]) +#define stderr (&_iob[2]) + +/* flags bit definitions */ + +#define _F_RDWR 0x0003 /* Read/write */ +#define _F_READ 0x0001 /* Read only file */ +#define _F_WRIT 0x0002 /* Write only file */ +#define _F_UBUF 0x0004 /* User allocated buffer */ +#define _F_APP 0x0008 /* Append data */ +#define _F_ERR 0x0010 /* Error */ +#define _F_EOF 0x0020 /* EOF */ +#define _F_BIN 0x0040 /* Binary file */ +#define _F_IN 0x0080 /* Data is incoming */ +#define _F_OUT 0x0100 /* Data is outgoing */ +#define _F_DEV 0x0200 /* File is terminal */ +#define _F_RST 0x0400 /* Newly opened stream */ +#define _F_LBUF 0x0800 /* line buffered stream */ +#define _F_CTZ 0x1000 + +/* Default buffer size use by "setbuf" function */ + +#define BUFSIZ 512 /* Buffer size for stdio */ + +/* Constants to be used as 3rd argument for "fseek" function */ + +#define SEEK_SET 0 +#define SEEK_CUR 1 +#define SEEK_END 2 + +#ifndef _FPOS_T_DEF +#define _FPOS_T_DEF +typedef long fpos_t; +#endif + +#ifdef __cplusplus +extern "C" { +#endif +extern void clearerr(FILE *_st); +extern int fclose(FILE *_st); +extern int fflush(FILE *_st); +extern int fgetc(FILE *_st); +extern char * fgets(char *s, int _n, FILE *_st); +extern FILE * fopen(const char *_path, const char *_mode); +extern int fprintf(FILE *_st, const char *_format, ...); +extern int fputc(int _c, FILE *_st); +extern int fputs(const char *_s, FILE *_st); +extern size_t fread(void *_ptr, size_t _size, size_t _n, FILE *_st); +extern FILE * freopen(const char *_path, const char *_mode,FILE *_oldfile); +extern int fscanf(FILE *_st, const char *_format, ...); +extern int fseek(FILE *_st, long _offset, int _whence); +extern long ftell(FILE *_st); +extern size_t fwrite(const void *_ptr, size_t _size, size_t _n,FILE *_st); +extern char * gets(char *_s); +extern void perror(const char *_s); +extern int printf(const char *_format, ...); +extern int puts(const char *_s); +extern int rename(const char *_oldname, const char *_newname); +extern void rewind(FILE *_st); +extern int rmtmp(void); +extern int scanf(const char *_format, ...); +extern void setbuf(FILE *_st, char *_buf); +extern int setvbuf(FILE *_st, char *_buf, int _type, size_t _size); +extern int sprintf(char *_s, const char *_format, ...); +extern int sscanf(const char *_s, const char *_format, ...); +extern char * strerror(int _errnum); +extern FILE * tmpfile(void); +extern int ungetc(int _c, FILE *_st); +extern int vfprintf(FILE *_st, const char *_format, va_list _argptr); +extern int vfscanf(FILE *_st, const char *_format, va_list _argptr); +extern int vprintf(const char *_format, va_list _argptr); +extern int vscanf(const char *_format, va_list _argptr); +extern int vsprintf(char *_s, const char *_format, va_list _argptr); +extern int vsscanf(const char *_s, const char *_format, va_list _argptr); +extern int fcloseall(void); +extern FILE * fdopen(int _handle, char *_type); +extern int fgetchar(void); +extern int fgetpos(FILE *_st, fpos_t *_fp); +extern int fsetpos(FILE *_st, const fpos_t *_fp); +extern int flushall(void); +extern int fputchar(int _c); +extern int getw(FILE *_st); +extern int putw(int _w, FILE *_st); +extern char * _strerror(const char *_s); +extern int unlink(const char *_path); + +/* common functions normally implemented as macros */ + +extern int putchar(int _c); +extern int getchar(void); +extern int putc(int _c, FILE *_st); +extern int getc(FILE *_st); +extern int remove(const char *_path); +extern int fileno(FILE *_st); +extern int feof(FILE *_st); +extern int ferror(FILE *_st); +#ifdef __cplusplus +} +#endif + +#ifndef __STDC__ +#ifndef _IO_MTF +#define ferror(f) ((f)->_flag & _F_ERR) +#define feof(f) ((f)->_flag & _F_EOF) +#define fileno(f) ((f)->_file) +#define remove(path) unlink(path) +#define getc(f) fgetc(f) +#define putc(c,f) fputc(c,f) +#define getchar() fgetc(stdin) +#define putchar(c) fputc((c), stdout) +#endif +#endif + +#endif + diff --git a/code/SIBOSDK/include/stdiostr.hpp b/code/SIBOSDK/include/stdiostr.hpp new file mode 100644 index 0000000..c2e07c5 --- /dev/null +++ b/code/SIBOSDK/include/stdiostr.hpp @@ -0,0 +1,61 @@ +/* Release 3.10 */ +/*-------------------------------------------------------------------------* +* * +* STDIOSTR.HPP - header file for stdio stream input and output. * +* * +* COPYRIGHT (C) 1990..1992 Clarion Software Corporation * +* All Rights Reserved * +* * +*--------------------------------------------------------------------------*/ +#include + +#ifndef _STDIOSTR_INC_ +#define _STDIOSTR_INC_ + + +#include +#include + +class stdiobuf : public streambuf { + +public: + stdiobuf(FILE *); + ~stdiobuf(); + + FILE *stdiofile(); + virtual int overflow(int = EOF); + virtual int pbackfail(int); + virtual int sync(); + virtual streampos seekoff(streamoff, ios::seek_dir, int); + virtual int underflow(); + +private: + + FILE *sio; + long last_seek; + int gs; + char lahead[2]; + int last_op(); +}; + +inline FILE* stdiobuf::stdiofile() { return sio; } + +class stdiostream : public ios { + +public: + + stdiostream(FILE *); + ~stdiostream(); + + stdiobuf* rdbuf(); + +private: + + stdiobuf buf; + +}; + +inline stdiobuf* stdiostream::rdbuf() { return &buf; } + +#endif + diff --git a/code/SIBOSDK/include/stdlib.h b/code/SIBOSDK/include/stdlib.h new file mode 100644 index 0000000..8d65fe1 --- /dev/null +++ b/code/SIBOSDK/include/stdlib.h @@ -0,0 +1,150 @@ +/* Release 3.00 */ + +/*-------------------------------------------------------------------------* +* * +* stdlib.h - definitions for common variables, types and functions. * +* * +* COPYRIGHT (C) 1989, 1990 Jensen and Partners. All Rights Reserved. * +* * +* * +*--------------------------------------------------------------------------*/ +#include + +#ifndef _STDLIB_INC_ +#define _STDLIB_INC_ + +#ifndef _SIZE_T +#define _SIZE_T +typedef unsigned size_t; +#endif + +#ifndef _WCHAR_T +#define _WCHAR_T +typedef unsigned char wchar_t; +#endif + +#ifndef NULL +#define NULL 0 +#endif + +#define MB_CUR_MAX 1 + +#ifndef _LDIV_T +#define _LDIV_T +typedef struct { + long quot; + long rem; +} ldiv_t; +#endif + +#ifndef _DIV_T +#define _DIV_T +typedef struct { + int quot; + int rem; +} div_t; +#endif + +#ifndef _ERRNOL_INC_ +#define _ERRNOL_INC_ +extern int _doserrno; /* global DOS error variable */ +extern int errno; /* global error variable */ +#endif + +#ifdef __cplusplus +extern "C" { +#endif +extern void abort(void); +extern int abs(int _num); +extern int atexit(void (*_func)(void)); +extern double atof(const char *_nptr); +extern long double atofl(const char *_nptr); +extern int atoi(const char *_nptr); +extern long atol(const char *_nptr); +extern unsigned long atoul(const char *_nptr); +extern void * bsearch(const void *_key, const void *_base, + size_t _nmemb, size_t _size, + int ( *_compare)(const void *_e1, const void *_e2)); +extern void * calloc(size_t _num, size_t _size); +extern void delay(int _tm); +extern div_t div(int _numer, int _denom); +extern char * ecvt(double _value, int _digits, int *_dec, int *_sign); +extern void _exit(int _status); +extern void exit(int _code); +extern char * fcvt(double _value, int _digits, int *_dec, int *_sign); +extern void free(void *_block); +extern char * gcvt(double _value, int _ndec, char *_buf); +extern char * gcvtl(long double _value, int _ndec, char *_buf); +extern char * getenv(const char *_name); +extern char * itoa(int _value, char *_string, int _radix); +extern long labs(long _j); +extern ldiv_t ldiv(long _numer, long _denom); +extern char * lfind(const char *_key, const char *_base, + unsigned *_num, unsigned _width, + int ( *_compare)(const void *_e1, const void *_e2)); +extern unsigned long _lrotl(unsigned long _val, int _count); +extern unsigned long _lrotr(unsigned long _val, int _count); +extern char * lsearch(const char *_key, char *_base, + unsigned *_num, unsigned _width, + int ( *_compare)(const void *_e1, const void *_e2)); +extern char * ltoa(long _value, char *_s, int _radix); +extern void _makepath(char *_path, const char *_drive, const char *_dir, + const char *_name, const char *_ext); +extern void * malloc(size_t _size); +extern int mblen(const char *_s, size_t _n); +extern size_t mbstowcs(wchar_t *_pwcs, const char *_s, size_t _n); +extern int mbtowc(wchar_t *_pwc, const char *_s, size_t _n); +extern void (* onexit(void ( *_func)(void)))(); +extern int putenv(const char *_name); +extern void qsort(void *_base, size_t _nmemb, size_t _size, + int (*_compare)(const void *_e1, const void *_e2)); +extern int rand(void); +extern void randomize(void); +extern void * realloc(void *_block, size_t _size); +extern unsigned _rotl(unsigned _value, int _count); +extern unsigned _rotr(unsigned _value, int _count); + +extern void _searchenv(const char *_name, const char *_env, char *_path); +extern void _splitpath(const char *_path, char *_drive, char *_dir, + char *_name, char *_ext); +extern void srand(unsigned _seed); +extern double strtod(const char *_s, char **_endptr); +extern long strtol(const char *_s, char **_endptr, int _base); +extern unsigned long strtoul(const char *_s, char **_endptr, int _base); +extern void swab(const char *_from, char *_to, int _num); +extern int system(const char *_string); +extern char * ultoa(unsigned long _value, char *_s, int _radix); +extern int wctomb(char *_s, wchar_t _wchar); +extern size_t wcstombs(char *_s, const wchar_t *_pwcs, size_t _n); +#ifdef __cplusplus +} +#endif + + +/* Variables */ + +extern unsigned int _fmode; +extern char * sys_errlist[38]; +extern int sys_nerr; + +#define EXIT_SUCCESS 0 +#define EXIT_FAILURE 0xFF + +#ifndef max +#define max(a,b) (((a) > (b)) ? (a) : (b)) +#endif +#ifndef min +#define min(a,b) (((a) < (b)) ? (a) : (b)) +#endif + +#define random(num) (rand() % (num)) +#define RAND_MAX 32767 + + +#define _MAX_PATH 144 /* maximum length of full pathname */ +#define _MAX_DRIVE 4 /* maximum length of drive component */ +#define _MAX_DIR 130 /* maximum length of path component */ +#define _MAX_FNAME 9 /* maximum length of file name component */ +#define _MAX_EXT 5 /* maximum length of extension component */ + +#endif diff --git a/code/SIBOSDK/include/stream.hpp b/code/SIBOSDK/include/stream.hpp new file mode 100644 index 0000000..2ee5bf2 --- /dev/null +++ b/code/SIBOSDK/include/stream.hpp @@ -0,0 +1,245 @@ +/* Release 3.10 */ +/*-------------------------------------------------------------------------* +* * +* STREAM.HPP - header file for AT&T v1.2 stream input and output. * +* * +* COPYRIGHT (C) 1990..1992 Clarion Software Corporation * +* All Rights Reserved * +* * +*--------------------------------------------------------------------------*/ +#include + +#ifndef __STREAM_INC_ +#define __STREAM_INC_ + +#include + +#pragma save +#pragma name(prefix=>"__o__") + +struct whitespace { + char x; +}; + +extern struct whitespace WS; + +class istream; +class ostream; + +class streambuf { + +friend istream; +friend ostream; + +protected: + + FILE *file; + char *base; + char *pptr; + char *gptr; + char *eptr; + int didalloc; + + virtual int overflow(int = EOF ); + virtual int underflow(); + + int allocate(); + streambuf * setbuf(char *, int , unsigned = 0); + + virtual void terminate(); + +public: + streambuf() { file=0; didalloc=0; base=pptr=gptr=eptr=NULL; } + streambuf(char *buf, int len) { file=0; didalloc=0; setbuf(buf, len); } + virtual ~streambuf(); + + virtual int snextc(); + virtual int sputc(int); + virtual void sputbackc(char); + +}; + +enum open_mode { + input, + output, + append +}; + +class filebuf : public streambuf { + +private: + + int fd; + int isopen; + +protected: + + void terminate(); + +public: + + filebuf() { isopen=0; fd=0; } + filebuf(FILE *); + filebuf(int); + filebuf(int, char *, int); + ~filebuf() { close(); } + + filebuf* open(char *, int); + int close(); + int snextc() { return ::fgetc(file); } + int sputc(int _c) { return ::fputc(_c, file); } + void sputbackc(char _c) { (void) :: ungetc(_c, file); } +}; + +char *dec(long, int = 0); +char *hex(long, int = 0); +char *oct(long, int = 0); +char *chr(int, int = 0); +char *str(const char *, int = 0); +char *form(char *, ...); + +enum stream_state { + _good=0, + _eof=1, + _fail=2, + _bad=4 +}; + +class ostream { + +friend istream; + +private: + + streambuf* stream; + char mystream; + char state; + +public: + + ostream(streambuf *); + ostream(int); + ostream(int, char *); + ~ostream() { (void) flush(); if(mystream) delete stream; } + + operator void*() { return (state == _good) ? this : NULL; } + int operator !() { return (state != _good); } + + ostream& operator <<(int); + ostream& operator <<(long); + ostream& operator <<(unsigned int _U) { return *this << ((long) _U); } + ostream& operator <<(unsigned long); + ostream& operator <<(const char *); + ostream& operator <<(double); + ostream& operator <<(long double); + + ostream& put(char _c) { if(stream->sputc(_c) == EOF) + state = _fail; + return *this; } + + ostream& flush(); + + int rdstate() { return state; } + void clear(int _s = _good) { state = _s; } + int bad() { return (state & _bad); } + int fail() { return (state & _fail); } + int eof() { return (state & _eof); } + int good() { return (state == _good); } + +}; + +class istream { + +friend void eatwhite(istream& _s) {_s >> WS; } + +private: + ostream* tied_to; + streambuf* stream; + char skipping; + char mystream; + int state; + + long getlong(int); + long double getreal(); + +public: + istream(streambuf*, int = 1, ostream* = NULL); + istream(int, char*, int = 1); + istream(int, int = 1, ostream* = NULL); + ~istream() { if(mystream) delete stream; } + + operator void*() { return (state == _good) ? this : NULL; } + int operator !() { return (state != _good); } + + istream& operator >> (signed char& _c) { unsigned char _x; + *this >> _x; + if(state == _good) + _c=(signed char) _x; + return *this; } + + istream& operator >> ( char& _c) { unsigned char _x; + *this >> _x; + if(state == _good) + _c=(char) _x; + return *this; } + + istream& operator >> (short& _s){ short _x= (short) getlong(0); + if(state == _good) + _s=_x; + return *this; } + + istream& operator >> (int& _i) { int _x= (int) getlong(0); + if(state == _good) + _i=_x; + return *this; } + + istream& operator >> (long& _l){ long _x= getlong(0); + if(state == _good) + _l=_x; + return *this; } + + + istream& operator >> (unsigned char& _c); + + istream& operator >> (unsigned short& _s){ unsigned short _x= (unsigned short) getlong(0); + if(state == _good) + _s=_x; + return *this; } + + istream& operator >> (unsigned int& _i){ unsigned int _x= (unsigned int) getlong(0); + if(state == _good) + _i=_x; + return *this; } + + istream& operator >> (unsigned long& _l){ unsigned long _x= (unsigned long) getlong(0); + if(state == _good) + _l=_x; + return *this; } + + istream& operator >>(float&); + istream& operator >>(double&); + istream& operator >>(long double&); + istream& operator >>(char *); + istream& operator >>(whitespace&); + istream& get(char&); + istream& get(char*, int, int = '\n'); + + int skip(int _s) { short _t = skipping; skipping = _s; return _t; } + ostream * tie( ostream *_to ) { ostream *_t = tied_to; tied_to = _to; return _t; } + void putback(char _c) { stream->sputbackc(_c); }; + int rdstate() { return state; } + void clear(int _s = _good) { state = _s; } + int bad() { return (state & _bad); } + int fail() { return (state & _fail); } + int eof() { return (state & _eof); } + int good() { return (state == _good); } + +}; + +extern istream cin; +extern ostream cout; +extern ostream cerr; + +#pragma restore + +#endif diff --git a/code/SIBOSDK/include/string.h b/code/SIBOSDK/include/string.h new file mode 100644 index 0000000..f8e0ecf --- /dev/null +++ b/code/SIBOSDK/include/string.h @@ -0,0 +1,74 @@ +/* Release 3.00 */ + +/*-------------------------------------------------------------------------* +* * +* string.h - Definitions for string and memory functions. * +* * +* COPYRIGHT (C) 1989, 1990 Jensen and Partners. All Rights Reserved. * +* * +*--------------------------------------------------------------------------*/ +#include + +#ifndef _STRING_INC_ +#define _STRING_INC_ + +#ifndef _SIZE_T +#define _SIZE_T +typedef unsigned size_t; +#endif + +#ifndef NULL +#define NULL 0 +#endif + +#ifdef __cplusplus +extern "C" { +#endif +extern int memcmp(const void *_s1, const void *_s2, size_t _n); +extern void * memcpy(void *_dest, const void *_source, size_t _n); +extern void * memset(void *_s, int _c, size_t _n); +extern char * strcat(char *_dest, const char *_source); +extern int strcmp(const char *_s1, const char *_s2); +extern char * strcpy(char *_dest, const char *_source); +extern size_t strlen(const char *_s); +extern char * strset(char *_s, int _ch); +extern void * memccpy(void *_dest, const void *_source, int _c, size_t _n); +extern void * memchr(const void *_s, int _c, size_t _n); +extern int memicmp(const void *_s1, const void *_s2, size_t _n); +extern void * memmove(void *_dest, const void *_source, size_t _n); +extern void movmem(void *_src, void *_dest, unsigned length); +extern void setmem(void *_dest, unsigned length, char val); +extern void * memwcpy(void *_dest, const void *_source, size_t _n); +extern void * memwmove(void *_dest, const void *_source, size_t _n); +extern void * memwset(void *_s, int _c, size_t _n); +extern char * stpcpy(char *_dest, const char *_source); +extern char * strchr(const char *_s, int _c); +extern int strcoll(const char *_s1, const char *_s2); +extern size_t strxfrm(char *_s1, const char *_s2, size_t _n); +extern size_t strcspn(const char *_s1, const char *_s2); +extern char * strdup(const char *_s); +extern char * strerror(int _errnum); +extern int stricmp(const char *_s1, const char *_s2); +extern char * strlwr(char *_s); +extern char * strncat(char *_dest, const char *_source, size_t _n); +extern int strncmp(const char *_s1, const char *_s2, size_t _n); +extern char * strncpy(char *_dest, const char *_source, size_t _n); +extern int strnicmp(const char *_s1, const char *_s2, size_t _n); +extern char * strnset(char *_s, int _ch, size_t _n); +extern char * strpbrk(const char *_s1, const char *_s2); +extern char * strrchr(const char *_s, int _c); +extern char * strrev(char *_s); +extern size_t strspn(const char *_s1, const char *_s2); +extern char * strstr(const char *_s1, const char *_s2); +extern char * strtok(char *_s1, const char *_s2); +extern char * strupr(char *_s); +extern char * _strerror (const char *_s); +#ifdef __cplusplus +} +#endif + +/* compatibility with other compilers */ +#define strcmpi(s1,s2) stricmp(s1,s2) +#define strncmpi(s1,s2,n) strnicmp(s1,s2,n) + +#endif diff --git a/code/SIBOSDK/include/strstrea.hpp b/code/SIBOSDK/include/strstrea.hpp new file mode 100644 index 0000000..8a1a782 --- /dev/null +++ b/code/SIBOSDK/include/strstrea.hpp @@ -0,0 +1,108 @@ +/* Release 3.10 */ +/*-------------------------------------------------------------------------* +* * +* STRSTREA.HPP - header file for string stream input and output. * +* * +* COPYRIGHT (C) 1990..1992 Clarion Software Corporation * +* All Rights Reserved * +* * +*--------------------------------------------------------------------------*/ +#include + +#ifndef _STRSTREAM_INC_ +#define _STRSTREAM_INC_ + +#include + +class strstreambuf : public streambuf { + +public: + strstreambuf(); + strstreambuf(int _n); + strstreambuf(void * (*a)(long), void (*f)(void*)); + strstreambuf(char *_s, int , char *_start=NULL); + ~strstreambuf(); + + void freeze(int = 1); + char *str(); + virtual int doallocate(); + virtual int overflow(int); + virtual int underflow(); + virtual streambuf *setbuf(char *, int); + virtual streampos seekoff(streamoff, ios::seek_dir, int); + +private: + + enum { + dynamic = 1, + frozen = 2, + unlimited = 4 }; + + void * (*allocf)(long); + void (*freef)(void *); + void init(char *, int, char *); + short flags; + int next_alloc; +}; + +class strstreambase : public virtual ios { + +public: + + strstreambuf* rdbuf(); + +protected: + + strstreambase(char *, int, char *); + strstreambase(); + ~strstreambase(); + +private: + + strstreambuf buf; + +}; + +inline strstreambuf* strstreambase::rdbuf() { return &this->buf; } + +class istrstream : public strstreambase, public istream { + +public: + + istrstream(char *); + istrstream(char *, int); + ~istrstream(); +}; + +class ostrstream : public strstreambase, public ostream { + +public: + + ostrstream(); + ostrstream(char *, int, int); + ~ostrstream(); + + char *str(); + int pcount(); + +}; + +inline char *ostrstream::str() { return strstreambase::rdbuf()->str(); } +inline int ostrstream::pcount() { return strstreambase::rdbuf()->out_waiting(); } + +class strstream : public strstreambase, public iostream { + +public: + + strstream(); + strstream(char *, int _sz, int _m); + ~strstream(); + + char *str(); + +}; + +inline char *strstream::str() { return strstreambase::rdbuf()->str(); } + +#endif + diff --git a/code/SIBOSDK/include/sw_.rsg b/code/SIBOSDK/include/sw_.rsg new file mode 100644 index 0000000..2ce8a68 --- /dev/null +++ b/code/SIBOSDK/include/sw_.rsg @@ -0,0 +1,182 @@ +#define SYS_SPECIAL_CHARACTERS 1 +#define SYS_STRING 2 +#define SYS_DIMMED_MSG 3 +#define SYS_LOCKED_MSG 4 +#define SYS_BUSY 5 +#define SYS_SCANNING 6 +#define SYS_PRINTING_TO 7 +#define SYS_PAGE_IS 8 +#define SYS_COPIED_PROMPT 9 +#define SYS_COPYING_PROMPT 10 +#define SYS_LOADING_PROMPT 11 +#define SYS_MERGING_PROMPT 12 +#define SYS_NOTHING_TO_BRING 13 +#define SYS_NOT_FOUND 14 +#define SYS_NOTHING_TO_FIND 15 +#define SYS_COMPRESS_PROMPT 16 +#define SYS_NOT_COMPRESSIBLE 17 +#define SYS_PASSWORD_INCORRECT 18 +#define SYS_PASSWORD_NOT_CONFIRMED 19 +#define SYS_RANGE_RESET 20 +#define SYS_INVALID_NUM 21 +#define SYS_INVALID_MARGINS 22 +#define SYS_INVALID_CHAR 23 +#define SYS_OUT_OF_RANGE 24 +#define SYS_EDIT_NCHARS 25 +#define SYS_POPOUT_HELP 26 +#define SYS_HELP_STRING 27 +#define SYS_REPLACE_DISK 28 +#define SYS_NAME 29 +#define SYS_PACK 30 +#define SYS_FILELIST_DISK 31 +#define SYS_FLIST_RESET 32 +#define SYS_DEVICE_MEMORY 33 +#define SYS_PATH_IS 34 +#define SYS_CHOOSE_DIRECTORY 35 +#define SYS_CHOOSE_FILENAME 36 +#define SYS_CHOOSE_NEW_DIRECTORY 37 +#define SYS_EXISTS_OVER 38 +#define SYS_MAX 39 +#define SYS_MIN 40 +#define SYS_DEC_PLACES 41 +#define SYS_SIG_DIGITS 42 +#define SYS_EVALDLG_TITLE 43 +#define SYS_NOTHING_TO_EVAL 44 +#define SYS_TOOLONG_TO_EVAL 45 +#define SYS_XONXOFF_STRING 46 +#define SYS_HEADER_STR 47 +#define SYS_FOOTER_STR 48 +#define SYS_CENTIMETRES 49 +#define SYS_INCHES 50 +#define SYS_DEV_NOTREADY 51 +#define SYS_DEV_CORRUPT 52 +#define SYS_DEV_UNKNOWN 53 +#define SYS_DEV_INFO 54 +#define SYS_MTYPE_UNKNOWN 55 +#define SYS_MTYPE_FLOPPY 56 +#define SYS_MTYPE_HARD 57 +#define SYS_MTYPE_FLASH 58 +#define SYS_MTYPE_RAM 59 +#define SYS_MTYPE_ROM 60 +#define SYS_MTYPE_PROTECTED 61 +#define SYS_FILES_TAGGED 62 +#define SYS_NO_FILES 63 +#define SYS_NO_DISK 64 +#define SYS_UNFORMATTED 65 +#define SYS_UNRECOGNISED 66 +#define SYS_SOUND_FAIL 67 +#define SYS_BUTTON_TEXT 68 +#define SYS_AC_NO_YES 69 +#define SYS_AC_CONTINUE 70 +#define SYS_AC_ABANDON 71 +#define SYS_APPEND_ACLIST 72 +#define SYS_SMART_DIAL_ACLIST 73 +#define SYS_FREEDIAL_ACLIST 74 +#define SYS_NO_YES 75 +#define SYS_OFFON_MENU 76 +#define SYS_PRINTER_UNITS_CHLIST 77 +#define SYS_PRINTER_DEVICE_CHLIST 78 +#define SYS_BAUD_RATE_CHLIST 79 +#define SYS_DATA_BITS_CHLIST 80 +#define SYS_STOP_BITS_CHLIST 81 +#define SYS_PARITY_CHLIST 82 +#define SYS_FORMAT_CHLIST 83 +#define SYS_RAD_DEG 84 +#define SYS_PAGE_DIMENSIONS 85 +#define SYS_PAGE_SIZE 86 +#define SYS_ORIENT 87 +#define SYS_PRN_POS 88 +#define SYS_HEADFOOT_ALIGN 89 +#define SYS_PGNO_CHOICE 90 +#define SYS_ERROR_DIALOG 91 +#define SYS_QUERY_DIALOG 92 +#define SYS_PRINTING_DIALOG 93 +#define SYS_SET_PORT_DIALOG 94 +#define SYS_SET_HSHK_DIALOG 95 +#define SYS_PRINTER_CONFIG_DIALOG 96 +#define SYS_EVAL_DIALOG 97 +#define SYS_COUNTRY_SELECTOR_DIALOG 98 +#define SYS_SMART_DIAL_ITEM 99 +#define SYS_SMART_DIAL_DIALOG 100 +#define SYS_FREEDIAL_DIALOG 101 +#define SYS_FLIST_DIALOG 102 +#define SYS_PRINT_CONTROL_DL 103 +#define SYS_PAGING_CONTROL_DL 104 +#define SYS_PRINTER_MODEL 105 +#define SYS_MARGINS_DL 106 +#define SYS_HEADFOOT_DL 107 +#define SYS_PAGESIZE_DL 108 +#define SYS_FONT_DL 109 +#define SYS_TXTMESS 110 +#define SYS_HELP_INDEX_DATA 111 +#define SYS_HELP_INDEX 112 +#define SYS_HELP_ON_HELP 113 +#define SYS_HELP_DIALOG 114 +#define SYS_HELP_STATWIN 115 +#define SYS_HELP_DIALLING 116 +#define SYS_HELP_FILSELS 117 +#define SYS_HELP_EDIT 118 +#define SYS_HELP_X_HELP 119 +#define SYS_HELP_FILES 120 +#define SYS_HELP_PRINT 121 +#define SYS_TIME_BASICS 122 +#define SYS_HELP_ON_OFF 123 +#define SYS_HELP_X_INDEX 124 +#define SYS_WDR_GENERAL 125 +#define SYS_DIAL_OUT 126 +#define SYS_SKIPPING_PAGE 127 +#define SYS_DEBUGGING_NUM_CELLS 128 +#define SYS_CALENDAR 129 +#define SYS_PAGE 130 +#define SYS_PAGES 131 +#define SYS_PREVIEW_BUSY 132 +#define SYS_DISPLAY_MARGINS 133 +#define SYS_HIDE_MARGINS 134 +#define SYS_OPENING_PROMPT 135 +#define SYS_PRINT_PREVIEW 136 +#define SYS_PREVIEW_MARGINS_CHLIST 137 +#define SYS_PREVIEW_OPTIONS_CHLIST 138 +#define SYS_PREVIEW_OPTIONS_DIALOG 139 +#define SYS_PREVIEW_JUMP_DIALOG 140 +#define SYS_PREVIEW_ACC 141 +#define SYS_PREVIEW_MENUBAR 142 +#define SYS_PREVIEW_MENU 143 +#define SYS_PRINTER_DEVICES 144 +#define SYS_PRINT_CONTROL_DEVICE 145 +#define SYS_PRINT_PREVIEW_SETTINGS 146 +#define SYS_PREVIEW_SETTINGS_DL 147 +#define SYS_STANDARD_SOUNDS 148 +#define SYS_ALARM_STANDARD_NAME 149 +#define SYS_SILENT_ALARM 150 +#define SYS_SOUND_DISABLED 151 +#define SYS_WORD_ROM 152 +#define SYS_RESTART_FROM_SYS 153 +#define SRT_FILE_CREATED 154 +#define SRT_FILE_OPENED 155 +#define SRT_FILE_SAVED 156 +#define SRT_FILE_COMPRESSED 157 +#define SRT_FILE_MERGED 158 +#define SYS_SAVING_PROMPT 159 +#define SYS_RELOADING_PROMPT 160 +#define SYS_CONVERTING_PROMPT 161 +#define SYS_NOT_CHANGED 162 +#define SYS_CONFIRM_CONTINUE 163 +#define SYS_CONFIRM_CHANGE_LOSS 164 +#define SYS_LOSING_CHANGES 165 +#define SYS_NOTHING_TO_PRINT 166 +#define SYS_NOTHING_TO_INSERT 167 +#define SYS_NOTHING_TO_COPY 168 +#define SYS_REVERT_TO_SAVED 169 +#define SYS_SHIFT_KEY_NAME 170 +#define SRT_SPACE_ONLY 171 +#define SYS_CHANGE_PASSWORD 172 +#define SYS_SET_PASSWORD_DL 173 +#define SYS_GET_PASSWORD_DL 174 +#define SYS_HELP_EVALUATE 175 +#define SYS_HELP_MEMO 176 +#define SYS_HELP_IN_USE 177 +#define SYS_HELP_NO_SYS_MEM 178 +#define SYS_HELP_CALENDAR 179 +#define SYS_S3C_PRINT_CONTROL_DL 180 +#define SYS_S3C_PAGE_SETUP 181 +#define SYS_HELP_BATTERY 182 diff --git a/code/SIBOSDK/include/sw_.rsi b/code/SIBOSDK/include/sw_.rsi new file mode 100644 index 0000000..d93cae1 --- /dev/null +++ b/code/SIBOSDK/include/sw_.rsi @@ -0,0 +1,182 @@ +SYS_SPECIAL_CHARACTERS equ 1 +SYS_STRING equ 2 +SYS_DIMMED_MSG equ 3 +SYS_LOCKED_MSG equ 4 +SYS_BUSY equ 5 +SYS_SCANNING equ 6 +SYS_PRINTING_TO equ 7 +SYS_PAGE_IS equ 8 +SYS_COPIED_PROMPT equ 9 +SYS_COPYING_PROMPT equ 10 +SYS_LOADING_PROMPT equ 11 +SYS_MERGING_PROMPT equ 12 +SYS_NOTHING_TO_BRING equ 13 +SYS_NOT_FOUND equ 14 +SYS_NOTHING_TO_FIND equ 15 +SYS_COMPRESS_PROMPT equ 16 +SYS_NOT_COMPRESSIBLE equ 17 +SYS_PASSWORD_INCORRECT equ 18 +SYS_PASSWORD_NOT_CONFIRMED equ 19 +SYS_RANGE_RESET equ 20 +SYS_INVALID_NUM equ 21 +SYS_INVALID_MARGINS equ 22 +SYS_INVALID_CHAR equ 23 +SYS_OUT_OF_RANGE equ 24 +SYS_EDIT_NCHARS equ 25 +SYS_POPOUT_HELP equ 26 +SYS_HELP_STRING equ 27 +SYS_REPLACE_DISK equ 28 +SYS_NAME equ 29 +SYS_PACK equ 30 +SYS_FILELIST_DISK equ 31 +SYS_FLIST_RESET equ 32 +SYS_DEVICE_MEMORY equ 33 +SYS_PATH_IS equ 34 +SYS_CHOOSE_DIRECTORY equ 35 +SYS_CHOOSE_FILENAME equ 36 +SYS_CHOOSE_NEW_DIRECTORY equ 37 +SYS_EXISTS_OVER equ 38 +SYS_MAX equ 39 +SYS_MIN equ 40 +SYS_DEC_PLACES equ 41 +SYS_SIG_DIGITS equ 42 +SYS_EVALDLG_TITLE equ 43 +SYS_NOTHING_TO_EVAL equ 44 +SYS_TOOLONG_TO_EVAL equ 45 +SYS_XONXOFF_STRING equ 46 +SYS_HEADER_STR equ 47 +SYS_FOOTER_STR equ 48 +SYS_CENTIMETRES equ 49 +SYS_INCHES equ 50 +SYS_DEV_NOTREADY equ 51 +SYS_DEV_CORRUPT equ 52 +SYS_DEV_UNKNOWN equ 53 +SYS_DEV_INFO equ 54 +SYS_MTYPE_UNKNOWN equ 55 +SYS_MTYPE_FLOPPY equ 56 +SYS_MTYPE_HARD equ 57 +SYS_MTYPE_FLASH equ 58 +SYS_MTYPE_RAM equ 59 +SYS_MTYPE_ROM equ 60 +SYS_MTYPE_PROTECTED equ 61 +SYS_FILES_TAGGED equ 62 +SYS_NO_FILES equ 63 +SYS_NO_DISK equ 64 +SYS_UNFORMATTED equ 65 +SYS_UNRECOGNISED equ 66 +SYS_SOUND_FAIL equ 67 +SYS_BUTTON_TEXT equ 68 +SYS_AC_NO_YES equ 69 +SYS_AC_CONTINUE equ 70 +SYS_AC_ABANDON equ 71 +SYS_APPEND_ACLIST equ 72 +SYS_SMART_DIAL_ACLIST equ 73 +SYS_FREEDIAL_ACLIST equ 74 +SYS_NO_YES equ 75 +SYS_OFFON_MENU equ 76 +SYS_PRINTER_UNITS_CHLIST equ 77 +SYS_PRINTER_DEVICE_CHLIST equ 78 +SYS_BAUD_RATE_CHLIST equ 79 +SYS_DATA_BITS_CHLIST equ 80 +SYS_STOP_BITS_CHLIST equ 81 +SYS_PARITY_CHLIST equ 82 +SYS_FORMAT_CHLIST equ 83 +SYS_RAD_DEG equ 84 +SYS_PAGE_DIMENSIONS equ 85 +SYS_PAGE_SIZE equ 86 +SYS_ORIENT equ 87 +SYS_PRN_POS equ 88 +SYS_HEADFOOT_ALIGN equ 89 +SYS_PGNO_CHOICE equ 90 +SYS_ERROR_DIALOG equ 91 +SYS_QUERY_DIALOG equ 92 +SYS_PRINTING_DIALOG equ 93 +SYS_SET_PORT_DIALOG equ 94 +SYS_SET_HSHK_DIALOG equ 95 +SYS_PRINTER_CONFIG_DIALOG equ 96 +SYS_EVAL_DIALOG equ 97 +SYS_COUNTRY_SELECTOR_DIALOG equ 98 +SYS_SMART_DIAL_ITEM equ 99 +SYS_SMART_DIAL_DIALOG equ 100 +SYS_FREEDIAL_DIALOG equ 101 +SYS_FLIST_DIALOG equ 102 +SYS_PRINT_CONTROL_DL equ 103 +SYS_PAGING_CONTROL_DL equ 104 +SYS_PRINTER_MODEL equ 105 +SYS_MARGINS_DL equ 106 +SYS_HEADFOOT_DL equ 107 +SYS_PAGESIZE_DL equ 108 +SYS_FONT_DL equ 109 +SYS_TXTMESS equ 110 +SYS_HELP_INDEX_DATA equ 111 +SYS_HELP_INDEX equ 112 +SYS_HELP_ON_HELP equ 113 +SYS_HELP_DIALOG equ 114 +SYS_HELP_STATWIN equ 115 +SYS_HELP_DIALLING equ 116 +SYS_HELP_FILSELS equ 117 +SYS_HELP_EDIT equ 118 +SYS_HELP_X_HELP equ 119 +SYS_HELP_FILES equ 120 +SYS_HELP_PRINT equ 121 +SYS_TIME_BASICS equ 122 +SYS_HELP_ON_OFF equ 123 +SYS_HELP_X_INDEX equ 124 +SYS_WDR_GENERAL equ 125 +SYS_DIAL_OUT equ 126 +SYS_SKIPPING_PAGE equ 127 +SYS_DEBUGGING_NUM_CELLS equ 128 +SYS_CALENDAR equ 129 +SYS_PAGE equ 130 +SYS_PAGES equ 131 +SYS_PREVIEW_BUSY equ 132 +SYS_DISPLAY_MARGINS equ 133 +SYS_HIDE_MARGINS equ 134 +SYS_OPENING_PROMPT equ 135 +SYS_PRINT_PREVIEW equ 136 +SYS_PREVIEW_MARGINS_CHLIST equ 137 +SYS_PREVIEW_OPTIONS_CHLIST equ 138 +SYS_PREVIEW_OPTIONS_DIALOG equ 139 +SYS_PREVIEW_JUMP_DIALOG equ 140 +SYS_PREVIEW_ACC equ 141 +SYS_PREVIEW_MENUBAR equ 142 +SYS_PREVIEW_MENU equ 143 +SYS_PRINTER_DEVICES equ 144 +SYS_PRINT_CONTROL_DEVICE equ 145 +SYS_PRINT_PREVIEW_SETTINGS equ 146 +SYS_PREVIEW_SETTINGS_DL equ 147 +SYS_STANDARD_SOUNDS equ 148 +SYS_ALARM_STANDARD_NAME equ 149 +SYS_SILENT_ALARM equ 150 +SYS_SOUND_DISABLED equ 151 +SYS_WORD_ROM equ 152 +SYS_RESTART_FROM_SYS equ 153 +SRT_FILE_CREATED equ 154 +SRT_FILE_OPENED equ 155 +SRT_FILE_SAVED equ 156 +SRT_FILE_COMPRESSED equ 157 +SRT_FILE_MERGED equ 158 +SYS_SAVING_PROMPT equ 159 +SYS_RELOADING_PROMPT equ 160 +SYS_CONVERTING_PROMPT equ 161 +SYS_NOT_CHANGED equ 162 +SYS_CONFIRM_CONTINUE equ 163 +SYS_CONFIRM_CHANGE_LOSS equ 164 +SYS_LOSING_CHANGES equ 165 +SYS_NOTHING_TO_PRINT equ 166 +SYS_NOTHING_TO_INSERT equ 167 +SYS_NOTHING_TO_COPY equ 168 +SYS_REVERT_TO_SAVED equ 169 +SYS_SHIFT_KEY_NAME equ 170 +SRT_SPACE_ONLY equ 171 +SYS_CHANGE_PASSWORD equ 172 +SYS_SET_PASSWORD_DL equ 173 +SYS_GET_PASSWORD_DL equ 174 +SYS_HELP_EVALUATE equ 175 +SYS_HELP_MEMO equ 176 +SYS_HELP_IN_USE equ 177 +SYS_HELP_NO_SYS_MEM equ 178 +SYS_HELP_CALENDAR equ 179 +SYS_S3C_PRINT_CONTROL_DL equ 180 +SYS_S3C_PAGE_SETUP equ 181 +SYS_HELP_BATTERY equ 182 diff --git a/code/SIBOSDK/include/symbols.h b/code/SIBOSDK/include/symbols.h new file mode 100644 index 0000000..c919390 --- /dev/null +++ b/code/SIBOSDK/include/symbols.h @@ -0,0 +1,99 @@ +/* + File: SYMBOLS.H + Copyright (C) Psion PLC 1993 + Started by : DavidW +*/ + +/* Names of the pictures in the symbols font */ + +#define WS_SYMBOL_SHOW_CR 0 + +#define WS_SYMBOL_ELLIPSIS 1 +/* #define WS_WIDTH_ELLIPSIS 6 */ + +#define WS_SYMBOL_PSION 2 + +#define WS_SYMBOL_POWERX 3 + +#define WS_SYMBOL_DIAMOND 4 +#define WS_SYMBOL_NOTE_ICON 4 + +#define WS_SYMBOL_PHONE 5 + +#define WS_SYMBOL_PADLOCK 6 + +#define WS_SYMBOL_HARD_HYPHEN 7 + +#define WS_SYMBOL_SHOW_SPACE 8 + +#define WS_SYMBOL_SHOW_TAB 9 + +#define WS_SYMBOL_LINE_BREAK 10 + +#define WS_SYMBOL_SHIFTED 11 +#define WS_SYMBOL_SQROOT 11 + +#define WS_SYMBOL_TICK 12 + +#define WS_SYMBOL_DOWN_ARROWHEAD 13 + +#define WS_SYMBOL_SOFT_HYPHEN 14 + +#define WS_SYMBOL_HARD_SPACE 15 + +#define WS_SYMBOL_RIGHT_ARROWHEAD 16 + +#define WS_SYMBOL_LEFT_ARROWHEAD 17 + +#define WS_SYMBOL_WHITE_BOX 18 + +#define WS_SYMBOL_PASS_UNDERLINE 19 + +#define WS_SYMBOL_GREY_BOX 20 + +#define WS_SYMBOL_IR_SEND 21 + +#define WS_SYMBOL_BLACK_BOX 22 + +#define WS_SYMBOL_IR_RECEIVE 23 + +#define WS_SYMBOL_UP_KEY 24 + +#define WS_SYMBOL_DOWN_KEY 25 + +#define WS_SYMBOL_RIGHT_KEY 26 + +#define WS_SYMBOL_LEFT_KEY 27 + +#define WS_SYMBOL_MARGIN_CURSOR 28 + +#define WS_SYMBOL_BELL 29 + +#define WS_SYMBOL_UP_ARROWHEAD 30 + +#define WS_SYMBOL_NS 31 + +#define WS_SYMBOL_POWER2 253 + +#define WS_SYMBOL_BULLET 254 + +/* Positioning of special characters in the special array */ + +#define H_SC_TPLUS 0 /* T is for Tag */ +#define H_SC_TMINUS 1 +#define H_SC_TSTAR 2 +#define H_SC_TSLASH 3 + +#define H_SC_ILESS 4 /* I is for Incrementer */ +#define H_SC_ICOMMA 5 +#define H_SC_IMORE 6 +#define H_SC_IDOT 7 + +#define H_SC_HFANCY 8 /* H is for Hyphen */ + +#define H_SC_LLN 9 /* LL is for LatLong editor */ +#define H_SC_LLS 10 +#define H_SC_LLW 11 +#define H_SC_LLE 12 +#define H_SC_DEGREE 13 /* Degree symbol */ +#define H_SC_BULLET 14 /* bullet used in helplist */ diff --git a/code/SIBOSDK/include/symbols.inc b/code/SIBOSDK/include/symbols.inc new file mode 100644 index 0000000..40d09f3 --- /dev/null +++ b/code/SIBOSDK/include/symbols.inc @@ -0,0 +1,124 @@ +; Names and widths of the pictures in the symbols font + +WS_SYMBOL_SHOW_CR equ 0 +WS_WIDTH_SHOW_CR equ 6 + +WS_SYMBOL_ELLIPSIS equ 1 +WS_WIDTH_ELLIPSIS equ 6 + +WS_SYMBOL_PSION equ 2 +WS_WIDTH_PSION equ 5 + +WS_SYMBOL_POWERX equ 3 +WS_WIDTH_POWERX equ 5 + +WS_SYMBOL_NOTE_ICON equ 4 +WS_WIDTH_NOTE_ICON equ 6 + +WS_SYMBOL_PHONE equ 5 +WS_WIDTH_PHONE equ 6 + +WS_SYMBOL_PADLOCK equ 6 +WS_WIDTH_PADLOCK equ 6 + +WS_SYMBOL_HARD_HYPHEN equ 7 +WS_WIDTH_HARD_HYPHEN equ 6 + +WS_SYMBOL_SHOW_SPACE equ 8 +WS_WIDTH_SHOW_SPACE equ 3 + +WS_SYMBOL_SHOW_TAB equ 9 +WS_WIDTH_SHOW_TAB equ 6 + +WS_SYMBOL_LINE_BREAK equ 10 +WS_WIDTH_LINE_BREAK equ 6 + +WS_SYMBOL_SQROOT equ 11 +WS_WIDTH_SQROOT equ 6 + +WS_SYMBOL_TICK equ 12 +WS_WIDTH_TICK equ 8 + +WS_SYMBOL_DOWN_ARROWHEAD equ 13 +WS_WIDTH_DOWN_ARROWHEAD equ 7 + +WS_SYMBOL_SOFT_HYPHEN equ 14 +WS_WIDTH_SOFT_HYPHEN equ 6 + +WS_SYMBOL_HARD_SPACE equ 15 +WS_WIDTH_HARD_SPACE equ 3 + +WS_SYMBOL_RIGHT_ARROWHEAD equ 16 +WS_WIDTH_RIGHT_ARROWHEAD equ 5 + +WS_SYMBOL_LEFT_ARROWHEAD equ 17 +WS_WIDTH_LEFT_ARROWHEAD equ 5 + +WS_SYMBOL_WHITE_BOX1 equ 18 +WS_WIDTH_WHITE_BOX1 equ 6 + +WS_SYMBOL_WHITE_BOX2 equ 19 +WS_WIDTH_WHITE_BOX2 equ 5 + +WS_SYMBOL_GREY_BOX1 equ 20 +WS_WIDTH_GREY_BOX1 equ 6 + +WS_SYMBOL_GREY_BOX2 equ 21 +WS_WIDTH_GREY_BOX2 equ 5 + +WS_SYMBOL_BLACK_BOX1 equ 22 +WS_WIDTH_BLACK_BOX1 equ 6 + +WS_SYMBOL_BLACK_BOX2 equ 23 +WS_WIDTH_BLACK_BOX2 equ 5 + +WS_SYMBOL_UP_KEY equ 24 +WS_WIDTH_UP_KEY equ 6 + +WS_SYMBOL_DOWN_KEY equ 25 +WS_WIDTH_DOWN_KEY equ 6 + +WS_SYMBOL_RIGHT_KEY equ 26 +WS_WIDTH_RIGHT_KEY equ 8 + +WS_SYMBOL_LEFT_KEY equ 27 +WS_WIDTH_LEFT_KEY equ 8 + +WS_SYMBOL_MARGIN_CURSOR equ 28 +WS_WIDTH_MARGIN_CURSOR equ 5 + +WS_SYMBOL_BELL equ 29 +WS_WIDTH_BELL equ 6 + +WS_SYMBOL_UP_ARROWHEAD equ 30 +WS_WIDTH_UP_ARROWHEAD equ 7 + +WS_SYMBOL_NS equ 31 +WS_WIDTH_NS equ 6 + +WS_SYMBOL_POWER2 equ 253 +WS_WIDTH_POWER2 equ 4 + +WS_SYMBOL_BULLET equ 254 +WS_WIDTH_BULLET equ 5 + +; Positioning of special characters in the special array + +H_SC_TPLUS equ 0 ; T is for Tag */ +H_SC_TMINUS equ 1 +H_SC_TSTAR equ 2 +H_SC_TSLASH equ 3 + +H_SC_ILESS equ 4 ; I is for Incrementer +H_SC_ICOMMA equ 5 +H_SC_IMORE equ 6 +H_SC_IDOT equ 7 + +H_SC_HFANCY equ 8 ; H is for Hyphen + +H_SC_LLN equ 9 ; The following are North, South, West, East +H_SC_LLS equ 10 +H_SC_LLW equ 11 +H_SC_LLE equ 12 +H_SC_DEGREE equ 13 ; As used in LatLong editor +H_SC_BULLET equ 14 ; As used in help list diff --git a/code/SIBOSDK/include/sys$ncp.h b/code/SIBOSDK/include/sys$ncp.h new file mode 100644 index 0000000..c303108 --- /dev/null +++ b/code/SIBOSDK/include/sys$ncp.h @@ -0,0 +1,75 @@ +/* +SYS$NCP.H - Header file for NCP defines +*/ + +#define NCLINK_VERSION_NUMBER 3 +#define NCLINK_MINOR_VERNO 1 + +/* Informational data obtained by supervisory reads */ +#define PHYS_LINK_FAILED 0 /* Link layer has failed*/ +#define PHYS_CONNECT_FAILED 1 /* Waiting for connection failed */ +#define PHYS_CHARS_FAILED 2 /* Setting serial characteristics failed */ +#define PHYS_INIT_FAILED 3 /* Initialization of modem failed */ +#define PHYS_DIAL_FAILED 4 /* Dialling phone number failed */ +#define PHYS_MDMCONFIG_FAILED 5 /* additional modem config failed */ +#define PHYS_PHYS_LINK_ESTABLISHED 6 /* A physical link established */ +#define PHYS_WAITING_FOR_CALL 7 /* Physical layer waiting for call */ +#define PHYS_DIALLING_NUMBER 8 /* Physical layer dialling */ +#define PHYS_CONFIGURING_MODEM 9 /* configuring modem */ +#define PHYS_NCP_LINK_ESTAB_OK 10 /* Ncp link established OK */ +#define PHYS_NCP_LINK_ESTAB_NEW_NCP 11 /* Talking to different Ncp */ +#define PHYS_NCP_LINK_ESTAB_INVALID_VER 12 /* Remote NCP is V1.0 !!*/ +#define PHYS_NCP_LINK_END 13 /* remote NCP is terminating */ +#define PHYS_SERCONFIG_FAILED 14 /* serial port not there */ + +#define MAX_DVR_NAME 10 /* Max device driver name size (incl zero term) */ +#define MAX_PHONE_NO 40 /* Max phone number length */ +#define MAX_MODEM_CMD 40 /* Max extra modem config */ + +/* Control functions to perform */ +#define NCLINK_CTRL_RETRY 0 +#define NCLINK_CTRL_EXIT 1 +#define NCLINK_CTRL_NEWNCP_OK 2 +#define NCLINK_CTRL_NEW_CONFIG 3 + +typedef struct + { + P_SRCHAR sch; + P_MDMCHR mch; + UWORD errcorrect; /* what sort of error correction modem using */ + UWORD connectbaud; /* baud rate at which connected */ + UBYTE serdvr[MAX_DVR_NAME]; + UBYTE mdmdvr[MAX_DVR_NAME]; + UBYTE masdvr[MAX_DVR_NAME]; + UBYTE lnkdvr[MAX_DVR_NAME]; + UBYTE phoneno[MAX_PHONE_NO]; + UBYTE mdmconf[MAX_MODEM_CMD]; + } DVRS; + +typedef struct + { + UWORD vers; /* Remote NCP sofware version */ + ULONG id; /* Remote NCP id */ + } REM_NCP; + +typedef union + { + REM_NCP remncp; /* Remote NCP info */ + DVRS dvrs; /* Driver names, phone number */ + } PHY_INFO; + +typedef struct /* Physical layer status information */ + { + UWORD cmdtype; /* Info type */ + WORD errno; /* Error number if applicable to type */ + PHY_INFO p; /* Physical layer info */ + } NCLINK_INFO; + +typedef struct /* Network sense data struct */ + { + UWORD chanused; /* True if channel being used else False */ + ULONG xmitK; /* number K bytes transmitted */ + ULONG recvK; /* number K bytes received */ + UBYTE procname[E_MAX_NAME+2]; /* Process name that owns channel */ + } NCLINK_SREC; + diff --git a/code/SIBOSDK/include/textwin.g b/code/SIBOSDK/include/textwin.g new file mode 100644 index 0000000..86f90be --- /dev/null +++ b/code/SIBOSDK/include/textwin.g @@ -0,0 +1,54 @@ +/* Generated by Ctran from textwin.cl */ +#define TEXTWIN_G +#ifndef LODGER_G +#include +#endif +#ifndef EDIT_G +#include +#endif +/* Class Numbers */ +#define C_TEXTWIN 4 +/* Method Numbers */ +/* Constants for textwin */ +#define PR_TEXTWIN_AL_LEFT 0x00 +#define PR_TEXTWIN_AL_RIGHT 0x01 +#define PR_TEXTWIN_AL_CENTRE 0x02 +#define PR_TEXTWIN_BOLD 0x04 +#define PR_TEXTWIN_BULLET 0x20 +#define PR_TEXTWIN_POPOUT 0x40 +#define PR_TEXTWIN_FLASHING 0x80 +#define IN_TEXTWIN_AL_LEFT PR_TEXTWIN_AL_LEFT +#define IN_TEXTWIN_AL_RIGHT PR_TEXTWIN_AL_RIGHT +#define IN_TEXTWIN_AL_CENTRE PR_TEXTWIN_AL_CENTRE +#define IN_TEXTWIN_BOLD PR_TEXTWIN_BOLD +#define IN_TEXTWIN_BULLET PR_TEXTWIN_BULLET +#define IN_TEXTWIN_POPOUT PR_TEXTWIN_POPOUT +#define SE_TEXTWIN_ALIGN (PR_TEXTWIN_AL_RIGHT|PR_TEXTWIN_AL_CENTRE) +#define SE_TEXTWIN_BOLD PR_TEXTWIN_BOLD +#define SE_TEXTWIN_TEXT 0x08 +#define SE_TEXTWIN_BULLET PR_TEXTWIN_BULLET +/* Types for textwin */ +typedef struct +{ +unsigned short int state; +char label[1]; +}IN_TEXTWIN; +typedef struct +{ +int flags; +unsigned short int state; +char *buf; +unsigned short int len; +}SE_TEXTWIN; +/* Property of textwin */ +typedef struct { +PR_EPFLAT *label; +unsigned short int state; +} PRS_TEXTWIN; +typedef struct pr_textwin +{ +PRS_ROOT root; +PRS_WIN win; +PRS_LODGER lodger; +PRS_TEXTWIN textwin; +} PR_TEXTWIN; diff --git a/code/SIBOSDK/include/textwin.ing b/code/SIBOSDK/include/textwin.ing new file mode 100644 index 0000000..3ecefa1 --- /dev/null +++ b/code/SIBOSDK/include/textwin.ing @@ -0,0 +1,51 @@ +; Generated by Ctran from textwin.cl +TEXTWIN_ING equ 1 +IFNDEF LODGER_ING + INCLUDE ..\inc\LODGER.ING +ENDIF +IFNDEF EDIT_ING + INCLUDE ..\inc\EDIT.ING +ENDIF +; Class Numbers +C_TEXTWIN equ 4 +; Method Numbers +; Constants for textwin +PR_TEXTWIN_AL_LEFT equ (000h) +PR_TEXTWIN_AL_RIGHT equ (001h) +PR_TEXTWIN_AL_CENTRE equ (002h) +PR_TEXTWIN_BOLD equ (004h) +PR_TEXTWIN_BULLET equ (020h) +PR_TEXTWIN_POPOUT equ (040h) +PR_TEXTWIN_FLASHING equ (080h) +IN_TEXTWIN_AL_LEFT equ (PR_TEXTWIN_AL_LEFT) +IN_TEXTWIN_AL_RIGHT equ (PR_TEXTWIN_AL_RIGHT) +IN_TEXTWIN_AL_CENTRE equ (PR_TEXTWIN_AL_CENTRE) +IN_TEXTWIN_BOLD equ (PR_TEXTWIN_BOLD) +IN_TEXTWIN_BULLET equ (PR_TEXTWIN_BULLET) +IN_TEXTWIN_POPOUT equ (PR_TEXTWIN_POPOUT) +SE_TEXTWIN_ALIGN equ (PR_TEXTWIN_AL_RIGHT or PR_TEXTWIN_AL_CENTRE) +SE_TEXTWIN_BOLD equ (PR_TEXTWIN_BOLD) +SE_TEXTWIN_TEXT equ (008h) +SE_TEXTWIN_BULLET equ (PR_TEXTWIN_BULLET) +; Types for textwin +IN_TEXTWIN struc +IN_TEXTWINState dw ? +IN_TEXTWINLabel db (1) * 1 dup (?) +IN_TEXTWIN ends +SE_TEXTWIN struc +SE_TEXTWINFlags dw ? +SE_TEXTWINState dw ? +SE_TEXTWINBuf dw ? +SE_TEXTWINLen dw ? +SE_TEXTWIN ends +; Property of textwin +PRS_TEXTWIN struc +TextwinLabel dw ? +TextwinState dw ? +PRS_TEXTWIN ends +PR_TEXTWIN struc +TextwinRoot PRS_ROOT <> +TextwinWin PRS_WIN <> +TextwinLodger PRS_LODGER <> +TextwinTextwin PRS_TEXTWIN <> +PR_TEXTWIN ends diff --git a/code/SIBOSDK/include/time.g b/code/SIBOSDK/include/time.g new file mode 100644 index 0000000..e4d6f71 --- /dev/null +++ b/code/SIBOSDK/include/time.g @@ -0,0 +1,93 @@ +/* Generated by Ctran from time.cat */ +#define TIME_G +#ifndef OLIB_G +#include +#endif +#ifndef P_DATE_H +#include +#endif +/* Class Numbers */ +#define C_TIME 40 +/* Method Numbers */ +#define O_TO_ADD_SECS 6 +#define O_TO_ADD_MONTHS 4 +#define O_TO_GET_SYSDAT 9 +#define O_TO_ADD_YEARS 3 +#define O_TO_SENSE 2 +#define O_TO_SENSE_FORMAT 8 +#define O_TO_SET 1 +#define O_TO_SET_FORMAT 7 +#define O_TO_ADD_DAYS 5 +/* Constants for time */ +#define SET_TIME_SECONDS 0 +#define SET_TIME_DATE 1 +#define SET_TIME_DAYSEC 2 +#define SET_TIME_NOW 3 +#define SET_TIME_DATESTR 4 +#define SET_TIME_TIMESTR 5 +#define SENSE_TIME_SECONDS 0 +#define SENSE_TIME_DATE 1 +#define SENSE_TIME_DAYSEC 2 +#define SENSE_TIME_STRING 3 +#define SENSE_TIME_DATESTR 4 +#define SENSE_TIME_TIMESTR 5 +#define SENSE_TIME_FIELDS 0x8000 +#define FLD_TIME_DAY 0 +#define FLD_TIME_MONTH 1 +#define FLD_TIME_YEAR 2 +#define FLD_TIME_HOUR 3 +#define FLD_TIME_MINUTE 4 +#define FLD_TIME_SECOND 5 +#define FLD_TIME_DAYNAME 6 +#define PR_TIME_DDMMYY 0x0000 +#define PR_TIME_MMDDYY 0x0001 +#define PR_TIME_YYMMDD 0x0002 +#define PR_TIME_DATE_ORDER 0x0003 +#define PR_TIME_NO_DAY 0x0004 +#define PR_TIME_NO_MONTH 0x0008 +#define PR_TIME_NO_YEAR 0x0010 +#define PR_TIME_MONTH_NAME 0x0020 +#define PR_TIME_SUFFIX_NAME 0x0040 +#define PR_TIME_DAY_NAME 0x0080 +#define PR_TIME_NO_CENTURY 0x0100 +#define PR_TIME_NO_SECS 0x0200 +#define PR_TIME_AMPM 0x0400 +#define TY_TIME_DAY 0 +#define TY_TIME_MONTH 1 +#define TY_TIME_SUFFIX 2 +#define TY_TIME_AMPM 3 +#define TY_TIME_FORMAT 4 +#define LN_TIME_DAY_NAME 14 +#define LN_TIME_MONTH_NAME 14 +#define LN_TIME_DATE_STR 48 +#define LN_TIME_TIME_STR 12 +/* Types for time */ +typedef struct +{ +unsigned short int flags; +unsigned char dsep; +unsigned char tsep; +} SE_TIME_FORMAT; +typedef struct +{ +unsigned short int fld; +char *buf; +unsigned short int len; +} SE_TIME_FIELD; +typedef union +{ +char *t; +unsigned long int *l; +P_DAYSEC *ds; +P_DATE *dt; +} PT_TIME_DATA; +/* Property of time */ +typedef struct { +P_DAYSEC ds; +SE_TIME_FORMAT f; +} PRS_TIME; +typedef struct pr_time +{ +PRS_ROOT root; +PRS_TIME time; +} PR_TIME; diff --git a/code/SIBOSDK/include/time.h b/code/SIBOSDK/include/time.h new file mode 100644 index 0000000..bd9d00a --- /dev/null +++ b/code/SIBOSDK/include/time.h @@ -0,0 +1,107 @@ +/* Release 3.00 */ + +/*-------------------------------------------------------------------------* +* * +* time.h - structure and function definitions for time. * +* * +* COPYRIGHT (C) 1989 Jensen and Partners. All Rights Reserved * +* * +*--------------------------------------------------------------------------*/ +#include + +#ifndef _TIME_INC_ +#define _TIME_INC_ + +#ifndef _SIZE_T +#define _SIZE_T +typedef unsigned size_t; +#endif + +#ifndef _TIME_T +#define _TIME_T +#ifndef _TIME_DEF +#define _TIME_DEF +typedef long time_t; +#endif +typedef long clock_t; +#define CLK_TCK 100 +#define CLOCKS_PER_SEC 100 +#endif + +#ifndef NULL +#define NULL 0 +#endif + +#ifndef _TM_DEF +#define _TM_DEF +struct tm { + int tm_sec; + int tm_min; + int tm_hour; + int tm_mday; + int tm_mon; + int tm_year; + int tm_wday; + int tm_yday; + int tm_isdst; +}; +#endif + +#ifndef _TMT_DEF +#define _TMT_DEF +struct date { + int da_year; + unsigned char da_day; + unsigned char da_mon; +}; + +struct time { + unsigned char ti_hour; + unsigned char ti_min; + unsigned char ti_sec; + unsigned char ti_hund; +}; +#endif + +#ifndef _UTMT_DEF +#define _UTMT_DEF +struct utm { int u_sec; + int u_min; + int u_hour; + int u_day; + int u_mon; + int u_year; +}; +#endif + +#ifdef __cplusplus +extern "C" { +#endif +extern char * asctime(const struct tm *_tblock); +extern char * ctime(const time_t *_timer); +extern clock_t clock(void); +extern double difftime(time_t _time2, time_t _time1); +extern struct tm * gmtime(const time_t *_timer); +extern struct tm * localtime(const time_t *_timer); +extern time_t mktime(struct tm *_timeptr); +extern size_t strftime(char *_s, size_t _maxsize, const char *_format, + const struct tm *_timeptr); +extern time_t time(time_t *_timer); +extern int stime(time_t *_tp); +extern void tzset(void); +extern void settime(const struct time *_tptr); +extern void gettime(struct time *_tptr); +extern void setdate(const struct date *_dptr); +extern void getdate(struct date *_dptr); +extern char * _strdate(char *_dt); +extern char * _strtime(char *_tm); +extern int utime(char *_path, struct utm *_time); +extern time_t get_utime(int _handle); +extern int _filetime(int _handle, struct utm *_ubuf); +#ifdef __cplusplus +} +#endif + +extern time_t timezone; +extern int daylight; +#endif diff --git a/code/SIBOSDK/include/time.ing b/code/SIBOSDK/include/time.ing new file mode 100644 index 0000000..96d55b8 --- /dev/null +++ b/code/SIBOSDK/include/time.ing @@ -0,0 +1,89 @@ +; Generated by Ctran from time.cat +TIME_ING equ 1 +IFNDEF OLIB_ING + INCLUDE ..\inc\OLIB.ING +ENDIF +IFNDEF P_DATE_INC + INCLUDE ..\inc\P_DATE.INC +ENDIF +; Class Numbers +C_TIME equ 40 +; Method Numbers +O_TO_ADD_SECS equ 6 +O_TO_ADD_MONTHS equ 4 +O_TO_GET_SYSDAT equ 9 +O_TO_ADD_YEARS equ 3 +O_TO_SENSE equ 2 +O_TO_SENSE_FORMAT equ 8 +O_TO_SET equ 1 +O_TO_SET_FORMAT equ 7 +O_TO_ADD_DAYS equ 5 +; Constants for time +SET_TIME_SECONDS equ (0) +SET_TIME_DATE equ (1) +SET_TIME_DAYSEC equ (2) +SET_TIME_NOW equ (3) +SET_TIME_DATESTR equ (4) +SET_TIME_TIMESTR equ (5) +SENSE_TIME_SECONDS equ (0) +SENSE_TIME_DATE equ (1) +SENSE_TIME_DAYSEC equ (2) +SENSE_TIME_STRING equ (3) +SENSE_TIME_DATESTR equ (4) +SENSE_TIME_TIMESTR equ (5) +SENSE_TIME_FIELDS equ (08000h) +FLD_TIME_DAY equ (0) +FLD_TIME_MONTH equ (1) +FLD_TIME_YEAR equ (2) +FLD_TIME_HOUR equ (3) +FLD_TIME_MINUTE equ (4) +FLD_TIME_SECOND equ (5) +FLD_TIME_DAYNAME equ (6) +PR_TIME_DDMMYY equ (00000h) +PR_TIME_MMDDYY equ (00001h) +PR_TIME_YYMMDD equ (00002h) +PR_TIME_DATE_ORDER equ (00003h) +PR_TIME_NO_DAY equ (00004h) +PR_TIME_NO_MONTH equ (00008h) +PR_TIME_NO_YEAR equ (00010h) +PR_TIME_MONTH_NAME equ (00020h) +PR_TIME_SUFFIX_NAME equ (00040h) +PR_TIME_DAY_NAME equ (00080h) +PR_TIME_NO_CENTURY equ (00100h) +PR_TIME_NO_SECS equ (00200h) +PR_TIME_AMPM equ (00400h) +TY_TIME_DAY equ (0) +TY_TIME_MONTH equ (1) +TY_TIME_SUFFIX equ (2) +TY_TIME_AMPM equ (3) +TY_TIME_FORMAT equ (4) +LN_TIME_DAY_NAME equ (14) +LN_TIME_MONTH_NAME equ (14) +LN_TIME_DATE_STR equ (48) +LN_TIME_TIME_STR equ (12) +; Types for time +SE_TIME_FORMAT struc +SE_TIME_FORMATFlags dw ? +SE_TIME_FORMATDsep db ? +SE_TIME_FORMATTsep db ? +SE_TIME_FORMAT ends +SE_TIME_FIELD struc +SE_TIME_FIELDFld dw ? +SE_TIME_FIELDBuf dw ? +SE_TIME_FIELDLen dw ? +SE_TIME_FIELD ends +PT_TIME_DATA union +PT_TIME_DATAT dw ? +PT_TIME_DATAL dw ? +PT_TIME_DATADs dw ? +PT_TIME_DATADt dw ? +PT_TIME_DATA ends +; Property of time +PRS_TIME struc +TimeDs P_DAYSEC <> +TimeF SE_TIME_FORMAT <> +PRS_TIME ends +PR_TIME struc +TimeRoot PRS_ROOT <> +TimeTime PRS_TIME <> +PR_TIME ends diff --git a/code/SIBOSDK/include/timeb.h b/code/SIBOSDK/include/timeb.h new file mode 100644 index 0000000..35d071b --- /dev/null +++ b/code/SIBOSDK/include/timeb.h @@ -0,0 +1,36 @@ +/* Release 3.00 */ + +/*-------------------------------------------------------------------------* +* * +* timeb.h - header file for ftime. * +* * +* COPYRIGHT (C) 1989, 1990 Jensen and Partners. All Rights Reserved. * +* * +*--------------------------------------------------------------------------*/ +#include + +#ifndef _TIMEB_INC_ +#define _TIMEB_INC_ + +#ifndef _TIME_DEF +#define _TIME_DEF +typedef long time_t; +#endif + +/* structure returned by ftime */ + +struct timeb { + time_t time; + unsigned short millitm; + short timezone; + short dstflag; +}; + +#ifdef __cplusplus +extern "C" { +#endif +extern void ftime(struct timeb *); +#ifdef __cplusplus +} +#endif +#endif diff --git a/code/SIBOSDK/include/timer.g b/code/SIBOSDK/include/timer.g new file mode 100644 index 0000000..40521db --- /dev/null +++ b/code/SIBOSDK/include/timer.g @@ -0,0 +1,70 @@ +/* Generated by Ctran from timer.cat */ +#define TIMER_G +#ifndef APPMAN_G +#include +#endif +/* Class Numbers */ +#define C_TIMER 41 +#define C_BUZSND 42 +#define C_ALARR 43 +#define C_ANIMATOR 44 +/* Method Numbers */ +#define O_VA_CANCEL 25 +#define O_VA_CONFIRM 24 +#define O_TM_QABSOLUTE 6 +/* Property of timer */ +typedef struct pr_timer +{ +PRS_ROOT root; +PRS_ACTIVE active; +} PR_TIMER; +/* Property of buzsnd */ +typedef struct { +unsigned char *snd; +unsigned short int sndrep; +unsigned short int sndnum; +unsigned short int snddelay; +unsigned short int sndvolume; +PR_ROOT *h_done; +unsigned short int m_done; +} PRS_BUZSND; +typedef struct pr_buzsnd +{ +PRS_ROOT root; +PRS_ACTIVE active; +PRS_BUZSND buzsnd; +} PR_BUZSND; +/* Constants for alarr */ +#define ALARR_GRAN 8 +/* Property of alarr */ +typedef struct { +RC_VAXVAR rec; +} PRS_ALARR; +typedef struct pr_alarr +{ +PRS_ROOT root; +PRS_VAROOT varoot; +PRS_VAFIX vafix; +PRS_VAFLAT vaflat; +PRS_ALARR alarr; +} PR_ALARR; +/* Types for animator */ +typedef struct +{ +PR_ROOT *own; +int message; +int interval; +int first; +} IN_ANIMATOR; +/* Property of animator */ +typedef struct { +PR_ROOT *own; +int message; +int interval; +} PRS_ANIMATOR; +typedef struct pr_animator +{ +PRS_ROOT root; +PRS_ACTIVE active; +PRS_ANIMATOR animator; +} PR_ANIMATOR; diff --git a/code/SIBOSDK/include/timer.ing b/code/SIBOSDK/include/timer.ing new file mode 100644 index 0000000..958fd26 --- /dev/null +++ b/code/SIBOSDK/include/timer.ing @@ -0,0 +1,65 @@ +; Generated by Ctran from timer.cat +TIMER_ING equ 1 +IFNDEF APPMAN_ING + INCLUDE ..\inc\APPMAN.ING +ENDIF +; Class Numbers +C_TIMER equ 41 +C_BUZSND equ 42 +C_ALARR equ 43 +C_ANIMATOR equ 44 +; Method Numbers +O_VA_CANCEL equ 25 +O_VA_CONFIRM equ 24 +O_TM_QABSOLUTE equ 6 +; Property of timer +PR_TIMER struc +TimerRoot PRS_ROOT <> +TimerActive PRS_ACTIVE <> +PR_TIMER ends +; Property of buzsnd +PRS_BUZSND struc +BuzsndSnd dw ? +BuzsndSndrep dw ? +BuzsndSndnum dw ? +BuzsndSnddelay dw ? +BuzsndSndvolume dw ? +BuzsndH_done dw ? +BuzsndM_done dw ? +PRS_BUZSND ends +PR_BUZSND struc +BuzsndRoot PRS_ROOT <> +BuzsndActive PRS_ACTIVE <> +BuzsndBuzsnd PRS_BUZSND <> +PR_BUZSND ends +; Constants for alarr +ALARR_GRAN equ (8) +; Property of alarr +PRS_ALARR struc +AlarrRec RC_VAXVAR <> +PRS_ALARR ends +PR_ALARR struc +AlarrRoot PRS_ROOT <> +AlarrVaroot PRS_VAROOT <> +AlarrVafix PRS_VAFIX <> +AlarrVaflat PRS_VAFLAT <> +AlarrAlarr PRS_ALARR <> +PR_ALARR ends +; Types for animator +IN_ANIMATOR struc +IN_ANIMATOROwn dw ? +IN_ANIMATORMessage dw ? +IN_ANIMATORInterval dw ? +IN_ANIMATORFirst dw ? +IN_ANIMATOR ends +; Property of animator +PRS_ANIMATOR struc +AnimatorOwn dw ? +AnimatorMessage dw ? +AnimatorInterval dw ? +PRS_ANIMATOR ends +PR_ANIMATOR struc +AnimatorRoot PRS_ROOT <> +AnimatorActive PRS_ACTIVE <> +AnimatorAnimator PRS_ANIMATOR <> +PR_ANIMATOR ends diff --git a/code/SIBOSDK/include/tlvfile.g b/code/SIBOSDK/include/tlvfile.g new file mode 100644 index 0000000..716f9e3 --- /dev/null +++ b/code/SIBOSDK/include/tlvfile.g @@ -0,0 +1,238 @@ +/* Generated by Ctran from tlvfile.cat */ +#define TLVFILE_G +#ifndef APPMAN_G +#include +#endif +#ifndef P_FILE_H +#include +#endif +#ifndef P_SERIAL_H +#include +#endif +#ifndef P_MODEM_H +#include +#endif +/* Class Numbers */ +#define C_BFILE 45 +#define C_TLVFILE 46 +#define C_TLVDATA 47 +#define C_SERFILE 48 +#define C_PRINT 49 +#define C_SERIAL 50 +/* Method Numbers */ +#define O_TD_SAVE_ITEM 5 +#define O_TD_SENSE_ITEM 9 +#define O_FL_SET_BUF_LEN 3 +#define O_FL_SENSE_REC 12 +#define O_FL_REPLACE 13 +#define O_FL_DELREC 8 +#define O_TD_SET_ITEM 8 +#define O_TD_SAVE 2 +#define O_TD_OPEN 1 +#define O_FI_OPEN 5 +#define O_FL_SET_REC 11 +#define O_FL_WRITE_REC 7 +#define O_SR_FLUSH 10 +#define O_TD_LOAD_ITEM 4 +#define O_FI_CLOSE 1 +#define O_TD_SET_FILE 7 +#define O_TD_CHANGED 3 +#define O_FI_READ 2 +#define O_FL_SENSE_DATA 4 +#define O_FL_REWIND 6 +#define O_SR_CONTROL 11 +#define O_FL_COUNT 9 +#define O_SR_SENSE 9 +#define O_SR_ENQUIRE 12 +#define O_TD_RESET 6 +#define O_SR_GRAB 13 +#define O_PR_GET_DATA 6 +#define O_FL_READ_BY_TYPE 10 +#define O_SR_TEST 7 +#define O_SR_SET 8 +#define O_SR_WRITE 6 +/* Constants for bfile */ +#define OP_BFILE_ID_SIZE 16 +/* Types for bfile */ +typedef struct +{ +char fid[OP_BFILE_ID_SIZE]; +unsigned short int vers; +unsigned short int offset; +unsigned short int rtvers; +} OP_BFILE_FSIG; +/* Property of bfile */ +typedef struct { +unsigned char *pcb; +unsigned char *rbuf; +unsigned short int rlen; +unsigned short int offset; +} PRS_BFILE; +typedef struct pr_bfile +{ +PRS_ROOT root; +PRS_BFILE bfile; +} PR_BFILE; +/* Constants for tlvfile */ +#define TLV_TYPE_UNKNOWN 0x10 +#define TLV_TYPE_INVALID 0x0f +#define TLV_TYPE_DELETED 0x00 +#define TLV_TYPE_NORMAL 0x01 +#define TLV_TYPE_FIELDS 0x02 +#define TLV_TYPE_SHIFT 12 +#define TLV_TYPE_MASK 0xf000 +/* Types for tlvfile */ +typedef struct +{ +OP_BFILE_FSIG fsig; +unsigned short int types; +} OP_TLVFILE; +typedef struct +{ +unsigned char *buf; +unsigned int len; +int type; +} OP_TLV_REC; +/* Property of tlvfile */ +typedef struct { +unsigned short int typmask; +unsigned short int hdlen; +unsigned short int hdtype; +unsigned long int pos; +unsigned long int fpos; +} PRS_TLVFILE; +typedef struct pr_tlvfile +{ +PRS_ROOT root; +PRS_BFILE bfile; +PRS_TLVFILE tlvfile; +} PR_TLVFILE; +/* Types for tlvdata */ +typedef struct +{ +OP_TLVFILE tlvfile; +char ext[6]; +} PR_TLVDATA_CHARS; +/* Property of tlvdata */ +typedef struct { +PR_TLVFILE *tlv; +unsigned short int cl_tlv; +unsigned short int changed; +short int index; +short int tmask; +char name[P_FNAMESIZE]; +} PRS_TLVDATA; +typedef struct pr_tlvdata +{ +PRS_ROOT root; +PRS_TLVDATA tlvdata; +} PR_TLVDATA; +/* Constants for serfile */ +#define TE_MASK_SERIAL 0x0001 +#define TE_MASK_MODEM 0x0002 +#define TE_MASK_FILE 0x0004 +#define TY_SERFILE_SERIAL 1 +#define OBSOLETE_SERFILE_MODEM 2 +#define TY_SERFILE_FILE 3 +#define TY_SERFILE_NEW_MODEM 4 +#define TY_SERFILE_SERDVR 5 +#define TY_SERFILE_LNKDVR 6 +#define TE_XMDM_NONE 3 +#define TE_DIAL_PULSE 1 +#define TE_DIAL_TONE 2 +#define TE_MODEM_300 0x01 +#define TE_MODEM_1200 0x02 +#define TE_MODEM_2400 0x03 +#define TE_MODEM_4800 0x04 +#define TE_MODEM_9600 0x05 +#define TE_MODEM_19200 0x06 +#define MAX_DEVICE_NAME 10 +#define MAX_MODEM_CMD 40 +/* Types for serfile */ +typedef struct +{ +P_SRCHAR ch; +char port[P_MAXDEVNAME+2]; +} PF_SERIAL; +typedef struct +{ +P_MDMCHR mch; +unsigned char phone[25]; +unsigned char auto_dial; +unsigned char mdmdvr[MAX_DEVICE_NAME]; +unsigned char mdmcmd[MAX_MODEM_CMD]; +unsigned char spare[16]; +} PF_MODEM; +typedef struct +{ +unsigned short int protocol; +} PF_FILE; +typedef struct +{ +P_SRCHAR ch; +unsigned char serdvr[MAX_DEVICE_NAME]; +unsigned char spare[16]; +} PF_SERDVR; +typedef struct +{ +unsigned char masdvr[MAX_DEVICE_NAME]; +unsigned char lnkdvr[MAX_DEVICE_NAME]; +unsigned char spare[16]; +} PF_LNKDVR; +/* Property of serfile */ +typedef struct { +PF_SERIAL serial; +PF_MODEM modem; +PF_FILE file; +PF_LNKDVR lnkdvr; +PF_SERDVR serdvr; +} PRS_SERFILE; +typedef struct pr_serfile +{ +PRS_ROOT root; +PRS_TLVDATA tlvdata; +PRS_SERFILE serfile; +} PR_SERFILE; +/* Constants for print */ +#define PRINT_DATA 0x0 +#define PRINT_LINE 0x1 +#define PRINT_FINISH 0x8 +/* Types for print */ +typedef struct +{ +unsigned char *buf; +unsigned short int len; +unsigned short int status; +} PRINT_STATE; +/* Property of print */ +typedef struct { +PRINT_STATE state; +unsigned char crlf[2]; +} PRS_PRINT; +typedef struct pr_print +{ +PRS_ROOT root; +PRS_ACTIVE active; +PRS_PRINT print; +} PR_PRINT; +/* Constants for serial */ +#define READ_QUEUED 0x01 +#define WRITE_QUEUED 0x02 +/* Property of serial */ +typedef struct { +unsigned short int flags; +short int rstat; +short int wstat; +unsigned short int rlen; +unsigned char *rbuf; +unsigned short int wlen; +unsigned char *wbuf; +unsigned short int rsize; +unsigned short int wsize; +} PRS_SERIAL; +typedef struct pr_serial +{ +PRS_ROOT root; +PRS_ACTIVE active; +PRS_SERIAL serial; +} PR_SERIAL; diff --git a/code/SIBOSDK/include/tlvfile.ing b/code/SIBOSDK/include/tlvfile.ing new file mode 100644 index 0000000..2f2d5c8 --- /dev/null +++ b/code/SIBOSDK/include/tlvfile.ing @@ -0,0 +1,222 @@ +; Generated by Ctran from tlvfile.cat +TLVFILE_ING equ 1 +IFNDEF APPMAN_ING + INCLUDE ..\inc\APPMAN.ING +ENDIF +IFNDEF P_FILE_INC + INCLUDE ..\inc\P_FILE.INC +ENDIF +IFNDEF P_SERIAL_INC + INCLUDE ..\inc\P_SERIAL.INC +ENDIF +IFNDEF P_MODEM_INC + INCLUDE ..\inc\P_MODEM.INC +ENDIF +; Class Numbers +C_BFILE equ 45 +C_TLVFILE equ 46 +C_TLVDATA equ 47 +C_SERFILE equ 48 +C_PRINT equ 49 +C_SERIAL equ 50 +; Method Numbers +O_TD_SAVE_ITEM equ 5 +O_TD_SENSE_ITEM equ 9 +O_FL_SET_BUF_LEN equ 3 +O_FL_SENSE_REC equ 12 +O_FL_REPLACE equ 13 +O_FL_DELREC equ 8 +O_TD_SET_ITEM equ 8 +O_TD_SAVE equ 2 +O_TD_OPEN equ 1 +O_FI_OPEN equ 5 +O_FL_SET_REC equ 11 +O_FL_WRITE_REC equ 7 +O_SR_FLUSH equ 10 +O_TD_LOAD_ITEM equ 4 +O_FI_CLOSE equ 1 +O_TD_SET_FILE equ 7 +O_TD_CHANGED equ 3 +O_FI_READ equ 2 +O_FL_SENSE_DATA equ 4 +O_FL_REWIND equ 6 +O_SR_CONTROL equ 11 +O_FL_COUNT equ 9 +O_SR_SENSE equ 9 +O_SR_ENQUIRE equ 12 +O_TD_RESET equ 6 +O_SR_GRAB equ 13 +O_PR_GET_DATA equ 6 +O_FL_READ_BY_TYPE equ 10 +O_SR_TEST equ 7 +O_SR_SET equ 8 +O_SR_WRITE equ 6 +; Constants for bfile +OP_BFILE_ID_SIZE equ (16) +; Types for bfile +OP_BFILE_FSIG struc +OP_BFILE_FSIGFid db (1) * OP_BFILE_ID_SIZE dup (?) +OP_BFILE_FSIGVers dw ? +OP_BFILE_FSIGOffset dw ? +OP_BFILE_FSIGRtvers dw ? +OP_BFILE_FSIG ends +; Property of bfile +PRS_BFILE struc +BfilePcb dw ? +BfileRbuf dw ? +BfileRlen dw ? +BfileOffset dw ? +PRS_BFILE ends +PR_BFILE struc +BfileRoot PRS_ROOT <> +BfileBfile PRS_BFILE <> +PR_BFILE ends +; Constants for tlvfile +TLV_TYPE_UNKNOWN equ (010h) +TLV_TYPE_INVALID equ (00fh) +TLV_TYPE_DELETED equ (000h) +TLV_TYPE_NORMAL equ (001h) +TLV_TYPE_FIELDS equ (002h) +TLV_TYPE_SHIFT equ (12) +TLV_TYPE_MASK equ (0f000h) +; Types for tlvfile +OP_TLVFILE struc +OP_TLVFILEFsig OP_BFILE_FSIG <> +OP_TLVFILETypes dw ? +OP_TLVFILE ends +OP_TLV_REC struc +OP_TLV_RECBuf dw ? +OP_TLV_RECLen dw ? +OP_TLV_RECType dw ? +OP_TLV_REC ends +; Property of tlvfile +PRS_TLVFILE struc +TlvfileTypmask dw ? +TlvfileHdlen dw ? +TlvfileHdtype dw ? +TlvfilePos dd ? +TlvfileFpos dd ? +PRS_TLVFILE ends +PR_TLVFILE struc +TlvfileRoot PRS_ROOT <> +TlvfileBfile PRS_BFILE <> +TlvfileTlvfile PRS_TLVFILE <> +PR_TLVFILE ends +; Types for tlvdata +PR_TLVDATA_CHARS struc +PR_TLVDATA_CHARSTlvfile OP_TLVFILE <> +PR_TLVDATA_CHARSExt db (1) * 6 dup (?) +PR_TLVDATA_CHARS ends +; Property of tlvdata +PRS_TLVDATA struc +TlvdataTlv dw ? +TlvdataCl_tlv dw ? +TlvdataChanged dw ? +TlvdataIndex dw ? +TlvdataTmask dw ? +TlvdataName db (1) * P_FNAMESIZE dup (?) +PRS_TLVDATA ends +PR_TLVDATA struc +TlvdataRoot PRS_ROOT <> +TlvdataTlvdata PRS_TLVDATA <> +PR_TLVDATA ends +; Constants for serfile +TE_MASK_SERIAL equ (00001h) +TE_MASK_MODEM equ (00002h) +TE_MASK_FILE equ (00004h) +TY_SERFILE_SERIAL equ (1) +OBSOLETE_SERFILE_MODEM equ (2) +TY_SERFILE_FILE equ (3) +TY_SERFILE_NEW_MODEM equ (4) +TY_SERFILE_SERDVR equ (5) +TY_SERFILE_LNKDVR equ (6) +TE_XMDM_NONE equ (3) +TE_DIAL_PULSE equ (1) +TE_DIAL_TONE equ (2) +TE_MODEM_300 equ (001h) +TE_MODEM_1200 equ (002h) +TE_MODEM_2400 equ (003h) +TE_MODEM_4800 equ (004h) +TE_MODEM_9600 equ (005h) +TE_MODEM_19200 equ (006h) +MAX_DEVICE_NAME equ (10) +MAX_MODEM_CMD equ (40) +; Types for serfile +PF_SERIAL struc +PF_SERIALCh P_SRCHAR <> +PF_SERIALPort db (1) * P_MAXDEVNAME+2 dup (?) +PF_SERIAL ends +PF_MODEM struc +PF_MODEMMch P_MDMCHR <> +PF_MODEMPhone db (1) * 25 dup (?) +PF_MODEMAuto_dial db ? +PF_MODEMMdmdvr db (1) * MAX_DEVICE_NAME dup (?) +PF_MODEMMdmcmd db (1) * MAX_MODEM_CMD dup (?) +PF_MODEMSpare db (1) * 16 dup (?) +PF_MODEM ends +PF_FILE struc +PF_FILEProtocol dw ? +PF_FILE ends +PF_SERDVR struc +PF_SERDVRCh P_SRCHAR <> +PF_SERDVRSerdvr db (1) * MAX_DEVICE_NAME dup (?) +PF_SERDVRSpare db (1) * 16 dup (?) +PF_SERDVR ends +PF_LNKDVR struc +PF_LNKDVRMasdvr db (1) * MAX_DEVICE_NAME dup (?) +PF_LNKDVRLnkdvr db (1) * MAX_DEVICE_NAME dup (?) +PF_LNKDVRSpare db (1) * 16 dup (?) +PF_LNKDVR ends +; Property of serfile +PRS_SERFILE struc +SerfileSerial PF_SERIAL <> +SerfileModem PF_MODEM <> +SerfileFile PF_FILE <> +SerfileLnkdvr PF_LNKDVR <> +SerfileSerdvr PF_SERDVR <> +PRS_SERFILE ends +PR_SERFILE struc +SerfileRoot PRS_ROOT <> +SerfileTlvdata PRS_TLVDATA <> +SerfileSerfile PRS_SERFILE <> +PR_SERFILE ends +; Constants for print +PRINT_DATA equ (00h) +PRINT_LINE equ (01h) +PRINT_FINISH equ (08h) +; Types for print +PRINT_STATE struc +PRINT_STATEBuf dw ? +PRINT_STATELen dw ? +PRINT_STATEStatus dw ? +PRINT_STATE ends +; Property of print +PRS_PRINT struc +PrintState PRINT_STATE <> +PrintCrlf db (1) * 2 dup (?) +PRS_PRINT ends +PR_PRINT struc +PrintRoot PRS_ROOT <> +PrintActive PRS_ACTIVE <> +PrintPrint PRS_PRINT <> +PR_PRINT ends +; Constants for serial +READ_QUEUED equ (001h) +WRITE_QUEUED equ (002h) +; Property of serial +PRS_SERIAL struc +SerialFlags dw ? +SerialRstat dw ? +SerialWstat dw ? +SerialRlen dw ? +SerialRbuf dw ? +SerialWlen dw ? +SerialWbuf dw ? +SerialRsize dw ? +SerialWsize dw ? +PRS_SERIAL ends +PR_SERIAL struc +SerialRoot PRS_ROOT <> +SerialActive PRS_ACTIVE <> +SerialSerial PRS_SERIAL <> +PR_SERIAL ends diff --git a/code/SIBOSDK/include/types.h b/code/SIBOSDK/include/types.h new file mode 100644 index 0000000..f0f6685 --- /dev/null +++ b/code/SIBOSDK/include/types.h @@ -0,0 +1,31 @@ +/* Release 3.00 */ + +/*-------------------------------------------------------------------------* +* * +* types.h - common types * +* * +* COPYRIGHT (C) 1988 Jensen and Partners. All Rights Reserved * +* * +*--------------------------------------------------------------------------*/ +#include + +#ifndef _INO_DEF +typedef unsigned short ino_t; /* i-node number */ +#define _INO_DEF +#endif + +#ifndef _TIME_DEF +typedef long time_t; +#define _TIME_DEF +#endif + +#ifndef _DEV_DEF +typedef short dev_t; /* device code */ +#define _DEV_DEF +#endif + +#ifndef _OFF_DEF +typedef long off_t; /* file offset value */ +#define _OFF_DEF +#endif + diff --git a/code/SIBOSDK/include/values.h b/code/SIBOSDK/include/values.h new file mode 100644 index 0000000..9b1cc5e --- /dev/null +++ b/code/SIBOSDK/include/values.h @@ -0,0 +1,38 @@ +/* Release 3.00 */ + +/*-------------------------------------------------------------------------* +* * +* values.h - Value ranges for common data types. * +* * +* COPYRIGHT (C) 1988 Jensen and Partners. All Rights Reserved. * +* * +*--------------------------------------------------------------------------*/ +#include + +#ifndef _VALUES_INC_ +#define _VALUES_INC_ + +#define MAXCHAR 127 +#define MINCHAR -128 +#define MAXUCHAR 255 +#define MINUCHAR 0 +#define MAXSHORT 32767 +#define MINSHORT ((-32767)-1) +#define MAXINT 32767 +#define MININT ((-32767)-1) +#define MAXUINT 65535U +#define MINUINT 0 +#define MAXLONG 2147483647L +#define MINLONG ((-2147483647L)-1) +#define MAXULONG 4294967295UL +#define MINULONG 0 +#define DMAXEXP 308 +#define FMAXEXP 38 +#define DMINEXP -307 +#define FMINEXP -37 +#define MAXDOUBLE 1.797693e+308 +#define MAXFLOAT 3.402823e+38 +#define MINDOUBLE 2.225074e-308 +#define MINFLOAT 1.175494e-38 + +#endif diff --git a/code/SIBOSDK/include/vares.g b/code/SIBOSDK/include/vares.g new file mode 100644 index 0000000..31cc67b --- /dev/null +++ b/code/SIBOSDK/include/vares.g @@ -0,0 +1,18 @@ +/* Generated by Ctran from vares.cl */ +#define VARES_G +#ifndef VARRAY_G +#include +#endif +/* Class Numbers */ +#define C_VARES 20 +/* Method Numbers */ +/* Property of vares */ +typedef struct { +unsigned char *data; +} PRS_VARES; +typedef struct pr_vares +{ +PRS_ROOT root; +PRS_VAROOT varoot; +PRS_VARES vares; +} PR_VARES; diff --git a/code/SIBOSDK/include/vares.ing b/code/SIBOSDK/include/vares.ing new file mode 100644 index 0000000..b7c4c0c --- /dev/null +++ b/code/SIBOSDK/include/vares.ing @@ -0,0 +1,17 @@ +; Generated by Ctran from vares.cl +VARES_ING equ 1 +IFNDEF VARRAY_ING + INCLUDE ..\inc\VARRAY.ING +ENDIF +; Class Numbers +C_VARES equ 20 +; Method Numbers +; Property of vares +PRS_VARES struc +VaresData dw ? +PRS_VARES ends +PR_VARES struc +VaresRoot PRS_ROOT <> +VaresVaroot PRS_VAROOT <> +VaresVares PRS_VARES <> +PR_VARES ends diff --git a/code/SIBOSDK/include/varray.g b/code/SIBOSDK/include/varray.g new file mode 100644 index 0000000..42ce9f5 --- /dev/null +++ b/code/SIBOSDK/include/varray.g @@ -0,0 +1,166 @@ +/* Generated by Ctran from varray.cat */ +#define VARRAY_G +#ifndef OLIB_G +#include +#endif +#ifndef P_QUE_H +#include +#endif +/* Class Numbers */ +#define C_VAROOT 1 +#define C_VAFIX 2 +#define C_VAFLAT 3 +#define C_SGBUF 4 +#define C_VASEG 5 +#define C_VASTR 6 +#define C_VAXVAR 7 +#define C_VAXVARS 8 +/* Method Numbers */ +#define O_VA_COPY 14 +#define O_SB_INIT 1 +#define O_VA_FINDISQ 5 +#define O_VA_TEST 12 +#define O_SB_DELETE 4 +#define O_VA_INIT 17 +#define O_VA_REPLACE 13 +#define O_SB_INSERT 3 +#define O_VA_RECLEN 15 +#define O_VA_APPEND 7 +#define O_VA_RESET 11 +#define O_VA_DELETE 2 +#define O_VA_INSERT 8 +#define O_SB_POINT 2 +#define O_VA_DELETEM 18 +#define O_SB_COMPRESS 6 +#define O_VA_SORT 3 +#define O_VA_PBUF 21 +#define O_VA_INSERTM 19 +#define O_VA_PREC 20 +#define O_SB_COUNT 7 +#define O_VA_COMPARE 10 +#define O_SB_ALLOCSEG 9 +#define O_VA_INSERTISQ 6 +#define O_VA_COMPRESS 23 +#define O_VA_KEY 4 +#define O_SB_BACKPOINT 8 +#define O_VA_SWAP 16 +#define O_VA_COUNT 1 +#define O_VA_CAPACITY 22 +#define O_VA_SEARCH 9 +#define O_SB_EXTRACT 5 +/* Constants for varoot */ +#define VA_ROOT_DUPLICATE 1 +#define VA_ROOT_FLG_FOLD 0x01 +#define VA_ROOT_FLG_DESC 0x02 +/* Types for varoot */ +typedef struct +{ +unsigned char ofs; +unsigned char len; +unsigned char fold; +unsigned char desc; +} PR_VAROOT_KEY; +/* Property of varoot */ +typedef struct { +unsigned short int nrec; +PR_VAROOT_KEY key; +} PRS_VAROOT; +typedef struct pr_varoot +{ +PRS_ROOT root; +PRS_VAROOT varoot; +} PR_VAROOT; +/* Property of vafix */ +typedef struct { +unsigned short int rlen; +} PRS_VAFIX; +typedef struct pr_vafix +{ +PRS_ROOT root; +PRS_VAROOT varoot; +PRS_VAFIX vafix; +} PR_VAFIX; +/* Property of vaflat */ +typedef struct { +unsigned short int gran; +unsigned short int nspc; +unsigned char *base; +} PRS_VAFLAT; +typedef struct pr_vaflat +{ +PRS_ROOT root; +PRS_VAROOT varoot; +PRS_VAFIX vafix; +PRS_VAFLAT vaflat; +} PR_VAFLAT; +/* Types for sgbuf */ +typedef struct +{ +P_QUE q; +unsigned short int len; +} PR_SGBUF_HD; +typedef struct +{ +PR_SGBUF_HD *seg; +unsigned short int base; +unsigned short int ofs; +} PR_SGBUF_SBO; +/* Property of sgbuf */ +typedef struct { +PR_SGBUF_HD hd; +unsigned short int nbytes; +PR_SGBUF_SBO cur; +} PRS_SGBUF; +typedef struct pr_sgbuf +{ +PRS_ROOT root; +PRS_SGBUF sgbuf; +} PR_SGBUF; +/* Property of vaseg */ +typedef struct { +PR_SGBUF *buf; +} PRS_VASEG; +typedef struct pr_vaseg +{ +PRS_ROOT root; +PRS_VAROOT varoot; +PRS_VAFIX vafix; +PRS_VASEG vaseg; +} PR_VASEG; +/* Property of vastr */ +typedef struct { +unsigned short int size; +unsigned short int gran; +unsigned char *base; +unsigned short int len; +unsigned short int num; +unsigned char *pnum; +} PRS_VASTR; +typedef struct pr_vastr +{ +PRS_ROOT root; +PRS_VAROOT varoot; +PRS_VASTR vastr; +} PR_VASTR; +/* Types for vaxvar */ +typedef struct +{ +unsigned short int len; +unsigned char *buf; +} RC_VAXVAR; +/* Property of vaxvar */ +typedef struct pr_vaxvar +{ +PRS_ROOT root; +PRS_VAROOT varoot; +PRS_VAFIX vafix; +PRS_VAFLAT vaflat; +} PR_VAXVAR; +/* Property of vaxvars */ +typedef struct pr_vaxvars +{ +PRS_ROOT root; +PRS_VAROOT varoot; +PRS_VAFIX vafix; +PRS_VASEG vaseg; +} PR_VAXVARS; diff --git a/code/SIBOSDK/include/varray.ing b/code/SIBOSDK/include/varray.ing new file mode 100644 index 0000000..ba932b7 --- /dev/null +++ b/code/SIBOSDK/include/varray.ing @@ -0,0 +1,154 @@ +; Generated by Ctran from varray.cat +VARRAY_ING equ 1 +IFNDEF OLIB_ING + INCLUDE ..\inc\OLIB.ING +ENDIF +IFNDEF P_QUE_INC + INCLUDE ..\inc\P_QUE.INC +ENDIF +; Class Numbers +C_VAROOT equ 1 +C_VAFIX equ 2 +C_VAFLAT equ 3 +C_SGBUF equ 4 +C_VASEG equ 5 +C_VASTR equ 6 +C_VAXVAR equ 7 +C_VAXVARS equ 8 +; Method Numbers +O_VA_COPY equ 14 +O_SB_INIT equ 1 +O_VA_FINDISQ equ 5 +O_VA_TEST equ 12 +O_SB_DELETE equ 4 +O_VA_INIT equ 17 +O_VA_REPLACE equ 13 +O_SB_INSERT equ 3 +O_VA_RECLEN equ 15 +O_VA_APPEND equ 7 +O_VA_RESET equ 11 +O_VA_DELETE equ 2 +O_VA_INSERT equ 8 +O_SB_POINT equ 2 +O_VA_DELETEM equ 18 +O_SB_COMPRESS equ 6 +O_VA_SORT equ 3 +O_VA_PBUF equ 21 +O_VA_INSERTM equ 19 +O_VA_PREC equ 20 +O_SB_COUNT equ 7 +O_VA_COMPARE equ 10 +O_SB_ALLOCSEG equ 9 +O_VA_INSERTISQ equ 6 +O_VA_COMPRESS equ 23 +O_VA_KEY equ 4 +O_SB_BACKPOINT equ 8 +O_VA_SWAP equ 16 +O_VA_COUNT equ 1 +O_VA_CAPACITY equ 22 +O_VA_SEARCH equ 9 +O_SB_EXTRACT equ 5 +; Constants for varoot +VA_ROOT_DUPLICATE equ (1) +VA_ROOT_FLG_FOLD equ (001h) +VA_ROOT_FLG_DESC equ (002h) +; Types for varoot +PR_VAROOT_KEY struc +PR_VAROOT_KEYOfs db ? +PR_VAROOT_KEYLen db ? +PR_VAROOT_KEYFold db ? +PR_VAROOT_KEYDesc db ? +PR_VAROOT_KEY ends +; Property of varoot +PRS_VAROOT struc +VarootNrec dw ? +VarootKey PR_VAROOT_KEY <> +PRS_VAROOT ends +PR_VAROOT struc +VarootRoot PRS_ROOT <> +VarootVaroot PRS_VAROOT <> +PR_VAROOT ends +; Property of vafix +PRS_VAFIX struc +VafixRlen dw ? +PRS_VAFIX ends +PR_VAFIX struc +VafixRoot PRS_ROOT <> +VafixVaroot PRS_VAROOT <> +VafixVafix PRS_VAFIX <> +PR_VAFIX ends +; Property of vaflat +PRS_VAFLAT struc +VaflatGran dw ? +VaflatNspc dw ? +VaflatBase dw ? +PRS_VAFLAT ends +PR_VAFLAT struc +VaflatRoot PRS_ROOT <> +VaflatVaroot PRS_VAROOT <> +VaflatVafix PRS_VAFIX <> +VaflatVaflat PRS_VAFLAT <> +PR_VAFLAT ends +; Types for sgbuf +PR_SGBUF_HD struc +PR_SGBUF_HDQ P_QUE <> +PR_SGBUF_HDLen dw ? +PR_SGBUF_HD ends +PR_SGBUF_SBO struc +PR_SGBUF_SBOSeg dw ? +PR_SGBUF_SBOBase dw ? +PR_SGBUF_SBOOfs dw ? +PR_SGBUF_SBO ends +; Property of sgbuf +PRS_SGBUF struc +SgbufHd PR_SGBUF_HD <> +SgbufNbytes dw ? +SgbufCur PR_SGBUF_SBO <> +PRS_SGBUF ends +PR_SGBUF struc +SgbufRoot PRS_ROOT <> +SgbufSgbuf PRS_SGBUF <> +PR_SGBUF ends +; Property of vaseg +PRS_VASEG struc +VasegBuf dw ? +PRS_VASEG ends +PR_VASEG struc +VasegRoot PRS_ROOT <> +VasegVaroot PRS_VAROOT <> +VasegVafix PRS_VAFIX <> +VasegVaseg PRS_VASEG <> +PR_VASEG ends +; Property of vastr +PRS_VASTR struc +VastrSize dw ? +VastrGran dw ? +VastrBase dw ? +VastrLen dw ? +VastrNum dw ? +VastrPnum dw ? +PRS_VASTR ends +PR_VASTR struc +VastrRoot PRS_ROOT <> +VastrVaroot PRS_VAROOT <> +VastrVastr PRS_VASTR <> +PR_VASTR ends +; Types for vaxvar +RC_VAXVAR struc +RC_VAXVARLen dw ? +RC_VAXVARBuf dw ? +RC_VAXVAR ends +; Property of vaxvar +PR_VAXVAR struc +VaxvarRoot PRS_ROOT <> +VaxvarVaroot PRS_VAROOT <> +VaxvarVafix PRS_VAFIX <> +VaxvarVaflat PRS_VAFLAT <> +PR_VAXVAR ends +; Property of vaxvars +PR_VAXVARS struc +VaxvarsRoot PRS_ROOT <> +VaxvarsVaroot PRS_VAROOT <> +VaxvarsVafix PRS_VAFIX <> +VaxvarsVaseg PRS_VASEG <> +PR_VAXVARS ends diff --git a/code/SIBOSDK/include/win.g b/code/SIBOSDK/include/win.g new file mode 100644 index 0000000..1e06d40 --- /dev/null +++ b/code/SIBOSDK/include/win.g @@ -0,0 +1,67 @@ +/* Generated by Ctran from win.cl */ +#define WIN_G +#ifndef OLIB_G +#include +#endif +#ifndef WLIB_H +#include +#endif +/* Class Numbers */ +#define C_WIN 1 +/* Method Numbers */ +#define O_WN_INIT 13 +#define O_WN_VISIBLE 7 +#define O_WN_SENSE 11 +#define O_WN_POSITION 4 +#define O_WN_KEY 6 +#define O_WN_DODRAW 2 +#define O_WN_CALC_POSITION 5 +#define O_WN_CONNECT 3 +#define O_WN_REDRAW 1 +#define O_WN_EMPHASISE 8 +#define O_WN_SENSE_HELP 9 +#define O_WN_SET 10 +#define O_WN_DRAW 12 +/* Constants for win */ +#define CURSOR_WIDTH 2 +#define CURSOR_COLWID 2 +#define SYSTEM_FONT_COLWID 2 +#define W_KEY_SPACE 32 +#define PR_BWIN_CUSHION 0x1 +#define PR_BWIN_CORNER_4 0x2 +#define PR_BWIN_SHADOW_1 0x4 +#define PR_BWIN_SHADOW_2 0x8 +#define PR_WIN_EMPHASISED 0x10 +#define PR_BWIN_OPEN 0x20 +#define PR_BWIN_CORNER_1 0x40 +#define PR_WIN_IS_DLCTRL 0x80 +#define PR_WIN_IS_OVCTRL 0x100 +#define PR_WIN_INITIALISED 0x800 +#define PR_WIN_FORCE_RIGHT 0x1000 +#define PR_WIN_FORCE_LEFT 0x2000 +#define PR_WIN_FORCE_BOTTOM 0x4000 +#define PR_WIN_FORCE_TOP 0x8000 +#define PR_WIN_FORCE_FLAGS 0xf000 +#define WIN_3dBORDER PR_WIN_FORCE_RIGHT +#define WIN_FROM_ATS PR_WIN_FORCE_LEFT +#define IN_WIN_EMPHASISED (PR_WIN_EMPHASISED) +#define WV_INVISIBLE 0 +#define WV_VISIBLE 1 +#define WV_INITINVIS 2 +#define WV_INITVIS 3 +#define WN_KEY_NO_CHANGE 0 +#define WN_KEY_CHANGED 3 +#define WN_KEY_CHANGED_DEFER 7 +#define WN_KEY_CANCELLED (-1) +#define WN_KEY_ABSORB_ON (-2) +#define ERROR_RID_OFFSET 512 +/* Property of win */ +typedef struct { +unsigned short int id; +unsigned short int flags; +} PRS_WIN; +typedef struct pr_win +{ +PRS_ROOT root; +PRS_WIN win; +} PR_WIN; diff --git a/code/SIBOSDK/include/win.ing b/code/SIBOSDK/include/win.ing new file mode 100644 index 0000000..7a284f8 --- /dev/null +++ b/code/SIBOSDK/include/win.ing @@ -0,0 +1,66 @@ +; Generated by Ctran from win.cl +WIN_ING equ 1 +IFNDEF OLIB_ING + INCLUDE ..\inc\OLIB.ING +ENDIF +IFNDEF WLIB_INC + INCLUDE ..\inc\WLIB.INC +ENDIF +; Class Numbers +C_WIN equ 1 +; Method Numbers +O_WN_INIT equ 13 +O_WN_VISIBLE equ 7 +O_WN_SENSE equ 11 +O_WN_POSITION equ 4 +O_WN_KEY equ 6 +O_WN_DODRAW equ 2 +O_WN_CALC_POSITION equ 5 +O_WN_CONNECT equ 3 +O_WN_REDRAW equ 1 +O_WN_EMPHASISE equ 8 +O_WN_SENSE_HELP equ 9 +O_WN_SET equ 10 +O_WN_DRAW equ 12 +; Constants for win +CURSOR_WIDTH equ (2) +CURSOR_COLWID equ (2) +SYSTEM_FONT_COLWID equ (2) +W_KEY_SPACE equ (32) +PR_BWIN_CUSHION equ (01h) +PR_BWIN_CORNER_4 equ (02h) +PR_BWIN_SHADOW_1 equ (04h) +PR_BWIN_SHADOW_2 equ (08h) +PR_WIN_EMPHASISED equ (010h) +PR_BWIN_OPEN equ (020h) +PR_BWIN_CORNER_1 equ (040h) +PR_WIN_IS_DLCTRL equ (080h) +PR_WIN_IS_OVCTRL equ (0100h) +PR_WIN_INITIALISED equ (0800h) +PR_WIN_FORCE_RIGHT equ (01000h) +PR_WIN_FORCE_LEFT equ (02000h) +PR_WIN_FORCE_BOTTOM equ (04000h) +PR_WIN_FORCE_TOP equ (08000h) +PR_WIN_FORCE_FLAGS equ (0f000h) +WIN_3dBORDER equ (PR_WIN_FORCE_RIGHT) +WIN_FROM_ATS equ (PR_WIN_FORCE_LEFT) +IN_WIN_EMPHASISED equ (PR_WIN_EMPHASISED) +WV_INVISIBLE equ (0) +WV_VISIBLE equ (1) +WV_INITINVIS equ (2) +WV_INITVIS equ (3) +WN_KEY_NO_CHANGE equ (0) +WN_KEY_CHANGED equ (3) +WN_KEY_CHANGED_DEFER equ (7) +WN_KEY_CANCELLED equ (-1) +WN_KEY_ABSORB_ON equ (-2) +ERROR_RID_OFFSET equ (512) +; Property of win +PRS_WIN struc +WinId dw ? +WinFlags dw ? +PRS_WIN ends +PR_WIN struc +WinRoot PRS_ROOT <> +WinWin PRS_WIN <> +PR_WIN ends diff --git a/code/SIBOSDK/include/window.h b/code/SIBOSDK/include/window.h new file mode 100644 index 0000000..8f5f128 --- /dev/null +++ b/code/SIBOSDK/include/window.h @@ -0,0 +1,34 @@ +/* Release 3.00 */ +/*-------------------------------------------------------------------------* +* * +* window.h - definitions for window module types and functions. * +* * +* COPYRIGHT (C) 1989..1991 Jensen and Partners. All Rights Reserved * +* * +*--------------------------------------------------------------------------*/ + +#ifndef _WINDOWS +#ifndef _TSWIN_INC_ +#define _TSWIN_INC_ + +#define TRUE 1 +#define FALSE 0 + +#ifdef __cplusplus +extern "C" { +#endif +extern void gotoxy(int x, int y); +extern int wherex(void); +extern int wherey(void); +extern void clrscr(void); +extern void cursoron(void); +extern void cursoroff(void); +extern void insline(void); +extern void delline(void); +extern void clreol(void); +extern void setwrap(int on); +#ifdef __cplusplus +} +#endif +#endif +#endif diff --git a/code/SIBOSDK/include/wldselwn.g b/code/SIBOSDK/include/wldselwn.g new file mode 100644 index 0000000..b42b67a --- /dev/null +++ b/code/SIBOSDK/include/wldselwn.g @@ -0,0 +1,68 @@ +/* Generated by Ctran from wldselwn.cl */ +#define WLDSELWN_G +#ifndef MATCHER_G +#include +#endif +#ifndef WR_IO_H +#include +#endif +/* Class Numbers */ +#define C_WMATCHER 37 +#define C_WLDSELWN 38 +/* Method Numbers */ +#define O_WLD_RESTRICT 19 +/* Constants for wmatcher */ +#define GEOG_MAX_NAME 22 +#define PR_WMATCHER_INDETERMINATE 0x02 +/* Property of wmatcher */ +typedef struct { +void *wfcb; +unsigned char iscountry; +unsigned char tleng; +char tbuf[GEOG_MAX_NAME]; +WR_FIND_RES res; +short int resco; +} PRS_WMATCHER; +typedef struct pr_wmatcher +{ +PRS_ROOT root; +PRS_MATCHER matcher; +PRS_WMATCHER wmatcher; +} PR_WMATCHER; +/* Constants for wldselwn */ +#define PR_WLDSELWN_COUNTRY 0x01 +#define PR_WLDSELWN_FIRST_PARTNER 0x02 +#define PR_WLDSELWN_NOT_IN_DIALOG 0x04 +#define PR_WLDSELWN_RESTRICTED 0x08 +#define IN_WLDSELWN_CITY 0 +#define IN_WLDSELWN_COUNTRY PR_WLDSELWN_COUNTRY +#define IN_WLDSELWN_FIRST_PARTNER PR_WLDSELWN_FIRST_PARTNER +#define IN_WLDSELWN_NOT_IN_DIALOG PR_WLDSELWN_NOT_IN_DIALOG +#define IN_WLDSELWN_SECOND_PARTNER 0x10 +#define IN_WLDSELWN_SETHOME 0x20 +#define IN_WLDSELWN_SETDFLT 0x40 +/* Types for wldselwn */ +typedef struct +{ +unsigned short int flags; +PR_WIN *other; +} IN_WLDSELWN; +typedef struct +{ +void *wfcb; +WR_EXTRA_DATA data; +} SENSE_WLDSELWN; +/* Property of wldselwn */ +typedef struct { +PR_WMATCHER *mat; +unsigned char *tleng; +unsigned short int flags; +PR_WIN *other; +} PRS_WLDSELWN; +typedef struct pr_wldselwn +{ +PRS_ROOT root; +PRS_WIN win; +PRS_LODGER lodger; +PRS_WLDSELWN wldselwn; +} PR_WLDSELWN; diff --git a/code/SIBOSDK/include/wldselwn.ing b/code/SIBOSDK/include/wldselwn.ing new file mode 100644 index 0000000..7d7ba3e --- /dev/null +++ b/code/SIBOSDK/include/wldselwn.ing @@ -0,0 +1,64 @@ +; Generated by Ctran from wldselwn.cl +WLDSELWN_ING equ 1 +IFNDEF MATCHER_ING + INCLUDE ..\inc\MATCHER.ING +ENDIF +IFNDEF WR_IO_INC + INCLUDE ..\inc\WR_IO.INC +ENDIF +; Class Numbers +C_WMATCHER equ 37 +C_WLDSELWN equ 38 +; Method Numbers +O_WLD_RESTRICT equ 19 +; Constants for wmatcher +GEOG_MAX_NAME equ (22) +PR_WMATCHER_INDETERMINATE equ (002h) +; Property of wmatcher +PRS_WMATCHER struc +WmatcherWfcb dw ? +WmatcherIscountry db ? +WmatcherTleng db ? +WmatcherTbuf db (1) * GEOG_MAX_NAME dup (?) +WmatcherRes WR_FIND_RES <> +WmatcherResco dw ? +PRS_WMATCHER ends +PR_WMATCHER struc +WmatcherRoot PRS_ROOT <> +WmatcherMatcher PRS_MATCHER <> +WmatcherWmatcher PRS_WMATCHER <> +PR_WMATCHER ends +; Constants for wldselwn +PR_WLDSELWN_COUNTRY equ (001h) +PR_WLDSELWN_FIRST_PARTNER equ (002h) +PR_WLDSELWN_NOT_IN_DIALOG equ (004h) +PR_WLDSELWN_RESTRICTED equ (008h) +IN_WLDSELWN_CITY equ (0) +IN_WLDSELWN_COUNTRY equ (PR_WLDSELWN_COUNTRY) +IN_WLDSELWN_FIRST_PARTNER equ (PR_WLDSELWN_FIRST_PARTNER) +IN_WLDSELWN_NOT_IN_DIALOG equ (PR_WLDSELWN_NOT_IN_DIALOG) +IN_WLDSELWN_SECOND_PARTNER equ (010h) +IN_WLDSELWN_SETHOME equ (020h) +IN_WLDSELWN_SETDFLT equ (040h) +; Types for wldselwn +IN_WLDSELWN struc +IN_WLDSELWNFlags dw ? +IN_WLDSELWNOther dw ? +IN_WLDSELWN ends +SENSE_WLDSELWN struc +SENSE_WLDSELWNWfcb dw ? +SENSE_WLDSELWNData WR_EXTRA_DATA <> +SENSE_WLDSELWN ends +; Property of wldselwn +PRS_WLDSELWN struc +WldselwnMat dw ? +WldselwnTleng dw ? +WldselwnFlags dw ? +WldselwnOther dw ? +PRS_WLDSELWN ends +PR_WLDSELWN struc +WldselwnRoot PRS_ROOT <> +WldselwnWin PRS_WIN <> +WldselwnLodger PRS_LODGER <> +WldselwnWldselwn PRS_WLDSELWN <> +PR_WLDSELWN ends diff --git a/code/SIBOSDK/include/wlib.h b/code/SIBOSDK/include/wlib.h new file mode 100644 index 0000000..4557916 --- /dev/null +++ b/code/SIBOSDK/include/wlib.h @@ -0,0 +1,827 @@ +/* HEADER - WLIB.H +Copyright (C) Psion PLC 1991 + VER DATE BY DESCRIPTION +===== ======== === =========== +1.00F 26/04/90 NSM First relase +1.10F 22/10/93 SLT Second relase +*/ +#ifndef WLIB_H +#define WLIB_H + +#include +#include +#include +#include +#include +#include + +#define G_GC_MASK_GMODE 0x2 +#define G_GC_MASK_TEXTMODE 0x4 +#define G_GC_MASK_STYLE 0x8 +#define G_GC_MASK_FONT 0x10 +#define G_GC_MASK_GREY 0x20 +#define G_GC_MASK_DOUBLE 0x40 + +#define G_GC_FLAG_GREY_PLANE 0x1 +#define G_GC_FLAG_BOTH_PLANES 0x2 +#define G_GC_FLAG_DOUBLE 0x4 + +#define G_TEXT_ALIGN_RIGHT 1 +#define G_TEXT_ALIGN_LEFT 2 +#define G_TEXT_ALIGN_CENTRE 4 +#define G_FONT_FLAG_ASCII 0x01 +#define G_FONT_FLAG_CP850 0x02 +#define G_FONT_FLAG_BOLD 0x04 +#define G_FONT_FLAG_ITALIC 0x08 +#define G_FONT_FLAG_SERIF 0x10 +#define G_FONT_FLAG_MONO 0x20 +#define G_FONT_FLAG_HANG 0x40 /* Has over/under hang table */ +#define G_FONT_SPECIAL_1 0x8000 /* Font is stored in Special format 1 */ +#define G_TRMODE_SET 0 +#define G_TRMODE_CLR 1 +#define G_TRMODE_INV 2 +#define MAX_GMODE 2 /* max trmode allowed in the gmode of a gc */ +#define G_TRMODE_REPL 4 +#define MAX_BLITMODE 5 /* .. .. in a blit-type command */ +#define MAX_TEXTMODE 5 /* .. .. in the textmode of a gc */ +#define G_STY_NORMAL 0 +#define G_STY_BOLD 0x01 +#define G_STY_UNDERLINE 0x02 +#define G_STY_INVERSE 0x04 +#define G_STY_DOUBLE 0x08 +#define G_STY_MONO 0x10 +#define G_STY_ITALIC 0x20 +#define G_STY_SUBSCRIPT2 0x40 +#define G_STY_SUPERSCRIPT2 0x80 +#define G_STY_SUBSCRIPT 0x100 +#define G_STY_SUPERSCRIPT 0x200 +#define G_XP_INV_BLOCK 0x01 +#define G_XP_INV_OBLOID 0x02 +#define G_XP_UND_BLOCK 0x04 +#define G_XP_REDUCED 0x08 +#define W_BORD_CORNER_2 0x00 +#define W_BORD_CUSHION 0x01 +#define W_BORD_CORNER_4 0x02 +#define W_BORD_SHADOW_S 0x04 +#define W_BORD_SHADOW_D 0x08 +#define W_BORD_SHADOW_ON 0x10 +#define W_BORD_OPEN 0x20 +#define W_BORD_CORNER_1 0x40 +#define W_BORD_TOP_OFF 0x80 +#define W_BORD_BOT_OFF 0x100 +#define W_BORD_TOP_ON 0x200 +#define W_BORD_BOT_ON 0x400 +#define X_BORD_SHADOW_BOX 0x8000 +#define W_BORDER_TYPE_0 0 +#define W_BORDER_TYPE_1 1 +#define X_BORDER_TYPE_MAX 1 +#define G_DRAW_OBJECT_TYPE_0 0 +#define X_DRAW_OBJECT_TYPE_MAX 0 +#define G_APPEND 0x01 +#define G_DISPLAY 0x02 +#define W_CTBY_S3 0x0001 +#define X_CTBY_SCR_SIZE 0x0002 +#define W_CTBY_S3_SCR (X_CTBY_S3|X_CTBY_SCR_SIZE) +#define W_SUPPORT_GREY 0x01 +#define W_SUPPORT_CTBY_S3 0x02 +typedef struct + { + unsigned int flags; + unsigned int fillers[15]; + } W_SUPPORT_INFO; +#define WS_MAX_CLIENTS 21 /* Includes rubber band client */ +#define FONT_NAME_LEN 16 +#define FONT_MAX_HEADER_LEN 128 +typedef struct + { + unsigned short int low_ch; /* lowest code in font */ + unsigned short int high_ch; /* highest code in font */ + unsigned short int height; /* height of font */ + unsigned short int descent; /* height of bottom part of character */ + unsigned short int ascent; /* height of top part of character */ + unsigned short int numeric_width; /* Width of numeric character */ + unsigned short int max_width; /* The width of the widest character in the font */ + unsigned short int flags; + char name[FONT_NAME_LEN]; + } G_FONT_INFO; +#define WS_FONT_SYSTEM 0x4099 +#define WS_DEFAULT_ICON (WS_BITMAP_BASE+8) +typedef struct + { + unsigned short int keycode; /* Code for the key pressed */ + unsigned char modifiers; /* A bit set for each modifier key held down */ + unsigned char count; + } WMSG_KEY; +typedef struct + { + unsigned short int unused; + unsigned char modifiers; /* A bit set for each modifier key held down */ + unsigned char filler; + } WMSG_CAPS; +typedef struct + { + unsigned char event; + unsigned char state; + P_POINT pos; + } WMSG_MOUSE; +typedef struct + { + unsigned short int state; + P_EXTENT extent; + } WMSG_RUBBER; +typedef union + { + unsigned short int uword; + unsigned char *dpoint; /* Data pointer */ + P_RECT rect; + WMSG_KEY key; + WMSG_MOUSE mouse; + WMSG_RUBBER rubber; + WMSG_CAPS caps; + } WS_EVENT_UNION; +typedef struct + { + unsigned short int handle; /* Destination handle */ + unsigned short int time; + WS_EVENT_UNION u; + } WS_EVENT_X; +typedef struct + { + short int type; /* E_FILE_PENDING,or -ve error,or +ve good event type */ + WS_EVENT_X x; + } WS_EVENT; +typedef struct /* The WS_EV struct runs in parallel to the WS_EVENT struct */ + { /* but is in a simplified form without the WS_EVENT_X */ + /* sub structure */ + short int type; + unsigned short int handle; + unsigned short int time; + WS_EVENT_UNION p; + } WS_EV; +#define MAX_CLIENT_TO_WSERV_BUFFER 300 +#define MAX_WSERV_TO_CLIENT_BUFFER 300 +#define W_INFO_MSG_MAX_LEN 64 +#define W_BUSY_MSG_MAX_LEN 20 +#define W_DRAW_BUTTON_MAX_LEN 64 +#define W_ALERT_TEXT_MAX_LEN 80 +#define W_PASSWORD_ALERT_TEXT_MAX_LEN 128 +#define W_BUTTON_TYPE_1 0 +#define W_BUTTON_TYPE_2 1 +typedef struct + { + unsigned char gmode; /* transfer mode */ + unsigned char textmode; /* transfer mode for writing text */ + unsigned char style; /* style of text : bold,underline etc. */ + unsigned char flags; + unsigned short int font; /* handle of curr font in use */ + } G_GC; +typedef struct + { + P_EXTENT start; /* Current dimension */ + P_EXTENT outer; /* Outer bounding rectangle */ + P_EXTENT inner; /* Inner bounding rectangle */ + unsigned short int flags; /* TRUE if the rubber band is resizable */ + unsigned short int minx; /* Max and Min limits only used if resize is TRUE */ + unsigned short int miny; + unsigned short int maxx; + unsigned short int maxy; + P_POINT grid_snap; + } W_RUBBER_BAND; +typedef struct + { + unsigned short int flags; /* see below */ + P_EXTENT extent; /* position and size relative to parent */ + short int mouse_icon; /* handle of mouse icon */ + unsigned char background; /* Auto clear to black,white or none on redraws */ + unsigned char filler; + } W_WINDATA; +typedef struct + { + P_POINT pos; /* position within window */ + unsigned char height; + char ascent; + unsigned char width; + unsigned char flags; + } W_CURSOR; +#define W_CURSOR_OBLOID 0x01 +#define W_CURSOR_NO_FLASH 0x02 +#define W_CURSOR_GREY 0x04 +typedef struct + { + short int bitmap; + P_POINT pos; + P_RECT rect; + unsigned short int mode; + unsigned long int time; + } WS_WIN_BITMAP; +#define WS_WIN_BITMAP_GREY 0x8000 +typedef struct + { + short int bit_set; + short int bit_clr; + short int bit_inv; + short int bit_gr_set; + short int bit_gr_clr; + short int bit_gr_inv; + P_POINT offset; + unsigned short int time; + } W_SPRITE; +#define MAX_SET_SPRITE 13 +#define W_SPRITE_CLIP_CHILDREN 0x0001 +typedef struct + { + short int id; /* Window id */ + short int type; /* Clock type */ + P_POINT pos; + short int offset; /* Time offset */ + short int flags; /* Clock flags */ + short int font; + short int style; + } WS_CREATE_CLOCK; +typedef struct + { + short int FontId; + unsigned char Styles; + unsigned char FontStyles; + short int BaseOffset; + } G_FONT_CONFIG; +typedef struct + { + unsigned char BodyColour; + unsigned char ShadowColour; + unsigned char LightColour; + unsigned char filler; + unsigned short int Flags; + short int ShadowSizeX; + short int ShadowSizeY; + short int LightSizeX; + short int LightSizeY; + short int Spacing; + } G_SHADOW; +#define G_COLOUR_BLACK 0 +#define G_COLOUR_WHITE 1 +#define G_COLOUR_GREY 2 +#define G_COLOUR_NONE 3 +#define G_COLOUR_DARK_GREY 4 +#define G_COLOUR_LIGHT_GREY 5 +#define G_COLOUR_MAX 5 +#define G_SHADOW_SOLID 0x01 +#define G_SHADOW_CORNER_1 W_BORD_CORNER_1 +#define G_SHADOW_CORNER_4 W_BORD_CORNER_4 +#define WE_KEY 0x0001 +#define WE_REDRAW 0x0002 +#define WE_STATUS 0x0004 +#define WE_MOUSE 0x0008 +#define WE_OTHERS 0x0010 +#define WE_ESC 0x8000 +#define WE_NORMAL 0x0FFF +#define WSIPC_LINK_PASTE 0x0004 +#define WSIPC_LINK_SERVER 0x0003 +#define WSIPC_CLIENT_TO_SERVER 0x0100 +#define WSIPC_OS_CLIENT_DIED 0x0200 +#define WSIPC_NOTIFY 0x0300 +#define WSIPC_ALERT 0x0400 +#define WSIPC_WATCHALL 0x0500 +#define IPC_HEAD_FLAG_REPORT_ERRORS 0x0100 +#define IPC_HEAD_FLAG_READ_FLAGS 0x0200 +typedef struct + { + unsigned char *data; + unsigned char word_len; + unsigned char flags; + WS_EVENT *read; + union + { + unsigned int read_flags; /* What sort of events to read */ + unsigned char *reply; /* Optional address for reply buffers */ + }r; + }IPC_HEAD; +typedef struct + { + P_POINT pixels; /* Display size */ + unsigned short int width_1000_pixels_mm; + unsigned short int height_1000_pixels_mm; + unsigned char set_is_dark; + unsigned char version_id; + unsigned short int system_font_handle; + unsigned short int flags; + unsigned short int dummy; + } W_SERVER_INFO; +#define W_SERVER_INFO_FLAG_GREY1 0x0001 +typedef struct + { + unsigned short int client_handle; /* S_CCB table index */ + W_SERVER_INFO info; + } CONNECT_INFO; +typedef struct + { + int (*write)(struct _WSERV_SPEC *,short int *,WS_EV *,unsigned int,unsigned int); + void (*close)(struct _WSERV_SPEC *); + void (*init_transmit)(struct _WSERV_SPEC *); + void (*panic)(struct _WSERV_SPEC *,unsigned int); + } CLINK_REDIRECTOR; +typedef struct + { + /* The following symbols are only used in debug mode but have been left + in as they be useful for future expansion */ + unsigned char *log; + char *par_file; + void (*cpanic_handler)(int); + /**/ + unsigned short int usage_count; + unsigned char *p_commands; + unsigned char *p_end; /* End is not always the end of the buffer,this is because + the limit may be constrained by the receiveing end */ + union + { + struct + { + unsigned char commands[1]; + } local; + struct + { + unsigned char commands[1]; + } metafile; + unsigned char buf[MAX_CLIENT_TO_WSERV_BUFFER]; + } msg; + } WSERV_CLIENT_DATA; +typedef struct _WSERV_SPEC /* WSERV_SPEC */ + { + unsigned short int handle_check; + CONNECT_INFO conn; + char error; + unsigned char leaves_disabled; + unsigned short int cpanic; + CLINK_REDIRECTOR redirector; /* magic cookie - switches between :- */ + /* 1) IPC to WSERV,*/ + /* 2) metafile code,*/ + /* 3) and p_io() */ + union /* link :- link specific parts */ + { + struct /* local link */ + { + unsigned short int wserv_pid; + IPC_HEAD ipc_head; + } local; + struct /* metafile recording */ + { + unsigned char *io_channel; /* p_io() - to link-layer-like device */ + struct _WSERV_SPEC * display; /* if display while recording: */ + /* else NULL */ + unsigned char *transmit_start; + } metafile; + } link; + unsigned short int os_ds; /* Operating system DS */ + } WSERV_SPEC; +typedef struct + { + P_POINT size; + char seg_name[14]; + } W_OPEN_BIT_SEG; +typedef struct + { + UWORD checksum; + P_POINT size; + UWORD byte_size; + ULONG offset; + }WS_PIC_HEADER; +typedef struct + { + P_FSIG sig; + UWORD count; + WS_PIC_HEADER wspic; + } PIC_HEAD; +/* Flags used in field set and the flag field in the window structure */ +#define W_WIN_INPUT_ONLY 0x01 +#define W_WIN_RUBBER_BAND_CAPTURE 0x02 +#define W_WIN_INACTIVE 0x04 +#define W_WIN_MOUSE_MOVE 0x08 +#define W_WIN_MOUSE_DRAG 0x10 +#define W_WIN_MOUSE_GRAB 0x20 +#define W_WIN_DOUBLE_PIXEL 0x40 +#define W_WIN_FOREGROUND_ONLY 0x80 +#define W_WIN_PRIORITY 0x100 +#define W_WIN_NO_REDRAW 0x200 +#define W_WIN_NO_MOUSE 0x400 +#define W_WIN_RUBBER_BAND_COMPLETE_ON_RELEASE 0x800 +#define W_WIN_ALL_FLAGS 0xfff +/* Flags used in field set only */ +#define W_WIN_EXTENT 0x1000 +#define W_WIN_MOUSE_ICON 0x2000 +#define W_WIN_BACKGROUND 0x4000 +#define W_STATUS_HIDDEN 0x8000 /* Used internally to mark window as hidden */ +/* Status flags */ +#define W_UNINITIALISED 0x80 +#define W_REDRAW 0x40 +#define W_BACKGROUND 0x20 /* Window is invisible because it is background */ +#define W_SET_INVISIBLE 0x10 /* Window is set to invisible by client */ +#define W_XXXXXXX 0x08 +#define W_INVALID 0x04 /* The whole window contents is invalid */ + +#define X_WIN_BACK_NO_REDRAW 0x08 /* Private */ +#define X_WIN_BACK_GREY_REDRAW 0x80 /* Private */ +#define W_WIN_BACK_NONE 0x00 +#define W_WIN_BACK_CLR 0x01 +#define W_WIN_BACK_SET 0x02 +#define W_WIN_BACK_BITMAP 0x03 +#define W_WIN_BACK_NONE_NO_REDRAW (00+X_WIN_BACK_NO_REDRAW) +#define W_WIN_BACK_CLR_NO_REDRAW (01+X_WIN_BACK_NO_REDRAW) +#define W_WIN_BACK_SET_NO_REDRAW (02+X_WIN_BACK_NO_REDRAW) +#define W_WIN_BACK_GREY_CLR (00+X_WIN_BACK_GREY_REDRAW) +#define W_WIN_BACK_GREY_NONE (16+X_WIN_BACK_GREY_REDRAW) +#define W_WIN_BACK_GREY_SET (32+X_WIN_BACK_GREY_REDRAW) +#define W_WIN_BACK_GREY_BITMAP (48+X_WIN_BACK_GREY_REDRAW) +#define W_WIN_BACK_GREY_CLR_NO_REDRAW 0x00 +#define W_WIN_BACK_GREY_NONE_NO_REDRAW 0x10 +#define W_WIN_BACK_GREY_SET_NO_REDRAW 0x20 +#define W_VER_DOUBLE_BITS 0x0001 +#define X_CORNER_BOTTOM 0x40 +#define X_CORNER_RIGHT 0x80 +#define W_CORNER_TOP_LEFT 0x00 +#define W_CORNER_TOP_RIGHT X_CORNER_RIGHT +#define W_CORNER_BOTTOM_LEFT X_CORNER_BOTTOM +#define W_CORNER_BOTTOM_RIGHT (X_CORNER_RIGHT+X_CORNER_BOTTOM) +#define WSERV_FLAG_NO_SHELL_REBOOT 0x0001 +#define WSERV_FLAG_NO_NOTIFIER_REBOOT 0x0002 +#define WSERV_FLAG_NO_PANIC_NOTIFYS 0x0004 +#define WSERV_FLAG_HOOK_NOTIFIER 0x0008 +#define WSERV_FLAG_UPDATE_MSGS 0x0010 +#define WSERV_FLAG_LOW_BATTERY_WARNINGS 0x0020 +#define WSERV_FLAG_HUNG_UP_SW 0x0040 +#define WSERV_FLAG_SW_NO_LOW_BATTERY 0x0080 +#define WSERV_FLAG_SW_NO_PACKS 0x0100 +#define WSERV_FLAG_SW_NO_LINK 0x0200 +#define WSERV_FLAG_SW_NO_CAPS 0x0400 +#define WSERV_FLAG_TOP_BIT 0x8000 /* Can not be set */ +#define W_CONNECT_AT_BACK 0x01 +#define W_CONNECT_CONNECTED 0x01 /* Only used in replys to wClientInfo() */ +#define W_CONNECT_USER_FLAG 0x02 +#define W_CONNECT_SYSTEM_MODAL 0x04 +#define W_CONNECT_PRIORITY 0x40 +#define W_CONNECT_DISABLE_LEAVES 0x80 +#define WS_TEMPORARY_GC 1 +#define WS_BIT_WRITE 0x01 +#define WS_BIT_SEG 0x02 +#define WS_BIT_SEG_NAME 0x04 +#define WS_BIT_SEG_ACCESS (WS_BIT_SEG|WS_BIT_SEG_NAME) +#define WS_BIT_SEG_ZERO_SIZE 0x08 +#define WS_BIT_MASK (WS_BIT_WRITE+WS_BIT_SEG+WS_BIT_SEG_NAME+WS_BIT_SEG_ZERO_SIZE) +#define WS_BIT_ROM 0x80 +#define WS_BIT_FILE 0x100 +#define WX_BIT_GREY 0x8000 /* secret do not use */ +#define WS_CLOCK_SMALL_DIGITAL 0x00 +#define WS_CLOCK_MEDIUM 0x01 +#define WS_CLOCK_LARGE_ANALOG 0x02 +#define WS_CLOCK_MEDIUM2 0x03 +#define WS_CLOCK_XL_ANALOG 0x04 +#define WS_CLOCK_FORMATTED 0x05 +#define WS_CLOCK_MAX 0x06 +#define WS_CLOCK_VINE 0x06 +#define WS_CLOCK_MAX_VINE 0x07 /* Last clock type on vine plus 1 */ +#define WS_CLOCK_MEDIUM3 0x06 +#define WS_CLOCK_XL2_ANALOG 0x07 +#define WS_CLOCK_MAX_OAK 0x08 /* Last clock type on oak plus 1 */ +#define CLOCK_FLAG_COLON_OFFSET 0x04 +#define CLOCK_FLAG_DIGITAL 0x08 +#define CLOCK_FLAG_WSRV 0x04 +#define CLOCK_FLAG_XXXX 0x08 +#define WS_CLOCK_WITH_DATE 0x10 +#define WS_CLOCK_WITH_SECONDS 0x20 +#define WS_CLOCK_FORCE_ANALOG 0x40 +#define WS_CLOCK_FORCE_DIGITAL 0x80 +#define WS_CLOCK_AM_PM 0x100 +#define WS_CLOCK_AM_PM_BUT_NOT_IN_MEDIUM_ANALOG 0x400 +#define WS_CLOCK_CENTRED 0x200 +#define WS_CLOCK_WITH_DATE_EXTRA 0x400 +#define WS_CLOCK_GREY 0x800 +#define WS_CLOCK_DBL_PLANE 0x1000 +#define WS_CLOCK_RIGHT_ALIGN 0x2000 +#define WS_CLOCK_SUMMER_TIME 0x4000 +#define WS_CLOCK_BOX 0x8000 +#define OLD_CLOCK_FLAGS 0xFFF0 +#define WS_BITMAP_CLOCK_SIZE_X 36 +#define WS_BITMAP_CLOCK_SIZE_Y 32 +#define WS_BITMAP_LARGE_CLOCK_SIZE_X 66 +#define WS_BITMAP_LARGE_CLOCK_SIZE_Y 60 +#define WS_BITMAP_XL_CLOCK_SIZE_X 99 +#define WS_BITMAP_XL_CLOCK_SIZE_Y 99 +#define WS_BITMAP_MEDIUM2_CLOCK_SIZE_X 58 +#define WS_BITMAP_MEDIUM2_CLOCK_SIZE_Y 51 +#define WS_LEFT_POS_CONS 189 +#define WS_LEFT_POS_CORP 109 +#define WS_TOP_POS 0 +#define WS_WIDTH 51 +#define WS_HEIGHT 80 +#define WS_WIDTH_V4 64 +#define WS_WIDTH_SMALL_V4 32 +#define WS_WIDTH_V4C 51 +#define WS_WIDTH_SMALL_V4C 32 +#define WS_WIDTH_VINE 36 /* Same number as small but different width on vine */ +/* Basic WSERV-to-client message types +*/ +#define WM_KEY 1 +#define WM_MOUSE 2 +#define WM_REDRAW 3 +#define WM_BACKGROUND 5 +#define WM_FOREGROUND 6 +#define WM_RUBBER 7 +#define WM_USER_MSG 8 +#define WM_ACTIVE 9 +#define WM_CANCELLED 11 +#define WM_KEYBOARD_STATE_CHANGE 12 +#define WM_RUBBER_BAND_INIT 13 +#define WM_DEICONISE 14 +#define WM_ATTACHED 15 +#define WM_DETACHED 16 +#define WM_COMMAND 17 +#define WM_TASK_KEY 18 +#define WM_TASK_UPDATE 19 +#define WM_ON 20 +#define WM_ESCAPE 21 +#define WM_DATE_CHANGED 22 +#define WM_MAX_WSERV 23 +#define WM_NULL_EVENT 24 +#define WS_BITMAP_GREY 0x4000 +#define WS_BITMAP_GREY_SIZE_X 192 +#define WS_BITMAP_GREY_SIZE_Y 16 +#define WS_BITMAP_BASE 0x4001 +#define WS_FONT_BASE 0x4000 +#define WS_FONT_BASE2 0x6000 +#define WS_MI_BASE 0x4002 +#define WS_LAST_CLIENT_POSITION 100 +/* system mouse icon handles */ +#define W_WIN_MI_STANDARD 0x4000 /* index 0 + Base 0x4000 */ +#define W_WIN_MI_NULL 0x4001 /* index 1 + Base 0x4000 */ +#define WM_MOUSE_RELEASE 1 +#define WM_MOUSE_PRESS 2 +#define WM_MOUSE_MOVE 3 +#define P_MAX_COORD 0x7fff +#define WS_MAX_PRINT_TEXT_LEN 246 +#define WS_MAX_PRINT_CLIP_TEXT_LEN 244 +#define WS_MAX_PRINT_BOX_TEXT_LEN 236 +#define WS_MAX_XPRINT_TEXT_LEN 244 +#define WS_MAX_SHADOW_TEXT_LEN 234 +#define WS_MAX_FORMATTED_CLOCK 238 +#define W_MAX_FONT_CONFIG 24 +#define WM_BAND_NOMOVE 0 +#define WM_BAND_MOVE 1 +#define WM_BAND_RESIZE 2 +#define WM_BAND_CANCEL 3 +#define WM_BAND_ERROR 4 +#define W_BAND_RESIZE 0x01 +#define W_BAND_INNER 0x02 +#define W_BAND_OUTER 0x04 +#define W_BAND_START 0x08 +#define W_BAND_COMPLETE_ON_UP 0x10 +#define W_BAND_KILL_CAPTURE 0x20 +#define W_BAND_GRID_SNAP_SIZE 0x40 +#define W_XXXX_GRID_SNAP_POS 0x80 /* Secret internal #define */ +#define W_BAND_GRID_SNAP (W_XXXX_GRID_SNAP_POS|W_BAND_GRID_SNAP_SIZE) +#define WS_TYPE_MASK 0xF0 +#define WS_VERSION_MASK 0x0F +#define WS_TYPE_MC 0x00 +#define WS_TYPE_S3 0x10 +#define WS_TYPE_HC 0x20 +#define WS_TYPE_MCA 0x30 +#define WS_TYPE_S3A 0x40 +#define WS_TYPE_HCA 0x50 +#define WS_TYPE_S3C 0x60 +#define WS_TYPE_VINE 0x70 +#define WS_VERSION_2 0x00 +#define WS_VERSION_3 0x01 +#define WS_VERSION_3_5 0x02 +#define WS_VERSION_4 0x02 +/* The alert type is made of a base value one of ...*/ +#define WS_ALERT_CLIENT 0x00 +#define WS_ALERT_TIMED 0x01 +#define WS_ALERT_CANCEL 0x08 +/* ...with one or none of the following flags or'ed in */ +#define WS_ALERT_PERMANENT 0x02 +#define WS_ALERT_UPDATE 0x04 /* Wserv internal use only */ +#define WS_ALERT_B 0x10 +#define WS_UPDATE_NAME 0x01 +#define WS_UPDATE_CLOCK 0x02 +#define WSERV_PANIC_FIRST 81 +#define WSERV_PANIC_LAST 116 +#define W_STATUS_WINDOW_OFF 0 +#define W_STATUS_WINDOW_SMALL 1 +#define W_STATUS_WINDOW_BIG 2 +#define W_STATUS_WINDOW_CTBY 3 +#define W_STATUS_WINDOW_MAX W_STATUS_WINDOW_CTBY +#define W_STATUS_WIN_NO_DIAMOND -1 +#define W_STATUS_WINDOW_ICON -1 +typedef struct + { + unsigned char hposition; + unsigned char length; + unsigned short int offset; + } DESC; +typedef struct + { + unsigned char zero; + unsigned char filler; + DESC desc[3]; + } WS_ALERT_DESC; +#define G_OPEN_MODE_NORMAL 0 +#define G_OPEN_MODE_OFFSET 1 +#define G_OPEN_MODE_LONG_PTR_OFFSET 2 +#define G_OPEN_MODE_WORD_PTR_OFFSET 3 +#define MAX_G_OPEN_MODE 3 +#define W_SYSTEM_FONT_S3B 0 +#define W_SYSTEM_FONT_S3 1 +#define W_SYSTEM_FONT_INTERNAL_S3B 2 +#define W_SYSTEM_FONT_INTERNAL_S3 3 +#ifdef __cplusplus +extern "C" { +#endif +#pragma save +extern void cdecl wsAlertA(int,short int *,const char *,const char *,...); +extern int cdecl wsAlertUpdate(const char *,const char *,...); +extern int cdecl wsAlertW(int,const char *,const char *,...); +extern int cdecl wAllDump(char *,unsigned int); +#pragma call(reg_param =>(bx,cx,dx,si),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int gOpenBit(const char *,unsigned int,unsigned int,void *); +extern int gGetBit(unsigned int,unsigned int,unsigned int,void *); +extern int gPeekBit(unsigned int,const P_POINT *,unsigned int,void *); +#pragma call(reg_param =>(bx,cx,si),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int gReadFontHeader(const char *name,int index,unsigned char *buf); +extern int wInquireWindowOffset(unsigned int,unsigned int,P_POINT *); +extern int gQueryBit(int,int,P_POINT *); +#pragma call(reg_param =>(bx,si),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int gReadFontGroupHeader(const char *name,unsigned char *buf); +extern int wInquireWindow(unsigned int,W_WINDATA *); +extern int wInquireStatusWindow(int state,P_EXTENT *ext); +extern void wCompatibilityMode(unsigned int flags,WSERV_SPEC *wSpec); +extern int gInitBit(const char *,int *); +extern void gInquireChecksum(int id,unsigned short int *checksum); +#pragma call(reg_param =>(bx,si,ax,cx,dx,di),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern void gPrintBoxText(const P_RECT *,unsigned int,unsigned int,unsigned int,const char *,unsigned int); +#pragma call(reg_param =>(dx),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int gPlayBack(void *); +extern unsigned int wDisableLeaves(unsigned int); +extern void wGetEventWait(WS_EV *); +extern void wGetEventUpdate(unsigned int); +extern void wPanic(unsigned int); +extern void wSelect(WSERV_SPEC *); +extern int gCheckBitmapID(unsigned int); +#pragma call(reg_param =>(dx,cx,di),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int gFontInfo(unsigned int,unsigned int,G_FONT_INFO *); +extern void wGetEventSpecial(WS_EV *,unsigned int); +#pragma call(reg_param =>(dx,si,di,cx,ax),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int gTextWidth(unsigned int,unsigned int,const char *,unsigned int); +extern int gTextCount(unsigned int,unsigned int,const char *,unsigned int,unsigned int *); +extern int gGetWidthTable(unsigned int,unsigned int,unsigned char *); +#pragma call(reg_param =>(di,cx,dx),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern void gRecordToMetaFile(WSERV_SPEC *,void *,unsigned int); +#pragma call(reg_param =>(bx,cx,dx,di,si),reg_saved =>(bx,cx,si,di,EPOC_SAVE)) +extern void wBeginRedrawGC0(unsigned int,const P_RECT *); +#pragma call(reg_param =>(bx,cx,dx,di,si),reg_saved =>(bx,dx,si,di,EPOC_SAVE)) +extern int gCreateGC0(unsigned int); +extern void gCreateTempGC0(unsigned int); +extern void gSetGC0(unsigned int); +extern void wBeginRedrawWinGC0(unsigned int); +#pragma call(reg_param =>(si),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern int wGetCommand(unsigned char *); +extern void wGetProcessList(unsigned short int *); +extern void wSupportInfo(W_SUPPORT_INFO *); +#pragma call(reg_param =>(bx,cx,dx,di,si),reg_saved =>(cx,dx,si,di,EPOC_SAVE)) +extern int wCancelBusyMsg(void); +#pragma call(reg_param =>(bx,cx,dx,di,si),reg_saved =>(si,di,EPOC_SAVE)) +extern void wStartup(void); +#pragma call(reg_param =>(bx,cx,dx,di,si),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern void wsScreenExt(P_EXTENT *); +extern void gClrRect(const P_RECT *,unsigned short int); +extern int gCloseMetaFile(void); +extern void gCopyBit(const P_POINT *,unsigned int,const P_RECT *,unsigned int); +extern int gDrawBit(const P_POINT *,int,const P_RECT *,int,int); +extern void gCopyRect(const P_RECT *,const P_POINT *,int); +extern int gCreateGC(unsigned int,unsigned int,G_GC *); +extern void gCreateTempGC(unsigned int,unsigned int,G_GC *); +extern void gDrawLine(int,int,int,int); +extern void gDrawPolyLine(int,int,short int *); +extern void gFreeTempGC(void); +extern void gInvObloid(P_EXTENT *); +extern int gOpenFont(const char *); +extern int gOpenFontIndex(const char *,unsigned int); +extern int gOpenMouseIcon(const char *,unsigned int); +extern unsigned int gPrintClipText(int,int,const char *,int,int); +extern void gPrintText(int,int,const char *,int); +extern int gCreateBit(unsigned int,void *); +extern int gSaveBit(const char *,unsigned int); +extern int gSaveRect(const char *,unsigned int,const P_RECT *); +extern int gInitMultiSave(const char *,int); +extern int gSaveMultiBit(int,int); +extern int gSaveMultiRect(int,int,const P_RECT *); +extern int gEndMultiSave(int); +extern void gSetGC(unsigned int,unsigned int,G_GC *); +extern void gXPrintText(int,int,const char *,unsigned int,unsigned int); +extern int wAttachToClient(unsigned int); +extern void wAttachToForegroundClient(void); +extern void wBeginRedraw(unsigned int,const P_RECT *); +extern void wBeginRedrawGC(unsigned int,const P_RECT *,unsigned int,G_GC *); +extern void wBeginRedrawWin(unsigned int); +extern void wBeginRedrawWinGC(unsigned int,unsigned int,G_GC *); +extern void wCallDYL(unsigned int,unsigned int,unsigned int,void *); +extern int wCallDYLReply(unsigned int,unsigned int,unsigned int,void *,void *); +extern int wCancelCaptureKey(unsigned int,unsigned int,unsigned int); +extern void wCancelGetEvent(void); +extern void wCancelSystemModal(unsigned int); +extern int wCaptureKey(unsigned int,unsigned int,unsigned int); +extern int wSetTaskKey(unsigned int,unsigned int,unsigned int); +extern int wSetBackTaskKey(unsigned int,unsigned int,unsigned int); +extern int wCancelTaskKey(unsigned int,unsigned int,unsigned int); +extern int wCancelBackTaskKey(unsigned int,unsigned int,unsigned int); +extern void wCaptureMouse(unsigned int); +extern void wChangeWinBitmap(unsigned int,unsigned int,WS_WIN_BITMAP *); +extern void wClientIconised(unsigned int); +extern unsigned int wClientInfo(unsigned int); +extern void wClientPosition(unsigned int,unsigned int); +extern void wCloseDown(void); +extern int wCreateWindow(unsigned int,unsigned int,W_WINDATA *,unsigned short int); +extern void wDetachClient(void); +extern void wDisablePauseKey(void); +extern void wAppKeyHandler(void); +extern void wDrawTextCursor(unsigned int,W_CURSOR *); +extern void wTextCursor(unsigned int,W_CURSOR *); +extern void wEnablePauseKey(void); +extern void wEndCompute(void); +extern void wEraseTextCursor(void); +extern void wEscapeOff(void); +extern void wEscapeOn(void); +extern void wFree(unsigned int); +extern unsigned int wGetWindowPosition(unsigned int); +extern void wInvalidateRect(unsigned int,const P_RECT *); +extern int wSetWinBitmap(unsigned int,unsigned int,WS_WIN_BITMAP *); +extern int wSetPriorityControl(unsigned int flag); +extern int gConfigureFonts(int count,G_FONT_CONFIG *cfg); +extern int wSetSystemFont(int type,int font,unsigned int style); +extern int wCreateSprite(int winId,const P_POINT *pos,int flags,int count,W_SPRITE *sprite); +extern int wSetSprite(int id,const P_POINT *pos,int index,W_SPRITE *); +extern int wsSetList(int count,char **list,int pos); +extern void wsSelectList(int move); +extern void gShadowText(int,int,G_SHADOW *,const char *,int); +extern void gDrawObject(int type,const P_RECT *,int flags); +extern void gBorder2Rect(int type,const P_RECT *,int flags); +extern void gBorder2(int type,int flags); +extern int gCreateFontHeader(G_FONT_INFO *info,char *SegName); +extern void wInformInactivity(void); +extern void wDisableKeyClick(int); +extern int wLoadDYL(const char *); +extern void wReassignRootWindow(unsigned int); +extern void wReleaseMouse(void); +extern void wRubberBand(unsigned int,unsigned int,W_RUBBER_BAND *); +extern void wScrollRect(unsigned int,const P_RECT *,const P_POINT *); +extern void wScrollWin(unsigned int,const P_POINT *); +extern int wsCreateClock(unsigned int,unsigned int,int,int,int); +extern int wsCreateClock2(WS_CREATE_CLOCK *,char *); +extern void wsDisable(void); +extern void wsDisableTemp(void); +extern void wsEnable(void); +extern void wsEnableTemp(void); +extern void wStatusWindow(int); +extern void wsSetClock(unsigned int,int); +extern void wSetWindow(unsigned int,unsigned int,W_WINDATA *); +extern int wSetBusyMsg(const char *,unsigned int); +extern void wStartCompute(void); +extern void wsUpdate(unsigned int); +extern void wInformOn(void); +extern void wInformOnAll(unsigned int); +extern int wSystem(unsigned int,unsigned int); +extern void wSystemModal(unsigned int); +extern void wUserMsg(void); +extern void wValidateRect(unsigned int,const P_RECT *); +extern int wInfoMsg(const char *); +extern int wInfoMsgCorner(const char *,unsigned int); +extern void gSetOpenAddress(unsigned int,unsigned long int); +extern void wDrawButton(const P_RECT *,const char *,unsigned int); +extern void wDrawButton2(int,const P_RECT *,const char *,unsigned int); +extern unsigned int wInquireCompatibility(void); +extern int wSendCommand(unsigned short int,unsigned char *,unsigned short int); +#pragma call(reg_param =>(si,di,cx),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern void wConnect(WSERV_SPEC *,unsigned int,unsigned int); +#pragma call(reg_param =>(dx),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern void wGetEvent(WS_EV *); +#pragma call(reg_param =>(bx,cx,dx,di,si),reg_saved =>(bx,cx,dx,si,di,EPOC_SAVE)) +extern void gBorder(unsigned int); +extern void gBorderRect(const P_RECT *,unsigned int); +extern void gDrawBox(const P_RECT *); +extern void gFillPattern(const P_RECT *,unsigned int,unsigned int); +extern void wsAlertCancel(void); +extern int wCheckPoint(void); +extern void wCleanUp(void); +extern void wCloseWindowTree(unsigned int); +extern void wDisconnect(void); +extern void wEndRedraw(void); +extern void wFlush(void); +extern void wInitialiseWindowTree(unsigned int); +extern void wInvalidateWin(unsigned int); +extern void wMakeInvisible(unsigned int); +extern void wMakeVisible(unsigned int); +extern void wValidateWin(unsigned int); +extern void wWindowPosition(unsigned int,unsigned int); +#pragma restore +#ifdef __cplusplus +} +#endif + +#endif // WLIB_H \ No newline at end of file diff --git a/code/SIBOSDK/include/wr_io.h b/code/SIBOSDK/include/wr_io.h new file mode 100644 index 0000000..0d67eaa --- /dev/null +++ b/code/SIBOSDK/include/wr_io.h @@ -0,0 +1,142 @@ +/* HEADER - WR_IO.H +World structures and constants. +Copyright (c) Psion PLC 1991. + + VER DATE BY DESCRIPTION +----- -------- ---- ----------- +1.00F NSM Final release +2.00A 1/6/93 MHS S3B release +*/ +#ifndef WR_IO_H +#define WR_IO_H + +#include +#include +#include + +#define WR_FIND_CITY 10 +#define WR_FIND_COUNTRY 11 +#define WR_FIND_EXACT 12 +#define WR_NEXT 13 +#define WR_BACK 14 +#define WR_GET_HOME 15 +#define WR_SET_HOME 16 +#define WR_GET_DEFAULT_COUNTRY 17 +#define WR_SET_DEFAULT_COUNTRY 18 +#define WR_GET_DIAL_STRING 19 +#define WR_EXTRA 20 +#define WR_SET_EXTRA 21 +#define WR_GET_CITY_DATA 22 +#define WR_GET_COUNTRY_DATA 23 +#define WR_CALC 24 +#define WR_NEXT_LOCK 25 +#define WR_GET_DIAL_STRING_B 26 + +#define WR_MAX_NAME 20 +#define WR_MAX_DIAL 16 +#define WR_MAX_CODE 8 +#define WR_MAX_INTRA 4 +#define WR_MAX_INTER 4 +#define WR_MAX_DIAL_STRING 24 +/* new (S3B) max length of output string 40 - E_MAX_DTMF_DIAL_B */ +#define WR_MAX_DIAL_STRING_B 40 +#define WR_MAX_IN_STRING 64 + +#define WR_UNITS_MILES 0 +#define WR_UNITS_KILOMETERS 1 +#define WR_UNITS_NAUTICAL 2 + +#define WR_START_STATE 1 +#define WR_END_STATE 0 + +#define WR_HOME_DONE 0 +#define WR_HOME_SET 1 +#define WR_HOME_DOING 2 + +#define WR_NOT_FOUND E_GEN_FAIL +#define WR_FOUND 0 + +#define WR_EXTRA_ADD_CITY 0 +#define WR_EXTRA_UPDATE_CITY 1 +#define WR_EXTRA_DELETE_CITY 2 +#define WR_EXTRA_UPDATE_COUNTRY 3 +#define WR_EXTRA_ADD_HOME 4 + +#define WR_DELETED 0 +#define WR_REVERTED 1 + +#define WR_TOO_MANY_ERR -23 +#define WR_NOTVALID_ERR -25 +#define WR_DELHOME_ERR -26 +#define WR_DELCAPITAL_ERR -27 +#define WR_DUPLICATE_ERR -28 + +typedef struct /* Lat long */ + { + WORD iLat; + WORD iLong; + } LATL; + +typedef struct + { + TEXT city[WR_MAX_NAME+1]; + TEXT country[WR_MAX_NAME+1]; + } WR_FIND_RES; + +typedef struct + { + WR_FIND_RES f; + UBYTE units; /* Also baseGMT */ + UBYTE DST; + WORD GMT; + LATL latl; + TEXT dial[WR_MAX_DIAL+1]; + TEXT STD[WR_MAX_CODE+1]; + P_POINT pos; + } WR_CITY_DATA; + +typedef struct + { + TEXT dialIntra[WR_MAX_INTRA+1]; + TEXT dialInter[WR_MAX_INTER+1]; + TEXT dial[WR_MAX_CODE+1]; + UBYTE dummy; + } CO_DIAL; + +typedef struct + { + WR_FIND_RES f; + BYTE baseGMT; + UBYTE DST; + WORD GMT; + CO_DIAL dial; + } WR_COUNTRY_DATA; + +typedef union + { + WR_CITY_DATA ci; + WR_COUNTRY_DATA co; + } WR_EXTRA_DATA; + +typedef struct + { + WORD distance; + WORD sunRise; + WORD sunSet; + WORD always; + } WR_CALC_OUT; + +typedef union + { + WR_CITY_DATA in; + WR_CALC_OUT out; + } WR_CALC_DATA; + +typedef struct + { + UWORD time; + UWORD date; + UWORD amPm; + } TIMEDATE; + +#endif // WR_IO_H \ No newline at end of file diff --git a/code/SIBOSDK/include/wsdyl.h b/code/SIBOSDK/include/wsdyl.h new file mode 100644 index 0000000..324d54b --- /dev/null +++ b/code/SIBOSDK/include/wsdyl.h @@ -0,0 +1,41 @@ +/* HEADER - WSDYL.H +Copyright (C) Psion PLC 1991 + VER DATE BY DESCRIPTION +===== ======== === =========== +1.00F 26/04/90 NSM First relase +*/ +#ifndef WSDYL_H +#define WSDYL_H + +#include +#include +#include + +typedef struct +{ +P_OBJECT obj; +P_RECT total; +P_RECT clip; +P_RECT workrect; +/* +The following three elements are grouped together to match the layout of +the unpublished BM_DATA structure. +*/ +unsigned short int seg; +unsigned char *addr; +unsigned short int bytewid; +unsigned short int trmode; +short int x_offset; +short int y_offset; +unsigned char *work_space; +unsigned char *user_handle; +P_POINT *alt_offset; +unsigned short int bitmap_segment; +P_POINT size; +unsigned char *bitmap_addr; +unsigned int osdataseg; +unsigned char *reply_addr; +unsigned int reply_len; +} DYL_CALL; + +#endif // WSDYL_H diff --git a/code/SIBOSDK/include/wskeys.h b/code/SIBOSDK/include/wskeys.h new file mode 100644 index 0000000..229693f --- /dev/null +++ b/code/SIBOSDK/include/wskeys.h @@ -0,0 +1,80 @@ +/* HEADER - WSKEYS.H +Copyright (C) Psion PLC 1991 + VER DATE BY DESCRIPTION +===== ======== === =========== +1.00F 26/04/90 NSM First relase +*/ +#ifndef WSKEYS_H +#define WSKEYS_H + +#define W_SHIFT_MODIFIER 0x02 +#define W_CTRL_MODIFIER 0x04 +#define W_PSION_MODIFIER 0x08 +#define W_CAPS_MODIFIER 0x10 +#define W_NUM_LOCK_MODIFIER 0x20 +#define W_MOUSE_OUTSIDE 0x40 +#define W_MOUSE_DOWN 0x80 +#define W_FUNC_MODIFIER 0x80 /* Doubles up as mouse or func */ +#define W_RUSSIAN_MODIFIER 0x1000 + +#define W_KEY_REPEATED 0x800 +#define W_SPECIAL_KEY 0x0200 + +#define W_KEY_DELETE_LEFT 8 +#define W_KEY_TAB 9 +#define W_KEY_RETURN 13 +#define W_KEY_ESCAPE 27 +#define W_KEY_DELETE_RIGHT 127 + +#define W_KEY_UP 0x0100 +#define W_KEY_DOWN 0x0101 +#define W_KEY_RIGHT 0x0102 +#define W_KEY_LEFT 0x0103 +#define W_KEY_PAGE_UP 0x0104 +#define W_KEY_PAGE_DOWN 0x0105 +#define W_KEY_HOME 0x0106 +#define W_KEY_END 0x0107 +#define W_KEY_TASK 0x0108 +#define W_KEY_VOICE 0x0109 + +#define W_KEY_CAPS_LOCK 0x010c + +#define W_KEY_BACKLIGHT 0x120 +#define W_KEY_INFO 0x121 +#define W_KEY_MENU 0x122 +#define W_KEY_HELP 0x123 +#define W_KEY_DIAMOND 0x124 + +#define W_KEY_MODE 0x0130 +#define W_KEY_APP1 0x0131 +#define W_KEY_APP2 0x0132 +#define W_KEY_APP3 0x0133 +#define W_KEY_APP4 0x0134 +#define W_KEY_APP5 0x0135 +#define W_KEY_APP6 0x0136 +#define W_KEY_APP7 0x0137 +#define W_KEY_APP8 0x0138 +#define W_KEY_APP9 0x0139 + +#define W_KEY_IR_BRING 0x0140 +#define W_KEY_IR_SEND 0x0141 +#define W_KEY_IR_LINK 0x0142 + +#define W_KEY_CALC_CLEAR 0x001b +#define W_KEY_CALC_MEM_CLEAR 0x0150 +#define W_KEY_CALC_MEM_RECALL 0x0151 +#define W_KEY_CALC_MEM_MINUS 0x0152 +#define W_KEY_CALC_MEM_PLUS 0x0153 +#define W_KEY_CALC_CHNG_SIGN 0x0154 +#define W_KEY_CALC_PERCENT 0x0155 +#define W_KEY_CALC_DECIMAL 0x0156 +#define W_KEY_CALC_MEM_INPUT 0x0158 + +#define W_KEY_LCD 0x2000 +#define W_KEY_LCD_MINUS 0x2001 +#define W_KEY_ON 0x2002 +#define W_KEY_OFF 0x2003 + +#define PERMITTED_MODS (W_SHIFT_MODIFIER+W_CTRL_MODIFIER+W_PSION_MODIFIER+W_MOUSE_DOWN+W_CAPS_MODIFIER+W_NUM_LOCK_MODIFIER) + +#endif // WSKEYS_H diff --git a/code/SIBOSDK/include/xactive.g b/code/SIBOSDK/include/xactive.g new file mode 100644 index 0000000..7bb3038 --- /dev/null +++ b/code/SIBOSDK/include/xactive.g @@ -0,0 +1,31 @@ +/* Generated by Ctran from xactive.cl */ +#define XACTIVE_G +#ifndef APPMAN_G +#include +#endif +/* Class Numbers */ +#define C_LOGONA 7 +#define C_UNLOAD 8 +/* Method Numbers */ +/* Property of logona */ +typedef struct { +unsigned short int pid; +void *owner; +unsigned short int mess; +} PRS_LOGONA; +typedef struct pr_logona +{ +PRS_ROOT root; +PRS_ACTIVE active; +PRS_LOGONA logona; +} PR_LOGONA; +/* Property of unload */ +typedef struct { +int cathand; +} PRS_UNLOAD; +typedef struct pr_unload +{ +PRS_ROOT root; +PRS_ACTIVE active; +PRS_UNLOAD unload; +} PR_UNLOAD; diff --git a/code/SIBOSDK/include/xactive.ing b/code/SIBOSDK/include/xactive.ing new file mode 100644 index 0000000..cd99ed8 --- /dev/null +++ b/code/SIBOSDK/include/xactive.ing @@ -0,0 +1,29 @@ +; Generated by Ctran from xactive.cl +XACTIVE_ING equ 1 +IFNDEF APPMAN_ING + INCLUDE ..\inc\APPMAN.ING +ENDIF +; Class Numbers +C_LOGONA equ 7 +C_UNLOAD equ 8 +; Method Numbers +; Property of logona +PRS_LOGONA struc +LogonaPid dw ? +LogonaOwner dw ? +LogonaMess dw ? +PRS_LOGONA ends +PR_LOGONA struc +LogonaRoot PRS_ROOT <> +LogonaActive PRS_ACTIVE <> +LogonaLogona PRS_LOGONA <> +PR_LOGONA ends +; Property of unload +PRS_UNLOAD struc +UnloadCathand dw ? +PRS_UNLOAD ends +PR_UNLOAD struc +UnloadRoot PRS_ROOT <> +UnloadActive PRS_ACTIVE <> +UnloadUnload PRS_UNLOAD <> +PR_UNLOAD ends diff --git a/code/SIBOSDK/include/xadd.ext b/code/SIBOSDK/include/xadd.ext new file mode 100644 index 0000000..bed1770 --- /dev/null +++ b/code/SIBOSDK/include/xadd.ext @@ -0,0 +1,138 @@ +Generated by Ctran from xadd.cat +LIBRARY xadd +CLASS prvinfo win +{ +HAS_METHOD +HAS_PROPERTY +} +CLASS prvview dlgchain +{ +DECLARE pvv_done +DECLARE pvv_pages_done +DECLARE pvv_new_page +DECLARE pvv_margins +DECLARE pvv_init +DECLARE pvv_false +HAS_METHOD +HAS_PROPERTY +} +CLASS prvpage win +{ +DECLARE pvp_margins +HAS_METHOD +HAS_PROPERTY +} +CLASS prvcomm comman +{ +DECLARE pvc_preview_print +DECLARE pvc_preview_margins +DECLARE pvc_preview_options +DECLARE pvc_preview_jump +DECLARE pvc_preview_exit +HAS_METHOD +HAS_PROPERTY +} +CLASS prvjump_dlg dlgbox +{ +HAS_METHOD +} +CLASS prvoptions_dlg dlgbox +{ +HAS_METHOD +} +CLASS xprinter lprinter +{ +HAS_METHOD +HAS_PROPERTY +} +CLASS logona active +{ +HAS_METHOD +HAS_PROPERTY +} +CLASS unload active +{ +HAS_METHOD +HAS_PROPERTY +} +CLASS calimgwn win +{ +HAS_METHOD +HAS_PROPERTY +} +CLASS calwin bwin +{ +HAS_METHOD +HAS_PROPERTY +} +CLASS runmemo active +{ +HAS_METHOD +HAS_PROPERTY +} +CLASS ipcstat active +{ +DECLARE ipcs_set_message +DECLARE ipcs_wait +DECLARE ipcs_key +HAS_METHOD +HAS_PROPERTY +} +CLASS atssv server +{ +DECLARE sv_free +DECLARE sv_key +HAS_METHOD +HAS_PROPERTY +} +CLASS atstim timer +{ +HAS_METHOD +HAS_PROPERTY +} +CLASS oprinter xprinter +{ +DECLARE lpr_print_command +HAS_METHOD +HAS_PROPERTY +} +CLASS ohelpdlg helpdlg +{ +HAS_METHOD +} +CLASS atsdial dlgbox +{ +HAS_METHOD +HAS_PROPERTY +} +CLASS scprnctl dlgbox +{ +HAS_METHOD +HAS_PROPERTY +} +CLASS scpgsetup prnctrl +{ +HAS_METHOD +} +CLASS gridwin bwin +{ +DECLARE gw_get_cell_rect +DECLARE gw_draw_cells +DECLARE gw_move_to +DECLARE gw_set_col_width +DECLARE gw_set_row_height +DECLARE gw_get_current +DECLARE gw_zoom +DECLARE gw_highlight +DECLARE gw_get_data +HAS_METHOD +HAS_PROPERTY +} +CLASS matchwin gridwin +{ +DECLARE mw_start_match +DECLARE mw_stop_match +DECLARE mw_hit_maxlen +HAS_METHOD +HAS_PROPERTY +} diff --git a/code/SIBOSDK/include/xadd.g b/code/SIBOSDK/include/xadd.g new file mode 100644 index 0000000..700099f --- /dev/null +++ b/code/SIBOSDK/include/xadd.g @@ -0,0 +1,11 @@ +/* Generated by Ctran from xadd.cat */ +#define XADD_G +#ifndef OLIB_G +#include +#endif +/* Category Numbers */ +/* EPOC */ +#define CAT_XADD_XADD 0 +#define CAT_XADD_OLIB 1 +#define CAT_XADD_FORM 2 +#define CAT_XADD_HWIM 3 diff --git a/code/SIBOSDK/include/xadd.ing b/code/SIBOSDK/include/xadd.ing new file mode 100644 index 0000000..d7094e7 --- /dev/null +++ b/code/SIBOSDK/include/xadd.ing @@ -0,0 +1,10 @@ +; Generated by Ctran from xadd.cat +XADD_ING equ 1 +IFNDEF OLIB_ING + INCLUDE ..\inc\OLIB.ING +ENDIF +; Category Numbers +CAT_XADD_XADD equ 0 +CAT_XADD_OLIB equ 1 +CAT_XADD_FORM equ 2 +CAT_XADD_HWIM equ 3 diff --git a/code/SIBOSDK/include/xdlgbox.g b/code/SIBOSDK/include/xdlgbox.g new file mode 100644 index 0000000..3b8f42e --- /dev/null +++ b/code/SIBOSDK/include/xdlgbox.g @@ -0,0 +1,31 @@ +/* Generated by Ctran from xdlgbox.cl */ +#define XDLGBOX_G +#ifndef DLGBOX_G +#include +#endif +#ifndef SERDLGS_G +#include +#endif +/* Class Numbers */ +#define C_ATSDIAL 17 +/* Method Numbers */ +/* Property of atsdial */ +typedef struct { +void *owner; +void *main; +void *buts; +PR_WIN *filter; +short int filmethod; +short int chlist; +short int pid; +short int ret; +unsigned short int locked; +} PRS_ATSDIAL; +typedef struct pr_atsdial +{ +PRS_ROOT root; +PRS_WIN win; +PRS_DLGCHAIN dlgchain; +PRS_DLGBOX dlgbox; +PRS_ATSDIAL atsdial; +} PR_ATSDIAL; diff --git a/code/SIBOSDK/include/xdlgbox.ing b/code/SIBOSDK/include/xdlgbox.ing new file mode 100644 index 0000000..c14b51a --- /dev/null +++ b/code/SIBOSDK/include/xdlgbox.ing @@ -0,0 +1,30 @@ +; Generated by Ctran from xdlgbox.cl +XDLGBOX_ING equ 1 +IFNDEF DLGBOX_ING + INCLUDE ..\inc\DLGBOX.ING +ENDIF +IFNDEF SERDLGS_ING + INCLUDE ..\inc\SERDLGS.ING +ENDIF +; Class Numbers +C_ATSDIAL equ 17 +; Method Numbers +; Property of atsdial +PRS_ATSDIAL struc +AtsdialOwner dw ? +AtsdialMain dw ? +AtsdialButs dw ? +AtsdialFilter dw ? +AtsdialFilmethod dw ? +AtsdialChlist dw ? +AtsdialPid dw ? +AtsdialRet dw ? +AtsdialLocked dw ? +PRS_ATSDIAL ends +PR_ATSDIAL struc +AtsdialRoot PRS_ROOT <> +AtsdialWin PRS_WIN <> +AtsdialDlgchain PRS_DLGCHAIN <> +AtsdialDlgbox PRS_DLGBOX <> +AtsdialAtsdial PRS_ATSDIAL <> +PR_ATSDIAL ends diff --git a/code/SIBOSDK/include/xedit.g b/code/SIBOSDK/include/xedit.g new file mode 100644 index 0000000..205097a --- /dev/null +++ b/code/SIBOSDK/include/xedit.g @@ -0,0 +1,28 @@ +/* Generated by Ctran from xedit.cl */ +#define XEDIT_G +#ifndef LODGER_G +#include +#endif +/* Class Numbers */ +#define C_XEDIT 26 +/* Method Numbers */ +/* Constants for xedit */ +#define XEDIT_MAX_LEN 8 +/* Types for xedit */ +typedef struct +{ +char *pstr; +} SE_XEDIT; +/* Property of xedit */ +typedef struct { +unsigned char current; +unsigned char width; +char data[XEDIT_MAX_LEN+2]; +} PRS_XEDIT; +typedef struct pr_xedit +{ +PRS_ROOT root; +PRS_WIN win; +PRS_LODGER lodger; +PRS_XEDIT xedit; +} PR_XEDIT; diff --git a/code/SIBOSDK/include/xedit.ing b/code/SIBOSDK/include/xedit.ing new file mode 100644 index 0000000..69e087d --- /dev/null +++ b/code/SIBOSDK/include/xedit.ing @@ -0,0 +1,26 @@ +; Generated by Ctran from xedit.cl +XEDIT_ING equ 1 +IFNDEF LODGER_ING + INCLUDE ..\inc\LODGER.ING +ENDIF +; Class Numbers +C_XEDIT equ 26 +; Method Numbers +; Constants for xedit +XEDIT_MAX_LEN equ (8) +; Types for xedit +SE_XEDIT struc +SE_XEDITPstr dw ? +SE_XEDIT ends +; Property of xedit +PRS_XEDIT struc +XeditCurrent db ? +XeditWidth db ? +XeditData db (1) * XEDIT_MAX_LEN+2 dup (?) +PRS_XEDIT ends +PR_XEDIT struc +XeditRoot PRS_ROOT <> +XeditWin PRS_WIN <> +XeditLodger PRS_LODGER <> +XeditXedit PRS_XEDIT <> +PR_XEDIT ends diff --git a/code/SIBOSDK/include/xprinter.g b/code/SIBOSDK/include/xprinter.g new file mode 100644 index 0000000..f79395c --- /dev/null +++ b/code/SIBOSDK/include/xprinter.g @@ -0,0 +1,18 @@ +/* Generated by Ctran from xprinter.cl */ +#define XPRINTER_G +#ifndef LPRINTER_G +#include +#endif +/* Class Numbers */ +#define C_XPRINTER 6 +/* Method Numbers */ +/* Property of xprinter */ +typedef struct { +short int locked; +} PRS_XPRINTER; +typedef struct pr_xprinter +{ +PRS_ROOT root; +PRS_LPRINTER lprinter; +PRS_XPRINTER xprinter; +} PR_XPRINTER; diff --git a/code/SIBOSDK/include/xprinter.ing b/code/SIBOSDK/include/xprinter.ing new file mode 100644 index 0000000..587f36f --- /dev/null +++ b/code/SIBOSDK/include/xprinter.ing @@ -0,0 +1,17 @@ +; Generated by Ctran from xprinter.cl +XPRINTER_ING equ 1 +IFNDEF LPRINTER_ING + INCLUDE ..\inc\LPRINTER.ING +ENDIF +; Class Numbers +C_XPRINTER equ 6 +; Method Numbers +; Property of xprinter +PRS_XPRINTER struc +XprinterLocked dw ? +PRS_XPRINTER ends +PR_XPRINTER struc +XprinterRoot PRS_ROOT <> +XprinterLprinter PRS_LPRINTER <> +XprinterXprinter PRS_XPRINTER <> +PR_XPRINTER ends diff --git a/code/SIBOSDK/include/xpulldwn.g b/code/SIBOSDK/include/xpulldwn.g new file mode 100644 index 0000000..1e96689 --- /dev/null +++ b/code/SIBOSDK/include/xpulldwn.g @@ -0,0 +1,20 @@ +/* Generated by Ctran from xpulldwn.cl */ +#define XPULLDWN_G +#ifndef PULLDOWN_G +#include +#endif +/* Class Numbers */ +#define C_XPULLDWN 81 +/* Method Numbers */ +/* Constants for xpulldwn */ +#define PULLDOWN_3b_LEFT 4 +#define PULLDOWN_3b_RIGHT 3 +#define PULLDOWN_3b_BOTTOM 3 +#define PULLDOWN_3b_TOP 4 +/* Property of xpulldwn */ +typedef struct pr_xpulldwn +{ +PRS_ROOT root; +PRS_WIN win; +PRS_LISTBOX listbox; +} PR_XPULLDWN; diff --git a/code/SIBOSDK/include/xpulldwn.ing b/code/SIBOSDK/include/xpulldwn.ing new file mode 100644 index 0000000..235aa83 --- /dev/null +++ b/code/SIBOSDK/include/xpulldwn.ing @@ -0,0 +1,19 @@ +; Generated by Ctran from xpulldwn.cl +XPULLDWN_ING equ 1 +IFNDEF PULLDOWN_ING + INCLUDE ..\inc\PULLDOWN.ING +ENDIF +; Class Numbers +C_XPULLDWN equ 81 +; Method Numbers +; Constants for xpulldwn +PULLDOWN_3b_LEFT equ (4) +PULLDOWN_3b_RIGHT equ (3) +PULLDOWN_3b_BOTTOM equ (3) +PULLDOWN_3b_TOP equ (4) +; Property of xpulldwn +PR_XPULLDWN struc +XpulldwnRoot PRS_ROOT <> +XpulldwnWin PRS_WIN <> +XpulldwnListbox PRS_LISTBOX <> +PR_XPULLDWN ends diff --git a/code/SIBOSDK/ldd/atimdvr.asm b/code/SIBOSDK/ldd/atimdvr.asm new file mode 100644 index 0000000..7a3c024 --- /dev/null +++ b/code/SIBOSDK/ldd/atimdvr.asm @@ -0,0 +1,446 @@ + title ATIMDVR -- Attached timer device driver example + subttl Copyright (c) Psion PLC 1991 + name ATIMDVR +; +; VER DATE BY DESCRIPTION +; ----- -------- ---- ----------- +; 1.00A 01/02/92 JH Alpha release +; +TURBOC equ 1 +; + include epocdef.inc + include epocmac.inc + include epocpan.inc + include epoclib.inc + include epocser.inc + +HandlerDisable equ 000h ; the hnadler should not be called +HandlerEnable equ 001h ; the handler should be called +; +TimerEnt struc + TimerIo ChanEnt <> ; I/O device driver hdr + ReadRq RqEnt <> ; read request info + ReadStat dw ? ; read completion status + InStrategy dw ? ; internal control + WaitHandler dw ? ; wait handler handle + TimerChan dw ? ; open timer channel handle + Timeout dd ? ; read timout + TimerStat dw ? ; timer completion status +TimerEnt ends + + CodeSeg + + ProcBegin@ AttachedTimerLDD +; ================= +; The externally loadable Attached timer device table + dw LDDSignature + db 'ATM',0,0,0,0,0 + dw (VectorEnd-Vector)/2 +Vector: + dw AttachedTimerInstall + dw AttachedTimerRemove + dw AttachedTimerHold + dw AttachedTimerResume + dw AttachedTimerReset + dw AttachedTimerUnits + dw AttachedTimerOpen + dw AttachedTimerStrategy +VectorHandler: + dw AttachedTimerHandler +VectorEnd: + ProcEnd noret + + + ProcBegin@ AttachedTimerInstall,far +; ===================== +; Called on device installation by the operating system +; + clc ; installed OK + ret + ProcEnd noret + + + ProcBegin@ AttachedTimerRemove,far +; ==================== +; Always allow to be removed. +; + clc ; removed ok. + ret + ProcEnd noret + + + ProcBegin@ AttachedTimerHold,far +; ================== +; This does not need to do anything. +; + ret + ProcEnd noret + + + ProcBegin@ AttachedTimerResume,far +; ==================== +; This does not need to do anything. +; + ret + ProcEnd noret + + + ProcBegin@ AttachedTimerReset,far +; =================== +; This will never be called since we dont request it to be called. +; The lower level driver and timer driver will handle the process +; terminating abnormally. +; + ProcEnd noret + + + ProcBegin@ AttachedTimerUnits,far +; =================== +; Called by device query units operating system service +; + mov ax, -1 ; supports many open requests + ret + ProcEnd noret + + + ProcBegin@ AttachedTimerOpen,far +; ================== +; Called by the IoOpen system service +; +; In: +; DX - device handle +; SI - ptr to OpenEnt struct +; Out: +; Carry clear +; BX - open channel handle +; DX - device handle as passed +; Carry set +; AL - error number +; DX - device handle as passed +; + cld + mov cx, (size TimerEnt) + HeapAllocateCell + jc endOpen ; return that error + mov bx, ax + +; Initialise the allocated cell to zero. + mov di, ax + shr cx, 1 ; alloc cells should be even no of bytes. + xor ax, ax + rep stosw ; initialize all struct to zero + +; Add the waithandler function + mov al, (VectorHandler-Vector)/2 + IoAddHandler + jc freeCellExit ; report the add handler error + mov [bx].WaitHandler, ax ; handler handle + +; Open a timer channel + push bx ; save the alloc cell handle + mov cx, sp ; save SP for now + xor ax, ax + push ax + mov ax, ':' shl 8 + 'M' + push ax + mov ax, 'I' shl 8 + 'T' + push ax + mov bx, sp ; BX is pointer to name to 'TIM:' + IoOpen ; CX and DX are irrelvant for a timer + mov sp, cx + pop bx + jc freeHandlerExit ; report the timer open error. + mov [bx].TimerChan, ax + +; Set up the channel header + mov [bx].ChanSignature, IoChanSignature + mov [bx].ChanLibHandle, dx + mov [bx].ChanNext, bx ; were a root driver for now + +; Attach this driver to the currently open driver Hierarchy + mov cx, bx ; channel were attaching + mov al, IoFuncAttach + mov bx, [si].OpenChan ; driver to attach to + IoWithWait + clc ; return BX (ie what attached to) + +; Finished the open request +endOpen: + ret + +; An error has occured, free the handler then cell in BX and return an error +freeHandlerExit: + push ax + push bx + mov bx, [bx].WaitHandler + IoRemoveHandler + pop bx + pop ax + +; An error has occured, free the cell in BX and return an error +freeCellExit: + push ax + HeapFreeCell + pop ax ; AL has the error code + stc + ret + ProcEnd noret + + + ProcBegin@ StrategyVectorTable +; =================== +; The strategy vector jump table +; + dw StrategyDefault ; IoFuncPanic + dw StrategyRead ; IoFuncRead + dw StrategyDefault ; IoFuncWrite + dw StrategyClose ; IoFuncClose + dw StrategyCancel ; IoFuncCancel + dw StrategyDefault ; IoFuncAttach + dw StrategyDefault ; IoFuncDetach + dw StrategySet ; IoFuncSet + dw StrategySense ; IoFuncSense +StrategyVectorEnd: + ProcEnd noret + + + ProcBegin@ CancelTimer +; =========== +; Cancel the outstanding timer request +; In: +; BX = TimerEnt ptr +; Out: +; NONE +; + push bx + mov bx, [bx].TimerChan + mov al, IoFuncCancel ; cancel the queued timer + IoWithWait + pop bx + lea di, [bx].TimerStat + IoWaitForStatus ; use up completion signal + ret + ProcEnd noret + + ProcBegin@ CancelRead +; ========== +; Cancel the outstanding read request on the lower driver +; In: +; BX = TimerEnt ptr +; Out: +; NONE +; + mov al, IoFuncCancel ; cancel the queued read + IoWithWait + lea di, [bx].ReadStat + IoWaitForStatus ; use up completion signal + ret + ProcEnd noret + + ProcBegin@ SignalReadAX +; ============ +; Complete the orignal read request with the completion status in AX +; In: +; AX = completion status to report +; BX = control block ptr as allocated by open +; Out: +; NONE +; + xor di, di ; complete the original read request + xchg di, [bx].ReadRq.RqStatusPtr + mov word ptr [di], ax + IoSignal + ret + ProcEnd noret + + ProcBegin@ CancelAnyRequests +; ================= +; Cancel any outstanding attached driver and timer requests. +; In: +; BX = control block ptr as allocated by open +; Out: +; NONE +; + cmp [bx].ReadRq.RqStatusPtr, 0 + je noRequestsQueued + call CancelRead + call CancelTimer + push bx + mov bx, [bx].WaitHandler + mov cl, HandlerDisable + IoEnableHandler + pop bx + mov ax, CancelErr + call SignalReadAX + +noRequestsQueued: + ret + ProcEnd noret + + ProcBegin@ AttachedTimerStrategy,far +; ===================== +; Called by the applications I/O services. +; In: +; BX = control block ptr as allocated by open +; SI = RqEnt pointer +; Out: +; Carry clear +; The request was sucessfully queued, (may have completed) +; Carry set +; The request failed to start +; + cld + mov [bx].InStrategy, 1 ; anti nesting + mov di, [si].RqStatusPtr + mov word ptr [di], PendingErr ; request now pending + mov ax, di ; pre-load AX + mov di, [si].RqFunction + cmp di, (StrategyVectorEnd-StrategyVectorTable)/2 + ja StrategyDefault + mov cx, [si].RqA1Ptr ; pre-load CX and DX + mov dx, [si].RqA2Ptr + shl di, 1 ; vector table entry + jmp word ptr cs:StrategyVectorTable[di] + +; This device driver does not handle this function, pass it up the driver +; hierarchy to a driver that may support this function. +StrategyDefault: + mov [bx].InStrategy, 0 + IoSuper ; pass request to next dvr + ret + +StrategyRead: + cmp [bx].ReadRq.RqStatusPtr, 0 + jne panicPending ; already a read queued + mov [bx].ReadRq.RqStatusPtr, ax + mov [bx].ReadRq.RqA1Ptr, cx + mov [bx].ReadRq.RqA2Ptr, dx + lea di, [bx].ReadStat ; Q an attached dvr read + mov al, IoFuncRead + IoAsynchronousNoError ; Queue a read on lower dvr + lea di, [bx].TimerStat + lea cx, [bx].Timeout + push bx + push [bx].WaitHandler + mov bx, [bx].TimerChan + mov al, IoFuncRead + IoAsynchronousNoError ; Queue a read on the timer channel +; now let the wait handler be callable + pop bx + mov cl, HandlerEnable + IoEnableHandler + pop bx + and [bx].InStrategy, 0 + clc + ret + +; The process is making a 2nd call of a function that is already outstanding. +panicPending: + mov al, PanicIoPending + ProcPanic ; stop calling process. + +StrategyCancel: + call CancelAnyRequests + and [bx].InStrategy, 0 + jmp short completeRequestOk + +; This driver defines the IoFuncSet function to set the read timout. +StrategySet: + mov di, cx ; RqA1Ptr is a pointer to a long + mov ax, [di] + mov word ptr [bx].Timeout, ax + mov ax, [di+2] + mov word ptr [bx+2].Timeout, ax + and [bx].InStrategy, 0 + jmp short completeRequestOk + +; This driver defines the IoFuncSense function to sense the read timout. +StrategySense: + mov di, cx ; RqA1Ptr is a pointer to a long + mov ax, word ptr [bx].Timeout + mov word ptr [di], ax + mov ax, word ptr [bx+2].Timeout + mov word ptr [di+2], ax +completeRequestOk: + mov di, [si].RqStatusPtr + and word ptr [di], 0 ; complete request OK. + IoSignal + and [bx].InStrategy, 0 + clc + ret + +StrategyClose: + call CancelAnyRequests + push bx + push [bx].WaitHandler + mov bx, [bx].TimerChan + IoClose ; close the timer + pop bx + IoRemoveHandler ; remove the waithandler + pop bx + mov al, IoFuncDetach ; detach from lower driver + IoWithWait + HeapFreeCell ; alloc cell freed !!! + mov di, [si].RqStatusPtr + and word ptr [di], 0 ; complete request OK. + IoSignal + clc + ret + + ProcEnd noret + + ProcBegin@ AttachedTimerHandler,far +; ==================== +; Called by the operating system when the applications I/O semaphore has +; been signalled. See if its one of our requests that have been completed. +; The operating system will automatically stop any nesting if it called this +; handler, however we will get called if we are in the strategy vector and +; use synchronous I/O requests. The driver has set itself up such that this +; will only ever be called if there is an outstanding request by only +; enabling the handler when a read request is received. +; +; In: +; BX = as passed to IoAddHandler +; Out: +; Carry clear +; The signal was not for us. +; Carry set +; AL = 0 - we used signal, allow handler to be disabled. +; AL = 1 - we used signal, keep the handler enabled. +; + + cmp [bx].InStrategy, 1 + jne notInAttachedTimerStrategy +signalNotForThisDriver: + clc ; get out as fast as possible + ret ; as event definatly not for us. + +notInAttachedTimerStrategy: + cmp [bx].ReadStat, PendingErr + je readRequestNotComplete +; The read request has completed. + call CancelTimer + mov ax, [bx].ReadStat ; read completion result + jmp short signalAXdisableHandler + +readRequestNotComplete: + cmp [bx].TimerStat, PendingErr + je signalNotForThisDriver +; The timer request has completed. + call CancelRead + mov ax, InActivityErr ; read inactivity on timeout +signalAXdisableHandler: + call SignalReadAX + xor al, al ; we used signal + stc ; handler now disabled. + ret + ProcEnd noret + + + EndCodeSeg +; +stack segment stack para 'data' +; +stack ends +; + end AttachedTimerLDD diff --git a/code/SIBOSDK/ldd/epocdef.inc b/code/SIBOSDK/ldd/epocdef.inc new file mode 100644 index 0000000..1dfd846 --- /dev/null +++ b/code/SIBOSDK/ldd/epocdef.inc @@ -0,0 +1,731 @@ + .xlist +; Include file - EPOCDEF.INC +; Epoc/Os standard definitions include file +; Copyright (c) Psion PLC 1989-91. +; +; VER DATE BY DESCRIPTION +; ----- -------- ---- ----------- +; 2.00F 30/09/90 NSM Final release +; 2.12F 08/05/91 NSM Final release +; +EPOCDEF_INC = 1 +; +Sibo = 0 +S3b = 0 +S3c = 0 +S3d = 0 +S3r = 0 +S39 = 0 +S3 = 0 +S3Pc = 0 +Vine = 0 +Prot = 0 +Asic1 = 1 +Asic9 = 0 +HandHeld = 0 +LapTop = 1 +IbmPc = 1 +RomServer = 0 +McLink = 0 +Consumer = 0 +Corporate = 0 +Dpmi = 0 +TickTock = 0 +DoubleSpeed = 0 +Condor = 0 +OvalDisable = 0 +S3cExtra = 0 +ifdef BUILDPH +S3Pc = 1 +endif +ifdef BUILDDL +Dpmi = 1 +endif +ifdef BUILDHH +S3 = 1 +Sibo = 1 +HandHeld = 1 +LapTop = 0 +IbmPc = 0 +Consumer = 1 +TickTock = 1 +endif +ifdef BUILDSB +Sibo = 1 +HandHeld = 1 +LapTop = 0 +IbmPc = 0 +Consumer = 1 +S3b = 1 +S39 = 1 +Asic1 = 0 +Asic9 = 1 +TickTock = 1 +endif +ifdef BUILDSC +Sibo = 1 +HandHeld = 1 +LapTop = 0 +IbmPc = 0 +S3c = 1 +S39 = 1 +Asic1 = 0 +Asic9 = 1 +TickTock = 1 +endif +ifdef BUILDWA +Sibo = 1 +HandHeld = 1 +LapTop = 0 +IbmPc = 0 +S3c = 1 +S39 = 1 +Asic1 = 0 +Asic9 = 1 +TickTock = 1 +S3cExtra = 1 +endif +ifdef BUILDSR +Sibo = 1 +HandHeld = 1 +LapTop = 0 +IbmPc = 0 +Consumer = 1 +S3b = 1 +S39 = 1 +Asic1 = 0 +Asic9 = 1 +TickTock = 1 +S3r = 1 +endif +ifdef BUILDVN +Sibo = 1 +HandHeld = 1 +LapTop = 0 +IbmPc = 0 +Consumer = 1 +S3b = 1 +S39 = 1 +Asic1 = 0 +Asic9 = 1 +TickTock = 1 +Vine = 1 +Condor = 1 +endif +ifdef BUILDPT +Sibo = 1 +HandHeld = 1 +LapTop = 0 +IbmPc = 0 +Consumer = 1 +S3b = 1 +S39 = 1 +Asic1 = 0 +Asic9 = 1 +Prot = 1 +TickTock = 1 +DoubleSpeed = 1 +endif +ifdef BUILDSD +Sibo = 1 +HandHeld = 1 +LapTop = 0 +IbmPc = 0 +Consumer = 1 +S3b = 1 +S39 = 1 +Asic1 = 0 +Asic9 = 1 +TickTock = 1 +Condor = 1 +S3d = 1 +OvalDisable = 1 +endif +ifdef BUILDCH +Sibo = 1 +HandHeld = 1 +LapTop = 0 +IbmPc = 0 +Corporate = 1 +TickTock = 1 +endif +ifdef BUILDLT +Sibo = 1 +IbmPc = 0 +endif +ifdef BUILDRM +RomServer = 1 +endif +ifdef BUILDMC +McLink = 1 +endif +; +PriorityForeground = 080h +PriorityBackground = 070h +; +LcdUnknown = -1 +Lcd640X400 = 0 +Lcd640X200Small = 1 +Lcd640X200Big = 2 +Lcd720X348 = 3 +Lcd160X80 = 4 +Lcd240X80 = 5 +; +PcHerc = Lcd720X348 +PcCga = Lcd640X200Big +PcMda = 6 +PcEgaMono = 7 +PcEgaColour = 8 +PcVgaMono = 9 +PcVgaColour = 10 +; +Lcd480X160 = 11 +Lcd240X100 = 12 +Lcd240X120 = 13 +Lcd240X160 = 14 +Lcd640X200 = 15 +Lcd640X240 = 16 +; +OldPsu = 0 +MaximPsu = 1 +PanPsu = 2 +PanA9Psu = 3 +BatteryUnknown = 0 +BatteryAlkaline = 1 +BatteryNicad600 = 2 +BatteryNicad1000 = 3 +BatteryNicad500 = 4 +BatteryNicad850 = 5 +; +IsAColdStart = 0 +IsAPowerFailStart = 1 +IsAResetStart = 2 +IsAKernelFault = 3 +IsANewOsStart = 4 +; +HwInt0Revector = 0 +HwInt1Revector = 1 +HwInt2Revector = 2 +HwInt3Revector = 3 +HwInt4Revector = 4 +HwIrq0Revector = 5 +HwIrq1Revector = 6 +HwIrq2Revector = 7 +HwIrq3Revector = 8 +HwIrq4Revector = 9 +HwIrq5Revector = 10 +HwIrq6Revector = 11 +HwIrq7Revector = 12 +; +if IbmPc +TicksPerSecond = 18 +endif +if Sibo +TicksPerSecond = 32 +endif +FileSystemNameSize = 5 +MaxDeviceSize = 8 +MaxNameSize = 8 +MaxExtSize = 4 +MaxNameESize = (MaxNameSize+MaxExtSize) +MaxPathSize = 080h +DeviceSeparator = ':' +ExtSeparator = '.' +MatchAny = '*' +MatchSingle = '?' +MaxErrorTextSize = 64 +MaxNotifyTextSize = 64 +MaxOptionTextSize = 16 +MaxDayName = 32 +MaxMonthName = MaxDayName +MaxSuffixes = 31 +MaxCommandBuffer = 127 +PidMask = 0fffh +MaxEnvNameSize = 16 +MaxAlarms = 2 +MaxPassword = 8 +BackLightDisable = 8000h +BackLightOff = 0 +BackLightOn = 1 +BackLightToggle = 2 +BackLightQuery = 3 +FrcCounting = 0 +FrcRepeating = 1 +; +SoundKeyboardEnable = 00001h +SoundBuzzerEnable = 00002h +SoundDeviceEnable = 00004h +SoundLoud = 00008h +SoundLoudBuzzer = 00010h +SoundDisable = 08000h +SoundMaxVolume = 0 +SoundMinVolume = 5 +SoundMaxBpm = 240 +SoundMinBpm = 2 +; +DiskAPresent = 0000000000000001b +DiskAActive = 0000000000000010b +DiskBPresent = 0000000000000100b +DiskBActive = 0000000000001000b +DiskCPresent = 0000000000010000b +DiskCActive = 0000000000100000b +DiskDPresent = 0000000001000000b +DiskDActive = 0000000010000000b +PortAOpen = 0000000100000000b +PortAActive = 0000001000000000b +PortBOpen = 0000010000000000b +PortBActive = 0000100000000000b +PortCOpen = 0001000000000000b +PortCActive = 0010000000000000b +MainsInactive = 0100000000000000b +CondorActive = 1000000000000000b +; +CPBInRom = 0 +CPBInRam = 1 +CPBMaxPriority = 0c0h +CPBMinPriority = 040h +MaxHeapGrowBy = 0400h +HeapGrowByDefault = 080h +MaxProcesses = 018h +; +CreateSegmentLow = 0 +CreateSegmentHigh = 1 +CreateSegmentDevice = 2 +CreateSegmentLocked = 3 +; +DevFuncInstall = 000h +DevFuncRemove = 001h +DevFuncHold = 002h +DevFuncResume = 003h +DevFuncReset = 004h +DevFuncUnits = 005h +DevFuncOpen = 006h +DevFuncStrategy = 007h +; +DevHoldNormal = 000h +DevHoldPowerDown = 001h +DevHoldPowerFail = 002h +; +DevFuncInstallPDD = DevFuncInstall +DevFuncRemovePDD = DevFuncRemove +DevFuncOpenPDD = (DevFuncRemovePDD+1) +DevFuncStrategyPDD = (DevFuncOpenPDD+1) +; Generic I/O r=ests +IoFuncPanic = 000h +IoFuncRead = 001h +SoundChannel1 = IoFuncRead +TimerRelative = IoFuncRead +IoFuncWrite = 002h +SoundChannel2 = IoFuncWrite +TimerAbsolute = IoFuncWrite +IoFuncClose = 003h +IoFuncCancel = 004h +IoFuncAttach = 005h +IoFuncDetach = 006h +IoFuncSet = 007h +IoFuncSense = 008h +IoFuncFlush = 009h +IoFuncAlarm = IoFuncFlush +; The File System +IoFuncSeek = 00ah +IoFuncDial = IoFuncSeek +IoFuncSetEof = 00bh +; Data Link I/O + Wserv +IoFuncConnect = 00ah +IoFuncDisconnect = 00bh +; Wserv functions +IoFuncWriteReply = 00ch +; Serial/llmac +IoFuncTest = 00ah +IoFuncControl = 00bh +IoFuncInquire = 00ch +IoFuncSuperFrame = 00dh +IoFuncStop = 00eh +IoFuncStart = 00fh +; Serial LDD to Serial PDD I/O defines +IoFuncEnable = 010h +IoFuncSetDevice = 011h +; Modem driver functions +IoFuncModemInit = 010h +IoFuncModemDial = 011h +IoFuncModemWaitCall = 012h +IoFuncModemSense = 013h +IoFuncModemSet = 014h +IoFuncModemCancel = 015h +IoFuncModemWrite = 016h +; For 3B sound device +IoSoundPlay = 010h +IoSoundRecord = 011h +IoSoundPlayO = 012h +; +ModeOpen = 00000h +ModeCreate = 00001h +ModeReplace = 00002h +ModeAppend = 00003h +ModeUnique = 00004h +; +ModeStream = 00000h +ModeStreamText = 00010h +ModeText = 00020h +ModeDir = 00030h +ModeFormat = 00040h +ModeDevice = 00050h +ModeNode = 00060h +; +ModeUpdate = 00100h +ModeRandom = 00200h +ModeShare = 00400h +; +ModeLowDensity = 01000h +; +ModeServiceMask = 0000fh +ModeFormatMask = 000f0h +ModeAccessMask = 00f00h +; +SeekAddress = 00h +SeekFromStart = 01h +SeekFromEnd = 02h +SeekFromCurrent = 03h +SeekRecordSense = 04h +SeekRecordSet = 05h +SeekRewind = 06h +; +FileAttWrite = 00001h +FileAttHidden = 00002h +FileAttSystem = 00004h +FileAttVolume = 00008h +FileAttDirectory = 00010h +FileAttModified = 00020h +FileAttRead = 00100h +FileAttExecute = 00200h +FileAttStream = 00400h +FileAttText = 00800h +; +FileChangeDirRoot = 0 +FileChangeDirParent = 1 +FileChangeDirSubdir = 2 +; +FileStatusEnt struc +FileVersionNo dw ? +FileAtt dw ? +FileSize dd ? +FileModDate dd ? +FileSpare db 4 dup (?) +FileStatusEnt ends +; +MaxVolumeName = 32 +FileMediaUnknown = 0 +FileMediaFloppy = 1 +FileMediaHardDisk = 2 +FileMediaFlash = 3 +FileMediaRam = 4 +FileMediaRom = 5 +FileMediaWriteProtected = 6 +FileMediaCompressible = 08000h +FileMediaDynamic = 04000h +FileMediaInternal = 02000h +FileMediaDualDensity = 01000h +FileMediaFormattable = 00800h +; +DeviceStatusEnt struc +DeviceVersionNo dw ? +DeviceMediaType dw ? +DeviceIsRemovable dw ? +DeviceStatusSize dd ? +DeviceStatusFree dd ? +DeviceStatusName db MaxVolumeName dup (?) +DeviceBatteryState dw ? +DeviceSpare db 16 dup (?) +DeviceStatusEnt ends +; +FileNodeFlat = 0 +FileNodeHierarchical = 1 +; +NodeStatusEnt struc +NodeVersionNo dw ? +NodeType dw ? +NodeSupportsFormat dw ? +NodeStatusSpare db 26 dup (?) +NodeStatusEnt ends +; +FileBlockShift = 9 +FileBlockSize = 00200h +FileMaxRecordSize = 00100h +FileMaxStreamSize = 04000h +; +JustifyLeft = 0 +JustifyRight = 1 +JustifyCentre = 2 +; +ParseWildAny = 00001h +ParseWildName = 00002h +ParseWildExt = 00004h +; +DtobTypeFixed = 00h +DtobTypeExponent = 01h +DtobTypeGeneral = 02h +DtobMaxExponent = 99 +DtobGenLimit = 40h +FloatSignificantDigits = 15 +; +DtobEnt struc +DtobType db ? +DtobWidth db ? +DtobNdec db ? +DtobPoint db ? +DtobTriad db ? +DtobTrilen db ? +DtobEnt ends +; +FullParseEnt struc +FullParseSystem db ? +FullParseDevice db ? +FullParsePath db ? +FullParseName db ? +FullParseExt db ? +FullParseFlags db ? +FullParseEnt ends +; +GenParseEnt struc +GenParseSourceNamePtr dw ? +GenParseRelatedNamePtr dw ? +GenParseDefaultsPtr dw ? +GenParseTargetNamePtr dw ? +GenParseInfoPtr dw ? +GenParseDeviceSeparator db ? +GenParsePathSeparator db ? +GenParseExtSeparator db ? +GenParseMaxDeviceSize db ? +GenParseMaxPathSize db ? +GenParseMaxNameSize db ? +GenParseMaxExtSize db ? +GenParseDummy db ? +GenParseEnt ends +; +CDataEnt struc +CDataCountryCode dw ? +CDataGmtOffset dw ? +CDataDateType db ? +CDataTimeType db ? +CDataCurrencySymbolPosition db ? +CDataCurrencySpaceRequired db ? +CDataCurrencyDecimalPlaces db ? +CDataCurrencyNegativeInBrackets db ? +CDataCurrencyTriadsAllowed db ? +CDataThousandsSeparator db ? +CDataDecimalSeparator db ? +CDataDateSeparator db ? +CDataTimeSeparator db ? +CDataCurrencySymbol db 9 dup(?) +CDataStartOfWeek db ? +CDataSummerTime db ? +CDataClockType db ? +CDataDayAbbreviation db ? +CDataMonthAbbreviation db ? +CDataWorkDays db ? +CDataUnits db ? +CDataEscCharacter db ? +CDataSpare db 8 dup(?) +CDataEnt ends +; +DyScEnt struc +DyScDays dw 2 dup(?) +DyScSeconds dw 2 dup(?) +DyScEnt ends +; +DateEnt struc +DateYear db ? +DateMonth db ? +DateDay db ? +DateHour db ? +DateMinute db ? +DateSecond db ? +DateYearDay dw ? +DateEnt ends +; +MessEnt struc +MessNext dw ? +MessStatusPtr dw ? +MessType dw ? +MessPid dw ? +MessEnt ends +; +CPBlock struc +CPBCodeParas dw ? +CPBInitialIp dw ? +CPBStackParas dw ? +CPBDataParas dw ? +CPBHeapParas dw ? +CPBCommandLine dw ? +CPBChecksum dw ? +CPBMinHeap dw ? +CPBPriority db ? +CPBRamOrRom db ? +CPBName db ? +CPBlock ends +; +IoChanSignature = 01101h +IoHandlerSignature = 01121h +DbfChanSignature = 01141h +LIBChanSignature = 01161h +LDDSignature = 0dd01h +PDDSignature = 0dd21h +LIBSignature = 0dd41h +VectorInfoSize = 8 +; +LibEnt struc +LibSignature dw ? +LibInfo db VectorInfoSize dup(?) +LibCount dw ? +LibBase dw ? +LibEnt ends +; +OpenEnt struc +OpenNamePtr dw ? +OpenMode dw ? +OpenChan dw ? +OpenEnt ends +; +RqEnt struc +RqFunction dw ? +RqA1Ptr dw ? +RqA2Ptr dw ? +RqStatusPtr dw ? +RqEnt ends +; +ChanEnt struc +ChanSignature dw ? +ChanNext dw ? +ChanLibHandle dw ? +ChanEnt ends +; +SndEnt struc +SndBeatsPerMinute db ? +SndVolume db ? +SndEnt ends +; +PassEnt struc +PassData db (MaxPassword*2) dup(?) +PassPos dw ? +PassEnt ends +; +IntEnt struc +IntFrame dw ? +IntBP dw ? +IntES dw ? +IntDS dw ? +IntPC dw ? +IntCS dw ? +IntFLAGS dw ? +IntEnt ends +; +DataEnt struc +DataWordDead dw ? +DataHandNext dw ? +DataHandPrev dw ? +DataCountrySeg dw ? +DataClassHandle dw ? +DataClassPtr dw ? +DataEClassHandle dw ? +DataEClassPtr dw ? +DataEnterFramePtr dw ? +Dataw_ws dw ? +Dataw_am dw ? +DatawClientData dw ? +Datawserv_channel dw ? +DataT dw ? +Datar dw ? +DataOsFramePtr dw ? +DataATFlag db ? +DataHeapLocked db ? +DataProcessNamePtr dw ? +DataCommandPtr dw ? +DataTest dw ? +DataApp1 dw ? +DataApp2 dw ? +DataApp3 dw ? +DataApp4 dw ? +DataApp5 dw ? +DataApp6 dw ? +DataApp7 dw ? +DataDialogPtr dw ? +DataGate dw ? +DataLocked dw ? +DataStatusNamePtr dw ? +DataUsedPathNamePtr dw ? +DataEnt ends +; +; Major exit error numbers +KillExit = 0 +PanicExit = 1 +TaskPanicExit = 2 +; Minor exit error numbers +NoErr = 0 +FailErr = -1 +ArgumentErr = -2 +OsErr = -3 +NotSupportedErr = -4 +UnderflowErr = -5 +OverflowErr = -6 +RangeErr = -7 +DivideByZeroErr = -8 +InUseErr = -9 +NoMemoryErr = -10 +IoAllocErr = NoMemoryErr +NoSegmentsErr = -11 +NoSemaphoreErr = -12 +NoProcessErr = -13 +AlreadyOpenErr = -14 +NotOpenErr = -15 +ImageErr = -16 +NoReceiverErr = -17 +NoDevicesErr = -18 +NoFileSystemErr = -19 +FailedToStartErr = -20 +FontNotLoadedErr = -21 +TooWideErr = -22 +TooManyItemsErr = -23 +BatLowSoundErr = -24 +BatLowFlashErr = -25 +BatLowIRDAErr = -26 +; +ExistsErr = -32 +NotExistsErr = -33 +WriteErr = -34 +ReadErr = -35 +EofErr = -36 +FullErr = -37 +NameErr = -38 +AccessErr = -39 +LockedErr = -40 +DeviceErr = -41 +DirErr = -42 +RecordErr = -43 +ReadOnlyErr = -44 +IoInvalidErr = -45 +PendingErr = -46 +VolumeErr = -47 +CancelErr = -48 +ReservedErr = -49 +DisconnectErr = -50 +ConnectErr = -51 +ReTransmitErr = -52 +LineErr = -53 +InActivityErr = -54 +ParityErr = -55 +FrameErr = -56 +OverrunErr = -57 +ModemConnectErr = -58 +ModemBusyErr = -59 +ModemNoAnswerErr = -60 +ModemBlacklistErr = -61 +NotReadyErr = -62 +UnknownErr = -63 +DirFullErr = -64 +WriteProtectErr = -65 +CorruptMediaErr = -66 +AbortErr = -67 +EraseErr = -68 +InvalidFileErr = -69 + .list + diff --git a/code/SIBOSDK/ldd/epoclib.inc b/code/SIBOSDK/ldd/epoclib.inc new file mode 100644 index 0000000..62e98e8 --- /dev/null +++ b/code/SIBOSDK/ldd/epoclib.inc @@ -0,0 +1,284 @@ + .xlist +; Include file - EPOCLIB.INC +; Epoc/Os plib standard include file. +; Copyright (c) Psion PLC 1989-90. +; +; VER DATE BY DESCRIPTION +; ----- -------- ---- ----------- +; 2.00F 30/09/90 NSM Final release +; +EPOCLIB_INC equ 1 +; +_TANDW = 0 +ifdef LATTICE +CodeSeg macro +pgroup group prog +PGROUP equ +prog segment byte public 'prog' + assume cs:pgroup + endm +EndCodeSeg macro +prog ends + endm +DataSeg macro +dgroup group data,udata +DGROUP equ +data segment word public 'data' + assume ds:dgroup,es:dgroup,ss:dgroup + endm +EndDataSeg macro +data ends + endm +UDataSeg macro +udata segment word public 'data' + endm +EndUDataSeg macro +udata ends + endm +GLREF_D MACRO NAME,TYPE + EXTRN NAME:TYPE + ENDM +GLDEF_D MACRO NAME,TYPE + PUBLIC NAME +NAME label TYPE + ENDM +GLREF_C MACRO NAME + EXTRN NAME:NEAR + ENDM +endif +; +ifdef TURBOC +_TANDW = 1 +CodeSeg macro +PGROUP group _TEXT +pgroup equ +_TEXT segment byte public 'CODE' + assume cs:PGROUP + endm +EndCodeSeg macro +_TEXT ends + endm +DataSeg macro +DGROUP group _DATA,_BSS +dgroup equ +_DATA segment word public 'DATA' + assume ds:DGROUP,es:DGROUP,ss:DGROUP + endm +EndDataSeg macro +_DATA ends + endm +UDataSeg macro +_BSS segment word public 'BSS' + endm +EndUDataSeg macro +_BSS ends + endm +GLREF_D MACRO NAME,TYPE + EXTRN _&NAME:TYPE +NAME EQU _&NAME + ENDM +GLDEF_D MACRO NAME,TYPE + PUBLIC _&NAME +_&NAME label TYPE +NAME EQU _&NAME + ENDM +GLREF_C MACRO NAME + EXTRN _&NAME:NEAR +NAME EQU _&NAME + ENDM +endif +ifdef WATCOMC +REG_PARAM equ 1 +ifdef _MSC +_TANDW = 1 +endif +CodeSeg macro +PGROUP group _TEXT +pgroup equ +_TEXT segment byte public 'CODE' + assume cs:PGROUP + endm +EndCodeSeg macro +_TEXT ends + endm +DataSeg macro +DGROUP group _DATA,_BSS +dgroup equ +_DATA segment word public 'DATA' + assume ds:DGROUP,es:DGROUP,ss:DGROUP + endm +EndDataSeg macro +_DATA ends + endm +UDataSeg macro +_BSS segment word public 'BSS' + endm +EndUDataSeg macro +_BSS ends + endm +GLREF_D MACRO NAME,TYPE + EXTRN NAME&_:TYPE +NAME EQU NAME&_ + ENDM +GLDEF_D MACRO NAME,TYPE + PUBLIC NAME&_ +NAME&_ label TYPE +NAME EQU NAME&_ + ENDM +GLREF_C MACRO NAME + EXTRN NAME&_:NEAR +NAME EQU NAME&_ + ENDM +endif +ifdef JPIC +REG_PARAM equ 1 +ifdef _MSC +_TANDW = 1 +endif +CodeSeg macro +_TEXT segment byte public 'CODE' + assume cs:_TEXT + endm +EndCodeSeg macro +_TEXT ends + endm +DataSeg macro +DGROUP group _DATA,_BSS +dgroup equ +_DATA segment word public 'DATA' + assume ds:DGROUP,es:DGROUP,ss:DGROUP + endm +EndDataSeg macro +_DATA ends + endm +UDataSeg macro +_BSS segment word public 'BSS' + endm +EndUDataSeg macro +_BSS ends + endm +GLREF_D MACRO NAME,TYPE + EXTRN _&NAME:TYPE +NAME EQU _&NAME + ENDM +GLDEF_D MACRO NAME,TYPE + PUBLIC _&NAME +_&NAME label TYPE +NAME EQU _&NAME + ENDM +GLREF_C MACRO NAME + EXTRN _&NAME:NEAR +NAME EQU _&NAME + ENDM +endif +; +LOCAL_D MACRO NAME,TYPE +NAME label TYPE + ENDM +; +ProcBegin macro _Name,_Type,_Registers +ifdef TURBOC + ProcBeginBody _&_Name,_Type,_Registers +endif +ifdef JPIC + ProcBeginBody _&_Name,_Type,_Registers +endif +ifdef WATCOMC + ProcBeginBody _Name&_,_Type,_Registers +_Name EQU _Name&_ +endif +ifdef LATTICE + ProcBeginBody _Name,_Type,_Registers +endif + endm +ProcBegin@ macro _Name,_Type,_Registers + ProcBeginBody _Name,_Type,_Registers + endm +ProcBeginBody macro _Name,_Type,_Registers +_DI = 0 +_SI = 0 +if _TANDW +ifnb <_Registers> + irpc _flags,_Registers +ifidni <_flags>, +_DI = 1 +endif +ifidni <_flags>, +_SI = 1 +endif + endm +endif +endif +; +ProcEnd macro _flag +ifb <_flag> +if _DI + pop di +endif +if _SI + pop si +endif +if _TANDW +ifidni <_Type>, + pop bp +endif +endif +ifdef LATTICE +ifidni <_Type>, + pop bp +endif +endif + ret +endif +&_Name endp + endm +; + public _Name +ifidni <_Type>, +_Name proc far +else +_Name proc near +endif +ifidni <_Type>, +if _TANDW + push bp + mov bp, sp +endif +ifdef LATTICE + push bp + mov bp, sp +endif +Arg1 equ <[bp+4]> +Arg2 equ <[bp+6]> +Arg3 equ <[bp+8]> +Arg4 equ <[bp+10]> +Arg5 equ <[bp+12]> +Arg6 equ <[bp+14]> +Arg7 equ <[bp+16]> +Arg8 equ <[bp+18]> +endif +ifidni <_Type>, +if _TANDW + mov bx, sp +endif +ifdef LATTICE + mov bx, sp +endif +Arg1 equ <[bx+2]> +Arg2 equ <[bx+4]> +Arg3 equ <[bx+6]> +Arg4 equ <[bx+8]> +Arg5 equ <[bx+10]> +Arg6 equ <[bx+12]> +Arg7 equ <[bx+14]> +Arg8 equ <[bx+16]> +endif +if _SI + push si +endif +if _DI + push di +endif + endm +; + .list diff --git a/code/SIBOSDK/ldd/epocmac.inc b/code/SIBOSDK/ldd/epocmac.inc new file mode 100644 index 0000000..c2c249f --- /dev/null +++ b/code/SIBOSDK/ldd/epocmac.inc @@ -0,0 +1,512 @@ + .xlist +; Include file - EPOCMAC.INC +; Epoc/Os standard OS macro call definitions include file +; Copyright (c) Psion PLC 1989-90. +; +; VER DATE BY DESCRIPTION +; ----- -------- ---- ----------- +; 2.00F 30/09/90 NSM Final release +; 2.01F 25/03/91 NSM Added a number of extra functions. +; +EPOCMAC_INC equ 1 +; +__IntBase = 080h +; +BeginInterrupt macro __Name,__VIntBase +__IntVector = 0 +__Name macro + int __VIntBase + endm +IntEntry macro __EntName,__VIntVector +ifdef __DeclareNames +Nm&&__EntName = __VIntVector +endif +__EntName macro + mov ah, __VIntVector + int __VIntBase + endm +__IntVector = __IntVector+1 + endm +__IntBase = __IntBase+1 + endm +; +BeginInterrupt SegManager,%__IntBase +IntEntry SegFreeMemory,%__IntVector +IntEntry SegCreate,%__IntVector +IntEntry SegDelete,%__IntVector +IntEntry SegOpen,%__IntVector +IntEntry SegClose,%__IntVector +IntEntry SegSize,%__IntVector +IntEntry SegAdjustSize,%__IntVector +IntEntry SegFind,%__IntVector +IntEntry SegCopyTo,%__IntVector +IntEntry SegCopyFrom,%__IntVector +IntEntry SegLock,%__IntVector +IntEntry SegUnLock,%__IntVector +IntEntry SegRamDiskUsed,%__IntVector +IntEntry SegCloseLockedOrDevice,%__IntVector +IntEntry SegTotalK,%__IntVector +; +BeginInterrupt HeapManager,%__IntBase +IntEntry HeapAllocateCell,%__IntVector +IntEntry HeapReAllocateCell,%__IntVector +IntEntry HeapAdjustCellSize,%__IntVector +IntEntry HeapFreeCell,%__IntVector +IntEntry HeapCellSize,%__IntVector +IntEntry HeapSetGranularity,%__IntVector +IntEntry HeapFreeMemory,%__IntVector +; +BeginInterrupt SemManager,%__IntBase +IntEntry SemCreate,%__IntVector +IntEntry SemDelete,%__IntVector +IntEntry SemWait,%__IntVector +IntEntry SemSignalOnce,%__IntVector +IntEntry SemSignalMany,%__IntVector +IntEntry SemSignalOnceNoReSched,%__IntVector +; +BeginInterrupt MessManager,%__IntBase +IntEntry MessInit,%__IntVector +IntEntry MessReceiveAsynchronous,%__IntVector +IntEntry MessReceiveWithWait,%__IntVector +IntEntry MessReceiveCancel,%__IntVector +IntEntry MessSend,%__IntVector +IntEntry MessSendReceiveAsynchronous,%__IntVector +IntEntry MessSendReceiveWithWait,%__IntVector +IntEntry MessFree,%__IntVector +IntEntry MessSignal,%__IntVector +IntEntry MessSignalCancel,%__IntVector +IntEntry MessSignalCancelX,%__IntVector +; +BeginInterrupt LibManager,%__IntBase +IntEntry LibLoad,%__IntVector +IntEntry LibUnLoad,%__IntVector +IntEntry LibLink,%__IntVector +IntEntry LibFind,%__IntVector +IntEntry LibHandle,%__IntVector +IntEntry LibCreate,%__IntVector +IntEntry LibCreateByHandle,%__IntVector +IntEntry LibDestroy,%__IntVector +IntEntry LibCopy,%__IntVector +IntEntry LibOpen,%__IntVector +IntEntry LibLoadFile,%__IntVector +IntEntry LibReClass,%__IntVector +IntEntry LibReClassByHandle,%__IntVector +; +BeginInterrupt DevManager,%__IntBase +IntEntry IoOpen,%__IntVector +IntEntry DevOpenPDD,%__IntVector +IntEntry DevGetPDDAddress,%__IntVector +IntEntry DevInstall,%__IntVector +IntEntry DevHold,%__IntVector +IntEntry DevResume,%__IntVector +IntEntry DevLoadLDD,%__IntVector +IntEntry DevLoadPDD,%__IntVector +IntEntry DevDelete,%__IntVector +IntEntry DevQueryUnits,%__IntVector +IntEntry DevFind,%__IntVector +IntEntry DevRemove,%__IntVector +IntEntry DevVector,%__IntVector +; +BeginInterrupt IoManager,%__IntBase +IntEntry IoAsynchronous,%__IntVector +IntEntry IoAsynchronousNoError,%__IntVector +IntEntry IoWithWait,%__IntVector +IntEntry IoRoot,%__IntVector +IntEntry IoSuper,%__IntVector +IntEntry IoWaitForSignal,%__IntVector +IntEntry IoWaitForStatus,%__IntVector +IntEntry IoYield,%__IntVector +IntEntry IoSignal,%__IntVector +IntEntry IoSignalByPid,%__IntVector +IntEntry IoSignalByPidNoReSched,%__IntVector +IntEntry IoAddHandler,%__IntVector +IntEntry IoRemoveHandler,%__IntVector +IntEntry IoEnableHandler,%__IntVector +IntEntry IoRequestReset,%__IntVector +IntEntry IoRequestResetCancel,%__IntVector +IntEntry IoClose,%__IntVector +IntEntry IoRead,%__IntVector +IntEntry IoWrite,%__IntVector +IntEntry IoSeek,%__IntVector +IntEntry IoKeyAndMouseWithWait,%__IntVector +IntEntry IoAddApplicationHandler,%__IntVector +IntEntry IoRemoveApplicationHandler,%__IntVector +IntEntry IoEnableApplicationHandler,%__IntVector +IntEntry IoShiftStates,%__IntVector +IntEntry IoWaitForSignalNoHandler,%__IntVector +IntEntry IoSignalKillAsynchronous,%__IntVector +IntEntry IoSignalKillCancel,%__IntVector +IntEntry IoKeyAndMouseAsynchronous,%__IntVector +IntEntry IoNextHalfSecond,%__IntVector +IntEntry IoPlaySoundA,%__IntVector +IntEntry IoPlaySoundW,%__IntVector +IntEntry IoPlaySoundCancel,%__IntVector +IntEntry IoRecordSoundA,%__IntVector +IntEntry IoRecordSoundW,%__IntVector +IntEntry IoRecordSoundCancel,%__IntVector +IntEntry IoPlaySoundAO,%__IntVector +IntEntry IoPlaySoundWO,%__IntVector +; +BeginInterrupt FilManager,%__IntBase +IntEntry FilConnect,%__IntVector +IntEntry FilExecute,%__IntVector +IntEntry FilParse,%__IntVector +IntEntry FilPathGet,%__IntVector +IntEntry FilPathSet,%__IntVector +IntEntry FilPathTest,%__IntVector +IntEntry FilDelete,%__IntVector +IntEntry FilRename,%__IntVector +IntEntry FilStatusGet,%__IntVector +IntEntry FilStatusSet,%__IntVector +IntEntry FilStatusDevice,%__IntVector +IntEntry FilStatusSystem,%__IntVector +IntEntry FilMakeDirectory,%__IntVector +IntEntry FilOpenUnique,%__IntVector +IntEntry FilSystemAttach,%__IntVector +IntEntry FilSystemDetach,%__IntVector +IntEntry FilPathGetById,%__IntVector +IntEntry FilChangeDirectory,%__IntVector +IntEntry FilSetInitialPath,%__IntVector +IntEntry FilSetFileDate,%__IntVector +IntEntry FilLocChanged,%__IntVector +IntEntry FilLocDevice,%__IntVector +IntEntry FilLocReadPdd,%__IntVector +; +BeginInterrupt ProcManager,%__IntBase +IntEntry ProcId,%__IntVector +IntEntry ProcIdByName,%__IntVector +IntEntry ProcGetPriority,%__IntVector +IntEntry ProcSetPriority,%__IntVector +IntEntry ProcCreate,%__IntVector +IntEntry ProcCreateTask,%__IntVector +IntEntry ProcResume,%__IntVector +IntEntry ProcSuspend,%__IntVector +IntEntry ProcKill,%__IntVector +IntEntry ProcPanicById,%__IntVector +IntEntry ProcNameById,%__IntVector +IntEntry ProcFind,%__IntVector +IntEntry ProcRename,%__IntVector +IntEntry ProcTerminate,%__IntVector +IntEntry ProcOnTerminate,%__IntVector +IntEntry ProcWatchAllExits,%__IntVector +IntEntry ProcGetOwner,%__IntVector +IntEntry ProcKillReason,%__IntVector +; +BeginInterrupt TimManager,%__IntBase +IntEntry TimSleepForTenths,%__IntVector +IntEntry TimSleepForTicks,%__IntVector +IntEntry TimGetSystemTime,%__IntVector +IntEntry TimSetSystemTime,%__IntVector +IntEntry TimSystemTimeToDaySeconds,%__IntVector +IntEntry TimDaySecondsToSystemTime,%__IntVector +IntEntry TimDaySecondsToDate,%__IntVector +IntEntry TimDateToDaySeconds,%__IntVector +IntEntry TimDaysInMonth,%__IntVector +IntEntry TimDayOfWeek,%__IntVector +IntEntry TimNameOfDay,%__IntVector +IntEntry TimNameOfMonth,%__IntVector +IntEntry TimWaitAbsolute,%__IntVector +IntEntry TimWeekNumber,%__IntVector +IntEntry TimNameOfDayAbb,%__IntVector +IntEntry TimNameOfMonthAbb,%__IntVector +; +BeginInterrupt ConvManager,%__IntBase +IntEntry ConvUnsignedIntToBuffer,%__IntVector +IntEntry ConvUnsignedLongIntToBuffer,%__IntVector +IntEntry ConvIntToBuffer,%__IntVector +IntEntry ConvLongIntToBuffer,%__IntVector +IntEntry ConvArgumentsToBuffer,%__IntVector +IntEntry ConvStringToUnsignedInt,%__IntVector +IntEntry ConvStringToUnsignedLongInt,%__IntVector +IntEntry ConvStringToInt,%__IntVector +IntEntry ConvStringToLongInt,%__IntVector +IntEntry ConvFloatToBuffer,%__IntVector +IntEntry ConvStringToFloat,%__IntVector +; +BeginInterrupt GenManager,%__IntBase +IntEntry GenVersion,%__IntVector +IntEntry GenLcdType,%__IntVector +IntEntry GenStartReason,%__IntVector +IntEntry GenParse,%__IntVector +IntEntry LongUnsignedIntRandom,%__IntVector +IntEntry GenGetCountryData,%__IntVector +IntEntry GenGetErrorText,%__IntVector +IntEntry GenGetOsData,%__IntVector +IntEntry GenDeferredMode,%__IntVector +IntEntry GenNotify,%__IntVector +IntEntry GenNotifyError,%__IntVector +IntEntry GenNotifyHook,%__IntVector +IntEntry GenNotifyUnHook,%__IntVector +IntEntry GenGetRamSizeInParas,%__IntVector +IntEntry GenGetCommandLine,%__IntVector +IntEntry GenGetSoundFlags,%__IntVector +IntEntry GenSetSoundFlags,%__IntVector +IntEntry GenSound,%__IntVector +IntEntry GenMarkActive,%__IntVector +IntEntry GenMarkNonActive,%__IntVector +IntEntry GenGetText,%__IntVector +IntEntry GenGetNotifyState,%__IntVector +IntEntry GenSetNotifyState,%__IntVector +IntEntry GenGetAutoSwitchOffValue,%__IntVector +IntEntry GenSetAutoSwitchOffValue,%__IntVector +IntEntry GenSetRevector,%__IntVector +IntEntry GenResetRevector,%__IntVector +IntEntry GenGetLanguageCode,%__IntVector +IntEntry GenGetSuffixes,%__IntVector +IntEntry GenGetAmPmText,%__IntVector +IntEntry GenSetCountryData,%__IntVector +IntEntry GenGetBatteryType,%__IntVector +IntEntry GenSetBatteryType,%__IntVector +IntEntry GenEnvBufferGet,%__IntVector +IntEntry GenEnvBufferSet,%__IntVector +IntEntry GenEnvBufferDelete,%__IntVector +IntEntry GenEnvBufferFind,%__IntVector +IntEntry GenEnvStringGet,%__IntVector +IntEntry GenEnvStringSet,%__IntVector +IntEntry GenEnvStringDelete,%__IntVector +IntEntry GenEnvStringFind,%__IntVector +IntEntry GenCrc,%__IntVector +IntEntry GenRomVersion,%__IntVector +IntEntry GenAlarmHook,%__IntVector +IntEntry GenAlarmUnHook,%__IntVector +IntEntry GenAlarmId,%__IntVector +IntEntry GenPasswordSet,%__IntVector +IntEntry GenPasswordTest,%__IntVector +IntEntry GenPasswordControl,%__IntVector +IntEntry GenPasswordQuery,%__IntVector +IntEntry GenTickle,%__IntVector +IntEntry GenSetConfig,%__IntVector +IntEntry GenMaskInit,%__IntVector +IntEntry GenMaskEncrypt,%__IntVector +IntEntry GenMaskDecrypt,%__IntVector +IntEntry GenSetOnEvents,%__IntVector +IntEntry GenGetAutoMains,%__IntVector +IntEntry GenSetAutoMains,%__IntVector +IntEntry GenCsToDsAlias,%__IntVector +IntEntry GenDsToCsAlias,%__IntVector +IntEntry GenSetCapsLockMode,%__IntVector +; +BeginInterrupt FloatManager,%__IntBase +ifndef SmallInclude +IntEntry FloatSin,%__IntVector +IntEntry FloatCos,%__IntVector +IntEntry FloatTan,%__IntVector +IntEntry FloatASin,%__IntVector +IntEntry FloatACos,%__IntVector +IntEntry FloatATan,%__IntVector +IntEntry FloatExp,%__IntVector +IntEntry FloatLn,%__IntVector +IntEntry FloatLog,%__IntVector +IntEntry FloatSqrt,%__IntVector +IntEntry FloatPow,%__IntVector +IntEntry FloatRand,%__IntVector +IntEntry FloatMod,%__IntVector +IntEntry FloatInt,%__IntVector +endif +; +BeginInterrupt WservOpcodes,%__IntBase +; +BeginInterrupt HardwareManager,%__IntBase +ifndef SmallInclude +IntEntry HwComboOn,%__IntVector +IntEntry HwComboOff,%__IntVector +IntEntry HwPacksOn,%__IntVector +IntEntry HwPacksOff,%__IntVector +IntEntry HwSetA2Control1Bits,%__IntVector +IntEntry HwClearA2Control1Bits,%__IntVector +IntEntry HwReadA2Control1,%__IntVector +IntEntry HwWriteA2Control1,%__IntVector +IntEntry HwSetA2Control2Bits,%__IntVector +IntEntry HwClearA2Control2Bits,%__IntVector +IntEntry HwReadA2Control2,%__IntVector +IntEntry HwWriteA2Control2,%__IntVector +IntEntry HwSetA2Control3Bits,%__IntVector +IntEntry HwClearA2Control3Bits,%__IntVector +IntEntry HwReadA2Control3,%__IntVector +IntEntry HwWriteA2Control3,%__IntVector +IntEntry HwSelectChannel,%__IntVector +IntEntry HwGetSupplyStatus,%__IntVector +IntEntry HwLcdContrastDelta,%__IntVector +IntEntry HwReadLcdContrast,%__IntVector +IntEntry HwSwitchOff,%__IntVector +IntEntry HwNullFrame,%__IntVector +IntEntry HwExit,%__IntVector +IntEntry HwGetCombo,%__IntVector +IntEntry HwFreeCombo,%__IntVector +IntEntry HwGetChannel,%__IntVector +IntEntry HwFreeChannel,%__IntVector +IntEntry HwGetPsuType,%__IntVector +IntEntry HwSupplyWarnings,%__IntVector +IntEntry HwForceSupplyReading,%__IntVector +IntEntry HwGetBackLight,%__IntVector +IntEntry HwSetBackLight,%__IntVector +IntEntry HwBackLight,%__IntVector +IntEntry HwComboOnInput,%__IntVector +IntEntry HwSupplyInfo,%__IntVector +IntEntry HwScreenSeg,%__IntVector +IntEntry HwGetScreenMode,%__IntVector +IntEntry HwSetScreenMode,%__IntVector +IntEntry HwSetPCurrent,%__IntVector +IntEntry HwSetFCurrent,%__IntVector +IntEntry HwGetScanCodes,%__IntVector +IntEntry HwGetSsdData,%__IntVector +IntEntry HwResetBatteryStatus,%__IntVector +IntEntry HwEnableAutoBatReset,%__IntVector +IntEntry HwGetBatData,%__IntVector +IntEntry HwDetectSoakTestFixture,%__IntVector +IntEntry HwReLogPacks,%__IntVector +IntEntry HwSetIRPowerLevel,%__IntVector +IntEntry HwReturnTickCount,%__IntVector +IntEntry HwReturnExpansionPortState,%__IntVector +IntEntry HwExpansionOn,%__IntVector +IntEntry HwExpansionOff,%__IntVector +endif +; +BeginInterrupt GenDataSegment,%__IntBase +BeginInterrupt ProcPanic,%__IntBase +BeginInterrupt ProcCopyFromById,%__IntBase +BeginInterrupt ProcCopyToById,%__IntBase +BeginInterrupt CharIsDigit,%__IntBase +BeginInterrupt CharIsHexDigit,%__IntBase +BeginInterrupt CharIsPrintable,%__IntBase +BeginInterrupt CharIsAlphabetic,%__IntBase +BeginInterrupt CharIsAlphaNumeric,%__IntBase +BeginInterrupt CharIsUpperCase,%__IntBase +BeginInterrupt CharIsLowerCase,%__IntBase +BeginInterrupt CharIsSpace,%__IntBase +BeginInterrupt CharIsPunctuation,%__IntBase +BeginInterrupt CharIsGraphic,%__IntBase +BeginInterrupt CharIsControl,%__IntBase +BeginInterrupt CharToUpperChar,%__IntBase +BeginInterrupt CharToLowerChar,%__IntBase +BeginInterrupt CharToFoldedChar,%__IntBase +BeginInterrupt BufferCopy,%__IntBase +BeginInterrupt BufferSwap,%__IntBase +BeginInterrupt BufferCompare,%__IntBase +BeginInterrupt BufferCompareFolded,%__IntBase +BeginInterrupt BufferMatch,%__IntBase +BeginInterrupt BufferMatchFolded,%__IntBase +BeginInterrupt BufferLocate,%__IntBase +BeginInterrupt BufferLocateFolded,%__IntBase +BeginInterrupt BufferSubBuffer,%__IntBase +BeginInterrupt BufferSubBufferFolded,%__IntBase +BeginInterrupt BufferJustify,%__IntBase +BeginInterrupt StringCopy,%__IntBase +BeginInterrupt StringCopyFolded,%__IntBase +BeginInterrupt StringConvertToFolded,%__IntBase +BeginInterrupt StringCompare,%__IntBase +BeginInterrupt StringCompareFolded,%__IntBase +BeginInterrupt StringMatch,%__IntBase +BeginInterrupt StringMatchFolded,%__IntBase +BeginInterrupt StringLocate,%__IntBase +BeginInterrupt StringLocateFolded,%__IntBase +BeginInterrupt StringLocateInReverse,%__IntBase +BeginInterrupt StringLocateInReverseFolded,%__IntBase +BeginInterrupt StringSubString,%__IntBase +BeginInterrupt StringSubStringFolded,%__IntBase +BeginInterrupt StringLength,%__IntBase +BeginInterrupt StringValidateName,%__IntBase +BeginInterrupt LongIntCompare,%__IntBase +BeginInterrupt LongIntMultiply,%__IntBase +BeginInterrupt LongIntDivide,%__IntBase +BeginInterrupt LongUnsignedIntCompare,%__IntBase +BeginInterrupt LongUnsignedIntMultiply,%__IntBase +BeginInterrupt LongUnsignedIntDivide,%__IntBase +BeginInterrupt FloatAdd,%__IntBase +BeginInterrupt FloatSubtract,%__IntBase +BeginInterrupt FloatMultiply,%__IntBase +BeginInterrupt FloatDivide,%__IntBase +BeginInterrupt FloatCompare,%__IntBase +BeginInterrupt FloatNegate,%__IntBase +BeginInterrupt FloatToInt,%__IntBase +BeginInterrupt FloatToUnsignedInt,%__IntBase +BeginInterrupt FloatToLong,%__IntBase +BeginInterrupt FloatToUnsignedLong,%__IntBase +BeginInterrupt IntToFloat,%__IntBase +BeginInterrupt UnsignedIntToFloat,%__IntBase +BeginInterrupt LongToFloat,%__IntBase +BeginInterrupt UnsignedLongToFloat,%__IntBase +BeginInterrupt LibSend,%__IntBase +BeginInterrupt LibSendSuper,%__IntBase +BeginInterrupt LibSendExact,%__IntBase +BeginInterrupt LibEnter,%__IntBase +BeginInterrupt LibLeave,%__IntBase +BeginInterrupt Dummy,%__IntBase +BeginInterrupt GenIntByNumber,%__IntBase +BeginInterrupt WservFunctions,%__IntBase +BeginInterrupt LibSendExit,%__IntBase +BeginInterrupt DbfManager,%__IntBase +ifndef SmallInclude +IntEntry DbfOpen,%__IntVector +IntEntry DbfClose,%__IntVector +IntEntry DbfFlush,%__IntVector +IntEntry DbfTrash,%__IntVector +IntEntry DbfCopyDown,%__IntVector +IntEntry DbfCompress,%__IntVector +IntEntry DbfCopyFile,%__IntVector +IntEntry DbfFileSize,%__IntVector +IntEntry DbfExtHeaderRead,%__IntVector +IntEntry DbfExtHeaderWrite,%__IntVector +IntEntry DbfVersion,%__IntVector +IntEntry DbfAbsReadSense,%__IntVector +IntEntry DbfAbsRead,%__IntVector +IntEntry DbfNextRead,%__IntVector +IntEntry DbfBackRead,%__IntVector +IntEntry DbfFirstRead,%__IntVector +IntEntry DbfLastRead,%__IntVector +IntEntry DbfAppend,%__IntVector +IntEntry DbfEraseRead,%__IntVector +IntEntry DbfUpdate,%__IntVector +IntEntry DbfFindRead,%__IntVector +IntEntry DbfSense,%__IntVector +IntEntry DbfCount,%__IntVector +IntEntry DbfDescRecordRead,%__IntVector +IntEntry DbfDescRecordWrite,%__IntVector +IntEntry DbfFindReadField,%__IntVector +endif +BeginInterrupt LibEnterSend,%__IntBase +BeginInterrupt IoKeyAndMouseStatus,%__IntBase +BeginInterrupt StringCapitalise,%__IntBase +BeginInterrupt ProcIndStringCopyFromById,%__IntBase +BeginInterrupt IoNextHalfSecondStatus,%__IntBase + +BeginInterrupt IoSerManager,%__IntBase +ifndef SmallInclude +IntEntry IoSerOpen,%__IntVector +IntEntry IoSerAddHandler,%__IntVector +IntEntry IoSerRemoveHandler,%__IntVector +IntEntry IoSerSetHandler,%__IntVector +IntEntry IoSerHandlerSaveError,%__IntVector +IntEntry IoSerOpenHandler,%__IntVector +IntEntry IoSerOpenTimerHandler,%__IntVector +IntEntry IoSerFree,%__IntVector +IntEntry IoSerCloseTimerHandler,%__IntVector +IntEntry IoSerDetachFree,%__IntVector +IntEntry IoSerTimerOpen,%__IntVector +IntEntry IoSerTimerCancel,%__IntVector +IntEntry IoSerTimerClose,%__IntVector +IntEntry IoSerAttachOnOpenChan,%__IntVector +IntEntry IoSerSenseOnOpenChan,%__IntVector +IntEntry IoSerOnOpenChan,%__IntVector +IntEntry IoSerCheckWriteSI,%__IntVector +IntEntry IoSerCheckReadSI,%__IntVector +IntEntry IoSerSignalUserWriteOk,%__IntVector +IntEntry IoSerSignalUserWrite,%__IntVector +IntEntry IoSerSignalUserReadOk,%__IntVector +IntEntry IoSerSignalUserRead,%__IntVector +IntEntry IoSerSignalUser,%__IntVector +IntEntry IoSerQueueRead,%__IntVector +IntEntry IoSerQueueWrite,%__IntVector +IntEntry IoSerQueueSuper,%__IntVector +IntEntry IoSerQueueTimer,%__IntVector +IntEntry IoSerCancelIoRequest,%__IntVector +IntEntry IoSerCancelAllSignalUser,%__IntVector +IntEntry IoSerSignalCompleteOK,%__IntVector +IntEntry IoSerSignalComplete,%__IntVector +IntEntry IoSerSyncWrite,%__IntVector +endif +BeginInterrupt HwSetRomBank,%__IntBase +BeginInterrupt HwGetRomBank,%__IntBase +BeginInterrupt IoActivity,%__IntBase + .list + diff --git a/code/SIBOSDK/ldd/epocpan.inc b/code/SIBOSDK/ldd/epocpan.inc new file mode 100644 index 0000000..b59201e --- /dev/null +++ b/code/SIBOSDK/ldd/epocpan.inc @@ -0,0 +1,91 @@ + .xlist +; Include file - EPOCPAN.INC +; Epoc/Os standard panic number include file +; Copyright (c) Psion PLC 1989-90. +; +; VER DATE BY DESCRIPTION +; ----- -------- ---- ----------- +; 2.00F 30/09/90 NSM Final release +; +EPOCPAN_INC = 1 +; +PanicTest0 = 00 ; Test code panic +PanicSem0 = 01 ; Invalid function number for semaphore manager +PanicSem1 = 02 ; Semaphore number out of range +PanicSem2 = 03 ; Semaphore not allocated +PanicSem3 = 04 ; Initial semaphore count not 0 or +ve +PanicSem4 = 05 ; Signal count not >= 0 +PanicProc0 = 06 ; Invalid function number for process manager +PanicProc1 = 07 ; Process Id out of range +PanicProc2 = 08 ; Task tried to create a task +PanicTim0 = 09 ; Invalid function number for time manager +PanicSeg0 = 10 ; Invalid function number for segment manager +PanicSeg1 = 11 ; Size was negative +PanicSeg2 = 12 ; Type was neither CreateLow or High or Device +PanicSeg3 = 13 ; Segment handle was invalid +PanicSeg4 = 14 ; Segment copy would have been out of range +PanicHeap0 = 15 ; Invalid function number for heap manager +PanicHeap1 = 16 ; Heap is not allocated +PanicHeap2 = 17 ; Cell being reduced by more than its size +PanicHeap3 = 18 ; Attempt to set heap granularity > MaxHeapGrowBy +PanicHeap4 = 19 ; Cell base address invalid +PanicMess0 = 20 ; Invalid function number for message manager +PanicMess1 = 21 ; Messages are already initialized +PanicMess2 = 22 ; Messages are not initialized +PanicMess3 = 23 ; Cannot initialize with 0 messages in the que +PanicIo0 = 24 ; Invalid function number for I/o manager +PanicIo1 = 25 ; Invalid Io channel +PanicIo2 = 26 ; Device requested panic +PanicIo3 = 27 ; Invalid handler handle +PanicIo4 = 28 ; Key and Mouse already hooked +PanicIo5 = 29 ; Key and Mouse requesting process is not a task +PanicDev0 = 30 ; Invalid function number for device manager +PanicDev1 = 31 ; Inavlid device handle +PanicFile0 = 32 ; Invalid function number for file manager +PanicFile1 = 33 ; Process already connected to file server +PanicFile2 = 34 ; Argument was'nt IoFuncSet or IoFuncSense +PanicLib0 = 35 ; Invalid function number for library manager +PanicLib1 = 36 ; Invalid library handle +PanicLib2 = 37 ; Invalid function number for library +PanicLib3 = 38 ; Invalid LIB file channel +PanicLib4 = 39 ; Invalid DYL index number +PanicFs0 = 40 ; Invalid message to file server +PanicFs1 = 41 ; Process has not connected to file server +PanicConv0 = 42 ; Invalid function number for conversion manager +PanicGen0 = 43 ; Invalid function number for general manager +PanicGen1 = 44 ; Attempt to unhook from alarm or notify when not already hooked +PanicGen2 = 45 ; Invalid revector address +PanicFlt0 = 46 ; Invalid function number for conversion manager +PanicEnter0 = 47 ; Leave called before a call to enter +PanicObj0 = 48 ; No method available to handle message +PanicObj1 = 49 ; Invalid reclass attempted +PanicObj2 = 50 ; Unknown category in LibHandle +PanicObj3 = 51 ; Unknown class in LibCreate +PanicObj4 = 52 ; Supersend called from outside a method +PanicObj5 = 53 ; Attempt to get a handle before being linked +PanicObj6 = 54 ; Missing external categories in LibLink +PanicObj7 = 55 ; Object does not point to a valid class +PanicLink0 = 56 ; Invalid link layer completion code +PanicWin0 = 57 ; Invalid function number for window manager +PanicHw0 = 58 ; Invalid function number for hardware manager +PanicHw1 = 59 ; Unexpected interrupt +PanicHw2 = 60 ; User wrote out of range +PanicHw3 = 61 ; User left interrupts off +PanicHaymd0 = 62 ; Bad things going on in the i/o system +PanicDivide = 63 ; Divide by zero interrupt +PanicOverflow = 64 ; Overflow interrupt +PanicDbf0 = 65 ; Invalid function number for Dbf manager +PanicDbf1 = 66 ; Invalid DBF Io channel +PanicDbf2 = 67 ; Invalid parameter for DBF function +PanicDead0 = 68 ; Address 0 overwrite +PanicStack0 = 69 ; Stack below 100h +PanicEnv0 = 70 ; Environment name size > EnvMaxNameSize +PanicSStep = 71 ; Single step interrupt +PanicBreak = 72 ; Break point interrupt +PanicIoPending = 73 ; Io was already pending +PanicIoSer0 = 74 ; Invalid function number for serial I/O manager +PanicIoAsic9 = 75 ; Call to an asic1 function on asic9 machines +PanicLib5 = 76 ; Trying to find a .DYL not in a visible bank +PanicEM$1 = 77 ; FP Emulator exception +PanicSem5 = 78 ; Semaphore count exceeds 07fffh + .list diff --git a/code/SIBOSDK/ldd/epocser.inc b/code/SIBOSDK/ldd/epocser.inc new file mode 100644 index 0000000..319bc43 --- /dev/null +++ b/code/SIBOSDK/ldd/epocser.inc @@ -0,0 +1,298 @@ + .xlist +; Include file - EPOCSER.INC +; Epoc/Os standard Serial Driver defines +; Copyright (c) Psion PLC 1989-90. +; +; VER DATE BY DESCRIPTION +; ----- -------- ---- ----------- +; 2.00F 30/09/90 JH Final release +; 2.01F 05/10/90 JH Added a define for Constant speed DTE modems +; +EPOCSER_INC equ 1 +; Serial port characteristics +SerialCharEnt struc + SerialCharTbaud db ? ; transmit Baud rate selector + SerialCharRbaud db ? ; receive Baud rate selector + SerialCharFrame db ? ; number of data, parity and stop bits + SerialCharParity db ? ; parity selector + SerialCharHandshake db ? ; handshake flags + SerialCharXon db ? ; XON character + SerialCharXoff db ? ; XOFF character + SerialCharFlags db ? ; control flags + SerialCharTmask dd ? ; terminator mask +SerialCharEnt ends + +; Function numbers to use to call PDD functions +SerPDDFuncOpen equ 0 +SerPDDFuncClose equ 2 +SerPDDFuncStart equ 4 +SerPDDFuncStop equ 6 +SerPDDFuncSet equ 8 +SerPDDFuncSense equ 10 +SerPDDFuncControl equ 12 +SerPDDFuncEnquire equ 14 +SerPDDFuncEnable equ 16 +SerPDDFuncSetHandlerCS equ 18 + +; +SERPARITY_ERR equ 0ffh +SERFRAME_ERR equ 0feh +SEROVERRUN_ERR equ 0fdh + +SERNOCHAR equ 0ffffh + +; Baud rates +P_BAUD_50 equ 01h +P_BAUD_75 equ 02h +P_BAUD_110 equ 03h +P_BAUD_134 equ 04h +P_BAUD_150 equ 05h +P_BAUD_300 equ 06h +P_BAUD_600 equ 07h +P_BAUD_1200 equ 08h +P_BAUD_1800 equ 09h +P_BAUD_2000 equ 0Ah +P_BAUD_2400 equ 0Bh +P_BAUD_3600 equ 0Ch +P_BAUD_4800 equ 0Dh +P_BAUD_7200 equ 0Eh +P_BAUD_9600 equ 0Fh +P_BAUD_19200 equ 10h +P_BAUD_38400 equ 11h +P_BAUD_56000 equ 12h +P_BAUD_115000 equ 13h + +; allocation of frame bits +P_DATA_FRM equ 0fh ; number of data bits mask +P_DATA_5 equ 0h ; 5 data bits +P_DATA_6 equ 1h ; 6 data bits +P_DATA_7 equ 2h ; 7 data bits +P_DATA_8 equ 3h ; 8 data bits +P_TWOSTOP equ 10h ; 2 stop bits if set, 1 if clear +P_PARITY equ 20h ; 1 parity bit if set, 0 if clear + +; parity - ignored unless P_PARITY is set +P_PAR_EVEN equ 1h ; even parity +P_PAR_ODD equ 2h ; odd parity +P_PAR_MARK equ 3h ; mark parity +P_PAR_SPACE equ 4h ; space parity + +; handshaking control +P_OBEY_XOFF equ 01h ; respond to received XOFF (and XON) if set +P_SEND_XOFF equ 02h ; send XOFF/XON to control receive buf if set +P_IGN_CTS equ 04h ; ignore the state of CTS if set +P_OBEY_DSR equ 08h ; obey the state of DSR if set +P_FAIL_DSR equ 10h ; fail if DSR goes OFF if set +P_OBEY_DCD equ 20h ; obey the state of DCD if set +P_FAIL_DCD equ 40h ; fail if DCD goes OFF if set + +; flags control +P_IGNORE_PARITY equ 01h ; ignore parity errors + +; For P_FCTRL function +P_SRCTRL_CTS equ 01h +P_SRCTRL_DSR equ 02h +P_SRCTRL_DCD equ 04h +P_SRCTRL_DTR equ 08h +P_SRCTRL_RTS equ 10h + +P_SRDTR_ON equ 1h ; to set DTR to MARK +P_SRDTR_OFF equ 2h ; to set DTR to SPACE + +; Bit masks for P_FINQ function +P_SRINQ_50 equ 0001h +P_SRINQ_75 equ 0002h +P_SRINQ_110 equ 0004h +P_SRINQ_134 equ 0008h +P_SRINQ_150 equ 0010h +P_SRINQ_300 equ 0020h +P_SRINQ_600 equ 0040h +P_SRINQ_1200 equ 0080h +P_SRINQ_1800 equ 0100h +P_SRINQ_2000 equ 0200h +P_SRINQ_2400 equ 0400h +P_SRINQ_3600 equ 0800h +P_SRINQ_4800 equ 1000h +P_SRINQ_7200 equ 2000h +P_SRINQ_9600 equ 4000h +P_SRINQ_19200 equ 8000h +; second baud rate word +P_SRINQ_38400 equ 0001h +P_SRINQ_56000 equ 0002h + +; 2nd set of info +P_SRINQ_DATA5 equ 0001h ; supports 5 data bits +P_SRINQ_DATA6 equ 0002h ; supports 6 data bits +P_SRINQ_DATA7 equ 0004h ; supports 7 data bits +P_SRINQ_DATA8 equ 0008h ; supports 8 data bits +P_SRINQ_STOP2 equ 0010h ; supports 2 stop bits (as well as 1) +P_SRINQ_PAREVEN equ 0020h ; supports even parity +P_SRINQ_PARODD equ 0040h ; supports odd parity +P_SRINQ_PARMARK equ 0080h ; supports mark parity +P_SRINQ_PARSPACE equ 0100h ; supports space parity +P_SRINQ_SETDTR equ 0200h ; can set DTR +P_SRINQ_SPLIT equ 0400h ; supports split Baud rates +P_SRINQ_XONXOFF equ 0800h ; Supports soft xon/xoff characters + +; CRC generator section +; The Low and High bytes of the 16 bit CRC +CrcEnt struc + CrcLow db ? ; CRC low byte + CrcHigh db ? ; CRC high byte +CrcEnt ends + +;Serial Driver Media Access Control section (LLMAC) +; +P_MAXILEN equ 300 ; maximum length of information field + +;Frame type codes +LA_LPDU equ 0 ; The Link Acknowledge PDU +LD_LPDU equ 1 ; The Link disconnect PDU +LR_LPDU equ 2 ; The Link Request PDU +LT_LPDU equ 3 ; The Link Data PDU +P_FRM_BROKEN equ 4 ; A broken frame + +FrameEnt struc + FrameType db ? ; frame type + FrameSeq db ? ; frame sequence + FrameLen dw ? ; length of information field + FramePbuf dw ? ; ptr to data buffer +FrameEnt ends + +; LLMAC layer characteristics +LlmacEnt struc + LlmacIlen dw ? ; maximum information field length + LlmacSpeed dw ? ; nominal speed in characters per second + LlmacRtint dw ? ; suggested retransmission interval +LlmacEnt ends + +; LINK layer structures and defines +; IoFuncConnect service connection modes */ +P_LINK_ACCP equ 0 ; want link as acceptor +P_LINK_INIT equ 1 ; want link as initiator + +; Link layer states +P_LINK_IDLE equ 0 ; no connection - idle +P_LINK_IDLE_LR equ 1 ; no connection - awaiting LR +P_LINK_DATA_IDLE equ 2 ; connected - idle +P_LINK_DATA_LA equ 3 ; connected - awaiting LA +P_LINK_IDLE_LA equ 4 ; not connected - awaiting LA (or LT) to LR + +;State and event log record +LinkLogEnt struc + LinkLogState db ? ; Link layer state (as defined above) + LinkLogEvent db ? ; Event that occured +LinkLogEnt ends + +P_LINK_NLOG equ 32 ; Max number of debug events,states we record +P_LINK_LOG_MASK equ 0C0h +P_LINK_LOG_PANIC equ 0C0h ; panic number +P_LINK_LOG_MAC equ 0 ; MAC request or timer +P_LINK_LOG_REQ equ 80h ; User request +P_LINK_LOG_COMP equ 40h ; User completion + +LinkDataEnt struc + LinkDataLlmac LlmacEnt <> + LinkDataBrokenCount dw ? ; count of broken frames + LinkDataRetranCount dw ? ; re-transmission count +LinkDataEnt ends + +; Comms I/O drivers shared code header structs +; Flag defines +RQ_TIMER equ 01h ; a timer has been started +RQ_SUPER equ 02h ; a supervisory read has been started +RQ_WRITE equ 04h ; a write has been started +RQ_READ equ 08h ; a data read has been started +RQ_DISABLE_HANDLER equ 10h ; set to disable handers +RQ_ANY equ (RQ_TIMER or RQ_SUPER or RQ_WRITE or RQ_READ) + +;Flag bits to indicate various features of the link layer event. +QUEUE_XMIT_LA equ 20h ; queue an LA when the transmit completes +LINK_ACTIVE equ 40h ; set between a P_FCONNECT and a disconnect +USER_DATA_PENDING equ 80h + +; DONT CHANGE THE ORDER OF THIS !! +IoRequestEnt struc + IoRequestChan ChanEnt <> ; I/O control block + IoRequestWaitHandler dw ? ; wait handler vector number + IoRequestRqRead RqEnt <> ; Read request packet + IoRequestRqWrite RqEnt <> ; Write request packet + IoRequestRqSuper RqEnt <> ; Supervisorry request packet + IoRequestTimerPcb dw ? ; open Timer cb + IoRequestTimerStat dw ? ; timer completion status + IoRequestReadStat dw ? ; read completion status + IoRequestWriteStat dw ? ; write completion status + IoRequestSuperStat dw ? ; supervisory completion status + IoRequestFlags db ? ; controlling flags + IoRequestState db ? ; current internal state +IoRequestEnt ends + +LnkEnt struc + LnkIoRequest IoRequestEnt <> ; I/O header + LnkLinkData LinkDataEnt <> ; Link layer data + LnkNumberLog dw ? ; current log table event no. + LnkLogTable db (size LinkLogEnt)*P_LINK_NLOG dup (?) +LnkEnt ends + +; XMODEM structures and defines +; IoFuncConnect service connection modes */ +P_XMDM_ACCP equ 0 ; want link as acceptor +P_XMDM_INIT equ 1 ; want link as initiator + +; Xmodem link types +P_XMDM_CRCORCHECKSUM equ 0 +P_XMDM_CRCMODE equ 1 +P_XMDM_CHECKSUMMODE equ 2 +P_YMODEM_MODE equ 3 +P_YMODEM_G_MODE equ 4 +P_XMDM_ONE_K equ 8000h + +;Xmodem/Ymodem supported flags +P_FXMDM_SENSE equ 0ffh ; I/O function number +P_XSUP_XMODEM equ 01h ; original Xmodem checksum +P_XSUP_XMODEM_CRC equ 02h ; Xmodem with CRC +P_XSUP_ONE_K_OPTION equ 04h ; 1k frames +P_XSUP_YMODEM equ 08h ; Ymodem +P_XSUP_YMODEM_G equ 10h ; Ymodem-G + +; Xmodem State defines +P_XMDM_IDLE equ P_LINK_IDLE ; idle state (no connection) +P_XMDM_CONNECT_RECEIVE equ 1 ; receive connect state +P_XMDM_CONNECT_TRANSMIT equ 2 ; Transmit connect state +P_XMDM_DATA_RECEIVE equ 3 ; receive data state +P_XMDM_DATA_TRANSMIT equ 4 ; transmit data state +P_XMDM_DATA_TRANSMIT_ACK equ 5 ; awaiting ACK to transmitted data + +;State and event log record +XmdmLogEnt struc + LinkLogEnt <> +XmdmLogEnt ends + +P_XMDM_NLOG equ P_LINK_NLOG ; Max number of debug events,states we record +P_XMDM_LOG_MASK equ P_LINK_LOG_MASK +P_XMDM_LOG_PANIC equ P_LINK_LOG_PANIC ; panic number +P_XMDM_LOG_REQ equ P_LINK_LOG_REQ ; User request +P_XMDM_LOG_COMP equ P_LINK_LOG_COMP ; User completion + +; Modem driver info +; what options are selected +P_MDM_TONE equ 01h +P_MDM_BELL equ 02h +P_MDM_NO_MODULATION equ 04h +P_MDM_CONSTANT_SPEED equ 08h ; modem provides constant speed interface if set + +; error correction types +P_MDM_ERRCORRECT_NONE equ 00h +P_MDM_ERRCORRECT equ 01h +P_MDM_ERRCORRECT_MNP equ 02h +P_MDM_ERRCORRECT_V42 equ 03h + +ModemCharEnt struc + ModemCharSupport dw ? ; flags saying what supported + ModemCharOptions dw ? ; Selected options + ModemCharBaudRate dw ? ; Baud rate running at + ModemCharConnHand db ? ; Connected handshaking + ModemCharCallHand db ? ; Wait for call handshaking +ModemCharEnt ends + + .list diff --git a/code/SIBOSDK/ldd/makefile b/code/SIBOSDK/ldd/makefile new file mode 100644 index 0000000..e2345f6 --- /dev/null +++ b/code/SIBOSDK/ldd/makefile @@ -0,0 +1,24 @@ +TASM = C:\BC\TASM +TLINK = C:\BC\TLINK +EMAKE = C:\TOOLS\EMAKE +all: snddvr.img sndfrc.img atimdvr.img +snddvr.img: snddvr.exe + $(EMAKE) -s -t2 snddvr +snddvr.exe: snddvr.obj + $(TLINK) /v /n snddvr +snddvr.obj: snddvr.asm + $(TASM) /ml snddvr.asm,snddvr.obj +sndfrc.img: sndfrc.exe + $(EMAKE) -s -t2 sndfrc +sndfrc.exe: sndfrc.obj + $(TLINK) /v /n sndfrc +sndfrc.obj: sndfrc.asm + $(TASM) /ml sndfrc.asm,sndfrc.obj +atimdvr.img: atimdvr.exe + $(EMAKE) -s -t2 atimdvr +atimdvr.exe: atimdvr.obj + $(TLINK) /v /n atimdvr +atimdvr.obj: atimdvr.asm + $(TASM) /ml atimdvr.asm,atimdvr.obj + + diff --git a/code/SIBOSDK/ldd/ossibo.inc b/code/SIBOSDK/ldd/ossibo.inc new file mode 100644 index 0000000..2d856fe --- /dev/null +++ b/code/SIBOSDK/ldd/ossibo.inc @@ -0,0 +1,241 @@ + .xlist +; Include file - OSSIBO.INC +; Epoc/Os Sibo include file. +; Copyright (c) Psion PLC 1989-90. +; +; VER DATE BY DESCRIPTION +; ----- -------- ---- ----------- +; 2.00F 30/09/90 NSM Final release +; +NoNullFrames equ 1 +; +A1Ent struc +A1Dummy dw ? +A1Control dw ? +A1LcdSize dw ? +A1LcdControl dw ? +A1InterruptMask dw ? +A1NonSpecificEoi dw ? +A1TimerEoi dw ? +A1FrcEoi dw ? +A1ResetWatchDog dw ? +A1FrcControl dw ? +A1ProtectionOn dw ? +A1ProtectionUpper dw ? +A1ProtectionLower dw ? +A1SoundLsw dw ? +A1SoundMsw dw ? +A1SoundControl dw ? +A1Ent ends +; +A1Status equ A1Control +A1ProtectionOff equ A1ProtectionOn +A1InterruptStatus equ A1LcdControl +; +A1StatusR record LcdData:2,Rtc4Hz:1,SldMsw:1,ComboBusy:1,Rtc32Hz:1,ExternalNmi:1,WatchDogNmi:1,SldTx:1,A1SldEnable:1,LcdEnable:1,Ram512:1,Ram128:1,FrcSource:1,TickRate:1,FrcMode:1 +A1LcdSizeR record LcdMLineEnable:1,LcdNumberOfPixels:5,LcdEndOfFrame:10 +A1LcdControlR record LcdMode:2,LcdMLineRate:5,LcdRate:5 +A1InterruptMaskR record SldTransmit:1,SldReceive:1,FrcExpired:1,Asic2Int:1,ExpIntLeftA:1,ExpIntRightB:1,Mains:1,Timer:1 +ExpAddressLeftA equ 0200h +ExpAddressRightB equ 0100h +ExpChannelLeftA equ SelectChannel6 +ExpChannelRightB equ SelectChannel5 +; +A2Ent struc +A2Dummy db 080h dup(?) +A2Index dw ? +A2Control dw ? +A2Control1 dw ? +A2Control2 dw ? +A2Control3 dw ? +A2SerialData dw ? +A2SerialControl dw ? +A2ChannelControl dw ? +A2Ent ends +; +A2External equ A2Control1 +A2InterruptStatus equ A2Control2 +A2Status equ A2Control3 +A2KeyData equ A2SerialControl +A2SlaveData equ A2ChannelControl +A2IControl0 equ 0 +A2IControl1 equ 1 +A2IWrite equ 2 +A2IDDR equ 3 +; +A2InterruptStatusR record SlaveDataOverrun:1,SlaveDataControl:1,SlaveDataValid:1,ExpansionInterrupt:1,DoorInterrupt:1 +A2StatusR record A2RevId:1,A2XExt:1,A2Sdis:1,SerialBusy:1,SerialClockState:1,ResetFlag:1,WakeUp:1,OnKey:1 +A2Control1R record SerialClockRate:2,KeyScan:4 +A2Control2R record ClockEnable7:1,ClockEnable6:1,ClockEnable5:1,BuzzerMode:1,BuzzerVolume:1,BuzzerToggle:1,XySwitch:1,DigitizerEnable:1 +A2Control3R record ElEnable:1,VhControl:1,ExpansionEnable:1,DoorEnable:1,SerialEnable:1,A2SldEnable:1,Ps34Acknowledge:1,SerialNull:1 +A2ChannelControlR record MultiplexEnable:1,ChannelSelect:3,Pack4Enable:1,Pack3Enable:1,Pack2Enable:1,Pack1Enable:1 +; +SerialWriteSingle equ 10000000b +SerialWriteMulti equ 10010000b +SerialReadSingle equ 11000000b +SerialReadMulti equ 11010000b +SerialReset equ 00000000b +SerialSelect equ 01000000b +ClockRateSlow equ 2 +ClockRateMedium equ 0 +ClockRateFast equ 3 +SelectChannel0 equ (4 shl ChannelSelect) +SelectChannel1 equ (mask Pack1Enable) +SelectChannel2 equ (mask Pack2Enable) +SelectChannel3 equ (mask Pack3Enable) +SelectChannel4 equ (mask Pack4Enable) +SelectChannel5 equ (5 shl ChannelSelect) +SelectChannel6 equ (6 shl ChannelSelect) +SelectChannel7 equ (7 shl ChannelSelect) +; +Asic4Id equ 001h +Asic5PackId equ 002h +Asic5NormalId equ 003h +Asic6Id equ 004h +Asic8Id equ 005h +Asic2SlaveId equ 01fh +; +A3Ent struc +A3Adc db ? +A3Control1 db ? +A3Setup db ? +A3Control2 db ? +A3Dummy1 db 3 dup (?) +A3Control3 db ? +A3Dummy2 db 5 dup (?) +A3Status db ? +A3Dummy3 db ? +A3Ent ends +; +A3AdcLsbR record InvertedBit:1,OtherBits:7 +A3AdcMsbR record Polarity:1,Overrange:1,AdcBits:4 +A3Control1R record Vcc5Enable:1,Vcc4Enable:1,Vcc3Enable:1,DtoaBits:5 +A3Control2R record AnalogueMultiplex:2,VhSoftStart:1,Vee2SoftStart:1,Vee1SoftStart:1,VhEnable:1,Vee2Enable:1,Vee1Enable:1 +A3Control3R record AdcReadHighEnable:1,OffEnable:1,xDummy1:1 +A3StatusR record PowerFail:1,ColdStart:1 +Ps34ControlR record Ps34Vcc3:1,xDummy2:1,Ps34Vcc4:1,xDummy3:1,Ps34Vcc5:1,xDummy4:3 +; +AdcDigitizer equ 0 +AdcVh equ 1 +AdcMainBattery equ 2 +AdcLithiumBattery equ 3 +A3SetupValue equ 2 +A3SelectId equ (SerialSelect or Asic5NormalId) +A3InfoByte equ 080h +; +Vee1SoftStartDelay equ (30*128) +Vee2SoftStartDelay equ (30*128) +VhSoftStartDelay equ (100*128) +Vee1OffDelay equ (100*128) +Vee2OffDelay equ (100*128) +VhOffDelay equ (100*128) +Vcc3Delay equ (25*128) +Vcc4Delay equ (25*128) +Vcc5Delay equ (25*128) +Vcc1_4To5Delay equ (3) ; Pan only in ms. +; +PS34R_ADC equ 0 +PS34R_STATUS equ 1 +PS34W_CONTROL equ 0 +PS34W_DTOA equ 1 +PS34W_OFF equ 0eh +; +PS34STATR record pPowerFail:1,pColdStart:1,pVhready:1,pPenup:1,pNc:1,pAdmsb:3 +PS34CONTR record pVcc3:1,pVee1:1,pVcc4:1,pVee2:1,pVcc5:1,pVh:1,pVhpower:2 +PS34DTOAR record pNcc:1,pAdcsel:2,pDac:5 +; +ADCSEL_ADCIN equ 0 +ADCSEL_VIN equ 1 +ADCSEL_VH equ 2 +ADCSEL_VBATT equ 3 +; +VHP1TO8 equ 0 +VHP1TO4 equ 1 +VHP1TO2 equ 2 +VHP1TO1 equ 3 +; +; Asic5 info byte structure +; +A5InfoByteR record A5TTL:1,A5Modem:1,A5MultiDrop:1,A5Barcode:1,A5Other:2,A5Parallel:1,A5Rs232:1 +A5OtherRom equ (1 shl A5Other) +A5OtherMCRTTL equ (3 shl A5Other) +A5MCR equ (2 shl A5Other) +; +PPowerControl equ 0100h +PPowerControlR record PVcc5Enable:1,PSoundEnable:1,PVee1Enable:1,PDropVoltage:1,PDac:4 +PPia record PSoundVol:2,PClearCold:1,PDcPresent:1,PColdFlag:1,PLithiumWarn:1,PVinWarn:1 +PSoundControl equ 0200h +; +if Consumer +DefaultLcdContrast equ 7 +else +DefaultLcdContrast equ 15 +endif +; +InterruptBase equ 078h +; +KeyPollColumns equ 10 +KeyInitialDelay equ 24 +if Consumer +KeyRepeatDelay equ 2 +else +KeyRepeatDelay equ 4 +endif +PenUpDelay equ 16 +MouseDownDelay equ 8 +KeySettleDelay equ 24 +KeyCntrlMask equ 00000001b +KeyLeftShiftMask equ 00000010b +KeyPsionMask equ 00000100b +KeyCapsMask equ 00001000b +KeyRightShiftMask equ 00010000b +DigitizerRowMask equ 00010000b +PsionScanCode equ 6 +CapsScanCode equ 5 +PsionUpScanCode equ 65 +; +PostRomTest equ 010h +PostSystemRamTest equ 020h +PostVideoRamTest equ 030h +PostComplete equ 0f0h +if Consumer +PostPort equ 0h +else +PostPort equ 01ffh +endif +; +if HandHeld +VideoRamSegment equ 00040h +VideoRamBase equ 00000h +if Corporate +VideoRamWords equ 00320h +else +VideoRamWords equ 00500h +endif +else +VideoRamSegment equ 0b800h +VideoRamBase equ 00000h +VideoRamWords equ 04000h +endif +; +CalSeg equ 0fffeh +CalEnt struc +CalVsupCLsw dw ? +CalVsupCMsw dw ? +CalVsupM dw ? +CalVlthCLsw dw ? +CalVlthCMsw dw ? +CalVlthM dw ? +CalType dw ? +CalEnt ends +; +CHKeyDataR record CHInSled:1,CHMains:1,CHDummy:2 +; +Vcc4OffFrames equ 25 ; Gives 512 frames = 10.0 ms +; +Vcc1_4to5OffFrames equ 20 ; Gives 392 frames = 6.0 ms +Vcc1_4to5OnTime equ 4 ; Gives 4 ms +; +IntBXHw equ -2 + .list + diff --git a/code/SIBOSDK/ldd/read.me b/code/SIBOSDK/ldd/read.me new file mode 100644 index 0000000..06cfca3 --- /dev/null +++ b/code/SIBOSDK/ldd/read.me @@ -0,0 +1,72 @@ +1) BUILDING SNDDVR.LDD, SNDFRC.LDD, ATIMDVR.LDD + ============================================ + +These drivers are supplied as both source (in this directory) and as +built drivers (in \SIBOSDK\LIB). + +To rebuild them you must use the Borland Turbo assembler. The file +MAKEFILE is supplied to simplify the building of all three drivers. +If necessary, edit the first two lines of MAKEFILE to agree with the +directory containing a copy of the Borland Turbo files TASM.EXE and +TLINK.EXE. + +Provided that the directory containing Borland Turbo MAKE.EXE is in +your path, you can then build all three drivers by typing: + + make RETURN + + +2) A note on SNDFRC.LDD + ==================== + +The SNDFRC driver is for the Series 3, since the Series 3a has a +built-in FRC device driver. SNDFRC is provided as an illustration +only. + +The driver code assumes that, while it is running, no system +code makes use of the Series 3 free-running counter (FRC). The +FRC, however, is used when sounding the buzzer and when the +Flash filing system writes to a Flash SSD. + +Writing to a Flash SSD or sounding the buzzer (for example, with +p_sound) while the SNDFRC driver is in use will cause the driver +to hang indefinitely. It is also likely that opening the driver +while writing to a Flash SSD is in progress could adversely affect +the Flash file device driver. + +Commercial software should not make use of the Series 3 FRC in the +manner illustrated in this example. + + +3) The HC Barcode Drivers + ====================== + +The following Barcode decoder/device drivers are provided +(in \SIBOSDK\LIB) for use on the HC: + + BAREAN.LDD + BARC39.LDD + BARITF.LDD + BARMPLES.LDD + BAR128.LDD + BARRAW.LDD + +4) The HC and Workabout Fast Charger Drivers + ========================================= + +The following drivers are provided (in \SIBOSDK\LIB): + + SYS$CHGH.LDD fast charger driver for the HC + SYS$FCHG.LDD fast charger driver for the Workabout + +The header file FCHARGE.H is also provided (in \SIBOSDK\INCLUDE). + +4) The Series 3c and Siena IR Drivers + ================================== + +The following drivers are provided (in \SIBOSDK\LIB): + + ACCESSIR.LDD the AcessIR driver, AIR: + IRLPT.LDD IR printer port driver, IRP: + +The header file MUX.H is also provided (in \SIBOSDK\INCLUDE). diff --git a/code/SIBOSDK/ldd/snddvr.asm b/code/SIBOSDK/ldd/snddvr.asm new file mode 100644 index 0000000..574d5b1 --- /dev/null +++ b/code/SIBOSDK/ldd/snddvr.asm @@ -0,0 +1,395 @@ + title SNDDVR -- Epoc/Os Sound Device Driver Example + subttl Copyright (c) Psion PLC 1992 + name SNDDVR +; +; VER DATE BY DESCRIPTION +; ----- -------- ---- ----------- +; 1.00A 21/04/92 JH Alpha release +; +TURBOC equ 1 +; + include epocdef.inc + include epocmac.inc + include epoclib.inc + include epocser.inc + include ossibo.inc + +HandlerDisable equ 000h ; the hnadler should not be called +HandlerEnable equ 001h ; the handler should be called + + CodeSeg + + ProcBegin@ SnddvrLDD +; ========== +; The externally loadable device table + dw LDDSignature + db 'MUS',0,0,0,0,0 + dw (VectorEnd-Vector)/2 +Vector: + dw SnddvrInstall + dw SnddvrRemove + dw SnddvrHold + dw SnddvrResume + dw SnddvrReset + dw SnddvrUnits + dw SnddvrOpen + dw SnddvrStrategy +VectorHandler: + dw SnddvrHandler +VectorEnd: + ProcEnd noret + +SoundChanOpen db ? + + ProcBegin@ CancelWrite +; =========== +; Cancel any outstanding I/O write request. +; Set the completion status word to E_FILE_CANCEL and signal the I/O +; semaphore. +; In: +; BX - sound control block ptr +; Out: +; NONE +; + mov dl, CancelErr + IoSerSignalUserWrite ; complete any write with E_FILE_CANCEL + IoSerTimerCancel ; harmless if nothing queued + mov al, HandlerDisable + IoSerSetHandler ; make SnddvrHandler non callable +; FALL THROUGH to StopSound + ProcEnd noret +; + + ProcBegin@ StopSound +; ========= +; Stop the sound by turning off the sound chip and shuting down the +; amplifier. +; In: +; BX - sound control block ptr +; Out: +; NONE +; + mov dx, PSoundControl + mov al, 1 + out dx, al ; stop sound chip + HwComboOff ; stop amplifier + ret + ProcEnd noret +; + + ProcBegin@ PlaySounds +; ========== +; Play any more sounds available. +; Set the note volume from bits 6 and 7 of the first byte. +; Write the note to the chip from bits 0-5 of the first byte. +; Queue the timer to expire on timeout specified in 2nd byte. +; In: +; BX - channel control blk +; Out: +; AL as required by SnddvrHandler routine +; + cmp [bx].IoRequestRqWrite.RqA2Ptr, 0 + je finishedAllNotes + cld + dec [bx].IoRequestRqWrite.RqA2Ptr ; one less note to play + mov si, [bx].IoRequestRqWrite.RqA1Ptr + lodsw ; note+volume to AL, duration to AH + mov [bx].IoRequestRqWrite.RqA1Ptr, si + xor cx, cx + mov cl, ah ; the duration (in 1/10ths) + push ax + shr ax, 1 ; factor out the volume bits + and al, 60h ; into bits 5+6 for the hardware + mov ah, al + mov al, A2IWrite + out A2Index, al + mov al, ah + out A2Control, al ; set the volume for that note + pop ax + mov dx, PSoundControl + and al, 3fh ; bottom 6 bits are note info + out dx, al ; and play the note + xor dx, dx + IoSerQueueTimer ; DX:CX is timeout in 1/10ths + mov al, 1 ; enable handler + ret +finishedAllNotes: + call StopSound ; stop sound activity + IoSerSignalUserWriteOk ; write request completed ok + xor ax, ax ; disable handler + ret + ProcEnd noret +; + + ProcBegin@ SnddvrInstall,far +; ============= +; Install vector called when application calls p_loadldd() +; In: +; NONE +; Out: +; Carry clear if installed ok +; Carry set if failed to install +; + and SoundChanOpen, 0 ; no channel open yet + clc ; installed OK + ret + ProcEnd noret +; + + ProcBegin@ SnddvrRemove,far +; ============ +; Remove vector called when application calls p_devdel() +; In: +; NONE +; Out: +; Carry clear if removed ok +; Carry set if failed to remove +; + cmp SoundChanOpen, 0 + je soundRemoved ; dont do anything if not open + mov al, InUseErr + stc ; channel open, fail to remove + ret + ProcEnd noret +; + + ProcBegin@ SnddvrReset,far +; =========== +; Reset vector called if the client terminated. +; We can only get a reset if weve got channel open and client died +; since we cancel the reset request when the channel is closed. +; NOTE: The clients data space no longer exists thus all data required to +; close down the channel must be avaliable in the drivers space. +; In: +; NONE +; Out: +; NONE +; + call StopSound + HwFreeCombo ; allow other sound components to work. + and SoundChanOpen, 0 ; no channel open now +soundRemoved: + clc ; removed OK. + ret + ProcEnd noret + + + ProcBegin@ SnddvrHold,far +; ========== +; Hold called when another driver loaded or switched off/power fail. +; In: +; AH - reason. +; Out: +; NONE + + cmp SoundChanOpen, 0 + je soundHeld ; dont do anything if not open + call StopSound ; stop any current sounds. +soundHeld: + ret + ProcEnd noret + + ProcBegin@ SnddvrResume,far +; ============ +; Resume called after a Hold to allow the driver to continue. +; If we were running the outstanding timer request will complete at some +; in the future at which point we will play the next note. +; Note - we dont immediatly start playing the note that was being played +; when the hold was called - this may be a bug for some applications. +; In: +; NONE +; Out: +; NONE + + cmp SoundChanOpen, 0 + je soundResumed ; dont do anything if not open + HwComboOn ; waithandler will run eventually +soundResumed: + ret ; when the timer expires if we were active. + ProcEnd noret + + ProcBegin@ SnddvrUnits,far +; =========== +; We can only handle 1 sound channel at a time. +; + mov ax, 1 ; support 1 unit at a time + ret + ProcEnd noret + + ProcBegin@ SnddvrOpen,far +; ========== +; Open the sound device driver. +; This runs is the context of the process that has called p_open("MUS:"). +; +; In: +; DS=ES=SS - Process data space. +; DX - OS device handle +; SI - ptr to OpenEnt struct +; Out: +; DX - OS device handle +; Carry Clear +; BX - channel, DX is as passed (device handle) +; Carry Set +; AL - error number +; +; All device drivers MUST have a ChanEnt as first item at returned BX +; + HwGetCombo ; see if already in use, if not grab it + jc sndAlreadyInUse + +; allocate in clients heap the I/O control block, add vector 9 as a +; waithandler and open a timer channel. Tidies up all resources if there +; are any errors. + mov cx, (size IoRequestEnt) + IoSerOpenTimerHandler + jc endOpenNoMemory ; sets up ChanEnt, returns BX + +; request reset vector be called if client terminates before closing channel + xchg bx, dx + xor cx, cx + IoRequestReset ; BX=device handle, CX= channel indicator + xchg bx, dx + mov SoundChanOpen, 1 + clc ; Opened Ok, BX=channel, DX=device + ret +; +endOpenNoMemory: + push ax + HwFreeCombo ; free up as failed + pop ax + stc +sndAlreadyInUse: + ret + ProcEnd noret + + ProcBegin@ SnddvrHandler,far +; ============== +; Called when an I/O signal is generated, it may be our timer to indicate +; that we should play the next note if any. +; In: +; DS,ES,SS == Process data space +; BX = the open sound channel +; Out: +; Carry clear +; Did not consume signal +; Carry set +; al = 0 - Leave handler disabled +; al = non 0 - Enable handler +; + +; check that were not currently in any StategyVector code, (anti nesting) + test [bx].IoRequestFlags, RQ_DISABLE_HANDLER + jnz signalNotForUs + +; see if we currently have a timer request outstanding + test [bx].IoRequestFlags, RQ_TIMER + jz signalNotForUs ; timer not queued + +; see if the outstanding timer has completed + cmp [bx].IoRequestTimerStat, PendingErr + je signalNotForUs ; timer still pending + +; timer completed, play next sound if any and re-queue timer + and [bx].IoRequestFlags, NOT RQ_TIMER + call PlaySounds ; returns AL as required + stc + ret +signalNotForUs: + clc ; we didnt use the signal + ret + ProcEnd noret + + + ProcBegin@ SnddvrStrategy,far +; ============== +; Strategy vector called by an I/O request on the opened sound device driver +; channel. +; The wait handler may be called (when enabled ) unless we block it when we +; call a sync I/O request. Allowing the waithandler to run whilst in the +; strategy vector is generally not a good thing to do. +; In this particular example there are synchronous calls to the I/O system +; to cancel the outstanding timer (if queued) and use the signal generated +; by the cancel. +; +; In: +; DS,ES,SS == Process data space +; BX == channel control block from open request +; DX == device handle +; SI == RqEnt pointer +; Out: +; Carry clear +; - request queued sucessfully (may have completed) +; Carry set +; - error queuing the I/O request +; + cld + +; Stop the WaitHandler from being called temporarily + or [bx].IoRequestFlags, RQ_DISABLE_HANDLER + + mov al, byte ptr [si].RqFunction + cmp al, IoFuncWrite + jne tryCancel + +; P_FWRITE I/O function request + mov di, [si].RqA2Ptr + mov cx, [di] ; length to write + mov di, [si].RqA1Ptr ; ptr to data to write + mov si, [si].RqStatusPtr + IoSerCheckWriteSI ; set *SI to Pending, PendingPanic's + mov [bx].IoRequestRqWrite.RqA2Ptr, cx + mov [bx].IoRequestRqWrite.RqA1Ptr, di + mov al, HandlerEnable + IoSerSetHandler ; make SnddvrHandler callable + HwComboOn ; start the amplifier + call PlaySounds ; start the sound + and [bx].IoRequestFlags, NOT RQ_DISABLE_HANDLER + ret +tryCancel: + cmp al, IoFuncCancel + jne tryClose + +; P_FCANCEL I/O function request + call CancelWrite ; cancel any outstanding requests + and [bx].IoRequestFlags, NOT RQ_DISABLE_HANDLER + jmp short signalOk ; cancel completed ok. +tryClose: + cmp al, IoFuncClose + jne notForUs + +; P_FCLOSE I/O function request + push bx + push dx + call CancelWrite ; cancel any outstanding requests + +; cancel the request to call the Reset vector + pop bx ; our I/O device handle + xor cx, cx ; MUST be same as passed to IoRequestReset + IoRequestResetCancel ; dont call reset vector now + +; close timer, remove handler, free alloc + pop bx + IoSerCloseTimerHandler + HwFreeCombo ; not in use any more + and SoundChanOpen, 0 ; no channel open now +signalOk: + xor ax, ax + mov di, [si].RqStatusPtr + stosw ; set completion status word to zero + IoSignal ; complete the I/O request + xor ax, ax ; also clears carry + ret +notForUs: + and [bx].IoRequestFlags, NOT RQ_DISABLE_HANDLER + IoRoot ; pass on request as not for us + ret + ProcEnd noret + + EndCodeSeg +; +stack segment stack para 'data' +; +stack ends +; + end SnddvrLDD + diff --git a/code/SIBOSDK/ldd/sndfrc.asm b/code/SIBOSDK/ldd/sndfrc.asm new file mode 100644 index 0000000..ba7302f --- /dev/null +++ b/code/SIBOSDK/ldd/sndfrc.asm @@ -0,0 +1,521 @@ + title SNDFRC -- Epoc/Os Sound Device Driver Using FRC + subttl Copyright (c) Psion PLC 1992 + name SNDFRC +; +; VER DATE BY DESCRIPTION +; ----- -------- ---- ----------- +; 1.00A 21/04/92 JH Alpha release +; +TURBOC equ 1 +; + include epocdef.inc + include epocmac.inc + include epocpan.inc + include epoclib.inc + include epocser.inc + include ossibo.inc + +HandlerDisable equ 000h ; the hnadler should not be called +HandlerEnable equ 001h ; the handler should be called + +MAX_NOTES equ 500 + +; This is allocated in the user space for the I/O channel +SndFrcEnt struc + SndFrcIo ChanEnt <> ; I/O channel hdr, MUST be first + SndFrcWrite RqEnt <> + SndFrcHandler dw ? + SndFrcFlags dw ? + SndFrcPstat dw ? +SndFrcEnt ends + +SndChannel struc + Pid dw ? ; owning channel pid + OpenFrcChan db ? ; channel open status (KEEP ORDER) + WriteStat db ? ; write completion status (ORDER) + DataPtr dw ? ; where we are in buffer + DataLength dw ? ; number of notes to play + DataPreBuffer dw ? ; First Frc timout ptr + DataBuffer dw MAX_NOTES dup (?) +SndChannel ends + + CodeSeg + + ProcBegin@ SndfrcLDD +; ========== +; The externally loadable device table + dw LDDSignature + db 'MUS',0,0,0,0,0 + dw (VectorEnd-Vector)/2 +Vector: + dw SndfrcInstall + dw SndfrcRemove + dw SndfrcHold + dw SndfrcResume + dw SndfrcReset + dw SndfrcUnits + dw SndfrcOpen + dw SndfrcStrategy +VectorHandler: + dw SndfrcHandler +VectorEnd: + ProcEnd noret + +SoundChan SndChannel <> + + ProcBegin@ disableFrcInt +; ============= +; Disable the generation of Frc interrupts +; + pushf + cli + in al, A1InterruptMask + and al, not (mask FrcExpired) + out A1InterruptMask, al ; stop Interrupt controller from + popf ; generating Frc interrupts + ret + ProcEnd +; + ProcBegin@ enableFrcInt +; ============ +; Starts the free running counter. +; + pushf + cli + in al, A1Control + or al, mask FrcSource or mask FrcMode + out A1Control, al ; set 512khz and prescale mode + mov ax, 5120 ; request a FrcInt every 10ms + out A1FrcControl, ax + out A1FrcEoi, al ; clear any junk Frc Interrupt + in al, A1InterruptMask + or al, mask FrcExpired ; allow interrupt controller to + out A1InterruptMask, al ; generate a Frc Interrupt + popf + ret + ProcEnd noret +; + + ProcBegin@ FrcInterrupt,far +; ============ +; The Frc interrupt routine. +; Although we could get addressability to the clients data space since it is +; possible that the operating system is currently moving the +; data space of the client in which case the data buffer to be played +; may not be valid. +; The ISR is called by the operating system after all registers have been +; preserved. +; We MUST NOT cause a reschedule directly since the ISR would take a long +; time to complete if we did. +; +; Called in the context of whatever was running when the interrupt went off +; + out A1FrcEoi, al ; clear Frc Interrupt + mov si, SoundChan.DataPtr + cmp byte ptr cs:[si+1], 0 ; look at the duration byte + je finishedThatNote ; if zero goto the next note + dec byte ptr cs:[si+1] ; reduce timeout +endFrcInterrupt: + stc ; no potential reschedule required +endFrcInterruptFlags: + out A1NonSpecificEoi, al ; finish the ISR + ret + +finishedThatNote: + cmp SoundChan.DataLength, 0 + je finishedAllNotes + dec SoundChan.DataLength ; one less note to play + inc si + inc si ; find next note,volume and duration + mov SoundChan.DataPtr, si ; updated ptr + mov al, byte ptr cs:[si] + push ax + shr ax, 1 ; factor out the volume bits + and al, 60h ; into bits 5+6 for the hardware + mov ah, al + mov al, A2IWrite + out A2Index, al + mov al, ah + out A2Control, al ; set the volume for that note + pop ax + mov dx, PSoundControl + and al, 3fh ; bottom 6 bits are note info + out dx, al ; and play that note + jmp short endFrcInterrupt +finishedAllNotes: + call StopSound + mov SoundChan.WriteStat, 0 ; finished playing that lot + mov bx, SoundChan.Pid ; get the channel owner + IoSignalByPidNoReSched ; signal ourselves, causes handler + clc ; reschedule if possible + jmp short endFrcInterruptFlags + ProcEnd noret +; + + ProcBegin@ setFrcIntVector +; =============== +; Set the ISR pointer to our FRC interrupt routine. +; MUST be done with ints disabled so we cant be moved by the operating +; system whilst setting the address. +; + pushf + cli + push bx + mov al, HwIrq5Revector + mov bx, offset FrcInterrupt + mov cx, cs ; this ok as ints disabled. + GenSetRevector + pop bx + popf + ret + ProcEnd noret +; + + ProcBegin@ StopSound +; ========= +; Stop the sound generation. +; + call disableFrcInt ; Stop Frc interrupts + mov dx, PSoundControl + mov al, 1 + out dx, al ; stop sound chip + HwComboOff ; stop amplifier + ret + ProcEnd noret + + ProcBegin@ SndfrcInstall,far +; ============= +; Install vector called when application calls p_loadldd() +; Set OpenFrcChan to zero. +; In: +; NONE +; Out: +; Carry clear if installed ok +; Carry set if failed to install +; + and SoundChan.OpenFrcChan, 0 + clc ; installed OK + ret + ProcEnd noret +; + + ProcBegin@ SndfrcRemove,far +; ============ +; Remove vector called when application calls p_devdel() +; + cmp SoundChan.OpenFrcChan, 0 + je soundRemoved + mov al, InUseErr + stc ; channel open, fail to remove + ret + ProcEnd noret +; + + ProcBegin@ SndfrcReset,far +; =========== +; Reset vector called if the client terminated. +; We can only get a reset if weve got channel open and client died +; since we cancel the reset request when the channel is closed. +; NOTE: The clients data space no longer exists thus all data required to +; close down the channel must be avaliable in the drivers space. +; In: +; NONE +; Out: +; NONE +; + call StopSound ; disable Frc ints etc + mov al, HwIrq5Revector + GenResetRevector ; restore the default ROM ISR vector + mov al, mask FrcExpired + HwFreeChannel ; free Frc resource + HwFreeCombo ; free up sound usage resource + and word ptr SoundChan.OpenFrcChan, 0 ; all closed now +soundRemoved: + clc ; removed OK. + ret + ProcEnd noret + + + ProcBegin@ SndfrcHold,far +; ========== +; Hold called when another driver loaded or switched off/power fail. +; In: +; AH - reason. +; Out: +; NONE + + cmp SoundChan.OpenFrcChan, 0 + je soundHeld ; dont do anything if not open + call StopSound ; shut down ints and sound +soundHeld: + ret + ProcEnd noret + + ProcBegin@ SndfrcResume,far +; ============ +; Resume called after a Hold to allow the driver to continue. +; If we were running enabling the Frc interrupt will cause the +; FrcInt routine to be called thus allowing us to count down the current +; duration as though nothing had happened before going to the next note. +; In: +; NONE +; Out: +; NONE +; + cmp SoundChan.OpenFrcChan, 0 + je soundResumed ; dont do anything if not open + call setFrcIntVector ; we may have moved, set CS correctly + cmp SoundChan.WriteStat, PendingErr + jne soundResumed ; dont enable ints if no write queued + HwComboOn ; switch amplifier on + call enableFrcInt ; continue where we left off +soundResumed: + ret + ProcEnd noret + + ProcBegin@ SndfrcUnits,far +; =========== +; We can only handle 1 sound channel at a time. +; + mov ax, 1 ; support 1 unit at a time + ret + ProcEnd noret + + ProcBegin@ SndfrcOpen,far +; ========== +; Open the sound device driver. +; This runs is the context of the process that has called p_open("MUF:"). +; +; In: +; DS=ES=SS - Process data space. +; DX - OS device handle +; SI - ptr to OpenEnt struct +; Out: +; DX - OS device handle +; Carry Clear +; BX - channel, DX is as passed (device handle) +; Carry Set +; AL - error number +; +; All device drivers MUST have a ChanEnt as first item at returned BX +; + HwGetCombo ; see if snd already in use, if not grab it + jc sndAlreadyInUse + mov al, mask FrcExpired + HwGetChannel ; see if FRC already in use, if not grab it + jc endFrcInUse + mov cx, (size SndFrcEnt) + HeapAllocateCell + jc endOpenNoMemory ; get users I/O channel + mov bx, ax ; the allocated cell handle + mov al, (VectorHandler-Vector)/2 + IoAddHandler ; handler handle in AX + jc endOpenFreeMemory + mov [bx].SndFrcHandler, ax + xchg bx, dx + xor cx, cx + IoRequestReset ; call Reset if client terminates + xchg bx, dx + mov [bx].SndFrcIo.ChanNext, bx ; we are a root device + mov [bx].SndFrcIo.ChanSignature, IoChanSignature + mov [bx].SndFrcIo.ChanLibHandle, dx ; This is our device handle + and [bx].SndFrcPstat, 0 ; no write pending yet + and [bx].SndFrcFlags, 0 + ProcId + mov SoundChan.Pid, ax ; remember client id for ISR + mov SoundChan.OpenFrcChan, 1 ; now open + call setFrcIntVector ; set up the ISR address ptr + clc + ret + +endOpenFreeMemory: + push ax + HeapFreeCell + pop ax +endOpenNoMemory: + push ax + mov al, mask FrcExpired + HwFreeChannel ; free Frc resource + pop ax +endFrcInUse: + push ax + HwFreeCombo ; free sound resource as failed somewhere + pop ax + stc +sndAlreadyInUse: + ret + ProcEnd noret + + ProcBegin@ SndfrcHandler,far +; ============== +; Called when an I/O signal is generated and were enabled. We should only +; enabled when a write request is outstanding. +; We need to check the LOW side drivers completion status to see if all the +; notes have been played yet (SoundChan.WriteStat!=E_FILE_PENDING). +; Typically write the handler defensivly since complex drivers may leave the +; handler enabled other than when a request is outstanding. +; +; In: +; DS,ES,SS == Process data space +; BX == channel control block from open request +; Out: +; Carry clear +; Did not consume signal +; Carry set +; al = 0 - Leave handler disabled +; al = non 0 - Enable handler +; + test [bx].SndFrcFlags, RQ_DISABLE_HANDLER + jnz signalNotForUs ; we are in StategyVector code + cmp [bx].SndFrcPstat, 0 + je signalNotForUs ; no write request queued yet + mov al, SoundChan.WriteStat + cmp al, PendingErr + je signalNotForUs ; pending write request not finished + cbw + xor si, si + xchg si, [bx].SndFrcPstat ; no write queued if Pstat is zero + mov [si], ax + IoSignal ; complete the original write request + xor ax, ax ; disable handler now + stc + ret +signalNotForUs: + clc + ret + ProcEnd noret + + ProcBegin@ CancelWrite +; =========== +; Cancel any outstanding write request +; + xor di, di + xchg di, [bx].SndFrcPstat + or di, di ; see if any write is currently queued + jz noWriteQueued + push bx + mov bx, [bx].SndFrcHandler + mov cl, HandlerDisable + IoEnableHandler ; make SndfrcHandler non callable + pop bx + call StopSound ; stops Frc ints + mov word ptr [di], CancelErr ; set write completion stat + IoSignal ; and signal write completion +noWriteQueued: + mov SoundChan.WriteStat, 0 + ret + ProcEnd noret +; + + ProcBegin@ SndfrcStrategy,far +; ============== +; Strategy vector called by an I/O request on the opened sound device driver +; channel. +; The wait handler may be called (when enabled ) unless we block it when we +; call a sync I/O request. Allowing the waithandler to run whilst in the +; strategy vector is generally not a good thing to do. +; In this particular example there are infact no sync calls to the I/O system +; thus the wait handler cannot be run. In more complex drivers it may be +; difficult to determine all possible paths through the code thus the driver +; should be written defensivly (use RQ_DISABLE_HANDLER type mechanism). +; In: +; DS,ES,SS == Process data space +; BX == channel control block from open request +; DX == device handle +; SI == RqEnt pointer +; Out: +; Carry clear +; - request queued sucessfully (may have completed) +; Carry set +; - error queuing the I/O request +; + cld + or [bx].SndFrcFlags, RQ_DISABLE_HANDLER + mov al, byte ptr [si].RqFunction + cmp al, IoFuncWrite + jne tryCancel + cmp [bx].SndFrcPstat, 0 + jne writeQueued ; panic if write already queued + mov di, [si].RqA2Ptr + mov cx, [di] ; length to write + cmp cx, MAX_NOTES + jae writeQueued ; length too much, panic dvr + mov di, [si].RqStatusPtr + mov word ptr [di], PendingErr + mov [bx].SndFrcPstat, di ; write request now queued + mov si, [si].RqA1Ptr ; ptr to data to write as sound + mov di, offset SoundChan.DataPreBuffer + and word ptr [di], 0 ; set pre buffer len to zero + mov SoundChan.DataPtr, di + inc di + inc di + mov SoundChan.DataLength, cx ; this many notes to play + mov SoundChan.WriteStat, PendingErr + pushf + cli ; we can set ES when ints are off + push cs + pop es ; copy the notes+vol and duration + popf ; into buf we can access in ISR + rep movsw ; dont use CS override + mov es, [bp].IntES + push bx + mov bx, [bx].SndFrcHandler + mov cl, HandlerEnable + IoEnableHandler ; allow waithandler to be called + pop bx + HwComboOn + call enableFrcInt ; start the sound off + and [bx].SndFrcFlags, NOT RQ_DISABLE_HANDLER + xor ax, ax ; queued OK + ret +writeQueued: + mov al, PanicIoPending + ProcPanic ; stop bad applications + +tryCancel: + cmp al, IoFuncCancel + jne tryClose + call CancelWrite ; stop any queued write + and [bx].IoRequestFlags, NOT RQ_DISABLE_HANDLER + jmp short signalOk ; cancel completed ok. +tryClose: + cmp al, IoFuncClose + jne notForUs + call CancelWrite ; stop any queued writes + push bx + push [bx].SndFrcHandler + push dx + mov al, HwIrq5Revector + GenResetRevector + pop bx ; channel handle + xor cx, cx + IoRequestResetCancel ; dont call Reset vector now + pop bx ; handler handle + IoRemoveHandler + pop bx ; alloc handle + HeapFreeCell + mov al, mask FrcExpired + HwFreeChannel ; free Frc resource + HwFreeCombo ; not in use any more + and word ptr SoundChan.OpenFrcChan, 0 ; all closed now +signalOk: + xor ax, ax + mov di, [si].RqStatusPtr + stosw ; the I/O request completed OK + IoSignal + xor ax, ax ; also clears carry + ret +notForUs: + and [bx].IoRequestFlags, NOT RQ_DISABLE_HANDLER + IoRoot ; pass on request as not for us + ret + ProcEnd noret + + EndCodeSeg +; +stack segment stack para 'data' +; +stack ends +; + end SndfrcLDD + diff --git a/code/SIBOSDK/ldd/t_atim.c b/code/SIBOSDK/ldd/t_atim.c new file mode 100644 index 0000000..f5555d4 --- /dev/null +++ b/code/SIBOSDK/ldd/t_atim.c @@ -0,0 +1,64 @@ +/* +T_ATIM.C - Test the attached timer a bit + +Written by John, February 1992 +*/ + +#include +#include +#include + +LOCAL_C VOID panic( + INT num, + INT errno) + { + UBYTE b[100]; + + p_errs(&b[p_atos(&b[0],"panic num %d - ",num)],errno); + t_panic(&b[0]); + } + +GLDEF_C main(VOID) + { + UWORD len; + WORD stat; + INT ret; + UBYTE *pcb; + ULONG timeout; + UBYTE bb[10]; + GLREF_D P_DEVICE p_wind,p_file; + + p_inst(&p_wind,&p_file,NULL_D); + if (ret=p_loadldd("ATIMDVR.LDD")) + panic(1,ret); + if (ret=p_open(&pcb,"TTY:A")) + panic(2,ret); + if (ret=p_open(&pcb,"ATM:",0)) + panic(3,ret); + timeout=50L; /* 5 second timeout */ + if (ret=p_iow(pcb,P_FSET,&timeout)) + panic(4,ret); + +/* +Once the device driver hierarchy has been set up the I/O requests are +identical between a driver with and a driver without an attached timeout +driver, except of course that the attached timeout driver will not wait +forever if no characters can be read. +*/ + len=10; + p_ioc(pcb,P_FREAD,&stat,&bb[0],&len); + p_iow(pcb,P_FCANCEL); + p_waitstat(&stat); + if (stat!=E_FILE_CANCEL) + panic(5,stat); + if ((ret=p_read(pcb,&bb[0],10))!=E_FILE_INACT) + panic(6,ret); /* times out after 5 seconds */ + + + p_close(pcb); + p_close(pcb); + if (ret=p_devdel("ATM",E_LDD)) + panic(7,ret); + return(0); + } + diff --git a/code/SIBOSDK/ldd/t_mus.c b/code/SIBOSDK/ldd/t_mus.c new file mode 100644 index 0000000..34b01eb --- /dev/null +++ b/code/SIBOSDK/ldd/t_mus.c @@ -0,0 +1,118 @@ +/* +T_MUS.C - Test the musical sound driver a bit + +Written by John, April 1992 +*/ + +#include + +/* all are 1 sec duration by default */ +LOCAL_D UBYTE notes[] = { +/* Basic note numbers */ + 0x30, + 0x31, + 0x32, + 0x33, + 0x34, + 0x35, + 0x36, + 0x37, + 0x38, + 0x39, + 0x3a, + 0x29, + 0x3b, + 0x3c, + 0x3d, + 0x0e, + 0x3e, + 0x2c, + 0x3f, + 0x04, + 0x05, + 0x25, + 0x2f, + 0x06, + 0x07 + }; + +LOCAL_D WORD volume=0; /* volume to use */ +LOCAL_D WORD length=10; /* length of notes */ + +LOCAL_C VOID panic( + INT num, + INT errno) + { + TEXT b[100]; + + p_errs(&b[p_atob(&b[0],"panic num %d - ",&num)],errno); + t_panic(&b[0]); + } + +GLDEF_C main(VOID) + { + INT ret,i; + VOID *pcb; + UBYTE bb[100],*p; + + p_loadldd("SNDDVR.LDD"); + if (ret=p_open(&pcb,"MUS:",-1)) + panic(2,ret); + p_puts("Musical notes tester - ? for help"); + FOREVER + { + p_print("Next>"); + p_gets(p=(&bb[0])); + p=p_skipwh(p); + if (!*p) + continue; + switch (p_toupper(*p++)) + { + case '?': + p_puts("Q - Quit"); + p_puts("V - Volume 0-3"); + p_puts("L - Length 0-100"); + p_puts("P - Play scale"); + break; + case 'Q': /* Quit */ + p_close(pcb); + if (ret=p_devdel("MUS",E_LDD)) + panic(7,ret); + return(0); + case 'V': /* Volume */ + if (p_stoi(&p,&volume)<0) + volume=0; + if (volume<0 || volume>3) + volume=0; + break; + case 'L': /* Length */ + if (p_stoi(&p,&length)<0) + length=10; + if (length<0 || length>100) + length=10; + break; + case 'P': /* play that lot */ + for (i=0;i + +/* all are 1 sec duration by default */ +LOCAL_D UBYTE notes[] = { +/* Basic note numbers */ + 0x30, + 0x31, + 0x32, + 0x33, + 0x34, + 0x35, + 0x36, + 0x37, + 0x38, + 0x39, + 0x3a, + 0x29, + 0x3b, + 0x3c, + 0x3d, + 0x0e, + 0x3e, + 0x2c, + 0x3f, + 0x04, + 0x05, + 0x25, + 0x2f, + 0x06, + 0x07 + }; + +LOCAL_D WORD volume=0; /* volume to use */ +LOCAL_D WORD length=100; /* length of notes */ + +LOCAL_C VOID panic( + INT num, + INT errno) + { + TEXT b[100]; + + p_errs(&b[p_atob(&b[0],"panic num %d - ",&num)],errno); + t_panic(&b[0]); + } + +GLDEF_C main(VOID) + { + INT ret,i; + VOID *pcb; + UBYTE bb[100],*p; + + p_loadldd("SNDFRC.LDD"); + if (ret=p_open(&pcb,"MUS:",-1)) + panic(2,ret); + p_puts("Musical notes tester - ? for help"); + FOREVER + { + p_print("Next>"); + p_gets(p=(&bb[0])); + p=p_skipwh(p); + if (!*p) + continue; + switch (p_toupper(*p++)) + { + case '?': + p_puts("Q - Quit"); + p_puts("V - Volume 0-3"); + p_puts("L - Length 0-256"); + p_puts("P - Play scale"); + break; + case 'Q': /* Quit */ + p_close(pcb); + if (ret=p_devdel("MUS",E_LDD)) + panic(7,ret); + return(0); + case 'V': /* Volume */ + if (p_stoi(&p,&volume)<0) + volume=0; + if (volume<0 || volume>3) + volume=0; + break; + case 'L': /* Length */ + if (p_stoi(&p,&length)<0) + length=100; + if (length<0 || length>256) + length=100; + break; + case 'P': /* play that lot */ + for (i=0;i +#include +#include +#include +#include +#include "nolayout.h" +#include "notes.def" + +GLREF_D PR_HWIMMAN *w_am; +GLREF_D PR_WSERV *w_ws; +GLREF_D WSERV_SPEC *wserv_channel; +GLREF_D PR_VAFLAT *DatApp1; +GLREF_D PR_NOCOMMAN *DatApp2; +GLREF_D PR_EDWIN *DatApp3; +GLREF_D NOTE *DatApp4; + +GLDEF_D LAYOUT_DATA ld; + +LOCAL_C VOID RotateStatusWindow(VOID) + { + P_EXTENT ext; + + if (ld.Version4) + { + if (!ld.StatusWindow--) + ld.StatusWindow=W_STATUS_WINDOW_BIG; + wStatusWindow(ld.StatusWindow); + wInquireStatusWindow(-1,&ext); + ld.StatusWindowWidth=ext.width; + } + else + { + if (ld.StatusWindow^=TRUE) + { + wsEnable(); + ld.StatusWindowWidth=WS_WIDTH; + } + else + { + wsDisable(); + ld.StatusWindowWidth=0; + } + } + } + +LOCAL_C VOID InitStatusWindow(VOID) + { + if (ld.Version4) + wsSetList(W_STATUS_WINDOW_ICON,NULL,0); + RotateStatusWindow(); + } + +LOCAL_C VOID GetFontHeightData(VOID) + { + G_FONT_INFO font; + + gFontInfo(WS_FONT_SYSTEM,0,&font); + ld.FontHeight=font.height; + ld.FontAscent=font.ascent; + } + +LOCAL_C VOID CreateTextWindows(PR_NOCOMMAN *self) + { + self->nocomman.tagwin=f_new(CAT_NOTES_NOTES,C_NOTAGWIN); + self->nocomman.cntwin=f_new(CAT_NOTES_NOTES,C_NOCNTWIN); + } + +LOCAL_C VOID InitTextWindow(VOID *win,INT x,INT y,INT width) + { + W_WINDATA wd; + + wd.background=W_WIN_BACK_NONE; + wd.extent.tl.x=x; + wd.extent.tl.y=y+EDGE_TLY; + wd.extent.width=width; + wd.extent.height=ld.FontHeight+2; + p_send5(win,O_WN_CONNECT,NULL,W_WIN_BACKGROUND|W_WIN_EXTENT,&wd); + hInitVis(win); + } + +LOCAL_C VOID MoveWindowLeft(INT wid,INT change) + { + W_WINDATA wd; + + wInquireWindow(wid,&wd); + wd.extent.tl.x+=change; + wSetWindow(wid,W_WIN_EXTENT,&wd); + } + +LOCAL_C UINT CalculateYValues(UWORD *py1,UWORD *py2) + { + UWORD NumLines; + UWORD LineHeight; + UWORD spare; + + LineHeight=ld.FontHeight+2; + NumLines=(ld.ScreenHeight-REQD_EDGE_PIXELS)/LineHeight; + spare=ld.ScreenHeight-REQD_EDGE_PIXELS-LineHeight*NumLines; + spare>>=1; /* excess goes to second "spare" region */ + *py1=EDGE_HEIGHT+LineHeight+BASIC_GAP_BETWEEN_WINDOWS+spare; + *py2=ld.ScreenHeight-(EDGE_HEIGHT+LineHeight); + return(NumLines-2); + } + +LOCAL_C VOID SetupInEdwin(IN_EDWIN *pInit,INT delx,INT flags,INT maxlen) + { + pInit->vulen=ld.ScreenWidth-ld.StatusWindowWidth-delx; + pInit->flags=flags; + pInit->maxlen=maxlen; + pInit->contents[0]=0; + } + +LOCAL_C PR_NOWIN *CreateNowin(INT class,IN_EDWIN *pIned,IN_EDWIN_X *pIX) + { + PR_NOWIN *nowin; + + nowin=f_newsend(CAT_NOTES_NOTES,class,O_WN_INIT,pIned,pIX); + hInitVis(nowin); + return(nowin); + } + +#define EDWIN_FLGS (IN_EDWIN_VULEN_PIXELS|IN_EDWIN_POSITION_SUPPLIED) + +LOCAL_C VOID InitialiseWindows(PR_NOCOMMAN *self) + { + UWORD x1,x2; + UWORD y1,y2; + UWORD NumNotesLines; + IN_EDWIN ined; + IN_EDWIN_X inedx; + + CreateTextWindows(self); + x1=p_send2(self->nocomman.tagwin,O_WN_SENSE); + x2=p_send2(self->nocomman.cntwin,O_WN_SENSE); + NumNotesLines=CalculateYValues(&y1,&y2); + SetupInEdwin(&ined,x1,EDWIN_FLGS|IN_EDWIN_FONT_SUPPLIED,40); + inedx.pos.x=x1; + inedx.pos.y=0; + if (ld.Version4) + { + inedx.font=WS_FONT_SYSTEM; + inedx.style=G_STY_BOLD; + } + else + { + inedx.font=WS_FONT_BASE+1; + inedx.style=G_STY_NORMAL; + } + self->nocomman.edit[0]=CreateNowin(C_NOTITWIN,&ined,&inedx); + SetupInEdwin(&ined,0,EDWIN_FLGS|IN_EDWIN_VISLINES_SUPPLIED| + IN_EDWIN_LEFT_CURSOR|IN_EDWIN_CLIPBOARD,512); + inedx.pos.x=0; + inedx.pos.y=y1; + inedx.vislines=NumNotesLines; + inedx.clip=NULL; + self->nocomman.edit[1]=CreateNowin(C_NOWIN,&ined,&inedx); + SetupInEdwin(&ined,x2,EDWIN_FLGS,20); + inedx.pos.x=0; + inedx.pos.y=y2; + self->nocomman.edit[2]=CreateNowin(C_NOFNDWIN,&ined,&inedx); + InitTextWindow(self->nocomman.tagwin,0,0,x1); + InitTextWindow(self->nocomman.cntwin, + ld.ScreenWidth-ld.StatusWindowWidth-x2,y2,x2); + } + +LOCAL_C VOID InitialiseLayout(PR_NOCOMMAN *self) + { + ld.Version4= + ((wserv_channel->conn.info.version_id&WS_VERSION_MASK) >= WS_VERSION_4); + InitStatusWindow(); + ld.ScreenWidth=wserv_channel->conn.info.pixels.x; + ld.ScreenHeight=wserv_channel->conn.info.pixels.y; + GetFontHeightData(); + InitialiseWindows(self); + DatApp3=self->nocomman.edit[NOTES_WINDOW]->nowin.edwin; + } + +LOCAL_C VOID FocusTo(PR_NOCOMMAN *self,INT which) + { + if (w_ws->wserv.cli) + p_send3(w_ws->wserv.cli,O_WN_EMPHASISE,FALSE); + self->nocomman.which=which; + w_ws->wserv.cli=(PR_WIN *)self->nocomman.edit[which]; + p_send3(w_ws->wserv.cli,O_WN_EMPHASISE,TRUE); + } + +LOCAL_C VOID FocusToWithCheck(PR_NOCOMMAN *self,INT which) + { + if (which==self->nocomman.which) + return; + FocusTo(self,which); + } + +LOCAL_C VOID RecordChange(PR_NOWIN *win,LENBUF *lb) + { + PR_EDWIN *edwin; + SE_EDWIN sense; + + edwin=win->nowin.edwin; + if (!(edwin->edwin.change)) + return; + p_send3(edwin,O_WN_SENSE,&sense); + lb->buf=f_realloc(lb->buf,sense.len); + lb->len=sense.len; + p_bcpy(lb->buf,sense.buf,sense.len); + edwin->edwin.change=FALSE; + } + +LOCAL_C VOID RecordAnyChanges(PR_NOCOMMAN *self) + { + RecordChange(self->nocomman.edit[TITLE_WINDOW],&DatApp4->title); + RecordChange(self->nocomman.edit[NOTES_WINDOW],&DatApp4->note); + } + +LOCAL_C VOID SetCurrentNote(PR_NOCOMMAN *self) + { + DatApp4=ePointToNote(self->nocomman.where); + } + +LOCAL_C VOID LoadEditor(PR_NOWIN *win,LENBUF *lb) + { + PR_EDWIN *edwin; + SE_EDWIN set; + + edwin=win->nowin.edwin; + set.buf=lb->buf; + set.len=lb->len; + p_send3(edwin,O_WN_SET,&set); + edwin->edwin.change=FALSE; + } + +LOCAL_C VOID LoadTagStatus(PR_NOCOMMAN *self) + { + p_send3(self->nocomman.tagwin,O_WN_SET,DatApp4->tagged); + } + +LOCAL_C VOID LoadWhereAndCount(PR_NOCOMMAN *self) + { + p_send4(self->nocomman.cntwin, + O_WN_SET,self->nocomman.where+1,DatApp1->varoot.nrec); + } + +LOCAL_C VOID LoadWindows(PR_NOCOMMAN *self) + { + LoadEditor(self->nocomman.edit[TITLE_WINDOW],&DatApp4->title); + LoadEditor(self->nocomman.edit[NOTES_WINDOW],&DatApp4->note); + LoadWhereAndCount(self); + LoadTagStatus(self); + } + +LOCAL_C VOID CheckEditing(PR_NOCOMMAN *self) + { + if (self->nocomman.which==NOTES_WINDOW) + return; + hInfoPrint(NOSTR_ONLY_IN_NOTES); + p_leave(RUN_ACTIVE_USED); + } + +LOCAL_C VOID GiveTagCount(VOID) + { + hInfoPrint(NOSTR_TAG_COUNT,eCountTaggedNotes()); + } + +LOCAL_C INT RunDialog(INT class,INT resid,VOID *rbuf) + { + DL_DATA dd; + + dd.id=resid; + dd.rbuf=rbuf; + dd.pdlg=NULL; + return(hLaunchDial(CAT_NOTES_NOTES,class,&dd)); + } + +LOCAL_C VOID TagCurrentNote(INT clear) + { + DatApp4->tagged=(!clear); + } + +LOCAL_C VOID SetTo(PR_NOCOMMAN *self,INT where) + { + self->nocomman.where=where; + SetCurrentNote(self); + LoadWindows(self); + } + +LOCAL_C VOID WinEmphasise(PR_NOCOMMAN *self,INT which,INT state) + { + p_send3(self->nocomman.edit[which]->nowin.edwin,O_WN_EMPHASISE,state); + } + +LOCAL_C VOID SetCursorWidth(PR_NOCOMMAN *self,INT which,INT width) + { + PR_EDWIN *edwin; + SCRIMG_WIN win; + + edwin=self->nocomman.edit[which]->nowin.edwin; + p_send3(edwin->edwin.scrimg,O_SI_SENSE,&win); + win.cwidth=width; + p_send4(edwin->edwin.scrimg,O_SI_SET,&win,NULL); + } + +LOCAL_C VOID SetEdwinSelect(PR_NOCOMMAN *self,INT which,INT aoff,INT coff) + { + SET_EDWIN set; + + set.flags=SET_EDWIN_CURSOR|SET_EDWIN_ANCHOR; + set.anchor=aoff; + set.cursor=coff; + p_send3(self->nocomman.edit[which]->nowin.edwin,O_EW_SET,&set); + } + +LOCAL_C VOID DrawImmediately(PR_WIN *win) + { + p_send2(win,O_WN_DODRAW); + } + +LOCAL_C VOID Search(PR_NOCOMMAN *self,LENBUF *lb,INT here,INT which) + { + INT ind; + + if (self->nocomman.casesens) + ind=p_bsub(lb->buf,lb->len, + self->nocomman.pattern.buf,self->nocomman.pattern.len); + else + ind=p_bsubi(lb->buf,lb->len, + self->nocomman.pattern.buf,self->nocomman.pattern.len); + if (ind<0) + return; + if (here!=self->nocomman.where) + SetTo(self,here); + if (self->nocomman.pattern.len) + { + if (which!=self->nocomman.which) + { + WinEmphasise(self,self->nocomman.which,FALSE); + SetCursorWidth(self,which,0); + WinEmphasise(self,which,TRUE); + } + SetEdwinSelect(self,which,ind,ind+self->nocomman.pattern.len); + if (which!=self->nocomman.which) + { + DrawImmediately((PR_WIN *)self->nocomman.cntwin); + DrawImmediately((PR_WIN *)self->nocomman.tagwin); + wFlush(); + p_sleep(5L); + WinEmphasise(self,which,FALSE); + SetCursorWidth(self,which,2); + WinEmphasise(self,self->nocomman.which,TRUE); + } + } + p_leave(RUN_ACTIVE_USED); + } + +LOCAL_C VOID DoSearch(PR_NOCOMMAN *self,INT here,INT direction) + { + PR_EDWIN *edwin; + INT k; + INT count; + NOTE *pn; + + RecordAnyChanges(self); + edwin=self->nocomman.edit[FIND_WINDOW]->nowin.edwin; + p_send3(edwin,O_WN_SENSE,&self->nocomman.pattern); + edwin->edwin.change=FALSE; + k=DatApp1->varoot.nrec; + count=k-1; + while (k--) + { + here+=direction; + if (here<0) + here=count; + else if (here>count) + here=0; + pn=ePointToNote(here); + if (self->nocomman.findtype!=FIND_NOTES_ONLY) + Search(self,&pn->title,here,TITLE_WINDOW); + if (self->nocomman.findtype!=FIND_TITLE_ONLY) + Search(self,&pn->note,here,NOTES_WINDOW); + } + hInfoPrint(NOSTR_NOT_FOUND); + } + +LOCAL_C INT EdwinChanged(PR_NOCOMMAN *self,INT which) + { + return(self->nocomman.edit[which]->nowin.edwin->edwin.change); + } + +LOCAL_C VOID CheckIfChanged(PR_NOCOMMAN *self) + { + if (EdwinChanged(self,TITLE_WINDOW)) + return; + if (EdwinChanged(self,NOTES_WINDOW)) + return; + hInfoPrint(NOSTR_NOT_CHANGED); + p_leave(RUN_ACTIVE_USED); + } + +LOCAL_C WORD GetLinkableData(ULONG *pFmt) + { + return(p_send3(w_am->appman.system,O_SY_LINK_PASTE,pFmt)); + } + +#pragma METHOD_CALL + +METHOD VOID nocomman_com_init(PR_NOCOMMAN *self) + { + DatApp2=self; + eInitialiseEngine(); + SetCurrentNote(self); + InitialiseLayout(self); + LoadWhereAndCount(self); + FocusTo(self,TITLE_WINDOW); + InitLinkServer(); + } + +METHOD VOID nocomman_com_statwin(PR_NOCOMMAN *self) + { + INT change; + INT i; + + change=ld.StatusWindowWidth; + RotateStatusWindow(); + change-=ld.StatusWindowWidth; + for (i=0; i<3; i++) + p_send3(self->nocomman.edit[i],O_NW_INCREASE_WIDTH,change); + MoveWindowLeft(self->nocomman.cntwin->win.id,change); + } + +METHOD VOID nocomman_com_exit(VOID) + { + p_exit(0); + } + +METHOD VOID nocomman_ncon_new(PR_NOCOMMAN *self) + { + RecordAnyChanges(self); + self->nocomman.where=eAppendNullEntry(); + SetCurrentNote(self); + LoadWindows(self); + FocusToWithCheck(self,TITLE_WINDOW); + } + +METHOD VOID nocomman_ncon_insert(PR_NOCOMMAN *self) + { + RecordAnyChanges(self); + if (!self->nocomman.clip.title.len && !self->nocomman.clip.note.len) + { + hInfoPrint(NOSTR_NO_NOTE_INSERTED); + return; + } + self->nocomman.where=eAppendNullEntry(); + SetCurrentNote(self); + eTakeCopy(DatApp4,&self->nocomman.clip); + LoadWindows(self); + } + +METHOD VOID nocomman_ncon_copy(PR_NOCOMMAN *self) + { + NOTE new; + + RecordAnyChanges(self); + if (!DatApp4->title.len && !DatApp4->note.len) + { + hInfoPrint(NOSTR_NO_NOTE_COPIED); + return; + } + eTakeCopy(&new,DatApp4); + eZeroNote(&self->nocomman.clip); + self->nocomman.clip=new; + hInfoPrint(NOSTR_NOTE_COPIED); + } + +METHOD VOID nocomman_ncon_delete(PR_NOCOMMAN *self) + { + if (!hConfirm(NOSTR_DELETE_NOTE)) + return; + self->nocomman.where=eDeleteNote(self->nocomman.where); + SetCurrentNote(self); + LoadWindows(self); + } + +METHOD VOID nocomman_ncon_record(PR_NOCOMMAN *self) + { + CheckIfChanged(self); + RecordAnyChanges(self); + hInfoPrint(NOSTR_NOTE_RECORDED); + } + +METHOD VOID nocomman_ncon_undo(PR_NOCOMMAN *self) + { + CheckIfChanged(self); + if (hConfirm(NOSTR_UNDO_EDITING)) + LoadWindows(self); + } + +METHOD VOID nocomman_ncoe_insert(PR_NOCOMMAN *self) + { + CheckEditing(self); + if (!(p_send2(DatApp3,O_EW_PASTE_CLIP))) + hInfoPrint(NOSTR_NO_TEXT_INSERTED); + } + +METHOD VOID nocomman_ncoe_copy(PR_NOCOMMAN *self) + { + CheckEditing(self); + if (!(p_send2(DatApp3,O_EW_REPLACE_CLIP))) + hInfoPrint(NOSTR_NO_TEXT_COPIED); + else + hInfoPrint(NOSTR_TEXT_COPIED); + } + +METHOD VOID nocomman_ncoe_bring(PR_NOCOMMAN *self) + { + INT lkpid; + ULONG lkfmt; + + CheckEditing(self); + lkpid=p_send3(w_am->appman.system,O_SY_LINK_PASTE,&lkfmt); + if (!lkpid || !(lkfmt & (1<nocomman.which; + if (mods&W_SHIFT_MODIFIER) + { + if (!which--) + which=FIND_WINDOW; + } + else if (which++==FIND_WINDOW) + which=TITLE_WINDOW; + FocusTo(self,which); + } + +METHOD VOID nocomman_ncot_set(PR_NOCOMMAN *self,INT commid) + { + if (commid>=O_NCOT_SET_ALL) + eTagAllNotes(commid-O_NCOT_SET_ALL); + else + TagCurrentNote(commid-O_NCOT_SET); + LoadTagStatus(self); + GiveTagCount(); + } + +METHOD VOID nocomman_ncox_goto(PR_NOCOMMAN *self) + { + UWORD where; + + where=self->nocomman.where; + if (!RunDialog(C_NODL_GOTO,NODL_GOTO,&where)) + return; + if (where==self->nocomman.where) + return; + RecordAnyChanges(self); + SetTo(self,where); + } + +METHOD VOID nocomman_ncox_moveto(PR_NOCOMMAN *self) + { + UWORD where; + + where=0; + if (!RunDialog(C_NODL_GOTO,NODL_MOVETO,&where)) + return; + if (where==self->nocomman.where) + return; + RecordAnyChanges(self); + eMoveNoteTo(where,self->nocomman.where); + SetTo(self,where); + } + +METHOD VOID nocomman_ncos_options(PR_NOCOMMAN *self) + { + RunDialog(C_NODL_OPTIONS,NODL_OPTIONS,NULL); + } + +METHOD VOID nocomman_nco_quick_find(PR_NOCOMMAN *self,INT dir) + { + INT here; + + here=EdwinChanged(self,FIND_WINDOW)? + DatApp1->varoot.nrec: self->nocomman.where; + DoSearch(self,here,dir); + } + +METHOD VOID nocomman_ncos_forwards(PR_NOCOMMAN *self) + { + DoSearch(self,self->nocomman.where,+1); + } + +METHOD VOID nocomman_ncos_backwards(PR_NOCOMMAN *self) + { + DoSearch(self,self->nocomman.where,-1); + } + +METHOD VOID nocomman_ncos_first(PR_NOCOMMAN *self) + { + DoSearch(self,DatApp1->varoot.nrec,+1); + } + +METHOD VOID nocomman_ncos_last(PR_NOCOMMAN *self) + { + DoSearch(self,DatApp1->varoot.nrec,-1); + } + diff --git a/code/SIBOSDK/notes/nodlgs.c b/code/SIBOSDK/notes/nodlgs.c new file mode 100644 index 0000000..2238d3c --- /dev/null +++ b/code/SIBOSDK/notes/nodlgs.c @@ -0,0 +1,42 @@ +/* NODLGS.C */ + +#include +#include +#include + +GLREF_D PR_VAFLAT *DatApp1; +GLREF_D PR_NOCOMMAN *DatApp2; + +#pragma METHOD_CALL + +METHOD VOID nodl_goto_dl_dyn_init(PR_DLGBOX *self) + { + SE_NCEDIT set; + + set.high=DatApp1->varoot.nrec; + set.value=(*(UWORD *)self->dlgbox.rbuf)+1; + set.flags=SE_NCEDIT_VALUE|SE_NCEDIT_HIGH; + hDlgSet(1,&set); + } + +METHOD INT nodl_goto_dl_key(PR_DLGBOX *self) + { + *(UWORD *)self->dlgbox.rbuf=hDlgSenseNcedit(1)-1; + return(WN_KEY_CHANGED); + } + +#define NODL_OPTIONS_CASESENS 1 +#define NODL_OPTIONS_FINDTYPE 2 + +METHOD VOID nodl_options_dl_dyn_init(PR_DLGBOX *self) + { + hDlgSetChlist(NODL_OPTIONS_CASESENS,DatApp2->nocomman.casesens); + hDlgSetChlist(NODL_OPTIONS_FINDTYPE,DatApp2->nocomman.findtype); + } + +METHOD INT nodl_options_dl_key(PR_DLGBOX *self) + { + DatApp2->nocomman.casesens=hDlgSenseChlist(NODL_OPTIONS_CASESENS); + DatApp2->nocomman.findtype=hDlgSenseChlist(NODL_OPTIONS_FINDTYPE); + return(WN_KEY_CHANGED); + } diff --git a/code/SIBOSDK/notes/noengine.c b/code/SIBOSDK/notes/noengine.c new file mode 100644 index 0000000..9100379 --- /dev/null +++ b/code/SIBOSDK/notes/noengine.c @@ -0,0 +1,130 @@ +/* NOENGINE.C */ + +#include +#include +#include + +GLREF_D PR_VAFLAT *DatApp1; + +GLDEF_C NOTE *ePointToNote(INT pos) + { + return((NOTE *)p_send3(DatApp1,O_VA_PREC,pos)); + } + +GLDEF_C INT eAppendNullEntry(VOID) + { + NOTE note; + + if (DatApp1->varoot.nrec==MAX_NUMBER_NOTES) + { + hInfoPrint(NOSTR_MAX_NUMBER_NOTES); + p_leave(RUN_ACTIVE_CLEANUP_NONOTIFY); + } + p_bfil(¬e,sizeof(NOTE),0); + p_send3(DatApp1,O_VA_APPEND,¬e); + return(DatApp1->varoot.nrec-1); + } + +LOCAL_C VOID ZeroLenBuf(LENBUF *lb) + { + p_free(lb->buf); + lb->buf=NULL; + lb->len=0; + } + +GLDEF_C VOID eZeroNote(NOTE *pn) + { + ZeroLenBuf(&pn->title); + ZeroLenBuf(&pn->note); + pn->tagged=FALSE; + } + +GLDEF_C INT eDeleteNote(INT pos) + { + if (DatApp1->varoot.nrec==1) + { + eZeroNote(ePointToNote(0)); + return(0); + } + p_send3(DatApp1,O_VA_DELETE,pos); + p_send(DatApp1,O_VA_COMPRESS); + if (pos==DatApp1->varoot.nrec) + pos--; + return(pos); + } + +GLDEF_C VOID eInitialiseEngine(VOID) + { + DatApp1=f_newsend(CAT_NOTES_OLIB,C_VAFLAT,O_VA_INIT,sizeof(NOTE),4); + eAppendNullEntry(); + } + +GLDEF_C INT eCountTaggedNotes(VOID) + { + INT ret; + INT i; + NOTE *pn; + + ret=0; + pn=ePointToNote(0); + i=DatApp1->varoot.nrec; + while (i--) + { + if (pn->tagged) + ret++; + pn++; + } + return(ret); + } + +GLDEF_C VOID eTagAllNotes(INT clear) + { + INT set; + INT i; + NOTE *pn; + + set=(!clear); + pn=ePointToNote(0); + i=DatApp1->varoot.nrec; + while (i--) + { + pn->tagged=set; + pn++; + } + } + +#pragma save,ENTER_CALL + +LOCAL_C INT TakeCopyLenBuf(LENBUF *targ,LENBUF *src) + { + targ->buf=f_alloc(src->len); + p_bcpy(targ->buf,src->buf,src->len); + targ->len=src->len; + return(0); + } + +#pragma restore + +GLDEF_C VOID eTakeCopy(NOTE *targ,NOTE *src) + { + INT ret; + + TakeCopyLenBuf(&targ->title,&src->title); + ret=p_enter3(TakeCopyLenBuf,&targ->note,&src->note); + if (ret) + { + p_free(targ->title.buf); + targ->title.buf=0; + p_leave(ret); + } + targ->tagged=src->tagged; + } + +GLDEF_C VOID eMoveNoteTo(INT newpos,INT pos) + { + NOTE moving; + + moving=*ePointToNote(pos); + p_send3(DatApp1,O_VA_DELETE,pos); + p_send4(DatApp1,O_VA_INSERT,newpos,&moving); + } diff --git a/code/SIBOSDK/notes/nolayout.h b/code/SIBOSDK/notes/nolayout.h new file mode 100644 index 0000000..2001291 --- /dev/null +++ b/code/SIBOSDK/notes/nolayout.h @@ -0,0 +1,26 @@ +/* NOLAYOUT.H */ + +typedef struct + { + UBYTE Version4; + UBYTE StatusWindow; + UWORD StatusWindowWidth; + UWORD ScreenWidth; + UWORD ScreenHeight; + UWORD FontHeight; + UWORD FontAscent; + } LAYOUT_DATA; + +#define DOUBLE_SHADOW_WIDTH 2 + +#define EDGE_TLX 5 +#define EDGE_TLY 2 +#define EDGE_BRX (EDGE_TLX+DOUBLE_SHADOW_WIDTH) +#define EDGE_BRY (EDGE_TLY+DOUBLE_SHADOW_WIDTH) +#define EDGE_WIDTH (EDGE_TLX+EDGE_BRX) +#define EDGE_HEIGHT (EDGE_TLY+EDGE_BRY) + +#define BASIC_GAP_BETWEEN_WINDOWS 1 +#define REQD_EDGE_PIXELS (3*EDGE_HEIGHT+2*BASIC_GAP_BETWEEN_WINDOWS) + +#define TEXT_WINDOW_EDGE_WIDTH 3 diff --git a/code/SIBOSDK/notes/nolinksv.c b/code/SIBOSDK/notes/nolinksv.c new file mode 100644 index 0000000..a722ce0 --- /dev/null +++ b/code/SIBOSDK/notes/nolinksv.c @@ -0,0 +1,38 @@ +/* NOLINKSV.C */ + +#include +#include + +GLREF_D PR_EDWIN *DatApp3; + +GLDEF_C VOID InitLinkServer(VOID) + { + f_newsend(CAT_NOTES_NOTES,C_NOLINKSV,O_SV_INIT); + } + +LOCAL_C VOID DestroyLinker(PR_NOLINKSV *self) + { + hDestroy(self->nolinksv.ewls); + self->nolinksv.ewls=NULL; + } + +#pragma METHOD_CALL + +METHOD VOID nolinksv_ls_set_format(PR_NOLINKSV *self,INT type) + { + DestroyLinker(self); + self->nolinksv.ewls=f_newsend(CAT_NOTES_HWIM,C_EWLINKSV, + O_EWLS_INIT,DatApp3,type); + } + +METHOD INT nolinksv_ls_get_data(PR_NOLINKSV *self,INT len) + { + if (len>0) + { + if (((INT)(self->linksv.len=p_send4(self->nolinksv.ewls, + O_EWLS_EXTRACT,&self->linksv.buf,len)))>=0) + return(TRUE); + } + DestroyLinker(self); + return(FALSE); + } diff --git a/code/SIBOSDK/notes/nomain.c b/code/SIBOSDK/notes/nomain.c new file mode 100644 index 0000000..61b8812 --- /dev/null +++ b/code/SIBOSDK/notes/nomain.c @@ -0,0 +1,20 @@ +/* NOMAIN.C */ + +#include + +#define APPMAN_FLGS (FLG_APPMAN_RSCFILE|FLG_APPMAN_SRSCFILE|FLG_APPMAN_CLEAN) + +GLDEF_C VOID main(VOID) + { + IN_HWIMMAN app; + IN_WSERV wserv; + + p_linklib(0); + app.flags=APPMAN_FLGS|FLG_APPMAN_LINKING|FLG_APPMAN_IPCS| + FLG_APPMAN_FULLSCREEN; + wserv.com_cat=app.wserv_cat=p_getlibh(CAT_NOTES_NOTES); + app.wserv_class=C_NOWSERV; + wserv.com_class=C_NOCOMMAN; + p_send4(p_new(CAT_NOTES_HWIM,C_HWIMMAN),O_AM_INIT,&app,&wserv); + } + diff --git a/code/SIBOSDK/notes/notes.afl b/code/SIBOSDK/notes/notes.afl new file mode 100644 index 0000000..7578d91 --- /dev/null +++ b/code/SIBOSDK/notes/notes.afl @@ -0,0 +1,3 @@ +notes.pic +notes.rsc +notes.shd diff --git a/code/SIBOSDK/notes/notes.cat b/code/SIBOSDK/notes/notes.cat new file mode 100644 index 0000000..3d1e018 --- /dev/null +++ b/code/SIBOSDK/notes/notes.cat @@ -0,0 +1,165 @@ +IMAGE notes + +EXTERNAL olib +EXTERNAL hwim + +INCLUDE hwimman.g +INCLUDE edwin.g +INCLUDE ipc.g + +CLASS nowin bwin + { + REPLACE wn_key + REPLACE wn_emphasise + REPLACE wn_draw + REPLACE wn_init + ADD nw_increase_width + ADD nw_init=p_dummy + PROPERTY 1 + { + PR_EDWIN *edwin; + } + } + +CLASS notitwin nowin + { + REPLACE wn_key + } + +CLASS nofndwin nowin + { + REPLACE destroy + REPLACE wn_draw + REPLACE wn_key + REPLACE nw_init + PROPERTY + { + TEXT *prompt; + UWORD len; + UWORD x; + UWORD y; + } + } + +CLASS notagwin win + { + REPLACE wn_set + REPLACE wn_sense + REPLACE wn_draw + PROPERTY + { + UWORD on; + } + } + +CLASS nocntwin win + { + REPLACE wn_set + REPLACE wn_sense + REPLACE wn_draw + PROPERTY + { + UWORD val; + UWORD max; + } + } + +CLASS nocomman comman + { + REPLACE com_init + REPLACE com_statwin + REPLACE com_exit + ADD ncon_new + ADD ncon_insert + ADD ncon_copy + ADD ncon_delete + ADD ncon_record + ADD ncon_undo + ADD ncoe_insert + ADD ncoe_copy + ADD ncoe_bring + ADD ncoe_evaluate + ADD ncoe_sum=p_dummy + ADD ncow_title + ADD ncow_notes=nocomman_ncow_title + ADD ncow_find=nocomman_ncow_title + ADD ncos_options + ADD ncos_forwards + ADD ncos_backwards + ADD ncos_first + ADD ncos_last + ADD ncot_set + ADD ncot_clear=nocomman_ncot_set + ADD ncot_set_all=nocomman_ncot_set + ADD ncot_clear_all=nocomman_ncot_set + ADD ncox_goto + ADD ncox_moveto + ADD ncox_symbols=p_dummy + ADD ncox_psetup + ADD ncox_print=p_dummy + ADD nco_switch_focus + ADD nco_quick_find + TYPES + { + typedef struct + { + UBYTE len; + TEXT *buf; + } LENBUF; + typedef struct + { + LENBUF title; + LENBUF note; + UWORD tagged; + } NOTE; + } + CONSTANTS + { + TITLE_WINDOW 0 + NOTES_WINDOW 1 + FIND_WINDOW 2 + MAX_NUMBER_NOTES 99 + FIND_NOTES_ONLY 0 + FIND_TITLE_ONLY 1 + FIND_EITHER_WIN 2 + } + PROPERTY + { + PR_NOWIN *edit[3]; + UWORD which; + PR_NOTAGWIN *tagwin; + PR_NOCNTWIN *cntwin; + WORD where; + UBYTE casesens; + UBYTE findtype; + NOTE clip; + SE_EDWIN pattern; + } + } + +CLASS nowserv wserv + { + REPLACE ws_background + } + +CLASS nolinksv linksv + { + REPLACE ls_set_format + REPLACE ls_get_data + PROPERTY + { + PR_EWLINKSV *ewls; + } + } + +CLASS nodl_goto dlgbox + { + REPLACE dl_dyn_init + REPLACE dl_key + } + +CLASS nodl_options dlgbox + { + REPLACE dl_dyn_init + REPLACE dl_key + } diff --git a/code/SIBOSDK/notes/notes.def b/code/SIBOSDK/notes/notes.def new file mode 100644 index 0000000..430ed50 --- /dev/null +++ b/code/SIBOSDK/notes/notes.def @@ -0,0 +1,12 @@ +GLREF_C NOTE *ePointToNote(INT pos); +GLREF_C INT eAppendNullEntry(VOID); +GLREF_C VOID eZeroNote(NOTE *pn); +GLREF_C INT eDeleteNote(INT pos); +GLREF_C VOID eInitialiseEngine(VOID); +GLREF_C INT eCountTaggedNotes(VOID); +GLREF_C VOID eTagAllNotes(INT clear); +GLREF_C VOID eTagCurrentNote(INT clear); +GLREF_C VOID eTakeCopy(NOTE *targ,NOTE *src); +GLREF_C VOID eMoveNoteTo(INT newpos,INT pos); + +GLREF_C VOID InitLinkServer(VOID); diff --git a/code/SIBOSDK/notes/notes.ms b/code/SIBOSDK/notes/notes.ms new file mode 100644 index 0000000..a5bd624 --- /dev/null +++ b/code/SIBOSDK/notes/notes.ms @@ -0,0 +1,3 @@ +Notes + +5000 diff --git a/code/SIBOSDK/notes/notes.plk b/code/SIBOSDK/notes/notes.plk new file mode 100644 index 0000000..62740c6 --- /dev/null +++ b/code/SIBOSDK/notes/notes.plk @@ -0,0 +1,2 @@ +notes1.pic +notes2.pic diff --git a/code/SIBOSDK/notes/notes.pr b/code/SIBOSDK/notes/notes.pr new file mode 100644 index 0000000..00b33cb --- /dev/null +++ b/code/SIBOSDK/notes/notes.pr @@ -0,0 +1,45 @@ +#system epoc img +#set epocinit=iplib +#model small jpi + +#compile notes.cat + +#if %remake #or (notes.rg #older notes.re) #or (notes.rg #older notes.g) #then + #run "re notes" no_window no_abort +#endif + +#if (notes.rsg #older notes.rss) #or (notes.rsg #older notes.rg) #then + #file delete notes.rsg + #run "rs notes" no_window no_abort +#endif + +#if notes.rzc #older notes.rsg #then + #run "rch notes" no_window no_abort + #file delete notes.img +#endif + +#compile nocomman.c +#compile nodlgs.c +#compile noengine.c +#compile nolinksv.c +#compile nomain.c +#compile nowin.c +#compile nowserv.c + +#if (notes.pic #older notes1.pic) #or (notes.pic #older notes2.pic) #then + #run "wspcx -l notes" no_window no_abort + #file delete notes.img +#endif + +#if notes.shd #older notes.ms #then + #run "makeshd notes" no_window no_abort + #file delete notes.img +#endif + +#if (notes.img #older notes.afl) #or (notes.img #older notes.pic) #then + #file delete notes.img +#endif + +#pragma link(hwim.lib) + +#link notes.img diff --git a/code/SIBOSDK/notes/notes.re b/code/SIBOSDK/notes/notes.re new file mode 100644 index 0000000..28e34e5 --- /dev/null +++ b/code/SIBOSDK/notes/notes.re @@ -0,0 +1,31 @@ +#include + +_O_COM_EXIT +_O_NCON_NEW +_O_NCON_INSERT +_O_NCON_COPY +_O_NCON_DELETE +_O_NCON_RECORD +_O_NCON_UNDO +_O_NCOE_INSERT +_O_NCOE_COPY +_O_NCOE_BRING +_O_NCOE_EVALUATE +_O_NCOE_SUM +_O_NCOW_TITLE +_O_NCOW_NOTES +_O_NCOW_FIND +_O_NCOS_OPTIONS +_O_NCOS_FORWARDS +_O_NCOS_BACKWARDS +_O_NCOS_FIRST +_O_NCOS_LAST +_O_NCOT_SET +_O_NCOT_CLEAR +_O_NCOT_SET_ALL +_O_NCOT_CLEAR_ALL +_O_NCOX_GOTO +_O_NCOX_MOVETO +_O_NCOX_SYMBOLS +_O_NCOX_PSETUP +_O_NCOX_PRINT diff --git a/code/SIBOSDK/notes/notes.rss b/code/SIBOSDK/notes/notes.rss new file mode 100644 index 0000000..4f8ac3c --- /dev/null +++ b/code/SIBOSDK/notes/notes.rss @@ -0,0 +1,330 @@ +/* NOTES.RSS */ + +#include +#include +#include +#include + +RESOURCE WSERV_INFO notes_accs + { + menbar_id=notes_menubar; + first_com=O_COM_EXIT; + accel={'x', + 'a','j','k','d','r','u', + 'i','c','b','e','z', + 't','n','f', + 'o','s','w','q','l', + '+','-','*','/', + 'g','m','h','y','p'}; + } + +RESOURCE MENU_BAR notes_menubar + { + items = + { + MENU_BAR_ITEM + { + menu_id=notes_menu; + mb_item="Notes"; + }, + MENU_BAR_ITEM + { + menu_id=edit_menu; + mb_item="Edit"; + }, + MENU_BAR_ITEM + { + menu_id=windows_menu; + mb_item="Windows"; + }, + MENU_BAR_ITEM + { + menu_id=search_menu; + mb_item="Search"; + }, + MENU_BAR_ITEM + { + menu_id=tag_menu; + mb_item="Tag"; + }, + MENU_BAR_ITEM + { + menu_id=special_menu; + mb_item="Special"; + } + }; + } + +RESOURCE MENU notes_menu + { + items = + { + MENU_ITEM + { + com_id=O_NCON_NEW; + mn_item="New note"; + }, + MENU_ITEM + { + com_id=O_NCON_INSERT; + mn_item="Insert note"; + }, + MENU_ITEM + { + com_id=O_NCON_COPY; + mn_item="Copy note"; + }, + MENU_ITEM + { + com_id=O_NCON_DELETE; + mn_item="Delete note"; + }, + MENU_ITEM + { + com_id=O_NCON_RECORD; + mn_item="Record"; + }, + MENU_ITEM + { + com_id=O_NCON_UNDO; + mn_item="Undo"; + } + }; + } + +RESOURCE MENU edit_menu + { + items = + { + MENU_ITEM + { + com_id=O_NCOE_INSERT; + mn_item="Insert text"; + }, + MENU_ITEM + { + com_id=O_NCOE_COPY; + mn_item="Copy text"; + }, + MENU_ITEM + { + com_id=O_NCOE_BRING; + mn_item="Bring"; + }, + MENU_ITEM + { + com_id=O_NCOE_EVALUATE; + mn_item="Evaluate"; + }, + MENU_ITEM + { + com_id=O_NCOE_SUM; + mn_item="Sum"; + } + }; + } + +RESOURCE MENU windows_menu + { + items = + { + MENU_ITEM + { + com_id=O_NCOW_TITLE; + mn_item="Title window"; + }, + MENU_ITEM + { + com_id=O_NCOW_NOTES; + mn_item="Notes window"; + }, + MENU_ITEM + { + com_id=O_NCOW_FIND; + mn_item="Find window"; + } + }; + } + +RESOURCE MENU search_menu + { + items = + { + MENU_ITEM + { + com_id=O_NCOS_OPTIONS; + mn_item="Options"; + }, + MENU_ITEM + { + com_id=O_NCOS_FORWARDS; + mn_item="Search forwards"; + }, + MENU_ITEM + { + com_id=O_NCOS_BACKWARDS; + mn_item="Search backwards"; + }, + MENU_ITEM + { + com_id=O_NCOS_FIRST; + mn_item="Search first"; + }, + MENU_ITEM + { + com_id=O_NCOS_LAST; + mn_item="Search last"; + } + }; + } + +RESOURCE MENU tag_menu + { + items = + { + MENU_ITEM + { + com_id=O_NCOT_SET; + mn_item="Set"; + }, + MENU_ITEM + { + com_id=O_NCOT_CLEAR; + mn_item="Clear"; + }, + MENU_ITEM + { + com_id=O_NCOT_SET_ALL; + mn_item="Tag all"; + }, + MENU_ITEM + { + com_id=O_NCOT_CLEAR_ALL; + mn_item="Clear all"; + } + }; + } + +RESOURCE MENU special_menu + { + items = + { + MENU_ITEM + { + com_id=O_NCOX_GOTO; + mn_item="Go to"; + }, + MENU_ITEM + { + com_id=O_NCOX_MOVETO; + mn_item="Move to"; + }, + MENU_ITEM + { + com_id=O_NCOX_SYMBOLS; + mn_item="Show symbols"; + }, + MENU_ITEM + { + com_id=O_NCOX_PSETUP; + mn_item="Print setup"; + }, + MENU_ITEM + { + com_id=O_NCOX_PRINT; + mn_item="Print"; + }, + MENU_ITEM + { + com_id=O_COM_EXIT; + mn_item="Exit"; + } + }; + } + +RESOURCE STRING nostr_find_prompt { str="Find: "; } /* includes space */ +RESOURCE STRING nostr_max_number_notes { str="Maximum number of notes already reached"; } + +RESOURCE STRING nostr_no_note_inserted { str="No note to insert"; } +RESOURCE STRING nostr_note_copied { str="Note copied"; } +RESOURCE STRING nostr_no_note_copied { str="No note to copy"; } +RESOURCE STRING nostr_note_recorded { str="Note recorded"; } + +RESOURCE STRING nostr_no_text_inserted { str="No text to insert"; } +RESOURCE STRING nostr_no_text_copied { str="No text to copy"; } +RESOURCE STRING nostr_text_copied { str="Text copied"; } +RESOURCE STRING nostr_only_in_notes { str="Only available in notes window"; } +RESOURCE STRING nostr_tag_count { str="Number of notes currently tagged: %d"; } +RESOURCE STRING nostr_delete_note { str="Delete this note"; } +RESOURCE STRING nostr_undo_editing { str="Undo editing"; } +RESOURCE STRING nostr_not_found { str="Not found"; } +RESOURCE STRING nostr_not_changed { str="Not changed"; } + +RESOURCE DIALOG nodl_goto + { + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_RBUF_FILLED; + title="Go to"; + controls= + { + CONTROL + { + class=C_NCEDIT; + prompt="Note number"; + info=NCEDIT + { + low=1; + high=99; + }; + } + }; + } + +RESOURCE DIALOG nodl_moveto + { + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_RBUF_FILLED; + title="Move note"; + controls= + { + CONTROL + { + class=C_NCEDIT; + prompt="New note number"; + info=NCEDIT + { + low=1; + high=99; + }; + } + }; + } + +RESOURCE MENU nom_find_types + { + items = + { + CHOICE_ITEM { str="Just notes";}, + CHOICE_ITEM { str="Just title";}, + CHOICE_ITEM { str="Title and notes";} + }; + } + +RESOURCE DIALOG nodl_options + { + title="Options for search"; + flags=DLGBOX_NOTIFY_ENTER; + controls= + { + CONTROL + { + class=C_CHLIST; + prompt="Case sensitive"; + info=CHLIST { rid=-SYS_NO_YES; }; + }, + CONTROL + { + class=C_CHLIST; + prompt="Search"; + info=CHLIST { rid=nom_find_types; }; + } + }; + } diff --git a/code/SIBOSDK/notes/notes1.pic b/code/SIBOSDK/notes/notes1.pic new file mode 100644 index 0000000..63d830f Binary files /dev/null and b/code/SIBOSDK/notes/notes1.pic differ diff --git a/code/SIBOSDK/notes/notes2.pic b/code/SIBOSDK/notes/notes2.pic new file mode 100644 index 0000000..eeb14f9 Binary files /dev/null and b/code/SIBOSDK/notes/notes2.pic differ diff --git a/code/SIBOSDK/notes/notesrel.prj b/code/SIBOSDK/notes/notesrel.prj new file mode 100644 index 0000000..5e96ff0 --- /dev/null +++ b/code/SIBOSDK/notes/notesrel.prj @@ -0,0 +1,23 @@ +notesrel.prj ! release files list +notes.pr ! TS project file +make.bat ! makes NOTES.APP +! +nolayout.h ! layout constants +notes.def ! function prototypes +notes.cat ! category file +notes.re ! resource externals +notes.rss ! resource script +! +nocomman.c ! command manager +nodlgs.c ! dialogs +noengine.c ! engine +nolinksv.c ! link server +nomain.c ! main +nowin.c ! note window +nowserv.c ! window server +! +notes.afl ! add file list +notes1.pic ! s3 icon +notes2.pic ! s3a icon +notes.plk ! icon link file +notes.ms ! shell data source file diff --git a/code/SIBOSDK/notes/nowin.c b/code/SIBOSDK/notes/nowin.c new file mode 100644 index 0000000..39ef104 --- /dev/null +++ b/code/SIBOSDK/notes/nowin.c @@ -0,0 +1,164 @@ +/* NOWIN.C */ + +#include +#include +#include +#include "nolayout.h" + +GLREF_D PR_NOCOMMAN *DatApp2; +GLREF_D LAYOUT_DATA ld; + +LOCAL_C VOID DrawTextInWindow(INT wid,TEXT *pstr) + { + W_WINDATA wd; + + wInquireWindow(wid,&wd); + wd.extent.tl.x=wd.extent.tl.y=0; + gPrintBoxText((P_RECT *)(&wd.extent),ld.FontAscent+1, + G_TEXT_ALIGN_CENTRE,0,pstr,p_slen(pstr)); + } + +#pragma METHOD_CALL + +METHOD VOID nowin_wn_key(PR_NOWIN *self,INT keycode,INT mods) + { + if (keycode==W_KEY_TAB) + p_send3(DatApp2,O_NCO_SWITCH_FOCUS,mods); + else + p_send4(self->nowin.edwin,O_WN_KEY,keycode,mods); + } + +METHOD VOID nowin_wn_emphasise(PR_NOWIN *self,INT emphasise) + { + p_supersend3(self,O_WN_EMPHASISE,emphasise); + p_send3(self->nowin.edwin,O_WN_EMPHASISE,emphasise); + } + +METHOD VOID nowin_wn_draw(PR_NOWIN *self) + { + p_supersend2(self,O_WN_DRAW); + p_send2(self->nowin.edwin,O_WN_DRAW); + } + +METHOD VOID nowin_wn_init(PR_NOWIN *self,IN_EDWIN *pined,IN_EDWIN_X *pinx) + { + W_WINDATA wd; + + wd.extent.tl=pinx->pos; + wd.extent.width=pined->vulen; + wd.extent.height=ld.FontHeight+2; + if (pined->flags&IN_EDWIN_VISLINES_SUPPLIED) + wd.extent.height*=pinx->vislines; + wd.extent.height+=EDGE_HEIGHT; + p_send5(self,O_WN_CONNECT,NULL,W_WIN_EXTENT,&wd); + self->win.flags=PR_BWIN_CORNER_4|PR_BWIN_SHADOW_2; + pinx->pos.x=EDGE_TLX; + pinx->pos.y=EDGE_TLY; + pined->vulen-=EDGE_WIDTH; + p_send4(self,O_NW_INIT,pined,pinx); + self->nowin.edwin=f_newsend(CAT_NOTES_HWIM,C_EDWIN, + O_WN_INIT,pined,self,pinx); + } + +METHOD VOID nowin_nw_increase_width(PR_NOWIN *self,INT increase) + { + W_WINDATA wd; + PR_EDWIN *edwin; + + wInvalidateWin(self->win.id); + wInquireWindow(self->win.id,&wd); + wd.extent.width+=increase; + wSetWindow(self->win.id,W_WIN_EXTENT,&wd); + edwin=self->nowin.edwin; + p_send3(edwin,O_EW_SENSE_SIZE,&wd.extent); + edwin->edwin.margins.right+=increase; + wd.extent.width+=increase; + p_send4(edwin,O_EW_SET_SIZE,&wd.extent,NULL); + } + +METHOD VOID notitwin_wn_key(PR_NOWIN *self,INT keycode,INT mods) + { + if (keycode==W_KEY_RETURN) + p_send3(DatApp2,O_NCO_SWITCH_FOCUS,mods); + else + p_supersend4(self,O_WN_KEY,keycode,mods); + } + +METHOD VOID nofndwin_wn_key(PR_NOWIN *self,INT keycode,INT mods) + { + if (keycode==W_KEY_RETURN) + p_send3(DatApp2,O_NCO_QUICK_FIND,mods&W_SHIFT_MODIFIER? -1: +1); + else + p_supersend4(self,O_WN_KEY,keycode,mods); + } + +METHOD VOID nofndwin_destroy(PR_NOFNDWIN *self) + { + p_free(self->nofndwin.prompt); + p_supersend2(self,O_DESTROY); + } + +METHOD VOID nofndwin_nw_init(PR_NOFNDWIN *self,IN_EDWIN *pined,IN_EDWIN_X *pinx) + { + UWORD width; + + self->nofndwin.x=EDGE_TLX; + self->nofndwin.y=EDGE_TLY+(1+ld.FontAscent); + self->nofndwin.len= + hLoadResource(NOSTR_FIND_PROMPT,&self->nofndwin.prompt)-1; + width=gTextWidth(WS_FONT_SYSTEM,G_STY_ITALIC, + self->nofndwin.prompt,self->nofndwin.len); + pinx->pos.x=EDGE_TLX+width; + pined->vulen-=width; + } + +METHOD VOID nofndwin_wn_draw(PR_NOFNDWIN *self) + { + p_supersend2(self,O_WN_DRAW); + hSetGStyle(G_STY_ITALIC); + gPrintText(self->nofndwin.x,self->nofndwin.y, + self->nofndwin.prompt,self->nofndwin.len); + hSetGStyle(G_STY_NORMAL); + } + +METHOD VOID notagwin_wn_set(PR_NOTAGWIN *self,INT on) + { + if (on==self->notagwin.on) + return; + wInvalidateWin(self->win.id); + self->notagwin.on=on; + } + +#define TICK_SYM_AS_STRING "\014" + +METHOD VOID notagwin_wn_draw(PR_NOTAGWIN *self) + { + DrawTextInWindow(self->win.id,self->notagwin.on? TICK_SYM_AS_STRING: ""); + } + +METHOD INT notagwin_wn_sense(PR_NOTAGWIN *self) + { + return(hGetSWid(TICK_SYM_AS_STRING)+TEXT_WINDOW_EDGE_WIDTH); + } + +METHOD VOID nocntwin_wn_set(PR_NOCNTWIN *self,INT val,INT max) + { + if (val==self->nocntwin.val && max==self->nocntwin.max) + return; + wInvalidateWin(self->win.id); + self->nocntwin.val=val; + self->nocntwin.max=max; + } + +METHOD VOID nocntwin_wn_draw(PR_NOCNTWIN *self) + { + TEXT buf[10]; + + p_atos(&buf[0],"%d/%d",self->nocntwin.val,self->nocntwin.max); + DrawTextInWindow(self->win.id,&buf[0]); + } + +METHOD INT nocntwin_wn_sense(PR_NOCNTWIN *self) + { + return(hGetSWid("99/99")+TEXT_WINDOW_EDGE_WIDTH); + } diff --git a/code/SIBOSDK/notes/nowserv.c b/code/SIBOSDK/notes/nowserv.c new file mode 100644 index 0000000..17efcd6 --- /dev/null +++ b/code/SIBOSDK/notes/nowserv.c @@ -0,0 +1,21 @@ +/* NOWSERV.C */ + +#include + +GLREF_D PR_HWIMMAN *w_am; +GLREF_D PR_NOCOMMAN *DatApp2; +GLREF_D PR_EDWIN *DatApp3; + +#pragma METHOD_CALL + +METHOD VOID nowserv_ws_background(PR_NOWSERV *self) + { + INT fmt; + + if (!(self->wserv.flags&PR_WSERV_RECEIVED_KEY)) + return; + fmt=0; + if (DatApp2->nocomman.which==NOTES_WINDOW && DatApp3->edwin.select) + fmt=(1<appman.system,O_SY_LINK_SERVER,fmt,0); + } diff --git a/code/SIBOSDK/oopdemo/cc.bat b/code/SIBOSDK/oopdemo/cc.bat new file mode 100644 index 0000000..b95f574 --- /dev/null +++ b/code/SIBOSDK/oopdemo/cc.bat @@ -0,0 +1,3 @@ +@echo off +call checkvid +tscx %1.c /fpunnamed /%jpivid% diff --git a/code/SIBOSDK/oopdemo/checkvid.bat b/code/SIBOSDK/oopdemo/checkvid.bat new file mode 100644 index 0000000..5c6199f --- /dev/null +++ b/code/SIBOSDK/oopdemo/checkvid.bat @@ -0,0 +1,2 @@ +@if not "%jpivid%"=="v2" set jpivid=v0 + diff --git a/code/SIBOSDK/oopdemo/dirlist.c b/code/SIBOSDK/oopdemo/dirlist.c new file mode 100644 index 0000000..cee1e15 --- /dev/null +++ b/code/SIBOSDK/oopdemo/dirlist.c @@ -0,0 +1,31 @@ +/* +DIRLIST +*/ + +#include +#include + +#pragma METHOD_CALL + +METHOD INT dirlist_va_test(PR_DIRLIST *self,RC_VAXVAR *prec1,RC_VAXVAR *prec2) +/* +Firstly perform a 2 way test on file or dir name records. +Order dir names before file names. +Otherwise order names alphabetically. +Return 0 if equal, <0 if *prec1 is before *prec2, >0 if after. +*/ + { + FAST DIRLIST_ITEM *p1,*p2; + FAST INT ret; + + ret=0; + p1=(DIRLIST_ITEM *)prec1->buf; + p2=(DIRLIST_ITEM *)prec2->buf; + if ((p1->info.status&P_FADIR)^(p2->info.status&P_FADIR)) + ret=(p1->info.status&P_FADIR)?-1:+1; + else /* both records either dir or file names */ + ret=p_scmp(&p1->name[0],&p2->name[0]); + if (self->varoot.key.desc) + ret=(-ret); /* reverse result if required */ + return(ret); + } diff --git a/code/SIBOSDK/oopdemo/dirmain.c b/code/SIBOSDK/oopdemo/dirmain.c new file mode 100644 index 0000000..39b56d0 --- /dev/null +++ b/code/SIBOSDK/oopdemo/dirmain.c @@ -0,0 +1,105 @@ +/* +DIRLIST +*/ + +#include +#include + +LOCAL_D VOID *dcb=NULL; +LOCAL_D VOID *hand; + +LOCAL_C VOID error(TEXT *msg, INT errno) + { + TEXT bb[E_MAX_ERROR_TEXT_SIZE]; + + p_close(dcb); + dcb=NULL; + p_errs(&bb[0],errno); + p_printf("%s: %s",msg,&bb[0]); + } + +LOCAL_C VOID panic(TEXT *msg, INT errno) + { + error(msg,errno); + p_leave(0); + } + +LOCAL_C VOID PrintDirLine(TEXT *name, P_INFO *pinfo) + { + P_DAYSEC ds; + P_DATE dt; + TEXT *p,b[40]; + + p=&b[0]; + if (pinfo->status&P_FAVOLUME) + p=p_scpy(p,"Vol,"); + if (pinfo->status&P_FADIR) + p=p_scpy(p,"Dir,"); + if (pinfo->status&P_FAMOD) + p=p_scpy(p,"Mod,"); + if (!(pinfo->status&P_FAWRITE)) + p=p_scpy(p,"Read,"); + if (pinfo->status&P_FASYSTEM) + p=p_scpy(p,"Sys,"); + if (pinfo->status&P_FAHIDDEN) + p=p_scpy(p,"Hid,"); + if (*(p-1)==',') + *--p=0; + p_sttods(&pinfo->modst,&ds); + p_dstodt(&ds,&dt); + p_printf("%- 12s %7lu %02u-%02u-%02u %02u:%02u %s", + name,pinfo->size,dt.day+1,dt.month+1,dt.year,dt.hour,dt.minute,&b[0]); + } + +LOCAL_C VOID CDECL PrintDirList(TEXT *dir) + { + INT ret; + UWORD i,count; + DIRLIST_ITEM *pd,d; + RC_VAXVAR rec; + + p_send2(hand,O_VA_RESET); + if ((ret=p_open(&dcb,dir,P_FDIR))!=0) + panic("Failed to open directory file",ret); + while (!(ret=p_iow(dcb,P_FREAD,&d.name[0],&d.info))) + { + rec.buf=(UBYTE *)&d; + rec.len=sizeof(d.info)+p_slen(&d.name[0])+1; + p_send4(hand,O_VA_INSERTISQ,&rec,&i); + } + p_close(dcb); + dcb=NULL; + if (ret!=E_FILE_EOF) + panic("Failed to read directory",ret); + if (!(count=p_send2(hand,O_VA_COUNT))) + p_printf("No files found"); + else + { + for (i=0;iname[0],&pd->info); + } + } + } + +GLDEF_C INT CDECL DoDirLists(VOID) + { + TEXT name[P_FNAMESIZE]; + + hand=f_newsend(CAT_PRNDIR_PRNDIR,C_DIRLIST,O_VA_INIT,16); + while (p_getl(">",&name[0],P_FNAMESIZE)) + PrintDirList(&name[0]); + p_send2(hand,O_DESTROY); + return(0); + } + +GLDEF_C INT main(VOID) + { + INT err; + + p_linklib(0); + if ((err=p_enter((VOID *)DoDirLists))!=0) + error("Called p_leave",err); + return(0); + } diff --git a/code/SIBOSDK/oopdemo/dylsort.c b/code/SIBOSDK/oopdemo/dylsort.c new file mode 100644 index 0000000..014b367 --- /dev/null +++ b/code/SIBOSDK/oopdemo/dylsort.c @@ -0,0 +1,51 @@ +/* +DYLSORT.C +*/ + +#include +#include + +GLREF_D VOID *DatCommandPtr; + +GLDEF_D P_RECT _DefScreenRect; + +LOCAL_D INT array[] = {10,1,5,7,9,3,6,8,4,2}; + +#pragma save,ENTER_CALL + +LOCAL_C INT RunSort(HANDLE dyl) + { + VOID *sort; + + sort=f_newlibh(dyl,C_ISORT); + p_send4(sort,O_SORT,&array[0],10); + p_send2(sort,O_DESTROY); + return(0); + } + +#pragma restore + +GLDEF_C INT main(VOID) + { + INT err,i; + HANDLE dyl; + VOID *dcb; + + p_openlib(&dcb,DatCommandPtr); + err=p_loadfilelib(dcb,0,&dyl,TRUE); + if (!err) + { + _DefScreenRect.tl.x=0; + _DefScreenRect.tl.y=0; + _DefScreenRect.br.x=40; + _DefScreenRect.br.y=8; + + p_printf("Sorting..."); + err=p_enter2(RunSort,dyl); + p_unloadlib(dyl); + for (i=0;i<10;i+=2) + p_printf("%4d %4d",array[i],array[i+1]); + p_getch(); + } + return(err); + } diff --git a/code/SIBOSDK/oopdemo/dylsort.dfl b/code/SIBOSDK/oopdemo/dylsort.dfl new file mode 100644 index 0000000..98e9631 --- /dev/null +++ b/code/SIBOSDK/oopdemo/dylsort.dfl @@ -0,0 +1 @@ +sort.dyl diff --git a/code/SIBOSDK/oopdemo/dylsort.pr b/code/SIBOSDK/oopdemo/dylsort.pr new file mode 100644 index 0000000..7062a2b --- /dev/null +++ b/code/SIBOSDK/oopdemo/dylsort.pr @@ -0,0 +1,7 @@ +#system epoc img +#set epocinit=iplib +#model small jpi + +#pragma link(olib.lib) +#pragma link(dylsort) +#link dylsort diff --git a/code/SIBOSDK/oopdemo/hello.afl b/code/SIBOSDK/oopdemo/hello.afl new file mode 100644 index 0000000..58bb4cc --- /dev/null +++ b/code/SIBOSDK/oopdemo/hello.afl @@ -0,0 +1,3 @@ +hello.pic +hello.rzc +hello.shd diff --git a/code/SIBOSDK/oopdemo/hello.cat b/code/SIBOSDK/oopdemo/hello.cat new file mode 100644 index 0000000..72f45f0 --- /dev/null +++ b/code/SIBOSDK/oopdemo/hello.cat @@ -0,0 +1,19 @@ +IMAGE hello + +EXTERNAL olib +EXTERNAL hwim + +INCLUDE hwimman.g + +CLASS hellows wserv +window server active object + { + REPLACE ws_dyn_init + } + +CLASS hellobw bwin +bordered window + { + REPLACE wn_init + REPLACE wn_draw + } diff --git a/code/SIBOSDK/oopdemo/hello.ms b/code/SIBOSDK/oopdemo/hello.ms new file mode 100644 index 0000000..5e9fef7 --- /dev/null +++ b/code/SIBOSDK/oopdemo/hello.ms @@ -0,0 +1,3 @@ +Hello + +0 diff --git a/code/SIBOSDK/oopdemo/hello.pic b/code/SIBOSDK/oopdemo/hello.pic new file mode 100644 index 0000000..51b7607 Binary files /dev/null and b/code/SIBOSDK/oopdemo/hello.pic differ diff --git a/code/SIBOSDK/oopdemo/hello.pr b/code/SIBOSDK/oopdemo/hello.pr new file mode 100644 index 0000000..d2128b8 --- /dev/null +++ b/code/SIBOSDK/oopdemo/hello.pr @@ -0,0 +1,41 @@ +#system epoc img +#set epocinit=iplib +#model small jpi + +#abort on + +#set version=0x100F +#set priority=0x80 +#set heapsize=0x80 + +#compile %main.cat + +#if %remake #or (%main.rg #older %main.re) #or (%main.rg #older %main.g) #then + #run "re %main" no_window no_abort +#endif + +#if (%main.rsg #older %main.rss) #or (%main.rsg #older %main.rg) #then + #file delete %main.rsg + #run "rs %main" no_window no_abort +#endif + +#if %main.rzc #older %main.rsg #then + #run "rch %main" no_window no_abort +#endif + +#compile o_hello.c + +#if %main.shd #older %main.ms #then + #run "makeshd %main" no_window no_abort + #file delete %main.img +#endif + +#if (%main.img #older %main.afl) #or (%main.img #older %main.pic) #then + #file delete %main.img +#endif + +#pragma link(olib.lib) +#pragma link(hwim.lib) + +#link %main + diff --git a/code/SIBOSDK/oopdemo/hello.re b/code/SIBOSDK/oopdemo/hello.re new file mode 100644 index 0000000..8d3b206 --- /dev/null +++ b/code/SIBOSDK/oopdemo/hello.re @@ -0,0 +1,3 @@ +#include + +_O_COM_EXIT diff --git a/code/SIBOSDK/oopdemo/hello.rss b/code/SIBOSDK/oopdemo/hello.rss new file mode 100644 index 0000000..87cdd12 --- /dev/null +++ b/code/SIBOSDK/oopdemo/hello.rss @@ -0,0 +1,40 @@ +/* + HELLO.RSS + +English resource file for Hello World application + +*/ + +#include +#include + +RESOURCE WSERV_INFO hello_accs + { + menbar_id=hello_menbar; + first_com=O_COM_EXIT; + accel={'x'}; /* Exit */ + } + +RESOURCE MENU_BAR hello_menbar + { + items= + { + MENU_BAR_ITEM + { + menu_id=special_menu; + mb_item="Special"; + } + }; + } + +RESOURCE MENU special_menu + { + items = + { + MENU_ITEM + { + com_id=O_COM_EXIT; + mn_item="Exit"; + } + }; + } diff --git a/code/SIBOSDK/oopdemo/hello2.afl b/code/SIBOSDK/oopdemo/hello2.afl new file mode 100644 index 0000000..b37736a --- /dev/null +++ b/code/SIBOSDK/oopdemo/hello2.afl @@ -0,0 +1,3 @@ +hello.pic +hello2.rzc +hello2.shd diff --git a/code/SIBOSDK/oopdemo/hello2.cat b/code/SIBOSDK/oopdemo/hello2.cat new file mode 100644 index 0000000..389f9de --- /dev/null +++ b/code/SIBOSDK/oopdemo/hello2.cat @@ -0,0 +1,31 @@ +IMAGE hello2 + +EXTERNAL olib +EXTERNAL hwim + +INCLUDE hwimman.g + +CLASS hellows wserv +window server active object + { + REPLACE ws_dyn_init + } + +CLASS hellobw bwin +bordered window + { + REPLACE wn_init + REPLACE wn_draw + REPLACE wn_set + PROPERTY + { + UWORD isbye; + } + } + +CLASS hellocm comman +command manager + { + ADD com_hello + ADD com_bye + } diff --git a/code/SIBOSDK/oopdemo/hello2.ms b/code/SIBOSDK/oopdemo/hello2.ms new file mode 100644 index 0000000..2445b28 --- /dev/null +++ b/code/SIBOSDK/oopdemo/hello2.ms @@ -0,0 +1,3 @@ +Hello2 + +0 diff --git a/code/SIBOSDK/oopdemo/hello2.pr b/code/SIBOSDK/oopdemo/hello2.pr new file mode 100644 index 0000000..1370435 --- /dev/null +++ b/code/SIBOSDK/oopdemo/hello2.pr @@ -0,0 +1,41 @@ +#system epoc img +#set epocinit=iplib +#model small jpi + +#abort on + +#set version=0x100F +#set priority=0x80 +#set heapsize=0x80 + +#compile %main.cat + +#if %remake #or (%main.rg #older %main.re) #or (%main.rg #older %main.g) #then + #run "re %main" no_window no_abort +#endif + +#if (%main.rsg #older %main.rss) #or (%main.rsg #older %main.rg) #then + #file delete %main.rsg + #run "rs %main" no_window no_abort +#endif + +#if (%main.rzc #older %main.rsg) #or (%main.rsg #older %main.rss) #then + #run "rch %main" no_window no_abort +#endif + +#compile o_hello2.c + +#if %main.shd #older %main.ms #then + #run "makeshd %main" no_window no_abort + #file delete %main.img +#endif + +#if (%main.img #older %main.afl) #or (%main.img #older %main.pic) #then + #file delete %main.img +#endif + +#pragma link(olib.lib) +#pragma link(hwim.lib) + +#link %main + diff --git a/code/SIBOSDK/oopdemo/hello2.re b/code/SIBOSDK/oopdemo/hello2.re new file mode 100644 index 0000000..d278edc --- /dev/null +++ b/code/SIBOSDK/oopdemo/hello2.re @@ -0,0 +1,6 @@ +#include +#include + +_O_COM_EXIT +_O_COM_HELLO +_O_COM_BYE diff --git a/code/SIBOSDK/oopdemo/hello2.rss b/code/SIBOSDK/oopdemo/hello2.rss new file mode 100644 index 0000000..ff021b8 --- /dev/null +++ b/code/SIBOSDK/oopdemo/hello2.rss @@ -0,0 +1,68 @@ +/* + HELLO.RSS + +English resource file for Hello World application + +*/ + +#include +#include + +RESOURCE WSERV_INFO hello_accs + { + menbar_id=hello_menbar; + first_com=O_COM_EXIT; + accel={'x', /* Exit */ + 'h', /* Hello */ + 'b'}; /* Bye */ + } + +RESOURCE MENU_BAR hello_menbar + { + items= + { + MENU_BAR_ITEM + { + menu_id=message_menu; + mb_item="Message"; + }, + MENU_BAR_ITEM + { + menu_id=special_menu; + mb_item="Special"; + } + }; + } + +RESOURCE MENU message_menu + { + items = + { + MENU_ITEM + { + com_id=O_COM_HELLO; + mn_item="Say hello"; + }, + MENU_ITEM + { + com_id=O_COM_BYE; + mn_item="Say goodbye"; + } + }; + } + +RESOURCE MENU special_menu + { + items = + { + MENU_ITEM + { + com_id=O_COM_EXIT; + mn_item="Exit"; + } + }; + } + +RESOURCE STRING hello_message {str="Hello World";} + +RESOURCE STRING bye_message {str="Goodbye Cruel World";} diff --git a/code/SIBOSDK/oopdemo/isort.c b/code/SIBOSDK/oopdemo/isort.c new file mode 100644 index 0000000..5e69799 --- /dev/null +++ b/code/SIBOSDK/oopdemo/isort.c @@ -0,0 +1,35 @@ +/* +ISORT.C +*/ + +#include + +#define IdataBuf ((INT *)DataBuf) + +LOCAL_C INT OrdFunc(INT i,INT j,VOID *DataBuf) +/* +order function used in qsort +*/ + { + return(IdataBuf[i]-IdataBuf[j]); + } + +LOCAL_C VOID ExchFunc(INT i,INT j,VOID *DataBuf) +/* +exchange function used in qsort +*/ + { + INT k; + + k=IdataBuf[i]; + IdataBuf[i]=IdataBuf[j]; + IdataBuf[j]=k; + } + +#pragma METHOD_CALL + +METHOD VOID isort_sort(PR_ROOT *self,INT *start,INT num) + { + p_qsort(num,OrdFunc,ExchFunc,start); + } + diff --git a/code/SIBOSDK/oopdemo/lf.bat b/code/SIBOSDK/oopdemo/lf.bat new file mode 100644 index 0000000..8eec323 --- /dev/null +++ b/code/SIBOSDK/oopdemo/lf.bat @@ -0,0 +1,3 @@ +@echo off +call checkvid +tscx %1.pr /l /%jpivid% diff --git a/code/SIBOSDK/oopdemo/lfc.bat b/code/SIBOSDK/oopdemo/lfc.bat new file mode 100644 index 0000000..74e04b9 --- /dev/null +++ b/code/SIBOSDK/oopdemo/lfc.bat @@ -0,0 +1,3 @@ +@echo off +if exist %1.dyl del %1.dyl +tscx %1.pr /l /v0 diff --git a/code/SIBOSDK/oopdemo/make.bat b/code/SIBOSDK/oopdemo/make.bat new file mode 100644 index 0000000..319ca30 --- /dev/null +++ b/code/SIBOSDK/oopdemo/make.bat @@ -0,0 +1,9 @@ +@echo off +call checkvid +if not exist %1.pr goto error +tscx /m %1 /%jpivid% +tscx /m %1 /%jpivid% +goto end +:error +echo Project file %1.pr does not exist +:end diff --git a/code/SIBOSDK/oopdemo/o_hello.c b/code/SIBOSDK/oopdemo/o_hello.c new file mode 100644 index 0000000..d57a743 --- /dev/null +++ b/code/SIBOSDK/oopdemo/o_hello.c @@ -0,0 +1,52 @@ +/* +O_HELLO +*/ + +#include +#include +#include + +GLREF_D WSERV_SPEC *wserv_channel; +GLREF_D VOID *w_am; + +GLDEF_C VOID main(VOID) + { + IN_HWIMMAN app; + IN_WSERV ws; + + p_linklib(0); + app.flags=/*FLG_APPMAN_FULLSCREEN|*/FLG_APPMAN_RSCFILE|FLG_APPMAN_CLEAN| + FLG_APPMAN_SRSCFILE/*|FLG_APPMAN_IPCS|FLG_APPMAN_LINKING*/; + app.wserv_cat=p_getlibh(CAT_HELLO_HELLO); + ws.com_cat=p_getlibh(CAT_HELLO_HWIM); + app.wserv_class=C_HELLOWS; + ws.com_class=C_COMMAN; + p_send4(p_new(CAT_HELLO_HWIM,C_HWIMMAN),O_AM_INIT,&app,&ws); + } + +#pragma METHOD_CALL + +METHOD VOID hellows_ws_dyn_init(PR_HELLOWS *self) + { + self->wserv.cli=f_new(CAT_HELLO_HELLO,C_HELLOBW); + p_send2(self->wserv.cli,O_WN_INIT); + } + +METHOD VOID hellobw_wn_init(PR_HELLOBW *self) + { + W_WINDATA wd; + + wd.extent.tl.x=0; + wd.extent.tl.y=0; + wd.extent.width=wserv_channel->conn.info.pixels.x; + wd.extent.height=wserv_channel->conn.info.pixels.y; + p_send5(self,O_WN_CONNECT,NULL,W_WIN_EXTENT,&wd); + p_send3(self,O_WN_VISIBLE,WV_INITVIS); + p_send3(self,O_WN_EMPHASISE,TRUE); + } + +METHOD VOID hellobw_wn_draw(PR_HELLOBW *self) + { + p_supersend2(self,O_WN_DRAW); + gPrintText(50,50,"Hello World",11); + } diff --git a/code/SIBOSDK/oopdemo/o_hello2.c b/code/SIBOSDK/oopdemo/o_hello2.c new file mode 100644 index 0000000..1516a6a --- /dev/null +++ b/code/SIBOSDK/oopdemo/o_hello2.c @@ -0,0 +1,75 @@ +/* +O_HELLO +*/ + +#include +#include +#include + +GLREF_D WSERV_SPEC *wserv_channel; +GLREF_D PR_HWIMMAN *w_am; +GLREF_D PR_WSERV *w_ws; + +GLDEF_C VOID main(VOID) + { + IN_HWIMMAN app; + IN_WSERV ws; + + p_linklib(0); + app.flags=/*FLG_APPMAN_FULLSCREEN|*/FLG_APPMAN_RSCFILE|FLG_APPMAN_CLEAN| + FLG_APPMAN_SRSCFILE/*|FLG_APPMAN_IPCS|FLG_APPMAN_LINKING*/; + app.wserv_cat=p_getlibh(CAT_HELLO2_HELLO2); + ws.com_cat=p_getlibh(CAT_HELLO2_HELLO2); + app.wserv_class=C_HELLOWS; + ws.com_class=C_HELLOCM; + p_send4(p_new(CAT_HELLO2_HWIM,C_HWIMMAN),O_AM_INIT,&app,&ws); + } + +#pragma METHOD_CALL + +METHOD VOID hellows_ws_dyn_init(PR_HELLOWS *self) + { + self->wserv.cli=f_new(CAT_HELLO2_HELLO2,C_HELLOBW); + p_send2(self->wserv.cli,O_WN_INIT); + } + +METHOD VOID hellobw_wn_init(PR_HELLOBW *self) + { + W_WINDATA wd; + + wd.extent.tl.x=0; + wd.extent.tl.y=0; + wd.extent.width=wserv_channel->conn.info.pixels.x; + wd.extent.height=wserv_channel->conn.info.pixels.y; + p_send5(self,O_WN_CONNECT,NULL,W_WIN_EXTENT,&wd); + p_send3(self,O_WN_VISIBLE,WV_INITVIS); + /* hInitVis(self); */ + p_send3(self,O_WN_EMPHASISE,TRUE); + } + +METHOD VOID hellobw_wn_draw(PR_HELLOBW *self) + { + UINT resid; + TEXT buf[40]; + + resid=self->hellobw.isbye ? BYE_MESSAGE:HELLO_MESSAGE; + p_send(w_am,O_AM_LOAD_RES_BUF,resid,&buf[0]); + p_supersend2(self,O_WN_DRAW); + gPrintText(50,50,&buf[0],p_slen(&buf[0])); + } + +METHOD VOID hellobw_wn_set(PR_HELLOBW *self,UINT isbye) + { + self->hellobw.isbye=isbye; + p_send2(self,O_WN_DODRAW); + } + +METHOD VOID hellocm_com_hello(PR_HELLOCM *self) + { + p_send3(w_ws->wserv.cli,O_WN_SET,FALSE); + } + +METHOD VOID hellocm_com_bye(PR_HELLOCM *self) + { + p_send3(w_ws->wserv.cli,O_WN_SET,TRUE); + } diff --git a/code/SIBOSDK/oopdemo/o_timer.c b/code/SIBOSDK/oopdemo/o_timer.c new file mode 100644 index 0000000..d896ac0 --- /dev/null +++ b/code/SIBOSDK/oopdemo/o_timer.c @@ -0,0 +1,72 @@ +/* +O_TIMER +*/ + +#include +#include +#include +#include + +GLREF_D WSERV_SPEC *wserv_channel; +GLREF_D VOID *w_am; + +GLDEF_C VOID main(VOID) + { + IN_HWIMMAN app; + IN_WSERV ws; + + p_linklib(0); + app.flags=FLG_APPMAN_RSCFILE|FLG_APPMAN_CLEAN|FLG_APPMAN_SRSCFILE; + app.wserv_cat=p_getlibh(CAT_TIMER_TIMER); + ws.com_cat=p_getlibh(CAT_TIMER_HWIM); + app.wserv_class=C_TIMERWS; + ws.com_class=C_COMMAN; + p_send4(p_new(CAT_TIMER_HWIM,C_HWIMMAN),O_AM_INIT,&app,&ws); + } + +#pragma METHOD_CALL + +METHOD VOID timerws_ws_dyn_init(PR_TIMERWS *self) + { + self->wserv.cli=f_new(CAT_TIMER_TIMER,C_TIMERBW); + p_send2(self->wserv.cli,O_WN_INIT); + f_newsend(CAT_TIMER_TIMER,C_MYTIMER,O_AO_INIT,"TIM:",-1); + } + +METHOD VOID timerbw_wn_init(PR_TIMERBW *self) + { + W_WINDATA wd; + + wd.extent.tl.x=0; + wd.extent.tl.y=0; + wd.extent.width=wserv_channel->conn.info.pixels.x; + wd.extent.height=wserv_channel->conn.info.pixels.y; + p_send5(self,O_WN_CONNECT,NULL,W_WIN_EXTENT,&wd); + p_send3(self,O_WN_VISIBLE,WV_INITVIS); + p_send3(self,O_WN_EMPHASISE,TRUE); + } + +METHOD VOID mytimer_ao_init(PR_MYTIMER *self,TEXT *devname,INT mode) + { + p_supersend4(self,O_AO_INIT,devname,mode); + self->active.priority=PRIORITY_ACTIVE_REPEATER; + p_send3(w_am,O_AM_ADD_TASK,self); + p_send2(self,O_AO_QUEUE); + } + +METHOD VOID mytimer_ao_queue(PR_MYTIMER *self) + { + LONG delay; + + delay=20; + p_ioc4(self->active.pcb,P_FREAD,&self->active.stat,&delay); + self->active.isactive=TRUE; + } + +METHOD INT mytimer_ao_run(PR_MYTIMER *self) + { + self->mytimer.count+=1; + hInfoPrint(TIMER_INFO,self->mytimer.count); + p_send2(self,O_AO_QUEUE); + return(RUN_ACTIVE_USED); + } diff --git a/code/SIBOSDK/oopdemo/oopdemo.prj b/code/SIBOSDK/oopdemo/oopdemo.prj new file mode 100644 index 0000000..91f2ba8 --- /dev/null +++ b/code/SIBOSDK/oopdemo/oopdemo.prj @@ -0,0 +1,56 @@ +OOPDEMO.PRJ ! This list file +! +PRNDIR.CAT ! Directory print category file +DIRLIST.C ! Directory print DIRLIST methods +DIRMAIN.C ! Directory print main() +PRNDIR.PR ! Directory print project link file +! +SORT.CAT ! Sort DYL category file +ISORT.C ! Sort method function +SORT.PR ! Sort project link file +! +RSORT.CAT ! Root sort DYL category file +ROOT.C ! Root sort method function +RSORT.PR ! Root sort project link file +! +RUNSORT.C ! Use the sort DYL +RUNSORT.PR ! Link file for above +! +DYLSORT.C ! Sort, using a built-in DYL +DYLSORT.PR ! Link file for above +DYLSORT.DFL ! DYL file list for above +! +HELLO.PIC ! Icon used for the following 3 demonstration programs +! +HELLO.CAT ! Hello World category file +HELLO.RE ! Hello World resource externals file +HELLO.RSS ! Hello World application resource file +O_HELLO.C ! Hello World method source file +HELLO.MS ! Hello World shell data source file +HELLO.AFL ! Hello World add-file list +HELLO.PR ! Hello World project file +! +HELLO2.CAT ! Hello World (2) category file +HELLO2.RE ! Hello World (2) resource externals file +HELLO2.RSS ! Hello World (2) application resource file +O_HELLO2.C ! Hello World (2) method source file +HELLO2.MS ! Hello World (2) shell data source file +HELLO2.AFL ! Hello World (2) add-file list +HELLO2.PR ! Hello World (2) project file +! +TIMER.CAT ! Timer category file +TIMER.RE ! Timer resource externals file +TIMER.RSS ! Timer application resource file +O_TIMER.C ! Timer method source file +TIMER.MS ! Timer shell data source file +TIMER.AFL ! Timer add-file list +TIMER.PR ! Timer project file +! +UNNAMED.PR ! General project file for cc.bat +! +VID.BAT ! Set/clear JPI VID pragma +CHECKVID.BAT ! Check JPI VID pragma +CC.BAT ! cc batch file +LF.BAT ! IMG link batch file +LFC.BAT ! DYL link batch file +MAKE.BAT ! Project make batch file diff --git a/code/SIBOSDK/oopdemo/prndir.cat b/code/SIBOSDK/oopdemo/prndir.cat new file mode 100644 index 0000000..401e8d8 --- /dev/null +++ b/code/SIBOSDK/oopdemo/prndir.cat @@ -0,0 +1,21 @@ +IMAGE prndir + +EXTERNAL olib + +INCLUDE varray.g +INCLUDE p_file.h + + +CLASS dirlist vaxvar +Directory list + { + REPLACE va_test sort by various criteria + TYPES + { + typedef struct + { + P_INFO info; + TEXT name[P_FNAMESIZE]; + } DIRLIST_ITEM; + } + } diff --git a/code/SIBOSDK/oopdemo/prndir.pr b/code/SIBOSDK/oopdemo/prndir.pr new file mode 100644 index 0000000..d4ad20d --- /dev/null +++ b/code/SIBOSDK/oopdemo/prndir.pr @@ -0,0 +1,10 @@ +#system epoc img +#set epocinit=iplib +#model small jpi + +#pragma link(olib.lib) +#pragma link(prndir) +#pragma link(dirlist) +#pragma link(dirmain) + +#link prndir diff --git a/code/SIBOSDK/oopdemo/root.c b/code/SIBOSDK/oopdemo/root.c new file mode 100644 index 0000000..2104e32 --- /dev/null +++ b/code/SIBOSDK/oopdemo/root.c @@ -0,0 +1,35 @@ +/* +ROOT.C +*/ + +#include + +#define IdataBuf ((INT *)DataBuf) + +LOCAL_C INT OrdFunc(INT i,INT j,VOID *DataBuf) +/* +order function used in qsort +*/ + { + return(IdataBuf[i]-IdataBuf[j]); + } + +LOCAL_C VOID ExchFunc(INT i,INT j,VOID *DataBuf) +/* +exchange function used in qsort +*/ + { + INT k; + + k=IdataBuf[i]; + IdataBuf[i]=IdataBuf[j]; + IdataBuf[j]=k; + } + +#pragma METHOD_CALL + +METHOD VOID root_sort(PR_ROOT *self,INT *start,INT num) + { + p_qsort(num,OrdFunc,ExchFunc,start); + } + diff --git a/code/SIBOSDK/oopdemo/rsort.cat b/code/SIBOSDK/oopdemo/rsort.cat new file mode 100644 index 0000000..8ebcb6a --- /dev/null +++ b/code/SIBOSDK/oopdemo/rsort.cat @@ -0,0 +1,15 @@ +LIBRARY rsort + +INCLUDE p_std.h +INCLUDE p_object.h + +CLASS root + { + ADD destroy + ADD sort Sort a given list of integers + PROPERTY + { + P_OBJECT pc; Class link + } + } + diff --git a/code/SIBOSDK/oopdemo/rsort.pr b/code/SIBOSDK/oopdemo/rsort.pr new file mode 100644 index 0000000..55427e1 --- /dev/null +++ b/code/SIBOSDK/oopdemo/rsort.pr @@ -0,0 +1,8 @@ +#system epoc dyl +#set epocinit=iplib +#model small jpi + +#pragma link(olib.lib) +#pragma link(rsort) +#pragma link(root) +#link rsort diff --git a/code/SIBOSDK/oopdemo/runsort.c b/code/SIBOSDK/oopdemo/runsort.c new file mode 100644 index 0000000..5cc8f23 --- /dev/null +++ b/code/SIBOSDK/oopdemo/runsort.c @@ -0,0 +1,51 @@ +/* +RUNSORT.C +*/ + +#include +#include + +GLREF_D VOID *DatCommandPtr; + +GLDEF_D P_RECT _DefScreenRect; + +LOCAL_D INT array[] = {10,1,5,7,9,3,6,8,4,2}; + +#pragma save,ENTER_CALL + +LOCAL_C INT RunSort(HANDLE dyl) + { + VOID *sort; + + sort=f_newlibh(dyl,C_ISORT); + p_send4(sort,O_SORT,&array[0],10); + p_send2(sort,O_DESTROY); + return(0); + } + +#pragma restore + +GLDEF_C INT main(VOID) + { + INT err,i; + HANDLE dyl; + TEXT buf[P_FNAMESIZE]; + + p_fparse("sort.dyl",DatCommandPtr,&buf[0],NULL); + err=p_loadlib(&buf[0],&dyl,TRUE); + if (!err) + { + _DefScreenRect.tl.x=0; + _DefScreenRect.tl.y=0; + _DefScreenRect.br.x=40; + _DefScreenRect.br.y=8; + + p_printf("Sorting..."); + err=p_enter2(RunSort,dyl); + p_unloadlib(dyl); + for (i=0;i<10;i+=2) + p_printf("%4d %4d",array[i],array[i+1]); + p_getch(); + } + return(err); + } diff --git a/code/SIBOSDK/oopdemo/runsort.pr b/code/SIBOSDK/oopdemo/runsort.pr new file mode 100644 index 0000000..e0597b7 --- /dev/null +++ b/code/SIBOSDK/oopdemo/runsort.pr @@ -0,0 +1,7 @@ +#system epoc img +#set epocinit=iplib +#model small jpi + +#pragma link(olib.lib) +#pragma link(runsort) +#link runsort diff --git a/code/SIBOSDK/oopdemo/sort.cat b/code/SIBOSDK/oopdemo/sort.cat new file mode 100644 index 0000000..96c133b --- /dev/null +++ b/code/SIBOSDK/oopdemo/sort.cat @@ -0,0 +1,11 @@ +LIBRARY sort + +EXTERNAL olib + +INCLUDE olib.g + +CLASS isort root + { + ADD sort Sort a given list of integers + } + diff --git a/code/SIBOSDK/oopdemo/sort.pr b/code/SIBOSDK/oopdemo/sort.pr new file mode 100644 index 0000000..c2e3c5e --- /dev/null +++ b/code/SIBOSDK/oopdemo/sort.pr @@ -0,0 +1,8 @@ +#system epoc dyl +#set epocinit=iplib +#model small jpi + +#pragma link(olib.lib) +#pragma link(sort) +#pragma link(isort) +#link sort diff --git a/code/SIBOSDK/oopdemo/timer.afl b/code/SIBOSDK/oopdemo/timer.afl new file mode 100644 index 0000000..96a9022 --- /dev/null +++ b/code/SIBOSDK/oopdemo/timer.afl @@ -0,0 +1,3 @@ +hello.pic +timer.rzc +timer.shd diff --git a/code/SIBOSDK/oopdemo/timer.cat b/code/SIBOSDK/oopdemo/timer.cat new file mode 100644 index 0000000..febb61f --- /dev/null +++ b/code/SIBOSDK/oopdemo/timer.cat @@ -0,0 +1,30 @@ +IMAGE timer + +EXTERNAL olib +EXTERNAL hwim + +INCLUDE hwimman.g + +CLASS timerws wserv +window server active object + { + REPLACE ws_dyn_init + } + +CLASS timerbw bwin +bordered window + { + REPLACE wn_init + } + +CLASS mytimer active +timer active object + { + REPLACE ao_init + REPLACE ao_queue + REPLACE ao_run + PROPERTY + { + UWORD count; + } + } diff --git a/code/SIBOSDK/oopdemo/timer.ms b/code/SIBOSDK/oopdemo/timer.ms new file mode 100644 index 0000000..f1ca1e4 --- /dev/null +++ b/code/SIBOSDK/oopdemo/timer.ms @@ -0,0 +1,3 @@ +Timer + +0 diff --git a/code/SIBOSDK/oopdemo/timer.pr b/code/SIBOSDK/oopdemo/timer.pr new file mode 100644 index 0000000..80f2276 --- /dev/null +++ b/code/SIBOSDK/oopdemo/timer.pr @@ -0,0 +1,38 @@ +#system epoc img +#set epocinit=iplib +#model small jpi + +#abort on + +#set version=0x100F +#set priority=0x80 +#set heapsize=0x80 + +#compile %main.cat + +#if %remake #or (%main.rg #older %main.re) #or (%main.rg #older %main.g) #then + #run "re %main" no_window no_abort +#endif + +#if (%main.rsg #older %main.rss) #or (%main.rsg #older %main.rg) #then + #file delete %main.rsg + #run "rs %main" no_window no_abort + #run "rch %main" no_window no_abort +#endif + +#compile o_timer.c + +#if %main.shd #older %main.ms #then + #run "makeshd %main" no_window no_abort + #file delete %main.img +#endif + +#if (%main.img #older %main.afl) #or (%main.img #older %main.pic) #then + #file delete %main.img +#endif + +#pragma link(olib.lib) +#pragma link(hwim.lib) + +#link %main + diff --git a/code/SIBOSDK/oopdemo/timer.re b/code/SIBOSDK/oopdemo/timer.re new file mode 100644 index 0000000..8d3b206 --- /dev/null +++ b/code/SIBOSDK/oopdemo/timer.re @@ -0,0 +1,3 @@ +#include + +_O_COM_EXIT diff --git a/code/SIBOSDK/oopdemo/timer.rss b/code/SIBOSDK/oopdemo/timer.rss new file mode 100644 index 0000000..05571a2 --- /dev/null +++ b/code/SIBOSDK/oopdemo/timer.rss @@ -0,0 +1,42 @@ +/* + HELLO.RSS + +English resource file for Hello World application + +*/ + +#include +#include + +RESOURCE WSERV_INFO timer_accs + { + menbar_id=timer_menbar; + first_com=O_COM_EXIT; + accel={'x'}; /* Exit */ + } + +RESOURCE MENU_BAR timer_menbar + { + items= + { + MENU_BAR_ITEM + { + menu_id=special_menu; + mb_item="Special"; + } + }; + } + +RESOURCE MENU special_menu + { + items = + { + MENU_ITEM + { + com_id=O_COM_EXIT; + mn_item="Exit"; + } + }; + } + +RESOURCE STRING timer_info {str="Counted to %u";} diff --git a/code/SIBOSDK/oopdemo/unnamed.pr b/code/SIBOSDK/oopdemo/unnamed.pr new file mode 100644 index 0000000..96416fd --- /dev/null +++ b/code/SIBOSDK/oopdemo/unnamed.pr @@ -0,0 +1,6 @@ +#system epoc img +#set epocinit=iplib +#model small jpi + +#compile %main +#link %main diff --git a/code/SIBOSDK/oopdemo/vid.bat b/code/SIBOSDK/oopdemo/vid.bat new file mode 100644 index 0000000..4ccb4d5 --- /dev/null +++ b/code/SIBOSDK/oopdemo/vid.bat @@ -0,0 +1,22 @@ +@echo off +goto X%1X +:Xv0X +:XoffX +set jpivid=v0 +echo VID is now OFF +goto :end +:Xv2X +:XonX +set jpivid=v2 +echo VID is now ON +goto :end +:XX +call checkvid +goto %jpivid% +:v0 +echo VID is OFF +goto end +:v2 +echo VID is ON +:end + diff --git a/code/SIBOSDK/pr/clib.pr b/code/SIBOSDK/pr/clib.pr new file mode 100644 index 0000000..8c0df02 --- /dev/null +++ b/code/SIBOSDK/pr/clib.pr @@ -0,0 +1,73 @@ +#system epoc img +#model small jpi + +#message "Epoc/Os CLIB library project file" + +#pragma check(index=>off, + range=>off, + overflow=>off, + stack=>off, + nil_ptr=>off + ) +#pragma optimize(speed=>off) +#pragma option(ansi=>off) + +#pragma define( _ENV => off, _WINDOWS => off, _DLL => off, _OVL => off, _OS2 => off, _WINDLL=>off) +#pragma define( _SMALL_INLINE=>on) +#pragma define( _EPOC=>on) + +#message "Compiling standard object files" +#compile iplib.a +#compile iplib2.a +#compile iplib8.a +#compile iclib2.a +#compile iclib4.a +#compile iclib.a +#compile icat.a +#compile nofloat.a +#compile r_emul.a +#dolink dummy.lib + +#message "Compiling RLIB library files" +#compile coreinit.a +#compile corertl.a +#compile cpplow.a +#compile new.cpp +#message "Making shared library RLIB.LIB" +#dolink rlib.lib + +#message "Compiling core CLIB library files" +#compile coremain.a +#compile coresig.a +#compile coremath.a +#compile corefile.a +#compile coremem.a +#compile coreio.a + +#message "Compiling CLIB C library files" +#compile cdata.c +#compile clib1.a +#compile clib2.c +#compile printf.c +#compile scanf.c +#compile cstr.a +#compile cio1.a +#compile cio2.c +#compile csys.c +#compile epoc.a +#compile epoc1.c + +#message "Compiling CLIB CPP library files" +#compile bcd.cpp +#compile complex.cpp +#compile coniostr.cpp +#compile fstream.cpp +#compile ioinline.cpp +#compile iostream.cpp +#compile stdiostr.cpp +#compile stream.cpp +#compile strstrea.cpp + +#message "Making C library CLIB.LIB" +#dolink clib.lib + diff --git a/code/SIBOSDK/pr/ptempl.pr b/code/SIBOSDK/pr/ptempl.pr new file mode 100644 index 0000000..ad87d0f --- /dev/null +++ b/code/SIBOSDK/pr/ptempl.pr @@ -0,0 +1,8 @@ +#system epoc img +#set epocinit=iplib +#model small jpi +#pragma define(EPOC=>1,JPIC=>1) + +#compile %main +#link %prjname + diff --git a/code/SIBOSDK/pr/template.pr b/code/SIBOSDK/pr/template.pr new file mode 100644 index 0000000..ac171dc --- /dev/null +++ b/code/SIBOSDK/pr/template.pr @@ -0,0 +1,7 @@ +#system epoc img +#model small jpi +#pragma define(EPOC=>1,JPIC=>1) + +#compile %main +#link %prjname + diff --git a/code/SIBOSDK/pr/unnamed.pr b/code/SIBOSDK/pr/unnamed.pr new file mode 100644 index 0000000..998a9e7 --- /dev/null +++ b/code/SIBOSDK/pr/unnamed.pr @@ -0,0 +1,8 @@ +#system epoc img +#model small jpi +#pragma define(EPOC=>1,JPIC=>1) + +#compile %main +#link %prjname + + diff --git a/code/SIBOSDK/record/checkvid.bat b/code/SIBOSDK/record/checkvid.bat new file mode 100644 index 0000000..5c6199f --- /dev/null +++ b/code/SIBOSDK/record/checkvid.bat @@ -0,0 +1,2 @@ +@if not "%jpivid%"=="v2" set jpivid=v0 + diff --git a/code/SIBOSDK/record/make.bat b/code/SIBOSDK/record/make.bat new file mode 100644 index 0000000..319ca30 --- /dev/null +++ b/code/SIBOSDK/record/make.bat @@ -0,0 +1,9 @@ +@echo off +call checkvid +if not exist %1.pr goto error +tscx /m %1 /%jpivid% +tscx /m %1 /%jpivid% +goto end +:error +echo Project file %1.pr does not exist +:end diff --git a/code/SIBOSDK/record/rec3b.prj b/code/SIBOSDK/record/rec3b.prj new file mode 100644 index 0000000..4e93133 --- /dev/null +++ b/code/SIBOSDK/record/rec3b.prj @@ -0,0 +1,23 @@ +rec3b.prj ! This list file +! +record.cat ! Cat file for application +record.re ! Hash defines from cat file needed in resource file +record.hlp ! Help text resources +record.rss ! Resource file for application +! +reccli.c ! client bordered window +reccom.c ! Command manager code +recdial.c ! Dialogs +receng.c ! Engine +recwserv.c ! Application WSERV +waveao.c ! Sound active objects +wvefile.c ! Sound file +! +record.ms ! Source for shell data on record +record.afl ! Lists the files to be built into record.img +record.pic ! Application icon +record.pr ! Project file for Record +! +VID.BAT ! Set/clear debug status +CHECKVID.BAT ! Check debug status +MAKE.BAT ! Project make file diff --git a/code/SIBOSDK/record/reccli.c b/code/SIBOSDK/record/reccli.c new file mode 100644 index 0000000..9b510c0 --- /dev/null +++ b/code/SIBOSDK/record/reccli.c @@ -0,0 +1,473 @@ +/* +RECCLI.C + +The record application's client window and its components +*/ + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +GLREF_D PR_RECWSERV * const w_ws; +GLREF_D PR_APPMAN * const w_am; +GLREF_D PR_RECENG * const receng; + +#define TIMEBAR_HEIGHT 13 + +#define RECBUT_HIDE_DRAW 0 +#define RECBUT_HIDE_HIDE 1 +#define RECBUT_HIDE_CLEAR 2 + +#define RECBUT_HALF_WIDTH 34 +#define RECBUT_HALF_HEIGHT 10 +#define RECBUT_ASCENT 16 +#define RECBUT_MARGIN 20 + +#define RECCLI_NBUTTONS 5 +#define RECCLI_3BUT_MASK 0x7 /* 1st 3 buttons */ +#define RECCLI_STOP_MASK 0x8 /* 4th button */ +#define RECCLI_START_MASK 0x10 /* 5th button */ + +LOCAL_D UBYTE recbut_hide[RECCLI_NBUTTONS]= + {RECBUT_HIDE_CLEAR,RECBUT_HIDE_HIDE,RECBUT_HIDE_CLEAR,RECBUT_HIDE_HIDE,RECBUT_HIDE_HIDE}; + +LOCAL_C TEXT *NextZTS(TEXT *str) + { + while (*str++); + return(str); + } + +LOCAL_C VOID StartFRC(PR_TIMEBAR *self) + { + UWORD tick,mode; + + mode=E_FRC_REPEATING; + tick=100; + p_iow4(self->active.pcb,P_FSTART,&mode,&tick); + } + +LOCAL_C INT BarLength(PR_TIMEBAR *self) + { + INT width; + + width=self->timebar.rect.br.x-self->timebar.rect.tl.x-2; + if (self->timebar.tenths0) + width-=(UINT)((width*self->timebar.tenths)/self->timebar.tenths0); + return(width); + } + +LOCAL_C VOID DrawBar(PR_TIMEBAR *self,INT border,INT createGC) + { + INT x1,x2; + P_RECT r; + + x1=self->timebar.x; + x2=BarLength(self); + if (x2==x1 && self->timebar.visible && !border) + return; + if (createGC) + gCreateTempGC0(self->timebar.wid); + r=self->timebar.rect; + if (!self->timebar.visible) + { + gClrRect(&r,G_TRMODE_CLR); + goto exit; + } + if (border) + gBorderRect(&r,W_BORD_CORNER_1); + p_insrec(&r,1,1); + if (x1>x2) + { + gClrRect(&r,G_TRMODE_CLR); + x1=0; + } + self->timebar.x=x2; + r.tl.x+=x1; + r.br.x=r.tl.x+x2-x1; + gFillPattern(&r,WS_BITMAP_GREY,G_TRMODE_REPL); + exit: + if (createGC) + { + gFreeTempGC(); + wFlush(); + } + } + +LOCAL_C VOID DrawButton(PR_RECBUT *self,INT state) + { + wDrawButton2(W_BUTTON_TYPE_2,&self->recbut.rect,&self->recbut.inlabel[0],state); + } + +LOCAL_C VOID PrintHeader(PR_RECCLI *self,INT y,TEXT *fmt,...) + { + INT len; + TEXT bb[256]; + P_RECT rect; + + rect.tl.x=8; + rect.tl.y=y; + rect.br.x=rect.tl.x+self->reccli.width-16; + rect.br.y=y+30; + if (fmt==NULL) + { + gClrRect(&rect,G_TRMODE_CLR); + return; + } + len=p_atob(&bb[0],fmt,&fmt+1); + gPrintBoxText(&rect,20,G_TEXT_ALIGN_CENTRE,0,&bb[0],len); + } + +LOCAL_C VOID HideButtons(PR_RECCLI *self,INT mask) +/* +Set the hidden state of the buttons to hide depending on the bits in mask. +*/ + { + INT i; + + for (i=0;i>=1) + self->reccli.recbut[i]->recbut.hide=(mask&1)?recbut_hide[i]:RECBUT_HIDE_DRAW; + } + +LOCAL_C VOID DrawWin(PR_RECCLI *self) + { + G_GC gc; + + gc.flags=G_GC_FLAG_BOTH_PLANES; + gCreateTempGC(self->win.id,G_GC_MASK_GREY,&gc); + p_send2(self,O_WN_DRAW); + gFreeTempGC(); + } + +LOCAL_C VOID PrintDuration(PR_RECCLI *self,TEXT *buf,ULONG tenths) + { + ULONG seconds; + UINT secs; + P_DAYSEC ds; + P_DATE dt; + + seconds=tenths/10; + if (seconds<60) + { + secs=(UINT)seconds; + p_atos(buf,"%d.%d %s",secs,(UINT)tenths-10*secs,self->reccli.secs); + return; + } + p_sttods(&seconds,&ds); + p_dstodt(&ds,&dt); + ds.day-=25567; /* base days at Jan 1 1970 */ + if (ds.day>0) + { /* show number of days */ + p_atos(buf,"%ld ",ds.day); + buf+=p_slen(buf); + } + if (dt.hour>0 || ds.day>0) + { /* show number of hours */ + p_atos(buf,"%02d%c",dt.hour,self->reccli.tsep); + buf+=p_slen(buf); + } + p_atos(buf,"%02d%c%02d",dt.minute,self->reccli.tsep,dt.second); + } + +#pragma METHOD_CALL + +METHOD VOID timebar_tb_draw(PR_TIMEBAR *self) + { + self->timebar.x=0; + DrawBar(self,TRUE,FALSE); + } + +METHOD VOID timebar_ao_init(PR_TIMEBAR *self,INT wid,P_RECT *prect) + { + self->active.priority=PRIORITY_ACTIVE_REPEATER; + p_send3(w_am,O_AM_ADD_TASK,self); + self->timebar.wid=wid; + self->timebar.rect=*prect; + } + +METHOD VOID timebar_ao_queue(PR_TIMEBAR *self) + { + p_ioc3(self->active.pcb,P_FREAD,&self->active.stat); + self->active.isactive=TRUE; + } + +METHOD INT timebar_ao_run(PR_TIMEBAR *self) + { + if (self->active.stat<0) + { /* possibly because the machine was switched off then on */ + StartFRC(self); /* restart the FRC */ + self->active.stat=0; + } + self->timebar.tenths-=self->active.stat; + if (self->timebar.tenths<=0) + { + self->timebar.tenths=0; /* stops re-queue */ + p_close(self->active.pcb); + self->active.pcb=NULL; + } + DrawBar(self,FALSE,TRUE); + if (self->timebar.tenths) + timebar_ao_queue(self); + return(RUN_ACTIVE_USED); + } + +METHOD VOID timebar_tb_start(PR_TIMEBAR *self,ULONG *tenths) + { + self->timebar.tenths0=*tenths; + self->timebar.tenths=self->timebar.tenths0; + self->timebar.x=0; + self->timebar.visible=TRUE; + if (self->timebar.tenths<10 || p_open(&self->active.pcb,"FRC:",-1)<0) + return; + StartFRC(self); + DrawBar(self,TRUE,TRUE); + timebar_ao_queue(self); + } + +METHOD VOID timebar_tb_stop(PR_TIMEBAR *self) + { + p_send2(self,O_AO_CANCEL); + self->timebar.visible=FALSE; + p_close(self->active.pcb); + self->active.pcb=NULL; + } + +METHOD VOID recbut_destroy(PR_RECBUT *self) + { + p_free(self->recbut.buttxt); + p_supersend2(self,O_DESTROY); + } + +METHOD VOID recbut_rb_init(PR_RECBUT *self,INT wid,P_POINT *pc,INT rid) + { + self->recbut.wid=wid; + self->recbut.rect.tl.x=pc->x-RECBUT_HALF_WIDTH; + self->recbut.rect.br.x=pc->x+RECBUT_HALF_WIDTH; + self->recbut.rect.tl.y=pc->y-RECBUT_HALF_HEIGHT; + self->recbut.rect.br.y=pc->y+RECBUT_HALF_HEIGHT; + hLoadResource(rid,&self->recbut.buttxt); + self->recbut.inlabel=(TEXT *)(((WORD *)self->recbut.buttxt)+1); + self->recbut.caption=NextZTS(self->recbut.inlabel); + self->recbut.caplen=p_slen(self->recbut.caption); + } + +METHOD VOID recbut_rb_draw(PR_RECBUT *self) + { + P_RECT r; + + if (self->recbut.hide==RECBUT_HIDE_HIDE) + return; + r.tl.x=self->recbut.rect.tl.x-RECBUT_MARGIN; + r.br.x=self->recbut.rect.br.x+RECBUT_MARGIN; + r.br.y=self->recbut.rect.tl.y; + r.tl.y=r.br.y-(2*RECBUT_HALF_HEIGHT); + if (self->recbut.hide==RECBUT_HIDE_CLEAR) + { + gClrRect(&r,G_TRMODE_CLR); + gClrRect(&self->recbut.rect,G_TRMODE_CLR); + return; + } + DrawButton(self,0); + gPrintBoxText(&r,RECBUT_ASCENT,G_TEXT_ALIGN_CENTRE,0,self->recbut.caption,self->recbut.caplen); + } + +METHOD VOID recbut_rb_depress(PR_RECBUT *self) + { + gCreateTempGC0(self->recbut.wid); + DrawButton(self,2); + wFlush(); + p_sleep(2L); + DrawButton(self,0); + wFlush(); + gFreeTempGC(); + } + +METHOD VOID recbut_rb_hide(PR_RECBUT *self,INT hide) + { + self->recbut.hide=hide; + } + +METHOD VOID reccli_destroy(PR_RECCLI *self) + { + p_free(self->reccli.clitxt); + p_supersend2(self,O_DESTROY); + } + +METHOD VOID reccli_wn_connect(PR_RECCLI *self,PR_WIN *par,UINT fields,W_WINDATA *pwd) + { + INT i,dx; + P_POINT c; + P_RECT rect; + E_CONFIG config; + + p_getctd(&config); + self->reccli.tsep=config.timeSeparator; + self->reccli.width=pwd->extent.width; + pwd->background=W_WIN_BACK_CLR|W_WIN_BACK_GREY_CLR; + p_supersend5(self,O_WN_CONNECT,par,fields|W_WIN_BACKGROUND,pwd); + hInitVis(self); + p_send3(self,O_WN_EMPHASISE,TRUE); + rect.tl.x=12; + rect.br.x=self->reccli.width-rect.tl.x; + rect.tl.y=74; + rect.br.y=rect.tl.y+TIMEBAR_HEIGHT; + self->reccli.timebar=f_newsend(CAT_RECORD_RECORD,C_TIMEBAR,O_AO_INIT,self->win.id,&rect); + dx=(self->reccli.width-6)/6; + c.y=130; + for (i=0;ireccli.recbut[i]=f_newsend(CAT_RECORD_RECORD,C_RECBUT,O_RB_INIT,self->win.id,&c,CLIBUT_REC_NEW+i); + } + HideButtons(self,RECCLI_STOP_MASK|RECCLI_START_MASK); + hLoadResource(RECCLI_TEXT,&self->reccli.clitxt); + self->reccli.secs=(TEXT *)(((WORD *)self->reccli.clitxt)+1); + self->reccli.title=NextZTS(self->reccli.secs); + self->reccli.sub=NextZTS(self->reccli.title); + wValidateWin(self->win.id); /* saves screen flicker on startup */ + } + +METHOD VOID reccli_wn_draw(PR_RECCLI *self) + { + INT i,len,y; + WVEFILE_INFO info; + TEXT name[16]; + TEXT duration[20],total[20]; + G_GC gc; + + p_supersend(self,O_WN_DRAW); /* draw border */ + p_send2(self->reccli.timebar,O_TB_DRAW); /* draw time bar */ + /* draw buttons */ + for (i=0;ireccli.recbut[i++])); + p_send3(receng,O_ENG_FILE_INFO,&info); + *p_bcpy(&name[0],info.name,len=info.nmlen)=0; + p_scap(&name[0]); + if (*info.device!='M') + { + name[len++]='['; + name[len++]=*info.device; + name[len++]=']'; + } + name[len]=0; + gc.style=G_STY_BOLD; + gc.font=FONT_ID_SWISS_16; + gSetGC(0,G_GC_MASK_STYLE|G_GC_MASK_FONT,&gc); + y=8; + if (info.duration) + { + PrintDuration(self,&duration[0],(LONG)info.duration); + /* %s %s %d Kbyte */ + PrintHeader(self,y,self->reccli.title,&name[0],&duration[0],(INT)(info.flen>>10)); + } + else + PrintHeader(self,y,"%s",&name[0]); /* might be a % character in name[] */ + y=40; + if (info.repeats<=1 && info.silence==0) + { + PrintHeader(self,y,NULL); /* clear rectangle */ + return; + } + gc.style=G_STY_NORMAL; + gc.font=FONT_ID_SWISS_13; + gSetGC(0,G_GC_MASK_STYLE|G_GC_MASK_FONT,&gc); + PrintDuration(self,&duration[0],(LONG)info.silence); + PrintDuration(self,&total[0],info.total); + /* Repeats: %d Trailing silence: %s Total: %s */ + PrintHeader(self,y,self->reccli.sub,info.repeats,&duration[0],&total[0]); + } + +METHOD VOID reccli_cl_update(PR_RECCLI *self) + { + p_send2(self->reccli.timebar,O_TB_STOP); + self->reccli.running=FALSE; + w_ws->wserv.filter=NULL; + wDisableKeyClick(FALSE); + HideButtons(self,RECCLI_STOP_MASK|RECCLI_START_MASK); + DrawWin(self); + wFlush(); + } + +METHOD VOID reccli_wn_key(PR_RECCLI *self,UINT keycode,UINT modifiers) + { + switch (keycode) + { + case W_KEY_TAB: + recbut_rb_depress(self->reccli.recbut[0]); + hWservComSend(O_COM_RECORD_NEW); + break; + case ' ': + recbut_rb_depress(self->reccli.recbut[1]); + hWservComSend(O_COM_RE_RECORD); + break; + case W_KEY_RETURN: + recbut_rb_depress(self->reccli.recbut[2]); + p_send2(receng,O_ENG_SOUND_PLAY); + break; + } + } + +METHOD INT reccli_cl_sound_filter(PR_RECCLI *self,UINT keycode,UINT modifiers) + { + if (keycode==W_KEY_ESCAPE) + { + p_send2(receng,O_ENG_SOUND_STOP); + recbut_rb_depress(self->reccli.recbut[3]); + } + return(WN_KEY_CHANGED); + } + +METHOD INT reccli_cl_pause_filter(PR_RECCLI *self,UINT keycode,UINT modifiers) +/* +Waiting to record. +*/ + { + if (keycode==W_KEY_ESCAPE) + p_send3(receng,O_ENG_OPEN_FILE,NULL); + else if (keycode==' ') + { + w_ws->wserv.filter=NULL; + p_send3(receng,O_ENG_SOUND_RECORD,self->reccli.duration); + } + return(WN_KEY_CHANGED); + } + +METHOD VOID reccli_cl_begin_sound(PR_RECCLI *self,ULONG *tenths) + { + p_send3(self->reccli.timebar,O_TB_START,tenths); + self->reccli.running=TRUE; + w_ws->wserv.filter=(PR_WIN *)self; + w_ws->wserv.filmethod=-O_CL_SOUND_FILTER; + wDisableKeyClick(TRUE); + HideButtons(self,RECCLI_3BUT_MASK|RECCLI_START_MASK); + DrawWin(self); + wFlush(); + } + +METHOD VOID reccli_cl_pause(PR_RECCLI *self,UINT duration) + { + self->reccli.duration=duration; + w_ws->wserv.filter=(PR_WIN *)self; + w_ws->wserv.filmethod=-O_CL_PAUSE_FILTER; + HideButtons(self,RECCLI_3BUT_MASK|RECCLI_STOP_MASK); + DrawWin(self); + wFlush(); + } + +METHOD VOID recman_am_clean_up(PR_RECMAN *self,INT err,UBYTE *htask) + { + PR_RECCLI *cli; + + cli=(PR_RECCLI *)w_ws->wserv.cli; + w_ws->wserv.filter=NULL; + wDisableKeyClick(FALSE); + p_send2(cli->reccli.timebar,O_TB_STOP); + p_supersend4(self,O_AM_CLEAN_UP,err,htask); + p_send3(receng,O_ENG_OPEN_FILE,NULL); + } diff --git a/code/SIBOSDK/record/reccom.c b/code/SIBOSDK/record/reccom.c new file mode 100644 index 0000000..121f084 --- /dev/null +++ b/code/SIBOSDK/record/reccom.c @@ -0,0 +1,151 @@ +/* +RECCOM.C + +Sound record/playback application command manager +*/ + +#include +#include +#include +#include + +GLREF_D PR_RECENG * const receng; +GLREF_D TEXT * const DatUsedPathNamePtr; + +LOCAL_C INT LaunchDial(VOID *buf,INT id,INT class) + { + DL_DATA dial_data; + + dial_data.id=id; + dial_data.rbuf=buf; + dial_data.pdlg=NULL; + return(hLaunchDial(CAT_RECORD_RECORD,class,&dial_data)); + } + +LOCAL_C VOID RecordToNewFile(TEXT *fname,INT DefaultName) + { + INT len; + P_FPARSE crk; + RECRBUF rb; + + rb.duration=((RECENG_PREFS *)p_send2(receng,O_ENG_SENSE_PREFS))->duration; + f_fparse(fname,DatUsedPathNamePtr,&rb.fname[0],&crk); + len=crk.system+crk.device+crk.path; + if (DefaultName) + len+=crk.name; + rb.fname[len]=0; + if (!LaunchDial(&rb,RECORD_NEW_DL,DefaultName?C_RECNEWDEF:C_RECNEW)) + p_send3(receng,O_ENG_OPEN_FILE,NULL); + } + +#pragma METHOD_CALL + +METHOD INT reccom_com_file_change(PR_RECCOM *self,INT command,TEXT *newname) + { + p_send2(receng,O_ENG_SOUND_STOP); + switch (command) + { + case H_COMMAND_CREATE_FILE: + p_send3(receng,O_ENG_NEW_FILE,newname); + p_send2(receng,O_ENG_VIEW_UPDATE); + RecordToNewFile((TEXT *)p_send2(receng,O_ENG_SENSE_FILE),TRUE); + break; + case H_COMMAND_OPEN_FILE: + p_send3(receng,O_ENG_OPEN_FILE,newname); + break; + } + return(0); /* no leave() */ + } + + +METHOD VOID reccom_com_new_file(PR_RECCOM *self) +/* +Called on selecting the New file menu command. +*/ + { + TEXT fspec[4]; + + fspec[0]=p_send2(receng,O_ENG_DEFAULT_DISK); + fspec[1]=':'; + fspec[2]=0; + RecordToNewFile(&fspec[0],FALSE); + } + +METHOD VOID reccom_com_record_new(PR_RECCOM *self) +/* +Called on pressing the Record new (Tab) button. +*/ + { + INT i,device; + P_INFO info; + TEXT name[32]; + TEXT fspec[P_FNAMESIZE]; + + device=p_send2(receng,O_ENG_DEFAULT_DISK); + for (i=1;i<100;i++) + { + hAtos(&name[0],DFLT_FNAME,device,i); /* "%c:RECORD%02d" */ + p_fparse(&name[0],DatUsedPathNamePtr,&fspec[0],NULL); + if (p_finfo(&fspec[0],&info)) + { /* file does not exist - so use the generated name */ + RecordToNewFile(&fspec[0],TRUE); + return; + } + } + RecordToNewFile("",FALSE); + } + +METHOD VOID reccom_com_open_file(PR_RECCOM *self) +/* +Called on selecting the Open file menu command. +*/ + { + RECRBUF rb; + + p_scpy(&rb.fname[0],(TEXT *)p_send2(receng,O_ENG_SENSE_FILE)); + if (!LaunchDial(&rb,OPEN_FILE_DL,C_RECOPEN)) + return; + /* rb.fname[] contains file name */ + p_send3(receng,O_ENG_OPEN_FILE,&rb.fname); + } + +METHOD VOID reccom_com_re_record(PR_RECCOM *self) +/* +Called on pressing the Record over (Space) button. +*/ + { + TEXT *fname; + WVEFILE_INFO info; + P_INFO finfo; + RECRBUF rb; + + p_send3(receng,O_ENG_FILE_INFO,&info); + fname=(TEXT *)p_send2(receng,O_ENG_SENSE_FILE); + if (!info.duration) + { /* file does not exist? */ + if (p_finfo(fname,&finfo)<0) + RecordToNewFile(fname,TRUE); + return; + } + rb.duration=info.duration; + p_scpy(&rb.fname[0],fname); + if (!LaunchDial(&rb,RE_RECORD_DL,C_RECEXIST)) + return; + } + +METHOD VOID reccom_com_set_repeat(PR_RECCOM *self) + { + LaunchDial(NULL,SET_REP_DL,C_SETREP); + } + +METHOD VOID reccom_com_rep_alarm(PR_RECCOM *self) + { + if (!hConfirm(ADJUST_ALARM_CONFIRM)) + return; + p_send4(receng,O_ENG_SET_REPEATS,0,150); /* set total time to 15 seconds */ + } + +METHOD VOID reccom_com_preferences(PR_RECCOM *self) + { + LaunchDial(NULL,PREFERENCES_DL,C_SETPREF); + } diff --git a/code/SIBOSDK/record/recdial.c b/code/SIBOSDK/record/recdial.c new file mode 100644 index 0000000..ef42975 --- /dev/null +++ b/code/SIBOSDK/record/recdial.c @@ -0,0 +1,190 @@ +/* +RECDIAL.C + +Sound record/playback command dialogs +*/ + +#include +#include +#include +#include +#include + +GLREF_D PR_RECENG * const receng; +GLREF_D PR_RECWSERV * const w_ws; + +LOCAL_C VOID TenthsToDouble(DOUBLE *pdbl,UINT tenths) +/* +Convert 10ths of a second to a double float. +*/ + { + WORD ten,x; + DOUBLE c; + + x=tenths; + p_itof(pdbl,&x); + ten=10; + p_itof(&c,&ten); + p_fdiv(pdbl,&c); + } + +LOCAL_C INT DoubleToTenths(DOUBLE *pdbl) +/* +Convert a double float to 10ths of a second. +*/ + { + WORD x; + DOUBLE c; + + x=10; + p_itof(&c,&x); + p_fmul(&c,pdbl); + p_inti(&x,&c); + return(x); + } + +LOCAL_C VOID SetTenthsFledit(INT item,UINT val) + { + DOUBLE dbl; + + TenthsToDouble(&dbl,val); + hDlgSetFledit(item,&dbl); + } + +LOCAL_C INT SenseTenthsFledit(INT item) + { + DOUBLE dbl; + + hDlgSenseFledit(item,&dbl); + return(DoubleToTenths(&dbl)); + } + +#pragma METHOD_CALL + +METHOD VOID setrep_dl_dyn_init(PR_SETREP *self) +/* +Dialog for setting repeat count and trailing silence. +*/ + { + WVEFILE_INFO info; + + p_send3(receng,O_ENG_FILE_INFO,&info); + hDlgSetNcedit(1,info.repeats); + SetTenthsFledit(2,info.silence); + } + +METHOD INT setrep_dl_key(PR_SETREP *self,INT index,INT keycode) +/* +Dialog for setting repeat count and trailing silence. +*/ + { + UINT repeats,silence; + + repeats=hDlgSenseNcedit(1); + silence=SenseTenthsFledit(2); + p_send4(receng,O_ENG_SET_REPEATS,repeats,silence); + return(WN_KEY_CHANGED); + } + +METHOD VOID setpref_dl_dyn_init(PR_SETPREF *self) +/* +Dialog for setting record/playback preferences. +*/ + { + RECENG_PREFS *pprefs; + + pprefs=(RECENG_PREFS *)p_send2(receng,O_ENG_SENSE_PREFS); + hDlgSetChlist(1,pprefs->volume); + SetTenthsFledit(2,pprefs->duration); + hDlgSetChlist(3,pprefs->disk); + } + +METHOD INT setpref_dl_key(PR_SETPREF *self,INT index,INT keycode) +/* +Dialog for setting record/playback preferences. +*/ + { + RECENG_PREFS prefs; + + prefs.volume=hDlgSenseChlist(1); + prefs.disk=hDlgSenseChlist(3); + prefs.duration=SenseTenthsFledit(2); + p_send3(receng,O_ENG_SET_PREFS,&prefs); + return(WN_KEY_CHANGED); + } + +METHOD VOID recnew_dl_dyn_init(PR_RECNEW *self) +/* +The dialog for recording to a new file. +*/ + { + RECRBUF *prb; + + prb=(RECRBUF *)self->dlgbox.rbuf; + if (prb->fname[0]) + hDlgSet(1,&prb->fname[0]); + SetTenthsFledit(3,prb->duration); + } + +METHOD VOID recnewdef_dl_set_size(PR_RECNEWDEF *self) + { + p_supersend2(self,O_DL_SET_SIZE); + hDlgTakeFocus(3); + } + +METHOD INT recnew_dl_key(PR_RECNEW *self,INT index,INT keycode) +/* +All dialogs for recording to a new or existing file share this code. +*/ + { + RECRBUF *prb; + INT MaxDuration; + + prb=(RECRBUF *)self->dlgbox.rbuf; + hDlgSense(1,&prb->fname[0]); + prb->duration=SenseTenthsFledit(3); + MaxDuration=p_send3(receng,O_ENG_NEW_FILE,&prb->fname[0]); + if (MaxDuration<0) + { + if (MaxDuration==E_FILE_VOLUME) + hInfoPrint(NO_RECORD_FLASH); + else + hInfoPrintErr(MaxDuration); + return(WN_KEY_NO_CHANGE); + } + if (prb->duration/10>MaxDuration) + { + SetTenthsFledit(3,10*MaxDuration); + hInfoPrint(NO_SPACE_RESET); + return(WN_KEY_NO_CHANGE); + } + p_send3(w_ws->wserv.cli,O_CL_PAUSE,prb->duration); + return(WN_KEY_CHANGED); + } + +METHOD VOID recexist_dl_dyn_init(PR_RECEXIST *self) +/* +The dialog for recording to an existing file. +*/ + { + hDlgSet(1,&((RECRBUF *)self->dlgbox.rbuf)->fname[0]); + p_supersend2(self,O_DL_DYN_INIT); + } + +METHOD VOID recexist_dl_set_size(PR_RECEXIST *self) +/* +The dialog for recording to an existing file. +*/ + { + p_supersend2(self,O_DL_SET_SIZE); + hDlgTakeFocus(3); + } + +METHOD INT recopen_dl_key(PR_RECOPEN *self,INT index,INT keycode) +/* +The dialog for opening a file. +*/ + { + hDlgSense(1,&((RECRBUF *)self->dlgbox.rbuf)->fname[0]); + return(WN_KEY_CHANGED); + } diff --git a/code/SIBOSDK/record/receng.c b/code/SIBOSDK/record/receng.c new file mode 100644 index 0000000..d6a5a32 --- /dev/null +++ b/code/SIBOSDK/record/receng.c @@ -0,0 +1,202 @@ +/* +RECENG.C + +Sound record/playback application engine +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define RECENG_ENVNAME "REC$PREF" +#define RECENG_ENVNAMELEN 8 + +GLREF_D PR_HWIMMAN * const w_am; + +LOCAL_C UINT ConvDurationTo2Ks(UINT tenths) +/* +Convert 10ths of a second to 2Kbyte units +*/ + { + return((tenths*25+0x3f)>>6); + } + +LOCAL_C INT IsDeviceSuitable(INT device) + { + P_DINFO dinfo; + TEXT dspec[16]; + + if (device!='M') + { + p_scpy(&dspec[0],"LOC::M:"); + dspec[P_FSYSNAMESIZE]=device; + p_dinfo(&dspec[0],&dinfo); + return((dinfo.mediatype&0xff)==P_FMEDIA_RAM); + } + return(TRUE); + } + +LOCAL_C INT DiskToDevice(INT disk) + { + if (disk==0) + return('A'); + if (disk==1) + return('M'); + if (disk==2) + return('B'); + } + +LOCAL_C VOID CheckSoundCompletion(INT stat) + { + if (stat==E_GEN_FAIL) + hInfoPrint(-SYS_SOUND_DISABLED); + else + f_leave(stat); + } + +#pragma METHOD_CALL + +METHOD VOID receng_eng_init(PR_RECENG *self,PR_ROOT *hview,UINT mupdate,UINT msound) + { + self->receng.prefs.duration=20; /* two seconds */ + self->receng.prefs.disk=1; /* Internal (M:) */ + self->receng.hview=hview; + self->receng.mupdate=mupdate; + self->receng.msound=msound; + self->receng.wvefile=f_new(CAT_RECORD_RECORD,C_WVEFILE); + self->receng.waveao=f_newsend(CAT_RECORD_RECORD,C_WAVEAO,O_AO_INIT,self,O_ENG_DONE_RECORD,O_ENG_DONE_PLAY); + } + +METHOD TEXT *receng_eng_sense_file(PR_RECENG *self) + { + return((TEXT *)p_send2(self->receng.wvefile,O_WVE_SENSE_FNAME)); + } + +METHOD INT receng_eng_default_disk(PR_RECENG *self) +/* +Returns the default device letter for new recordings. +Based on the "dialog" local disk number (0:A, 1:M, 2:B). +Guaranteed to return a suitable disk. +*/ + { + INT device; + TEXT fspec[P_FNAMESIZE]; + + p_send2(self,O_ENG_SENSE_PREFS); + device=DiskToDevice(self->receng.prefs.disk); /* try user-specified preference first */ + if (!IsDeviceSuitable(device)) + { /* preference is unsuitable */ + device='M'; /* fallback if the default device is unsuitable */ + p_getpth(&fspec[0]); + if (IsDeviceSuitable(fspec[P_FSYSNAMESIZE])) + device=fspec[P_FSYSNAMESIZE]; + } + return(device); + } + +METHOD VOID receng_eng_view_update(PR_RECENG *self) + { + p_send2(self->receng.hview,self->receng.mupdate); + } + +METHOD INT receng_eng_new_file(PR_RECENG *self,TEXT *pname) + { + return(p_send3(self->receng.wvefile,O_WVE_NEW,pname)); + } + +METHOD VOID receng_eng_open_file(PR_RECENG *self,TEXT *pname) + { + p_send3(self->receng.wvefile,O_WVE_OPEN,pname); + p_send3(w_am,O_AM_NEW_FILENAME,receng_eng_sense_file(self)); + receng_eng_view_update(self); + } + +METHOD VOID receng_eng_done_record(PR_RECENG *self,INT stat) + { + CheckSoundCompletion(stat); + receng_eng_open_file(self,NULL); + } + +METHOD VOID receng_eng_done_play(PR_RECENG *self,INT stat) + { + CheckSoundCompletion(stat); + receng_eng_view_update(self); + } + +METHOD VOID receng_eng_sound_play(PR_RECENG *self) + { + INT v; + WVEFILE_INFO info; + + p_send2(self,O_ENG_SENSE_PREFS); + v=0; /* loud */ + if (self->receng.prefs.volume==1) + v=2; /* medium */ + else if (self->receng.prefs.volume==2) + v=5; /* quiet */ + p_send3(self->receng.wvefile,O_WVE_SENSE_INFO,&info); + if (info.duration==0) + { + hInfoPrint(NO_DATA_NO_PLAY); + return; + } + p_send4(self->receng.waveao,O_WV_PLAY,p_send2(self->receng.wvefile,O_WVE_SENSE_FNAME),v); + p_send3(self->receng.hview,self->receng.msound,&info.total); + } + +METHOD VOID receng_eng_sound_record(PR_RECENG *self,UINT duration) + { + UINT num2Ks; + ULONG tenths; + TEXT *name; + + num2Ks=ConvDurationTo2Ks(duration); + tenths=num2Ks; + tenths=(tenths<<6)/25; + name=(TEXT *)p_send2(self->receng.wvefile,O_WVE_SENSE_FNAME); + if (name[P_FSYSNAMESIZE]=='M') + p_delete(name); /* free space for the sound server */ + p_send4(self->receng.waveao,O_WV_RECORD,name,num2Ks); + p_send3(self->receng.hview,self->receng.msound,&tenths); + } + +METHOD VOID receng_eng_sound_stop(PR_RECENG *self) + { + p_send2(self->receng.waveao,O_WV_STOP); + } + +METHOD VOID receng_eng_set_repeats(PR_RECENG *self,UINT repeats,UINT tenths) + { + p_send4(self->receng.wvefile,O_WVE_SET_REPEATS,repeats,tenths); + receng_eng_view_update(self); + } + +METHOD VOID receng_eng_file_info(PR_RECENG *self,WVEFILE_INFO *pi) + { + p_send3(self->receng.wvefile,O_WVE_SENSE_INFO,pi); + } + +METHOD RECENG_PREFS *receng_eng_sense_prefs(PR_RECENG *self) + { + INT len; + TEXT bb[P_ENVMAX]; + + len=p_getenviron(RECENG_ENVNAME,RECENG_ENVNAMELEN,&bb[0]); + if (len==sizeof(RECENG_PREFS)) + self->receng.prefs=*(RECENG_PREFS *)&bb[0]; + return(&self->receng.prefs); + } + +METHOD VOID receng_eng_set_prefs(PR_RECENG *self,RECENG_PREFS *new) + { + if (!p_bcmp(&self->receng.prefs,sizeof(RECENG_PREFS),new,sizeof(RECENG_PREFS))) + return; /* no change */ + self->receng.prefs=*new; + f_leave(p_setenviron(RECENG_ENVNAME,RECENG_ENVNAMELEN,&self->receng.prefs,sizeof(RECENG_PREFS))); + } diff --git a/code/SIBOSDK/record/record.afl b/code/SIBOSDK/record/record.afl new file mode 100644 index 0000000..979d1fb --- /dev/null +++ b/code/SIBOSDK/record/record.afl @@ -0,0 +1,3 @@ +record.pic +record.rzc +record.shd diff --git a/code/SIBOSDK/record/record.cat b/code/SIBOSDK/record/record.cat new file mode 100644 index 0000000..130136d --- /dev/null +++ b/code/SIBOSDK/record/record.cat @@ -0,0 +1,244 @@ +IMAGE record + +EXTERNAL olib +EXTERNAL hwim + +INCLUDE p_std.h +INCLUDE p_gen.h +INCLUDE p_que.h +INCLUDE p_object.h +INCLUDE p_file.h +INCLUDE epoc.h +INCLUDE wlib.h +INCLUDE olib.g +INCLUDE varray.g +INCLUDE appman.g +INCLUDE timer.g +INCLUDE bwin.g +INCLUDE matcher.g +INCLUDE listbox.g +INCLUDE pulldown.g +INCLUDE hwimman.g + +CLASS waveao active +Sound file record and play + { + REPLACE ao_init Queue into appman and init callback + REPLACE ao_run Call back + REPLACE ao_cancel Cancel sound + ADD wv_record Start recording a file + ADD wv_play Start playing a file + ADD wv_stop Start playing/recording a file + PROPERTY + { + WORD request; Request type + PR_ROOT *hdone; Callback handle on completion + UWORD done_record; Callback method on record completion + UWORD done_play; Callback method on playback completion + } + } + +CLASS wvefile root +Sound file + { + ADD wve_new Create a new file + ADD wve_open Open an existing file + ADD wve_sense_fname Sense the file name (for reading) + ADD wve_sense_info Fill in a WVEFILE_INFO struct + ADD wve_set_repeats Set the repeat and silence + TYPES + { + typedef struct + { + TEXT *device; address of device character + TEXT *name; file name component + WORD ret; possible error return + WORD nmlen; length of file name + UWORD duration; duration in 10ths of a sec + UWORD silence; silence in 10ths of a second + UWORD repeats; number of repeats + ULONG total; total time in seconds (with repeats & silence) + ULONG samples; number of samples + ULONG flen; file length + } WVEFILE_INFO; + } + PROPERTY + { + VOID *fcb; + WORD ret; + P_FPARSE crk; + TEXT fname[P_FNAMESIZE]; + P_INFO info; + SndFile head; + } + } + +CLASS receng root + { + ADD eng_init + ADD eng_new_file Start a new file + ADD eng_open_file Open an existing file (close any current file) + ADD eng_sense_file Get the current file name + ADD eng_file_info Get information on the current file + ADD eng_default_disk Return default device for new file + ADD eng_view_update Call back view to update itself + ADD eng_done_record Callback from active object on record completion + ADD eng_done_play Callback from active object on play completion + ADD eng_sound_play Play the current file + ADD eng_sound_record Record to the current file + ADD eng_sound_stop Stop the current record or playback + ADD eng_set_repeats Set the number of repeats and trailing silence + ADD eng_set_prefs Set the persistent preferences + ADD eng_sense_prefs Sense the persistent preferences + TYPES + { + typedef struct + { + WORD volume; volume for playback + WORD duration; maximum duration in 10ths of a sec + WORD disk; preferred disk for new files + } RECENG_PREFS; + } + PROPERTY 2 + { + PR_WVEFILE *wvefile; digital sound file + PR_WAVEAO *waveao; record/play active object + PR_ROOT *hview; callback view handle + UWORD mupdate; callback view method for update + UWORD msound; callback view method for begin sound + RECENG_PREFS prefs; persistent preferences + } + } + +CLASS reccom comman + { + REPLACE com_file_change from System application + ADD com_set_repeat Set repeat menu command + ADD com_rep_alarm Repeat for alarm menu command + ADD com_preferences Set preferences menu command + ADD com_new_file New file menu command + ADD com_open_file Open file menu command + ADD com_record_new Record new (Tab) button + ADD com_re_record Record over (Space) button + TYPES + { + typedef struct + { + WORD duration; + TEXT fname[P_FNAMESIZE]; + } RECRBUF; + } + } + +CLASS recman hwimman + { + REPLACE am_clean_up + } + +CLASS recwserv wserv + { + REPLACE ws_dyn_init + } + +CLASS timebar active + { + REPLACE ao_init Queue into appman and set priority + REPLACE ao_queue Queue next read + REPLACE ao_run Update on tick + ADD tb_start Start time bar + ADD tb_stop Stop time bar + ADD tb_draw For redraw + PROPERTY + { + WORD visible; Visible if TRUE + WORD wid; Window id of landlord + LONG tenths0; Initial value of timer + LONG tenths; Counted down value of timer + WORD x; Bar value in pixels + P_RECT rect; Bar rectangle + } + } + +CLASS recbut root + { + REPLACE destroy + ADD rb_init + ADD rb_draw + ADD rb_depress + ADD rb_hide + PROPERTY + { + WORD hide; Hide button if TRUE + WORD wid; Window id of landlord + P_RECT rect; Button rectangle + VOID *buttxt; As loaded from resource file + TEXT *inlabel; Button label + TEXT *caption; Caption above button + WORD caplen; Caption length + } + } + +CLASS reccli bwin + { + REPLACE destroy + REPLACE wn_connect + REPLACE wn_draw + REPLACE wn_key + ADD cl_update Viewed data has changed + ADD cl_sound_filter To catch keys while recording or playing + ADD cl_pause_filter To catch keys while waiting to record + ADD cl_begin_sound + ADD cl_pause + PROPERTY 6 + { + PR_TIMEBAR *timebar; + PR_RECBUT *recbut[5]; + UINT duration; Stored for pause to record + WORD running; TRUE if sound record/play running + WORD width; Window width + VOID *clitxt; Allocated resource + TEXT *secs; Seconds suffix + TEXT *title; Title format string + TEXT *sub; Subtitle format string + TEXT tsep; Time separator + UBYTE spare; + } + } + +CLASS setrep dlgbox + { + REPLACE dl_dyn_init + REPLACE dl_key + } + +CLASS setpref dlgbox + { + REPLACE dl_dyn_init + REPLACE dl_key + } + +CLASS recnew dlgbox +Record to new file dialog + { + REPLACE dl_dyn_init + REPLACE dl_key + } + +CLASS recnewdef recnew +Record to new file dialog with a default name + { + REPLACE dl_set_size + } + +CLASS recexist recnew +Record to existing file dialog + { + REPLACE dl_dyn_init + REPLACE dl_set_size + } + +CLASS recopen dlgbox +Open file dialog + { + REPLACE dl_key + } diff --git a/code/SIBOSDK/record/record.hlp b/code/SIBOSDK/record/record.hlp new file mode 100644 index 0000000..8bd4bf5 --- /dev/null +++ b/code/SIBOSDK/record/record.hlp @@ -0,0 +1,60 @@ +/* +RECORD.HLP + +Help file for Series 3a RECORD app +*/ + + + +RESOURCE HELP_ARRAY record_help +{ +topic="Record"; +topic_id=record_help_index; +} + +RESOURCE TOPIC_ARRAY record_help_index +{ +id_lst= +{ +record_alarms, +record_voice +}; +} + +RESOURCE HELP_ARRAY record_alarms +{ +topic="Recording alarm sounds"; +strlst= +{ +STRING {str="Use `New file' (or Tab) to start recording to a file";}, +STRING {str="Press Enter to play it back ";}, +STRING {str="To try again, use Space to record to the same file";}, +STRING {str="";}, +STRING {str="Esc stops recording or playback";}, +STRING {str="";}, +STRING {str="Sound files have a built-in "<34>"number of repeats"<34>" and length";}, +STRING {str="of silence between the repeats. Set these with `Set repeat'";}, +STRING {str="";}, +STRING {str="Sound files appear automatically in `Set alarm' dialogs";} +}; +} + +RESOURCE HELP_ARRAY record_voice +{ +topic="Recording voice notes"; +strlst= +{ +STRING {str="In the System screen, move to `Record' and use";}, +STRING {str="`Create new list' and change the `Directory for files'";}, +STRING {str="line. Then voice recordings will not appear in the";}, +STRING {str="`Set alarm' dialogs";}, +STRING {str="";}, +STRING {str="Use `Assign button' and make a button-press go";}, +STRING {str="to this list";}, +STRING {str="";}, +STRING {str="Use this button-press, then Tab, Enter and Space";}, +STRING {str="to record each new note";} +}; +} + + diff --git a/code/SIBOSDK/record/record.ms b/code/SIBOSDK/record/record.ms new file mode 100644 index 0000000..1807070 --- /dev/null +++ b/code/SIBOSDK/record/record.ms @@ -0,0 +1,3 @@ +Record.WVE +\WVE\ +1003 diff --git a/code/SIBOSDK/record/record.pic b/code/SIBOSDK/record/record.pic new file mode 100644 index 0000000..f9206fe Binary files /dev/null and b/code/SIBOSDK/record/record.pic differ diff --git a/code/SIBOSDK/record/record.pr b/code/SIBOSDK/record/record.pr new file mode 100644 index 0000000..1b3c5bf --- /dev/null +++ b/code/SIBOSDK/record/record.pr @@ -0,0 +1,46 @@ +#system epoc img +#set epocinit=iplib +#model small jpi + +#abort on + +#set version=0x118F +#set priority=0x80 +#set heapsize=0x48 + +#compile %main.cat + +#if %remake #or (%main.rg #older %main.re) #or (%main.rg #older %main.g) #then + #run "re %main" no_window no_abort +#endif + +#if (%main.rsg #older %main.rss) #or (%main.rsg #older %main.rg) #then + #file delete %main.rsg + #run "rs %main" no_window no_abort +#endif + +#if %main.rzc #older %main.rsg #then + #run "rch %main" no_window no_abort +#endif + +#compile reccli.c +#compile reccom.c +#compile recdial.c +#compile receng.c +#compile recwserv.c +#compile waveao.c +#compile wvefile.c + +#if %main.shd #older %main.ms #then + #run "makeshd %main" no_window no_abort + #file delete %main.img +#endif + +#if (%main.img #older %main.afl) #or (%main.img #older %main.pic) #then + #file delete %main.img +#endif + +#pragma link(olib.lib) +#pragma link(hwim.lib) + +#link %main diff --git a/code/SIBOSDK/record/record.re b/code/SIBOSDK/record/record.re new file mode 100644 index 0000000..518c107 --- /dev/null +++ b/code/SIBOSDK/record/record.re @@ -0,0 +1,9 @@ +#include + +_C_RECCOM +_O_COM_EXIT +_O_COM_SET_REPEAT +_O_COM_REP_ALARM +_O_COM_PREFERENCES +_O_COM_NEW_FILE +_O_COM_OPEN_FILE diff --git a/code/SIBOSDK/record/record.rss b/code/SIBOSDK/record/record.rss new file mode 100644 index 0000000..5177d7f --- /dev/null +++ b/code/SIBOSDK/record/record.rss @@ -0,0 +1,354 @@ +/* +RECORD.RSS + +Resource file for Sound recording Handheld Application +*/ + +#include +#include +#include + +RESOURCE WSERV_INFO record_accs + { + menbar_id=record_menu; + first_com=O_COM_EXIT; +/* follows order in cat file command manager */ + accel={'x', /* Exit */ + 'r', /* Set repeat */ + 'a', /* Repeat for alarm */ + 'q', /* Set preferences */ + 'n', /* New file */ + 'o' /* Open file */ + }; + } + +RESOURCE MENU_BAR record_menu + { + items = + { + MENU_BAR_ITEM + { + menu_id=file_menu; + mb_item="File"; + }, + MENU_BAR_ITEM + { + menu_id=repeats_menu; + mb_item="Repeats"; + }, + MENU_BAR_ITEM + { + menu_id=special_menu; + mb_item="Special"; + } + }; + } + +RESOURCE MENU file_menu + { + items = + { + MENU_ITEM + { + com_id=O_COM_NEW_FILE; + mn_item="New file"; + }, + MENU_ITEM + { + com_id=O_COM_OPEN_FILE; + mn_item="Open file"; + } + }; + } + +RESOURCE MENU repeats_menu + { + items = + { + MENU_ITEM + { + com_id=O_COM_SET_REPEAT; + mn_item="Set repeat"; + }, + MENU_ITEM + { + com_id=O_COM_REP_ALARM; + mn_item="Adjust for alarm"; + } + }; + } + +RESOURCE MENU special_menu + { + items = + { + MENU_ITEM + { + com_id=O_COM_PREFERENCES; + mn_item="Set preferences"; + }, + MENU_ITEM + { + com_id=O_COM_EXIT; + mn_item="Exit"; + } + }; + } + +RESOURCE STRING dflt_fname { str="%c:RECORD%02d"; } + +RESOURCE STRING no_space_reset { str="Insufficient disk space - Maximum duration reset"; } + +RESOURCE STRING no_record_flash { str="Can't record to a Flash SSD"; } + +RESOURCE STRING no_data_no_play { str="No sound to play"; } + +RESOURCE STRING adjust_alarm_confirm { str="Adjust repeat for use as an alarm"; } + +/* DIALOG RESOURCES */ + +RESOURCE DIALOG set_rep_dl +/* Dialog used by the "Set repeat" menu item */ + { + title="Set repeat"; + flags=DLGBOX_NOTIFY_ENTER; + controls= + { + CONTROL + { + class=C_NCEDIT; + prompt="Repeat count"; + info=NCEDIT + { + low=1; + high=1000; + }; + }, + CONTROL + { + class=C_FLTEDIT; + prompt="Trailing silence (sec)"; + info=FLTEDIT + { + low=0.0; + high=1000.0; + ndec=1; + }; + } + }; + } + +RESOURCE MENU volume_list + { + items= + { + CHOICE_ITEM {str="Loud";}, + CHOICE_ITEM {str="Medium";}, + CHOICE_ITEM {str="Quiet";} + }; + } + +RESOURCE MENU disk_list + { + items= + { + CHOICE_ITEM {str="A";}, + CHOICE_ITEM {str="Internal";}, + CHOICE_ITEM {str="B";} + }; + } + +RESOURCE DIALOG preferences_dl +/* Dialog used by the "Set preferences" menu item */ + { + title="Set preferences"; + flags=DLGBOX_NOTIFY_ENTER; + controls= + { + CONTROL + { + class=C_CHLIST; + prompt="Playback volume"; + info=CHLIST{rid=volume_list;}; + }, + CONTROL + { + class=C_FLTEDIT; + prompt="Default duration (sec)"; + info=FLTEDIT + { + low=0.0; + high=3000.0; + ndec=1; + }; + }, + CONTROL + { + class=C_CHLIST; + prompt="Default disk for new files"; + info=CHLIST{rid=disk_list;}; + } + }; + } + +RESOURCE DIALOG open_file_dl +/* Dialog used by the "Open file" menu item */ + { + title="Open file"; + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_RBUF_FILLED; + controls= + { + CONTROL + { + flags=DLGBOX_ITEM_NEEDS_PACK; + class=C_FNSELWN; + prompt="File:"; + info=FNSELWN + { + flags=IN_FNSELWN_STANDARD; + fname=""; + }; + } + }; + } + +RESOURCE DIALOG record_new_dl +/* Dialog presented before recording to a new file */ + { + title="Record to new file"; + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_RBUF_FILLED; + controls= + { + CONTROL + { + flags=DLGBOX_ITEM_NEEDS_PACK; + class=C_FNEDIT; + prompt="File:"; + info=FNEDIT + { + flags=IN_FNEDIT_STANDARD; + fname=""; + }; + }, + CONTROL + { + class=C_FLTEDIT; + prompt="Maximum duration (sec)"; + info=FLTEDIT + { + low=0.0; + high=3000.0; + current=0.0; + ndec=1; + }; + } + }; + } + +RESOURCE DIALOG re_record_dl +/* Dialog presented before recording to an existing file */ + { + title="Record over existing file"; + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_RBUF_FILLED; + controls= + { + CONTROL + { + flags=DLGBOX_ITEM_NEEDS_PACK; + class=C_FNSELWN; + prompt="File:"; + info=FNSELWN + { + flags=IN_FNSELWN_STANDARD; + fname=""; + }; + }, + CONTROL + { + class=C_FLTEDIT; + prompt="Maximum duration (sec)"; + info=FLTEDIT + { + low=0.0; + high=3000.0; + current=0.0; + ndec=1; + }; + }, + CONTROL + { + class=C_TEXTWIN; + flags=DLGBOX_ITEM_CENTRE|DLGBOX_ITEM_DEAD; + info=TXTMESS + { + flags=IN_TEXTWIN_AL_CENTRE; + str="The data in the existing file will be replaced"; + }; + } + }; + } + +RESOURCE STRING_ARRAY reccli_text + { + strlst= + { + STRING { str="sec"; }, + STRING { str="%s %s %d Kbyte"; }, + STRING { str="Repeats: %d Trailing silence: %s Total: %s"; } + }; + } + +/* The order of the following 5 items must not be changed */ + +RESOURCE STRING_ARRAY clibut_rec_new +/* "Record new" button */ + { + strlst= + { + STRING {str="Tab";}, /* button text */ + STRING {str="Record new";} /* button label */ + }; + } + +RESOURCE STRING_ARRAY clibut_rec_over +/* "Record over" button */ + { + strlst= + { + STRING {str="Space";}, /* button text */ + STRING {str="Record over";} /* button label */ + }; + } + +RESOURCE STRING_ARRAY clibut_play +/* "Play" button */ + { + strlst= + { + STRING {str="Enter";}, /* button text */ + STRING {str="Play";} /* button label */ + }; + } + +RESOURCE STRING_ARRAY clibut_stop +/* "Stop" button */ + { + strlst= + { + STRING {str="Esc";}, /* button text */ + STRING {str="Stop";} /* button label */ + }; + } + +RESOURCE STRING_ARRAY clibut_start +/* "Start recording" button */ + { + strlst= + { + STRING {str="Space";}, /* button text */ + STRING {str="Start recording";} /* button label */ + }; + } + +#include "record.hlp" + diff --git a/code/SIBOSDK/record/recwserv.c b/code/SIBOSDK/record/recwserv.c new file mode 100644 index 0000000..8a54531 --- /dev/null +++ b/code/SIBOSDK/record/recwserv.c @@ -0,0 +1,55 @@ +/* + RECWSERV.C + +Wserv subclass for Sound record/playback application +*/ + +#include +#include +#include +#include +#include + +GLREF_D PR_HWIMMAN * const w_am; +GLREF_D UBYTE *DatCommandPtr; +GLREF_D UBYTE *DatUsedPathNamePtr; +GLREF_D WSERV_SPEC *wserv_channel; +GLREF_D PR_GATE *DatGate; + +GLDEF_D PR_RECENG *receng; + +#pragma METHOD_CALL + +GLDEF_C VOID main(VOID) + { + IN_HWIMMAN app; + IN_WSERV ws; + + p_linklib(0); + app.flags=FLG_APPMAN_FULLSCREEN|FLG_APPMAN_RSCFILE|FLG_APPMAN_CLEAN| + FLG_APPMAN_SRSCFILE; + app.wserv_cat=ws.com_cat=p_getlibh(CAT_RECORD_RECORD); + app.wserv_class=C_RECWSERV; + ws.com_class=C_RECCOM; + p_send4(p_new(CAT_RECORD_RECORD,C_RECMAN),O_AM_INIT,&app,&ws); + } + +METHOD VOID recwserv_ws_dyn_init(PR_RECWSERV *self) + { + W_WINDATA wd; + + p_setpth("\\WVE\\"); + wd.extent.tl.x=0; + wd.extent.tl.y=0; + wd.extent.height=wserv_channel->conn.info.pixels.y; + wd.extent.width=wserv_channel->conn.info.pixels.x-DatGate->gate.x.bsww; + self->wserv.cli=f_newsend(CAT_RECORD_RECORD,C_RECCLI, + O_WN_CONNECT,NULL,W_WIN_EXTENT,&wd); + wsSetList(W_STATUS_WINDOW_ICON,NULL,W_STATUS_WIN_NO_DIAMOND); + wStatusWindow(W_STATUS_WINDOW_BIG); + self->wserv.help_index_id=RECORD_HELP; + receng=f_newsend(CAT_RECORD_RECORD,C_RECENG,O_ENG_INIT,self->wserv.cli,O_CL_UPDATE,O_CL_BEGIN_SOUND); + p_send4(self->wserv.com,O_COM_FILE_CHANGE,w_am->hwimman.command, + DatUsedPathNamePtr); + } + diff --git a/code/SIBOSDK/record/vid.bat b/code/SIBOSDK/record/vid.bat new file mode 100644 index 0000000..4ccb4d5 --- /dev/null +++ b/code/SIBOSDK/record/vid.bat @@ -0,0 +1,22 @@ +@echo off +goto X%1X +:Xv0X +:XoffX +set jpivid=v0 +echo VID is now OFF +goto :end +:Xv2X +:XonX +set jpivid=v2 +echo VID is now ON +goto :end +:XX +call checkvid +goto %jpivid% +:v0 +echo VID is OFF +goto end +:v2 +echo VID is ON +:end + diff --git a/code/SIBOSDK/record/waveao.c b/code/SIBOSDK/record/waveao.c new file mode 100644 index 0000000..93056cf --- /dev/null +++ b/code/SIBOSDK/record/waveao.c @@ -0,0 +1,64 @@ +/* +WAVEAO.C + +Active object to record and playback sound +*/ + +#include + +#define WAVEAO_REQUEST_RECORD 0 +#define WAVEAO_REQUEST_PLAY 1 + +GLREF_D PR_APPMAN * const w_am; + +#pragma METHOD_CALL + +METHOD VOID waveao_ao_init(PR_WAVEAO *self,PR_ROOT *hdone,UINT done_record,UINT done_play) + { + self->active.priority=PRIORITY_ACTIVE_VOICE; + p_send3(w_am,O_AM_ADD_TASK,self); + self->waveao.hdone=hdone; + self->waveao.done_record=done_record; + self->waveao.done_play=done_play; + } + +METHOD INT waveao_ao_run(PR_WAVEAO *self) + { + if (self->active.stat==E_FILE_CANCEL) + self->active.stat=0; + p_send3(self->waveao.hdone,(self->waveao.request==WAVEAO_REQUEST_RECORD)? + self->waveao.done_record:self->waveao.done_play,self->active.stat); + return(RUN_ACTIVE_USED); + } + +METHOD VOID waveao_ao_cancel(PR_WAVEAO *self) + { + p_playsoundcancel(); /* entirely equivalent to p_recordsoundcancel */ + p_supersend2(self,O_AO_CANCEL); + } + +METHOD VOID waveao_wv_play(PR_WAVEAO *self,TEXT *name,UINT volume) + { + if (!self->active.isactive) + { + p_playsounda(name,0,volume,&self->active.stat); + self->active.isactive=TRUE; + self->waveao.request=WAVEAO_REQUEST_PLAY; + } + } + +METHOD VOID waveao_wv_record(PR_WAVEAO *self,TEXT *name,UINT len) + { + if (!self->active.isactive) + { + p_recordsounda(name,len,&self->active.stat); + self->active.isactive=TRUE; + self->waveao.request=WAVEAO_REQUEST_RECORD; + } + } + +METHOD VOID waveao_wv_stop(PR_WAVEAO *self) + { + p_playsoundcancel(); /* entirely equivalent to p_recordsoundcancel */ + } + diff --git a/code/SIBOSDK/record/wvefile.c b/code/SIBOSDK/record/wvefile.c new file mode 100644 index 0000000..e9c8b47 --- /dev/null +++ b/code/SIBOSDK/record/wvefile.c @@ -0,0 +1,190 @@ +/* + WVEFILE.C + +Sound record/playback sound file +*/ + +#include +#include +#include +#include +#include +#include +#include +#include + +LOCAL_C ULONG SamplesToTenths(ULONG samples) + { + return((samples>>4)/50); + } + +LOCAL_C ULONG EffectiveSamples(ULONG samples) +/* +Converts the number of byte samples to the effective number of +samples for playback by rounding up to the nearest 0x800 (2K) +boundary and adding another 0x600. +*/ + { + return(((samples+0x7ff)&(~0x7ff))+0x600); + } + +LOCAL_C VOID CloseFile(PR_WVEFILE *self) + { + p_close(self->wvefile.fcb); + self->wvefile.fcb=NULL; + } + +LOCAL_C VOID StoreFileName(PR_WVEFILE *self,TEXT *fname) + { + CloseFile(self); + f_fparse(fname,NULL,&self->wvefile.fname[0],&self->wvefile.crk); + hEnsurePath(&self->wvefile.fname[0]); + } + +#pragma METHOD_CALL + + +METHOD INT wvefile_wve_new(PR_WVEFILE *self,TEXT *fname) +/* +Return the maximum duration in seconds consistent with the space on fspec +as a positive number. Otherwise return a negative error number. +*/ + { + UINT minfree; + INT SSDType; + P_DINFO dinfo; + + StoreFileName(self,fname); + p_dinfo(&self->wvefile.fname[0],&dinfo); + minfree=0x1000; /* need at least approx half a seconds worth of space */ + SSDType=dinfo.mediatype&0xff; + if (SSDType==P_FMEDIA_FLASH) + return(E_FILE_VOLUME); + if (SSDType==P_FMEDIA_ROM || SSDType==P_FMEDIA_WRITEPROTECTED) + return(E_FILE_PROTECT); + if (dinfo.mediatype&P_FMEDIA_INTERNAL) + minfree+=0x2800; /* since the sound server takes 0x2800 bytes to run */ + if (p_finfo(&self->wvefile.fname[0],&self->wvefile.info)>=0) + { + if (!(self->wvefile.info.status&P_FAWRITE)) + return(E_FILE_RDONLY); + dinfo.free+=self->wvefile.info.size; /* credit length of existing file */ + } + if (dinfo.freewvefile.ret=p_finfo(&self->wvefile.fname[0],&self->wvefile.info); + if (self->wvefile.ret<0) + return; + CloseFile(self); /* file can be open after an error in playback */ + self->wvefile.ret=p_open(&self->wvefile.fcb,&self->wvefile.fname[0],P_FSHARE); + if (self->wvefile.ret<0) + return; + self->wvefile.ret=p_read(self->wvefile.fcb,&self->wvefile.head,sizeof(SndFile)); + if (self->wvefile.ret<0) + { + close: + CloseFile(self); + return; + } + if (p_scmp(&self->wvefile.head.Signature[0],ALawSignature)) + { + self->wvefile.ret=E_FILE_INVALID; + goto close; + } + /* Wany "bootleg" files exist with incorrect Samples field */ + /* The sound system services work off the file length and not Samples */ + /* So we patch Samples here to the correct value */ + self->wvefile.head.Samples=self->wvefile.info.size-sizeof(SndFile); + if (self->wvefile.head.Repeats==0) + self->wvefile.head.Repeats=1; + } + +METHOD TEXT *wvefile_wve_sense_fname(PR_WVEFILE *self) + { + return(&self->wvefile.fname[0]); + } + +METHOD VOID wvefile_wve_sense_info(PR_WVEFILE *self,WVEFILE_INFO *pi) +/* +Write all kinds of information to *pi. +*/ + { + ULONG samples; + + p_bfil(pi,sizeof(WVEFILE_INFO),0); + pi->device=&self->wvefile.fname[self->wvefile.crk.system]; + pi->name=pi->device+self->wvefile.crk.device+self->wvefile.crk.path; + pi->nmlen=self->wvefile.crk.name; + if (self->wvefile.fcb==NULL) + return; + pi->duration=SamplesToTenths(self->wvefile.head.Samples); + pi->silence=(WORD)(((ULONG)self->wvefile.head.SilenceInTicks*5)>>4); + samples=EffectiveSamples(self->wvefile.head.Samples); + samples+=250*(ULONG)self->wvefile.head.SilenceInTicks; /* 250 samples per tick */ + if (self->wvefile.head.Repeats>1 && self->wvefile.head.SilenceInTicks<2) + samples+=500; /* the minimum silence between repeats */ + pi->repeats=self->wvefile.head.Repeats; + pi->total=SamplesToTenths(samples*pi->repeats); + pi->samples=self->wvefile.head.Samples; + pi->flen=self->wvefile.info.size; + } + +METHOD VOID wvefile_wve_set_repeats(PR_WVEFILE *self,UINT repeats,UINT tenths) +/* +If repeats is zero or more, set the number of repeats and the trailing silence +to tenths in 1/10s of a second. +If repeats is zero, set the silence such that the total duration with the +current number of repeats is equal to tenths. +*/ + { + INT ret; + INT silence,maxrepeats; + LONG total,period; + + ret=0; + if (self->wvefile.fcb==NULL) + return; + if (repeats>0) + silence=(INT)(((ULONG)tenths<<4)/5); /* convert to ticks */ + else + { /* tenths is total desired time */ + repeats=self->wvefile.head.Repeats; + total=tenths; + total*=800; /* convert tenths to samples */ + period=EffectiveSamples(self->wvefile.head.Samples); + maxrepeats=(INT)(total/(period+500)); + if (repeats<2 || repeats>maxrepeats) + repeats=maxrepeats; + if (repeats==0) + repeats=1; + silence=0; + if (repeats>1) + silence=(INT)((total-repeats*period+249*repeats)/(250*repeats)); + } + if (silence==self->wvefile.head.SilenceInTicks && repeats==self->wvefile.head.Repeats) + return; /* no change */ + self->wvefile.head.SilenceInTicks=silence; + self->wvefile.head.Repeats=repeats; + CloseFile(self); + ret=p_open(&self->wvefile.fcb,&self->wvefile.fname[0],P_FUPDATE); + if (ret>=0) + { + ret=p_write(self->wvefile.fcb,&self->wvefile.head,sizeof(SndFile)); + CloseFile(self); + } + wvefile_wve_open(self,NULL); + f_leave(ret); + } + + diff --git a/code/SIBOSDK/resource/s3_.rss b/code/SIBOSDK/resource/s3_.rss new file mode 100644 index 0000000..6509c9b --- /dev/null +++ b/code/SIBOSDK/resource/s3_.rss @@ -0,0 +1,1389 @@ +SYSTEM +/* +(No comment to be placed on the first line of this file!) + +S3_.RSS + +System Resource file for Series 3 + +*/ + +#include +#include +#include +#include + +/****************** THE SPECIAL CHARACTERS ************************/ + +/* leave most of these alone, but translate the NSWE */ + +GLOBAL RESOURCE STRING sys_special_characters { str="+-*/<,>.NSWE"; } + +/************************* STRINGS ********************************/ + +GLOBAL RESOURCE STRING sys_string { str="%s"; } +GLOBAL RESOURCE STRING sys_dimmed_msg {str="This item is not available";} +GLOBAL RESOURCE STRING sys_locked_msg {str="This item cannot be changed";} +GLOBAL RESOURCE STRING sys_busy { str="Busy"; } +GLOBAL RESOURCE STRING sys_scanning { str="Scanning"; } +GLOBAL RESOURCE STRING sys_printing_to { str="Printing to %s";} +GLOBAL RESOURCE STRING sys_page_is { str="(page %u)";} + +GLOBAL RESOURCE STRING sys_copied_prompt {str="Copied";} +GLOBAL RESOURCE STRING sys_copying_prompt {str="Saving as \"%s\"";} +GLOBAL RESOURCE STRING sys_loading_prompt {str="Loading \"%s\"";} +GLOBAL RESOURCE STRING sys_merging_prompt {str="Merging in \"%s\"";} +GLOBAL RESOURCE STRING sys_nothing_to_bring {str="Nothing to bring";} +GLOBAL RESOURCE STRING sys_not_found {str="Not found"; } +GLOBAL RESOURCE STRING sys_nothing_to_find {str="Nothing to find";} + +GLOBAL RESOURCE STRING sys_compress_prompt {str="Compressing \"%s\"";} +GLOBAL RESOURCE STRING sys_not_compressible {str="Cannot compress on Flash";} + +GLOBAL RESOURCE STRING sys_password_incorrect {str="Incorrect password";} +GLOBAL RESOURCE STRING sys_password_not_confirmed {str="Password not confirmed";} + +GLOBAL RESOURCE STRING sys_range_reset {str="Out of range - reset to limit";} +GLOBAL RESOURCE STRING sys_invalid_num {str="Number is not valid";} +GLOBAL RESOURCE STRING sys_invalid_margins { str="Invalid margins. Reset ?"; } +GLOBAL RESOURCE STRING sys_invalid_char { str="Undiallable character"; } +GLOBAL RESOURCE STRING sys_out_of_range {str="Value out of range: %s = %s";} + /* as used in "Value out of range: Max = 20.45 */ + +GLOBAL RESOURCE STRING sys_edit_nchars {str="Maximum number of characters reached";} + +GLOBAL RESOURCE STRING sys_popout_help {str="Press Tab to change this item";} + +GLOBAL RESOURCE STRING sys_help_string {str="Help: %s";} + +GLOBAL RESOURCE STRING sys_replace_disk {str="Replace the application disk";} + + /* the prompts for a file selector and a pack selector */ +GLOBAL RESOURCE STRING sys_name {str="Name";} +GLOBAL RESOURCE STRING sys_pack {str="Disk";} + + /* part of the title line of a filelist */ +GLOBAL RESOURCE STRING sys_filelist_disk {str="Disk ";} + +GLOBAL RESOURCE STRING sys_flist_reset { str="File list reset"; } +GLOBAL RESOURCE STRING sys_device_memory { str="Internal"; } +GLOBAL RESOURCE STRING sys_path_is { str="Path is %s"; } +GLOBAL RESOURCE STRING sys_choose_directory { str="Choose a directory"; } +GLOBAL RESOURCE STRING sys_choose_filename { str="Choose a filename"; } +GLOBAL RESOURCE STRING sys_choose_new_directory { str="Directory already exists"; } +GLOBAL RESOURCE STRING sys_exists_over { str="File already exists: overwrite?"; } + +/* Next two strings have a maximum length of 5 characters each */ +GLOBAL RESOURCE STRING sys_max { str="Max"; } +GLOBAL RESOURCE STRING sys_min { str="Min"; } + +GLOBAL RESOURCE STRING sys_dec_places { str="Decimal places"; } +GLOBAL RESOURCE STRING sys_sig_digits { str="Significant digits"; } +GLOBAL RESOURCE STRING sys_evaldlg_title { str="Set \"Evaluate\" format"; } +GLOBAL RESOURCE STRING sys_nothing_to_eval { str="Nothing to evaluate"; } +GLOBAL RESOURCE STRING sys_toolong_to_eval { str="Too long to evaluate"; } + +GLOBAL RESOURCE STRING sys_xonxoff_string {str="Xon/xoff ";} +GLOBAL RESOURCE STRING sys_header_str { str="Enter header details"; } +GLOBAL RESOURCE STRING sys_footer_str { str="Enter footer details"; } + +/* max len of next 2 strs is 9 (including the space and the brackets) */ +GLOBAL RESOURCE STRING sys_centimetres { str=" (cm)"; } +GLOBAL RESOURCE STRING sys_inches { str=" (in)"; } + +GLOBAL RESOURCE STRING sys_dev_notready { str=" Absent!"; } +GLOBAL RESOURCE STRING sys_dev_corrupt { str=" Unformatted!"; } +GLOBAL RESOURCE STRING sys_dev_unknown { str=" Unrecognised!"; } +GLOBAL RESOURCE STRING sys_dev_info { str=", %luK free"; } + +GLOBAL RESOURCE STRING sys_mtype_unknown { str="Unknown"; } +GLOBAL RESOURCE STRING sys_mtype_floppy { str="Floppy"; } +GLOBAL RESOURCE STRING sys_mtype_hard { str="Hard"; } +GLOBAL RESOURCE STRING sys_mtype_flash { str="Flash"; } +GLOBAL RESOURCE STRING sys_mtype_ram { str="Ram"; } +GLOBAL RESOURCE STRING sys_mtype_rom { str="Rom"; } +GLOBAL RESOURCE STRING sys_mtype_protected { str="Protected"; } + +/* Maximum of 14 character widths for the following 5 strings */ +GLOBAL RESOURCE STRING sys_files_tagged { str="(Tagged files)"; } +GLOBAL RESOURCE STRING sys_no_files { str="(No files)"; } +GLOBAL RESOURCE STRING sys_no_disk { str="(No disk)"; } +GLOBAL RESOURCE STRING sys_unformatted { str="(Unformatted)"; } +GLOBAL RESOURCE STRING sys_unrecognised { str="(Unrecognised)"; } + +GLOBAL RESOURCE STRING sys_sound_fail { str="Sound in use - please retry"; } + +/*********** THE ALLOWED SPECIAL KEYS FOR ACTION BUTTONS ******************/ + +/* You can translate the text, but no more than six characters each */ + +GLOBAL RESOURCE ACLIST_ARRAY sys_button_text + { + button= + { + PUSH_BUT + { + keycode=W_KEY_RETURN; + str="Enter"; + }, + PUSH_BUT + { + keycode=W_KEY_ESCAPE; + str="Esc"; + }, + PUSH_BUT + { + keycode=W_KEY_DELETE_LEFT; + str="Del"; + }, + PUSH_BUT + { + keycode=W_KEY_SPACE; + str="Space"; + }, + PUSH_BUT + { + keycode=W_KEY_UP; + str=; + }, + PUSH_BUT + { + keycode=W_KEY_DOWN; + str=; + }, + PUSH_BUT + { + keycode=W_KEY_RIGHT; + str=; + }, + PUSH_BUT + { + keycode=W_KEY_LEFT; + str=; + }, + PUSH_BUT + { + keycode=W_KEY_TAB; + str="Tab"; + }, + PUSH_BUT + { + keycode=W_KEY_MENU; + str="Menu"; + } + }; + } + + +/************************* ACTION LISTS ******************************/ + +/* Change the keycodes too, but don't lose the minus signs */ + +GLOBAL RESOURCE ACLIST_ARRAY sys_ac_no_yes + { + button = + { + PUSH_BUT + { + keycode=-'n'; + str="No"; + }, + PUSH_BUT + { + keycode='y'; + str="Yes"; + } + }; + } + +GLOBAL RESOURCE ACLIST_ARRAY sys_ac_continue + { + button = + { + PUSH_BUT + { + keycode=W_KEY_ESCAPE; + str="Continue"; + } + }; + } + +GLOBAL RESOURCE ACLIST_ARRAY sys_ac_abandon + { + button = + { + PUSH_BUT + { + keycode=W_KEY_ESCAPE; + str="Abandon"; + } + }; + } + +GLOBAL RESOURCE ACLIST_ARRAY sys_append_aclist + { + button = + { + PUSH_BUT + { + keycode=W_KEY_RETURN; + str="Append"; + } + }; + } + +/* Careful not to make the combined width of these strings much wider */ + +GLOBAL RESOURCE ACLIST_ARRAY sys_smart_dial_aclist + { + button = + { + PUSH_BUT + { + keycode=W_KEY_ESCAPE; + str="Cancel"; + }, + PUSH_BUT + { + keycode=W_KEY_MENU; + str="Free input"; + }, + PUSH_BUT + { + keycode=W_KEY_TAB; + str="Dial"; + }, + PUSH_BUT + { + keycode=W_KEY_RETURN; + str="Dial out"; + } + }; + } + +GLOBAL RESOURCE ACLIST_ARRAY sys_freedial_aclist + { + button = + { + PUSH_BUT + { + keycode=W_KEY_DELETE_LEFT; + str="Clear"; + }, + PUSH_BUT + { + keycode=W_KEY_TAB; + str="Redial"; + } + }; + } + +/************************* CHOICE LISTS *****************************/ + +GLOBAL RESOURCE MENU sys_no_yes + { + items = + { + CHOICE_ITEM { str= "No";}, + CHOICE_ITEM { str="Yes";} + }; + } + +GLOBAL RESOURCE MENU sys_offon_menu + { + items = + { + CHOICE_ITEM { str="Off";}, + CHOICE_ITEM { str= "On";} + }; + } + +GLOBAL RESOURCE MENU sys_printer_units_chlist + { + items = + { + CHOICE_ITEM { str= "Inches";}, /* matches with E_IMPERIAL */ + CHOICE_ITEM { str= "Centimetres";} /* matches with E_METRIC */ + }; + } + +GLOBAL RESOURCE MENU sys_printer_device_chlist + { + items = + { + CHOICE_ITEM { str= "Parallel";}, + CHOICE_ITEM { str= "Serial";}, + CHOICE_ITEM { str= "File";} + }; + } + +GLOBAL RESOURCE MENU sys_baud_rate_chlist + { + items = + { + CHOICE_ITEM { str= "9600";}, + CHOICE_ITEM { str= "4800";}, + CHOICE_ITEM { str= "2400";}, + CHOICE_ITEM { str= "1200";}, + CHOICE_ITEM { str= "600";}, + CHOICE_ITEM { str= "300";} + }; + } + +GLOBAL RESOURCE MENU sys_data_bits_chlist + { + items = + { + CHOICE_ITEM { str="5";}, + CHOICE_ITEM { str="6";}, + CHOICE_ITEM { str="7";}, + CHOICE_ITEM { str="8";} + }; + } + +GLOBAL RESOURCE MENU sys_stop_bits_chlist + { + items = + { + CHOICE_ITEM { str="1";}, + CHOICE_ITEM { str="2";} + }; + } + +GLOBAL RESOURCE MENU sys_parity_chlist + { + items = + { + CHOICE_ITEM { str="None";}, + CHOICE_ITEM { str="Even";}, + CHOICE_ITEM { str= "Odd";} + }; + } + +GLOBAL RESOURCE MENU sys_format_chlist + { + items = + { + CHOICE_ITEM { str="Fixed";}, + CHOICE_ITEM { str="Scientific";}, + CHOICE_ITEM { str="General";}, + CHOICE_ITEM { str="Hexadecimal";} + }; + } + +GLOBAL RESOURCE MENU sys_rad_deg + { + items = + { + CHOICE_ITEM { str= "Radians";}, + CHOICE_ITEM { str= "Degrees";} + }; + } + +/* IMPORTANT, order in next array must be same as in page_size menu below */ +/* Also, at most 10 entries allowed, and the first two cannot be altered */ +/* But change any of the others, if you wish */ +/* 1 mm is 1440/25.4 units in the dimensions used, so eg 148 mm is 8391 */ +/* so you could have {width=8391; ... for one entry (an A5 letter size) */ + +GLOBAL RESOURCE PAGE_SIZE_ARRAY sys_page_dimensions + { + page_size= + { + PAGE_SIZE {width=PAGE_WIDTH_A4; length=PAGE_LENGTH_A4;}, + PAGE_SIZE {width=PAGE_WIDTH_A4; length=PAGE_LENGTH_A4;}, + PAGE_SIZE {width=PAGE_WIDTH_EXECUTIVE; length=PAGE_LENGTH_EXECUTIVE;}, + PAGE_SIZE {width=PAGE_WIDTH_LEGAL; length=PAGE_LENGTH_LEGAL;}, + PAGE_SIZE {width=PAGE_WIDTH_LETTER; length=PAGE_LENGTH_LETTER;}, + PAGE_SIZE {width=PAGE_WIDTH_MONARCH; length=PAGE_LENGTH_MONARCH;}, + PAGE_SIZE {width=PAGE_WIDTH_DL; length=PAGE_LENGTH_DL;} + }; + } + +GLOBAL RESOURCE MENU sys_page_size + { + items= + { + CHOICE_ITEM {str="A4";}, + CHOICE_ITEM {str="Custom";}, + CHOICE_ITEM {str="Executive";}, + CHOICE_ITEM {str="Legal";}, + CHOICE_ITEM {str="Letter";}, + CHOICE_ITEM {str="Monarch";}, + CHOICE_ITEM {str="DL";} + }; + } + +GLOBAL RESOURCE MENU sys_orient + { + items= + { + CHOICE_ITEM {str="Portrait";}, + CHOICE_ITEM {str="Landscape";} + }; + } + +GLOBAL RESOURCE MENU sys_prn_pos + { + items= + { + CHOICE_ITEM {str="Normal";}, + CHOICE_ITEM {str="Superscript";}, + CHOICE_ITEM {str="Subscript";} + }; + } + +GLOBAL RESOURCE MENU sys_headfoot_align + { + items= + { + CHOICE_ITEM {str="Left";}, + CHOICE_ITEM {str="Right";}, + CHOICE_ITEM {str="Centred";}, + CHOICE_ITEM {str="Justified";}, + CHOICE_ITEM {str="Two column";}, + CHOICE_ITEM {str="Three column";} + }; + } + +GLOBAL RESOURCE MENU sys_pgno_choice + { + items= + { + CHOICE_ITEM {str="1,2,3";}, + CHOICE_ITEM {str="I,II,III";}, + CHOICE_ITEM {str="i,ii,iii";} + }; + } + + +/************************* DIALOGS ********************************/ + +GLOBAL RESOURCE DIALOG sys_error_dialog + { + flags=DLGBOX_RBUF_FILLED|DLGBOX_NO_DDP; + controls= + { + CONTROL + { + class=C_TEXTWIN; + flags=DLGBOX_ITEM_CENTRE|DLGBOX_ITEM_DEAD|DLGBOX_ITEM_UNDERLINED; + info=TXTMESS + { + flags=IN_TEXTWIN_AL_CENTRE; + }; + }, + CONTROL + { + class=C_TEXTWIN; + flags=DLGBOX_ITEM_CENTRE|DLGBOX_ITEM_DEAD; + info=TXTMESS + { + flags=IN_TEXTWIN_AL_CENTRE; + }; + }, + CONTROL + { + class=C_ACLIST; + info=ACLIST + { + rid=sys_ac_continue; + }; + } + }; + } + +GLOBAL RESOURCE DIALOG sys_query_dialog + { + flags = DLGBOX_ACTION_LIST|DLGBOX_REPORT_ACT_HORIZ; + controls= + { + CONTROL + { + class=C_TEXTWIN; + flags=DLGBOX_ITEM_CENTRE|DLGBOX_ITEM_DEAD|DLGBOX_ITEM_UNDERLINED; + info=TXTMESS + { + flags=IN_TEXTWIN_AL_CENTRE; + }; + }, + CONTROL + { + class=C_ACLIST; + info=ACLIST + { + rid=sys_ac_no_yes; + }; + } + }; + } + +GLOBAL RESOURCE DIALOG sys_printing_dialog + { + flags=DLGBOX_RBUF_FILLED; + controls= + { + CONTROL + { + class=C_TEXTWIN; + flags=DLGBOX_ITEM_CENTRE|DLGBOX_ITEM_DEAD|DLGBOX_ITEM_UNDERLINED; + info=TXTMESS + { + flags=IN_TEXTWIN_AL_CENTRE; + }; + }, + CONTROL + { + class=C_TEXTWIN; + flags=DLGBOX_ITEM_CENTRE|DLGBOX_ITEM_DEAD; + info=TXTMESS + { + flags=IN_TEXTWIN_AL_CENTRE; + }; + }, + CONTROL + { + class=C_ACLIST; + info=ACLIST + { + rid=sys_ac_abandon; + }; + } + }; + } + +GLOBAL RESOURCE DIALOG sys_set_port_dialog + { + title="Set Serial port"; + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_RBUF_FILLED; + controls= + { + CONTROL + { + class=C_CHLIST; + prompt="Baud rate"; + info=CHLIST + { + rid=sys_baud_rate_chlist; + nsel=0; + }; + }, + CONTROL + { + class=C_CHLIST; + prompt="Data bits"; + info=CHLIST + { + rid=sys_data_bits_chlist; + nsel=0; + }; + }, + CONTROL + { + class=C_CHLIST; + prompt="Stop bits"; + info=CHLIST + { + rid=sys_stop_bits_chlist; + nsel=0; + }; + }, + CONTROL + { + class=C_CHLIST; + prompt="Parity"; + info=CHLIST + { + rid=sys_parity_chlist; + nsel=0; + }; + }, + CONTROL + { + class=C_CHLIST; + prompt="Ignore parity"; + info=CHLIST + { + rid=sys_no_yes; + nsel=0; + }; + } + }; + } + +GLOBAL RESOURCE DIALOG sys_set_hshk_dialog + { + title="Set serial handshake"; + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_RBUF_FILLED; + controls= + { + CONTROL + { + class=C_CHLIST; + prompt="Xon/Xoff"; + info=CHLIST + { + rid=sys_offon_menu; + nsel=0; + }; + }, + CONTROL + { + class=C_CHLIST; + prompt="Rts/Cts"; + info=CHLIST + { + rid=sys_offon_menu; + nsel=0; + }; + }, + CONTROL + { + class=C_CHLIST; + prompt="Dsr/Dtr"; + info=CHLIST + { + rid=sys_offon_menu; + nsel=0; + }; + }, + CONTROL + { + class=C_CHLIST; + prompt="Dcd"; + info=CHLIST + { + rid=sys_offon_menu; + nsel=0; + }; + } + }; + } + +GLOBAL RESOURCE DIALOG sys_printer_config_dialog + { + title="Printer configuration"; + flags=DLGBOX_NOTIFY_ENTER; + controls= + { + CONTROL + { + class=C_CHLIST; + prompt="Printer device"; + flags=DLGBOX_ITEM_NOTIFY_CHANGED; + info=CHLIST + { + rid=sys_printer_device_chlist; + }; + }, + CONTROL + { + class=C_TEXTWIN; + prompt="Serial characteristics "; + info=TXTMESS + { + str="9600 "; + flags=IN_TEXTWIN_POPOUT; + }; + }, + CONTROL + { + class=C_TEXTWIN; + prompt="Serial handshaking "; + info=TXTMESS + { + str="Xon/Xoff Off "; + flags=IN_TEXTWIN_POPOUT; + }; + }, + CONTROL + { + flags=DLGBOX_ITEM_NEEDS_PACK|DLGBOX_ITEM_NOTIFY_CHANGED; + class=C_FNEDIT; + prompt="File:"; + info=FNEDIT { flags=IN_FNEDIT_NO_AUTOQUERY; }; + }, + CONTROL + { + class=C_CHLIST; + prompt="Units"; + info=CHLIST + { + rid=sys_printer_units_chlist; + }; + } + }; + } + +GLOBAL RESOURCE DIALOG sys_eval_dialog + { + title="Set Calculator format"; + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_RBUF_FILLED; + controls= + { + CONTROL + { + flags=DLGBOX_ITEM_NOTIFY_CHANGED; + class=C_CHLIST; + prompt="Format"; + info=CHLIST { rid=sys_format_chlist; }; + }, + CONTROL + { + class=C_NCEDIT; + /* The following line must be the longer of the 2 above strings */ + /* sys_dec_places and sys_sig_digits */ + prompt="Significant digits"; + info=NCEDIT + { + high=12; + low=0; + }; + }, + CONTROL + { + class=C_CHLIST; + prompt="Trigonometry units"; + info=CHLIST { rid=sys_rad_deg; }; + } + }; + } + +GLOBAL RESOURCE DIALOG sys_country_selector_dialog + { + title="Append country"; + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_ACTION_LIST|DLGBOX_RBUF_FILLED; + controls= + { + CONTROL + { + class=C_WLDSELWN; + prompt="Country"; + info=WLDSELWN {flags=IN_WLDSELWN_COUNTRY|IN_WLDSELWN_SETHOME; }; + }, + CONTROL + { + class=C_ACLIST; + info=ACLIST + { + rid=sys_append_aclist; + }; + } + }; + } + +GLOBAL RESOURCE CONTROL sys_smart_dial_item + { + class=C_EDWIN; + prompt=; + info=EDWIN + { + maxlen=WR_MAX_DIAL_STRING; + vulen=20; + flags=IN_EDWIN_VULEN_CHARACTERS|IN_EDWIN_NO_AUTOSELECT; + }; + } + +GLOBAL RESOURCE DIALOG sys_smart_dial_dialog + { + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_ACTION_LIST|DLGBOX_RBUF_FILLED; + controls= + { + CONTROL + { + class=C_TEXTWIN; + flags=DLGBOX_ITEM_CENTRE|DLGBOX_ITEM_DEAD|DLGBOX_ITEM_UNDERLINED; + info=TXTMESS + { + flags=IN_TEXTWIN_AL_CENTRE; + str="Dial"; + }; + }, + CONTROL + { + class=C_ACLIST; + info=ACLIST + { + rid=sys_smart_dial_aclist; + }; + } + }; + } + +GLOBAL RESOURCE DIALOG sys_freedial_dialog + { + title="Free-form dialling"; + flags = DLGBOX_NO_WAIT|DLGBOX_NO_DDP; + controls= + { + CONTROL + { + class=C_FREEDIAL; + prompt=; + }, + CONTROL + { + class=C_ACLIST; + info=ACLIST + { + rid=sys_freedial_aclist; + }; + } + }; + } + +GLOBAL RESOURCE DIALOG sys_flist_dialog + { + title="Specify filelist"; + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_RBUF_FILLED; + controls= + { + CONTROL + { + class=C_EDWIN; + prompt="Filename pattern"; + info=EDWIN + { + maxlen=P_FNAMESIZE; + vulen=18; + flags=IN_EDWIN_VULEN_CHARACTERS; + }; + }, + CONTROL + { + class=C_EDWIN; + prompt="Full path"; + info=EDWIN + { + maxlen=P_FNAMESIZE; + vulen=18; + flags=IN_EDWIN_VULEN_CHARACTERS; + }; + } + }; + } + +GLOBAL RESOURCE DIALOG sys_print_control_dl + { + title="Print setup"; + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_NOTIFY_ESCAPE; + controls= + { + CONTROL + { + class=C_TEXTWIN; + prompt="Page size"; + info=TXTMESS + { + str=""; + flags=IN_TEXTWIN_POPOUT; + }; + }, + CONTROL + { + class=C_TEXTWIN; + prompt="Margins"; + info=TXTMESS + { + str=""; + flags=IN_TEXTWIN_POPOUT; + }; + }, + CONTROL + { + class=C_TEXTWIN; + prompt="Header"; + info=TXTMESS + { + str=""; + flags=IN_TEXTWIN_POPOUT; + }; + }, + CONTROL + { + class=C_TEXTWIN; + prompt="Footer"; + info=TXTMESS + { + str=""; + flags=IN_TEXTWIN_POPOUT; + }; + }, + CONTROL + { + class=C_TEXTWIN; + prompt="Paging control"; + info=TXTMESS + { + str=""; + flags=IN_TEXTWIN_POPOUT; + }; + }, + CONTROL + { + class=C_TEXTWIN; + prompt="Printer model"; + info=TXTMESS + { + str=""; + flags=IN_TEXTWIN_POPOUT; + }; + } + }; + } + +GLOBAL RESOURCE DIALOG sys_paging_control_dl + { + title="Paging control"; + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_RBUF_FILLED; + controls= + { + CONTROL + { + class=C_NCEDIT; + prompt="Number for first page"; + info=NCEDIT + { + low=1; + high=9999; + }; + }, + CONTROL + { + class=C_CHLIST; + prompt="Allow widows/orphans"; + info=CHLIST{rid=sys_no_yes;}; + }, + CONTROL + { + class=C_CHLIST; + prompt="Page number style"; + info=CHLIST{rid=sys_pgno_choice;}; + } + }; + } + +GLOBAL RESOURCE DIALOG sys_printer_model + { + title="Set printer"; + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_RBUF_FILLED; + controls= + { + CONTROL + { + prompt="Select printer"; + flags=DLGBOX_ITEM_NOTIFY_CHANGED; + class=C_CHLIST; + info=CHLIST{}; + }, + CONTROL + { + class=C_TEXTWIN; + prompt="Default font"; + info=TXTMESS + { + flags=IN_TEXTWIN_POPOUT; + }; + } + }; + } + +GLOBAL RESOURCE DIALOG sys_margins_dl + { + title="Margins"; + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_RBUF_FILLED|DLGBOX_APPEND_UNITS_TITLE; + controls= + { + CONTROL + { + class=C_FLTEDIT; + prompt="Top"; + info=FLTEDIT + { + low=0; + high=9.99; + ndec=2; + }; + }, + CONTROL + { + class=C_FLTEDIT; + prompt="Left"; + info=FLTEDIT + { + low=0; + high=9.99; + ndec=2; + }; + }, + CONTROL + { + class=C_FLTEDIT; + prompt="Right"; + info=FLTEDIT + { + low=0; + high=9.99; + ndec=2; + }; + }, + CONTROL + { + class=C_FLTEDIT; + prompt="Bottom"; + info=FLTEDIT + { + low=0; + high=9.99; + ndec=2; + }; + } + }; + } + +GLOBAL RESOURCE DIALOG sys_headfoot_dl + { + title="*"; + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_RBUF_FILLED|DLGBOX_APPEND_UNITS_TITLE; + controls= + { + CONTROL + { + class=C_EDWIN; + prompt="Text"; + info=EDWIN + { + flags=IN_EDWIN_VULEN_CHARACTERS|IN_EDWIN_ACCEPT_TABS; + maxlen=80; + vulen=20; + }; + }, + CONTROL + { + class=C_CHLIST; + prompt="Alignment"; + info=CHLIST{rid=sys_headfoot_align;}; + }, + CONTROL + { + class=C_CHLIST; + prompt="On first page"; + info=CHLIST{rid=sys_no_yes;}; + }, + CONTROL + { + class=C_TEXTWIN; + prompt="Font"; + info=TXTMESS + { + flags=IN_TEXTWIN_POPOUT; + }; + }, + CONTROL + { + class=C_FLTEDIT; + prompt="Vertical offset"; + info=FLTEDIT + { + low=0; + high=9.99; + ndec=2; + }; + } + }; + } + +GLOBAL RESOURCE DIALOG sys_pagesize_dl + { + title="Page size"; + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_RBUF_FILLED|DLGBOX_APPEND_UNITS_TITLE; + controls= + { + CONTROL + { + class=C_CHLIST; + flags=DLGBOX_ITEM_NOTIFY_CHANGED; + prompt="Page size"; + info=CHLIST{rid=sys_page_size;}; + }, + CONTROL + { + class=C_FLTEDIT; + prompt="Width"; + info=FLTEDIT + { + low=0; + high=45; + ndec=2; + }; + }, + CONTROL + { + class=C_FLTEDIT; + prompt="Height"; + info=FLTEDIT + { + low=0; + high=45; + ndec=2; + }; + }, + CONTROL + { + class=C_CHLIST; + prompt="Orientation"; + info=CHLIST{rid=sys_orient;}; + } + }; + } + +GLOBAL RESOURCE DIALOG sys_font_dl + { + title="Font"; + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_RBUF_FILLED; + controls= + { + CONTROL + { + flags=DLGBOX_ITEM_NOTIFY_CHANGED; + class=C_CHLIST; + prompt="Font"; + info=CHLIST{}; + }, + CONTROL + { + class=C_CHLIST; + prompt="Size"; + info=CHLIST{}; + }, + CONTROL + { + class=C_CHLIST; + prompt="Underline"; + info=CHLIST{rid=sys_no_yes;}; + }, + CONTROL + { + class=C_CHLIST; + prompt="Bold"; + info=CHLIST{rid=sys_no_yes;}; + }, + CONTROL + { + class=C_CHLIST; + prompt="Italic"; + info=CHLIST{rid=sys_no_yes;}; + }, + CONTROL + { + class=C_CHLIST; + prompt="Print position"; + info=CHLIST{rid=sys_prn_pos;}; + } + }; + } + +GLOBAL RESOURCE CONTROL sys_txtmess + { + class=C_TEXTWIN; + flags=DLGBOX_ITEM_CENTRE|DLGBOX_ITEM_DEAD; + info=TXTMESS + { + flags=IN_TEXTWIN_AL_CENTRE; + }; + } + + +/************************* HELP ********************************/ + +GLOBAL RESOURCE TOPIC_ARRAY sys_help_index_data +{ +id_lst= +{ +sys_help_on_off, +sys_time_basics, +sys_help_edit, +sys_help_dialog, +sys_help_statwin, +sys_help_dialling, +sys_help_files, +sys_help_filsels, +sys_help_print +}; +} + +GLOBAL RESOURCE HELP_ARRAY sys_help_index +{ +topic="Index"; +topic_id=sys_help_index_data; +} + +GLOBAL RESOURCE HELP_ARRAY sys_help_on_help +{ +topic="About Help"; +strlst= +{ +STRING {str="To choose a topic:""then Enter";}, +STRING {str="";}, +STRING {str="Esc returns to previous screen";}, +STRING {str="Control-Esc exits";}, +STRING {str="";}, +STRING {str="Control-Help for an index";} +}; +} + +GLOBAL RESOURCE HELP_ARRAY sys_help_dialog +{ +topic="Menu/dialog tips"; +strlst= +{ +STRING {str="Use hot-keys (""-N etc) for menu options";}, +STRING {str="";}, +STRING {str="Tab often lists choices in dialogs";} +}; +} + + + +GLOBAL RESOURCE HELP_ARRAY sys_help_statwin +{ +topic="Status window"; +strlst= +{ +STRING {str="Press ""-Menu for a Status Window";}, +STRING {str="Control-Menu sets it on/off";} +}; +} + +GLOBAL RESOURCE HELP_ARRAY sys_help_dialling +{ +topic="Dialling"; +strlst= +{ +STRING {str="Find an entry then press Dial (""-Help)";}, +STRING {str="";}, +STRING {str=" marks numbers; Shift-Dial inserts a ";}, +STRING {str="";}, +STRING {str="Control-Dial "" free-form dialler";} +}; +} + +GLOBAL RESOURCE HELP_ARRAY sys_help_filsels +{ +topic="File selection"; +strlst= +{ +STRING {str="Press Tab to choose from a full list of";}, +STRING {str="files/directories:";}, +STRING {str="Typing matches files";}, +STRING {str="Shift-Letter matches directories";}, +STRING {str="Control-Letter matches disks";}, +STRING {str="";}, +STRING {str="On System screen:";}, +STRING {str="Menu now gives file/directory options;";}, +STRING {str="+- (or Shift-"")""tag/untag a file";}, +STRING {str="*/""tag/untag all";}, +STRING {str="";}, +STRING {str="In dialogs:";}, +STRING {str="""-Tab gives full path";}, +STRING {str="For quick wildcarding,";}, +STRING {str="use Control-Tab then Control-Enter";} +}; +} + +GLOBAL RESOURCE HELP_ARRAY sys_help_edit +{ +topic="Editing"; +strlst= +{ +STRING {str="Use "" to move cursor";}, +STRING {str="The Control and "" keys increase movement";}, +STRING {str="";}, +STRING {str="Shift-"" highlights text:";}, +STRING {str="Use Delete to cut, or `Copy' to copy text";}, +STRING {str="then `Insert' pastes the text back in;";}, +STRING {str="Shift-Delete deletes text without";}, +STRING {str="changing what `Insert' will next insert";}, +STRING {str="";}, +STRING {str="Quick delete methods (when no highlight):";}, +STRING {str="Shift-Delete: character forwards";}, +STRING {str="Shift-""-Delete: to end of line";}, +STRING {str="""-Delete: to beginning of line";}, +STRING {str="";}, +STRING {str="Quick highlight methods:";}, +STRING {str="Shift-Control-Home: current word";}, +STRING {str="Shift-Control-End: current paragraph";} +}; +} + +GLOBAL RESOURCE TOPIC_ARRAY sys_help_x_help +{ +id_lst= +{ +sys_help_on_help +}; +} + +GLOBAL RESOURCE HELP_ARRAY sys_help_files +{ +topic="Files"; +strlst= +{ +STRING {str="Create with `New file'";}, +STRING {str="";}, +STRING {str="Select from System screen";}, +STRING {str="";}, +STRING {str="Copy with `Save as'";} +}; +} + + +GLOBAL RESOURCE HELP_ARRAY sys_help_print +{ +topic="How to print"; +strlst= +{ +STRING {str="Set Printer Model with `Print setup'";}, +STRING {str="in Word/Agenda/Data, then use `Print'";} +}; +} + +GLOBAL RESOURCE HELP_ARRAY sys_time_basics +{ +topic="Time basics"; /* DON'T change to just "Basics" */ +strlst= +{ +STRING {str="Set `Home city', then `Time and date'";}, +STRING {str="";}, +STRING {str="Set `Summer times' on/off when they change";}, +STRING {str="";}, +STRING {str="`Formats' sets 12/24 hour clocks";} +}; +} + + +GLOBAL RESOURCE HELP_ARRAY sys_help_on_off +{ +topic="On/off"; +strlst= +{ +STRING {str="Esc turns on";}, +STRING {str="-1 turns off";} +}; +} + +GLOBAL RESOURCE TOPIC_ARRAY sys_help_x_index +{ +id_lst= +{ +sys_help_index +}; +} + +/************************* LATER ADDITIONS ********************************/ + +GLOBAL RESOURCE STRING sys_wdr_general { str="General"; } + /* Name of general printer driver */ + +GLOBAL RESOURCE STRING sys_dial_out { str="9,"; } /* 5 chars max */ +GLOBAL RESOURCE STRING sys_skipping_page { str="(skipping page %u)";} diff --git a/code/SIBOSDK/resource/sa_.rss b/code/SIBOSDK/resource/sa_.rss new file mode 100644 index 0000000..a101b88 --- /dev/null +++ b/code/SIBOSDK/resource/sa_.rss @@ -0,0 +1,1836 @@ +SYSTEM +/* +(No comment to be placed on the first line of this file!) + +SA_.RSS + +System Resource file for Series 3a + +*/ + +#include +#include +#include +#include + +/****************** THE SPECIAL CHARACTERS ************************/ + +/* leave most of these alone, but translate the NSWE */ + +RESOURCE STRING sys_special_characters { str="+-*/<,>.NSWE"; } + +/************************* STRINGS ********************************/ + +RESOURCE STRING sys_string { str="%s"; } +RESOURCE STRING sys_dimmed_msg {str="This item is not available";} +RESOURCE STRING sys_locked_msg {str="This item cannot be changed";} +RESOURCE STRING sys_busy { str="Busy"; } +RESOURCE STRING sys_scanning { str="Scanning"; } +RESOURCE STRING sys_printing_to { str="Printing to %s";} +RESOURCE STRING sys_page_is { str="(page %u)";} + +RESOURCE STRING sys_copied_prompt {str="Copied";} +RESOURCE STRING sys_copying_prompt {str="Saving as \"%s\"";} +RESOURCE STRING sys_loading_prompt {str="Loading \"%s\"";} +RESOURCE STRING sys_merging_prompt {str="Merging in \"%s\"";} +RESOURCE STRING sys_nothing_to_bring {str="Nothing to bring";} +RESOURCE STRING sys_not_found {str="Not found"; } +RESOURCE STRING sys_nothing_to_find {str="Nothing to find";} + +RESOURCE STRING sys_compress_prompt {str="Compressing \"%s\"";} +RESOURCE STRING sys_not_compressible {str="Cannot compress on Flash";} + +RESOURCE STRING sys_password_incorrect {str="Incorrect password";} +RESOURCE STRING sys_password_not_confirmed {str="Password not confirmed";} + +RESOURCE STRING sys_range_reset {str="Out of range - reset to limit";} +RESOURCE STRING sys_invalid_num {str="Number is not valid";} +RESOURCE STRING sys_invalid_margins { str="Invalid margins. Reset?"; } +RESOURCE STRING sys_invalid_char { str="Undiallable character"; } +RESOURCE STRING sys_out_of_range {str="Value out of range: %s = %s";} +/* as used in "Value out of range: Max = 20.45 */ + +RESOURCE STRING sys_edit_nchars {str="Maximum number of characters reached";} + +RESOURCE STRING sys_popout_help {str="Press Tab to change this item";} + +RESOURCE STRING sys_help_string {str="Help: %s";} + +RESOURCE STRING sys_replace_disk {str="Replace the application disk";} + +/* the prompts for a file selector and a pack selector */ +RESOURCE STRING sys_name {str="Name";} +RESOURCE STRING sys_pack {str="Disk";} + +/* part of the title line of a filelist */ +RESOURCE STRING sys_filelist_disk {str="Disk ";} + +RESOURCE STRING sys_flist_reset { str="File list reset"; } +RESOURCE STRING sys_device_memory { str="Internal"; } +RESOURCE STRING sys_path_is { str="Path is %s"; } +RESOURCE STRING sys_choose_directory { str="Choose a directory"; } +RESOURCE STRING sys_choose_filename { str="Choose a filename"; } +RESOURCE STRING sys_choose_new_directory { str="Directory already exists"; } +RESOURCE STRING sys_exists_over { str="File already exists: overwrite?"; } + +/* Next two strings have a maximum length of 5 characters each */ +RESOURCE STRING sys_max { str="Max"; } +RESOURCE STRING sys_min { str="Min"; } + +RESOURCE STRING sys_dec_places { str="Decimal places"; } +RESOURCE STRING sys_sig_digits { str="Significant digits"; } +RESOURCE STRING sys_evaldlg_title { str="Set \"Evaluate\" format"; } +RESOURCE STRING sys_nothing_to_eval { str="Nothing to evaluate"; } +RESOURCE STRING sys_toolong_to_eval { str="Too long to evaluate"; } + +RESOURCE STRING sys_xonxoff_string {str="Xon/xoff ";} +RESOURCE STRING sys_header_str { str="Enter header details"; } +RESOURCE STRING sys_footer_str { str="Enter footer details"; } + +/* max len of next 2 strs is 9 (including the space and the brackets) */ +RESOURCE STRING sys_centimetres { str=" (cm)"; } +RESOURCE STRING sys_inches { str=" (inches)"; } + +RESOURCE STRING sys_dev_notready { str=" Absent!"; } +RESOURCE STRING sys_dev_corrupt { str=" Unformatted!"; } +RESOURCE STRING sys_dev_unknown { str=" Unrecognised!"; } +RESOURCE STRING sys_dev_info { str=", %luK free"; } + +RESOURCE STRING sys_mtype_unknown { str="Unknown"; } +RESOURCE STRING sys_mtype_floppy { str="Floppy"; } +RESOURCE STRING sys_mtype_hard { str="Hard"; } +RESOURCE STRING sys_mtype_flash { str="Flash"; } +RESOURCE STRING sys_mtype_ram { str="Ram"; } +RESOURCE STRING sys_mtype_rom { str="Rom"; } +RESOURCE STRING sys_mtype_protected { str="Protected"; } + +/* Maximum of 14 character widths for the following 5 strings */ +RESOURCE STRING sys_files_tagged { str="(Tagged files)"; } +RESOURCE STRING sys_no_files { str="(No files)"; } +RESOURCE STRING sys_no_disk { str="(No disk)"; } +RESOURCE STRING sys_unformatted { str="(Unformatted)"; } +RESOURCE STRING sys_unrecognised { str="(Unrecognised)"; } + +RESOURCE STRING sys_sound_fail { str="Sound in use - please retry"; } + +/*********** THE ALLOWED SPECIAL KEYS FOR ACTION BUTTONS ******************/ + +/* You can translate the text, but no more than six characters each */ + +RESOURCE ACLIST_ARRAY sys_button_text + { + button= + { + PUSH_BUT + { + keycode=W_KEY_RETURN; + str="Enter"; + }, + PUSH_BUT + { + keycode=W_KEY_ESCAPE; + str="Esc"; + }, + PUSH_BUT + { + keycode=W_KEY_DELETE_LEFT; + str="Del"; + }, + PUSH_BUT + { + keycode=W_KEY_SPACE; + str="Space"; + }, + PUSH_BUT + { + keycode=W_KEY_UP; + str=; + }, + PUSH_BUT + { + keycode=W_KEY_DOWN; + str=; + }, + PUSH_BUT + { + keycode=W_KEY_RIGHT; + str=; + }, + PUSH_BUT + { + keycode=W_KEY_LEFT; + str=; + }, + PUSH_BUT + { + keycode=W_KEY_TAB; + str="Tab"; + }, + PUSH_BUT + { + keycode=W_KEY_MENU; + str="Menu"; + } + }; + } + + +/************************* ACTION LISTS ******************************/ + +/* Change the keycodes too, but don't lose the minus signs */ + +RESOURCE ACLIST_ARRAY sys_ac_no_yes + { + button = + { + PUSH_BUT + { + keycode=-'n'; + str="No"; + }, + PUSH_BUT + { + keycode='y'; + str="Yes"; + } + }; + } + +RESOURCE ACLIST_ARRAY sys_ac_continue + { + button = + { + PUSH_BUT + { + keycode=W_KEY_ESCAPE; + str="Continue"; + } + }; + } + +RESOURCE ACLIST_ARRAY sys_ac_abandon + { + button = + { + PUSH_BUT + { + keycode=W_KEY_ESCAPE; + str="Abandon"; + } + }; + } + +RESOURCE ACLIST_ARRAY sys_append_aclist + { + button = + { + PUSH_BUT + { + keycode=W_KEY_RETURN; + str="Append"; + } + }; + } + +/* Careful not to make the combined width of these strings much wider */ + +RESOURCE ACLIST_ARRAY sys_smart_dial_aclist + { + button = + { + PUSH_BUT + { + keycode=W_KEY_ESCAPE; + str="Cancel"; + }, + PUSH_BUT + { + keycode=W_KEY_MENU; + str="Free input"; + }, + PUSH_BUT + { + keycode=W_KEY_TAB; + str="Dial"; + }, + PUSH_BUT + { + keycode=W_KEY_RETURN; + str="Dial out"; + } + }; + } + +RESOURCE ACLIST_ARRAY sys_freedial_aclist + { + button = + { + PUSH_BUT + { + keycode=W_KEY_DELETE_LEFT; + str="Clear"; + }, + PUSH_BUT + { + keycode=W_KEY_TAB; + str="Redial"; + } + }; + } + +/************************* CHOICE LISTS *****************************/ + +RESOURCE MENU sys_no_yes + { + items = + { + CHOICE_ITEM { str= "No";}, + CHOICE_ITEM { str="Yes";} + }; + } + +RESOURCE MENU sys_offon_menu + { + items = + { + CHOICE_ITEM { str="Off";}, + CHOICE_ITEM { str= "On";} + }; + } + +RESOURCE MENU sys_printer_units_chlist + { + items = + { + CHOICE_ITEM { str= "Inches";}, /* matches with E_IMPERIAL */ + CHOICE_ITEM { str= "Centimetres";} /* matches with E_METRIC */ + }; + } + +RESOURCE MENU sys_printer_device_chlist + { + items = + { + CHOICE_ITEM { str= "Parallel";}, + CHOICE_ITEM { str= "Serial";}, + CHOICE_ITEM { str= "File";} + }; + } + +RESOURCE MENU sys_baud_rate_chlist + { + items = + { + CHOICE_ITEM { str= "19200";}, /* new for S3a */ + CHOICE_ITEM { str= "9600";}, + CHOICE_ITEM { str= "4800";}, + CHOICE_ITEM { str= "2400";}, + CHOICE_ITEM { str= "1200";}, + CHOICE_ITEM { str= "600";}, + CHOICE_ITEM { str= "300";} + }; + } + +RESOURCE MENU sys_data_bits_chlist + { + items = + { + CHOICE_ITEM { str="5";}, + CHOICE_ITEM { str="6";}, + CHOICE_ITEM { str="7";}, + CHOICE_ITEM { str="8";} + }; + } + +RESOURCE MENU sys_stop_bits_chlist + { + items = + { + CHOICE_ITEM { str="1";}, + CHOICE_ITEM { str="2";} + }; + } + +RESOURCE MENU sys_parity_chlist + { + items = + { + CHOICE_ITEM { str="None";}, + CHOICE_ITEM { str="Even";}, + CHOICE_ITEM { str= "Odd";} + }; + } + +RESOURCE MENU sys_format_chlist + { + items = + { + CHOICE_ITEM { str="Fixed";}, + CHOICE_ITEM { str="Scientific";}, + CHOICE_ITEM { str="General";}, + CHOICE_ITEM { str="Hexadecimal";} + }; + } + +RESOURCE MENU sys_rad_deg + { + items = + { + CHOICE_ITEM { str= "Radians";}, + CHOICE_ITEM { str= "Degrees";} + }; + } + +/* IMPORTANT, order in next array must be same as in page_size menu below */ +/* Also, at most 10 entries allowed, and the first two cannot be altered */ +/* But change any of the others, if you wish */ +/* 1 mm is 1440/25.4 units in the dimensions used, so eg 148 mm is 8391 */ +/* so you could have {width=8391; ... for one entry (an A5 letter size) */ + +RESOURCE PAGE_SIZE_ARRAY sys_page_dimensions + { + page_size= + { + PAGE_SIZE {width=PAGE_WIDTH_A4; length=PAGE_LENGTH_A4;}, + PAGE_SIZE {width=PAGE_WIDTH_A4; length=PAGE_LENGTH_A4;}, + PAGE_SIZE {width=PAGE_WIDTH_EXECUTIVE; length=PAGE_LENGTH_EXECUTIVE;}, + PAGE_SIZE {width=PAGE_WIDTH_LEGAL; length=PAGE_LENGTH_LEGAL;}, + PAGE_SIZE {width=PAGE_WIDTH_LETTER; length=PAGE_LENGTH_LETTER;}, + PAGE_SIZE {width=PAGE_WIDTH_MONARCH; length=PAGE_LENGTH_MONARCH;}, + PAGE_SIZE {width=PAGE_WIDTH_DL; length=PAGE_LENGTH_DL;} + }; + } + +RESOURCE MENU sys_page_size + { + items= + { + CHOICE_ITEM {str="A4";}, + CHOICE_ITEM {str="Custom";}, + CHOICE_ITEM {str="Executive";}, + CHOICE_ITEM {str="Legal";}, + CHOICE_ITEM {str="Letter";}, + CHOICE_ITEM {str="Monarch";}, + CHOICE_ITEM {str="DL";} + }; + } + +RESOURCE MENU sys_orient + { + items= + { + CHOICE_ITEM {str="Portrait";}, + CHOICE_ITEM {str="Landscape";} + }; + } + +RESOURCE MENU sys_prn_pos + { + items= + { + CHOICE_ITEM {str="Normal";}, + CHOICE_ITEM {str="Superscript";}, + CHOICE_ITEM {str="Subscript";} + }; + } + +RESOURCE MENU sys_headfoot_align + { + items= + { + CHOICE_ITEM {str="Left";}, + CHOICE_ITEM {str="Right";}, + CHOICE_ITEM {str="Centred";}, + CHOICE_ITEM {str="Justified";}, + CHOICE_ITEM {str="Two column";}, + CHOICE_ITEM {str="Three column";} + }; + } + +RESOURCE MENU sys_pgno_choice + { + items= + { + CHOICE_ITEM {str="1,2,3";}, + CHOICE_ITEM {str="I,II,III";}, + CHOICE_ITEM {str="i,ii,iii";} + }; + } + +/************************* DIALOGS ********************************/ + +RESOURCE DIALOG sys_error_dialog + { + flags=DLGBOX_RBUF_FILLED|DLGBOX_NO_DDP; + controls= + { + CONTROL + { + class=C_TEXTWIN; + flags=DLGBOX_ITEM_CENTRE|DLGBOX_ITEM_DEAD|DLGBOX_ITEM_UNDERLINED; + info=TXTMESS + { + flags=IN_TEXTWIN_AL_CENTRE; + }; + }, + CONTROL + { + class=C_TEXTWIN; + flags=DLGBOX_ITEM_CENTRE|DLGBOX_ITEM_DEAD; + info=TXTMESS + { + flags=IN_TEXTWIN_AL_CENTRE; + }; + }, + CONTROL + { + class=C_ACLIST; + info=ACLIST + { + rid=sys_ac_continue; + }; + } + }; + } + +RESOURCE DIALOG sys_query_dialog + { + flags = DLGBOX_ACTION_LIST|DLGBOX_REPORT_ACT_HORIZ; + controls= + { + CONTROL + { + class=C_TEXTWIN; + flags=DLGBOX_ITEM_CENTRE|DLGBOX_ITEM_DEAD|DLGBOX_ITEM_UNDERLINED; + info=TXTMESS + { + flags=IN_TEXTWIN_AL_CENTRE; + }; + }, + CONTROL + { + class=C_ACLIST; + info=ACLIST + { + rid=sys_ac_no_yes; + }; + } + }; + } + +RESOURCE DIALOG sys_printing_dialog + { + flags=DLGBOX_RBUF_FILLED; + controls= + { + CONTROL + { + class=C_TEXTWIN; + flags=DLGBOX_ITEM_CENTRE|DLGBOX_ITEM_DEAD|DLGBOX_ITEM_UNDERLINED; + info=TXTMESS + { + flags=IN_TEXTWIN_AL_CENTRE; + }; + }, + CONTROL + { + class=C_TEXTWIN; + flags=DLGBOX_ITEM_CENTRE|DLGBOX_ITEM_DEAD; + info=TXTMESS + { + flags=IN_TEXTWIN_AL_CENTRE; + }; + }, + CONTROL + { + class=C_ACLIST; + info=ACLIST + { + rid=sys_ac_abandon; + }; + } + }; + } + +RESOURCE DIALOG sys_set_port_dialog + { + title="Set Serial port"; + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_RBUF_FILLED; + controls= + { + CONTROL + { + class=C_CHLIST; + prompt="Baud rate"; + info=CHLIST + { + rid=sys_baud_rate_chlist; + nsel=0; + }; + }, + CONTROL + { + class=C_CHLIST; + prompt="Data bits"; + info=CHLIST + { + rid=sys_data_bits_chlist; + nsel=0; + }; + }, + CONTROL + { + class=C_CHLIST; + prompt="Stop bits"; + info=CHLIST + { + rid=sys_stop_bits_chlist; + nsel=0; + }; + }, + CONTROL + { + class=C_CHLIST; + prompt="Parity"; + info=CHLIST + { + rid=sys_parity_chlist; + nsel=0; + }; + }, + CONTROL + { + class=C_CHLIST; + prompt="Ignore parity"; + info=CHLIST + { + rid=sys_no_yes; + nsel=0; + }; + } + }; + } + +RESOURCE DIALOG sys_set_hshk_dialog + { + title="Set serial handshake"; + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_RBUF_FILLED; + controls= + { + CONTROL + { + class=C_CHLIST; + prompt="Xon/Xoff"; + info=CHLIST + { + rid=sys_offon_menu; + nsel=0; + }; + }, + CONTROL + { + class=C_CHLIST; + prompt="Rts/Cts"; + info=CHLIST + { + rid=sys_offon_menu; + nsel=0; + }; + }, + CONTROL + { + class=C_CHLIST; + prompt="Dsr/Dtr"; + info=CHLIST + { + rid=sys_offon_menu; + nsel=0; + }; + }, + CONTROL + { + class=C_CHLIST; + prompt="Dcd"; + info=CHLIST + { + rid=sys_offon_menu; + nsel=0; + }; + } + }; + } + +RESOURCE DIALOG sys_printer_config_dialog + { + title="Printer configuration"; + flags=DLGBOX_NOTIFY_ENTER; + controls= + { + CONTROL + { + class=C_CHLIST; + prompt="Printer device"; + flags=DLGBOX_ITEM_NOTIFY_CHANGED; + info=CHLIST + { + rid=sys_printer_device_chlist; + }; + }, + CONTROL + { + class=C_TEXTWIN; + prompt="Serial characteristics "; + info=TXTMESS + { + str="19200 "; /* changed for S3a */ + flags=IN_TEXTWIN_POPOUT; + }; + }, + CONTROL + { + class=C_TEXTWIN; + prompt="Serial handshaking "; + info=TXTMESS + { + str="Xon/Xoff Off "; + flags=IN_TEXTWIN_POPOUT; + }; + }, + CONTROL + { + flags=DLGBOX_ITEM_NEEDS_PACK|DLGBOX_ITEM_NOTIFY_CHANGED; + class=C_FNEDIT; + prompt="File:"; + info=FNEDIT { flags=IN_FNEDIT_NO_AUTOQUERY; }; + }, + CONTROL + { + class=C_CHLIST; + prompt="Units"; + info=CHLIST + { + rid=sys_printer_units_chlist; + }; + } + }; + } + +RESOURCE DIALOG sys_eval_dialog + { + title="Set Calculator format"; + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_RBUF_FILLED; + controls= + { + CONTROL + { + flags=DLGBOX_ITEM_NOTIFY_CHANGED; + class=C_CHLIST; + prompt="Format"; + info=CHLIST { rid=sys_format_chlist; }; + }, + CONTROL + { + class=C_NCEDIT; + /* The following line must be the wider of the 2 above strings */ + /* sys_dec_places and sys_sig_digits */ + prompt="Significant digits"; + info=NCEDIT + { + high=12; + low=0; + }; + }, + CONTROL + { + class=C_CHLIST; + prompt="Trigonometry units"; + info=CHLIST { rid=sys_rad_deg; }; + } + }; + } + +RESOURCE DIALOG sys_country_selector_dialog + { + title="Append country"; + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_ACTION_LIST|DLGBOX_RBUF_FILLED; + controls= + { + CONTROL + { + class=C_WLDSELWN; + prompt="Country"; + info=WLDSELWN {flags=IN_WLDSELWN_COUNTRY|IN_WLDSELWN_SETHOME; }; + }, + CONTROL + { + class=C_ACLIST; + info=ACLIST + { + rid=sys_append_aclist; + }; + } + }; + } + +RESOURCE CONTROL sys_smart_dial_item + { + class=C_EDWIN; + prompt=; + info=EDWIN + { + maxlen=WR_MAX_DIAL_STRING; + vulen=20; + flags=IN_EDWIN_VULEN_CHARACTERS|IN_EDWIN_NO_AUTOSELECT; + }; + } + +RESOURCE DIALOG sys_smart_dial_dialog + { + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_ACTION_LIST|DLGBOX_RBUF_FILLED; + controls= + { + CONTROL + { + class=C_TEXTWIN; + flags=DLGBOX_ITEM_CENTRE|DLGBOX_ITEM_DEAD|DLGBOX_ITEM_UNDERLINED; + info=TXTMESS + { + flags=IN_TEXTWIN_AL_CENTRE; + str="Dial"; + }; + }, + CONTROL + { + class=C_ACLIST; + info=ACLIST + { + rid=sys_smart_dial_aclist; + }; + } + }; + } + +RESOURCE DIALOG sys_freedial_dialog + { + title="Free-form dialling"; + flags = DLGBOX_NO_WAIT|DLGBOX_NO_DDP; + controls= + { + CONTROL + { + class=C_FREEDIAL; + prompt=; + }, + CONTROL + { + class=C_ACLIST; + info=ACLIST + { + rid=sys_freedial_aclist; + }; + } + }; + } + +RESOURCE DIALOG sys_flist_dialog + { + title="Specify filelist"; + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_RBUF_FILLED; + controls= + { + CONTROL + { + class=C_EDWIN; + prompt="Filename pattern"; + info=EDWIN + { + maxlen=P_FNAMESIZE; + vulen=18; + flags=IN_EDWIN_VULEN_CHARACTERS; + }; + }, + CONTROL + { + class=C_EDWIN; + prompt="Full path"; + info=EDWIN + { + maxlen=P_FNAMESIZE; + vulen=18; + flags=IN_EDWIN_VULEN_CHARACTERS; + }; + } + }; + } + +RESOURCE DIALOG sys_print_control_dl + { + title="Print setup"; + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_NOTIFY_ESCAPE; + controls= + { + CONTROL + { + class=C_TEXTWIN; + prompt="Page size"; + info=TXTMESS + { + str=""; + flags=IN_TEXTWIN_POPOUT; + }; + }, + CONTROL + { + class=C_TEXTWIN; + prompt="Margins"; + info=TXTMESS + { + str=""; + flags=IN_TEXTWIN_POPOUT; + }; + }, + CONTROL + { + class=C_TEXTWIN; + prompt="Header"; + info=TXTMESS + { + str=""; + flags=IN_TEXTWIN_POPOUT; + }; + }, + CONTROL + { + class=C_TEXTWIN; + prompt="Footer"; + info=TXTMESS + { + str=""; + flags=IN_TEXTWIN_POPOUT; + }; + }, + CONTROL + { + class=C_TEXTWIN; + prompt="Paging control"; + info=TXTMESS + { + str=""; + flags=IN_TEXTWIN_POPOUT; + }; + }, + CONTROL + { + class=C_TEXTWIN; + prompt="Printer model"; + info=TXTMESS + { + str=""; + flags=IN_TEXTWIN_POPOUT; + }; + } + }; + } + +RESOURCE DIALOG sys_paging_control_dl + { + title="Paging control"; + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_RBUF_FILLED; + controls= + { + CONTROL + { + class=C_NCEDIT; + prompt="Number for first page"; + info=NCEDIT + { + low=1; + high=9999; + }; + }, + CONTROL + { + class=C_CHLIST; + prompt="Allow widows/orphans"; + info=CHLIST{rid=sys_no_yes;}; + }, + CONTROL + { + class=C_CHLIST; + prompt="Page number style"; + info=CHLIST{rid=sys_pgno_choice;}; + } + }; + } + +RESOURCE DIALOG sys_printer_model + { + title="Set printer"; + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_RBUF_FILLED; + controls= + { + CONTROL + { + prompt="Select printer"; + flags=DLGBOX_ITEM_NOTIFY_CHANGED; + class=C_CHLIST; + info=CHLIST{}; + }, + CONTROL + { + class=C_TEXTWIN; + prompt="Default font"; + info=TXTMESS + { + flags=IN_TEXTWIN_POPOUT; + }; + } + }; + } + +RESOURCE DIALOG sys_margins_dl + { + title="Margins"; + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_RBUF_FILLED|DLGBOX_APPEND_UNITS_TITLE; + controls= + { + CONTROL + { + class=C_FLTEDIT; + prompt="Top"; + info=FLTEDIT + { + low=0; + high=9.99; + ndec=2; + }; + }, + CONTROL + { + class=C_FLTEDIT; + prompt="Left"; + info=FLTEDIT + { + low=0; + high=9.99; + ndec=2; + }; + }, + CONTROL + { + class=C_FLTEDIT; + prompt="Right"; + info=FLTEDIT + { + low=0; + high=9.99; + ndec=2; + }; + }, + CONTROL + { + class=C_FLTEDIT; + prompt="Bottom"; + info=FLTEDIT + { + low=0; + high=9.99; + ndec=2; + }; + } + }; + } + +RESOURCE DIALOG sys_headfoot_dl + { + title="*"; + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_RBUF_FILLED|DLGBOX_APPEND_UNITS_TITLE; + controls= + { + CONTROL + { + class=C_EDWIN; + prompt="Text"; + info=EDWIN + { + flags=IN_EDWIN_VULEN_CHARACTERS|IN_EDWIN_ACCEPT_TABS; + maxlen=80; + vulen=20; + }; + }, + CONTROL + { + class=C_CHLIST; + prompt="Alignment"; + info=CHLIST{rid=sys_headfoot_align;}; + }, + CONTROL + { + class=C_CHLIST; + prompt="On first page"; + info=CHLIST{rid=sys_no_yes;}; + }, + CONTROL + { + class=C_TEXTWIN; + prompt="Font"; + info=TXTMESS + { + flags=IN_TEXTWIN_POPOUT; + }; + }, + CONTROL + { + class=C_FLTEDIT; + prompt="Vertical offset"; + info=FLTEDIT + { + low=0; + high=9.99; + ndec=2; + }; + } + }; + } + +RESOURCE DIALOG sys_pagesize_dl + { + title="Page size"; + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_RBUF_FILLED|DLGBOX_APPEND_UNITS_TITLE; + controls= + { + CONTROL + { + class=C_CHLIST; + flags=DLGBOX_ITEM_NOTIFY_CHANGED; + prompt="Page size"; + info=CHLIST{rid=sys_page_size;}; + }, + CONTROL + { + class=C_FLTEDIT; + prompt="Width"; + info=FLTEDIT + { + low=1; + high=45; + ndec=2; + }; + }, + CONTROL + { + class=C_FLTEDIT; + prompt="Height"; + info=FLTEDIT + { + low=1; + high=45; + ndec=2; + }; + }, + CONTROL + { + class=C_CHLIST; + prompt="Orientation"; + info=CHLIST{rid=sys_orient;}; + } + }; + } + +RESOURCE DIALOG sys_font_dl + { + title="Font"; + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_RBUF_FILLED; + controls= + { + CONTROL + { + flags=DLGBOX_ITEM_NOTIFY_CHANGED; + class=C_CHLIST; + prompt="Font"; + info=CHLIST{}; + }, + CONTROL + { + class=C_CHLIST; + prompt="Size"; + info=CHLIST{}; + }, + CONTROL + { + class=C_CHLIST; + prompt="Underline"; + info=CHLIST{rid=sys_no_yes;}; + }, + CONTROL + { + class=C_CHLIST; + prompt="Bold"; + info=CHLIST{rid=sys_no_yes;}; + }, + CONTROL + { + class=C_CHLIST; + prompt="Italic"; + info=CHLIST{rid=sys_no_yes;}; + }, + CONTROL + { + class=C_CHLIST; + prompt="Print position"; + info=CHLIST{rid=sys_prn_pos;}; + } + }; + } + +RESOURCE CONTROL sys_txtmess + { + class=C_TEXTWIN; + flags=DLGBOX_ITEM_CENTRE|DLGBOX_ITEM_DEAD; + info=TXTMESS + { + flags=IN_TEXTWIN_AL_CENTRE; + }; + } + +/************************* HELP ********************************/ + +#define ARROWS + +RESOURCE TOPIC_ARRAY sys_help_index_data +{ +id_lst= +{ +sys_help_on_off, +sys_time_basics, +sys_help_edit, +sys_help_dialog, +sys_help_statwin, +sys_help_dialling, +sys_help_files, +sys_help_filsels, +sys_help_evaluate, +sys_help_print, +sys_help_in_use, +sys_help_no_sys_mem +}; +} + +RESOURCE HELP_ARRAY sys_help_index +{ +topic="Index"; +topic_id=sys_help_index_data; +} + +RESOURCE HELP_ARRAY sys_help_on_help +{ +topic="About Help"; +strlst= +{ +STRING {str="To choose a topic:""then Enter";}, +STRING {str="";}, +STRING {str="Esc returns to previous Help screen";}, +STRING {str="Control-Esc exits Help";}, +STRING {str="";}, +STRING {str="Control-Help for an index";}, +STRING {str="(works from main application screen)";} +}; +} + +RESOURCE HELP_ARRAY sys_help_dialog +{ +topic="Menu/dialog tips"; +strlst= +{ +STRING {str="Press Menu key to see a menu.";}, +STRING {str="Use "ARROWS" to choose the option,";}, +STRING {str="then press Enter.";}, +STRING {str="";}, +STRING {str="Hot-keys (""-N etc) access";}, +STRING {str="menu options directly";}, +STRING {str="";}, +STRING {str="Tab often lists choices in dialogs";} +}; +} + +RESOURCE HELP_ARRAY sys_help_statwin +{ +topic="Screen display"; +strlst= +{ +STRING {str="Press "" to switch";}, +STRING {str="between an application's screens";}, +STRING {str="";}, +STRING {str="`Zoom in/out' to change character size";}, +STRING {str="";}, +STRING {str="Press ""-Menu for a Status Window";}, +STRING {str="Control-Menu may set it large/small/off";}, +STRING {str="(depending on the application)";} +}; +} + +RESOURCE HELP_ARRAY sys_help_dialling +{ +topic="Dialling"; +strlst= +{ +STRING {str="Find an entry in Data/Agenda,";}, +STRING {str="then press Dial (""-Help)";}, +STRING {str="";}, +STRING {str=" marks numbers; Shift-Dial inserts a ";}, +STRING {str="";}, +STRING {str="Control-Dial for a free-form dialler";} +}; +} + +RESOURCE HELP_ARRAY sys_help_filsels +{ +topic="File selection"; +strlst= +{ +STRING {str="Press Tab in dialogs to choose from a";}, +STRING {str="full list of files/directories:";}, +STRING {str="Typing matches with filenames";}, +STRING {str="Shift+letter matches directories";}, +STRING {str="Control+letter matches disks";}, +STRING {str="";}, +STRING {str="Press Tab on System screen:";}, +STRING {str="Menu then gives file/directory options;";}, +STRING {str="+- (or Shift-"")""tag/untag a file";}, +STRING {str="*/""tag/untag all";}, +STRING {str="";}, +STRING {str="In dialogs:";}, +STRING {str="-Tab gives full path";}, +STRING {str="To select a wildcard filespec in a";}, +STRING {str="dialog, use Control-Tab, type the";}, +STRING {str="filespec, then Control-Enter";} +}; +} + +RESOURCE HELP_ARRAY sys_help_edit +{ +topic="Editing"; +strlst= +{ +STRING {str="Use "" to move cursor";}, +STRING {str="Control and "" keys increase movement";}, +STRING {str="";}, +STRING {str="Shift-"" highlights text:";}, +STRING {str="Use Delete to cut to the clipboard (or";}, +STRING {str="`Copy' to copy), then `Insert' to";}, +STRING {str="paste the text back in;";}, +STRING {str="Shift-Delete deletes text without";}, +STRING {str="changing the clipboard";}, +STRING {str="";}, +STRING {str="Use `Bring' options to copy text";}, +STRING {str="highlighted in a different application";}, +STRING {str="";}, +STRING {str="Quick delete methods (when no highlight)";}, +STRING {str="Shift-Delete: character forwards";}, +STRING {str="Shift-""-Delete: to end of line";}, +STRING {str="-Delete: to beginning of line";}, +STRING {str="";}, +STRING {str="Quick highlight methods";}, +STRING {str="Shift-Control-Home: current word";}, +STRING {str="Shift-Control-End: current paragraph";} +}; +} + +RESOURCE TOPIC_ARRAY sys_help_x_help +{ +id_lst= +{ +sys_help_on_help +}; +} + +RESOURCE HELP_ARRAY sys_help_files +{ +topic="Files"; +strlst= +{ +STRING {str="Create files with `New file'";}, +STRING {str="";}, +STRING {str="Copy files with `Copy file', but use";}, +STRING {str="`Save as' for Data and Agenda files";}, +STRING {str="";}, +STRING {str="To open: use `Open file', or highlight";}, +STRING {str="and Enter on System screen";}, +STRING {str="";}, +STRING {str="To delete: exit file, highlight on";}, +STRING {str="System screen and then `Delete file'";}, +STRING {str="";}, +STRING {str="To rename file: `Rename file' on";}, +STRING {str="System screen";}, +STRING {str="";}, +STRING {str="`Backup files' and `Restore files'";}, +STRING {str="on System screen";}, +STRING {str="";}, +STRING {str="`Merge in', `Compress file', `Save'";}, +STRING {str="and `Revert' in relevant applications";} +}; +} + +RESOURCE HELP_ARRAY sys_help_print +{ +topic="Printing/print preview"; +strlst= +{ +STRING {str="In applications which can Print, first";}, +STRING {str="use `Print setup' to set `Printer Model'";}, +STRING {str="";}, +STRING {str="Use `Print preview' to see a preview";}, +STRING {str="with its own menu of options. (You";}, +STRING {str="don't have to wait for the preview";}, +STRING {str="to finish calculating: Esc cancels, etc).";}, +STRING {str="Print preview's menu includes `Print'";}, +STRING {str="";}, +STRING {str="Use %D and %T in headers and footers";}, +STRING {str="(part of `Print setup') to print the";}, +STRING {str="date and time automatically.";}, +STRING {str="%Finserts the filename;";}, +STRING {str="%Pthe page number;";}, +STRING {str="%%a%character.";}, +STRING {str="(In Word or Sheet, you can use %M, eg";}, +STRING {str="`Page %P of %M', for eg `Page 1 of 6')";} +}; +} + +RESOURCE HELP_ARRAY sys_time_basics +{ +topic="Time basics"; +strlst= +{ +STRING {str="In `Time', set `Home city',";}, +STRING {str="then set `Time and date'";}, +STRING {str="";}, +STRING {str="Set `Summer times' on/off when";}, +STRING {str="they change";}, +STRING {str="";}, +STRING {str="`Formats' to set 12/24 hour clocks";} +}; +} + +RESOURCE HELP_ARRAY sys_help_on_off +{ +topic="On/off"; +strlst= +{ +STRING {str="Esc (or an application button) turns on";}, +STRING {str="-1 turns off";} +}; +} + +RESOURCE TOPIC_ARRAY sys_help_x_index +{ +id_lst= +{ +sys_help_index +}; +} + +/************************* LATER ADDITIONS ********************************/ + +/* Name of general printer driver */ +RESOURCE STRING sys_wdr_general { str="General"; } + +RESOURCE STRING sys_dial_out { str="9,"; } /* 5 chars max */ +RESOURCE STRING sys_skipping_page { str="(skipping page %u)";} + +/************************* NEW FOR Series 3a *****************************/ + +/* TTT: This file is entirely new for the S3a. +You must translate EVERY text string, accelerator etc in this +file (except those marked "Do not translate", of course) - not just +those things which are marked with TTT */ + + +/* TTT: Only used by developers */ +RESOURCE STRING sys_debugging_num_cells {str="Diagnostics: %d (%u)";} + +/********* for Calendar Window in Agenda **********/ + +/* TTT: eg "Calendar 1998" or "Calendar 1993-1994" */ +RESOURCE STRING sys_calendar {str="Calendar %Y";} + +/*********************** FOR PRINT PREVIEW ******************************/ +/* TTT: "Print preview" option in Word, Agenda, Sheet... uses these: */ +RESOURCE STRING sys_page {str="page";} +RESOURCE STRING sys_pages {str="pages";} +RESOURCE STRING sys_preview_busy {str="Busy, cannot print yet";} +RESOURCE STRING sys_display_margins {str="Show margins";} +RESOURCE STRING sys_hide_margins {str="Hide margins";} + +RESOURCE STRING sys_opening_prompt {str="Opening \"%s\"";} + +/* TTT: NB "Print preview" is a standard WP term... if every Wp in your +country uses one term for this, you must use it too */ +RESOURCE STRING sys_print_preview {str="Print preview";} + +/* TTT length of longest in sys_preview_margins_chlist + length of longest +in sys_preview_options_chlist must be less than 50 */ +RESOURCE MENU sys_preview_margins_chlist + { + items= + { + CHOICE_ITEM {str="Margins off";}, + CHOICE_ITEM {str="Margins on";} + }; + } + +RESOURCE MENU sys_preview_options_chlist + { + items= + { + CHOICE_ITEM {str="Facing pages";}, + CHOICE_ITEM {str="1 page";}, + CHOICE_ITEM {str="2 pages";}, + CHOICE_ITEM {str="3 pages";}, + CHOICE_ITEM {str="4 pages";} + }; + } + +RESOURCE DIALOG sys_preview_options_dialog + { + title="Display"; + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_RBUF_FILLED|DLGBOX_NO_DDP; + controls= + { + CONTROL + { + class=C_CHLIST; + prompt=""; + info=CHLIST{rid=sys_preview_options_chlist;}; + } + }; + } + +RESOURCE DIALOG sys_preview_jump_dialog + { + title="Jump to page"; + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_RBUF_FILLED|DLGBOX_NO_DDP; + controls= + { + CONTROL + { + class=C_NCEDIT; + prompt="Page number"; + info=NCEDIT + { + low=1; + high=9999; + }; + } + }; + } + +RESOURCE WSERV_INFO sys_preview_acc + { + menbar_id=sys_preview_menubar; + first_com=O_PVC_PREVIEW_PRINT; + accel= + { + 'p', /* Print */ + 'm', /* Margins */ + 'd', /* Pages to display */ + 'j', /* Jump to page */ + '*' /* Exit preview */ + }; + } + +RESOURCE MENU_BAR sys_preview_menubar + { + items = + { + MENU_BAR_ITEM + { + menu_id=sys_preview_menu; + mb_item="Preview"; + } + }; + } + +RESOURCE MENU sys_preview_menu + { + items = + { + MENU_ITEM + { + com_id=O_PVC_PREVIEW_PRINT; + mn_item="Print"; + }, + MENU_ITEM + { + com_id=O_PVC_PREVIEW_MARGINS; +/* TTT: use whichever's the longer: "Show margins" or "Hide margins" */ + mn_item="Show margins"; + }, + MENU_ITEM + { + com_id=O_PVC_PREVIEW_OPTIONS; + mn_item="Pages to display"; + }, + MENU_ITEM + { + com_id=O_PVC_PREVIEW_JUMP|BREAK_LINE_FOLLOWS; + mn_item="Jump to page"; + }, + MENU_ITEM + { + com_id=O_PVC_PREVIEW_EXIT; + mn_item="Exit preview"; + } + }; + } + +RESOURCE MENU sys_printer_devices + { + items = + { + CHOICE_ITEM { str= "Parallel";}, + CHOICE_ITEM { str= "Serial";}, + CHOICE_ITEM { str= "File";}, + CHOICE_ITEM { str= "Fax";} + }; + } + +RESOURCE CONTROL sys_print_control_device + { + class=C_TEXTWIN; +/* TTT: You'll see this on the bottom of the Print Setup dialog +in Word, Agenda... */ + prompt="Printer device"; + info=TXTMESS + { + str=""; + flags=IN_TEXTWIN_POPOUT; + }; + } + +RESOURCE CONTROL sys_print_preview_settings + { +/* TTT: You'll see this on the bottom of the Printer configuration dialog +in the Shell */ + class=C_TEXTWIN; + prompt="Print preview"; + info=TXTMESS + { + str="Facing pages,Margins off"; /* TTT widest possible */ + flags=IN_TEXTWIN_POPOUT; + }; + } + +RESOURCE DIALOG sys_preview_settings_dl + { + title="Preview settings"; + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_RBUF_FILLED; + controls= + { + CONTROL + { + class=C_CHLIST; + prompt="Display"; + info=CHLIST{rid=sys_preview_options_chlist;}; + }, + CONTROL + { + class=C_CHLIST; + prompt="Margins"; + info=CHLIST{rid=sys_offon_menu;}; + } + }; + } + +RESOURCE MENU sys_standard_sounds + { + items= + { +/* TTT: Built-in sounds, when you're setting an alarm in Time */ + CHOICE_ITEM {str="Rings";}, + CHOICE_ITEM {str="Chimes";}, + CHOICE_ITEM {str="Fanfare";}, + CHOICE_ITEM {str="Soft bells";}, + CHOICE_ITEM {str="Church bell";} + }; + } + +/* TTT: do not translate */ +RESOURCE STRING sys_alarm_standard_name {str="SYS$AL01";} +/* TTT: The "silent" sound, when setting an alarm */ +RESOURCE STRING sys_silent_alarm {str="Silent";} +/* TTT: If you try to play a sound, but sound is disabled... */ +RESOURCE STRING sys_sound_disabled {str="Sound disabled";} +/* TTT: do not translate the next one */ +RESOURCE STRING sys_word_rom { str="ROM::WORD.APP"; } +/* TTT: the user has refused to replace an SSD */ +RESOURCE STRING sys_restart_from_sys { str="Press Esc to exit application"; } + +/* TTT: when creating a new file: eg gives "Myfile" created +You can change these around if you like, eg we could've done the English +as str="Created \"%s\"" to give Created "Myfile" */ +RESOURCE STRING srt_file_created { str="\"%s\" created"; } +RESOURCE STRING srt_file_opened { str="\"%s\" opened"; } +RESOURCE STRING srt_file_saved { str="\"%s\" saved"; } +RESOURCE STRING srt_file_compressed { str="\"%s\" compressed"; } +RESOURCE STRING srt_file_merged { str="\"%s\" merged in"; } +RESOURCE STRING sys_saving_prompt {str="Saving \"%s\"";} +RESOURCE STRING sys_reloading_prompt {str="Reopening \"%s\"";} +RESOURCE STRING sys_converting_prompt {str="Converting \"%s\"";} + +/* TTT: When we refuse to save the file, because it hasn't changed */ +RESOURCE STRING sys_not_changed {str="Not changed";} +/* TTT: When you're exiting, but it failed to save the file for some reason */ +RESOURCE STRING sys_confirm_continue {str="Not saved, continue anyway?";} +/* TTT: When you're using the "Exit, lose changes" option: */ +RESOURCE STRING sys_confirm_change_loss {str="Confirm the loss of all changes";} +/* TTT: used with the previous two strings */ +RESOURCE STRING sys_losing_changes {str="(`Yes' discards all changes)";} +RESOURCE STRING sys_nothing_to_print {str="Nothing to print";} +RESOURCE STRING sys_nothing_to_insert {str="Nothing to insert";} +RESOURCE STRING sys_nothing_to_copy {str="Nothing to copy";} +/* TTT: preferably use the same word as the "Revert" menu option */ +RESOURCE STRING sys_revert_to_saved {str="Revert to saved?";} + +/* TTT: For use in menus (hotkeys) */ +RESOURCE STRING sys_shift_key_name {str="Shift";} + +/* TTT: When you use "Current country only" (or diamond key) World App... */ +RESOURCE STRING srt_space_only { str=" (only)"; } + +RESOURCE STRING sys_change_password {str="Change password";} + +RESOURCE DIALOG sys_set_password_dl + { + title = "Set password"; + flags=DLGBOX_NOTIFY_ENTER; + controls= + { + CONTROL + { + class=C_XEDIT; + prompt="Enter password"; + }, + CONTROL + { + class=C_XEDIT; + prompt="Confirm password"; + } + }; + } + +RESOURCE DIALOG sys_get_password_dl + { + title = "Password protected"; + flags=DLGBOX_NOTIFY_ENTER; + controls= + { + CONTROL + { + class=C_XEDIT; + prompt="Enter password"; + } + }; + } + +/* TTT Extra help - translate this! */ +/* BUT DON'T MAKE THE TEXT WIDER THAN WILL FIT ON COMPATIBILITY MODE SCREENS +(BEAR IN MIND THAT THIS HELP IS AVAILABLE TO COMPATIBILITY MODE APP) */ + +RESOURCE HELP_ARRAY sys_help_evaluate +{ +topic="Calculations (`Evaluate')"; +strlst= +{ +STRING {str="Type a calculation in Data/Word/Agenda";}, +STRING {str="(without `=' or spaces),";}, +STRING {str="then `Evaluate' for result";} +}; +} + +RESOURCE HELP_ARRAY sys_help_memo +{ +topic="Memo editor"; +strlst= +{ +STRING {str="This is like the Word Processor without";}, +STRING {str="a `File' menu. Use `Edit memo' in the Agenda";}, +STRING {str="to create a memo";}, +STRING {str="";}, +STRING {str="Agenda memos can be up to 4K long. One set of";}, +STRING {str="styles is kept for all memos in an agenda file";}, +STRING {str="";}, +STRING {str="Use `Password' to make a memo secure";}, +STRING {str="and use it again to remove or change the password";}, +STRING {str="";}, +STRING {str="Use `Exit' when you've finished the memo";}, +STRING {str="";}, +STRING {str="To delete a memo edit it, delete all text";}, +STRING {str="(`Highlight all text' then the Delete key) and `Exit'";} +}; +} + +RESOURCE HELP_ARRAY sys_help_in_use +{ +topic="File or device in use"; /* TTT copy this from the software please */ +strlst= +{ +STRING {str="You will see this message if you try to";}, +STRING {str="copy, delete or rename a file which is";}, +STRING {str="open (ie in bold on the System screen).";}, +STRING {str="Exit the file first.";}, +STRING {str="";}, +STRING {str="You will also see it if you try";}, +STRING {str="to use, at the same time, two of:";}, +STRING {str="`Remote link' in the System screen";}, +STRING {str="3Link's Comms application";}, +STRING {str="Printing to a serial port printer";} +}; +} + +RESOURCE HELP_ARRAY sys_help_no_sys_mem +{ +topic="No system memory"; /* TTT copy this from the software please */ +strlst= +{ +STRING {str="This message usually means all of your";}, +STRING {str="internal memory has been used up.";}, +STRING {str="Exit some open files, or delete";}, +STRING {str="unwanted files from the `Internal'";}, +STRING {str="disk, to free some more memory";}, +STRING {str="";}, +STRING {str="You may also see this message if a Word";}, +STRING {str="or Sheet file reaches its maximum size.";}, +STRING {str="In this case internal memory is";}, +STRING {str="probably NOT full - the message means the";}, +STRING {str="application has reached its memory limit";}, +STRING {str="";}, +STRING {str="(If an agenda has repeating entries,";}, +STRING {str="`Find' and `Print preview' may also";}, +STRING {str="temporarily cause the Agenda to reach";}, +STRING {str="its memory limit and display this message)";} +}; +} + +RESOURCE HELP_ARRAY sys_help_calendar +{ +topic="Calendars"; +strlst= +{ +STRING {str="Whenever you are entering a date in a dialog, you";}, +STRING {str="can press Tab to display a one month calendar";}, +STRING {str="";}, +STRING {str="Shift-Tab (or a second Tab) gives a three month calendar";}, +STRING {str="Control-Tab (or a third Tab) gives a 12 month calendar";}, +STRING {str="";}, +STRING {str="In the calendars:";}, +STRING {str=""ARROWS" move the cursor around the screen";}, +STRING {str="Psion-"" move a screen at a time";}, +STRING {str="";}, +STRING {str="Shift-"" (or <>) move one day at a time";}, +STRING {str="Shift-"" move by weeks";}, +STRING {str="Control-"" move by months";}, +STRING {str="Control-"" move by years";}, +STRING {str="";}, +STRING {str="Space moves to today";} +}; +} diff --git a/code/SIBOSDK/resource/sc_.rss b/code/SIBOSDK/resource/sc_.rss new file mode 100644 index 0000000..b47a5d4 --- /dev/null +++ b/code/SIBOSDK/resource/sc_.rss @@ -0,0 +1,2012 @@ +SYSTEM +/* +(No comment to be placed on the first line of this file!) + +SC_.RSS + +System Resource file for Series 3c + +*/ + +#include +#include "hwim.rh" +#include +#include "symbols.h" + +STRUCT KEYPAIR + { + BYTE latin; /* Latin character value */ + BYTE cyril; /* Cyrillic character value */ + } + +STRUCT KEYLIST + { + STRUCT list[]; + } + +#define ARROWS4 + +/****************** THE SPECIAL CHARACTERS ************************/ +/* The first four characters are used by the file selector to tag one, +untag one, tag all & untag all. The next four are the "nudge" keys used by +most numeric/date editors. (Two down, two up.) Next is the keycode used in +EDWIN.C to indicate a soft or hard hyphen. NSWE are the compass points used +by the Lat-Long editor. These are followed by the degree symbol used in the +same editor. Next is the bullet symbol used by Help and by the Agenda. +The last two symbols were added in September 1995 to support code pages +other than 850 (esp. 1251 for Russia!). See #define H_SC_TPLUS et seq. +in SYMBOLS.H */ + +/* TTT Leave most of these alone, but translate the NSWE */ + +RESOURCE STRING sys_special_characters { str="+-*/<,>.NSWEøþ"; } + +/************************* STRINGS ********************************/ + +RESOURCE STRING sys_string { str="%s"; } +RESOURCE STRING sys_dimmed_msg {str="This item is not available";} +RESOURCE STRING sys_locked_msg {str="This item cannot be changed";} +RESOURCE STRING sys_busy { str="Busy"; } +RESOURCE STRING sys_scanning { str="Scanning"; } +RESOURCE STRING sys_printing_to { str="Printing to %s";} +RESOURCE STRING sys_page_is { str="(page %u)";} + +RESOURCE STRING sys_copied_prompt {str="Copied";} +RESOURCE STRING sys_copying_prompt {str="Saving as \"%s\"";} +RESOURCE STRING sys_loading_prompt {str="Loading \"%s\"";} +RESOURCE STRING sys_merging_prompt {str="Merging in \"%s\"";} +RESOURCE STRING sys_nothing_to_bring {str="Nothing to bring";} +RESOURCE STRING sys_not_found {str="Not found"; } +RESOURCE STRING sys_nothing_to_find {str="Nothing to find";} + +RESOURCE STRING sys_compress_prompt {str="Compressing \"%s\"";} +RESOURCE STRING sys_not_compressible {str="Cannot compress on Flash";} + +RESOURCE STRING sys_password_incorrect {str="Incorrect password";} +RESOURCE STRING sys_password_not_confirmed {str="Password not confirmed";} + +RESOURCE STRING sys_range_reset {str="Out of range - reset to limit";} +RESOURCE STRING sys_invalid_num {str="Number is not valid";} +RESOURCE STRING sys_invalid_margins { str="Invalid margins. Reset?"; } +RESOURCE STRING sys_invalid_char { str="Undiallable character"; } +RESOURCE STRING sys_out_of_range {str="Value out of range: %s = %s";} +/* as used in "Value out of range: Max = 20.45 */ + +RESOURCE STRING sys_edit_nchars {str="Maximum number of characters reached";} + +RESOURCE STRING sys_popout_help {str="Press Tab to change this item";} + +RESOURCE STRING sys_help_string {str="Help: %s";} + +RESOURCE STRING sys_replace_disk {str="Replace the application disk";} + +/* the prompts for a file selector and a pack selector */ +RESOURCE STRING sys_name {str="Name";} +RESOURCE STRING sys_pack {str="Disk";} + +/* part of the title line of a filelist */ +RESOURCE STRING sys_filelist_disk {str="Disk ";} + +RESOURCE STRING sys_flist_reset { str="File list reset"; } +RESOURCE STRING sys_device_memory { str="Internal"; } +RESOURCE STRING sys_path_is { str="Path is %s"; } +RESOURCE STRING sys_choose_directory { str="Choose a directory"; } +RESOURCE STRING sys_choose_filename { str="Choose a filename"; } +RESOURCE STRING sys_choose_new_directory { str="Directory already exists"; } +RESOURCE STRING sys_exists_over { str="File already exists: overwrite?"; } + +/* Next two strings have a maximum length of 5 characters each */ +RESOURCE STRING sys_max { str="Max"; } +RESOURCE STRING sys_min { str="Min"; } + +RESOURCE STRING sys_dec_places { str="Decimal places"; } +RESOURCE STRING sys_sig_digits { str="Significant digits"; } +RESOURCE STRING sys_evaldlg_title { str="Set \"Evaluate\" format"; } +RESOURCE STRING sys_nothing_to_eval { str="Nothing to evaluate"; } +RESOURCE STRING sys_toolong_to_eval { str="Too long to evaluate"; } + +RESOURCE STRING sys_xonxoff_string {str="XON/XOFF ";} +RESOURCE STRING sys_header_str { str="Enter header details"; } +RESOURCE STRING sys_footer_str { str="Enter footer details"; } + +/* max len of next 2 strs is 9 (including the space and the brackets) */ +RESOURCE STRING sys_centimetres { str=" (cm)"; } +RESOURCE STRING sys_inches { str=" (inches)"; } + +RESOURCE STRING sys_dev_notready { str=" Absent!"; } +RESOURCE STRING sys_dev_corrupt { str=" Unformatted!"; } +RESOURCE STRING sys_dev_unknown { str=" Unrecognised!"; } +RESOURCE STRING sys_dev_info { str=", %luK free"; } + +RESOURCE STRING sys_mtype_unknown { str="Unknown"; } +RESOURCE STRING sys_mtype_floppy { str="Floppy"; } +RESOURCE STRING sys_mtype_hard { str="Hard"; } +RESOURCE STRING sys_mtype_flash { str="Flash"; } +RESOURCE STRING sys_mtype_ram { str="Ram"; } +RESOURCE STRING sys_mtype_rom { str="Rom"; } +RESOURCE STRING sys_mtype_protected { str="Protected"; } +/* Maximum of 14 character widths for the following 5 strings */ +RESOURCE STRING sys_files_tagged { str="(Tagged files)"; } +RESOURCE STRING sys_no_files { str="(No files)"; } +RESOURCE STRING sys_no_disk { str="(No disk)"; } +RESOURCE STRING sys_unformatted { str="(Unformatted)"; } +RESOURCE STRING sys_unrecognised { str="(Unrecognised)"; } + +RESOURCE STRING sys_sound_fail { str="Sound in use - please retry"; } + +/*********** THE ALLOWED SPECIAL KEYS FOR ACTION BUTTONS ******************/ + +/* You can translate the text, but no more than six characters each */ + +RESOURCE ACLIST_ARRAY sys_button_text + { + button= + { + PUSH_BUT + { + keycode=W_KEY_RETURN; + str="Enter"; + }, + PUSH_BUT + { + keycode=W_KEY_ESCAPE; + str="Esc"; + }, + PUSH_BUT + { + keycode=W_KEY_DELETE_LEFT; + str="Del"; + }, + PUSH_BUT + { + keycode=W_KEY_SPACE; + str="Space"; + }, + PUSH_BUT + { + keycode=W_KEY_UP; + str=; + }, + PUSH_BUT + { + keycode=W_KEY_DOWN; + str=; + }, + PUSH_BUT + { + keycode=W_KEY_RIGHT; + str=; + }, + PUSH_BUT + { + keycode=W_KEY_LEFT; + str=; + }, + PUSH_BUT + { + keycode=W_KEY_TAB; + str="Tab"; + }, + PUSH_BUT + { + keycode=W_KEY_MENU; + str="Menu"; + } + }; + } + + +/************************* ACTION LISTS ******************************/ + +/* Change the keycodes too, but don't lose the minus signs */ + +RESOURCE ACLIST_ARRAY sys_ac_no_yes + { + button = + { + PUSH_BUT + { + keycode=-'n'; + str="No"; + }, + PUSH_BUT + { + keycode='y'; + str="Yes"; + } + }; + } + +RESOURCE ACLIST_ARRAY sys_ac_continue + { + button = + { + PUSH_BUT + { + keycode=W_KEY_ESCAPE; + str="Continue"; + } + }; + } + +RESOURCE ACLIST_ARRAY sys_ac_abandon + { + button = + { + PUSH_BUT + { + keycode=W_KEY_ESCAPE; + str="Abandon"; + } + }; + } + +RESOURCE ACLIST_ARRAY sys_append_aclist + { + button = + { + PUSH_BUT + { + keycode=W_KEY_RETURN; + str="Append"; + } + }; + } + +/* Careful not to make the combined width of these strings much wider */ + +RESOURCE ACLIST_ARRAY sys_smart_dial_aclist + { + button = + { + PUSH_BUT + { + keycode=W_KEY_ESCAPE; + str="Cancel"; + }, + PUSH_BUT + { + keycode=W_KEY_MENU; + str="Free input"; + }, + PUSH_BUT + { + keycode=W_KEY_TAB; + str="Dial"; + }, + PUSH_BUT + { + keycode=W_KEY_RETURN; + str="Dial out"; + } + }; + } + +RESOURCE ACLIST_ARRAY sys_freedial_aclist + { + button = + { + PUSH_BUT + { + keycode=W_KEY_DELETE_LEFT; + str="Clear"; + }, + PUSH_BUT + { + keycode=W_KEY_TAB; + str="Redial"; + } + }; + } + +/************************* CHOICE LISTS *****************************/ + +RESOURCE MENU sys_no_yes + { + items = + { + CHOICE_ITEM { str= "No";}, + CHOICE_ITEM { str="Yes";} + }; + } + +RESOURCE MENU sys_offon_menu + { + items = + { + CHOICE_ITEM { str="Off";}, + CHOICE_ITEM { str= "On";} + }; + } + +RESOURCE MENU sys_printer_units_chlist + { + items = + { + CHOICE_ITEM { str= "Inches";}, /* matches with E_IMPERIAL */ + CHOICE_ITEM { str= "Centimetres";} /* matches with E_METRIC */ + }; + } + +RESOURCE MENU sys_printer_device_chlist + { + items = + { + CHOICE_ITEM { str= "Parallel";}, + CHOICE_ITEM { str= "Serial";}, + CHOICE_ITEM { str= "File";} + }; + } + + +RESOURCE MENU sys_baud_rate_chlist + { + items = + { + CHOICE_ITEM { str= "19200";}, /* new for S3a */ + CHOICE_ITEM { str= "9600";}, + CHOICE_ITEM { str= "4800";}, + CHOICE_ITEM { str= "2400";}, + CHOICE_ITEM { str= "1200";}, + CHOICE_ITEM { str= "600";}, + CHOICE_ITEM { str= "300";} + }; + } + +RESOURCE MENU sys_data_bits_chlist + { + items = + { + CHOICE_ITEM { str="5";}, + CHOICE_ITEM { str="6";}, + CHOICE_ITEM { str="7";}, + CHOICE_ITEM { str="8";} + }; + } + +RESOURCE MENU sys_stop_bits_chlist + { + items = + { + CHOICE_ITEM { str="1";}, + CHOICE_ITEM { str="2";} + }; + } + +RESOURCE MENU sys_parity_chlist + { + items = + { + CHOICE_ITEM { str="None";}, + CHOICE_ITEM { str="Even";}, + CHOICE_ITEM { str= "Odd";} + }; + } + +RESOURCE MENU sys_format_chlist + { + items = + { + CHOICE_ITEM { str="Fixed";}, + CHOICE_ITEM { str="Scientific";}, + CHOICE_ITEM { str="General";}, + CHOICE_ITEM { str="Hexadecimal";} + }; + } + +RESOURCE MENU sys_rad_deg + { + items = + { + CHOICE_ITEM { str= "Radians";}, + CHOICE_ITEM { str= "Degrees";} + }; + } + +/* IMPORTANT, order in next array must be same as in page_size menu below */ +/* Also, at most 10 entries allowed, and the first two cannot be altered */ +/* But change any of the others, if you wish */ +/* 1 mm is 1440/25.4 units in the dimensions used, so eg 148 mm is 8391 */ +/* so you could have {width=8391; ... for one entry (an A5 letter size) */ + +RESOURCE PAGE_SIZE_ARRAY sys_page_dimensions + { + page_size= + { + PAGE_SIZE {width=PAGE_WIDTH_A4; length=PAGE_LENGTH_A4;}, + PAGE_SIZE {width=PAGE_WIDTH_A4; length=PAGE_LENGTH_A4;}, + PAGE_SIZE {width=PAGE_WIDTH_EXECUTIVE; length=PAGE_LENGTH_EXECUTIVE;}, + PAGE_SIZE {width=PAGE_WIDTH_LEGAL; length=PAGE_LENGTH_LEGAL;}, + PAGE_SIZE {width=PAGE_WIDTH_LETTER; length=PAGE_LENGTH_LETTER;}, + PAGE_SIZE {width=PAGE_WIDTH_MONARCH; length=PAGE_LENGTH_MONARCH;}, + PAGE_SIZE {width=PAGE_WIDTH_DL; length=PAGE_LENGTH_DL;} + }; + } + +RESOURCE MENU sys_page_size + { + items= + { + CHOICE_ITEM {str="A4";}, + CHOICE_ITEM {str="Custom";}, + CHOICE_ITEM {str="Executive";}, + CHOICE_ITEM {str="Legal";}, + CHOICE_ITEM {str="Letter";}, + CHOICE_ITEM {str="Monarch";}, + CHOICE_ITEM {str="DL";} + }; + } + +RESOURCE MENU sys_orient + { + items= + { + CHOICE_ITEM {str="Portrait";}, + CHOICE_ITEM {str="Landscape";} + }; + } + +RESOURCE MENU sys_prn_pos + { + items= + { + CHOICE_ITEM {str="Normal";}, + CHOICE_ITEM {str="Superscript";}, + CHOICE_ITEM {str="Subscript";} + }; + } + +RESOURCE MENU sys_headfoot_align + { + items= + { + CHOICE_ITEM {str="Left";}, + CHOICE_ITEM {str="Right";}, + CHOICE_ITEM {str="Centred";}, + CHOICE_ITEM {str="Justified";}, + CHOICE_ITEM {str="Two column";}, + CHOICE_ITEM {str="Three column";} + }; + } + +RESOURCE MENU sys_pgno_choice + { + items= + { + CHOICE_ITEM {str="1,2,3";}, + CHOICE_ITEM {str="I,II,III";}, + CHOICE_ITEM {str="i,ii,iii";} + }; + } + +/************************* DIALOGS ********************************/ + +RESOURCE DIALOG sys_error_dialog + { + flags=DLGBOX_RBUF_FILLED|DLGBOX_NO_DDP; + controls= + { + CONTROL + { + class=C_TEXTWIN; + flags=DLGBOX_ITEM_CENTRE|DLGBOX_ITEM_DEAD|DLGBOX_ITEM_UNDERLINED; + info=TXTMESS + { + flags=IN_TEXTWIN_AL_CENTRE; + }; + }, + CONTROL + { + class=C_TEXTWIN; + flags=DLGBOX_ITEM_CENTRE|DLGBOX_ITEM_DEAD; + info=TXTMESS + { + flags=IN_TEXTWIN_AL_CENTRE; + }; + }, + CONTROL + { + class=C_ACLIST; + info=ACLIST + { + rid=sys_ac_continue; + }; + } + }; + } + +RESOURCE DIALOG sys_query_dialog + { + flags = DLGBOX_ACTION_LIST|DLGBOX_REPORT_ACT_HORIZ; + controls= + { + CONTROL + { + class=C_TEXTWIN; + flags=DLGBOX_ITEM_CENTRE|DLGBOX_ITEM_DEAD|DLGBOX_ITEM_UNDERLINED; + info=TXTMESS + { + flags=IN_TEXTWIN_AL_CENTRE; + }; + }, + CONTROL + { + class=C_ACLIST; + info=ACLIST + { + rid=sys_ac_no_yes; + }; + } + }; + } + +RESOURCE DIALOG sys_printing_dialog + { + flags=DLGBOX_RBUF_FILLED; + controls= + { + CONTROL + { + class=C_TEXTWIN; + flags=DLGBOX_ITEM_CENTRE|DLGBOX_ITEM_DEAD|DLGBOX_ITEM_UNDERLINED; + info=TXTMESS + { + flags=IN_TEXTWIN_AL_CENTRE; + }; + }, + CONTROL + { + class=C_TEXTWIN; + flags=DLGBOX_ITEM_CENTRE|DLGBOX_ITEM_DEAD; + info=TXTMESS + { + flags=IN_TEXTWIN_AL_CENTRE; + }; + }, + CONTROL + { + class=C_ACLIST; + info=ACLIST + { + rid=sys_ac_abandon; + }; + } + }; + } + +RESOURCE DIALOG sys_set_port_dialog + { + title="Set Serial port"; + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_RBUF_FILLED; + controls= + { + CONTROL + { + class=C_CHLIST; + prompt="Baud rate"; + info=CHLIST + { + rid=sys_baud_rate_chlist; + nsel=0; + }; + }, + CONTROL + { + class=C_CHLIST; + prompt="Data bits"; + info=CHLIST + { + rid=sys_data_bits_chlist; + nsel=0; + }; + }, + CONTROL + { + class=C_CHLIST; + prompt="Stop bits"; + info=CHLIST + { + rid=sys_stop_bits_chlist; + nsel=0; + }; + }, + CONTROL + { + class=C_CHLIST; + prompt="Parity"; + info=CHLIST + { + rid=sys_parity_chlist; + nsel=0; + }; + }, + CONTROL + { + class=C_CHLIST; + prompt="Ignore parity"; + info=CHLIST + { + rid=sys_no_yes; + nsel=0; + }; + } + }; + } + +RESOURCE DIALOG sys_set_hshk_dialog + { + title="Set serial handshake"; + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_RBUF_FILLED; + controls= + { + CONTROL + { + class=C_CHLIST; + prompt="XON/XOFF"; + info=CHLIST + { + rid=sys_offon_menu; + nsel=0; + }; + }, + CONTROL + { + class=C_CHLIST; + prompt="RTS/CTS"; + info=CHLIST + { + rid=sys_offon_menu; + nsel=0; + }; + }, + CONTROL + { + class=C_CHLIST; + prompt="DSR/DTR"; + info=CHLIST + { + rid=sys_offon_menu; + nsel=0; + }; + }, + CONTROL + { + class=C_CHLIST; + prompt="DCD"; + info=CHLIST + { + rid=sys_offon_menu; + nsel=0; + }; + } + }; + } + +RESOURCE DIALOG sys_printer_config_dialog + { + title="Printer configuration"; + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_SMALL_FONT; + controls= + { + CONTROL + { + class=C_CHLIST; + prompt="Printer device"; + flags=DLGBOX_ITEM_NOTIFY_CHANGED; + info=CHLIST + { + rid=sys_printer_device_chlist; + }; + }, + CONTROL + { + class=C_TEXTWIN; + prompt="Serial characteristics "; + info=TXTMESS + { + str="19200 "; /* changed for S3a */ + flags=IN_TEXTWIN_POPOUT; + }; + }, + CONTROL + { + class=C_TEXTWIN; + prompt="Serial handshaking "; + info=TXTMESS + { + str="XON/XOFF Off "; + flags=IN_TEXTWIN_POPOUT; + }; + }, + CONTROL + { + flags=DLGBOX_ITEM_NEEDS_PACK|DLGBOX_ITEM_NOTIFY_CHANGED; + class=C_FNEDIT; + prompt="File:"; + info=FNEDIT { flags=IN_FNEDIT_NO_AUTOQUERY; }; + }, + CONTROL + { + class=C_CHLIST; + prompt="Units"; + info=CHLIST + { + rid=sys_printer_units_chlist; + }; + } + }; + } + +RESOURCE DIALOG sys_eval_dialog + { + title="Set Calculator format"; + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_RBUF_FILLED; + controls= + { + CONTROL + { + flags=DLGBOX_ITEM_NOTIFY_CHANGED; + class=C_CHLIST; + prompt="Format"; + info=CHLIST { rid=sys_format_chlist; }; + }, + CONTROL + { + class=C_NCEDIT; + /* The following line must be the wider of the 2 above strings */ + /* sys_dec_places and sys_sig_digits */ + prompt="Significant digits"; + info=NCEDIT + { + high=12; + low=0; + }; + }, + CONTROL + { + class=C_CHLIST; + prompt="Trigonometry units"; + info=CHLIST { rid=sys_rad_deg; }; + } + }; + } + +RESOURCE DIALOG sys_country_selector_dialog + { + title="Append country"; + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_ACTION_LIST|DLGBOX_RBUF_FILLED; + controls= + { + CONTROL + { + class=C_WLDSELWN; + prompt="Country"; + info=WLDSELWN {flags=IN_WLDSELWN_COUNTRY|IN_WLDSELWN_SETHOME; }; + }, + CONTROL + { + class=C_ACLIST; + info=ACLIST + { + rid=sys_append_aclist; + }; + } + }; + } + +RESOURCE CONTROL sys_smart_dial_item + { + class=C_EDWIN; + prompt=; + info=EDWIN + { + maxlen=WR_MAX_DIAL_STRING; + vulen=20; + flags=IN_EDWIN_VULEN_CHARACTERS|IN_EDWIN_NO_AUTOSELECT; + }; + } + +RESOURCE DIALOG sys_smart_dial_dialog + { + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_ACTION_LIST|DLGBOX_RBUF_FILLED|DLGBOX_SMALL_FONT; + controls= + { + CONTROL + { + class=C_TEXTWIN; + flags=DLGBOX_ITEM_CENTRE|DLGBOX_ITEM_DEAD|DLGBOX_ITEM_UNDERLINED; + info=TXTMESS + { + flags=IN_TEXTWIN_AL_CENTRE; + str="Dial"; + }; + }, + CONTROL + { + class=C_ACLIST; + info=ACLIST + { + rid=sys_smart_dial_aclist; + }; + } + }; + } + +RESOURCE DIALOG sys_freedial_dialog + { + title="Free-form dialling"; + flags = DLGBOX_NO_WAIT|DLGBOX_NO_DDP; + controls= + { + CONTROL + { + class=C_FREEDIAL; + prompt=; + }, + CONTROL + { + class=C_ACLIST; + info=ACLIST + { + rid=sys_freedial_aclist; + }; + } + }; + } + +RESOURCE DIALOG sys_flist_dialog + { + title="Specify filelist"; + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_RBUF_FILLED; + controls= + { + CONTROL + { + class=C_EDWIN; + prompt="Filename pattern"; + info=EDWIN + { + maxlen=P_FNAMESIZE; + vulen=18; + flags=IN_EDWIN_VULEN_CHARACTERS; + }; + }, + CONTROL + { + class=C_EDWIN; + prompt="Full path"; + info=EDWIN + { + maxlen=P_FNAMESIZE; + vulen=18; + flags=IN_EDWIN_VULEN_CHARACTERS; + }; + } + }; + } + +RESOURCE DIALOG sys_print_control_dl + { + title="Print setup"; + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_NOTIFY_ESCAPE|DLGBOX_SMALL_FONT; + controls= + { + CONTROL + { + class=C_TEXTWIN; + prompt="Page size"; + info=TXTMESS + { + str=""; + flags=IN_TEXTWIN_POPOUT; + }; + }, + CONTROL + { + class=C_TEXTWIN; + prompt="Margins"; + info=TXTMESS + { + str=""; + flags=IN_TEXTWIN_POPOUT; + }; + }, + CONTROL + { + class=C_TEXTWIN; + prompt="Header"; + info=TXTMESS + { + str=""; + flags=IN_TEXTWIN_POPOUT; + }; + }, + CONTROL + { + class=C_TEXTWIN; + prompt="Footer"; + info=TXTMESS + { + str=""; + flags=IN_TEXTWIN_POPOUT; + }; + }, + CONTROL + { + class=C_TEXTWIN; + prompt="Paging control"; + info=TXTMESS + { + str=""; + flags=IN_TEXTWIN_POPOUT; + }; + }, + CONTROL + { + class=C_TEXTWIN; + prompt="Printer model"; + info=TXTMESS + { + str=""; + flags=IN_TEXTWIN_POPOUT; + }; + } + }; + } + +RESOURCE DIALOG sys_paging_control_dl + { + title="Paging control"; + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_RBUF_FILLED; + controls= + { + CONTROL + { + class=C_NCEDIT; + prompt="Number for first page"; + info=NCEDIT + { + low=1; + high=9999; + }; + }, + CONTROL + { + class=C_CHLIST; + prompt="Allow widows/orphans"; + info=CHLIST{rid=sys_no_yes;}; + }, + CONTROL + { + class=C_CHLIST; + prompt="Page number style"; + info=CHLIST{rid=sys_pgno_choice;}; + } + }; + } + +RESOURCE DIALOG sys_printer_model + { + title="Set printer"; + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_RBUF_FILLED; + controls= + { + CONTROL + { + prompt="Select printer"; + flags=DLGBOX_ITEM_NOTIFY_CHANGED; + class=C_CHLIST; + info=CHLIST{}; + }, + CONTROL + { + class=C_TEXTWIN; + prompt="Default font"; + info=TXTMESS + { + flags=IN_TEXTWIN_POPOUT; + }; + } + }; + } + +RESOURCE DIALOG sys_margins_dl + { + title="Margins"; + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_RBUF_FILLED|DLGBOX_APPEND_UNITS_TITLE; + controls= + { + CONTROL + { + class=C_FLTEDIT; + prompt="Top"; + info=FLTEDIT + { + low=0; + high=9.99; + ndec=2; + }; + }, + CONTROL + { + class=C_FLTEDIT; + prompt="Left"; + info=FLTEDIT + { + low=0; + high=9.99; + ndec=2; + }; + }, + CONTROL + { + class=C_FLTEDIT; + prompt="Right"; + info=FLTEDIT + { + low=0; + high=9.99; + ndec=2; + }; + }, + CONTROL + { + class=C_FLTEDIT; + prompt="Bottom"; + info=FLTEDIT + { + low=0; + high=9.99; + ndec=2; + }; + } + }; + } + +RESOURCE DIALOG sys_headfoot_dl + { + title="*"; + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_RBUF_FILLED|DLGBOX_APPEND_UNITS_TITLE; + controls= + { + CONTROL + { + class=C_EDWIN; + prompt="Text"; + info=EDWIN + { + flags=IN_EDWIN_VULEN_CHARACTERS|IN_EDWIN_ACCEPT_TABS; + maxlen=80; + vulen=20; + }; + }, + CONTROL + { + class=C_CHLIST; + prompt="Alignment"; + info=CHLIST{rid=sys_headfoot_align;}; + }, + CONTROL + { + class=C_CHLIST; + prompt="On first page"; + info=CHLIST{rid=sys_no_yes;}; + }, + CONTROL + { + class=C_TEXTWIN; + prompt="Font"; + info=TXTMESS + { + flags=IN_TEXTWIN_POPOUT; + }; + }, + CONTROL + { + class=C_FLTEDIT; + prompt="Vertical offset"; + info=FLTEDIT + { + low=0; + high=9.99; + ndec=2; + }; + } + }; + } + +RESOURCE DIALOG sys_pagesize_dl + { + title="Page size"; + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_RBUF_FILLED|DLGBOX_APPEND_UNITS_TITLE; + controls= + { + CONTROL + { + class=C_CHLIST; + flags=DLGBOX_ITEM_NOTIFY_CHANGED; + prompt="Page size"; + info=CHLIST{rid=sys_page_size;}; + }, + CONTROL + { + class=C_FLTEDIT; + prompt="Width"; + info=FLTEDIT + { + low=1; + high=45; + ndec=2; + }; + }, + CONTROL + { + class=C_FLTEDIT; + prompt="Height"; + info=FLTEDIT + { + low=1; + high=45; + ndec=2; + }; + }, + CONTROL + { + class=C_CHLIST; + prompt="Orientation"; + info=CHLIST{rid=sys_orient;}; + } + }; + } + +RESOURCE DIALOG sys_font_dl + { + title="Font"; + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_RBUF_FILLED|DLGBOX_SMALL_FONT; + controls= + { + CONTROL + { + flags=DLGBOX_ITEM_NOTIFY_CHANGED; + class=C_CHLIST; + prompt="Font"; + info=CHLIST{}; + }, + CONTROL + { + class=C_CHLIST; + prompt="Size"; + info=CHLIST{}; + }, + CONTROL + { + class=C_CHLIST; + prompt="Underline"; + info=CHLIST{rid=sys_no_yes;}; + }, + CONTROL + { + class=C_CHLIST; + prompt="Bold"; + info=CHLIST{rid=sys_no_yes;}; + }, + CONTROL + { + class=C_CHLIST; + prompt="Italic"; + info=CHLIST{rid=sys_no_yes;}; + }, + CONTROL + { + class=C_CHLIST; + prompt="Print position"; + info=CHLIST{rid=sys_prn_pos;}; + } + }; + } + +RESOURCE CONTROL sys_txtmess + { + class=C_TEXTWIN; + flags=DLGBOX_ITEM_CENTRE|DLGBOX_ITEM_DEAD; + info=TXTMESS + { + flags=IN_TEXTWIN_AL_CENTRE; + }; + } + +/************************* HELP ********************************/ + +RESOURCE TOPIC_ARRAY sys_help_index_data +{ +id_lst= +{ +sys_help_on_off, +sys_time_basics, +sys_help_infrared, +sys_help_edit, +sys_help_dialog, +sys_help_statwin, +sys_help_files, +sys_help_filsels, +sys_help_evaluate, +sys_help_print, +sys_help_in_use, +sys_help_appnotready, +sys_help_dialling, +sys_help_no_sys_mem +}; +} + +RESOURCE HELP_ARRAY sys_help_index +{ +topic="Index"; +topic_id=sys_help_index_data; +} + +RESOURCE HELP_ARRAY sys_help_on_help +{ +topic="Using Help"; +strlst= +{ +STRING {str="To choose a topic: press "" keys, then Enter.";}, +STRING {str="";}, +STRING {str="The help topics should help you to perform your tasks. In";}, +STRING {str="each topic, menus and menu options are shown in";}, +STRING {str="apostrophes, eg `File'; other help topics are shown in double";}, +STRING {str="quotes, eg \"Basics\".";}, +STRING {str="";}, +STRING {str="A small arrow pointing up or down in the top or bottom";}, +STRING {str="right-hand corners of the help window means that there is";}, +STRING {str="more text.";}, +STRING {str="";}, +STRING {str="Press Esc to return to the previous Help screen.";}, +STRING {str="Control-Esc exits Help.";}, +STRING {str="";}, +STRING {str="Press Control-Help for an alphabetical index. Note: this";}, +STRING {str="works from each main application screen and may also";}, +STRING {str="include general help topics.";} +}; +} + +RESOURCE HELP_ARRAY sys_help_dialog +{ +topic="Commands & actions"; +strlst= +{ +STRING {str="Press Menu key to see a menu of command options, use """;}, +STRING {str="to select an option, then press Enter.";}, +STRING {str="";}, +STRING {str="Some options work straight away; others display a \"dialog\"";}, +STRING {str="for more information. See \"Entering information\".";}, +STRING {str="Use \"hot-key\", eg ""-N, listed beside option to access it";}, +STRING {str="directly (hold down "" key and press letter).";} +}; +} + +RESOURCE HELP_ARRAY sys_help_statwin +{ +topic="Screen display"; +strlst= +{ +STRING {str="Use ""-> and ""-< to change contrast.";}, +STRING {str="";}, +STRING {str="Press "" to switch between \"views\" in an application.";}, +STRING {str="";}, +STRING {str="Use `Zoom in/out' to change size of text.";}, +STRING {str="";}, +STRING {str="In the System screen and most applications, a Status";}, +STRING {str="window can be displayed, showing general status information,";}, +STRING {str="eg time, date etc.";}, +STRING {str="To switch it on: use Control-Menu.";}, +STRING {str="To reduce its size: press Control-Menu again.";}, +STRING {str="To switch it off: press Control-Menu once more.";}, +STRING {str="To display it temporarily: use ""-Menu.";}, +STRING {str="To set up what is displayed in the Status window: use `Status";}, +STRING {str="window' option in the System screen.";} +}; +} + +RESOURCE HELP_ARRAY sys_help_dialling +{ +topic="Dialling telephone numbers"; +strlst= +{ +STRING {str="The Series 3c can generate the sounds used when dialling";}, +STRING {str="from push-button telephones.";}, +STRING {str="To dial a number marked with a telephone symbol "":";}, +STRING {str="Find an entry in Data/Agenda then press Dial (""-Help).";}, +STRING {str="";}, +STRING {str="To insert a "" before entering a number to mark an entry,";}, +STRING {str="press Shift-""-Help.";}, +STRING {str="To dial a number you enter: press Control-""-Help and type";}, +STRING {str="in the number to dial.";}, +STRING {str="To use a dial out code (eg if you are dialling from work): set";}, +STRING {str="the `Dialling' details in the System screen.";} +}; +} + +RESOURCE HELP_ARRAY sys_help_filsels +{ +topic="Entering information"; +strlst= +{ +STRING {str="Start the application for the data you want to enter, eg";}, +STRING {str="Agenda, and simply type your data in. When the Series 3c";}, +STRING {str="needs information, it will display a \"dialog\".";}, +STRING {str="";}, +STRING {str="Press Enter to accept the settings in a dialog.";}, +STRING {str="Press Esc to remove the dialog without setting new";}, +STRING {str="information.";}, +STRING {str="In dialogs:";}, +STRING {str="Some lines have arrows around settings, eg `All sound " " On ""'.";}, +STRING {str="Press "" or "" to change the setting or press Tab to display a";}, +STRING {str="list. When a list is displayed, use "" to highlight";}, +STRING {str="an option, then press Enter to select it.";}, +STRING {str="";}, +STRING {str="When entering dates, press Tab to display a calendar then:";}, +STRING {str=""" moves the cursor around the calendar.";}, +STRING {str="Spacebar moves to today.";}, +STRING {str="""-"" moves a month at a time.";}, +STRING {str=""" moves a week at a time.";}, +STRING {str="Press Enter when you've found the date.";}, +STRING {str="";}, +STRING {str="For filenames in dialogs, Shift-Tab gives full path of file.";}, +STRING {str="Press Tab to choose from a list of files.";}, +STRING {str="Type first letter of filename to move highlight to that file;";}, +STRING {str="Shift+letter to move to a directory; Control+letter to move to";}, +STRING {str="a disk.";} +}; +} + +RESOURCE HELP_ARRAY sys_help_edit +{ +topic="Editing text"; +strlst= +{ +STRING {str="Use "" to move cursor.";}, +STRING {str="Control "" to move a word at a time.";}, +STRING {str="";}, +STRING {str="Shift-"" to highlight text, then use:";}, +STRING {str="Delete to cut it to the clipboard (or `Copy' to copy it), then";}, +STRING {str="`Insert' to \"paste\" the text back in; use Shift-Delete to delete";}, +STRING {str="text without changing what's on the \"clipboard\".";}, +STRING {str="";}, +STRING {str="To copy text from another application: highlight text to copy";}, +STRING {str="in the other application, then use `Bring' option to insert text";}, +STRING {str="at cursor position.";}, +STRING {str="";}, +STRING {str="Quick delete methods (without highlighting):";}, +STRING {str="Shift-Delete: character forwards";}, +STRING {str="Shift-""-Delete: to end of line";}, +STRING {str="""-Delete: to beginning of line";}, +STRING {str="";}, +STRING {str="Quick highlight methods:";}, +STRING {str="Shift-Control-Home: current word";}, +STRING {str="Shift-Control-End: current paragraph";} +}; +} + +RESOURCE TOPIC_ARRAY sys_help_x_help +{ +id_lst= +{ +sys_help_on_help +}; +} + +RESOURCE HELP_ARRAY sys_help_files +{ +topic="Managing files"; +strlst= +{ +STRING {str="All your information is stored in files. Most files you can work";}, +STRING {str="on are listed under the application icons in the System screen.";}, +STRING {str="Note: \"Files\" on the System screen is the file manager application.";}, +STRING {str="";}, +STRING {str="To create a new file: use `New file' on `File' menu in the";}, +STRING {str="System screen or in the application.";}, +STRING {str="To save a file: use `Save' or `Save as' in the application.";}, +STRING {str="To open a file: highlight its name and press Enter on System";}, +STRING {str="screen or use `Open file' in the application.";}, +STRING {str="To exit a file: highlight bold filename in System screen and";}, +STRING {str="press Delete.";}, +STRING {str="To copy, move or delete files: highlight filename and use `File'";}, +STRING {str="menu options in the System screen.";}, +STRING {str="";}, +STRING {str="Press Tab on System screen for File selector:";}, +STRING {str="Menu gives file/directory options. Use + - (or Shift "" to";}, +STRING {str="tag/untag files. * / tag/untag all files.";}, +STRING {str="Files are stored on disk in \"directories\".";}, +STRING {str="Each application has an associated file extension, eg DAT for";}, +STRING {str="Data files.";}, +STRING {str="To find out others: highlight the application icon in the";}, +STRING {str="System screen and use `About application' to show directory";}, +STRING {str="and file extension. Note: filename extensions are not listed in";}, +STRING {str="the System screen.";} +}; +} + +RESOURCE HELP_ARRAY sys_help_print +{ +topic="Printing/previewing"; +strlst= +{ +STRING {str="Set your printer configuration using `Printer' in the System";}, +STRING {str="screen.";}, +STRING {str="";}, +STRING {str="In applications which can Print, first use `Print setup' on";}, +STRING {str="`Special' menu to set `Printer model'.";}, +STRING {str="";}, +STRING {str="Use `Print preview' to see a preview; it has its own menu of";}, +STRING {str="options (including `Print'). Note: you don't have to wait for";}, +STRING {str="the preview to finish calculating - Esc cancels.";}, +STRING {str="";}, +STRING {str="Use %D and %T in headers and footers (part of `Print setup')";}, +STRING {str="to print the date and time automatically.";}, +STRING {str="Other codes include:";}, +STRING {str="%F for the filename";}, +STRING {str="%P for the page number";}, +STRING {str="%% for a % character";}, +STRING {str="In Word or Sheet, you can use %M for total pages in a file. Eg in";}, +STRING {str="a file 6 pages long, `Page %P of %M' prints `Page 1 of 6'";}, +STRING {str="on the first page.";} +}; +} + +RESOURCE HELP_ARRAY sys_time_basics +{ +topic="Date & time settings"; +strlst= +{ +STRING {str="In Time, set `Home city', then set `Time and date'.";}, +STRING {str="";}, +STRING {str="Set `Summer times' on/off when they change.";}, +STRING {str="";}, +STRING {str="Use `Formats' to set 12/24 hour clocks.";} +}; +} + +RESOURCE HELP_ARRAY sys_help_on_off +{ +topic="Turning on & off"; +strlst= +{ +STRING {str="Press ON/Esc or an application button to turn on; OFF (""-1)";}, +STRING {str="to turn off.";}, +STRING {str="";}, +STRING {str="In the System screen, use `Auto switch off' to make the";}, +STRING {str="Series 3c switch off after a certain period without a";}, +STRING {str="keypress; this will save battery power.";} +}; +} + +RESOURCE TOPIC_ARRAY sys_help_x_index +{ +id_lst= +{ +sys_help_index +}; +} + +/************************* LATER ADDITIONS ********************************/ + +/* Name of general printer driver */ +RESOURCE STRING sys_wdr_general { str="General"; } + +RESOURCE STRING sys_dial_out { str="9,"; } /* 5 chars max */ + +RESOURCE STRING sys_skipping_page { str="(skipping page %u)";} + +/************************* NEW FOR XWIM ********************************/ + +/* TTT: Only used by developers */ +RESOURCE STRING sys_debugging_num_cells {str="Diagnostics: %d (%u)";} + +/********* for Calendar Window in Agenda **********/ + +/* TTT: eg "Calendar 1998" or "Calendar 1993-1994" */ +RESOURCE STRING sys_calendar {str="Calendar %Y";} + +/*********************** FOR PRINT PREVIEW ******************************/ +/* TTT: "Print preview" option in Word, Agenda, Sheet... uses these: */ +RESOURCE STRING sys_page {str="page";} +RESOURCE STRING sys_pages {str="pages";} +RESOURCE STRING sys_preview_busy {str="Busy, cannot print yet";} +RESOURCE STRING sys_display_margins {str="Show margins";} +RESOURCE STRING sys_hide_margins {str="Hide margins";} + +RESOURCE STRING sys_opening_prompt {str="Opening \"%s\"";} + +/* TTT: NB "Print preview" is a standard WP term... if every Wp in your +country uses one term for this, you must use it too */ +RESOURCE STRING sys_print_preview {str="Print preview";} + +/* TTT length of longest in sys_preview_margins_chlist + length of longest +in sys_preview_options_chlist must be less than 50 */ +RESOURCE MENU sys_preview_margins_chlist + { + items= + { + CHOICE_ITEM {str="Margins off";}, + CHOICE_ITEM {str="Margins on";} + }; + } + +RESOURCE MENU sys_preview_options_chlist + { + items= + { + CHOICE_ITEM {str="Facing pages";}, + CHOICE_ITEM {str="1 page";}, + CHOICE_ITEM {str="2 pages";}, + CHOICE_ITEM {str="3 pages";}, + CHOICE_ITEM {str="4 pages";} + }; + } + +RESOURCE DIALOG sys_preview_options_dialog + { + title="Display"; + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_RBUF_FILLED|DLGBOX_NO_DDP; + controls= + { + CONTROL + { + class=C_CHLIST; + prompt=""; + info=CHLIST{rid=sys_preview_options_chlist;}; + } + }; + } + +RESOURCE DIALOG sys_preview_jump_dialog + { + title="Jump to page"; + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_RBUF_FILLED|DLGBOX_NO_DDP; + controls= + { + CONTROL + { + class=C_NCEDIT; + prompt="Page number"; + info=NCEDIT + { + low=1; + high=9999; + }; + } + }; + } + +RESOURCE WSERV_INFO sys_preview_acc + { + menbar_id=sys_preview_menubar; + first_com=O_PVC_PREVIEW_PRINT; + accel= + { + 'p', /* Print */ + 'm', /* Margins */ + 'd', /* Pages to display */ + 'j', /* Jump to page */ + '*' /* Exit preview */ + }; + } + +RESOURCE MENU_BAR sys_preview_menubar + { + items = + { + MENU_BAR_ITEM + { + menu_id=sys_preview_menu; + mb_item="Preview"; + } + }; + } + +RESOURCE MENU sys_preview_menu + { + items = + { + MENU_ITEM + { + com_id=O_PVC_PREVIEW_PRINT; + mn_item="Print"; + }, + MENU_ITEM + { + com_id=O_PVC_PREVIEW_MARGINS; +/* TTT: use whichever's the longer: "Show margins" or "Hide margins" */ + mn_item="Show margins"; + }, + MENU_ITEM + { + com_id=O_PVC_PREVIEW_OPTIONS; + mn_item="Pages to display"; + }, + MENU_ITEM + { + com_id=O_PVC_PREVIEW_JUMP|BREAK_LINE_FOLLOWS; + mn_item="Jump to page"; + }, + MENU_ITEM + { + com_id=O_PVC_PREVIEW_EXIT; + mn_item="Exit preview"; + } + }; + } + +RESOURCE MENU sys_printer_devices + { + items = + { + CHOICE_ITEM { str= "Parallel";}, + CHOICE_ITEM { str= "Serial";}, + CHOICE_ITEM { str= "File";}, + CHOICE_ITEM { str= "Fax";} + }; + } + +RESOURCE CONTROL sys_print_control_device + { + class=C_TEXTWIN; +/* TTT: You'll see this on the bottom of the Print Setup dialog +in Word, Agenda... */ + prompt="Printer device"; + info=TXTMESS + { + str=""; + flags=IN_TEXTWIN_POPOUT; + }; + } + +RESOURCE CONTROL sys_print_preview_settings + { +/* TTT: You'll see this on the bottom of the Printer configuration dialog +in the Shell */ + class=C_TEXTWIN; + prompt="Print preview"; + info=TXTMESS + { + str="Facing pages,Margins off"; /* TTT widest possible */ + flags=IN_TEXTWIN_POPOUT; + }; + } + +RESOURCE DIALOG sys_preview_settings_dl + { + title="Preview settings"; + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_RBUF_FILLED; + controls= + { + CONTROL + { + class=C_CHLIST; + prompt="Display"; + info=CHLIST{rid=sys_preview_options_chlist;}; + }, + CONTROL + { + class=C_CHLIST; + prompt="Margins"; + info=CHLIST{rid=sys_offon_menu;}; + } + }; + } + +RESOURCE MENU sys_standard_sounds + { + items= + { +/* TTT: Built-in sounds, when you're setting an alarm in Time */ + CHOICE_ITEM {str="Rings";}, + CHOICE_ITEM {str="Chimes";}, + CHOICE_ITEM {str="Fanfare";}, + CHOICE_ITEM {str="Soft bells";}, + CHOICE_ITEM {str="Church bell";} + }; + } + +/* TTT: do not translate */ +RESOURCE STRING sys_alarm_standard_name {str="SYS$AL01";} +/* TTT: The "silent" sound, when setting an alarm */ +RESOURCE STRING sys_silent_alarm {str="Silent";} +/* TTT: If you try to play a sound, but sound is disabled... */ +RESOURCE STRING sys_sound_disabled {str="Sound disabled";} +/* TTT: do not translate the next one */ +RESOURCE STRING sys_word_rom { str="ROM::WORD.APP"; } +/* TTT: the user has refused to replace an SSD */ +RESOURCE STRING sys_restart_from_sys { str="Press Esc to exit application"; } + +/* TTT: when creating a new file: eg gives "Myfile" created +You can change these around if you like, eg we could've done the English +as str="Created \"%s\"" to give Created "Myfile" */ +RESOURCE STRING srt_file_created { str="\"%s\" created"; } +RESOURCE STRING srt_file_opened { str="\"%s\" opened"; } +RESOURCE STRING srt_file_saved { str="\"%s\" saved"; } +RESOURCE STRING srt_file_compressed { str="\"%s\" compressed"; } +RESOURCE STRING srt_file_merged { str="\"%s\" merged in"; } +RESOURCE STRING sys_saving_prompt {str="Saving \"%s\"";} +RESOURCE STRING sys_reloading_prompt {str="Reopening \"%s\"";} +RESOURCE STRING sys_converting_prompt {str="Converting \"%s\"";} + +/* TTT: When we refuse to save the file, because it hasn't changed */ +RESOURCE STRING sys_not_changed {str="Not changed";} +/* TTT: When you're exiting, but it failed to save the file for some reason */ +RESOURCE STRING sys_confirm_continue {str="Not saved, continue anyway?";} +/* TTT: When you're using the "Exit, lose changes" option: */ +RESOURCE STRING sys_confirm_change_loss {str="Confirm the loss of all changes";} +/* TTT: used with the previous two strings */ +RESOURCE STRING sys_losing_changes {str="(`Yes' discards all changes)";} +RESOURCE STRING sys_nothing_to_print {str="Nothing to print";} +RESOURCE STRING sys_nothing_to_insert {str="Nothing to insert";} +RESOURCE STRING sys_nothing_to_copy {str="Nothing to copy";} +/* TTT: preferably use the same word as the "Revert" menu option */ +RESOURCE STRING sys_revert_to_saved {str="Revert to saved?";} + +/* TTT: For use in menus (hotkeys) */ +RESOURCE STRING sys_shift_key_name {str="Shift";} + +/* TTT: When you use "Current country only" (or diamond key) World App... */ +RESOURCE STRING srt_space_only { str=""; } + +RESOURCE STRING sys_change_password {str="Change password";} + +RESOURCE DIALOG sys_set_password_dl + { + title = "Set password"; + flags=DLGBOX_NOTIFY_ENTER; + controls= + { + CONTROL + { + class=C_XEDIT; + prompt="Enter password"; + }, + CONTROL + { + class=C_XEDIT; + prompt="Confirm password"; + } + }; + } + +RESOURCE DIALOG sys_get_password_dl + { + title = "Password protected"; + flags=DLGBOX_NOTIFY_ENTER; + controls= + { + CONTROL + { + class=C_XEDIT; + prompt="Enter password"; + } + }; + } + +/* TTT Extra help - translate this! */ +/* BUT DON'T MAKE THE TEXT WIDER THAN WILL FIT ON COMPATIBILITY MODE SCREENS +(BEAR IN MIND THAT THIS HELP IS AVAILABLE TO COMPATIBILITY MODE APP) */ + +RESOURCE HELP_ARRAY sys_help_evaluate +{ +topic="Calculations - Using `Evaluate'"; +strlst= +{ +STRING {str="Use `Evaluate' to work out the result of a calculation as you";}, +STRING {str="type it in, eg in Word.";}, +STRING {str="";}, +STRING {str="Type a calculation (without = or spaces), then use `Evaluate'";}, +STRING {str="on `Edit' menu for result.";}, +STRING {str="";}, +STRING {str="To set the format for results: set `\"Evaluate\" format' in the";}, +STRING {str="System screen.";} +}; +} + +RESOURCE HELP_ARRAY sys_help_memo +{ +topic="Memo editor"; +strlst= +{ +STRING {str="Put cursor on entry and use `Edit memo' in Agenda to create";}, +STRING {str="a memo for an entry, eg meeting notes.";}, +STRING {str="";}, +STRING {str="Agenda memos can be up to 4K long. One set of styles is kept";}, +STRING {str="for all memos in an Agenda file.";}, +STRING {str="";}, +STRING {str="Use `Password' to protect a memo and use it again to remove";}, +STRING {str="or change the password.";}, +STRING {str="";}, +STRING {str="Use `Exit' when you've finished the memo.";}, +STRING {str="";}, +STRING {str="To delete a memo, edit it, delete all text in Memo editor";}, +STRING {str="(`Highlight all text', then press Delete key) and `Exit'.";} +}; +} + +RESOURCE HELP_ARRAY sys_help_in_use +{ +topic="File or device in use"; +strlst= +{ +STRING {str="You will see this message if you try to copy, delete or rename";}, +STRING {str="a file which is open (ie in bold on the System screen). Exit the";}, +STRING {str="file first.";}, +STRING {str="";}, +STRING {str="You will also see it if you have used `Communications' in";}, +STRING {str="System screen to set `Link cable', and then try to print to a";}, +STRING {str="serial port printer.";}, +STRING {str="Set `Use' line in `Communications' to `None' before printing.";} +}; +} + +RESOURCE HELP_ARRAY sys_help_no_sys_mem +{ +topic="No system memory"; +strlst= +{ +STRING {str="This message usually means all your Internal memory has";}, +STRING {str="been used up. Exit some open files, or delete unwanted files";}, +STRING {str="from the Internal disk, to free some more memory.";}, +STRING {str="";}, +STRING {str="It may also appear if a Word or Sheet file reaches its";}, +STRING {str="maximum size. In this case Internal memory is probably NOT";}, +STRING {str="full - the message means the application has reached its";}, +STRING {str="memory limit. You will need to split the file.";}, +STRING {str="";}, +STRING {str="(If an Agenda has repeating entries, `Find' and `Print preview'";}, +STRING {str="may also temporarily cause the Agenda to reach its memory";}, +STRING {str="limit and display this message.)";} +}; +} + +RESOURCE HELP_ARRAY sys_help_calendar +{ +topic="Calendars"; +strlst= +{ +STRING {str="Whenever you are entering a date in a dialog, you can press";}, +STRING {str="Tab to display a calendar.";}, +STRING {str="";}, +STRING {str="In the calendars:";}, +STRING {str=""" move the cursor around the screen;";}, +STRING {str="Psion-"" move a month at a time;";}, +STRING {str="Shift-"" (or <>) move one day at a time;";}, +STRING {str="Shift-"" move by weeks;";}, +STRING {str="Control-"" move by months;";}, +STRING {str="Control-"" move by years.";}, +STRING {str="";}, +STRING {str="Spacebar moves to today.";} +}; +} + +/************************* NEW FOR Workabout **************************/ +/* INCLUDED IN ALL BUILDS, BUT DUMMY RESOURCES USED FOR OTHER BUILDS */ + +RESOURCE DIALOG sys_s3c_print_control_dl + { + title=""; + } + + RESOURCE STRING sys_s3c_page_setup { str=""; } + +RESOURCE HELP_ARRAY sys_help_battery +{ + topic=""; +} + +/************************* NEW FOR Siena ******************************/ +/* INCLUDED IN ALL BUILDS, BUT DUMMY RESOURCES USED FOR OTHER BUILDS */ + +RESOURCE DIALOG sys_vine_file_info_dl + { + title=""; + } + +RESOURCE KEYLIST sys_russian_keys +{ +/* Used in Russian model to map between keyboard modes (latin and cyrillic) + + Used by Siena to map menu keys < > and , to . ? and ' + This is necessary when menu is on screen and user presses unmodified key + hoping to highlight relevent menu option +*/ + +} + + +RESOURCE HELP_ARRAY sys_help_infrared +{ +topic="Infrared"; +strlst= +{ +STRING {str="Lets you copy information to and from another Psion that";}, +STRING {str="has Infrared.";}, +STRING {str="";}, +STRING {str="To turn Infrared on: select `Communications' in the System";}, +STRING {str="screen and set the `Use' line to `Psion IR'. Note: Leave `Power";}, +STRING {str="setting' set to `High'.";}, +STRING {str="";}, +STRING {str="To use Infrared: select the data to copy, then transfer it.";}, +STRING {str="";}, +STRING {str="To select:";}, +STRING {str=""" File - highlight its name in the System screen.";}, +STRING {str=""" Agenda entry - put the cursor on the entry. The copied entry";}, +STRING {str="will have the same date, time and alarm as the original.";}, +STRING {str=""" Data entry - find the entry, or highlight specific text in an entry.";}, +STRING {str=""" Information in other applications - just highlight the text";}, +STRING {str="in Word & Program, the calculation or result in Calc, or the";}, +STRING {str="cell(s) in Sheet.";}, +STRING {str="";}, +STRING {str="To transfer the data:";}, +STRING {str="Point the Series 3c and the other Psion at each other and";}, +STRING {str="make sure they are less than 60cm (2 feet) apart.";}, +STRING {str="Press Psion-Tab on the sending Series 3c, then "".";}, +STRING {str="On the receiving Psion, move to appropriate application for";}, +STRING {str="information, or the System screen to receive a whole file, then";}, +STRING {str="use Infrared receive (Psion-Tab, then "").";} +}; +} + +RESOURCE HELP_ARRAY sys_help_appnotready +{ +topic="Application not ready"; +strlst= +{ +STRING {str="You will see this message if you try to use Infrared when:";}, +STRING {str=""" a dialog is being displayed in the receiving application.";}, +STRING {str=""" Help is being displayed in the receiving application.";}, +STRING {str=""" the receiving application does not support Infrared.";}, +STRING {str=""" the receiving application is \"busy\" and not ready to receive";}, +STRING {str="information.";}, +STRING {str="Check the receiving application, then try Infrared again.";} +}; +} + + +RESOURCE STRING sys_ir_disabled { str="Infrared is disabled"; } + +RESOURCE MENU sys_ir_power_level + { + items = + { + CHOICE_ITEM { str="High";}, + CHOICE_ITEM { str="Low";} + }; + } + +RESOURCE STRING sys_printer_ir { str = "Infrared"; } + +RESOURCE MENU sys_baud_rate_chlist_x + { + items = + { + CHOICE_ITEM { str= "300";}, + CHOICE_ITEM { str= "600";}, + CHOICE_ITEM { str= "1200";}, + CHOICE_ITEM { str= "2400";}, + CHOICE_ITEM { str= "4800";}, + CHOICE_ITEM { str= "9600";}, + CHOICE_ITEM { str= "19200";}, + CHOICE_ITEM { str= "38400";}, + CHOICE_ITEM { str= "57600";} + }; + } + +RESOURCE CONTROL sys_baud_control_x + { + class=C_CHLIST; + prompt="Baud rate"; + info=CHLIST + { + rid=sys_baud_rate_chlist_x; + nsel=8; + }; + } + +/* End of File: SC_.RSS */ + diff --git a/code/SIBOSDK/resource/ss_.rss b/code/SIBOSDK/resource/ss_.rss new file mode 100644 index 0000000..271fa64 --- /dev/null +++ b/code/SIBOSDK/resource/ss_.rss @@ -0,0 +1,2018 @@ +SYSTEM +/* +(No comment to be placed on the first line of this file!) + +SS_.RSS + +System Resource file for Siena + +*/ + +#include +#include "hwim.rh" +#include +#include "symbols.h" + +STRUCT KEYPAIR + { + BYTE latin; /* Latin character value */ + BYTE cyril; /* Cyrillic character value */ + } + +STRUCT KEYLIST + { + STRUCT list[]; + } + +#define ARROWS4 + +/****************** THE SPECIAL CHARACTERS ************************/ +/* The first four characters are used by the file selector to tag one, +untag one, tag all & untag all. The next four are the "nudge" keys used by +most numeric/date editors. (Two down, two up.) Next is the keycode used in +EDWIN.C to indicate a soft or hard hyphen. NSWE are the compass points used +by the Lat-Long editor. These are followed by the degree symbol used in the +same editor. Next is the bullet symbol used by Help and by the Agenda. +The last two symbols were added in September 1995 to support code pages +other than 850 (esp. 1251 for Russia!). See #define H_SC_TPLUS et seq. +in SYMBOLS.H */ + +/* TTT Leave most of these alone, but translate the NSWE */ + +RESOURCE STRING sys_special_characters { str="+-*/<,>.NSWEøþ"; } + +/************************* STRINGS ********************************/ + +RESOURCE STRING sys_string { str="%s"; } +RESOURCE STRING sys_dimmed_msg {str="This item is not available";} +RESOURCE STRING sys_locked_msg {str="This item cannot be changed";} +RESOURCE STRING sys_busy { str="Busy"; } +RESOURCE STRING sys_scanning { str="Scanning"; } +RESOURCE STRING sys_printing_to { str="Printing to %s";} +RESOURCE STRING sys_page_is { str="(page %u)";} + +RESOURCE STRING sys_copied_prompt {str="Copied";} +RESOURCE STRING sys_copying_prompt {str="Saving as \"%s\"";} +RESOURCE STRING sys_loading_prompt {str="Loading \"%s\"";} +RESOURCE STRING sys_merging_prompt {str="Merging in \"%s\"";} +RESOURCE STRING sys_nothing_to_bring {str="Nothing to bring";} +RESOURCE STRING sys_not_found {str="Not found"; } +RESOURCE STRING sys_nothing_to_find {str="Nothing to find";} + +RESOURCE STRING sys_compress_prompt {str="Compressing \"%s\"";} +RESOURCE STRING sys_not_compressible {str="Cannot compress on Flash";} + +RESOURCE STRING sys_password_incorrect {str="Incorrect password";} +RESOURCE STRING sys_password_not_confirmed {str="Password not confirmed";} + +RESOURCE STRING sys_range_reset {str="Out of range - reset to limit";} +RESOURCE STRING sys_invalid_num {str="Number is not valid";} +RESOURCE STRING sys_invalid_margins { str="Invalid margins. Reset?"; } +RESOURCE STRING sys_invalid_char { str="Undiallable character"; } +RESOURCE STRING sys_out_of_range {str="Value out of range: %s = %s";} +/* as used in "Value out of range: Max = 20.45 */ + +RESOURCE STRING sys_edit_nchars {str="Maximum number of characters reached";} + +RESOURCE STRING sys_popout_help {str="Press Tab to change this item";} + +RESOURCE STRING sys_help_string {str="Help: %s";} + +RESOURCE STRING sys_replace_disk {str="Replace the application disk";} + +/* the prompts for a file selector and a pack selector */ +RESOURCE STRING sys_name {str="Name";} +RESOURCE STRING sys_pack {str="Disk";} + +/* part of the title line of a filelist */ +RESOURCE STRING sys_filelist_disk {str="Disk ";} + +RESOURCE STRING sys_flist_reset { str="File list reset"; } +RESOURCE STRING sys_device_memory { str="Internal"; } +RESOURCE STRING sys_path_is { str="Path is %s"; } +RESOURCE STRING sys_choose_directory { str="Choose a directory"; } +RESOURCE STRING sys_choose_filename { str="Choose a filename"; } +RESOURCE STRING sys_choose_new_directory { str="Directory already exists"; } +RESOURCE STRING sys_exists_over { str="File already exists: overwrite?"; } + +/* Next two strings have a maximum length of 5 characters each */ +RESOURCE STRING sys_max { str="Max"; } +RESOURCE STRING sys_min { str="Min"; } + +RESOURCE STRING sys_dec_places { str="Decimal places"; } +RESOURCE STRING sys_sig_digits { str="Significant digits"; } +RESOURCE STRING sys_evaldlg_title { str="Set \"Evaluate\" format"; } +RESOURCE STRING sys_nothing_to_eval { str="Nothing to evaluate"; } +RESOURCE STRING sys_toolong_to_eval { str="Too long to evaluate"; } + +RESOURCE STRING sys_xonxoff_string {str="XON/XOFF ";} +RESOURCE STRING sys_header_str { str="Enter header details"; } +RESOURCE STRING sys_footer_str { str="Enter footer details"; } + +/* max len of next 2 strs is 9 (including the space and the brackets) */ +RESOURCE STRING sys_centimetres { str=" (cm)"; } +RESOURCE STRING sys_inches { str=" (inches)"; } + +RESOURCE STRING sys_dev_notready { str=" Absent!"; } +RESOURCE STRING sys_dev_corrupt { str=" Unformatted!"; } +RESOURCE STRING sys_dev_unknown { str=" Unrecognised!"; } +RESOURCE STRING sys_dev_info { str=", %luK free"; } + +RESOURCE STRING sys_mtype_unknown { str="Unknown"; } +RESOURCE STRING sys_mtype_floppy { str="Floppy"; } +RESOURCE STRING sys_mtype_hard { str="Hard"; } +RESOURCE STRING sys_mtype_flash { str="Flash"; } +RESOURCE STRING sys_mtype_ram { str="Ram"; } +RESOURCE STRING sys_mtype_rom { str="Rom"; } +RESOURCE STRING sys_mtype_protected { str=""; } +/* Maximum of 14 character widths for the following 5 strings */ +RESOURCE STRING sys_files_tagged { str="(Tagged files)"; } +RESOURCE STRING sys_no_files { str="(No files)"; } +RESOURCE STRING sys_no_disk { str="(No disk)"; } +RESOURCE STRING sys_unformatted { str="(Unformatted)"; } +RESOURCE STRING sys_unrecognised { str="(Unrecognised)"; } + +RESOURCE STRING sys_sound_fail { str="Sound in use - please retry"; } + +/*********** THE ALLOWED SPECIAL KEYS FOR ACTION BUTTONS ******************/ + +/* You can translate the text, but no more than six characters each */ + +RESOURCE ACLIST_ARRAY sys_button_text + { + button= + { + PUSH_BUT + { + keycode=W_KEY_RETURN; + str="Enter"; + }, + PUSH_BUT + { + keycode=W_KEY_ESCAPE; + str="Esc"; + }, + PUSH_BUT + { + keycode=W_KEY_DELETE_LEFT; + str="Del"; + }, + PUSH_BUT + { + keycode=W_KEY_SPACE; + str="Space"; + }, + PUSH_BUT + { + keycode=W_KEY_UP; + str=; + }, + PUSH_BUT + { + keycode=W_KEY_DOWN; + str=; + }, + PUSH_BUT + { + keycode=W_KEY_RIGHT; + str=; + }, + PUSH_BUT + { + keycode=W_KEY_LEFT; + str=; + }, + PUSH_BUT + { + keycode=W_KEY_TAB; + str="Tab"; + }, + PUSH_BUT + { + keycode=W_KEY_MENU; + str="Menu"; + } + }; + } + + +/************************* ACTION LISTS ******************************/ + +/* Change the keycodes too, but don't lose the minus signs */ + +RESOURCE ACLIST_ARRAY sys_ac_no_yes + { + button = + { + PUSH_BUT + { + keycode=-'n'; + str="No"; + }, + PUSH_BUT + { + keycode='y'; + str="Yes"; + } + }; + } + +RESOURCE ACLIST_ARRAY sys_ac_continue + { + button = + { + PUSH_BUT + { + keycode=W_KEY_ESCAPE; + str="Continue"; + } + }; + } + +RESOURCE ACLIST_ARRAY sys_ac_abandon + { + button = + { + PUSH_BUT + { + keycode=W_KEY_ESCAPE; + str="Abandon"; + } + }; + } + +RESOURCE ACLIST_ARRAY sys_append_aclist + { + button = + { + PUSH_BUT + { + keycode=W_KEY_RETURN; + str="Append"; + } + }; + } + +/* Careful not to make the combined width of these strings much wider */ + +RESOURCE ACLIST_ARRAY sys_smart_dial_aclist + { + } + +RESOURCE ACLIST_ARRAY sys_freedial_aclist + { + button = + { + PUSH_BUT + { + keycode=W_KEY_DELETE_LEFT; + str="Clear"; + }, + PUSH_BUT + { + keycode=W_KEY_TAB; + str="Redial"; + } + }; + } + +/************************* CHOICE LISTS *****************************/ + +RESOURCE MENU sys_no_yes + { + items = + { + CHOICE_ITEM { str= "No";}, + CHOICE_ITEM { str="Yes";} + }; + } + +RESOURCE MENU sys_offon_menu + { + items = + { + CHOICE_ITEM { str="Off";}, + CHOICE_ITEM { str= "On";} + }; + } + +RESOURCE MENU sys_printer_units_chlist + { + items = + { + CHOICE_ITEM { str= "Inches";}, /* matches with E_IMPERIAL */ + CHOICE_ITEM { str= "Centimetres";} /* matches with E_METRIC */ + }; + } + +RESOURCE MENU sys_printer_device_chlist + { + items = + { + CHOICE_ITEM { str= "Parallel";}, + CHOICE_ITEM { str= "Serial";}, + CHOICE_ITEM { str= "File";} + }; + } + + +RESOURCE MENU sys_baud_rate_chlist + { + items = + { + CHOICE_ITEM { str= "19200";}, /* new for S3a */ + CHOICE_ITEM { str= "9600";}, + CHOICE_ITEM { str= "4800";}, + CHOICE_ITEM { str= "2400";}, + CHOICE_ITEM { str= "1200";}, + CHOICE_ITEM { str= "600";}, + CHOICE_ITEM { str= "300";} + }; + } + +RESOURCE MENU sys_data_bits_chlist + { + items = + { + CHOICE_ITEM { str="5";}, + CHOICE_ITEM { str="6";}, + CHOICE_ITEM { str="7";}, + CHOICE_ITEM { str="8";} + }; + } + +RESOURCE MENU sys_stop_bits_chlist + { + items = + { + CHOICE_ITEM { str="1";}, + CHOICE_ITEM { str="2";} + }; + } + +RESOURCE MENU sys_parity_chlist + { + items = + { + CHOICE_ITEM { str="None";}, + CHOICE_ITEM { str="Even";}, + CHOICE_ITEM { str= "Odd";} + }; + } + +RESOURCE MENU sys_format_chlist + { + items = + { + CHOICE_ITEM { str="Fixed";}, + CHOICE_ITEM { str="Scientific";}, + CHOICE_ITEM { str="General";}, + CHOICE_ITEM { str="Hexadecimal";} + }; + } + +RESOURCE MENU sys_rad_deg + { + items = + { + CHOICE_ITEM { str= "Radians";}, + CHOICE_ITEM { str= "Degrees";} + }; + } + +/* IMPORTANT, order in next array must be same as in page_size menu below */ +/* Also, at most 10 entries allowed, and the first two cannot be altered */ +/* But change any of the others, if you wish */ +/* 1 mm is 1440/25.4 units in the dimensions used, so eg 148 mm is 8391 */ +/* so you could have {width=8391; ... for one entry (an A5 letter size) */ + +RESOURCE PAGE_SIZE_ARRAY sys_page_dimensions + { + page_size= + { + PAGE_SIZE {width=PAGE_WIDTH_A4; length=PAGE_LENGTH_A4;}, + PAGE_SIZE {width=PAGE_WIDTH_A4; length=PAGE_LENGTH_A4;}, + PAGE_SIZE {width=PAGE_WIDTH_EXECUTIVE; length=PAGE_LENGTH_EXECUTIVE;}, + PAGE_SIZE {width=PAGE_WIDTH_LEGAL; length=PAGE_LENGTH_LEGAL;}, + PAGE_SIZE {width=PAGE_WIDTH_LETTER; length=PAGE_LENGTH_LETTER;}, + PAGE_SIZE {width=PAGE_WIDTH_MONARCH; length=PAGE_LENGTH_MONARCH;}, + PAGE_SIZE {width=PAGE_WIDTH_DL; length=PAGE_LENGTH_DL;} + }; + } + +RESOURCE MENU sys_page_size + { + items= + { + CHOICE_ITEM {str="A4";}, + CHOICE_ITEM {str="Custom";}, + CHOICE_ITEM {str="Executive";}, + CHOICE_ITEM {str="Legal";}, + CHOICE_ITEM {str="Letter";}, + CHOICE_ITEM {str="Monarch";}, + CHOICE_ITEM {str="DL";} + }; + } + +RESOURCE MENU sys_orient + { + items= + { + CHOICE_ITEM {str="Portrait";}, + CHOICE_ITEM {str="Landscape";} + }; + } + +RESOURCE MENU sys_prn_pos + { + items= + { + CHOICE_ITEM {str="Normal";}, + CHOICE_ITEM {str="Superscript";}, + CHOICE_ITEM {str="Subscript";} + }; + } + +RESOURCE MENU sys_headfoot_align + { + items= + { + CHOICE_ITEM {str="Left";}, + CHOICE_ITEM {str="Right";}, + CHOICE_ITEM {str="Centred";}, + CHOICE_ITEM {str="Justified";}, + CHOICE_ITEM {str="Two column";}, + CHOICE_ITEM {str="Three column";} + }; + } + +RESOURCE MENU sys_pgno_choice + { + items= + { + CHOICE_ITEM {str="1,2,3";}, + CHOICE_ITEM {str="I,II,III";}, + CHOICE_ITEM {str="i,ii,iii";} + }; + } + +/************************* DIALOGS ********************************/ + +RESOURCE DIALOG sys_error_dialog + { + flags=DLGBOX_RBUF_FILLED|DLGBOX_NO_DDP; + controls= + { + CONTROL + { + class=C_TEXTWIN; + flags=DLGBOX_ITEM_CENTRE|DLGBOX_ITEM_DEAD|DLGBOX_ITEM_UNDERLINED; + info=TXTMESS + { + flags=IN_TEXTWIN_AL_CENTRE; + }; + }, + CONTROL + { + class=C_TEXTWIN; + flags=DLGBOX_ITEM_CENTRE|DLGBOX_ITEM_DEAD; + info=TXTMESS + { + flags=IN_TEXTWIN_AL_CENTRE; + }; + }, + CONTROL + { + class=C_ACLIST; + info=ACLIST + { + rid=sys_ac_continue; + }; + } + }; + } + +RESOURCE DIALOG sys_query_dialog + { + flags = DLGBOX_ACTION_LIST|DLGBOX_REPORT_ACT_HORIZ; + controls= + { + CONTROL + { + class=C_TEXTWIN; + flags=DLGBOX_ITEM_CENTRE|DLGBOX_ITEM_DEAD|DLGBOX_ITEM_UNDERLINED; + info=TXTMESS + { + flags=IN_TEXTWIN_AL_CENTRE; + }; + }, + CONTROL + { + class=C_ACLIST; + info=ACLIST + { + rid=sys_ac_no_yes; + }; + } + }; + } + +RESOURCE DIALOG sys_printing_dialog + { + flags=DLGBOX_RBUF_FILLED; + controls= + { + CONTROL + { + class=C_TEXTWIN; + flags=DLGBOX_ITEM_CENTRE|DLGBOX_ITEM_DEAD|DLGBOX_ITEM_UNDERLINED; + info=TXTMESS + { + flags=IN_TEXTWIN_AL_CENTRE; + }; + }, + CONTROL + { + class=C_TEXTWIN; + flags=DLGBOX_ITEM_CENTRE|DLGBOX_ITEM_DEAD; + info=TXTMESS + { + flags=IN_TEXTWIN_AL_CENTRE; + }; + }, + CONTROL + { + class=C_ACLIST; + info=ACLIST + { + rid=sys_ac_abandon; + }; + } + }; + } + +RESOURCE DIALOG sys_set_port_dialog + { + title="Set Serial port"; + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_RBUF_FILLED; + controls= + { + CONTROL + { + class=C_CHLIST; + prompt="Baud rate"; + info=CHLIST + { + rid=sys_baud_rate_chlist; + nsel=0; + }; + }, + CONTROL + { + class=C_CHLIST; + prompt="Data bits"; + info=CHLIST + { + rid=sys_data_bits_chlist; + nsel=0; + }; + }, + CONTROL + { + class=C_CHLIST; + prompt="Stop bits"; + info=CHLIST + { + rid=sys_stop_bits_chlist; + nsel=0; + }; + }, + CONTROL + { + class=C_CHLIST; + prompt="Parity"; + info=CHLIST + { + rid=sys_parity_chlist; + nsel=0; + }; + }, + CONTROL + { + class=C_CHLIST; + prompt="Ignore parity"; + info=CHLIST + { + rid=sys_no_yes; + nsel=0; + }; + } + }; + } + +RESOURCE DIALOG sys_set_hshk_dialog + { + title="Set serial handshake"; + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_RBUF_FILLED; + controls= + { + CONTROL + { + class=C_CHLIST; + prompt="XON/XOFF"; + info=CHLIST + { + rid=sys_offon_menu; + nsel=0; + }; + }, + CONTROL + { + class=C_CHLIST; + prompt="RTS/CTS"; + info=CHLIST + { + rid=sys_offon_menu; + nsel=0; + }; + }, + CONTROL + { + class=C_CHLIST; + prompt="DSR/DTR"; + info=CHLIST + { + rid=sys_offon_menu; + nsel=0; + }; + }, + CONTROL + { + class=C_CHLIST; + prompt="DCD"; + info=CHLIST + { + rid=sys_offon_menu; + nsel=0; + }; + } + }; + } + +RESOURCE DIALOG sys_printer_config_dialog + { + title="Printer configuration"; + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_SMALL_FONT; + controls= + { + CONTROL + { + class=C_CHLIST; + prompt="Printer device"; + flags=DLGBOX_ITEM_NOTIFY_CHANGED; + info=CHLIST + { + rid=sys_printer_device_chlist; + }; + }, + CONTROL + { + class=C_TEXTWIN; + prompt="Serial setup"; + info=TXTMESS + { + str="19200 "; /* changed for S3a */ + flags=IN_TEXTWIN_POPOUT; + }; + }, + CONTROL + { + class=C_TEXTWIN; + prompt="Handshaking"; + info=TXTMESS + { + str="XON/XOFF Off "; + flags=IN_TEXTWIN_POPOUT; + }; + }, + CONTROL + { + flags=DLGBOX_ITEM_NEEDS_PACK|DLGBOX_ITEM_NOTIFY_CHANGED; + class=C_FNEDIT; + prompt="File:"; + info=FNEDIT { flags=IN_FNEDIT_NO_AUTOQUERY; }; + }, + CONTROL + { + class=C_CHLIST; + prompt="Units"; + info=CHLIST + { + rid=sys_printer_units_chlist; + }; + } + }; + } + +RESOURCE DIALOG sys_eval_dialog + { + title="Set Calculator format"; + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_RBUF_FILLED; + controls= + { + CONTROL + { + flags=DLGBOX_ITEM_NOTIFY_CHANGED; + class=C_CHLIST; + prompt="Format"; + info=CHLIST { rid=sys_format_chlist; }; + }, + CONTROL + { + class=C_NCEDIT; + /* The following line must be the wider of the 2 above strings */ + /* sys_dec_places and sys_sig_digits */ + prompt="Significant digits"; + info=NCEDIT + { + high=12; + low=0; + }; + }, + CONTROL + { + class=C_CHLIST; + prompt="Trigonometry units"; + info=CHLIST { rid=sys_rad_deg; }; + } + }; + } + +RESOURCE DIALOG sys_country_selector_dialog + { + title="Append country"; + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_ACTION_LIST|DLGBOX_RBUF_FILLED; + controls= + { + CONTROL + { + class=C_WLDSELWN; + prompt="Country"; + info=WLDSELWN {flags=IN_WLDSELWN_COUNTRY|IN_WLDSELWN_SETHOME; }; + }, + CONTROL + { + class=C_ACLIST; + info=ACLIST + { + rid=sys_append_aclist; + }; + } + }; + } + +RESOURCE CONTROL sys_smart_dial_item + { + class=C_TEXTWIN; + prompt=; + flags=DLGBOX_ITEM_DEAD; + info=TXTMESS + { + str=" "; + }; + } + +RESOURCE DIALOG sys_smart_dial_dialog + { + flags=DLGBOX_RBUF_FILLED|DLGBOX_NOTIFY_ENTER|DLGBOX_SMALL_FONT|DLGBOX_NOTIFY_ALL_ACT; + controls= + { + CONTROL + { + class=C_TEXTWIN; + flags=DLGBOX_ITEM_CENTRE|DLGBOX_ITEM_DEAD|DLGBOX_ITEM_UNDERLINED; + info=TXTMESS + { + flags=IN_TEXTWIN_AL_CENTRE; + str="Number to dial"; + }; + }, + CONTROL + { + class=C_ACLIST; + info=ACLIST + { + rid=sys_ac_continue; + }; + } + }; + } + +RESOURCE DIALOG sys_freedial_dialog + { + title="Free-form dialling"; + flags = DLGBOX_NO_WAIT|DLGBOX_NO_DDP; + controls= + { + CONTROL + { + class=C_FREEDIAL; + prompt=; + }, + CONTROL + { + class=C_ACLIST; + info=ACLIST + { + rid=sys_freedial_aclist; + }; + } + }; + } + +RESOURCE DIALOG sys_flist_dialog + { + title="Specify filelist"; + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_RBUF_FILLED; + controls= + { + CONTROL + { + class=C_EDWIN; + prompt="Filename pattern"; + info=EDWIN + { + maxlen=P_FNAMESIZE; + vulen=18; + flags=IN_EDWIN_VULEN_CHARACTERS; + }; + }, + CONTROL + { + class=C_EDWIN; + prompt="Full path"; + info=EDWIN + { + maxlen=P_FNAMESIZE; + vulen=18; + flags=IN_EDWIN_VULEN_CHARACTERS; + }; + } + }; + } + +RESOURCE DIALOG sys_print_control_dl + { + title="Print setup"; + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_NOTIFY_ESCAPE|DLGBOX_SMALL_FONT; + controls= + { + CONTROL + { + class=C_TEXTWIN; + prompt="Page size"; + info=TXTMESS + { + str=""; + flags=IN_TEXTWIN_POPOUT; + }; + }, + CONTROL + { + class=C_TEXTWIN; + prompt="Margins"; + info=TXTMESS + { + str=""; + flags=IN_TEXTWIN_POPOUT; + }; + }, + CONTROL + { + class=C_TEXTWIN; + prompt="Header"; + info=TXTMESS + { + str=""; + flags=IN_TEXTWIN_POPOUT; + }; + }, + CONTROL + { + class=C_TEXTWIN; + prompt="Footer"; + info=TXTMESS + { + str=""; + flags=IN_TEXTWIN_POPOUT; + }; + }, + CONTROL + { + class=C_TEXTWIN; + prompt="Paging"; + info=TXTMESS + { + str=""; + flags=IN_TEXTWIN_POPOUT; + }; + }, + CONTROL + { + class=C_TEXTWIN; + prompt="Printer"; + info=TXTMESS + { + str=""; + flags=IN_TEXTWIN_POPOUT; + }; + } + }; + } + +RESOURCE DIALOG sys_paging_control_dl + { + title="Paging control"; + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_RBUF_FILLED; + controls= + { + CONTROL + { + class=C_NCEDIT; + prompt="Number for first page"; + info=NCEDIT + { + low=1; + high=9999; + }; + }, + CONTROL + { + class=C_CHLIST; + prompt="Allow widows/orphans"; + info=CHLIST{rid=sys_no_yes;}; + }, + CONTROL + { + class=C_CHLIST; + prompt="Page number style"; + info=CHLIST{rid=sys_pgno_choice;}; + } + }; + } + +RESOURCE DIALOG sys_printer_model + { + title="Set printer"; + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_RBUF_FILLED; + controls= + { + CONTROL + { + prompt="Printer"; + flags=DLGBOX_ITEM_NOTIFY_CHANGED; + class=C_CHLIST; + info=CHLIST{}; + }, + CONTROL + { + class=C_TEXTWIN; + prompt="Default"; + info=TXTMESS + { + flags=IN_TEXTWIN_POPOUT; + }; + } + }; + } + +RESOURCE DIALOG sys_margins_dl + { + title="Margins"; + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_RBUF_FILLED|DLGBOX_APPEND_UNITS_TITLE; + controls= + { + CONTROL + { + class=C_FLTEDIT; + prompt="Top"; + info=FLTEDIT + { + low=0; + high=9.99; + ndec=2; + }; + }, + CONTROL + { + class=C_FLTEDIT; + prompt="Left"; + info=FLTEDIT + { + low=0; + high=9.99; + ndec=2; + }; + }, + CONTROL + { + class=C_FLTEDIT; + prompt="Right"; + info=FLTEDIT + { + low=0; + high=9.99; + ndec=2; + }; + }, + CONTROL + { + class=C_FLTEDIT; + prompt="Bottom"; + info=FLTEDIT + { + low=0; + high=9.99; + ndec=2; + }; + } + }; + } + +RESOURCE DIALOG sys_headfoot_dl + { + title="*"; + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_RBUF_FILLED|DLGBOX_APPEND_UNITS_TITLE; + controls= + { + CONTROL + { + class=C_EDWIN; + prompt="Text"; + info=EDWIN + { + flags=IN_EDWIN_VULEN_CHARACTERS|IN_EDWIN_ACCEPT_TABS; + maxlen=80; + vulen=20; + }; + }, + CONTROL + { + class=C_CHLIST; + prompt="Alignment"; + info=CHLIST{rid=sys_headfoot_align;}; + }, + CONTROL + { + class=C_CHLIST; + prompt="On first page"; + info=CHLIST{rid=sys_no_yes;}; + }, + CONTROL + { + class=C_TEXTWIN; + prompt="Font"; + info=TXTMESS + { + flags=IN_TEXTWIN_POPOUT; + }; + }, + CONTROL + { + class=C_FLTEDIT; + prompt="Vertical offset"; + info=FLTEDIT + { + low=0; + high=9.99; + ndec=2; + }; + } + }; + } + +RESOURCE DIALOG sys_pagesize_dl + { + title="Page size"; + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_RBUF_FILLED|DLGBOX_APPEND_UNITS_TITLE; + controls= + { + CONTROL + { + class=C_CHLIST; + flags=DLGBOX_ITEM_NOTIFY_CHANGED; + prompt="Page size"; + info=CHLIST{rid=sys_page_size;}; + }, + CONTROL + { + class=C_FLTEDIT; + prompt="Width"; + info=FLTEDIT + { + low=1; + high=45; + ndec=2; + }; + }, + CONTROL + { + class=C_FLTEDIT; + prompt="Height"; + info=FLTEDIT + { + low=1; + high=45; + ndec=2; + }; + }, + CONTROL + { + class=C_CHLIST; + prompt="Orientation"; + info=CHLIST{rid=sys_orient;}; + } + }; + } + +RESOURCE DIALOG sys_font_dl + { + title="Font"; + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_RBUF_FILLED|DLGBOX_SMALL_FONT; + controls= + { + CONTROL + { + flags=DLGBOX_ITEM_NOTIFY_CHANGED; + class=C_CHLIST; + prompt="Font"; + info=CHLIST{}; + }, + CONTROL + { + class=C_CHLIST; + prompt="Size"; + info=CHLIST{}; + }, + CONTROL + { + class=C_CHLIST; + prompt="Underline"; + info=CHLIST{rid=sys_no_yes;}; + }, + CONTROL + { + class=C_CHLIST; + prompt="Bold"; + info=CHLIST{rid=sys_no_yes;}; + }, + CONTROL + { + class=C_CHLIST; + prompt="Italic"; + info=CHLIST{rid=sys_no_yes;}; + }, + CONTROL + { + class=C_CHLIST; + prompt="Print position"; + info=CHLIST{rid=sys_prn_pos;}; + } + }; + } + +RESOURCE CONTROL sys_txtmess + { + class=C_TEXTWIN; + flags=DLGBOX_ITEM_CENTRE|DLGBOX_ITEM_DEAD; + info=TXTMESS + { + flags=IN_TEXTWIN_AL_CENTRE; + }; + } + +/************************* HELP ********************************/ + +RESOURCE TOPIC_ARRAY sys_help_index_data +{ +id_lst= +{ +sys_help_on_off, +sys_time_basics, +sys_help_infrared, +sys_help_edit, +sys_help_dialog, +sys_help_statwin, +sys_help_files, +sys_help_filsels, +sys_help_evaluate, +sys_help_print, +sys_help_in_use, +sys_help_appnotready, +sys_help_no_sys_mem +}; +} + +RESOURCE HELP_ARRAY sys_help_index +{ +topic="Index"; +topic_id=sys_help_index_data; +} + +RESOURCE HELP_ARRAY sys_help_on_help +{ +topic="About Help"; +strlst= +{ +STRING {str="To choose a topic:""then Enter";}, +STRING {str="";}, +STRING {str="Esc returns to previous Help";}, +STRING {str="screen";}, +STRING {str="Control-Esc exits Help";}, +STRING {str="";}, +STRING {str="Control-Help for an index";}, +STRING {str="(works from main application";}, +STRING {str="screen)";} +}; +} + +RESOURCE HELP_ARRAY sys_help_dialog +{ +topic="Menu/dialog tips"; +strlst= +{ +STRING {str="Press Menu key to see a menu, use";}, +STRING {str=""" to select an option, then";}, +STRING {str="press Enter";}, +STRING {str="";}, +STRING {str="Use hot-key, eg ""-N, listed beside";}, +STRING {str="option to access it directly (hold";}, +STRING {str="down "" and press letter)";}, +STRING {str="";}, +STRING {str="Tab often lists choices available";}, +STRING {str="on dialog lines with arrows";} +}; +} + +RESOURCE HELP_ARRAY sys_help_statwin +{ +topic="Screen display"; +strlst= +{ +STRING {str="Use Fn-> and Fn-< to change";}, +STRING {str="contrast";}, +STRING {str="";}, +STRING {str="Press "" to switch between";}, +STRING {str="screens in an application";}, +STRING {str="";}, +STRING {str="Use `Zoom in/out' to change";}, +STRING {str="character size";}, +STRING {str="";}, +STRING {str="Press ""-Menu for a temporary";}, +STRING {str="Information window";}, +STRING {str="In some applications Control-Menu";}, +STRING {str="may turn an Information window";}, +STRING {str="on/off permanently";} +}; +} + +RESOURCE HELP_ARRAY sys_help_dialling +{ +} + +RESOURCE HELP_ARRAY sys_help_filsels +{ +topic="File selection"; +strlst= +{ +STRING {str="Press Tab in dialogs to choose";}, +STRING {str="from a full list of files/directories,";}, +STRING {str="then:";}, +STRING {str="Typing matches with filenames";}, +STRING {str="Shift+letter matches directories";}, +STRING {str="Control+letter matches disks";}, +STRING {str="";}, +STRING {str="Press Tab on System screen for";}, +STRING {str="File selector:";}, +STRING {str="Menu then gives file/directory";}, +STRING {str="options. Use +- (or Shift-"") to";}, +STRING {str="tag/untag files";}, +STRING {str=<158><246>" tag/untag all files";}, +STRING {str="";}, +STRING {str="In `File' dialogs:";}, +STRING {str="""-Tab gives full path of file";}, +STRING {str="To select multiple files, press";}, +STRING {str="Control-Tab, type the `Filename";}, +STRING {str="pattern', then press Control-Enter";} +}; +} + +RESOURCE HELP_ARRAY sys_help_edit +{ +topic="Editing"; +strlst= +{ +STRING {str="Use "" to move cursor";}, +STRING {str="Control and "" with "" keys";}, +STRING {str="increase movement";}, +STRING {str="";}, +STRING {str="Shift-"" highlights text, then";}, +STRING {str="use:";}, +STRING {str="Del to cut it to the clipboard (or";}, +STRING {str="`Copy' to copy it), then `Insert' to";}, +STRING {str="paste the text back in; use";}, +STRING {str="Shift-Del to delete text without";}, +STRING {str="changing what's on the clipboard";}, +STRING {str="";}, +STRING {str="To copy text from another";}, +STRING {str="application: highlight text to copy";}, +STRING {str="in the other application, then use";}, +STRING {str="`Bring' option to insert text at";}, +STRING {str="cursor position";}, +STRING {str="";}, +STRING {str="Quick delete methods (without";}, +STRING {str="highlighting):";}, +STRING {str="Shift-Del: character forwards";}, +STRING {str="Shift-""-Del: to end of line";}, +STRING {str="""-Del: to beginning of line";}, +STRING {str="";}, +STRING {str="Quick highlight methods:";}, +STRING {str="Shift-Control-Home: current word";}, +STRING {str="Shift-Control-End: current";}, +STRING {str="paragraph";} +}; +} + +RESOURCE TOPIC_ARRAY sys_help_x_help +{ +id_lst= +{ +sys_help_on_help +}; +} + +RESOURCE HELP_ARRAY sys_help_files +{ +topic="Files"; +strlst= +{ +STRING {str="To work on files, see options on";}, +STRING {str="`File' menu in application:";}, +STRING {str="";}, +STRING {str="`New file' to create files";}, +STRING {str="";}, +STRING {str="`Open file' to open files (or";}, +STRING {str="highlight and press Enter on";}, +STRING {str="System screen; press Shift-Enter";}, +STRING {str="to open without closing previous";}, +STRING {str="file)";}, +STRING {str="";}, +STRING {str="`Merge in', `Compress file', `Save'";}, +STRING {str="and `Revert' options are in relevant";}, +STRING {str="applications";}, +STRING {str="";}, +STRING {str="Other file operations are done on";}, +STRING {str="System screen:";}, +STRING {str="Copying, deleting, renaming,";}, +STRING {str="backing up & restoring file(s)";}, +STRING {str="Note: to copy Data or Agenda files,";}, +STRING {str="use `Save as' in application to";}, +STRING {str="create compressed copy of file";}, +STRING {str="";}, +STRING {str="To exit file: highlight bold filename";}, +STRING {str="on System screen and press Del";} +}; +} + +RESOURCE HELP_ARRAY sys_help_print +{ +topic="Printing/previewing"; +strlst= +{ +STRING {str="In applications which can Print,";}, +STRING {str="first use `Print setup' on `Special'";}, +STRING {str="menu to set `Printer Model'";}, +STRING {str="";}, +STRING {str="Use `Print preview' to see a";}, +STRING {str="preview; it has its own menu of";}, +STRING {str="options (including `Print'). (You";}, +STRING {str="don't have to wait for the preview";}, +STRING {str="to finish calculating: Esc cancels,";}, +STRING {str="etc.)";}, +STRING {str="";}, +STRING {str="Use %D and %T in headers and";}, +STRING {str="footers (part of `Print setup') to";}, +STRING {str="print the date and time";}, +STRING {str="automatically";}, +STRING {str="Other codes include:";}, +STRING {str="%Ffor the filename";}, +STRING {str="%Pfor the page number";}, +STRING {str="%%for a%character";}, +STRING {str="%Mfor total pages in file, eg";}, +STRING {str="`Page %P of %M' (Word and Sheet";}, +STRING {str="applications only)";} +}; +} + +RESOURCE HELP_ARRAY sys_time_basics +{ +topic="Time basics"; +strlst= +{ +STRING {str="In Time, set `Home city', then set";}, +STRING {str="`Time and date'";}, +STRING {str="";}, +STRING {str="Set `Summer times' on/off when";}, +STRING {str="they change";}, +STRING {str="";}, +STRING {str="Use `Formats' to set 12/24 hour";}, +STRING {str="clocks";} +}; +} + +RESOURCE HELP_ARRAY sys_help_on_off +{ +topic="Turning on & off"; +strlst= +{ +STRING {str="ON/CE (or an application button)";}, +STRING {str="turns on; OFF turns off";} +}; +} + +RESOURCE TOPIC_ARRAY sys_help_x_index +{ +id_lst= +{ +sys_help_index +}; +} + +/************************* LATER ADDITIONS ********************************/ + +/* Name of general printer driver */ +RESOURCE STRING sys_wdr_general { str="General"; } + +RESOURCE STRING sys_dial_out { str="9,"; } /* 5 chars max */ + +RESOURCE STRING sys_skipping_page { str="(skipping page %u)";} + +/************************* NEW FOR XWIM ********************************/ + +/* TTT: Only used by developers */ +RESOURCE STRING sys_debugging_num_cells {str="Diagnostics: %d (%u)";} + +/********* for Calendar Window in Agenda **********/ + +/* TTT: eg "Calendar 1998" or "Calendar 1993-1994" */ +RESOURCE STRING sys_calendar {str="Calendar %Y";} + +/*********************** FOR PRINT PREVIEW ******************************/ +/* TTT: "Print preview" option in Word, Agenda, Sheet... uses these: */ +RESOURCE STRING sys_page {str="page";} +RESOURCE STRING sys_pages {str="pages";} +RESOURCE STRING sys_preview_busy {str="Busy, cannot print yet";} +RESOURCE STRING sys_display_margins {str="Show margins";} +RESOURCE STRING sys_hide_margins {str="Hide margins";} + +RESOURCE STRING sys_opening_prompt {str="Opening \"%s\"";} + +/* TTT: NB "Print preview" is a standard WP term... if every Wp in your +country uses one term for this, you must use it too */ +RESOURCE STRING sys_print_preview {str="Print preview";} + +/* TTT length of longest in sys_preview_margins_chlist + length of longest +in sys_preview_options_chlist must be less than 50 */ +RESOURCE MENU sys_preview_margins_chlist + { + items= + { + CHOICE_ITEM {str="Margins off";}, + CHOICE_ITEM {str="Margins on";} + }; + } + +RESOURCE MENU sys_preview_options_chlist + { + items= + { + CHOICE_ITEM {str="Facing pages";}, + CHOICE_ITEM {str="1 page";}, + CHOICE_ITEM {str="2 pages";}, + CHOICE_ITEM {str="3 pages";}, + CHOICE_ITEM {str="4 pages";} + }; + } + +RESOURCE DIALOG sys_preview_options_dialog + { + title="Display"; + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_RBUF_FILLED|DLGBOX_NO_DDP; + controls= + { + CONTROL + { + class=C_CHLIST; + prompt=""; + info=CHLIST{rid=sys_preview_options_chlist;}; + } + }; + } + +RESOURCE DIALOG sys_preview_jump_dialog + { + title="Jump to page"; + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_RBUF_FILLED|DLGBOX_NO_DDP; + controls= + { + CONTROL + { + class=C_NCEDIT; + prompt="Page number"; + info=NCEDIT + { + low=1; + high=9999; + }; + } + }; + } + +RESOURCE WSERV_INFO sys_preview_acc + { + menbar_id=sys_preview_menubar; + first_com=O_PVC_PREVIEW_PRINT; + accel= + { + 'p', /* Print */ + 'm', /* Margins */ + 'd', /* Pages to display */ + 'j', /* Jump to page */ + '?' /* Exit preview */ + }; + } + +RESOURCE MENU_BAR sys_preview_menubar + { + items = + { + MENU_BAR_ITEM + { + menu_id=sys_preview_menu; + mb_item="Preview"; + } + }; + } + +RESOURCE MENU sys_preview_menu + { + items = + { + MENU_ITEM + { + com_id=O_PVC_PREVIEW_PRINT; + mn_item="Print"; + }, + MENU_ITEM + { + com_id=O_PVC_PREVIEW_MARGINS; +/* TTT: use whichever's the longer: "Show margins" or "Hide margins" */ + mn_item="Show margins"; + }, + MENU_ITEM + { + com_id=O_PVC_PREVIEW_OPTIONS; + mn_item="Pages to display"; + }, + MENU_ITEM + { + com_id=O_PVC_PREVIEW_JUMP|BREAK_LINE_FOLLOWS; + mn_item="Jump to page"; + }, + MENU_ITEM + { + com_id=O_PVC_PREVIEW_EXIT; + mn_item="Exit preview"; + } + }; + } + +RESOURCE MENU sys_printer_devices + { + items = + { + CHOICE_ITEM { str= "Parallel";}, + CHOICE_ITEM { str= "Serial";}, + CHOICE_ITEM { str= "File";}, + CHOICE_ITEM { str= "Fax";} + }; + } + +RESOURCE CONTROL sys_print_control_device + { + class=C_TEXTWIN; +/* TTT: You'll see this on the bottom of the Print Setup dialog +in Word, Agenda... */ + prompt="Device"; + info=TXTMESS + { + str=""; + flags=IN_TEXTWIN_POPOUT; + }; + } + +RESOURCE CONTROL sys_print_preview_settings + { +/* TTT: You'll see this on the bottom of the Printer configuration dialog +in the Shell */ + class=C_TEXTWIN; + prompt="Print preview"; + info=TXTMESS + { + str="Facing pages,Margins off"; /* TTT widest possible */ + flags=IN_TEXTWIN_POPOUT; + }; + } + +RESOURCE DIALOG sys_preview_settings_dl + { + title="Preview settings"; + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_RBUF_FILLED; + controls= + { + CONTROL + { + class=C_CHLIST; + prompt="Display"; + info=CHLIST{rid=sys_preview_options_chlist;}; + }, + CONTROL + { + class=C_CHLIST; + prompt="Margins"; + info=CHLIST{rid=sys_offon_menu;}; + } + }; + } + +RESOURCE MENU sys_standard_sounds + { + items= + { +/* TTT: Built-in sounds, when you're setting an alarm in Time */ + CHOICE_ITEM {str="Alert";}, + CHOICE_ITEM {str="Phone";}, + CHOICE_ITEM {str="Chime";}, + CHOICE_ITEM {str="Fanfare";}, + CHOICE_ITEM {str="Cavalry";}, + CHOICE_ITEM {str="Signal";} + }; + } + +/* TTT: do not translate */ +RESOURCE STRING sys_alarm_standard_name {str="SYS$AL01";} +/* TTT: The "silent" sound, when setting an alarm */ +RESOURCE STRING sys_silent_alarm {str="Silent";} +/* TTT: If you try to play a sound, but sound is disabled... */ +RESOURCE STRING sys_sound_disabled {str="Sound disabled";} +/* TTT: do not translate the next one */ +RESOURCE STRING sys_word_rom { str="ROM::WORD.APP"; } +/* TTT: the user has refused to replace an SSD */ +RESOURCE STRING sys_restart_from_sys { str="Press Esc to exit application"; } + +/* TTT: when creating a new file: eg gives "Myfile" created +You can change these around if you like, eg we could've done the English +as str="Created \"%s\"" to give Created "Myfile" */ +RESOURCE STRING srt_file_created { str="\"%s\" created"; } +RESOURCE STRING srt_file_opened { str="\"%s\" opened"; } +RESOURCE STRING srt_file_saved { str="\"%s\" saved"; } +RESOURCE STRING srt_file_compressed { str="\"%s\" compressed"; } +RESOURCE STRING srt_file_merged { str="\"%s\" merged in"; } +RESOURCE STRING sys_saving_prompt {str="Saving \"%s\"";} +RESOURCE STRING sys_reloading_prompt {str="Reopening \"%s\"";} +RESOURCE STRING sys_converting_prompt {str="Converting \"%s\"";} + +/* TTT: When we refuse to save the file, because it hasn't changed */ +RESOURCE STRING sys_not_changed {str="Not changed";} +/* TTT: When you're exiting, but it failed to save the file for some reason */ +RESOURCE STRING sys_confirm_continue {str="Not saved, continue anyway?";} +/* TTT: When you're using the "Exit, lose changes" option: */ +RESOURCE STRING sys_confirm_change_loss {str="Confirm the loss of all changes";} +/* TTT: used with the previous two strings */ +RESOURCE STRING sys_losing_changes {str="(`Yes' discards all changes)";} +RESOURCE STRING sys_nothing_to_print {str="Nothing to print";} +RESOURCE STRING sys_nothing_to_insert {str="Nothing to insert";} +RESOURCE STRING sys_nothing_to_copy {str="Nothing to copy";} +/* TTT: preferably use the same word as the "Revert" menu option */ +RESOURCE STRING sys_revert_to_saved {str="Revert to saved?";} + +/* TTT: For use in menus (hotkeys) */ +RESOURCE STRING sys_shift_key_name {str="Shift";} + +/* TTT: When you use "Current country only" (or diamond key) World App... */ +RESOURCE STRING srt_space_only { str=""; } + +RESOURCE STRING sys_change_password {str="Change password";} + +RESOURCE DIALOG sys_set_password_dl + { + title = "Set password"; + flags=DLGBOX_NOTIFY_ENTER; + controls= + { + CONTROL + { + class=C_XEDIT; + prompt="Enter password"; + }, + CONTROL + { + class=C_XEDIT; + prompt="Confirm password"; + } + }; + } + +RESOURCE DIALOG sys_get_password_dl + { + title = "Password protected"; + flags=DLGBOX_NOTIFY_ENTER; + controls= + { + CONTROL + { + class=C_XEDIT; + prompt="Enter password"; + } + }; + } + +/* TTT Extra help - translate this! */ +/* BUT DON'T MAKE THE TEXT WIDER THAN WILL FIT ON COMPATIBILITY MODE SCREENS +(BEAR IN MIND THAT THIS HELP IS AVAILABLE TO COMPATIBILITY MODE APP) */ + +RESOURCE HELP_ARRAY sys_help_evaluate +{ +topic="Calculations"; +strlst= +{ +STRING {str="Type a calculation (without an =";}, +STRING {str="sign or spaces), then use";}, +STRING {str="`Evaluate' on `Edit' menu for result";}, +STRING {str="";}, +STRING {str="Note: multiply appears as * and";}, +STRING {str="divide as / on screen, even if you";}, +STRING {str="used the "<158>" and "<246>" keys to enter";}, +STRING {str="them";} +}; +} + +RESOURCE HELP_ARRAY sys_help_memo +{ +topic="Memo editor"; +strlst= +{ +STRING {str="This is like the Word Processor";}, +STRING {str="without a `File' menu. Put cursor on";}, +STRING {str="entry and use `Edit memo' in";}, +STRING {str="Agenda to create a memo for an";}, +STRING {str="entry";}, +STRING {str="";}, +STRING {str="Agenda memos can be up to 4K";}, +STRING {str="long. One set of styles is kept for";}, +STRING {str="all memos in an Agenda file";}, +STRING {str="";}, +STRING {str="Use `Password' to protect a memo";}, +STRING {str="and use it again to remove or";}, +STRING {str="change the password";}, +STRING {str="";}, +STRING {str="Use `Exit' when you've finished the";}, +STRING {str="memo";}, +STRING {str="";}, +STRING {str="To delete a memo, edit it, delete all";}, +STRING {str="text in Memo editor (`Highlight all";}, +STRING {str="text', then press Del key) and";}, +STRING {str="`Exit'";} +}; +} + +RESOURCE HELP_ARRAY sys_help_in_use +{ +topic="File or device in use"; +strlst= +{ +STRING {str="You will see this message if you";}, +STRING {str="try to copy, delete or rename a file";}, +STRING {str="which is open (ie in bold on the";}, +STRING {str="System screen). Exit the file first";}, +STRING {str="";}, +STRING {str="You will also see it if you have used";}, +STRING {str="`Communications' in System screen";}, +STRING {str="to set `Serial cable', and then try to";}, +STRING {str="print to a serial port printer";}, +STRING {str="Set `Use' line in `Communications'";}, +STRING {str="to `None' before printing";} +}; +} + +RESOURCE HELP_ARRAY sys_help_no_sys_mem +{ +topic="No system memory"; +strlst= +{ +STRING {str="This message usually means all";}, +STRING {str="your Internal memory has been";}, +STRING {str="used up. Exit some open files, or";}, +STRING {str="delete unwanted files from the";}, +STRING {str="Internal disk, to free some more";}, +STRING {str="memory";}, +STRING {str="";}, +STRING {str="It may also appear if a Word or";}, +STRING {str="Sheet file reaches its maximum";}, +STRING {str="size. In this case internal memory";}, +STRING {str="is probably NOT full - the message";}, +STRING {str="means the application has reached";}, +STRING {str="its memory limit. You will need to";}, +STRING {str="split the file";}, +STRING {str="";}, +STRING {str="(If an Agenda has repeating";}, +STRING {str="entries, `Find' and `Print preview'";}, +STRING {str="may also temporarily cause the";}, +STRING {str="Agenda to reach its memory limit";}, +STRING {str="and display this message)";} +}; +} + +RESOURCE HELP_ARRAY sys_help_calendar +{ +topic="Calendars"; +strlst= +{ +STRING {str="Whenever you are entering a date";}, +STRING {str="in a dialog, you can press Tab to";}, +STRING {str="display a calendar";}, +STRING {str="";}, +STRING {str="In the calendars:";}, +STRING {str=""" move the cursor around the";}, +STRING {str="screen";}, +STRING {str="Psion-"" move a month at a time";}, +STRING {str="Shift-"" (or <>) move one day at a";}, +STRING {str="time";}, +STRING {str="Shift-"" move by weeks";}, +STRING {str="Control-"" move by months";}, +STRING {str="Control-"" move by years";}, +STRING {str="";}, +STRING {str="Spacebar moves to today";} +}; +} + +/************************* NEW FOR Workabout **************************/ +/* INCLUDED IN ALL BUILDS, BUT DUMMY RESOURCES USED FOR OTHER BUILDS */ + +RESOURCE DIALOG sys_s3c_print_control_dl + { + title=""; + } + + RESOURCE STRING sys_s3c_page_setup { str=""; } + +RESOURCE HELP_ARRAY sys_help_battery +{ + topic=""; +} + +/************************* NEW FOR Siena ******************************/ +/* INCLUDED IN ALL BUILDS, BUT DUMMY RESOURCES USED FOR OTHER BUILDS */ + +RESOURCE DIALOG sys_vine_file_info_dl + { + title="Last modified"; + controls= + { + CONTROL + { + class=C_TEXTWIN; + flags=DLGBOX_ITEM_DEAD; + prompt="Time"; + info=TXTMESS{ }; + }, + CONTROL + { + class=C_TEXTWIN; + flags=DLGBOX_ITEM_DEAD; + prompt="Date"; + info=TXTMESS{ }; + } + }; + } + +RESOURCE KEYLIST sys_russian_keys +{ +/* Used in Russian model to map between keyboard modes (latin and cyrillic) + + Used by Siena to map menu keys < > and , to . ? and ' + This is necessary when menu is on screen and user presses unmodified key + hoping to highlight relevent menu option +*/ + + list= + { + KEYPAIR { latin='<'; cyril=','; }, + KEYPAIR { latin='>'; cyril='.'; }, + KEYPAIR { latin='?'; cyril=39; } + }; +} + +RESOURCE HELP_ARRAY sys_help_infrared +{ +topic="Infrared"; +strlst= +{ +STRING {str="Lets you copy information to and";}, +STRING {str="from another Psion that has";}, +STRING {str="Infrared";}, +STRING {str="";}, +STRING {str="To turn Infrared on: select";}, +STRING {str="`Communications' in System screen";}, +STRING {str="and set `Use' line to `Infrared'";}, +STRING {str="Note: leave `Power setting' set to";}, +STRING {str="`High'";}, +STRING {str="";}, +STRING {str="To use Infrared: select data to";}, +STRING {str="copy, then transfer it";}, +STRING {str="";}, +STRING {str="To select a:";}, +STRING {str="* File - highlight name in System";}, +STRING {str="screen";}, +STRING {str="* Agenda entry - put cursor on";}, +STRING {str="entry. (Copied entry will have same";}, +STRING {str="date, time and alarm as original)";}, +STRING {str="* Data entry - find entry, or";}, +STRING {str="highlight specific text in an entry";}, +STRING {str="* Information in other applications";}, +STRING {str="- just highlight text in Word &";}, +STRING {str="Program, calculation or result in";}, +STRING {str="Calc, or cell(s) in Sheet";}, +STRING {str="";}, +STRING {str="To transfer the data:";}, +STRING {str="Point Siena and other Psion at each";}, +STRING {str="other and make sure they are less";}, +STRING {str="than 60cm (2 feet) apart";}, +STRING {str="Press "" button on sending Siena";}, +STRING {str="On receiving Siena, move to";}, +STRING {str="appropriate application for";}, +STRING {str="information, or System screen to";}, +STRING {str="receive a whole file, then press """;}, +STRING {str="button";} +}; +} + +RESOURCE HELP_ARRAY sys_help_appnotready +{ +topic="Application not ready"; +strlst= +{ +STRING {str="You will see this message if you";}, +STRING {str="try to use Infrared when:";}, +STRING {str="";}, +STRING {str="* a dialog is on screen in the";}, +STRING {str="receiving application";}, +STRING {str="";}, +STRING {str="* Help is on screen in the receiving";}, +STRING {str="application";}, +STRING {str="";}, +STRING {str="* the receiving application does";}, +STRING {str="not support Infrared";}, +STRING {str="";}, +STRING {str="* the receiving application is";}, +STRING {str="\"busy\" and not ready to receive";}, +STRING {str="information";}, +STRING {str="";}, +STRING {str="Check the receiving application,";}, +STRING {str="then try Infrared again";} +}; +} + +RESOURCE STRING sys_ir_disabled { str="Infrared is disabled"; } + +RESOURCE MENU sys_ir_power_level + { + items = + { + CHOICE_ITEM { str="High";}, + CHOICE_ITEM { str="Low";} + }; + } + +RESOURCE STRING sys_printer_ir { str = "Infrared"; } + +RESOURCE MENU sys_baud_rate_chlist_x + { + } + +RESOURCE CONTROL sys_baud_control_x + { + } + +/* End of File: SS_.RSS */ + diff --git a/code/SIBOSDK/resource/sw_.rss b/code/SIBOSDK/resource/sw_.rss new file mode 100644 index 0000000..e1f4fb7 --- /dev/null +++ b/code/SIBOSDK/resource/sw_.rss @@ -0,0 +1,1836 @@ +SYSTEM +/* +(No comment to be placed on the first line of this file!) + +SW_.RSS + +System Resource file for Workabout + +*/ + +#include +#include "hwim.rh" +#include +#include "symbols.h" + +#define ARROWS4 + +/****************** THE SPECIAL CHARACTERS ************************/ + +/* leave most of these alone, but translate the NSWE */ + +RESOURCE STRING sys_special_characters { str="+-*/<;>,NSWE"; } + +/************************* STRINGS ********************************/ + +RESOURCE STRING sys_string { str="%s"; } +RESOURCE STRING sys_dimmed_msg {str="This item is not available";} +RESOURCE STRING sys_locked_msg {str="This item cannot be changed";} +RESOURCE STRING sys_busy { str="Busy"; } +RESOURCE STRING sys_scanning { str="Scanning"; } +RESOURCE STRING sys_printing_to { str="Printing to %s";} +RESOURCE STRING sys_page_is { str="(page %u)";} + +RESOURCE STRING sys_copied_prompt {str="Copied";} +RESOURCE STRING sys_copying_prompt {str="Saving as \"%s\"";} +RESOURCE STRING sys_loading_prompt {str="Loading \"%s\"";} +RESOURCE STRING sys_merging_prompt {str="Merging in \"%s\"";} +RESOURCE STRING sys_nothing_to_bring {str="Nothing to bring";} +RESOURCE STRING sys_not_found {str="Not found"; } +RESOURCE STRING sys_nothing_to_find {str="Nothing to find";} + +RESOURCE STRING sys_compress_prompt {str="Compressing \"%s\"";} +RESOURCE STRING sys_not_compressible {str="Cannot compress on Flash";} + +RESOURCE STRING sys_password_incorrect {str="Incorrect password";} +RESOURCE STRING sys_password_not_confirmed {str="Password not confirmed";} + +RESOURCE STRING sys_range_reset {str="Out of range - reset to limit";} +RESOURCE STRING sys_invalid_num {str="Number is not valid";} +RESOURCE STRING sys_invalid_margins { str="Invalid margins. Reset?"; } +RESOURCE STRING sys_invalid_char { str="Undiallable character"; } +RESOURCE STRING sys_out_of_range {str="Value out of range: %s = %s";} +/* as used in "Value out of range: Max = 20.45 */ + +RESOURCE STRING sys_edit_nchars {str="Maximum number of characters reached";} + +RESOURCE STRING sys_popout_help {str="Press Tab to change this item";} + +RESOURCE STRING sys_help_string {str="Help: %s";} + +RESOURCE STRING sys_replace_disk {str="Replace the application disk";} + +/* the prompts for a file selector and a pack selector */ +RESOURCE STRING sys_name {str="Name";} +RESOURCE STRING sys_pack {str="Disk";} + +/* part of the title line of a filelist */ +RESOURCE STRING sys_filelist_disk {str="Disk ";} + +RESOURCE STRING sys_flist_reset { str="File list reset"; } +RESOURCE STRING sys_device_memory { str="Internal"; } +RESOURCE STRING sys_path_is { str="Path is %s"; } +RESOURCE STRING sys_choose_directory { str="Choose a directory"; } +RESOURCE STRING sys_choose_filename { str="Choose a filename"; } +RESOURCE STRING sys_choose_new_directory { str="Directory already exists"; } +RESOURCE STRING sys_exists_over { str="File already exists: overwrite?"; } + +/* Next two strings have a maximum length of 5 characters each */ +RESOURCE STRING sys_max { str="Max"; } +RESOURCE STRING sys_min { str="Min"; } + +RESOURCE STRING sys_dec_places { str="Decimal places"; } +RESOURCE STRING sys_sig_digits { str="Significant digits"; } +RESOURCE STRING sys_evaldlg_title { str="Set \"Evaluate\" format"; } +RESOURCE STRING sys_nothing_to_eval { str="Nothing to evaluate"; } +RESOURCE STRING sys_toolong_to_eval { str="Too long to evaluate"; } + +RESOURCE STRING sys_xonxoff_string {str="XON/XOFF ";} +RESOURCE STRING sys_header_str { str="Enter header details"; } +RESOURCE STRING sys_footer_str { str="Enter footer details"; } + +/* max len of next 2 strs is 9 (including the space and the brackets) */ +RESOURCE STRING sys_centimetres { str=" (cm)"; } +RESOURCE STRING sys_inches { str=" (inches)"; } + +RESOURCE STRING sys_dev_notready { str=" Absent!"; } +RESOURCE STRING sys_dev_corrupt { str=" Unformatted!"; } +RESOURCE STRING sys_dev_unknown { str=" Unrecognised!"; } +RESOURCE STRING sys_dev_info { str=", %luK free"; } + +RESOURCE STRING sys_mtype_unknown { str="Unknown"; } +RESOURCE STRING sys_mtype_floppy { str="Floppy"; } +RESOURCE STRING sys_mtype_hard { str="Hard"; } +RESOURCE STRING sys_mtype_flash { str="Flash"; } +RESOURCE STRING sys_mtype_ram { str="Ram"; } +RESOURCE STRING sys_mtype_rom { str="Rom"; } +RESOURCE STRING sys_mtype_protected { str="Protected"; } + +/* Maximum of 14 character widths for the following 5 strings */ +RESOURCE STRING sys_files_tagged { str="(Tagged files)"; } +RESOURCE STRING sys_no_files { str="(No files)"; } +RESOURCE STRING sys_no_disk { str="(No disk)"; } +RESOURCE STRING sys_unformatted { str="(Unformatted)"; } +RESOURCE STRING sys_unrecognised { str="(Unrecognised)"; } + +RESOURCE STRING sys_sound_fail { str="Sound in use - please retry"; } + +/*********** THE ALLOWED SPECIAL KEYS FOR ACTION BUTTONS ******************/ + +/* You can translate the text, but no more than six characters each */ + +RESOURCE ACLIST_ARRAY sys_button_text + { + button= + { + PUSH_BUT + { + keycode=W_KEY_RETURN; + str="Enter"; + }, + PUSH_BUT + { + keycode=W_KEY_ESCAPE; + str="Esc"; + }, + PUSH_BUT + { + keycode=W_KEY_DELETE_LEFT; + str="Del"; + }, + PUSH_BUT + { + keycode=W_KEY_SPACE; + str="Space"; + }, + PUSH_BUT + { + keycode=W_KEY_UP; + str=; + }, + PUSH_BUT + { + keycode=W_KEY_DOWN; + str=; + }, + PUSH_BUT + { + keycode=W_KEY_RIGHT; + str=; + }, + PUSH_BUT + { + keycode=W_KEY_LEFT; + str=; + }, + PUSH_BUT + { + keycode=W_KEY_TAB; + str="Tab"; + }, + PUSH_BUT + { + keycode=W_KEY_MENU; + str="Menu"; + } + }; + } + + +/************************* ACTION LISTS ******************************/ + +/* Change the keycodes too, but don't lose the minus signs */ + +RESOURCE ACLIST_ARRAY sys_ac_no_yes + { + button = + { + PUSH_BUT + { + keycode=-'n'; + str="No"; + }, + PUSH_BUT + { + keycode='y'; + str="Yes"; + } + }; + } + +RESOURCE ACLIST_ARRAY sys_ac_continue + { + button = + { + PUSH_BUT + { + keycode=W_KEY_ESCAPE; + str="Continue"; + } + }; + } + +RESOURCE ACLIST_ARRAY sys_ac_abandon + { + button = + { + PUSH_BUT + { + keycode=W_KEY_ESCAPE; + str="Abandon"; + } + }; + } + +RESOURCE ACLIST_ARRAY sys_append_aclist + { + button = + { + PUSH_BUT + { + keycode=W_KEY_RETURN; + str="Append"; + } + }; + } + +/* Careful not to make the combined width of these strings much wider */ + +RESOURCE ACLIST_ARRAY sys_smart_dial_aclist + { + button = + { + PUSH_BUT + { + keycode=W_KEY_ESCAPE; + str="Cancel"; + }, + PUSH_BUT + { + keycode=W_KEY_MENU; + str="Free input"; + }, + PUSH_BUT + { + keycode=W_KEY_TAB; + str="Dial"; + }, + PUSH_BUT + { + keycode=W_KEY_RETURN; + str="Dial out"; + } + }; + } + +RESOURCE ACLIST_ARRAY sys_freedial_aclist + { + button = + { + PUSH_BUT + { + keycode=W_KEY_DELETE_LEFT; + str="Clear"; + }, + PUSH_BUT + { + keycode=W_KEY_TAB; + str="Redial"; + } + }; + } + +/************************* CHOICE LISTS *****************************/ + +RESOURCE MENU sys_no_yes + { + items = + { + CHOICE_ITEM { str= "No";}, + CHOICE_ITEM { str="Yes";} + }; + } + +RESOURCE MENU sys_offon_menu + { + items = + { + CHOICE_ITEM { str="Off";}, + CHOICE_ITEM { str= "On";} + }; + } + +RESOURCE MENU sys_printer_units_chlist + { + items = + { + CHOICE_ITEM { str= "Inches";}, /* matches with E_IMPERIAL */ + CHOICE_ITEM { str= "Centimetres";} /* matches with E_METRIC */ + }; + } + +RESOURCE MENU sys_printer_device_chlist + { + items = + { + CHOICE_ITEM { str= "Parallel";}, + CHOICE_ITEM { str= "Serial";}, + CHOICE_ITEM { str= "File";} + }; + } + + +RESOURCE MENU sys_baud_rate_chlist + { + items = + { + CHOICE_ITEM { str= "19200";}, /* new for S3a */ + CHOICE_ITEM { str= "9600";}, + CHOICE_ITEM { str= "4800";}, + CHOICE_ITEM { str= "2400";}, + CHOICE_ITEM { str= "1200";}, + CHOICE_ITEM { str= "600";}, + CHOICE_ITEM { str= "300";} + }; + } + +RESOURCE MENU sys_data_bits_chlist + { + items = + { + CHOICE_ITEM { str="5";}, + CHOICE_ITEM { str="6";}, + CHOICE_ITEM { str="7";}, + CHOICE_ITEM { str="8";} + }; + } + +RESOURCE MENU sys_stop_bits_chlist + { + items = + { + CHOICE_ITEM { str="1";}, + CHOICE_ITEM { str="2";} + }; + } + +RESOURCE MENU sys_parity_chlist + { + items = + { + CHOICE_ITEM { str="None";}, + CHOICE_ITEM { str="Even";}, + CHOICE_ITEM { str= "Odd";} + }; + } + +RESOURCE MENU sys_format_chlist + { + items = + { + CHOICE_ITEM { str="Fixed";}, + CHOICE_ITEM { str="Scientific";}, + CHOICE_ITEM { str="General";}, + CHOICE_ITEM { str="Hexadecimal";} + }; + } + +RESOURCE MENU sys_rad_deg + { + items = + { + CHOICE_ITEM { str= "Radians";}, + CHOICE_ITEM { str= "Degrees";} + }; + } + +/* IMPORTANT, order in next array must be same as in page_size menu below */ +/* Also, at most 10 entries allowed, and the first two cannot be altered */ +/* But change any of the others, if you wish */ +/* 1 mm is 1440/25.4 units in the dimensions used, so eg 148 mm is 8391 */ +/* so you could have {width=8391; ... for one entry (an A5 letter size) */ + +RESOURCE PAGE_SIZE_ARRAY sys_page_dimensions + { + page_size= + { + PAGE_SIZE {width=PAGE_WIDTH_A4; length=PAGE_LENGTH_A4;}, + PAGE_SIZE {width=PAGE_WIDTH_A4; length=PAGE_LENGTH_A4;}, + PAGE_SIZE {width=PAGE_WIDTH_EXECUTIVE; length=PAGE_LENGTH_EXECUTIVE;}, + PAGE_SIZE {width=PAGE_WIDTH_LEGAL; length=PAGE_LENGTH_LEGAL;}, + PAGE_SIZE {width=PAGE_WIDTH_LETTER; length=PAGE_LENGTH_LETTER;}, + PAGE_SIZE {width=PAGE_WIDTH_MONARCH; length=PAGE_LENGTH_MONARCH;}, + PAGE_SIZE {width=PAGE_WIDTH_DL; length=PAGE_LENGTH_DL;} + }; + } + +RESOURCE MENU sys_page_size + { + items= + { + CHOICE_ITEM {str="A4";}, + CHOICE_ITEM {str="Custom";}, + CHOICE_ITEM {str="Executive";}, + CHOICE_ITEM {str="Legal";}, + CHOICE_ITEM {str="Letter";}, + CHOICE_ITEM {str="Monarch";}, + CHOICE_ITEM {str="DL";} + }; + } + +RESOURCE MENU sys_orient + { + items= + { + CHOICE_ITEM {str="Portrait";}, + CHOICE_ITEM {str="Landscape";} + }; + } + +RESOURCE MENU sys_prn_pos + { + items= + { + CHOICE_ITEM {str="Normal";}, + CHOICE_ITEM {str="Superscript";}, + CHOICE_ITEM {str="Subscript";} + }; + } + +RESOURCE MENU sys_headfoot_align + { + items= + { + CHOICE_ITEM {str="Left";}, + CHOICE_ITEM {str="Right";}, + CHOICE_ITEM {str="Centred";}, + CHOICE_ITEM {str="Justified";}, + CHOICE_ITEM {str="Two column";}, + CHOICE_ITEM {str="Three column";} + }; + } + +RESOURCE MENU sys_pgno_choice + { + items= + { + CHOICE_ITEM {str="1,2,3";}, + CHOICE_ITEM {str="I,II,III";}, + CHOICE_ITEM {str="i,ii,iii";} + }; + } + +/************************* DIALOGS ********************************/ + +RESOURCE DIALOG sys_error_dialog + { + flags=DLGBOX_RBUF_FILLED|DLGBOX_NO_DDP; + controls= + { + CONTROL + { + class=C_TEXTWIN; + flags=DLGBOX_ITEM_CENTRE|DLGBOX_ITEM_DEAD|DLGBOX_ITEM_UNDERLINED; + info=TXTMESS + { + flags=IN_TEXTWIN_AL_CENTRE; + }; + }, + CONTROL + { + class=C_TEXTWIN; + flags=DLGBOX_ITEM_CENTRE|DLGBOX_ITEM_DEAD; + info=TXTMESS + { + flags=IN_TEXTWIN_AL_CENTRE; + }; + }, + CONTROL + { + class=C_ACLIST; + info=ACLIST + { + rid=sys_ac_continue; + }; + } + }; + } + +RESOURCE DIALOG sys_query_dialog + { + flags = DLGBOX_ACTION_LIST|DLGBOX_REPORT_ACT_HORIZ; + controls= + { + CONTROL + { + class=C_TEXTWIN; + flags=DLGBOX_ITEM_CENTRE|DLGBOX_ITEM_DEAD|DLGBOX_ITEM_UNDERLINED; + info=TXTMESS + { + flags=IN_TEXTWIN_AL_CENTRE; + }; + }, + CONTROL + { + class=C_ACLIST; + info=ACLIST + { + rid=sys_ac_no_yes; + }; + } + }; + } + +RESOURCE DIALOG sys_printing_dialog + { + flags=DLGBOX_RBUF_FILLED; + controls= + { + CONTROL + { + class=C_TEXTWIN; + flags=DLGBOX_ITEM_CENTRE|DLGBOX_ITEM_DEAD|DLGBOX_ITEM_UNDERLINED; + info=TXTMESS + { + flags=IN_TEXTWIN_AL_CENTRE; + }; + }, + CONTROL + { + class=C_TEXTWIN; + flags=DLGBOX_ITEM_CENTRE|DLGBOX_ITEM_DEAD; + info=TXTMESS + { + flags=IN_TEXTWIN_AL_CENTRE; + }; + }, + CONTROL + { + class=C_ACLIST; + info=ACLIST + { + rid=sys_ac_abandon; + }; + } + }; + } + +RESOURCE DIALOG sys_set_port_dialog + { + title="Set Serial port"; + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_RBUF_FILLED; + controls= + { + CONTROL + { + class=C_CHLIST; + prompt="Baud rate"; + info=CHLIST + { + rid=sys_baud_rate_chlist; + nsel=0; + }; + }, + CONTROL + { + class=C_CHLIST; + prompt="Data bits"; + info=CHLIST + { + rid=sys_data_bits_chlist; + nsel=0; + }; + }, + CONTROL + { + class=C_CHLIST; + prompt="Stop bits"; + info=CHLIST + { + rid=sys_stop_bits_chlist; + nsel=0; + }; + }, + CONTROL + { + class=C_CHLIST; + prompt="Parity"; + info=CHLIST + { + rid=sys_parity_chlist; + nsel=0; + }; + }, + CONTROL + { + class=C_CHLIST; + prompt="Ignore parity"; + info=CHLIST + { + rid=sys_no_yes; + nsel=0; + }; + } + }; + } + +RESOURCE DIALOG sys_set_hshk_dialog + { + title="Set serial handshake"; + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_RBUF_FILLED; + controls= + { + CONTROL + { + class=C_CHLIST; + prompt="XON/XOFF"; + info=CHLIST + { + rid=sys_offon_menu; + nsel=0; + }; + }, + CONTROL + { + class=C_CHLIST; + prompt="RTS/CTS"; + info=CHLIST + { + rid=sys_offon_menu; + nsel=0; + }; + }, + CONTROL + { + class=C_CHLIST; + prompt="DSR/DTR"; + info=CHLIST + { + rid=sys_offon_menu; + nsel=0; + }; + }, + CONTROL + { + class=C_CHLIST; + prompt="DCD"; + info=CHLIST + { + rid=sys_offon_menu; + nsel=0; + }; + } + }; + } + +RESOURCE DIALOG sys_printer_config_dialog + { + title="Printer configuration"; + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_SMALL_FONT; + controls= + { + CONTROL + { + class=C_CHLIST; + prompt="Printer device"; + flags=DLGBOX_ITEM_NOTIFY_CHANGED; + info=CHLIST + { + rid=sys_printer_device_chlist; + }; + }, + CONTROL + { + class=C_TEXTWIN; + prompt="Serial characteristics "; + info=TXTMESS + { + str="19200 "; /* changed for S3a */ + flags=IN_TEXTWIN_POPOUT; + }; + }, + CONTROL + { + class=C_TEXTWIN; + prompt="Serial handshaking "; + info=TXTMESS + { + str="XON/XOFf Off "; + flags=IN_TEXTWIN_POPOUT; + }; + }, + CONTROL + { + flags=DLGBOX_ITEM_NEEDS_PACK|DLGBOX_ITEM_NOTIFY_CHANGED; + class=C_FNEDIT; + prompt="File:"; + info=FNEDIT { flags=IN_FNEDIT_NO_AUTOQUERY; }; + } +/* 'Units' control omitted for Workabout */ + }; + } + +RESOURCE DIALOG sys_eval_dialog + { + title="Set Calculator format"; + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_RBUF_FILLED; + controls= + { + CONTROL + { + flags=DLGBOX_ITEM_NOTIFY_CHANGED; + class=C_CHLIST; + prompt="Format"; + info=CHLIST { rid=sys_format_chlist; }; + }, + CONTROL + { + class=C_NCEDIT; + /* The following line must be the wider of the 2 above strings */ + /* sys_dec_places and sys_sig_digits */ + prompt="Significant digits"; + info=NCEDIT + { + high=12; + low=0; + }; + }, + CONTROL + { + class=C_CHLIST; + prompt="Trigonometry units"; + info=CHLIST { rid=sys_rad_deg; }; + } + }; + } + +RESOURCE DIALOG sys_country_selector_dialog + { + title="Append country"; + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_ACTION_LIST|DLGBOX_RBUF_FILLED; + controls= + { + CONTROL + { + class=C_WLDSELWN; + prompt="Country"; + info=WLDSELWN {flags=IN_WLDSELWN_COUNTRY|IN_WLDSELWN_SETHOME; }; + }, + CONTROL + { + class=C_ACLIST; + info=ACLIST + { + rid=sys_append_aclist; + }; + } + }; + } + +RESOURCE CONTROL sys_smart_dial_item + { + class=C_EDWIN; + prompt=; + info=EDWIN + { + maxlen=WR_MAX_DIAL_STRING; + vulen=20; + flags=IN_EDWIN_VULEN_CHARACTERS|IN_EDWIN_NO_AUTOSELECT; + }; + } + +RESOURCE DIALOG sys_smart_dial_dialog + { + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_ACTION_LIST|DLGBOX_RBUF_FILLED|DLGBOX_SMALL_FONT; + controls= + { + CONTROL + { + class=C_TEXTWIN; + flags=DLGBOX_ITEM_CENTRE|DLGBOX_ITEM_DEAD|DLGBOX_ITEM_UNDERLINED; + info=TXTMESS + { + flags=IN_TEXTWIN_AL_CENTRE; + str="Dial"; + }; + }, + CONTROL + { + class=C_ACLIST; + info=ACLIST + { + rid=sys_smart_dial_aclist; + }; + } + }; + } + +RESOURCE DIALOG sys_freedial_dialog + { + title="Free-form dialling"; + flags = DLGBOX_NO_WAIT|DLGBOX_NO_DDP; + controls= + { + CONTROL + { + class=C_FREEDIAL; + prompt=; + }, + CONTROL + { + class=C_ACLIST; + info=ACLIST + { + rid=sys_freedial_aclist; + }; + } + }; + } + +RESOURCE DIALOG sys_flist_dialog + { + title="Specify filelist"; + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_RBUF_FILLED; + controls= + { + CONTROL + { + class=C_EDWIN; + prompt="Filename pattern"; + info=EDWIN + { + maxlen=P_FNAMESIZE; + vulen=18; + flags=IN_EDWIN_VULEN_CHARACTERS; + }; + }, + CONTROL + { + class=C_EDWIN; + prompt="Full path"; + info=EDWIN + { + maxlen=P_FNAMESIZE; + vulen=18; + flags=IN_EDWIN_VULEN_CHARACTERS; + }; + } + }; + } + +RESOURCE DIALOG sys_print_control_dl + { + title="Print setup"; + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_NOTIFY_ESCAPE|DLGBOX_SMALL_FONT; + controls= + { + CONTROL + { + class=C_TEXTWIN; + prompt="Page size"; + info=TXTMESS + { + str=""; + flags=IN_TEXTWIN_POPOUT; + }; + }, + CONTROL + { + class=C_TEXTWIN; + prompt="Margins"; + info=TXTMESS + { + str=""; + flags=IN_TEXTWIN_POPOUT; + }; + }, + CONTROL + { + class=C_TEXTWIN; + prompt="Header"; + info=TXTMESS + { + str=""; + flags=IN_TEXTWIN_POPOUT; + }; + }, + CONTROL + { + class=C_TEXTWIN; + prompt="Footer"; + info=TXTMESS + { + str=""; + flags=IN_TEXTWIN_POPOUT; + }; + }, + CONTROL + { + class=C_TEXTWIN; + prompt="Paging control"; + info=TXTMESS + { + str=""; + flags=IN_TEXTWIN_POPOUT; + }; + } +/* 'Printer model' control omitted for Workabout */ + }; + } + +RESOURCE DIALOG sys_paging_control_dl + { + title="Paging control"; + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_RBUF_FILLED; + controls= + { + CONTROL + { + class=C_NCEDIT; + prompt="Number for first page"; + info=NCEDIT + { + low=1; + high=9999; + }; + }, + CONTROL + { + class=C_CHLIST; + prompt="Allow widows/orphans"; + info=CHLIST{rid=sys_no_yes;}; + }, + CONTROL + { + class=C_CHLIST; + prompt="Page number style"; + info=CHLIST{rid=sys_pgno_choice;}; + } + }; + } + +RESOURCE DIALOG sys_printer_model + { + title="Set printer"; + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_RBUF_FILLED; + controls= + { + CONTROL + { + prompt="Select printer"; + flags=DLGBOX_ITEM_NOTIFY_CHANGED; + class=C_CHLIST; + info=CHLIST{}; + }, + CONTROL + { + class=C_TEXTWIN; + prompt="Default font"; + info=TXTMESS + { + flags=IN_TEXTWIN_POPOUT; + }; + } + }; + } + +RESOURCE DIALOG sys_margins_dl + { + title="Margins"; + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_RBUF_FILLED|DLGBOX_APPEND_UNITS_TITLE; + controls= + { + CONTROL + { + class=C_FLTEDIT; + prompt="Top"; + info=FLTEDIT + { + low=0; + high=9.99; + ndec=2; + }; + }, + CONTROL + { + class=C_FLTEDIT; + prompt="Left"; + info=FLTEDIT + { + low=0; + high=9.99; + ndec=2; + }; + }, + CONTROL + { + class=C_FLTEDIT; + prompt="Right"; + info=FLTEDIT + { + low=0; + high=9.99; + ndec=2; + }; + }, + CONTROL + { + class=C_FLTEDIT; + prompt="Bottom"; + info=FLTEDIT + { + low=0; + high=9.99; + ndec=2; + }; + } + }; + } + +RESOURCE DIALOG sys_headfoot_dl + { + title="*"; + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_RBUF_FILLED|DLGBOX_APPEND_UNITS_TITLE; + controls= + { + CONTROL + { + class=C_EDWIN; + prompt="Text"; + info=EDWIN + { + flags=IN_EDWIN_VULEN_CHARACTERS|IN_EDWIN_ACCEPT_TABS; + maxlen=80; + vulen=20; + }; + }, + CONTROL + { + class=C_CHLIST; + prompt="Alignment"; + info=CHLIST{rid=sys_headfoot_align;}; + }, + CONTROL + { + class=C_CHLIST; + prompt="On first page"; + info=CHLIST{rid=sys_no_yes;}; + }, + CONTROL + { + class=C_TEXTWIN; + prompt="Font"; + info=TXTMESS + { + flags=IN_TEXTWIN_POPOUT; + }; + }, + CONTROL + { + class=C_FLTEDIT; + prompt="Vertical offset"; + info=FLTEDIT + { + low=0; + high=9.99; + ndec=2; + }; + } + }; + } + +RESOURCE DIALOG sys_pagesize_dl + { + title="Page size"; + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_RBUF_FILLED|DLGBOX_APPEND_UNITS_TITLE; + controls= + { + CONTROL + { + class=C_CHLIST; + flags=DLGBOX_ITEM_NOTIFY_CHANGED; + prompt="Page size"; + info=CHLIST{rid=sys_page_size;}; + }, + CONTROL + { + class=C_FLTEDIT; + prompt="Width"; + info=FLTEDIT + { + low=1; + high=45; + ndec=2; + }; + }, + CONTROL + { + class=C_FLTEDIT; + prompt="Height"; + info=FLTEDIT + { + low=1; + high=45; + ndec=2; + }; + }, + CONTROL + { + class=C_CHLIST; + prompt="Orientation"; + info=CHLIST{rid=sys_orient;}; + } + }; + } + +RESOURCE DIALOG sys_font_dl + { + title="Font"; + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_RBUF_FILLED|DLGBOX_SMALL_FONT; + controls= + { + CONTROL + { + flags=DLGBOX_ITEM_NOTIFY_CHANGED; + class=C_CHLIST; + prompt="Font"; + info=CHLIST{}; + }, + CONTROL + { + class=C_CHLIST; + prompt="Size"; + info=CHLIST{}; + }, + CONTROL + { + class=C_CHLIST; + prompt="Underline"; + info=CHLIST{rid=sys_no_yes;}; + }, + CONTROL + { + class=C_CHLIST; + prompt="Bold"; + info=CHLIST{rid=sys_no_yes;}; + }, + CONTROL + { + class=C_CHLIST; + prompt="Italic"; + info=CHLIST{rid=sys_no_yes;}; + }, + CONTROL + { + class=C_CHLIST; + prompt="Print position"; + info=CHLIST{rid=sys_prn_pos;}; + } + }; + } + +RESOURCE CONTROL sys_txtmess + { + class=C_TEXTWIN; + flags=DLGBOX_ITEM_CENTRE|DLGBOX_ITEM_DEAD; + info=TXTMESS + { + flags=IN_TEXTWIN_AL_CENTRE; + }; + } + +/************************* HELP ********************************/ + +RESOURCE TOPIC_ARRAY sys_help_index_data +{ +id_lst= +{ +sys_help_on_off, +sys_help_battery, +sys_help_calendar, +sys_help_edit, +sys_help_dialog, +sys_help_statwin, +sys_help_files, +sys_help_filsels, +sys_help_evaluate, +sys_help_print, +sys_help_in_use, +sys_help_no_sys_mem +}; +} + +RESOURCE HELP_ARRAY sys_help_index +{ +topic="Index"; +topic_id=sys_help_index_data; +} + +RESOURCE HELP_ARRAY sys_help_on_help +{ +topic="About Help"; +strlst= +{ +STRING {str="To choose topic:""then Enter.";}, +STRING {str="Ctrl-Esc displays Help index.";}, +STRING {str="Esc exits Help index.";} +}; +} + +RESOURCE HELP_ARRAY sys_help_dialog +{ +topic="Menu/dialog tips"; +strlst= +{ +STRING {str="Press Menu key to see menu bar.";}, +STRING {str=" moves between menus.";}, +STRING {str=" moves between options.";}, +STRING {str="Enter selects highlighted option.";}, +STRING {str="";}, +STRING {str="Accelerator-keys (""-X etc.)";}, +STRING {str="access menu options directly.";}, +STRING {str="";}, +STRING {str="Tab often lists choices in dialogs";} +}; +} + +RESOURCE HELP_ARRAY sys_help_statwin +{ +topic="Screen display"; +strlst= +{ +STRING {str="Press ""-Tab to switch";}, +STRING {str="between applications.";}, +STRING {str="";}, +STRING {str="`Zoom in/out' to change";}, +STRING {str="character size.";}, +STRING {str="";}, +STRING {str="Depending on the application,";}, +STRING {str="press ""-Menu for a Status";}, +STRING {str="Window or Ctrl-Menu to set size";} +}; +} + +RESOURCE HELP_ARRAY sys_help_dialling +{ +topic="Dialling"; +strlst= +{ +STRING {str="";} +}; +} + +RESOURCE HELP_ARRAY sys_help_filsels +{ +topic="File selection"; +strlst= +{ +STRING {str="Press Tab in file selection dialogs";}, +STRING {str="to choose from a full list of";}, +STRING {str="files/directories. ""-Tab";}, +STRING {str="displays full path. Typing:";}, +STRING {str="Letter matches filename";}, +STRING {str="Shift+letter matches directory";}, +STRING {str="Ctrl+letter matches drive";}, +STRING {str="";}, +STRING {str="In file-related dialogs:";}, +STRING {str="""-Tab gives full path";}, +STRING {str="To select a wildcard filespec in a";}, +STRING {str="dialog, use Ctrl-Tab, type the";}, +STRING {str="filespec, then press Ctrl-Enter";} +}; +} + +RESOURCE HELP_ARRAY sys_help_edit +{ +topic="Editing"; +strlst= +{ +STRING {str="In the full-screen text editors:";}, +STRING {str="Use "ARROWS4" to move cursor Ctrl";}, +STRING {str="and "" keys increase movement.";}, +STRING {str="";}, +STRING {str="Shift-"ARROWS4" highlights text:";}, +STRING {str="Use Delete to cut text to the";}, +STRING {str="clipboard (or `Copy text' to copy,";}, +STRING {str="it) then `Insert text' to paste";}, +STRING {str="the text back in.";}, +STRING {str="Shift-Del deletes text without";}, +STRING {str="changing the contents of the";}, +STRING {str="clipboard.";}, +STRING {str="";}, +STRING {str="Use `Bring' option to copy text";}, +STRING {str="which has been highlighted in";}, +STRING {str="another application.";}, +STRING {str="";}, +STRING {str="Quick delete methods (when";}, +STRING {str="no text is highlighted):";}, +STRING {str="Shift-Del: next character";}, +STRING {str="Shift-""-Del: to end of line";}, +STRING {str="""-Del: to beginning of line";}, +STRING {str="";}, +STRING {str="Quick highlight methods:";}, +STRING {str="""-Shift-Ctrl-"": current word";}, +STRING {str="""-Shift-Ctrl-"": current line";} +}; +} + +RESOURCE TOPIC_ARRAY sys_help_x_help +{ +id_lst= +{ +sys_help_on_help +}; +} + +RESOURCE HELP_ARRAY sys_help_files +{ +topic="Files in applications"; +strlst= +{ +STRING {str="See `New file', `Open file',";}, +STRING {str="`Merge in', `Compress file',";}, +STRING {str="`Save as', `Save' and `Revert'";}, +STRING {str="in relevant applications";}, +STRING {str="";}, +STRING {str="Various file handling facilities";}, +STRING {str="are provided in both the";}, +STRING {str="System Interfaces";} +}; +} + +RESOURCE HELP_ARRAY sys_help_print +{ +topic="Printing/Preview"; +strlst= +{ +STRING {str="In applications which can";}, +STRING {str="Print, first use `Print setup'";}, +STRING {str="to set `Printer Model'";}, +STRING {str="";}, +STRING {str="Use `Print preview' to see a";}, +STRING {str="preview with its own menu of";}, +STRING {str="options. (You don't have to";}, +STRING {str="wait for the preview to finish";}, +STRING {str="calculating: Esc cancels, etc).";}, +STRING {str="Print preview's menu usually";}, +STRING {str="includes a `Print' option";} +}; +} + +RESOURCE HELP_ARRAY sys_time_basics +{ +topic="Time basics"; +strlst= +{ +STRING {str="";} +}; +} + +RESOURCE HELP_ARRAY sys_help_on_off +{ +topic="On/off"; +strlst= +{ +STRING {str="On/Esc turns on";}, +STRING {str="Off turns off";} +}; +} + +RESOURCE TOPIC_ARRAY sys_help_x_index +{ +id_lst= +{ +sys_help_index +}; +} + +/************************* LATER ADDITIONS ********************************/ + +/* Name of general printer driver */ +RESOURCE STRING sys_wdr_general { str="General"; } + +RESOURCE STRING sys_dial_out { str="9,"; } /* 5 chars max */ +RESOURCE STRING sys_skipping_page { str="(skipping page %u)";} + +/************************* NEW FOR Series 3a *****************************/ + +/* TTT: This file is entirely new for the S3a. +You must translate EVERY text string, accelerator etc in this +file (except those marked "Do not translate", of course) - not just +those things which are marked with TTT */ + + +/* TTT: Only used by developers */ +RESOURCE STRING sys_debugging_num_cells {str="Diagnostics: %d (%u)";} + +/********* for Calendar Window in Agenda **********/ + +/* TTT: eg "Calendar 1998" or "Calendar 1993-1994" */ +RESOURCE STRING sys_calendar {str="Calendar %Y";} + +/*********************** FOR PRINT PREVIEW ******************************/ +/* TTT: "Print preview" option in Word, Agenda, Sheet... uses these: */ +RESOURCE STRING sys_page {str="page";} +RESOURCE STRING sys_pages {str="pages";} +RESOURCE STRING sys_preview_busy {str="Busy, cannot print yet";} +RESOURCE STRING sys_display_margins {str="Show margins";} +RESOURCE STRING sys_hide_margins {str="Hide margins";} + +RESOURCE STRING sys_opening_prompt {str="Opening \"%s\"";} + +/* TTT: NB "Print preview" is a standard WP term... if every Wp in your +country uses one term for this, you must use it too */ +RESOURCE STRING sys_print_preview {str="Print preview";} + +/* TTT length of longest in sys_preview_margins_chlist + length of longest +in sys_preview_options_chlist must be less than 50 */ +RESOURCE MENU sys_preview_margins_chlist + { + items= + { + CHOICE_ITEM {str="Margins off";}, + CHOICE_ITEM {str="Margins on";} + }; + } + +RESOURCE MENU sys_preview_options_chlist + { + items= + { + CHOICE_ITEM {str="Facing pages";}, + CHOICE_ITEM {str="1 page";}, + CHOICE_ITEM {str="2 pages";}, + CHOICE_ITEM {str="3 pages";}, + CHOICE_ITEM {str="4 pages";} + }; + } + +RESOURCE DIALOG sys_preview_options_dialog + { + title="Display"; + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_RBUF_FILLED|DLGBOX_NO_DDP; + controls= + { + CONTROL + { + class=C_CHLIST; + prompt=""; + info=CHLIST{rid=sys_preview_options_chlist;}; + } + }; + } + +RESOURCE DIALOG sys_preview_jump_dialog + { + title="Jump to page"; + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_RBUF_FILLED|DLGBOX_NO_DDP; + controls= + { + CONTROL + { + class=C_NCEDIT; + prompt="Page number"; + info=NCEDIT + { + low=1; + high=9999; + }; + } + }; + } + +RESOURCE WSERV_INFO sys_preview_acc + { + menbar_id=sys_preview_menubar; + first_com=O_PVC_PREVIEW_PRINT; + accel= + { + 'p', /* Print */ + 'm', /* Margins */ + 'd', /* Pages to display */ + 'j', /* Jump to page */ + '*' /* Exit preview */ + }; + } + +RESOURCE MENU_BAR sys_preview_menubar + { + items = + { + MENU_BAR_ITEM + { + menu_id=sys_preview_menu; + mb_item="Preview"; + } + }; + } + +RESOURCE MENU sys_preview_menu + { + items = + { + MENU_ITEM + { + com_id=O_PVC_PREVIEW_PRINT; + mn_item="Print"; + }, + MENU_ITEM + { + com_id=O_PVC_PREVIEW_MARGINS; +/* TTT: use whichever's the longer: "Show margins" or "Hide margins" */ + mn_item="Show margins"; + }, + MENU_ITEM + { + com_id=O_PVC_PREVIEW_OPTIONS; + mn_item="Pages to display"; + }, + MENU_ITEM + { + com_id=O_PVC_PREVIEW_JUMP|BREAK_LINE_FOLLOWS; + mn_item="Jump to page"; + }, + MENU_ITEM + { + com_id=O_PVC_PREVIEW_EXIT; + mn_item="Exit preview"; + } + }; + } + +RESOURCE MENU sys_printer_devices + { + items = + { + CHOICE_ITEM { str= "Parallel";}, + CHOICE_ITEM { str= "Serial";}, + CHOICE_ITEM { str= "File";}, + CHOICE_ITEM { str= "Fax";} + }; + } + +RESOURCE CONTROL sys_print_control_device + { + class=C_TEXTWIN; +/* TTT: You'll see this on the bottom of the Print Setup dialog +in Word, Agenda... */ + prompt="Printer device"; + info=TXTMESS + { + str=""; + flags=IN_TEXTWIN_POPOUT; + }; + } + +RESOURCE CONTROL sys_print_preview_settings + { +/* TTT: You'll see this on the bottom of the Printer configuration dialog +in the Shell */ + class=C_TEXTWIN; + prompt="Print preview"; + info=TXTMESS + { + str="Facing pages,Margins off"; /* TTT widest possible */ + flags=IN_TEXTWIN_POPOUT; + }; + } + +RESOURCE DIALOG sys_preview_settings_dl + { + title="Preview settings"; + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_RBUF_FILLED; + controls= + { + CONTROL + { + class=C_CHLIST; + prompt="Display"; + info=CHLIST{rid=sys_preview_options_chlist;}; + }, + CONTROL + { + class=C_CHLIST; + prompt="Margins"; + info=CHLIST{rid=sys_offon_menu;}; + } + }; + } + +RESOURCE MENU sys_standard_sounds + { + items= + { +/* TTT: Built-in sounds, when you're setting an alarm in Time */ + CHOICE_ITEM {str="Rings";}, + CHOICE_ITEM {str="Chimes";}, + CHOICE_ITEM {str="Fanfare";}, + CHOICE_ITEM {str="Soft bells";}, + CHOICE_ITEM {str="Church bell";} + }; + } + +/* TTT: do not translate */ +RESOURCE STRING sys_alarm_standard_name {str="SYS$AL01";} +/* TTT: The "silent" sound, when setting an alarm */ +RESOURCE STRING sys_silent_alarm {str="Silent";} +/* TTT: If you try to play a sound, but sound is disabled... */ +RESOURCE STRING sys_sound_disabled {str="Sound disabled";} +/* TTT: do not translate the next one */ +RESOURCE STRING sys_word_rom { str="ROM::WORD.APP"; } +/* TTT: the user has refused to replace an SSD */ +RESOURCE STRING sys_restart_from_sys { str="Press Esc to exit application"; } + +/* TTT: when creating a new file: eg gives "Myfile" created +You can change these around if you like, eg we could've done the English +as str="Created \"%s\"" to give Created "Myfile" */ +RESOURCE STRING srt_file_created { str="\"%s\" created"; } +RESOURCE STRING srt_file_opened { str="\"%s\" opened"; } +RESOURCE STRING srt_file_saved { str="\"%s\" saved"; } +RESOURCE STRING srt_file_compressed { str="\"%s\" compressed"; } +RESOURCE STRING srt_file_merged { str="\"%s\" merged in"; } +RESOURCE STRING sys_saving_prompt {str="Saving \"%s\"";} +RESOURCE STRING sys_reloading_prompt {str="Reopening \"%s\"";} +RESOURCE STRING sys_converting_prompt {str="Converting \"%s\"";} + +/* TTT: When we refuse to save the file, because it hasn't changed */ +RESOURCE STRING sys_not_changed {str="Not changed";} +/* TTT: When you're exiting, but it failed to save the file for some reason */ +RESOURCE STRING sys_confirm_continue {str="Not saved, continue anyway?";} +/* TTT: When you're using the "Exit, lose changes" option: */ +RESOURCE STRING sys_confirm_change_loss {str="Confirm the loss of all changes";} +/* TTT: used with the previous two strings */ +RESOURCE STRING sys_losing_changes {str="(`Yes' discards all changes)";} +RESOURCE STRING sys_nothing_to_print {str="Nothing to print";} +RESOURCE STRING sys_nothing_to_insert {str="Nothing to insert";} +RESOURCE STRING sys_nothing_to_copy {str="Nothing to copy";} +/* TTT: preferably use the same word as the "Revert" menu option */ +RESOURCE STRING sys_revert_to_saved {str="Revert to saved?";} + +/* TTT: For use in menus (hotkeys) */ +RESOURCE STRING sys_shift_key_name {str="Shift";} + +/* TTT: When you use "Current country only" (or diamond key) World App... */ +RESOURCE STRING srt_space_only { str=" (only)"; } + +RESOURCE STRING sys_change_password {str="Change password";} + +RESOURCE DIALOG sys_set_password_dl + { + title = "Set password"; + flags=DLGBOX_NOTIFY_ENTER; + controls= + { + CONTROL + { + class=C_XEDIT; + prompt="Enter password"; + }, + CONTROL + { + class=C_XEDIT; + prompt="Confirm password"; + } + }; + } + +RESOURCE DIALOG sys_get_password_dl + { + title = "Password protected"; + flags=DLGBOX_NOTIFY_ENTER; + controls= + { + CONTROL + { + class=C_XEDIT; + prompt="Enter password"; + } + }; + } + +/* TTT Extra help - translate this! */ +/* BUT DON'T MAKE THE TEXT WIDER THAN WILL FIT ON COMPATIBILITY MODE SCREENS +(BEAR IN MIND THAT THIS HELP IS AVAILABLE TO COMPATIBILITY MODE APP) */ + +RESOURCE HELP_ARRAY sys_help_evaluate +{ +topic="Evaluate"; +strlst= +{ +STRING {str="In applications such as the";}, +STRING {str="program editor, type a";}, +STRING {str="calculation (without `=' or";}, +STRING {str="spaces). Then use `Evaluate'";}, +STRING {str="menu option for result";} +}; +} + +RESOURCE HELP_ARRAY sys_help_memo +{ +topic="Memo editor"; +} + +RESOURCE HELP_ARRAY sys_help_in_use +{ +topic="File or device in use"; +strlst= +{ +STRING {str="You will see this message if you";}, +STRING {str="try to copy, delete or rename a";}, +STRING {str="file which is currently open.";}, +STRING {str="Exit the file then try again.";}, +STRING {str="";}, +STRING {str="You will also see it if you try to";}, +STRING {str="use, at the same time, through";}, +STRING {str="the same port, two serial devices,";}, +STRING {str="such as:";}, +STRING {str="The `Remote link' option";}, +STRING {str="A Comms application";}, +STRING {str="A printer";} +}; +} + +RESOURCE HELP_ARRAY sys_help_no_sys_mem +{ +topic="No system memory"; +strlst= +{ +STRING {str="This message usually means all";}, +STRING {str="the internal memory has been";}, +STRING {str="used up. Exit some open files,";}, +STRING {str="or delete unwanted files from";}, +STRING {str="the `Internal' disk, to free";}, +STRING {str="some more memory";} +}; +} + +RESOURCE HELP_ARRAY sys_help_calendar +{ +topic="Calendars"; +strlst= +{ +STRING {str="When you are entering a date";}, +STRING {str="in a dialog, you can press Tab";}, +STRING {str="to display a one month calendar";}, +STRING {str="";}, +STRING {str="In the calendar: "ARROWS" move";}, +STRING {str="the cursor around the screen";}, +STRING {str="""-"" move a month";}, +STRING {str="Ctrl-"" move a year";}, +STRING {str="Space moves to today";} +}; +} + +/************************* NEW FOR Workabout *****************************/ + +RESOURCE DIALOG sys_s3c_print_control_dl + { + title="Print setup"; + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_NOTIFY_ESCAPE|DLGBOX_SMALL_FONT; + controls= + { + CONTROL + { + class=C_TEXTWIN; + prompt="Page setup"; + info=TXTMESS + { + str=""; + flags=IN_TEXTWIN_POPOUT; + }; + }, + CONTROL + { + class=C_CHLIST; + prompt="Units"; + flags=DLGBOX_ITEM_UNDERLINED; + info=CHLIST + { + rid=sys_printer_units_chlist; + }; + }, + CONTROL + { + class=C_TEXTWIN; + prompt="Model"; + info=TXTMESS + { + str=""; + flags=IN_TEXTWIN_POPOUT; + }; + }, + CONTROL + { /* copy from sys_print_control_device */ + class=C_TEXTWIN; + prompt="Device"; + info=TXTMESS + { + str=""; + flags=IN_TEXTWIN_POPOUT; + }; + }, + CONTROL + { /* copy from sys_print_preview_settings */ + class=C_TEXTWIN; + prompt="Preview"; + info=TXTMESS + { + str="Facing pages,Margins off"; /* TTT widest possible */ + flags=IN_TEXTWIN_POPOUT; + }; + } + }; + } + +RESOURCE STRING sys_s3c_page_setup { str="Page setup"; } + +RESOURCE HELP_ARRAY sys_help_battery +{ +topic="Battery information"; +strlst= +{ +STRING {str="Press Shift-Ctrl-B in any";}, +STRING {str="application to display the";}, +STRING {str="battery information dialog";} +}; +} diff --git a/code/SIBOSDK/s3atool/iconeda.app b/code/SIBOSDK/s3atool/iconeda.app new file mode 100644 index 0000000..8895486 Binary files /dev/null and b/code/SIBOSDK/s3atool/iconeda.app differ diff --git a/code/SIBOSDK/s3atool/spya.app b/code/SIBOSDK/s3atool/spya.app new file mode 100644 index 0000000..43348ff Binary files /dev/null and b/code/SIBOSDK/s3atool/spya.app differ diff --git a/code/SIBOSDK/src/bcd.cpp b/code/SIBOSDK/src/bcd.cpp new file mode 100644 index 0000000..3fbd1b1 --- /dev/null +++ b/code/SIBOSDK/src/bcd.cpp @@ -0,0 +1,180 @@ +/* Release 3.10 */ +/*-------------------------------------------------------------------------* +* * +* BCD.CPP - BCD number class implementation. * +* * +* COPYRIGHT (C) 1989..1992 Clarion Software Corporation. * +* All Rights Reserved * +* * +*--------------------------------------------------------------------------*/ + +#include +#include + +#pragma module(init_prio=>22) + + bcd::bcd(int x) { + + int_to_dec((unsigned long) abs(x)); + if(x < 0) + bcd_array[9]|=0x80; +} + + bcd::bcd(unsigned x) { + + int_to_dec((unsigned long) x); +} + + bcd::bcd(long x) { + + int_to_dec((unsigned long) labs(x)); + if(x < 0) + bcd_array[9]|=0x80; +} + + bcd::bcd(unsigned long x) { + + int_to_dec(x); +} + +bcd bcd::operator-() { + + bcd_array[9]^=0x80; + return *this; +} + +ostream& operator<<(ostream& os, bcd& b) { + + os << real(b); + return os; +} + +istream& operator>>(istream& is, bcd& b) { + + long double n; + + is >> n; + b.real_to_dec(n); + return is; +} + +void bcd::bcd_copy_to(unsigned char *source) { + + int n=0; + + while(n < 10) { + bcd_array[n] = source[n]; + ++n; + } +} + + +void bcd::bcd_copy_from(unsigned char *dest) { + + int n=0; + + while(n < 10) { + dest[n] = bcd_array[n]; + ++n; + } +} + +void bcd::int_to_dec(unsigned long x) { + + char s[32]; + int l, n, c, p; + unsigned char cv; + + if(!x) + exp=ExpZero; + else + exp=110 + (int)log10((double) (x)); + ultoa(x, s, 10); + l=strlen(s); + p=0; + while(p < 10) { + bcd_array[p++]=0; + } + p=8; + n=0; + while(n < l) { + c=s[n++]; + cv=(c-0x30)<<4; + if(n == l) { + bcd_array[p]=cv; + break; + } + c=s[n++]; + cv|=(c-0x30); + bcd_array[p--]=cv; + } +} + +#pragma save +#pragma call(reg_param=>(ax)) +extern "C" long double _cvt_bcd(unsigned char/* <_SS>*/ *); +#pragma restore + +long double bcd::dec_to_real() { + + long double n; + unsigned char bcd_temp[10]; + + bcd_copy_from(bcd_temp); + n=_cvt_bcd(bcd_temp); + n*= pow10((double)(exp-127)); + return n; +} + +void bcd::real_to_dec(long double x, int decimals) { + + long double zero = 0; + long double norm; + int k,clear,n; + unsigned char bcd_temp[10]; + + if ( x < zero ) { + x = -x; + bcd_temp[9] = 0x80; + } + else + bcd_temp[9] = 0; + + if ( x == zero ) + k = -10000; + else { + k = 1 + (int) floorl( log10l(x) + 0.001 ); + } + + while (1) { + norm = x; + if ( k != -10000 ) + norm *= _pow_int(10,18-k); + + _bcd( norm, (char near *)bcd_temp ); + if ( k == -10000 ) { + k = 1; + break; + } + if ( ( bcd_temp[8] >> 4 ) != 0 ) + break; + k -= 1; + } + exp = 109 + k; + + if((k < 0) && (decimals != _BcdMaxDecimals)) { + clear = abs(k) + decimals; + n = 0; + while(clear) { + bcd_temp[n] &= ~0x0F; + if(--clear == 0) + break; + bcd_temp[n] &= ~0xF0; + --clear; + ++n; + } + } + bcd_copy_to(bcd_temp); +} + + \ No newline at end of file diff --git a/code/SIBOSDK/src/cdata.c b/code/SIBOSDK/src/cdata.c new file mode 100644 index 0000000..24845f5 --- /dev/null +++ b/code/SIBOSDK/src/cdata.c @@ -0,0 +1,220 @@ +/* Release 3.00 */ + +/*-------------------------------------------------------------------------* +* * +* cdata.c - C library data * +* * +* COPYRIGHT (C) 1989 Jensen and Partners. All Rights Reserved * +* Written by Simon Knight. * +* * +* COPYRIGHT (C) 1991 Psion PLC. All Rights Reserved * +* Modified by NSM. * +* * +*--------------------------------------------------------------------------*/ +#define _USE_TIME +#include + +char _cvt_buf[64]; /* real number conversion buffer */ +int daylight=0; /* daylight saving flag */ +time_t timezone=0; /* timezone variable */ + +struct lconv _lconv={".", "", "", "", "", "", "", "", "", "", + CHAR_MAX, CHAR_MAX, CHAR_MAX, CHAR_MAX, + CHAR_MAX, CHAR_MAX, CHAR_MAX, CHAR_MAX }; + +jmp_buf _EOFhandler; /* EOF error jump environment */ +int _open_init; +int _s_args; /* argument count */ +int _vp_ret; /* character count */ +int _vs_count; /* character count */ + +int (*_vs_fill)(FILE *st); /* filler function pointer */ +int (*_vp_flush)(FILE *st); /* output function pointer */ + +/*-------------------------------------------------------------------------* +* error message output - data declarations * +*--------------------------------------------------------------------------*/ + +#ifdef OLDERRORS +char *sys_errlist[]= +{"Unknown Error", +"Error Zero", +"Invalid Function Code", +"File Not Found", +"Path Not Found", +"Too Many Open Files", +"Access Denied", +"Invalid Handle", +"Memory Blocks Destroyed", +"Not Enough Core", +"Invalid Memory Block Address", +"Invalid Environment", +"Invalid Format", +"Invalid Access Code", +"Invalid Data", +"", +"Invalid Drive", +"Attempt To Remove CurDir", +"Not Same Device", +"No More Files", +"Invalid Argument", +"Not Directory", +"Is Directory", +"Corrupted EXE File", +"", +"", +"", +"", +"", +"", +"", +"", +"", +"Cross-Device Link", +"Math Argument Invalid", +"Result Too Large", +"File Locking Deadlock", +"Unknown Error" +}; + +int sys_nerr=38; /* number of system error strings */ +#endif + +char _sys_errbuf[128]; /* error message buffer */ + +/*-------------------------------------------------------------------------* +* Character type array. * +*--------------------------------------------------------------------------*/ + +char _ctype[257] = { +0,/* -1 EOF */ +_IS_CTL,/* 0 NUL */ +_IS_CTL,/* 1 SOH */ +_IS_CTL,/* 2 STX */ +_IS_CTL,/* 3 ETX */ +_IS_CTL,/* 4 EOT */ +_IS_CTL,/* 5 ENQ */ +_IS_CTL,/* 6 ACK */ +_IS_CTL,/* 7 BEL */ +_IS_CTL,/* 8 BS */ +_IS_CTL|_IS_SP,/* 9 HT */ +_IS_CTL|_IS_SP,/* A LF */ +_IS_CTL|_IS_SP,/* B VT */ +_IS_CTL|_IS_SP,/* C FF */ +_IS_CTL|_IS_SP,/* D CR */ +_IS_CTL,/* E SO */ +_IS_CTL,/* F SI */ +_IS_CTL,/* 10 DLE */ +_IS_CTL,/* 11 DC1 */ +_IS_CTL,/* 12 DC2 */ +_IS_CTL,/* 13 DC3 */ +_IS_CTL,/* 14 DC4 */ +_IS_CTL,/* 15 NAK */ +_IS_CTL,/* 16 SYN */ +_IS_CTL,/* 17 ETB */ +_IS_CTL,/* 18 CAN */ +_IS_CTL,/* 19 EM */ +_IS_CTL,/* 1A SUB */ +_IS_CTL,/* 1B ESC */ +_IS_CTL,/* 1C FS */ +_IS_CTL,/* 1D GS */ +_IS_CTL,/* 1E RS */ +_IS_CTL,/* 1F UF */ +_IS_SP,/* 20 '\ ' */ +_IS_PUN,/* 21 ! */ +_IS_PUN,/* 22 " */ +_IS_PUN,/* 23 # */ +_IS_PUN,/* 24 $ */ +_IS_PUN,/* 25 % */ +_IS_PUN,/* 26 & */ +_IS_PUN,/* 27 ' */ +_IS_PUN,/* 28 ( */ +_IS_PUN,/* 29 ) */ +_IS_PUN,/* 2A * */ +_IS_PUN,/* 2B + */ +_IS_PUN,/* 2C ,*/ +_IS_PUN,/* 2D - */ +_IS_PUN,/* 2E . */ +_IS_PUN,/* 2F / */ +_IS_DIG,/* 30 0 */ +_IS_DIG,/* 31 1 */ +_IS_DIG,/* 32 2 */ +_IS_DIG,/* 33 3 */ +_IS_DIG,/* 34 4 */ +_IS_DIG,/* 35 5 */ +_IS_DIG,/* 36 6 */ +_IS_DIG,/* 37 7 */ +_IS_DIG,/* 38 8 */ +_IS_DIG,/* 39 9 */ +_IS_PUN,/* 3A : */ +_IS_PUN,/* 3B ; */ +_IS_PUN,/* 3C < */ +_IS_PUN,/* 3D = */ +_IS_PUN,/* 3E > */ +_IS_PUN,/* 3F ? */ +_IS_PUN,/* 40 @ */ +_IS_UPP|_IS_HEX,/* 41 A */ +_IS_UPP|_IS_HEX,/* 42 B */ +_IS_UPP|_IS_HEX,/* 43 C */ +_IS_UPP|_IS_HEX,/* 44 D */ +_IS_UPP|_IS_HEX,/* 45 E */ +_IS_UPP|_IS_HEX,/* 46 F */ +_IS_UPP,/* 47 G */ +_IS_UPP,/* 48 H */ +_IS_UPP,/* 49 I */ +_IS_UPP,/* 4A J */ +_IS_UPP,/* 4B K */ +_IS_UPP,/* 4C L */ +_IS_UPP,/* 4D M */ +_IS_UPP,/* 4E N */ +_IS_UPP,/* 4F O */ +_IS_UPP,/* 50 P */ +_IS_UPP,/* 51 Q */ +_IS_UPP,/* 52 R */ +_IS_UPP,/* 53 S */ +_IS_UPP,/* 54 T */ +_IS_UPP,/* 55 U */ +_IS_UPP,/* 56 V */ +_IS_UPP,/* 57 W */ +_IS_UPP,/* 58 X */ +_IS_UPP,/* 59 Y */ +_IS_UPP,/* 5A Z */ +_IS_PUN,/* 5B [ */ +_IS_PUN,/* 5C \ */ +_IS_PUN,/* 5D ] */ +_IS_PUN,/* 5E ^ */ +_IS_PUN,/* 5F _ */ +_IS_PUN,/* 60 ` */ +_IS_LOW|_IS_HEX,/* 61 a */ +_IS_LOW|_IS_HEX,/* 62 b */ +_IS_LOW|_IS_HEX,/* 63 c */ +_IS_LOW|_IS_HEX,/* 64 d */ +_IS_LOW|_IS_HEX,/* 65 e */ +_IS_LOW|_IS_HEX,/* 66 f */ +_IS_LOW,/* 67 g */ +_IS_LOW,/* 68 h */ +_IS_LOW,/* 69 i */ +_IS_LOW,/* 6A j */ +_IS_LOW,/* 6B k */ +_IS_LOW,/* 6C l */ +_IS_LOW,/* 6D m */ +_IS_LOW,/* 6E n */ +_IS_LOW,/* 6F o */ +_IS_LOW,/* 70 p */ +_IS_LOW,/* 71 q */ +_IS_LOW,/* 72 r */ +_IS_LOW,/* 73 s */ +_IS_LOW,/* 74 t */ +_IS_LOW,/* 75 u */ +_IS_LOW,/* 76 v */ +_IS_LOW,/* 77 w */ +_IS_LOW,/* 78 x */ +_IS_LOW,/* 79 y */ +_IS_LOW,/* 7A z */ +_IS_PUN,/* 7B { */ +_IS_PUN,/* 7C | */ +_IS_PUN,/* 7D } */ +_IS_PUN,/* 7E ~ */ +_IS_CTL,/* 7F DEL */ +0}; + diff --git a/code/SIBOSDK/src/cio1.a b/code/SIBOSDK/src/cio1.a new file mode 100644 index 0000000..ff0997d --- /dev/null +++ b/code/SIBOSDK/src/cio1.a @@ -0,0 +1,306 @@ +(* Release 3.00 *) + +(* c_io1 - common low level I/O *) + +(* Copyright (C) 1989 Jensen and Partners. All Rights Reserved*) +(* Written by Simon Knight.*) + +(* Copyright (C) 1991 Psion PLC. All Rights Reserved*) +(* Modified by NSM.*) + +include "corelib.inc" +include "epocdefs.inc" + +module cio1 + +(***************************************************************************) +segment _TEXT(CODE,28H) +segment _DATA(DATA,28H) + +extrn __filbuf + +select _TEXT +(* +int fgetc(FILE *st) +*) + +public _fgetc : + + push bx + push cx + push dx + push si + mov bx, ax + mov cx, [bx][_flag] + dec word [bx][_cnt] + js callfunc + mov si, [bx][_ptr] + inc word [bx][_ptr] + mov al, [si] + sub ah, ah +done: + test cx, _F_BIN + jnz noTrans + cmp al, CTLZ + je fgEOF + cmp al, 0DH + jne noTrans + mov ax, bx + call _fgetc +noTrans: + pop si + pop dx + pop cx + pop bx + ret 0 + +callfunc: + push bx + mov ax, bx + call __filbuf + pop bx + jmp done + +fgEOF: + or word [bx][_flag], _F_EOF + mov ax, -1 + jmp noTrans + +(* _fgetc ENDP *) + +(******************************************************************************) +section +segment _TEXT(CODE,28H) +segment _DATA(DATA,28H) + +extrn __flsbuf +extrn __flusher + +select _TEXT +(* +int fputc(int ch, FILE *st) +*) + +public _fputc : + + push cx + push dx + push si + test word [bx][_flag], _F_BIN + jnz fpOK + cmp al, -1 + je fpError + cmp al, CTLZ + je fpEOF + cmp al, 0AH + jne fpOK + push bx + mov ax, 0DH + call _fputc + pop bx + mov ax, 0AH +fpOK: + dec word [bx][_cnt] + js callfunc + mov si, [bx][_ptr] + inc word [bx][_ptr] + mov [si], al + cmp al, 0AH + jne done + test word [bx][_flag], _F_LBUF + jz done + mov ax, bx + call __flusher +done: + pop si + pop dx + pop cx + ret 0 + +callfunc: + call __flsbuf + jmp done +fpError: + mov ax, -1 + jmp done + +fpEOF: + or word [bx][_flag], _F_CTZ + jmp fpOK + +(* _fputc ENDP *) + +(****************************************************************************) +section +segment _TEXT(CODE,28H) +segment _DATA(DATA, 28H) + +select _DATA + +extrn __ungotchar + +select _TEXT +public _ungetch : +(* +int ungetch(int c) +Returns character to console input stream. Returns EOF if __ungotchar +is occupied. +*) + + cmp word [__ungotchar], -1 + jne occupied + cmp ax, -1 + je occupied + mov [__ungotchar], ax + jmp ungetchDone +occupied: + mov ax, EOF +ungetchDone: + ret 0 + +(* _ungetch ENDP *) + +(***************************************************************************) +section +segment _TEXT(CODE,28H) + +extrn __ioerr + +public _chmod : +(* +int chmod(char *path, int attribute) +Returns -1 on error and sets _errno. +*) + + push bx + push cx + push di + mov cx, bx + mov bx, ax + mov di, 1 + cmp cx, S_IREAD + je chRdonly + mov cx, FileAttWrite + jmp chGotmode +chRdonly: + sub cx, cx +chGotmode: + sub al, al + mov ah, NmFilStatusSet + int FilManager + jnc chSuccess + call __ioerr (* set errno *) + mov ax, -1 + jmp chDone +chSuccess: + sub ax, ax +chDone: + pop di + pop cx + pop bx + ret 0 + +(******************************************************************************) +section +segment _TEXT(CODE,28H) + +extrn __ioerr + +public __chmod : +(* +int _chmod(char *path, int mode, int attribute) +mode 0 - returns file attribute. +mode 1 - sets file attribute to attribute. +Returns -1 on error. Low level DOS function. +*) + + push bx + push cx + push di + sub sp, FileEnt + test bx, bx + mov bx, ax + jz getAtt + mov di, FileAttWrite | FileAttHidden | FileAttSystem + and cx, di + xor cl, FileAttWrite + sub al, al + mov ah, NmFilStatusSet + int FilManager + jnc chSuccess +chFailed: + call __ioerr (* set errno *) + mov ax, -1 + jmp chDone +getAtt: + mov cx, sp + sub al, al + mov ah, NmFilStatusGet + int FilManager + jc chFailed + mov bx, sp + mov ax, [bx][FileAtt] + and ax, FileAttWrite | FileAttHidden | FileAttSystem + xor al, FileAttWrite +chSuccess: + sub ax, ax +chDone: + add sp, FileEnt + pop di + pop cx + pop bx + ret 0 + +(******************************************************************************) +section +segment _TEXT(CODE,28H) + +extrn __ioerr + +public _access : +(* +int access(char *path, int mode) +Returns 0 if mode available. +Returns -1 on error. +*) + +exist = 0 +write = 2 +read = 4 +rdwr = 6 + + push bx + push cx + push dx + sub sp, FileEnt + mov cx, sp + mov dx, bx + mov bx, ax + sub al, al + mov ah, NmFilStatusGet + int FilManager + jnc accSuccess + call __ioerr (* set errno *) +accNo: + mov ax, -1 + jmp accDone +accSuccess: + test dx, dx + je accYes + test dx, write + jz accYes + mov bx, sp + test byte [bx][FileAtt], FileAttWrite + jz accNo +accYes: + sub ax, ax +accDone: + add sp, FileEnt + pop dx + pop cx + pop bx + ret 0 + +end + + diff --git a/code/SIBOSDK/src/cio2.c b/code/SIBOSDK/src/cio2.c new file mode 100644 index 0000000..eee1edd --- /dev/null +++ b/code/SIBOSDK/src/cio2.c @@ -0,0 +1,1665 @@ +/* Release 3.00 */ +/*-------------------------------------------------------------------------* +* * +* cio2.c - common I/O * +* * +* COPYRIGHT (C) 1989 Jensen and Partners. All Rights Reserved * +* Written by Simon Knight. * +* * +* COPYRIGHT (C) 1991 Psion PLC. All Rights Reserved * +* Modified by NSM. * +* * +*--------------------------------------------------------------------------*/ + +#define _USE_TIME +#define _USE_CONIO +#include "clib.h" + +/**************************************************************************** +* buffer flushing functions. * +****************************************************************************/ + +int _flsbuf(int ch, FILE *st) { + + int flag; + + ch&=0xFF; + flag=st->_flag; + if( (!flag) || (flag&_F_ERR)) + return(-1); + if((flag&_F_EOF) && (flag&_F_IN)) { + lseek(st->_file, 0L, SEEK_END); + st->_flag|=_F_RST; + st->_flag&=(~(_F_IN|_F_EOF)); + if(st->_size) { + _flusher(st); + --st->_cnt; + *st->_ptr++= (char) ch; + return(ch); + } + } + else { + if((!(flag&_F_WRIT)) || (flag&_F_IN) + || ((!(flag&_F_BIN)) && ((char) ch == EOF))) { + st->_flag|=_F_ERR; + return(-1); + } /* return error */ + if(st->_size) { /* buffered */ + if(_flusher(st)== -1 ) /* flush buffer */ + return(-1); + --st->_cnt; /* put overflow char in buffer */ + *st->_ptr++= (char) ch; + return(ch); + } + st->_flag&=~_F_RST; /* clear reset flag */ + if(flag&_F_APP) + lseek(st->_file, 0L, SEEK_END); /* unbuffered - write data */ + } + st->_cnt=0; /* set buffer pointers */ + st->_ptr=NULL; + st->_flag|=_F_OUT; /* set output flag */ + if(_write(st->_file,&ch,1) != 1) { + st->_flag|=_F_ERR; + return(-1); + } + if((ch == _CTLZ) && (!(flag&(_F_BIN|_F_DEV)))) + /* ctl z - set EOF flag if */ + st->_flag|=_F_EOF; /* text mode and not device */ + return(ch); +} + +int _flusher(FILE *st) /* empties output buffer */ + +{ + unsigned wnum, flag; + char zbuf[128]; + long pos; + int nr, sr; + + flag=st->_flag; + if(flag&(_F_IN|_F_EOF)) + return(-1); + if(flag&_F_RST) /* set up reset buffer for output */ + { + st->_flag&=(~_F_RST); + st->_flag|=_F_OUT; + st->_cnt=st->_size; + st->_ptr=st->_base; + return(0); /* return - buffer wasn't full */ + } + if(st->_cnt<0) + st->_cnt=0; + wnum=st->_size-st->_cnt; + if(wnum == 0) /* nothing to do - return */ + return(0); /* buffer empty */ + if(flag&_F_BIN) /* binary mode */ + { + if(flag&_F_APP) + lseek(st->_file, 0L, SEEK_END); /* append */ + if(_write(st->_file, st->_base, wnum) != wnum) + goto error; + } + else /* text mode */ + { + if(flag&_F_APP) { + pos = lseek(st->_file, -128L, SEEK_END); + if(pos < 0) + lseek(st->_file, 0, SEEK_SET); + nr = _read(st->_file, zbuf, 128); + sr = nr; + if (nr == -1) + goto error; + while(--sr >= 0) { + if(zbuf[sr] != _CTLZ) + break; + } + pos = sr - nr + 1; + lseek(st->_file, pos, SEEK_END); /* append after last cltZ */ + } + if(_write(st->_file, st->_base, wnum) == -1) + goto error; + if(st->_flag&_F_CTZ) { + st->_flag|=_F_EOF; + st->_cnt=0; + st->_ptr=st->_base; + return(0); + } + } + st->_cnt=st->_size; /* set buffer pointers */ + st->_ptr=st->_base; + st->_flag|=_F_OUT; /* set output flag */ + return(0); +error: + st->_flag|=_F_ERR; + st->_cnt=0; + return(-1); +} + +/**************************************************************************** +* buffer filling functions * +****************************************************************************/ + +int _filbuf(FILE *st) +{ + int ch, n, flag; + + flag=st->_flag; + if((!flag)||(flag&(_F_EOF|_F_ERR))) + return(-1); + if((flag&_F_OUT) || (!(flag&_F_READ))) + { + st->_flag|=_F_ERR; + return(-1); /* return error */ + } + if(st->_size) /* buffered */ + { + if(_filler(st) <= 0 ) /* fill buffer */ + return(-1); + --st->_cnt; /* get first char from buffer */ + ch=*st->_ptr++; + return(ch&0xFF); /* return first character in buffer */ + } + st->_cnt=0; /* reset pointers */ + st->_flag|=_F_IN; /* set input flag */ + st->_ptr=NULL; + st->_flag&=~_F_RST; + for(n=0; n<2; n++) /* unbuffered - read character */ + { + if(_read(st->_file, &ch, 1) != 1) + { + st->_flag|=_F_EOF; + return(-1); + } + ch&=0xFF; + if((flag&_F_BIN)||(ch != '\r')) /* dont translate if binary mode */ + break; + } + if((!(flag&(_F_BIN|_F_DEV))) && (ch == _CTLZ)) + st->_flag|=_F_EOF; /* ctl z end of file */ + return(ch); +} + +int _filler(FILE *st) /* fills buffer */ +{ + int flag, num; + + flag=st->_flag; + if(flag&(_F_OUT|_F_EOF)) + return(-1); + if(flag&_F_RST) + st->_flag&=~_F_RST; + num =_read(st->_file, st->_base, st->_size); + st->_ptr=st->_base; + if(( num == -1) && (num != st->_size)) + goto error; + st->_cnt=num; /* reset pointers */ + st->_flag|=_F_IN; /* set input flag */ + if(num == 0) + { + st->_flag|=_F_EOF; /* end of file */ + return(-1); + } + return(num); +error: /* read error */ + st->_flag|=_F_ERR; + st->_cnt=0; + return(-1); +} + +int fputchar(int ch) +{ + return(fputc(ch, stdout)); +} + +int fgetchar() +{ + return(fgetc(stdin)); +} + +/**************************************************************************** +* ungetc - put character back onto input stream * +****************************************************************************/ + +int ungetc(int ch, FILE *st) +{ + int flag; + + flag=st->_flag; + if((!flag) || (flag&_F_ERR)) + return(EOF); + if(ch == EOF) + return(EOF); /* return EOF if error, EOF or not read mode */ + if(flag&_F_OUT) + { + st->_flag|=_F_ERR; + return(EOF); /* return EOF if error, EOF or not read mode */ + } + ch&=0xFF; + st->_flag&=(~_F_EOF); /* clear EOF */ + if((flag&_F_RST) || (st->_size == 0)) + { + st->_flag&=(~_F_RST); + st->_flag|=_F_IN; + if(st->_size) + st->_ptr=st->_base; + else + st->_ptr= (char *) &st->_pback; + if((ch == 0xA) && (!(st->_flag&_F_BIN))) { + st->_cnt=2; + *((unsigned *)st->_ptr)=0xA0D; + } + else { + st->_cnt=1; + *st->_ptr=ch; + } + return(ch); + } + if((ch == 0xA) && (!(st->_flag&_F_BIN)) && (st->_cnt < st->_size-2)) { + *--st->_ptr= (char) 0xD; + st->_cnt++; + } + *--st->_ptr= (char) ch; /* buffer not full - put it in buffer */ + st->_cnt++; + return(ch); +} + +/**************************************************************************** +* rewind - rewind and clear error flag * +****************************************************************************/ + +void rewind(FILE *st) +{ + if(st->_flag) + { + st->_flag&=(~_F_ERR); + fseek(st, 0L, SEEK_SET); + } + return; +} + +/**************************************************************************** +* flushall - flush all open streams * +****************************************************************************/ + +int flushall() +{ + int n, count; + + count=0; + for(n=0; n< _open_max; n++) + { + if(_iob[n]._flag) /* inc count if open file */ + { + fflush(&_iob[n]); /* flush buffer */ + count++; + } + } + return(count); /* return number of open streams */ +} + +void _flushall() +{ + int n; + + for(n=0; n<_open_max; n++) + { + if((_iob[n]._flag) && (_iob[n]._size)) + _flusher(&_iob[n]); /* flush buffer */ + } + return; /* return number of open streams */ +} + +/**************************************************************************** +* fopen - open stream * +****************************************************************************/ + +#define _WRITE 2 +#define NODEFMODE 4 +#define _READ 8 + +FILE *fopen(const char *path, const char *type) +{ + int num; + int handle, flag, mode; + + flag=_F_RST; + mode=0; + if(_scan_type(type, &flag, &mode) < 0) /* get access mode */ + return(NULL); + handle=_open_stream(path, &flag, mode); /* open the file */ + if(handle < 0) + return(NULL); + num=_free_stream(); /* find a free stream */ + if(num < 0) + { + close(handle); + return(NULL); + } + return(_alloc_stream(&_iob[num], handle, flag)); +} /* allocate the stream */ + +int _scan_type(const char *type, int *fptr, int *mptr) +{ /* evaluate file mode */ + int c, n; + + switch(type[0]) + { + case 'r': + *mptr|=(_READ|O_EXCL); + break; + case 'w': + *mptr|=(O_TRUNC|O_CREAT|_WRITE); + break; + case 'a': + *fptr|=_F_APP; + *mptr|=(_WRITE|O_APPEND|O_CREAT); + break; + default: + return(-1); + } + n=0; + do + { + c=type[++n]; + switch(c) + { + case'+': + *mptr|=(_READ|_WRITE); + break; + case'b': + *fptr|=_F_BIN; + *mptr|=NODEFMODE|O_BINARY; + break; + case't': + *mptr|=NODEFMODE|O_TEXT; + break; + default: + break; + } + } while((n < 3) && (c)); + return(0); +} + +int _open_stream(const char *path, int *fptr, int mode) +{ + unsigned access, permission; + + access=0; /* translates level 2 */ + permission=0; /* access and permission */ + if(!(mode&NODEFMODE)) /* flags to level 1 and */ + { /* uses open to get handle */ + if(_fmode==O_BINARY) + { + *fptr|=_F_BIN; + access= O_BINARY; + } + else + access=O_TEXT; + } + if(mode&_WRITE) + { + permission|=S_IWRITE; + if(mode&_READ) + { + *fptr|=_F_RDWR; + permission|=S_IREAD; + access|=O_RDWR; + } + else + { + *fptr|=_F_WRIT; + access|=O_WRONLY; + } + } + else + { + access|=O_RDONLY; + permission=S_IREAD; + *fptr|=_F_READ; + } + access|= (mode&(O_TEXT|O_BINARY|O_CREAT|O_TRUNC|O_EXCL|O_APPEND)); + return(open(path, access, permission)); +} + +int _valid_stream(FILE *st) /* checks stream pointer is valid */ +{ + if((st > &_iob[_open_max-1]) || (st < _iob) || (st->_flag==0) ) + return(FALSE); + return(TRUE); +} + +/**************************************************************************** +* fgetpos - get current stream position * +****************************************************************************/ + +int fgetpos(FILE *st, fpos_t *fp) +{ + long pos; + + pos=ftell(st); + if(pos == -1) + return(-1); + *fp= (fpos_t) pos; + return(0); +} + +/**************************************************************************** +* fsetpos - set current stream position * +****************************************************************************/ + +int fsetpos(FILE *st, const fpos_t *fp) +{ + return fseek(st, *fp, SEEK_SET); +} + +/*-------------------------------------------------------------------------* +* close.c - level 1 I/O - close file. * +*--------------------------------------------------------------------------*/ + +int close(int handle) +{ + int n; + + n=_close(handle); /* close file */ + if(n < 0) + return(-1); /* return -1 if error */ + _openfd[handle]=0; /* zero file descriptor */ + return(0); /* success - return 0 */ +} + +/*-------------------------------------------------------------------------* +* eof.c - level 1 I/O - test for eof. * +*--------------------------------------------------------------------------*/ + +int eof(int handle) +{ + if( (_openfd[handle]&O_TEXT) && (_openfd[handle]&_O_EOF)) + return(1); /* text file ctl z eof */ + if(_openfd[handle]&O_DEVICE) + return(0); /* device - no eof unless text mode */ + return(_eof(handle)); +} + +/*-------------------------------------------------------------------------* +* umask.c - level 1 I/O - set file permission mask. * +*--------------------------------------------------------------------------*/ + +unsigned umask(unsigned permission) +{ + unsigned ret; + + ret=_fmask; + _fmask=permission; + return(ret); +} + +/*-------------------------------------------------------------------------* +* filelength.c - returns file length. * +*--------------------------------------------------------------------------*/ + +long filelength(int handle) +{ + long pos, size; + + pos=tell(handle); /* save file position */ + if(pos == -1) + return(pos); + size=lseek(handle, 0L, SEEK_END); /* get file length */ + lseek(handle, pos, SEEK_SET); /* restore original file position */ + return(size); +} + +int rmtmp(void) +{ + int n, files; + + n=0; + files=0; + while(n < _open_max) + { + if (_tmpfiles[n]) + { + fclose(_tmpfptrs[n]); + unlink(_tmpfiles[n]); + _tmpfiles[n]=NULL; + ++files; + } + ++n; + } + _exit_tmp=NULL; + return(files); +} + +FILE *tmpfile(void) +{ + int handle,i; + FILE *ret; + char *e,*p,name[0x128]; + + name[0]=0; + if ((e=getenv("TMP"))!=NULL && (i=strlen(e))!=0) + { + strcpy(&name[0],e); + p=(&name[i-1]); + if (*p!='\\') + { + *p++='\\'; + *p=0; + } + } + if ((handle=_creat_temp(&name[0],FA_NORMAL))==(-1)) + return(NULL); + _openfd[handle]=O_BINARY|O_RDWR; + i=strlen(&name[0])+1; + if ((p=malloc(i))==NULL) + goto failed1; + strcpy(p,&name[0]); + _tmpfiles[handle]=p; + if ((ret=fdopen(handle,"w+b"))==NULL) + goto failed2; + _tmpfptrs[handle]=ret; + _exit_tmp=_exit2; + return(ret); +failed2: + free(_tmpfiles[handle]); + _tmpfiles[handle]=NULL; +failed1: + _openfd[handle]=0; + _close(handle); + return(NULL); +} + +/*-------------------------------------------------------------------------* +* console I/O section. * +*--------------------------------------------------------------------------*/ + +char *cgets(char *s) +{ + extern void *winHandle; + extern void p_xwind(void); + + if(!_p_init) + { + _i_putch=_d_putch; + _i_cgets=_d_cgets; + _p_init=-1; + if (winHandle==NULL) + p_xwind(); + } + return(_i_cgets(s)); +} + +int sopen(const char *path, int access, int shflag, ...) +{ + va_list _v_argptr; + + va_start(_v_argptr, shflag); + return(open(path, access|shflag, va_arg(_v_argptr, int))); +} + +/*-------------------------------------------------------------------------* +* macro equivalents. * +*--------------------------------------------------------------------------*/ + +int ferror(FILE *st) +{ + return((st)->_flag & _F_ERR); +} + +int feof(FILE *st) +{ + return((st)->_flag & _F_EOF); +} + +int fileno(FILE *st) +{ + return((st)->_file); +} + +int remove(const char *path) +{ + return(unlink(path)); +} + +int getc(FILE *st) +{ + return(fgetc(st)); +} + +int putc(int c, FILE *st) +{ + return(fputc(c, st)); +} + +int getchar() +{ + return(fgetc(stdin)); +} + +int putchar(int c) +{ + return(fputc(c, stdout)); +} + +/**************************************************************************** +* puts - send string to stdout * +****************************************************************************/ + +int puts(const char *s) +{ + int n, c, ret; + + n=0; + while((c=s[n++]) != 0) + { + if(putchar(c) == EOF) + { + ret=-1; + goto puts_error; + } + } + if(putchar('\n') == EOF) + { + ret=-1; + goto puts_error; + } + ret=fflush(stdout); +puts_error: + return(ret); +} + +/**************************************************************************** +* gets - get string from stdin * +****************************************************************************/ + +char *gets(char *s) +{ + int n, c; + char *ret; + + n=0; + while((c=getchar()) != '\n') + { + if(c < 0) + { + if((feof(stdin)) && (n)) + break; + ret=NULL; + goto gets_error; + } + s[n++]= (char) c; + } + s[n]=0; + ret=s; +gets_error: + return(ret); +} + +/**************************************************************************** +* fputs - put string on stream * +****************************************************************************/ + +int fputs(const char *s, FILE *st) +{ + int n, c, ret; + + ret=0; + n=0; + while((c=s[n++]) != 0) + { + if(fputc(c, st) == EOF ) + { + ret=-1; + break; + } + } + if(st->_flag&_F_DEV) + fflush(st); + return(ret); +} + +/**************************************************************************** +* fgets - get string from stream * +****************************************************************************/ + +char *fgets(char *s, int num, FILE *st) +{ + int n, c; + char *ret; + + n=0; + ret=s; + while( n < num-1) + { + c=fgetc(st); + if(c == -1) + { + if((feof(st)) && (n)) + break; + ret=NULL; + goto fgets_end; + } + s[n++]= (char) c; + if(c == '\n') + break; + } + s[n]=0; +fgets_end: + return(ret); +} + +/**************************************************************************** +* getw - get word from stream * +* putw - put word on stream * +****************************************************************************/ + +int getw(FILE *st) +{ + unsigned hibyte, lobyte; + + lobyte=fgetc(st); + hibyte=fgetc(st); + return( (hibyte*0x100)+lobyte); +} + +int putw(int num, FILE *st) +{ + int ret; + + fputc(num&0xFF, st); + ret=fputc((num&0xFF00)>>8, st); + return(ret); +} + +/**************************************************************************** +* clearerr - clear error and EOF flags and reset buffer status * +****************************************************************************/ + +void clearerr(FILE *st) + +{ + if(st->_flag) + { + st->_flag&=~(_F_ERR|_F_EOF|_F_CTZ); + _openfd[st->_file]&= (~_O_EOF); + } + return; +} + +/**************************************************************************** +* fseek - position stream pointer * +****************************************************************************/ + +int fseek(FILE *st, long offset, int orig) +{ + long ret, temp, pos; + int flag; + + flag=st->_flag; + if((!flag) || (flag&_F_ERR)) + { + errno=EBADF; + ret=-1; + goto fseek_end; + } + if(orig == SEEK_CUR) + { + if((!(flag&(_F_WRIT|_F_RST))) && (st->_size)) { + if(offset == 0) { + ret=0; + goto fseek_end; + } + else if(offset < 0) + pos=st->_ptr-st->_base; + else + pos=st->_cnt; + if(pos > labs(offset)) { + st->_cnt-=(short)offset; + st->_ptr+=(short)offset; + ret=0; + goto fseek_end; + } + } + temp=ftell(st); + ret=fseek(st, temp+offset, SEEK_SET); + if(ret) + ret = -1L; + goto fseek_end; + } + if((st->_size) && (flag&_F_OUT)) /* flush output buffer */ + _flusher(st); + st->_pback=0; /* reset buffer */ + st->_cnt=0; + st->_flag|=_F_RST; + ret=lseek(st->_file, offset, orig); + st->_flag&=~(_F_IN|_F_OUT|_F_EOF|_F_CTZ); /* clear direction flag and EOF */ + _openfd[st->_file]&=~(_O_EOF); +fseek_end: + if(ret < 0) + return(1); + return(0); +} + +/**************************************************************************** +* ftell - return stream pointer * +****************************************************************************/ + +long ftell(FILE *st) +{ + long pos, ret; + int flag; + + flag=st->_flag; + if((!flag) || (flag&_F_ERR)) + { + errno=EINVAL; + ret=-1L; + goto ftell_error; + } + if((flag&_F_RST) || (!st->_size)) /* unbuffered or reset stream */ + { + st->_cnt=0; + ret=tell(st->_file); + } + else if(flag&_F_OUT) /* output stream */ + { + _flusher(st); /* flush stream */ + ret=tell(st->_file); + } + else + { + pos=tell(st->_file); /* input stream */ + if(st->_pback != 0) + --pos; + if((flag&_F_BIN) && (st->_pback == 0xA0D)) + --pos; + ret=pos-st->_cnt; + } +ftell_error: + return(ret); +} + +/**************************************************************************** +* fflush - flush stream * +****************************************************************************/ + +int fflush(FILE *st) +{ + int flag, ret; + + if(st == NULL) + { + flushall(); + return(0); + } + flag=st->_flag; + if((!flag)||(flag&(_F_EOF|_F_ERR))) + { + ret=EOF; /* error EOF or not open */ + goto fflush_end; + } + if(!st->_size) + { + st->_cnt=0; + st->_flag|=_F_RST; + st->_flag&=~(_F_OUT|_F_IN); + ret=0; /* no buffer */ + goto fflush_end; + } + if(flag&_F_OUT) + ret=_flusher(st); /* flush output buffer */ + else + { + fseek(st, ftell(st), SEEK_SET); + ret=0; + goto fflush_end; + } + st->_pback=0; /* reset buffer */ + st->_cnt=0; + st->_flag|=_F_RST; + st->_flag&=~(_F_OUT|_F_IN); +fflush_end: + return(ret); +} + +/**************************************************************************** +* fdopen - assign stream to handle * +****************************************************************************/ + +#define _WRITE 2 +#define NODEFMODE 4 +#define _READ 8 + +FILE *fdopen(int handle, char *type) +{ + int num; + int flag, mode; + + flag=_F_RST; + mode=0; + if(handle < 0) /* bad handle */ + { + errno=EBADF; + return(NULL); + } + if(_scan_type(type, &flag, &mode) < 0) /* get the access mode */ + return(NULL); + if((!(mode&NODEFMODE))&&(_fmode==O_BINARY)) + flag|=_F_BIN; + if(mode&_WRITE) + { + if(mode&_READ) + flag|=_F_RDWR; + else + flag|=_F_WRIT; + } + else + flag|=_F_READ; + num=_free_stream(); /* find a free stream */ + if(num < 0) + { + close(handle); + return(NULL); + } + return(_alloc_stream(&_iob[num], handle, flag)); +} /* allocate the stream */ + +FILE * _alloc_stream(FILE *stream, int handle, int flag) +{ + stream->_file=handle; /* allocates buffer and sets flags */ + stream->_flag=flag; + stream->_cnt=0; + stream->_pback=0; + stream->_size=BUFSIZ; + if(_openfd[handle]&O_DEVICE) + stream->_flag|=_F_DEV; + if((stream->_base= (char *) malloc(BUFSIZ)) == NULL) + { + stream->_size=0; /* no memory for buffer */ + stream->_ptr=NULL; + errno=ENOMEM; + } + else + { + stream->_size=BUFSIZ; + stream->_ptr=stream->_base; + } + return(stream); +} + +int _free_stream() /* find a free stream */ +{ + int n; + + for(n=0; n < _open_max; n++) + { + if(_iob[n]._flag == 0) + return(n); + } + return(-1); +} + +/**************************************************************************** +* freopen - close existing stream and assign new file * +****************************************************************************/ + +FILE *freopen(const char *path, const char *type, FILE *st) +{ + int handle, flag, mode; + + if(fclose(st) == EOF) /* close old stream */ + return(NULL); + flag=_F_RST; + mode=0; + if(_scan_type(type, &flag, &mode) < 0) /* get file mode */ + goto fr_error; + handle=_open_stream(path, &flag, mode); /* open new */ + if(handle < 0) + goto fr_error; + return(_alloc_stream(st, handle, flag)); /* assign to stream */ +fr_error: + return(NULL); +} + +/**************************************************************************** +* fclose - close stream * +****************************************************************************/ + +int fclose(FILE *st) +{ + int ret; + + ret=0; + if(!_valid_stream(st)) + { + ret=-1; + goto fclose_error; + } + if(st->_size) + _flusher(st); /* flush buffer if any */ + if(close(st->_file) < 0) /* close file */ + ret=-1; + if((st->_base != NULL) && (!(st->_flag&_F_UBUF))) + free(st->_base); /* free system allocated buffer */ + st->_flag=0; /* free stream */ + if(_tmpfiles[st->_file]) + { + unlink(_tmpfiles[st->_file]); + free(_tmpfiles[st->_file]); + _tmpfiles[st->_file]=NULL; + } +fclose_error: + return(ret); +} + +/**************************************************************************** +* fcloseall - closes all streams except standards * +****************************************************************************/ + +int fcloseall(void) +{ + int n, count; + + count=0; + for(n=3; n < _open_max; n++) + { + if(fclose(&_iob[n]) == 0) + count++; + } + return(count); +} + +/**************************************************************************** +* setbuf - allocates user buffer to stream * +****************************************************************************/ + +void setbuf(FILE *st, char *buffer) +{ + if((!_valid_stream(st))||(!(st->_flag&_F_RST))||(st->_flag&_F_UBUF)) + return; + if(st->_base != NULL) /* free any system buffer */ + free(st->_base); + st->_base=buffer; /* use user buffer */ + st->_ptr=buffer; + if(buffer != NULL) + { + st->_size=BUFSIZ; + st->_flag|=_F_UBUF; + } + else + { + st->_size=0; + st->_flag&=~_F_LBUF; + } + return; +} + +/**************************************************************************** +* setvbuf - allocates user or system buffer to stream * +****************************************************************************/ + +int setvbuf(FILE *st, char *buffer, int type, size_t size) +{ + int flag; + + if((type < _IOFBF) || (type > _IONBF) || ((int) size < 0)) + return(1); + flag=st->_flag; + if((!_valid_stream(st))||(!(flag&_F_RST))||(size < 0)) + { + return(1); + } + if((st->_base != NULL) || (!(st->_flag&_F_UBUF))) /* free old buffer */ + free(st->_base); + st->_flag&=(~_F_LBUF|_F_IN|_F_OUT); + if(type != _IONBF) + { + if(buffer==NULL) + { /* allocate new system buffer */ + buffer=malloc(size); + if(buffer==NULL) + { + errno=ENOMEM; + return(1); + } + } + else /* user buffer */ + st->_flag|=_F_UBUF; + st->_base=buffer; + st->_ptr=buffer; + st->_size=size; + if(type == _IOLBF) /* line buffered */ + st->_flag|=_F_LBUF; + } + else /* no buffer */ + { + st->_size=0; + st->_base=NULL; + st->_ptr=NULL; + st->_cnt=0; + } +setvbuf_error: + return(0); +} + +/**************************************************************************** +* fread - get a number of data blocks from stream * +****************************************************************************/ + +size_t fread(void *buf, size_t size, size_t count, FILE *st) +{ + unsigned numtoread; + unsigned pos; + int flag; + char *buffer; + long total, numleft, p; + size_t ret; + + flag=st->_flag; + if((!flag) || (size == 0) || (count==0) || (flag&(_F_ERR|_F_EOF))) + { + ret=0; + goto fread_error; + } + if((flag&_F_OUT) || (!(st->_flag&_F_READ))) + { + st->_flag|=_F_ERR; + ret=0; + goto fread_error; + } + st->_flag|=_F_IN; + buffer=(char *)buf; + total=size*count; /* how many bytes are there to read */ + pos=0; + if((st->_size == 0) || (!(st->_flag&_F_BIN))) + { + for(p=0; p < total; p++) /* unbuffered */ + { + ret=getc(st); + if(ret == EOF ) + break; + buffer[pos]= (char) ret; + pos++; + } + } + else + { + numleft=total; + p=0; + do + { + if(st->_cnt == 0) /* fill empty buffer */ + { + if(_filler(st) <= 0) + break; /* error or EOF */ + } + if( (long) (unsigned) st->_cnt >= numleft) /* read entire item */ + numtoread = (unsigned) numleft; + else + numtoread=st->_cnt; /* read entire buffer */ + memcpy(buffer, st->_ptr, numtoread); + st->_cnt-=numtoread; + buffer+=numtoread; + st->_ptr+=numtoread; + numleft-=numtoread; + p+=numtoread; + }while(numleft); + } + ret=(int) p/size; +fread_error: + return(ret); /* return number of complete items read */ +} + +/**************************************************************************** +* fwrite - put a number of data blocks on stream * +****************************************************************************/ + +size_t fwrite(const void *buf, size_t size, size_t count, FILE *st) +{ + unsigned numtowrite; + unsigned pos; + char *buffer; + long total, numleft, p; + int flag; + size_t ret; + + flag=st->_flag; + if((!flag) || (size == 0) || (count==0) || (flag&(_F_ERR|_F_EOF))) + { + ret=0; + goto fwrite_error; + } + if((flag&_F_IN) || (!(st->_flag&_F_WRIT))) + { + st->_flag|=_F_ERR; + ret=0; + goto fwrite_error; + } + st->_flag|=_F_OUT; + buffer=(char *)buf; + pos=0; + total=size*count; + if((st->_size == 0) || (!(st->_flag&_F_BIN))) + { + for(p=0; p < total; p++) /* unbuffered */ + { + if(putc(buffer[pos], st) == -1) + break; + pos++; + } + } + else + { + numleft=total; + p=0; + do + { + if( (long) (unsigned) st->_cnt >= numleft) /* write entire item */ + numtowrite= (unsigned) numleft; + else + numtowrite=st->_cnt; /* write entire buffer */ + memcpy(st->_ptr, buffer, numtowrite); + st->_cnt-=numtowrite; + buffer+=numtowrite; + st->_ptr+=numtowrite; + numleft-= (long) numtowrite; + if(st->_cnt == 0) + { + if(_flusher(st) < 0) + break; /* error */ + } + p+=numtowrite; + }while(numleft); + } + ret=(int) p/size; +fwrite_error: + return(ret); /* return number of complete items written */ +} + +/*--------------------------------------------------------------------------* +* creat.c - creates a file. +*---------------------------------------------------------------------------*/ + +int creat(const char *path, int permission) +{ + int fh, fdesc; + + fdesc=_fmode; /* set RTL I/O flags */ + permission^=_fmask; + if(permission == S_IREAD) + { + permission=FA_RDONLY; + } + else + { + fdesc|=O_RDWR; + permission=FA_NORMAL; + } + if(_fmode&O_TEXT) + permission=FA_TEXT; + fh=_creat_trunc(path, permission); /* truncate if exists and !readonly */ + if((fh < 0) || (fh >= _open_max)) + return(-1); + if(isatty(fh)) + fdesc|=O_DEVICE; + _openfd[fh]=fdesc; /* store file descriptor */ + return(fh); /* return handle */ +} + +/*-------------------------------------------------------------------------* +* open.c - opens a file. * +* This function opens a file, setting DOS access and permision modes, * +* and stores access and translation modes in the file descriptor array * +* _openfd. * +*--------------------------------------------------------------------------*/ + +#pragma warn(wvnu => off) + +int open(const char *path, int access, ...) +{ + va_list varg; + int fh, fdesc; + unsigned permission; + + fdesc=0; + if(access&O_TEXT) /* defaults to _fmode */ + fdesc|=O_TEXT; + else if(access&O_BINARY) + fdesc|=O_BINARY; + else if( (_fmode == O_BINARY) || (_fmode == O_TEXT)) + fdesc|=_fmode; + else + fdesc|=O_BINARY; + if(access&(O_CREAT|O_APPEND|O_TRUNC)) /* create append or truncate */ + { + if(access&O_CREAT) + { + va_start(varg, access); + permission=va_arg(varg, unsigned); /* get permission */ + } + else + { + if(!(access&(O_RDWR|O_WRONLY))) + permission=S_IREAD; + else + permission=S_IREAD|S_IWRITE; + } + permission^=_fmask; /* exclusive or with fmask */ + if(permission == S_IREAD) /* set DOS access modes */ + { + permission=FA_RDONLY; + } + else + { + fdesc|=O_RDWR; + permission=FA_NORMAL; + } + if (fdesc&O_TEXT) + permission|=FA_TEXT; + if(_exists(path)) /* does file exist ? */ + { + if(access&O_EXCL) + { + errno=EEXIST; + return(-1); /* if exclusive flag return error */ + } + if(!(access&O_TRUNC)) + goto open_file; /* if not truncate open file */ + } + else if(!(access&O_CREAT)) /* create only if flag set */ + { + errno=ENOENT; + return(-1); + } + fh=_creat_trunc(path, permission); + } + else + { +open_file: /* open file */ + if(!(access&(O_RDWR|O_WRONLY))) + fdesc|=O_RDONLY; /* write access given */ + else + { + access&=~(O_RDONLY|O_WRONLY); + access|=O_RDWR; + fdesc|=O_RDWR; + } + access&=~(O_TEXT|O_BINARY); + if (fdesc&O_TEXT) + access|=O_TEXT; + fh=_open(path, access); + } + if((fh < 0) || (fh >= _open_max)) /* invalid handle from _open or _creat */ + return(-1); + if(access&O_APPEND) /* if O_APPEND set flag */ + fdesc|=O_APPEND; + if(isatty(fh)) /* check for character device */ + fdesc|=O_DEVICE; + _openfd[fh]=fdesc; /* store file descriptor */ + return(fh); /* return handle */ +} + +/*-------------------------------------------------------------------------* +* dup.c - level 1 I/O - force duplicate file handle. * +*--------------------------------------------------------------------------*/ + +int dup(int handle) +{ + int nh; + + if(((nh=_dup(handle)) == -1) || (nh >= _open_max)) + return(-1); /* duplication failed */ + _openfd[nh]=_openfd[handle]; /* copy file desc */ + return(nh); /* success - return new handle */ +} + +#pragma warn(wvnu => on) + +/*-------------------------------------------------------------------------* +* dup2.c - level 1 I/O - force duplicate file handle. * +*--------------------------------------------------------------------------*/ + +int dup2(int oldhandle, int newhandle) +{ + if(_openfd[newhandle]) /* close new handle if open */ + close(newhandle); /* at level 1 */ + if(_dup2(oldhandle, newhandle) < 0) + return(-1); /* duplication failed */ + _openfd[newhandle]=_openfd[oldhandle]; /* copy file desc */ + return(0); /* success - return 0 */ +} + +/*-------------------------------------------------------------------------* +* setmode.c - set file translation mode . * +*--------------------------------------------------------------------------*/ + + +int setmode(int handle, unsigned mode) +{ + int ret, n; + char name[P_FNAMESIZE]; + + if((mode != O_BINARY) && (mode != O_TEXT)) + { +invalid: + errno=EINVAL; + return(-1); + } + ret=-1; + if(_openfd[handle]) + { + _FsChanToName(getRealHandle(handle),&name[0]); + if (memcmp("LOC",&name[0],3)!=0) + goto invalid; + ret=_openfd[handle]&(O_BINARY|O_TEXT); /* save old mode */ + _openfd[handle]&= ~(O_BINARY|O_TEXT); /* mask out old mode */ + _openfd[handle]|=mode; /* set new mode */ + n=-1; + while(++n < _open_max) /* look for level 2 stream */ + { + if(_iob[n]._file == handle) + { + if(mode == O_BINARY) /* Binary - set flag */ + _iob[n]._flag|=_F_BIN; + else + _iob[n]._flag&=~(_F_BIN); /* Text - clear flag */ + break; + } + } + } + else + errno=EBADF; /* file wasn't open */ + return(ret); +} + +/*-------------------------------------------------------------------------* +* stat and fstat - return file status information in stat structure. * +*--------------------------------------------------------------------------*/ + +#define MAX_EXTS 4 +static char exec_exts[MAX_EXTS][5]={ ".BTF", ".OPO", ".APP",".IMG"}; + +int stat(const char *path, struct stat *statbuf) + +{ + int fmode, temp, drive, fh, n; + long time; + + if (!_isloc(path)) + { + errno=EINVAL; + return(-1); + } + temp=0; + fmode=_chmod(path, 0, 0); /* get access mode and file type */ + if(fmode == -1) + { + errno=ENOENT; + return(-1); + } + statbuf->st_nlink=1; /* nlink is always one */ + if(fmode&0x18) + { + statbuf->st_mode=S_IFDIR; + return(0); + } + else + temp|=S_IFREG; + if(fmode&1) + temp|=S_IREAD; + else + temp|=S_IREAD|S_IWRITE; + fh=_open(path, O_RDONLY); /* open the file */ + if(fh < 0) + return(-1); + if(isatty(fh)) /* is it a device */ + temp|=S_IFCHR; + else /* if it is a file get drive, length */ + /* and time info plus exec status */ + { + drive=_filedrive(fh); + statbuf->st_dev=drive; + statbuf->st_rdev=drive; + n=0; + while(n < MAX_EXTS) + { + if(strstr(path, exec_exts[n])) + { + temp|=S_IEXEC; + break; + } + ++n; + } + statbuf->st_size=filelength(fh); + time=get_utime(fh); + statbuf->st_atime=time; + statbuf->st_mtime=time; + statbuf->st_ctime=time; + } + statbuf->st_mode=temp; + _close(fh); /* close the file */ + return(0); +} + +int fstat(int handle, struct stat *statbuf) +{ + int fmode, temp, drive; + long time; + + temp=0; + fmode=_openfd[handle]; + if(fmode == 0) + { + errno=EBADF; + return(-1); + } + temp|=S_IFREG; /* get access etc from file descriptor */ + if(fmode&O_RDWR) + temp|=S_IREAD|S_IWRITE; + else if(fmode&O_WRONLY) + temp|=S_IWRITE; + else + temp|=S_IREAD; + if(fmode&O_DEVICE) + { + temp|=S_IFCHR; + drive=handle; + } + else /* if it is a file get length, drive */ + { /* and time info */ + statbuf->st_size=filelength(handle); + time=get_utime(handle); + statbuf->st_atime=time; + statbuf->st_mtime=time; + statbuf->st_ctime=time; + drive=_filedrive(handle); + } + statbuf->st_dev=drive; + statbuf->st_rdev=drive; + statbuf->st_mode=temp; + statbuf->st_nlink=1; /* nlink is always one */ + return(0); +} + +/*-------------------------------------------------------------------------* +* chsize - change size of file . * +*--------------------------------------------------------------------------*/ + +#define SECSIZE 2024L + +int chsize(int handle, long size) +{ + char *h; + int ret,mode; + + if ((h=getRealHandle(handle))==NULL) + return(-1); + if ((ret=_iow3(h,P_FSETEOF,&size))<0) + { + _ioerr(ret); + return(-1); + } + mode=P_FABS; + _iow4(h,P_FSEEK,&mode,&size); + return(0); +} + +/*-------------------------------------------------------------------------* +* getcwd.c - returns pointer to buffer containing current directory. * +*--------------------------------------------------------------------------*/ + +char *getcwd(char *buf, int maxlen) +{ + char temp[P_FNAMESIZE]; + int n,p,aflag; + + aflag=0; + _getPath(&temp[0]); + if(buf == NULL) + { + buf=(char *) malloc(maxlen); /* if buffer is null allocate memory */ + if(buf == NULL) + { + errno=ENOMEM; /* no memory - error */ + return(NULL); + } + aflag=1; + } + n=0; + p=P_FSYSNAMESIZE; + while(n < maxlen) /* copy maxlen bytes to buffer */ + { + if((buf[n++]=temp[p++]) == 0) + { + if ((n=strlen(&buf[0]))!=3) + buf[n-1]=0; + return(buf); + } + } + errno=ERANGE; /* string too long */ + if(aflag) /* free heap alocated buffer */ + free(buf); + return(NULL); +} + +/*-------------------------------------------------------------------------* +* console I/O * +*--------------------------------------------------------------------------*/ + +void cputs(const char *s) +{ + int n, c; + + n=0; + if(_ungotchar!=(-1)) + { + putch(_ungotchar); + _ungotchar=(-1); + } + while((c=s[n++]) != 0) + { + putch(c); + } + return; +} + diff --git a/code/SIBOSDK/src/clib1.a b/code/SIBOSDK/src/clib1.a new file mode 100644 index 0000000..14afaea --- /dev/null +++ b/code/SIBOSDK/src/clib1.a @@ -0,0 +1,1454 @@ +(* Release 3.00 *) + +(* clib1 - common misc stuff *) + +(* Copyright (C) 1989 Jensen and Partners. All Rights Reserved*) +(* Written by Simon Knight.*) + +(* Copyright (C) 1991 Psion PLC. All Rights Reserved*) +(* Written by NSM.*) + +include "corelib.inc" +include "epocdefs.inc" + +module clib1 + +segment _BSS(BSS, 28H) + +public __stream : org DataPtrSize + +(****************************************************************************) +section +segment _TEXT(CODE,28H) +segment _DATA(DATA,28H) + +select _TEXT + +public __swap : +(* +void _swap(void *p1, void *p2, size_t width) +swaps data at p1 with that at p2. +*) + + push di + push si + mov si, ax + mov di, bx +swapLoop: + mov al, [di] + movsb + mov [si][-1], al + loop swapLoop + pop si + pop di + ret 0 + +(* __swap ENDP *) + +(****************************************************************************) +section +segment _TEXT(CODE,28H) +segment _DATA(DATA,28H) + +select _TEXT + +public __rotl : +(* +int _rotl(int val, int shift) +returns val rotated left by shift bits +*) + + push cx + mov cl, bl + rol ax, cl + pop cx + ret 0 + +(* __rotl ENDP *) + +(****************************************************************************) +section +segment _TEXT(CODE,28H) +segment _DATA(DATA,28H) + +select _TEXT + +public __rotr : +(* +int _rotr(int val, int shift) +returns val rotated right by shift bits +*) + + push cx + mov cl, bl + ror ax, cl + pop cx + ret 0 + +(* __rotl ENDP *) + +(****************************************************************************) +section +segment _TEXT(CODE,28H) +segment _DATA(DATA,28H) + +select _TEXT + +public __lrotl : +(* +long _lrotl(long val, int shift) +returns val rotated left by shift bits +*) + + push cx + mov dx, bx + and cx, 31 +llLoop: + shl ax, 1 + rcl dx, 1 + jnc llCarryZero + or ax, 1 +llCarryZero: + loop llLoop + pop cx + ret 0 + +(* __rotl ENDP *) + +(****************************************************************************) +section +segment _TEXT(CODE,28H) +segment _DATA(DATA,28H) + +select _TEXT + +public __lrotr : +(* +long _lrotr(long val, int shift) +returns val rotated right by shift bits +*) + + push cx + mov dx, bx + and cx, 31 +lrLoop: + shr dx, 1 + rcr ax, 1 + jnc lrCarryZero + or dx, 8000H +lrCarryZero: + loop lrLoop + pop cx + ret 0 + +(* __rotl ENDP *) + +(****************************************************************************) +section +segment _TEXT(CODE,28H) +segment _DATA(DATA,28H) + +select _TEXT + +public _segread : (* copies segment registers into SEGREGS *) +(* +void segread(struct SREGS *segregs) +*) + +ES = 0 +CS = 2 +SS = 4 +DS = 6 + + push bx + mov bx, ax + mov [bx][ES], es + mov [bx][CS], cs + mov [bx][DS], ds + mov [bx][SS], ss + pop bx + ret 0 + +(* _segread ENDP *) + +(****************************************************************************) +section +segment _TEXT(CODE,28H) +segment _DATA(DATA,28H) + +select _TEXT + +public __enable : (* enable interrupts *) +public _enable : + + sti + ret 0 + +(* __enable ENDP *) + +public __disable : (* disable interrupts *) +public _disable : + + cli + ret 0 + +(* __disable ENDP *) + +(****************************************************************************) +section +segment _TEXT(CODE,28H) + +select _TEXT + +public _outportb : +public _outp : + + push dx + mov dx, ax + mov ax, bx + out byte dx, al + pop dx + ret 0 + +(****************************************************************************) +section +segment _TEXT(CODE,28H) + +select _TEXT + +public _outportw : +public _outpw : + + push dx + mov dx, ax + mov ax, bx + out word dx, ax + pop dx + ret 0 + +(****************************************************************************) +section +segment _TEXT(CODE,28H) + +select _TEXT + +public _inportb : +public _inp : + + push dx + mov dx, ax + in byte al, dx + sub ah, ah + pop dx + ret 0 + +(****************************************************************************) +section +segment _TEXT(CODE,28H) + +select _TEXT + +public _inportw : +public _inpw : + + push dx + mov dx, ax + in word ax, dx + pop dx + ret 0 + +(****************************************************************************) +section +segment _TEXT(CODE,28H) +segment _DATA(DATA,28H) + +select _TEXT + +public _stackavail : +(* +size_t stackavail(void) +returns bytes left in stack. +*) + + mov ax, sp + ret 0 + +(****************************************************************************) +section +segment _TEXT(CODE,28H) + +select _TEXT + +extrn __getDateAndTime + +public _gettime : (* gets system time *) +(* +void gettime(struct time *timeptr) +*) +hour = 0 +min = 1 +sec = 2 +hund = 3 +DataOsTimeInTicks = 420H +DataOsLcdType = 43BH + + push ax + push bx + push cx + push dx + push di + push si + mov cx, ax + call __getDateAndTime + mov si, cx + mov ax, [di][DateHour] + mov [si][hour], ax + mov al, [di][DateSecond] + mov [si][sec], al + int GenDataSegment + mov ax, es:[DataOsTimeInTicks] + mov bl, es:[DataOsLcdType] + cmp bl, Lcd640X200Small + jbe doSiboClock + cmp bl, Lcd160X80 + je doSiboClock + cmp bl, Lcd240X80 + jne doPcClock +doSiboClock: + test ax, ax + jns stillPositive + add al, 32 +stillPositive: + mov ah, al + mov al, 32 + sub al, ah + mov ah, al + add al, ah + add al, ah + jmp setHundreds +doPcClock: + sub dx, dx + mov bx, 655 + div bx +setHundreds: + mov [si][hund], al + pushf + cli + push ss + pop es + popf + add sp, (DateEnt + DyScEnt) + pop si + pop di + pop dx + pop cx + pop bx + pop ax + ret 0 + +(****************************************************************************) +section +segment _TEXT(CODE,28H) + +select _TEXT + +extrn __getDateAndTime +extrn __setDateAndTime + +public _settime : (* sets system time *) +(* +void settime(struct time *timeptr) +*) + +hour = 0 +min = 1 +sec = 2 +hund = 3 + + push ax + push cx + push di + push si + mov cx, ax + call __getDateAndTime + mov si, cx + mov ax, [si][hour] + mov [di][DateHour], ax + mov al, [si][sec] + mov [di][DateSecond], al + call __setDateAndTime + add sp, (DateEnt + DyScEnt) + pop si + pop di + pop cx + pop ax + ret 0 + +(*************************************************************************) +section +segment _TEXT(CODE,28H) + +select _TEXT + +extrn __getDateAndTime + +public _getdate : (* gets system date *) +(* +void getdate(struct date *dateptr) +*) + +year = 0 +day = 2 +mon = 3 + + push ax + push cx + push di + push si + mov cx, ax + call __getDateAndTime + mov si, cx + mov ax, [di][DateMonth] + xchg ah, al + add ax, 101H + mov [si][day], ax + mov al, [di][DateYear] + sub ah, ah + add ax, 1900 + mov [si][year], ax + add sp, (DateEnt + DyScEnt) + pop si + pop di + pop cx + pop ax + ret 0 + +(****************************************************************************) +section +segment _TEXT(CODE,28H) + +select _TEXT + +extrn __getDateAndTime +extrn __setDateAndTime + +public _setdate : (* sets system date *) +(* +void setdate(struct date *dateptr) +*) + +dateptr = frame +year = 0 +day = 2 +mon = 3 + + push ax + push cx + push di + push si + mov cx, ax + call __getDateAndTime + mov si, cx + mov ax, [si][day] + xchg ah, al + sub ax, 101H + mov [di][DateMonth], ax + mov ax, [si][year] + sub ax, 1900 + mov [di][DateYear], al + call __setDateAndTime + add sp, (DateEnt + DyScEnt) + pop si + pop di + pop cx + pop ax + ret 0 + +(****************************************************************************) +section +segment _TEXT(CODE,28H) +segment _DATA(DATA,28H) + +extrn __vp_flush +extrn __vp_ret +extrn __stream + +select _TEXT + +extrn __fputn +(* +void _str_out(char far *s, int flag, int wid, int prec) +*) + +_NO_POINT = 10H +_L_JUST = 1 + +file = -2 +s = -4 +flag = -6 +wid = -8 +prec = -10 +tmode = -12 (* 0 = file is text mode *) +locals = 14 + +public __str_out : (* internal function *) + push bp + mov bp, sp + sub sp, locals + push di + push si + mov [bp][s], ax + mov [bp][flag], bx + mov [bp][wid], cx + mov [bp][prec], dx + mov bx, cx (* bx = wid *) + or dx, dx + jnz FindLen + test cx, _NO_POINT (* is No Precision bit set? *) + jnz FindLen + mov dx, 7FFFH + mov [bp][prec], dx (* [bp][prec] is now OK *) +FindLen: + mov di, [bp][s] (* di = s, find end of string *) + mov cx, -1 + sub ax, ax + cld + repne;scasb + not cx + dec cx + cmp cx, dx + jb LenShorter + mov cx, dx +LenShorter: + sub bx, cx (* trash bx (wid) *) + mov cx, bx (* cx = pad length *) +(* stat: ax = 0 | bx = trash | cx = pad len | ~dx = prec | ~es:di = s *) + mov bx, [__stream] (* ds:bx = FILE [near DOS] *) + mov [bp][file], bx (* save FILE in file for __fputn *) + mov di, [bx][_flag] (* di = FILE flags *) + and di, _F_BIN (* is file text mode? *) + mov [bp][tmode], di + mov di, [bx][_ptr] (* es:di = FILE buffer *) + sub dx, dx (* dx is the output count *) + mov bx, [bx][_cnt] (* bx is _cnt *) +(* stat: ax = trash | bx = _cnt | cx = pad len | dx = out count | es:di = dest *) + cmp cx, 0 + jle LeftPadDone + test word [bp][flag], _L_JUST + jnz LeftPadDone + mov al, 20H +LeftPadLoop: + dec bx + cmp bx, 0 (* have we run out of buffer space? *) + jl LeftClearBuffer + stosb (* insert pad character *) + inc dx (* inc output counter *) + loop LeftPadLoop + jmp LeftPadDone +LeftClearBuffer: + call __fputn (* Clear the buffer *) + mov al, 20H + jmp LeftPadLoop +LeftPadDone: + push cx (* save pad length *) + mov cx, [bp][prec] (* cx = precision *) + jcxz StrOutDone + mov si, [bp][s] (* ds:si = s *) + mov ah, 0AH +StrOutLoop: + lodsb + cmp ah, al (* is it a LineFeed? *) + jz TranslateLF + or al, al (* is it a 0C? *) + jz StrOutDone +JumpRet: + dec bx + cmp bx, 0 (* buffer space check *) + jl StrOutClearBuffer + stosb + inc dx (* inc output counter *) + loop StrOutLoop + jmp StrOutDone +StrOutClearBuffer: + push ax + call __fputn + pop ax + jmp JumpRet +TranslateLF: + cmp byte [bp][tmode], 0 (* Binary Mode?, Don't translate *) + jnz JumpRet + mov al, 0DH + dec bx + cmp bx, 0 + jl TranslateClearBuffer + stosb + mov al, ah + jmp JumpRet +TranslateClearBuffer: + call __fputn + mov ah, 0AH + jmp TranslateLF +StrOutDone: + pop cx + cmp cx, 0 + jle RightPadDone + test word [bp][flag], _L_JUST + je RightPadDone + mov al, 20H +RightPadLoop: + dec bx + cmp bx, 0 + jl RightClearBuffer + stosb + inc dx + loop RightPadLoop + jmp RightPadDone +RightClearBuffer: + call __fputn + mov al, 20H + jmp RightPadLoop +RightPadDone: +(* stat: ax = trash | bx = _cnt | cx = trash | dx = out count | es:di = end of dest *) + add [__vp_ret], dx + mov si, [__stream] (* ds:si = FILE *) + mov [si][_cnt], bx + mov [si][_ptr], di + pop si + pop di + mov sp, bp + pop bp + ret 0 + +(****************************************************************************) +section +segment _TEXT(CODE,28H) +segment _DATA(DATA,28H) + +extrn __vp_flush + +select _TEXT + +file = -2 + +public __fputn : + mov ax, bx + mov bx, [bp][file] + mov [bx][_cnt], ax + mov [bx][_ptr], di + push cx + push dx + push bx + mov ax, bx + call [__vp_flush] + pop bx + pop dx + pop cx + mov di, [bx][_ptr] + mov bx, [bx][_cnt] + ret 0 + +(****************************************************************************) +section +segment _TEXT(CODE,28H) +segment _DATA(DATA, 28H) + +extrn __vp_flush +extrn __fputn + +select _DATA + +extrn __stream +extrn __vp_ret + +select _TEXT + +public __justify : (* internal function *) +(* +void _justify(char *s, int flag, int wid) +*) + +nopoint = 10H +left = 1H +zero = 80H +VBUFSIZE = 256 + +temp = -2 +padchar = -6 +s = -10 +flag = -12 +wid = -14 +locals = 14 + + push bp + mov bp, sp + sub sp, locals + push di + push si + mov [bp][s], ax + mov [bp][flag], bx + mov [bp][wid], cx + + test word [bp][flag], ZFLAG + jz useSpace + mov dx, '0' + jmp gotPad +useSpace: + mov dx, 20H +gotPad: + mov [bp][padchar], dx + mov di, [bp][s] + mov cx, -1 + sub ax, ax +repne ; scasb + not cx + dec cx + mov bx, [bp][wid] + sub bx, cx + mov cx, bx (* cx is pad length *) + sub dx, dx (* dx now output count *) + mov bx, [__stream] (* ds:bx is FILE *) + mov [bp][temp], bx + mov di, [bx][_ptr] (* es:di is destination *) + mov bx, [bx][_cnt] (* bx is now _cnt, ds still FILE seg *) + mov si, [bp][s] + cmp cx, 0 + jle pad1Done + test word [bp][flag], left + jnz pad1Done + add dx, cx + mov al, [bp][padchar] + cmp al, '0' + jnz pad1Loop (* handle laeding zeros in FP number *) + cmp byte [si], '-' + je pad0 + cmp byte [si], '+' + jnz pad1Loop +pad0: + dec bx + cmp bx, 0 + jl call0 + movsb + inc dx +pad1Loop: + dec bx + cmp bx, 0 + jl call1 + stosb + loop pad1Loop + jmp pad1Done +call0: + call __fputn + mov al, [bp][padchar] + jmp pad0 +call1: + call __fputn + mov al, [bp][padchar] + jmp pad1Loop +pad1Done: +outLoop: + lodsb + or al, al + je outDone +outRet: + dec bx + cmp bx, 0 + jl call2 + stosb + inc dx + jmp outLoop +call2: + push ax + call __fputn + pop ax + jmp outRet +outDone: + cmp cx, 0 + jle pad2Done + test word [bp][flag], left + je pad2Done + add dx, cx + mov al, [bp][padchar] +pad2Loop: + dec bx + cmp bx, 0 + jl call3 + stosb + loop pad2Loop + jmp pad2Done +call3: + call __fputn + mov al, [bp][padchar] + jmp pad2Loop +pad2Done: + mov si, [bp][temp] + mov [si][_cnt], bx + mov [si][_ptr], di + add [__vp_ret], dx + pop si + pop di + mov sp, bp + pop bp + ret 0 + +(****************************************************************************) +section +segment _TEXT(CODE,28H) +segment _DATA(DATA,28H) + +extrn __vp_flush + +select _DATA + +extrn __stream +extrn __vp_ret + +select _TEXT + +public __vputc : (* internal function *) +(* +void _vputc(int ch) +*) + +char = -2 +locals = 2 + + push bp + mov bp, sp + sub sp, locals + mov [bp][char], ax + inc word [__vp_ret] (* increment char count *) + cmp al, 0AH + jne vpRet + mov bx, [__stream] + test word [bx][_flag], _F_BIN + jnz vpCont + mov ax, 0DH + call __vputc + mov ax, 0AH +vpRet: + mov bx, [__stream] +vpCont: + mov ax, [bx][_cnt] (* decrement stream count *) + dec ax + js vpCall + mov [bx][_cnt], ax + mov bx, [bx][_ptr] + mov al, [bp][char] + mov [bx], al (* put character in buffer *) + mov bx, [__stream] + inc word [bx][_ptr] (* increment pointer *) + cmp al, CTLZ + jne vpDone + test word [bx][_flag], _F_BIN + jz vpDone + or word [bx][_flag], _F_CTZ +vpDone: + mov sp, bp + pop bp + ret 0 + +vpCall: + mov ax, [__stream] + call [__vp_flush] + jmp vpRet + +(****************************************************************************) +section +segment _TEXT(CODE,28H) +segment _DATA(DATA,28H) + +extrn __vs_fill +extrn _longjmp + +select _DATA + +extrn __stream +extrn __vs_count +extrn __EOFhandler + +select _TEXT + +public __vgetc : (* internal function *) +(* +int _vgetc() +*) + + push bp + push bx + mov bp, sp + inc word [__vs_count] (* increment char count *) +vsRet: + mov bx, [__stream] + mov ax, [bx][_cnt] (* decrement stream count *) + dec ax + js vsCall + mov [bx][_cnt], ax + mov bx, [bx][_ptr] + mov al, [bx] (* get character from buffer *) + sub ah, ah + mov bx, [__stream] + inc word [bx][_ptr] (* increment pointer *) + test word [bx][_flag], _F_BIN + jnz vsDone + cmp al, CTLZ + jne vsTrans + mov ax, -1 + jmp vsError +vsTrans: + cmp al, 0DH + jne vsDone + call __vgetc +vsDone: +vsError: + pop bx + pop bp + ret 0 + +vsCall: + mov ax, [__stream] + call [__vs_fill] + cmp ax, 0 + jg vsRet + jmp vsError + +(****************************************************************************) +section +segment _TEXT(CODE,28H) +segment _DATA(DATA,28H) + +select _DATA + +extrn __stream +extrn __vs_count + +select _TEXT +public __vungetc : (* internal function *) +(* +int _vungetc(char) +*) + + cmp ax, -1 + je vunError + dec word [__vs_count] (* decrement char count *) + push bx + mov bx, [__stream] + inc word [bx][_cnt] (* increment stream count *) + dec word [bx][_ptr] (* decrement pointer *) + pop bx +vunError: + ret 0 + +(*****************************************************************************) +section +segment _TEXT(CODE,28H) +segment _DATA(DATA,28H) + +extrn __upperHex + +select _TEXT + +public _itoa : +(* +char *itoa ( value, strP, radix ) +int value +char *strP +int radix + +Convert a short integer value to ASCIIZ string at ( *strP ), using +a radix from 2..36. If the radix is 10 and value is negative +then prefix the output by '-'. + +The function return value equals strP. +*) + +ita_value = -2 +ita_strP = -6 +ita_radix = -8 +ita_buf = -26 +locals = 26 + + push bp + mov bp, sp + sub sp, locals + push dx + push di + push si + mov [bp][ita_value], ax + mov [bp][ita_strP], bx + mov [bp][ita_radix], cx + mov di, [bp][ita_strP] + +(* If the request is invalid, generate an empty result*) + + mov bx, [bp][ita_radix] + cmp bx, 36 + ja ita_end + cmp bl, 2 + jb ita_end + + mov ax, [bp][ita_value] + +(* If the radix is decimal, then if the value is negative*) +(* put a sign on the result.*) + + cmp bl, 10 + jne ita_signSet + or ax, ax + jnl ita_signSet + + mov byte [di][0], '-' + inc di + neg ax + +ita_signSet: + lea si, [bp][ita_buf] + mov cx, si (* CX remembers start of string*) + +(* Now loop, taking each digit as modulo radix, and reducing the value*) +(* by dividing by radix, until the value is zeroed. Note that*) +(* at least one loop occurs even if the value begins as 0,*) +(* since we want "0" to be generated rather than "".*) + +ita_shortLoop: + sub dx, dx + div bx + mov [si], dl + inc si + or ax, ax + jnz ita_shortLoop + +(* The value has now been reduced to zero and the digits are in*) +(* the buffer.*) + + neg cx + add cx, si (* CX = length of the numeral*) + +(* The digits in the buffer must now be copied in reverse order into*) +(* the target string, translating to ASCII as they are moved.*) + +ita_copy: + cld + +ita_copyLoop: + dec si + mov al, [si] + sub al, 10 + jae ita_alphaDigit + add al, '0' + 10 + jmp ita_storeDigit + +ita_alphaDigit: + add al, [__upperHex] + +ita_storeDigit: + stosb + loop ita_copyLoop + +(* terminate the output string with a zero.*) + +ita_end: + mov al, 0 + stosb + +(* return a pointer to the string.*) + + mov ax, [bp][ita_strP][0] + pop si + pop di + pop dx + add sp, locals + pop bp + ret 0 + +(***************************************************************************) +section +segment _TEXT(CODE,28H) +segment _DATA(DATA,28H) + +extrn __upperHex + +select _TEXT +(* ltoa - converts signed long integer to ASCIIZ string + ultoa - converts unsigned long integer to ASCIIZ string +*) + +public _ultoa : +(* +char *ultoa ( value, strP, radix ) + +long value; +char *strP; +int radix; + +Convert an unsigned long integer value to ASCIIZ string at ( *strP), +using a radix from 2..36. If the radix is 10 and value is negative +then prefix the output by '-'. + +The parameters are identical to _ltoa except that the value is not +signed. The function is implemented by jumping to shared code. + +The function return value equals strP. +*) + +lta_value = -4 +lta_strP = -8 +lta_radix = -10 +lta_buf = -44 +locals = 44 + + push bp + mov bp, sp + sub sp, locals + push dx + push di + push si + sub si, si (* flag indicates "not signed" *) + jmp lta_shared + +(* The major work is done by ltoa. *) + +public _ltoa : +(* +char *ltoa ( value, strP, radix ) + +long value; +char *strP; +int radix; + +Convert an signed long integer value to ASCIIZ string at ( *strP), +using a radix from 2..36. + +The function return value equals strP. +*) + + + push bp + mov bp, sp + sub sp, locals + push dx + push di + push si + mov si, 1 (* flag indicates "may be signed" *) + +(* ltoa jumps into here. *) + +lta_shared: + + mov [bp][lta_value], ax + mov [bp][lta_value][2], bx + mov [bp][lta_strP], cx + mov [bp][lta_radix], dx + mov di, [bp][lta_strP] + +(* If the request is invalid, generate an empty result *) + + mov bx, [bp][lta_radix] + cmp bx, 36 + ja lta_end + cmp bl, 2 + jb lta_end + + mov ax, [bp][lta_value] + mov cx, [bp][lta_value][2] + cmp cx, 0 + jnl lta_notSigned (* Is the value signed or unsigned ? *) + + cmp bl, 10 (* only decimal numerals are signed *) + jne lta_notSigned + or si, si + je lta_notSigned + + mov byte [di], '-' + inc di + not cx + neg ax + cmc (* negate CX:AX *) + adc cx, 0 + +(* Now loop, taking each digit as modulo radix, and reducing the value + by dividing by radix, until the value is zeroed. Note that + at least one loop occurs even if the value begins as 0, + since we want "0" to be generated rather than "". +*) + +lta_notSigned: (* BX = radix, CX:AX = value *) + lea si, [bp][lta_buf] + jcxz lta_shortLoop + +lta_longLoop: + xchg cx, ax + sub dx, dx + div bx + xchg ax, cx + div bx + mov [si], dl + inc si + jcxz lta_shortTest (* does the value fit in 16 bits ? *) + jmp lta_longLoop + +lta_shortLoop: + sub dx, dx + div bx + mov [si], dl + inc si +lta_shortTest: + or ax, ax + jnz lta_shortLoop + +(* The value has now been reduced to zero and the digits are in + the buffer. +*) + lea cx, [bp][lta_buf] + neg cx + add cx, si (* CX = length of numeral *) + +(* The digits in the buffer must now be copied in reverse order into + the target string, translating to ASCII as they are moved. +*) + +lta_copy: + cld + +lta_copyLoop: + dec si + mov al, [si] + sub al, 10 + jae lta_alphaDigit + add al, '0' + 10 + jmp lta_storeDigit + +lta_alphaDigit: + add al, [__upperHex] + +lta_storeDigit: + stosb + loop lta_copyLoop + +(* terminate the output string with a zero. *) + +lta_end: + mov al, 0 + stosb + +(* return a pointer to the string *) + + mov ax, [bp][lta_strP] + pop si + pop di + pop dx + add sp, locals + pop bp + ret 0 + +(****************************************************************************) +section +segment _TEXT(CODE,28H) +segment _DATA(DATA,28H) +segment _INIT(DATA,28H) + +extrn __clock_time (* initialisation routine for clock function *) +extrn __InitLoop + +select _TEXT +do_initclock : (* defined later on ! *) + +select _INIT +initclock : dw MAGIC + db PR4 + dw do_initclock + +select _DATA +public __proc_time : dw initclock, 0 + +select _TEXT + call __clock_time + mov [__proc_time], ax + mov [__proc_time][2], dx + jmp __InitLoop + +(******************************************************************************) +section +segment _TEXT(CODE,28H) + +public _memwmove : +(* +void *memwmove(void *dest, void *source, unsigned num) + +Moves num words, selecting direction according to overlap. +Returns destination address. +*) + +s_high = -2 +s_low = -4 +num = -6 +locals = 6 + + push bp + mov bp, sp + sub sp, locals + push dx + push di + push si + mov si, bx + mov di, ax + mov [bp][num], cx + push ax + jcxz moveDone + cmp di, si + jb moveDown + je moveDone +moveUp: (* destination is higher *) + std + dec cx + shl cx, 1 + add si, cx + add di, cx + mov cx, [bp][num] +moveDown: (* destination is lower *) +rep ; movsw + cld +moveDone: + pop ax (* return destination address. *) + pop si + pop di + pop dx + mov sp, bp + pop bp + ret 0 + +(****************************************************************************) +section +segment _TEXT(CODE,28H) + +public _memmove : +(* +void *memmove(void *dest, void *source, unsigned num) +Selects correct move direction and moves num bytes. +Returns destination address. +*) + +s_high = -2 +s_low = -4 +num = -6 +locals = 6 + + push bp + mov bp, sp + sub sp, locals + push dx + push di + push si + mov si, bx + mov di, ax + push ax + jcxz moveDone + cmp di, si + jb moveDown + je moveDone +moveUp: (* destination is higher *) + std + add si, cx + dec si + add di, cx + dec di +moveDown: (* destination is lower *) +rep ; movsb + cld +moveDone: + pop ax (* return destination address *) + pop si + pop di + pop dx + mov sp, bp + pop bp + ret 0 + +(****************************************************************************) +section +segment _TEXT(CODE,28H) + +public _movmem : +(* +void *movmem(void *source, void *dest, unsigned num) +Selects correct move direction and moves num bytes. +Returns nothing. +*) + +s_high = -2 +s_low = -4 +num = -6 +locals = 6 + + push bp + mov bp, sp + sub sp, locals + push dx + push di + push si + mov si, ax + mov di, bx + jcxz moveDone + cmp di, si + jb moveDown + je moveDone +moveUp: (* destination is higher *) + std + add si, cx + dec si + add di, cx + dec di +moveDown: (* destination is lower *) +rep ; movsb + cld +moveDone: + pop si + pop di + pop dx + mov sp, bp + pop bp + ret 0 + +(******************************************************************************) +section +segment _TEXT(CODE,28H) + +public _swab : +(* +void swab(void *source, void *dest, unsigned num) +Moves num bytes, selecting direction according to overlap. Swaps byte order. +Returns nothing. +*) + + push dx + push di + push si + mov si, ax + mov di, bx + shr cx, 1 + jcxz moveDone + cmp di, si + jb moveDown + je moveDone +moveUp: (* destination is higher *) + std + push cx + dec cx + shl cx, 1 + add si, cx + add di, cx + pop cx +moveDown: (* destination is lower *) +swabLoop: + lodsw + xchg al, ah + stosw + loop swabLoop + cld +moveDone: + pop si + pop di + pop dx + ret 0 + +end + diff --git a/code/SIBOSDK/src/clib2.c b/code/SIBOSDK/src/clib2.c new file mode 100644 index 0000000..e927e01 --- /dev/null +++ b/code/SIBOSDK/src/clib2.c @@ -0,0 +1,1965 @@ +/* Release 3.00 */ + +/*-------------------------------------------------------------------------* +* * +* clib2.c - common miscellaneous library functions. * +* * +* COPYRIGHT (C) 1989 Jensen and Partners. All Rights Reserved * +* Written by Simon Knight. * +* * +* COPYRIGHT (C) 1991 Psion PLC. All Rights Reserved * +* Modified by NSM. * +* * +*--------------------------------------------------------------------------*/ + +#define _USE_TIME +#include +#include + +_STATIC void _qsort(char *buf, size_t num, size_t width, + int (* compare)(const void *e1, const void *e2), + char *_partition); + +void _cvt(LONGDOUBLE x, int n, int *dec, int *sign, char * buf) { + unsigned char bcd[10]; + LONGDOUBLE zero = 0; + LONGDOUBLE norm; + int i, k, kp, xtra; + + if ( x < zero ) { + x = -x; + *sign = 1; + } else { + *sign = 0; + } + + if ( x == zero ) + k = -10000; + else { + k = 1 + (int) FLOORL( LOG10L(x) + 0.001 ); + } + + xtra=0; + while (1) { + norm = x; + if ( k != -10000 ) { + kp = 18 - k; + if(kp > LDBL_MAX_10_EXP-1) { + xtra = kp - (LDBL_MAX_10_EXP-1); + kp = LDBL_MAX_10_EXP-1; + } + norm *= _pow_int(10,kp); + if(xtra) + norm*=_pow_int(10,xtra);; + } + + _bcd( norm, (char *)bcd ); + if ( k == -10000 ) { + k = 1; + break; + } + if ( ( bcd[8] >> 4 ) != 0 ) + break; + k -= 1; + } + + *dec = k; + for (i=8; n>1; n-=2){ + unsigned tmp = bcd[i]; + i -= 1; + *((int*)buf) = ( '0' + '0'*256 ) + ((tmp & 15)<<8) + (tmp >> 4); + buf+=2; + } + if ( n ) { + unsigned tmp = bcd[i]; + *buf = '0' + (tmp >> 4); + ++buf; + } + *buf = '\0'; +} + + +_STATIC void _insert_str(char *buf, char c) { + + movmem(buf, &buf[1], strlen(buf)+1); + buf[0] = c; +} + +void _cvt_round(int n, int *dec, int fc) { + int prec, l; + + if(n < 0) + n=-n; + if(fc) + n+=*dec; + else if(n == 0) { + _cvt_buf[0]='\0'; + return; + } + if(n > 63) + n=63; + l = strlen(_cvt_buf); + if(l > n) { + prec = n; + if(_cvt_buf[prec] >= '5') { + do { + _cvt_buf[prec--] = '0'; + if(prec < 0) { + _insert_str(_cvt_buf, '1'); + ++(*dec); + ++n; + break; + } + ++_cvt_buf[prec]; + } while(_cvt_buf[prec] > '9'); + } + _cvt_buf[n] = '\0'; + } + else { + while(l < n) { + _cvt_buf[l++]='0'; + } + _cvt_buf[l] = '\0'; + } +} + +double pow10(int p) +{ + return(pow(10.0, (double) p)); +} + +double modf(double x, double *y){ + double tmp = _round((LONGDOUBLE) x); + + *y = tmp; + return x - tmp; +} + +long double modfl(long double x, long double *y){ + + long double tmp = _round(x); + *y = tmp; + return x - tmp; +} + +char * ecvt(double x, int n, int *dec, int *sign ) { + + _cvt((LONGDOUBLE)x,18,dec,sign,_cvt_buf); + _cvt_round(n, dec, 0); + return _cvt_buf; +} + +char * fcvt(double x, int n, int *dec, int *sign ) { + + _cvt((LONGDOUBLE) x,18,dec,sign,_cvt_buf); + _cvt_round(n, dec, 1); + return _cvt_buf; +} + +/*-------------------------------------------------------------------------* +* toupper and tolower - case conversion functions. * +*--------------------------------------------------------------------------*/ + +int toupper(int ch) +{ + if(_ctype[(ch)+1] & _IS_LOW) + ch-= 0x20; + return(ch); +} + +int tolower(int ch) +{ + if(_ctype[(ch)+1] & _IS_UPP) + ch+=0x20; + return(ch); +} + +int isalnum(int c) +{ + return(_ctype[(c)+1] & (_IS_DIG | _IS_UPP | _IS_LOW)); +} + +int isalpha(int c) +{ + return(_ctype[(c)+1] & (_IS_UPP | _IS_LOW)); +} + +int isascii(int c) +{ + return((unsigned)((c)) < 0x81); +} + +int iscntrl(int c) +{ + return(_ctype[(c)+1] & _IS_CTL); +} + +int isdigit(int c) +{ + return(_ctype[(c)+1] & _IS_DIG); +} + +int isgraph(int c) +{ + return((c) >= 0x21 && (c) <= 0x7e); +} + +int islower(int c) +{ + return(_ctype[(c)+1] & _IS_LOW); +} + +int isprint(int c) +{ + return((c) >= 0x20 && (c) <= 0x7e); +} + +int ispunct(int c) +{ + return(_ctype[(c)+1] & _IS_PUN); +} + +int isspace(int c) +{ + return(_ctype[(c)+1] & _IS_SP); +} + +int isupper(int c) +{ + return(_ctype[(c)+1] & _IS_UPP); +} + +int isxdigit(int c) +{ + return(_ctype[(c)+1] & (_IS_DIG | _IS_HEX)); +} + +int _toupper(int c) +{ + return(c + 'A' - 'a'); +} + +int _tolower(int c) +{ + return(c + 'a' - 'A'); +} + +int toascii(int c) +{ + return(c & 0x7f); +} + +/*-------------------------------------------------------------------------* +* misc math functions * +*--------------------------------------------------------------------------*/ + +extern double HUGE; /* overflow return value */ +double _ten16 = 10.0e16; + +/*-------------------------------------------------------------------------* +* abs and labs - return absolute value of integer. * +*--------------------------------------------------------------------------*/ + +int abs(int num) +{ + if(num < 0 ) + return(-num); + return(num); +} + +long labs(long num) +{ + if(num < 0 ) + return(-num); + return(num); +} + +double poly(double x, int degree, double coeffs[]) +{ + double result; + + result=coeffs[degree]; + while(--degree >= 0) + { + result=x*result+coeffs[degree]; + } + return(result); +} + +long double polyl(long double x, int degree, long double coeffs[]) +{ + long double result; + + result=coeffs[degree]; + while(--degree >= 0) + { + result=x*result+coeffs[degree]; + } + return(result); +} + +/*-------------------------------------------------------------------------* +* atoul - converts string to unsigned long integer * +*--------------------------------------------------------------------------*/ + +unsigned long atoul(const char *s) +{ + unsigned long num, c; + int n; + + n=0; + num=0; + while(isspace(s[n++])); /* skip leading white-space */ + --n; + while(isdigit((unsigned) (c=s[n++]))) /* total digits */ + { + num*=10; + num+=c-'0'; + } + return(num); +} + +/*-------------------------------------------------------------------------* +* atol - converts string to signed long integer. * +*--------------------------------------------------------------------------*/ + +#define MINUS 1 + +long atol(const char *s) +{ + long num; + int n, c, sign; + + n=0; + num=0; + sign=0; + while(isspace(s[n++])); /* skip leading white-space */ + --n; + switch(s[n]) /* get sign */ + { + case '-': + sign=MINUS; + case '+': + ++n; + break; + default: + break; + } + while(isdigit(c=s[n++])) /* total digits */ + { + num*=10; + num+=c-'0'; + } + if(sign == MINUS) /* set sign */ + num*=-1; + return(num); +} + +/*-------------------------------------------------------------------------* +* atoi - converts string to signed integer. * +*--------------------------------------------------------------------------*/ + +int atoi(const char *s) +{ + int num; + int n, c, sign; + + n=0; + num=0; + sign=0; + while(isspace(s[n++])); /* skip white-space */ + --n; + switch(s[n]) /* get sign */ + { + case '-': + sign=MINUS; + case '+': + ++n; + break; + default: + break; + } + while(isdigit(c=s[n++])) /* total digits */ + { + num*=10; + num+=c-'0'; + } + if(sign == MINUS) /* set sign */ + num*=-1; + return(num); +} + +/*-------------------------------------------------------------------------* +* atof - convert string to double precision real. * +*--------------------------------------------------------------------------*/ + +double atof(const char *s) +{ + int discard; + + return(_atof(s, 0, &discard)); /*_atof does the work */ +} + +long double atofl(const char *s) +{ + int discard; + + return(_atof(s, 0, &discard)); /*_atof does the work */ +} + +/*-------------------------------------------------------------------------* +* strtod - convert string to double and store last character scanned. * +*--------------------------------------------------------------------------*/ + +double strtod(const char *s, char **eptr) +{ + int pos; + double ret; + + ret=(double) _atof(s, _STD, &pos); /* _atof does the work */ + if(pos <= 0) + { + if(pos == -1) + errno=ERANGE; + if(eptr) + *eptr=(char *) s; + } + else if(eptr) + *eptr= (char *) &s[pos]; /* store address of last char scanned */ + return(ret); +} + +long double strtodl(const char *s, char **eptr) +{ + int pos; + long double ret; + + ret= _atof(s, _STD, &pos); /* _atof does the work */ + if(pos <= 0) + { + if(pos == -1) + errno=ERANGE; + if(eptr) + *eptr=(char *) s; + } + else if(eptr) + *eptr= (char *) &s[pos]; /* store address of last char scanned */ + return(ret); +} + +double _atof(const char *s, int flag, int *pos) +{ + char mbuf[18]; /* converts string to unpacked BCD */ + int n, p, point; /* then calls _acvt to convert to */ + int c, count, places; /* double */ + int exp; + int last_exp; + double ret; + + n=0; + p=0; + exp=0; + count=18; + point=0; + places=0; + last_exp=0; + while(isspace(s[n])) /* skip leading white-space */ + { + ++n; + } + if((c=s[n]) == '+') /* get sign of mantissa */ + ++n; + else if(c == '-') + { + ++n; + flag|=_MNEG; + } + while(s[n] == '0') /* skip leading zeros */ + { + ++n; + } + if(s[n] == DEC_POINT) + { + ++n; /* number less than 10e0 */ + while(s[n] == '0') + { + ++n; + --point; + } + while(isdigit(c=s[n])) /* store digits to precsion */ + { + if(count-- == 0) + break; + mbuf[p++]= (char) c; + ++n; + ++places; + } + point-=places; /* adjust for BCD */ + } + else if(!isdigit(s[n])) + { + *pos=0; + return(0); + } + else + { + while(isdigit(c=s[n])) /* number greater than 10e0 */ + { + if(count-- > 0) + mbuf[p++]= (char) c; /* store digits to precision */ + ++n; + ++places; + } + if(c == '.') + { + point=p; + ++n; + while(isdigit(c=s[n])) + { + if(count-- > 0) + mbuf[p++]= (char) c; + ++n; + } + point-=p; /* adjust exponent for decimal point */ + } + else if(places > 18) + point=places-18; /* adjust exponent for BCD */ + } + if(((c=tolower(c)) == 'd') || (c == 'e')) + { + ++n; + if((c=s[n]) == '+') /* get sign of exponent */ + ++n; + else if(c == '-') + { + ++n; + flag|=_ENEG; + } + while(isdigit(c=s[n++])) + { + exp*=10; + exp+=c - '0'; + if(exp < last_exp) + { + exp=1000; + break; + } + last_exp=exp; + } + if(flag&_ENEG) + exp*= -1; + --n; + } + exp+=point; /* calculate total exponent */ + if(exp > 308) + { + ret=HUGE_VAL; + if(flag&_MNEG) + ret*= -1; + *pos=-1; + return(ret); + } + else if(exp < -308) + { + *pos=-1; + return(0); + } + *pos=n; + ret=_acvt(flag, mbuf, exp, p); /* convert from BCD to double */ + return ret; +} + +/*-------------------------------------------------------------------------* +* strtol - converts string to signed long and stores address of * +* last character scanned. * +*--------------------------------------------------------------------------*/ + +long strtol(const char *s, char **eptr, int base) +{ + long num, last_val; + int n, c, flag, scanned; + + n=0; + num=0; + last_val=0; + flag=0; + scanned=0; + while(isspace(s[n])) /* skip white-space */ + { + ++n; + } + switch(s[n]) /* get sign */ + { + case '-': + flag|=_NEG; + case '+': + ++n; + break; + } + if(s[n] == '0') /* check for hex or octal prefixes */ + { + ++n; + if(tolower(s[n]) == 'x') + { + if((base == 16) || (base == 0)) + { + flag|=_HEX; + ++n; + } + else + return(0); + } + else if((base == 0) || (base == 8)) + flag|=_OCT; + else + scanned=1; + } + if((base > 36) || (base < 2)) + base=0; + if(base == 0) /* if base is 0 use prefix */ + { + if(flag&_HEX) + base=16; + else if(flag&_OCT) + base=8; + else + base=10; + } + while(1) + { + c=s[n]; + if(!isdigit(c)) + c=tolower(c)-'a'+10; /* convert to digit and total */ + else + c-='0'; + if((c >= base) || (c < 0)) /* exit if not in radix */ + break; + scanned=1; + num*= (long) base; + num+=c; + if(num < last_val) + { + errno=ERANGE; + if(flag&_NEG) + return(LONG_MIN); + return(LONG_MAX); + } + last_val=num; + ++n; + + } + if(!scanned) + { + *eptr= (char *) s; + return(0); + } + if(flag&_NEG) /* set sign */ + num*=-1; + if(eptr != NULL) /* store address of last character scanned */ + *eptr=(char *) &s[n]; + return(num); +} + +/*-------------------------------------------------------------------------* +* strtoul - converts string to unsigned long and stores address of * +* last character scanned. * +*--------------------------------------------------------------------------*/ + +unsigned long strtoul(const char *s, char **eptr, int base) +{ + unsigned long num; + unsigned long last_val; + int n, c, flag, scanned; + + n=0; + num=0; + last_val=0; + flag=0; + scanned=0; + while(isspace(s[n])) + { + ++n; + } + if(s[n] == '+') + ++n; + if(s[n] == '0') + { + ++n; + if(tolower(s[n]) == 'x') + { + if((base == 16) || (base == 0)) + { + flag|=_HEX; + ++n; + } + else + return(0); + } + else if((base == 8) || (base == 0)) + flag|=_OCT; + } + if((base > 36) || (base < 2)) + base=0; + if(base == 0) + { + if(flag&_HEX) + base=16; + else if(flag&_OCT) + base=8; + else + base=10; + } + while(1) + { + c=s[n]; + if(!isdigit(c)) + c=tolower(c)-'a'+10; + else + c-='0'; + if((c >= base) || (c < 0)) + break; + scanned=1; + num*=base; + num+= (long) (unsigned) c; + if(num < last_val) + { + errno=ERANGE; + return(ULONG_MAX); + } + last_val=num; + ++n; + + } + if(!scanned) + { + if(eptr != NULL) + *eptr= (char *) s; + return(0); + } + if(eptr != NULL) + *eptr= (char *) &s[n]; + return(num); +} + +/*-------------------------------------------------------------------------* +* gcvt - convert double precision real to ascii string. * +*--------------------------------------------------------------------------*/ + +char *gcvt(double num, int digits, char *buf) +{ + if((digits > 18) || ( digits < 0)) /* max precision is 18 */ + digits=18; + return(_f_fmt(buf, (LONGDOUBLE) num, 0x400, digits)); +} + +char *gcvtl(LONGDOUBLE num, int digits, char *buf) +{ + if((digits > 18) || ( digits < 0)) /* max precision is 18 */ + digits=18; + return(_f_fmt(buf, num, 0x400, digits)); +} + +/*-------------------------------------------------------------------------* +* div and ldiv - return quotient and remainder of division in structure * +*--------------------------------------------------------------------------*/ + +div_t div(int num, int den) +{ + div_t ret; + + ret.quot=num/den; + ret.rem= num%den; + return(ret); +} + +ldiv_t ldiv(long num, long den) +{ + ldiv_t ret; + + ret.quot=num/den; + ret.rem= num%den; + return(ret); +} + +/*-------------------------------------------------------------------------* +* strerror - return address of system message string. * +*--------------------------------------------------------------------------*/ + +char *strerror(int errnum) +{ +#ifdef OLDERRORS + if(errno > sys_nerr) + errnum=EFAULT; + return(sys_errlist[errnum+1]); /* message is system string only */ +#else + return(_getErrorText(errnum,_sys_errbuf)); +#endif +} + +char *_strerror(const char *str) +{ +#ifdef OLDERRORS + int ernum; + /* concatenates user message and */ + if(errno > sys_nerr) /* system message for last error */ + ernum=EFAULT; + else + ernum=errno; + if(str == NULL) + return(sys_errlist[ernum+1]); + sprintf(_sys_errbuf, "%.94s: %s\n", str, sys_errlist[ernum+1]); +#else + char err[0x128]; + + _getErrorText(errno,&err[0]); + if (str == NULL) + strcpy(_sys_errbuf,&err[0]); + sprintf(_sys_errbuf, "%.94s: %s\n", str, &err[0]); +#endif + return(_sys_errbuf); +} + +/*-------------------------------------------------------------------------* +* perror - prints user mesage and system message for last error * +*--------------------------------------------------------------------------*/ + +void perror(const char *str) +{ +#ifdef OLDERRORS + int ernum; + + if(errno > sys_nerr) + ernum=EFAULT; + else + ernum=errno; + if(str != NULL) + fprintf(stderr, "%.94s: ", str); + fprintf(stderr, "%s\n", sys_errlist[ernum+1]); +#else + fprintf(stderr, _strerror(str)); +#endif + return; +} + +/*-------------------------------------------------------------------------* +* rand, srand and randomize - random number generation. * +*--------------------------------------------------------------------------*/ + +_STATIC int _r_hptr=0; +_STATIC int _r_lptr=0; +_STATIC int _r_hr[_HMAX+1]; + +int rand() +{ + int result; + + if((_r_lptr == 0) && (_r_hptr == 0)) + srand(1); + if (_r_hptr == 0) + { + _r_hptr=_HMAX; + _r_lptr-=1; + } + else + { + _r_hptr-=1; + if(_r_lptr == 0) + _r_lptr=_HMAX; + else + _r_lptr-=1; + } + result=_r_hr[_r_hptr]+_r_hr[_r_lptr]; + _r_hr[_r_hptr]=result; + return(result&0x7FFF); +} + +void randomize(void) +{ + struct time t; + + gettime(&t); + srand(t.ti_sec+t.ti_hund); + return; +} + +void srand(unsigned seed) +{ + unsigned long x; + int i; + + _r_hptr=_HMAX; + _r_lptr=23; + x=(long)(unsigned) seed; + i=0; + do + { + x= x*3141592621L+17; + _r_hr[i++]= (int) (x/0x10000L); + } while (i <= _HMAX); + return; +} + +/*-------------------------------------------------------------------------* +* time module - system anf file time functions. * +*--------------------------------------------------------------------------*/ + +/* +Leap years - centennial years are only leap years if they are divisible by +400. Therefore the year 2000 is a leap year. MSDOS clock functions won't +work in 2100 anyway, so execption will not occur during the life of this code. +*/ + +_STATIC int _mtable[]= { 0, 31, 59, 90, 120, 151, + 181, 212, 243, 273, 304, 334, 365 }; + +_STATIC int _lmtable[]= { 0, 31, 60, 91, 121, 152, + 182, 213, 244, 274, 305, 335, 366 }; + +_STATIC char *_wdays[] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; +_STATIC char *_months[]= { "Jan", "Feb", "Mar", "Apr", "May", "Jun", + "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; + +_STATIC char *_fwdays[] = { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" }; +_STATIC char *_fmonths[]= { "January", "February", "March", "April", "May", "June", + "July", "August", "September", "October", "November", "December" }; + +_STATIC char _asct_buf[28]; +_STATIC struct tm _tm_buf; + +/*-------------------------------------------------------------------------* +* ctime - convert time in seconds to string format. * +*--------------------------------------------------------------------------*/ + +char *ctime(const time_t *clock) +{ + struct date dte; /* uses static buffer */ + struct time tme; + int weekday; + char *buffer; + + buffer=_asct_buf; + weekday=_t_to_struct(*clock, &dte, &tme); + sprintf(buffer,"%s %s %.2d %.2d:%.2d:%.2d %.4d\n",_wdays[weekday], + _months[dte.da_mon-1],dte.da_day,tme.ti_hour,tme.ti_min, + tme.ti_sec,dte.da_year); + return(buffer); +} + +/*-------------------------------------------------------------------------* +* asctime - convert time structure to string format. * +*--------------------------------------------------------------------------*/ + +char *asctime(const struct tm *tme) +{ + char *buffer; + buffer=_asct_buf; + sprintf(buffer,"%s %s %.2d %.2d:%.2d:%.2d %.4d\n",_wdays[tme->tm_wday], + _months[tme->tm_mon],tme->tm_mday,tme->tm_hour,tme->tm_min, + tme->tm_sec,tme->tm_year+1900); + return(buffer); +} + +/*-------------------------------------------------------------------------* +* ftime - fills in timeb structure. * +*--------------------------------------------------------------------------*/ + +void ftime(struct timeb *tp) +{ + struct time st; + + gettime(&st); + tp->millitm=st.ti_hund*10; + time(&tp->time); + tp->dstflag=daylight; + if(timezone >= 0) + tp->timezone=1440-(((int) timezone)/60); + else + tp->timezone=(int) -(timezone/60); + return; +} + +/*-------------------------------------------------------------------------* +* low- level time functions. * +*--------------------------------------------------------------------------*/ + +struct tm *_t_to_tm(unsigned long clock) +{ + struct date dte; /* converts time in seconds to */ + struct time tme; /* struct tm format */ + struct tm *tmbuf; + + tmbuf=&_tm_buf; + tmbuf->tm_wday=_t_to_struct(clock, &dte, &tme); + tmbuf->tm_sec=tme.ti_sec; + tmbuf->tm_min=tme.ti_min; + tmbuf->tm_hour=tme.ti_hour; + tmbuf->tm_mday=dte.da_day; + tmbuf->tm_mon=dte.da_mon-1; + tmbuf->tm_year=dte.da_year-1900; + if(dte.da_year%4 == 0) /* 2000 is a leap year */ + tmbuf->tm_yday=_lmtable[dte.da_mon-1]; + else + tmbuf->tm_yday=_mtable[dte.da_mon-1]; + tmbuf->tm_yday+=dte.da_day-1; + tmbuf->tm_isdst=daylight; + return(tmbuf); + } +/*-------------------------------------------------------------------------* +* time - returns number of seconds since 01 01 1970 GMT * +*--------------------------------------------------------------------------*/ + +time_t time(time_t *tptr) +{ + struct date dte; + struct time tme; + time_t ret; + + getdate(&dte); /* get time and date from system */ + gettime(&tme); + ret=(time_t)_t_calc(dte, tme); /* convert to seconds GMT */ + if(tptr) + *tptr=ret; + return(ret); +} + +/*-------------------------------------------------------------------------* +* stime - set system clock from number of seconds after 01 01 1970 GMT * +*--------------------------------------------------------------------------*/ + +int stime(time_t *tptr) +{ + struct date dte; + struct time tme; + time_t val; + + val=*tptr+timezone; + if(daylight) + val+=3600; + _t_to_struct(val, &dte, &tme); /* convert seconds to years etc. */ + setdate(&dte); /* set system time */ + settime(&tme); + return(0); +} + +/*-------------------------------------------------------------------------* +* difftime - returns double time difference * +*--------------------------------------------------------------------------*/ + +double difftime(time_t t1, time_t t2) + +{ + return((double) (t1-t2)); +} + +/*-------------------------------------------------------------------------* +* tzset - does nothing in this implementation * +*--------------------------------------------------------------------------*/ + +void tzset(void) +{ + return; +} + +/*-------------------------------------------------------------------------* +* gmtime - converts time in seconds to structure GMT. * +*--------------------------------------------------------------------------*/ + +struct tm *gmtime(const time_t *clock) +{ + struct tm *ret; + + ret=_t_to_tm(*clock); + ret->tm_isdst=0; + return(ret); +} + +/*-------------------------------------------------------------------------* +* localtime - converts time in seconds to structure loca time. * +*--------------------------------------------------------------------------*/ + +struct tm *localtime(const time_t *clock) +{ + time_t tt; + struct tm *ret; + int dst; + + tt=*clock+timezone; + if(daylight) + { + tt+=3600; + dst=1; + } + else + dst=0; + ret=_t_to_tm(tt); + ret->tm_isdst=dst; + return(ret); +} + +/*-------------------------------------------------------------------------* +* clock - returns number of seconds since process started. * +*--------------------------------------------------------------------------*/ + +clock_t clock() +{ + clock_t tt; + + tt=_clock_time(); + if(tt < _proc_time) + tt+= _DAYSECS; + return(tt -_proc_time); +} + +clock_t _clock_time() +{ + struct time tme; + clock_t ret; + + gettime(&tme); + ret=tme.ti_hund; + ret+=((clock_t)tme.ti_sec)*100; + ret+=((clock_t)tme.ti_min)*6000; + ret+=((clock_t)tme.ti_hour)*360000L; + return(ret); +} + +time_t mktime(struct tm *timeptr) +{ + unsigned long ret; + int isdt; + + if(timeptr->tm_year < 0) + return((time_t) -1); + if((ret=_t_norm(timeptr)) == ULONG_MAX) + return((time_t) -1); + isdt=timeptr->tm_isdst; + memcpy(timeptr, _t_to_tm(ret), sizeof(struct tm)); + if(isdt >= 0) + timeptr->tm_isdst=isdt; + if(timeptr->tm_isdst) + ret-=3600; + ret-=timezone; + return(ret); +} + +size_t strftime(char *s, size_t maxsize, const char *format, const struct tm *timeptr) +{ + size_t fcount; + size_t scount; + int c, thour; + char temp[32]; + char *source; + int yday; + int yweek; + + fcount=0; + scount=0; + if(timeptr->tm_year%4 == 0) /* 2000 is a leap year */ + yday=_lmtable[timeptr->tm_mon]; + else + yday=_mtable[timeptr->tm_mon]; + yday+=timeptr->tm_mday; + while((c=format[fcount++]) != 0) + { + if(scount == maxsize) + return(0); + if(c == '%') + { + c=format[fcount++]; + if(c == 0) + break; + switch(c) + { + case '%': + if(scount == maxsize) + return(0); + s[scount++]=c; + continue; + case 'a': + source= _wdays[timeptr->tm_wday]; + break; + case 'A': + source= _fwdays[timeptr->tm_wday]; + break; + case 'b': + source=_months[timeptr->tm_mon]; + break; + case 'B': + source= _fmonths[timeptr->tm_mon]; + break; + case 'c': + source= asctime(timeptr); + break; + case 'd': + sprintf(temp, "%.2d", timeptr->tm_mday); + source=temp; + break; + case 'H': + sprintf(temp, "%.2d", timeptr->tm_hour); + source=temp; + break; + case 'I': + thour=timeptr->tm_hour; + if(thour > 12) + thour-=12; + sprintf(temp, "%.2d", thour); + source=temp; + break; + case 'j': + sprintf(temp, "%.2d", yday); + source=temp; + break; + case 'm': + sprintf(temp, "%.2d", timeptr->tm_mon+1); + source=temp; + break; + case 'M': + sprintf(temp, "%.2d", timeptr->tm_min); + source=temp; + break; + case 'p': + thour=timeptr->tm_hour; + if(thour > 12) + source="PM"; + else + source="AM"; + break; + case 'S': + sprintf(temp, "%.2d", timeptr->tm_sec); + source=temp; + break; + case 'U': + yweek=yday/7; + if(timeptr->tm_wday == 0) + ++yweek; + sprintf(temp, "%.2d", yweek); + source=temp; + break; + case 'w': + sprintf(temp, "%d", timeptr->tm_wday); + source=temp; + break; + case 'W': + yweek=yday/7; + if(timeptr->tm_wday == 1) + ++yweek; + sprintf(temp, "%.2d", yweek); + source=temp; + break; + case 'x': + sprintf(temp, "%s %s %d, %d", _wdays[timeptr->tm_wday], + _months[timeptr->tm_mon], + timeptr->tm_mday, + timeptr->tm_year+1900); + source=temp; + break; + case 'X': + sprintf(temp, "%.2d:%.2d:%.2d", timeptr->tm_hour, timeptr->tm_min, timeptr->tm_sec); + source=temp; + break; + case 'y': + sprintf(temp, "%.2d", timeptr->tm_year); + source=temp; + break; + case 'Y': + source=itoa((timeptr->tm_year+1900), temp, 10); + break; + case 'Z': + continue; + default: + continue; + } + scount=_set_date(s, scount, maxsize, source); + continue; + } + if(scount == maxsize) + return(0); + s[scount++]=c; + } + if(scount == maxsize) + return(0); + s[scount]=0; + return(scount); +} + +char *_strtime(char *timestr) +{ + time_t tt; + struct tm *timeptr; + + time(&tt); + timeptr=localtime(&tt); + sprintf(timestr, "%.2d:%.2d:%.2d", timeptr->tm_hour, timeptr->tm_min, timeptr->tm_sec); + return(timestr); +} + +char *_strdate(char *datestr) +{ + time_t tt; + struct tm *timeptr; + + time(&tt); + timeptr=localtime(&tt); + sprintf(datestr, "%.2d/%.2d/%.2d", timeptr->tm_mon+1, timeptr->tm_mday, timeptr->tm_year); + return(datestr); +} + +unsigned long _ytable(int year) +{ + + return( ((long)year * 365L) + (long)((year+1)/4) ); +} + + +size_t _set_date(char *s, size_t scount, size_t lim, char *st) +{ + int n=0; + int c; + + while(scount < lim) + { + c=st[n++]; + if(c == 0) + break; + s[scount]=c; + scount++; + } + return(scount); +} + +unsigned long _t_norm(struct tm *tp) +{ + unsigned long xdays; + long st, pt; + + st = (long)tp->tm_sec; + st += ((long)tp->tm_min*60); + st += ((long)tp->tm_hour*3600); + if(abs(tp->tm_mday) > 24800) + return(ULONG_MAX); + pt = ((long)(tp->tm_mday-1)*3600L*24L); + if(labs(st/2 + pt/2) > LONG_MAX/2) + return(ULONG_MAX); + st+=pt; + + tp->tm_year+=tp->tm_mon/12; + if(tp->tm_year < 0) + return(-1); + tp->tm_mon=tp->tm_mon%12; + if((tp->tm_year+1900)%4) + xdays=_mtable[tp->tm_mon]; + else + xdays=_lmtable[tp->tm_mon]; + if(tp->tm_year > 186) + return(ULONG_MAX); + xdays+=_ytable(tp->tm_year-70); + xdays*=(3600L*24L); + if((labs(st/2 + xdays/2) > LONG_MAX) || ((st < 0) && (labs(st) > xdays))) + return(ULONG_MAX); + return(st+xdays); +} + +unsigned long _t_calc(struct date dte, struct time tme) +{ + time_t ret; + int leap_year; + + leap_year=(dte.da_year%4 == 0); /* converts DOS format to seconds */ + dte.da_year-=1970; + ret= _ytable(dte.da_year);/* total days in years */ + if(leap_year) + ret+=_lmtable[dte.da_mon-1]; /* add days in months */ + else + ret+=_mtable[dte.da_mon-1]; + ret+=dte.da_day-1; /* add days in month */ + ret*=_DAYSECS; /* convert to seconds */ + ret+= ((long) tme.ti_hour)*3600; /* add hours in day */ + ret+=tme.ti_min*60; /* add hours in day */ + ret+=tme.ti_sec; /* add seconds */ + ret-=timezone; /* timezone and daylight saving */ + if(daylight) + ret-=3600; + return(ret); +} + +int _t_to_struct(unsigned long val, struct date *dte, struct time *tme) +{ + int n, wday; /* convert time in seconds to */ + long day; /* DOS format */ + + n=0; + day=val%_DAYSECS; + tme->ti_hour= (unsigned char) (day/3600); + day%=3600; + tme->ti_min= (unsigned char) (day/60); + tme->ti_sec= (unsigned char) (day%60); + tme->ti_hund=0; + val/=_DAYSECS; /* convert to days */ + wday= (int) (val%7); + wday = (wday+4)%7; + while(_ytable(n) <= val) + ++n; + dte->da_year=1969+n; + val-=_ytable(n-1); + n=0; + if(dte->da_year%4 == 0) /* 2000 is leap year so no exception */ + { + while(_lmtable[n] <= val) + ++n; + val-=_lmtable[n-1]; + } + else + { + while(_mtable[n] <= val) + ++n; + val-=_mtable[n-1]; + } + dte->da_mon= (unsigned char) n; + dte->da_day= (unsigned char) val+1; + return(wday); +} + +time_t get_utime(int handle) /* gets file time and converts */ +{ + struct utm ftime; + struct date dte; + struct time tme; + + _filetime(handle, &ftime); + tme.ti_sec = (unsigned char) ftime.u_sec; + tme.ti_min = (unsigned char) ftime.u_min; + tme.ti_hour= (unsigned char) ftime.u_hour; + dte.da_day= (unsigned char) ftime.u_day; + dte.da_mon= (unsigned char) ftime.u_mon; + dte.da_year=ftime.u_year+1980; + return(_t_calc(dte, tme)); +} + +/*-------------------------------------------------------------------------* +* qsort - sort array member using quicksort algorithm * +*--------------------------------------------------------------------------*/ + +_STATIC void _qsort(char *buf, size_t num, size_t width, + int (* compare)(const void *e1, const void *e2), + char *_partition)\ +{ + int i, j; + int new_num, right_num; + + while(num > 1) { + memcpy(_partition, &buf[(num/2)*width], width); /* get partition element */ + i= -width; + j=num*width; + while(1) { /* sort partition */ + do { + i+=width; + } while( (i < j) && (compare(&buf[i], _partition) < 0 ) ); + do { + j-=width; + } while( (i < j) && (compare(&buf[j], _partition) > 0) ); + if(i >= j) + break; + _swap(&buf[i], &buf[j], width); + } + new_num=i/width; + right_num= num-new_num; + if( new_num < right_num) { /* sort new partitions */ + _qsort(buf, new_num, width, compare, _partition); + num=right_num; + buf=&buf[i]; + } + else { + _qsort(&buf[i], right_num, width, compare, _partition); + num=new_num; + } + } + return; +} + +void qsort(void *base, size_t num, size_t width, + int (* compare)(const void *e1, const void *e2)) +{ + char *_partition; + + _partition=malloc(width); /* allocate buffer for partition member */ + if(_partition != NULL) + { + _qsort((char *)base, num, width, compare, _partition); /* sort array */ + free(_partition); + } + return; +} + +/*-------------------------------------------------------------------------* +* lfind - find key element in array. * +*--------------------------------------------------------------------------*/ + +char *lfind(const char *key, const char *base, unsigned *num, + unsigned width, int (* compare)(const void *e1, const void *e2)) +{ + const char *ptr; + unsigned count; + + count=*num; + ptr=base; + while(count--) + { + if(compare(key, ptr) == 0) + return(ptr); /* found key */ + ptr+=width; + } + return(NULL); /* key not found */ +} + +/*-------------------------------------------------------------------------* +* lfind - find key element in array and append if not present. * +*--------------------------------------------------------------------------*/ + +char *lsearch(const char *key, char *base, unsigned *num, + unsigned width, int (* compare)(const void *e1, const void *e2)) +{ + char *ptr; + unsigned count; + + count=*num; + ptr=base; + while(count--) + { + if(compare(key, ptr) == 0) + return(ptr); /* found key */ + ptr+=width; + } + memcpy(ptr, key, width); /* not found - append */ + return(ptr); +} + +/*-------------------------------------------------------------------------* +* bsearch - search for key member in sorted array. * +*--------------------------------------------------------------------------*/ + +void *bsearch(const void *key, const void *base, unsigned num, + unsigned width, int (* compare)(const void *e1, const void *e2)) +{ + long l, r, x; + int ret; + char *ptr; + + l = 0; + r = num; + do + { + x = (l+r)/2; + ptr = &((char *)base)[x*width]; + ret=compare(key, ptr); + if(ret < 0) + r = x - 1; + else if(ret > 0) + l = x + 1; + else + return(ptr); + } while (l < r); + ptr = &((char *)base)[l*width]; + return(compare(key,ptr) ? NULL : ptr); +} + +/*-------------------------------------------------------------------------* +* sbrk - returns -1 in this implementation. * +*--------------------------------------------------------------------------*/ + +#pragma warn(wpnu => off) + +char *sbrk(int incr) + +{ + return( (char *) 0xFFFF); +} + + +/*-------------------------------------------------------------------------* +* locale functions * +*--------------------------------------------------------------------------*/ + +_STATIC char _last_localeALL[4]="C"; +_STATIC char _last_localeCOLL[4]="C"; +_STATIC char _last_localeCTYP[4]="C"; +_STATIC char _last_localeNUM[4]="C"; +_STATIC char _last_localeTIME[4]="C"; +_STATIC char _last_localeMON[4]="C"; + +struct lconv *localeconv() + +{ + return(&_lconv); +} + +char * setlocale(int category, const char *locale) +{ + char *ret; + + if(locale) + { + if((strcmp(locale, "")) && (strcmp(locale, "C"))) + return(NULL); + } + switch(category) + { + case LC_ALL: + if(locale == NULL) + return(_last_localeALL); + ret=_last_localeALL; + strcpy(_last_localeALL, locale); + strcpy(_last_localeCOLL, locale); + strcpy(_last_localeCTYP, locale); + strcpy(_last_localeNUM, locale); + strcpy(_last_localeTIME, locale); + strcpy(_last_localeMON, locale); + return(ret); + break; + case LC_COLLATE: + if(locale == NULL) + return(_last_localeCOLL); + ret=_last_localeCOLL; + strcpy(_last_localeCOLL, locale); + return(ret); + break; + case LC_CTYPE: + if(locale == NULL) + return(_last_localeCTYP); + ret=_last_localeCTYP; + strcpy(_last_localeCTYP, locale); + return(ret); + break; + case LC_NUMERIC: + if(locale == NULL) + return(_last_localeNUM); + ret=_last_localeNUM; + strcpy(_last_localeNUM, locale); + return(ret); + break; + case LC_TIME: + if(locale == NULL) + return(_last_localeTIME); + ret=_last_localeTIME; + strcpy(_last_localeTIME, locale); + return(ret); + break; + case LC_MONETARY: + if(locale == NULL) + return(_last_localeMON); + ret=_last_localeMON; + strcpy(_last_localeMON, locale); + return(ret); + break; + default: + return(NULL); + } +} + +/*-------------------------------------------------------------------------* +* multi-byte functions * +*--------------------------------------------------------------------------*/ + +int mblen(const char *s, size_t n) +{ + if((s) && (s[0])) + return(1); + return(0); +} + +int mbtowc(wchar_t *pwc, const char *s, size_t n) +{ + if((s) && (pwc)) + { + *pwc=*s; + if(s[0]) + return(1); + } + return(0); +} + +int wctomb(char *s, wchar_t wchar) +{ + if(s) + { + *s=wchar; + return(1); + } + return(0); +} + +/*-------------------------------------------------------------------------* +* matherr - dummy math error handler. * +*--------------------------------------------------------------------------*/ + +int _matherr(struct exception *x) +{ + if(x != NULL); + return(0); +} + +/*-------------------------------------------------------------------------* +* misc compatibilty functions * +*--------------------------------------------------------------------------*/ + +#pragma warn(wpnu => on) + +void fnmerge(char *path,const char *drive,const char *dir,const char *name,const char *ext) + { + if (drive && *drive) + { + *path++ = *drive++; // may not need ++ on drive + *path++ = ':'; + } + if (dir && *dir) + { + path = stpcpy(path,dir); + if (*(path-1) != '\\' && *(path-1) != '/') + *path++ = '\\'; + } + if (name) + path=stpcpy(path,name); + if (ext && *ext) + { + if(*ext != '.') + *path++ = '.'; + path=stpcpy(path,ext); + } + *path = 0; + } + +int fnsplit(const char *path, char *drive, char *dir, char *name, char *ext) { + + int n, p, c; + int ret; + int dir_start, name_start, ext_start, path_end; + + n=0; + ret=0; + if((path[0]) && ((path[1] == ':') || (path[2] == ':'))) { + do { + c=path[n]; + drive[n]=c; + ++n; + } while (c != ':'); + ret |= DRIVE; + } + drive[n]='\0'; + dir_start=n; + name_start=n; + ext_start=0; + while((c=path[n]) != '\0') { + switch(c) { + case '.' : + if(!((path[n+1] == '.') || (path[n+1] == '\\') || (path[n+1] == '/'))) + ext_start=n; + ++n; + break; + case '/' : + case '\\': + name_start=++n; + ext_start=0; + break; + case '*' : + case '?' : + ret |= WILDCARDS; + default: + ++n; + break; + } + } + path_end=n; + if(ext_start == 0) + ext_start=n; + + n=dir_start; + p=0; + if(n < name_start) { + ret|=DIRECTORY; + while((n < name_start) && (p < MAXDIR-1)) { + dir[p++]=path[n++]; + } + } + dir[p]='\0'; + + n=name_start; + p=0; + if(n < ext_start) { + ret |= FILENAME; + while((n < ext_start) && (p < MAXFILE-1)) { + name[p++]=path[n++]; + } + } + name[p]='\0'; + + p=0; + if((ext_start >= name_start) && (path[ext_start])) { + n=ext_start; + ret |= EXTENSION; + while((n < path_end) && (p < MAXEXT-1)) { + ext[p++]=path[n++]; + } + } + ext[p]='\0'; + + return ret; +} + +void _makepath(char *path, const char *drive, const char *dir, + const char *name, const char *ext) +{ + int pos; + + if(drive) + strcpy(path, drive); + if(dir) + { + if((dir[0] != '\\') && (dir[0] != '/')) + strcat(path, "\\"); + strcat(path, dir); + pos=strlen(path)-1; + if(!((path[pos] == '\\') || (path[pos] == '/') && (!dir[0]))) + { + path[pos+1]='\\'; + path[pos+2]=0; + } + } + strcat(path, name); + if((ext) && (ext[0])) + { + if(ext[0] != '.') + { + pos=strlen(path); + path[pos]='.'; + path[pos+1]='\0'; + } + strcat(path, ext); + } + return; +} + +void _splitpath(const char *path, char *drive, char *dir, char *name, char *ext) { + int n, p, c; + int dir_start, name_start, ext_start, path_end; + + n=0; + if((path[0]) && ((path[1] == ':') || (path[2] == ':'))) { + do { + c=path[n]; + drive[n]=c; + ++n; + } while (c != ':'); + } + drive[n]='\0'; + dir_start=n; + name_start=n; + ext_start=0; + while((c=path[n]) != '\0') { + switch(c) { + case '.' : + if(!((path[n+1] == '.') || (path[n+1] == '\\') || (path[n+1] == '/'))) + ext_start=n; + ++n; + break; + case '/' : + case '\\': + name_start=++n; + ext_start=0; + break; + default: + ++n; + break; + } + } + path_end=n; + if(ext_start == 0) + ext_start=n; + + n=dir_start; + p=0; + while((n < name_start) && (p < _MAX_DIR-1)) { + dir[p++]=path[n++]; + } + dir[p]='\0'; + + n=name_start; + p=0; + while((n < ext_start) && (p < _MAX_FNAME-1)) { + name[p++]=path[n++]; + } + name[p]='\0'; + + p=0; + if(ext_start >= name_start) { + n=ext_start; + while((n < path_end) && (p < _MAX_EXT-1)) { + ext[p++]=path[n++]; + } + } + ext[p]='\0'; +} + +_STATIC char _spath[80]; + +char *searchpath(const char *filename) +{ + + _searchenv(filename, "PATH", _spath); + if(_spath[0]) + return(_spath); + return(NULL); +} + +/*-------------------------------------------------------------------------* +* strtok - separates tokens from string. * +*--------------------------------------------------------------------------*/ + +_STATIC char *_token; + +char *strtok(char *s1, const char *s2) +{ + int n, retn; + + if(s1 == NULL) + s1=_token; + if(s1 == NULL) + return(NULL); + /* use end of last token as starting point */ + n=strspn(s1, s2); /* skip leading deliminators */ + if(s1[n] == '\0') + return(NULL); + retn=n; /* save beginning of token */ + n+=strcspn(&s1[n], s2); /* find end of token */ + if(n == retn) + return(NULL); + if(s1[n]) + { + _token=&s1[n+1]; + s1[n]=0; /* terminate token */ + } + else + { + _token=NULL; + } + return(&s1[retn]); /* return address of token */ +} + +char *StrToPas(char *passtr, const char *s) { + + size_t l; + + l=strlen(s); + if(l > 255) + return NULL; + passtr[0]=(char) l; + return strcpy(&passtr[1], s); +} + +char *_ld_format(char *fmt_buf, LONGDOUBLE num, int flag, int prec) +{ + return _f_fmt(fmt_buf, num, flag, prec); +} + +char *_v_format(unsigned long l, char *s) +{ + return _fptoa(l, s); +} diff --git a/code/SIBOSDK/src/complex.cpp b/code/SIBOSDK/src/complex.cpp new file mode 100644 index 0000000..053db05 --- /dev/null +++ b/code/SIBOSDK/src/complex.cpp @@ -0,0 +1,239 @@ +/* Release 3.10 */ +/*-------------------------------------------------------------------------* +* * +* COMPLEX.C - complex number class implementation. * +* * +* COPYRIGHT (C) 1989..1992 Clarion Software Corporation. * +* All Rights Reserved * +* * +*--------------------------------------------------------------------------*/ + +#include +#include + +#pragma module(init_prio=>22) + +double norm(const complex& c) { + + double r, i; + + r=real(c); + i=imag(c); + return r*r + i*i; +} + +double arg(const complex& c) { + + return atan2(imag(c), real(c)); +} + +complex operator*(const complex& c1, const complex& c2) { + + double ires, rres; + double r1, r2, i1, i2; + + r1=real(c1); + i1=imag(c1); + r2=real(c2); + i2=imag(c2); + rres = r1*r2 - i1*i2; + ires = r1*i2 + r2*i1; + return complex(rres, ires); +} + +complex operator/(const complex& c1, const complex& c2) { + + double ires, rres; + double r1, r2, i1, i2; + + r1=real(c1); + i1=imag(c1); + r2=real(c2); + i2=imag(c2); + + rres=(i1*i2+r1*r2)/(r2*r2+i2*i2); + ires=(r2*i1-r1*i2)/(r2*r2+i2*i2); + + return complex(rres, ires); +} + +const complex& complex::operator*=(const complex& c2) { + + double ires, rres; + double r2, i2; + + r2=real(c2); + i2=imag(c2); + rres = re*r2 - im*i2; + ires = re*i2 + r2*im; + re=rres; + im=ires; + return *this; +} + +const complex& complex::operator/=(const complex& c2) { + + double ires, rres; + double r2, i2; + + r2=real(c2); + i2=imag(c2); + + ires=(im*r2 - i2*re)/(i2*i2 + r2*r2); + rres=(im-r2*ires)/i2; + re=rres; + im=ires; + return *this; +} + + +double abs(const complex& c) { + + double i, r; + + i=imag(c); + r=real(c); + return sqrt(r*r + i*i); +} + +complex acos(const complex& c) { + + complex r; + + r=sqrt(1 - c*c); + r=complex(-imag(r), real(r) ); + r=log(c + r); + return complex(imag(r), -real(r)); +} + +complex asin(const complex& c) { + + complex r; + + r=sqrt(1 - c*c); + r=log(complex(-imag(r), real(r)) + r); + return complex(imag(r), -real(r)); +} + +complex atan(const complex& c) { + + complex r, t; + + t=complex(-imag(c), real(c)); + r=log((1.0+t)/(1.0-t))/2.0; + return complex(imag(r), -real(r)); +} + +complex cos(const complex& c) { + + complex t; + + t=complex(-imag(c), real(c)); + return (exp(t) + exp(-t))/2.0; +} + + +complex cosh(const complex& c) { + + return (exp(c) + exp(-c))/2.0; +} + +complex exp(const complex& c) { + + double ex; + + ex=exp(real(c)); + return complex(ex*cos(imag(c)), ex*sin(imag(c))); +} + +complex log(const complex& c) { + + complex t; + + t=arg(c); + t=complex(-imag(t), real(t)); + return log(abs(c)) + t; +} + +complex log10(const complex& c) { + + complex t; + + t=arg(c); + t=complex(-imag(t), real(t)); + return (log(abs(c)) + t)/log(10.0); +} + +complex pow(const complex& base, double expo) { + + return exp(expo*log(base)); +} + +complex pow(double base, const complex& expo) { + + return exp(expo*log(base)); +} + +complex pow(const complex& base, const complex& expo) { + + return exp(expo*log(base)); +} + +complex sin(const complex& c) { + + complex t; + complex twoi(0.0, 2.0); + + t=complex(-imag(c), real(c)); + return complex((exp(t) - exp(-t))/twoi); +} + +complex sinh(const complex& c) { + + return (exp(c) - exp(-c))/2.0; +} + +complex sqrt(const complex& c) { + + complex t; + + t=sin(arg(c)/2.0); + t=complex(-imag(t), real(t)); + return sqrt(abs(c))*(cos(arg(c)/2.0) + t); +} + + +complex tan(const complex& c) { + + return sin(c)/cos(c); +} + +complex tanh(const complex& c) { + + return sinh(c)/cosh(c); +} + +ostream& operator<<(ostream& st, const complex& c) { + + st<< '(' << real(c) << ',' << imag(c) << ')'; + return st; +} + +istream& operator>>(istream& st, complex& c) { + + double r=0.0, i=0.0; + + if(st.peek() == '(') + st.get(); + st >> r; + if(st.peek() == ',') + st.get(); + st >> i; + if(st.peek() == ')') + st.get(); + c=complex(r, i); + return st; +} + + + \ No newline at end of file diff --git a/code/SIBOSDK/src/coniostr.cpp b/code/SIBOSDK/src/coniostr.cpp new file mode 100644 index 0000000..37ab641 --- /dev/null +++ b/code/SIBOSDK/src/coniostr.cpp @@ -0,0 +1,104 @@ +/* Release 3.10 */ +/*-------------------------------------------------------------------------* +* * +* CONIOSTR.CPP - console I/O stream class implementations. * +* * +* COPYRIGHT (C) 1989..1992 Clarion Software Corporation. * +* All Rights Reserved * +* * +*--------------------------------------------------------------------------*/ + +#define _USE_CONIO +#include +#include + + +#pragma module(init_prio=>22) + +extern "C" void _init_con(void) { + + conout.setf(ios::unitbuf); +} + +static conbuf inbuf; +static conbuf outbuf; + +istream conin(&inbuf); +ostream conout(&outbuf); + +int conbuf::underflow() { + + #define CGETS_MAX_NR 255 /* new line */ + + int nr, c; + char *buf; + + nr=ebuf()-eback(); + if(nr == 1) { + c=getche(); + if(c == EOF) { + return EOF; + } + *eback()=c; + } + else { + if (nr > CGETS_MAX_NR) /* new line */ + nr = CGETS_MAX_NR; /* new line */ + + buf=new char[nr+3]; + buf[0]=nr; + cgets(buf); + nr=buf[1]; + memcpy(eback(), buf+2, nr); /* corrected line */ + + delete buf; + } + setg(eback(), eback(), eback()+nr); + return *gptr(); + + #undef CGETS_MAX_NR /* new line */ + +} + +int conbuf::pbackfail(int c) { + + return ungetch(c); +} + +extern "C" unsigned _flush_init_magic; + +int conbuf::overflow(int c) { + + char *pt; + int nw; + + flush_magic=_flush_init_magic; + if(unbuffered()) { + if((c == EOF) || (putch(c) == EOF)) { + return EOF; + } + } + else { + pt=pbase(); + nw=pptr()-pt; + while(nw--) { + if(putch(*pt) == EOF) { + return EOF; + } + ++pt; + } + } + setp(pbase(), epptr()); + if((c != EOF) && (!unbuffered())) + sputc(c); + return c; +} + +int conbuf::sync() { + + overflow(); + setp(base(), ebuf()); + setg(base(), ebuf(), ebuf()); + return 0; +} + diff --git a/code/SIBOSDK/src/corefile.a b/code/SIBOSDK/src/corefile.a new file mode 100644 index 0000000..adf9b09 --- /dev/null +++ b/code/SIBOSDK/src/corefile.a @@ -0,0 +1,47 @@ +(* Release 3.00 *) + +(* c_files.a - file control memory *) + +(* Copyright (C) 1989 Jensen and Partners. All Rights Reserved*) +(* Written by Simon Knight.*) + +(* Copyright (C) 1991 Psion PLC. All Rights Reserved*) +(* Modified by NSM.*) + +include "corelib.inc" + +OPEN_MAX = 20 + +module files + +section +segment _DATA(DATA, 28H) + +select _DATA + +public __open_max: dw OPEN_MAX + +section +segment _BSS(BSS, 28H) + +public __iob: org OPEN_MAX * _iobSize + +public __openfd: org OPEN_MAX*2 + +public __openmp: org OPEN_MAX*2 + +public __openfl: org OPEN_MAX*2 + +section +segment _BSS(BSS, 28H) + +select _BSS +public __tmpfiles: org OPEN_MAX * DataPtrSize + + section +segment _BSS(BSS, 28H) + +select _BSS +public __tmpfptrs: org OPEN_MAX * DataPtrSize + +end diff --git a/code/SIBOSDK/src/coreinit.a b/code/SIBOSDK/src/coreinit.a new file mode 100644 index 0000000..159eb38 --- /dev/null +++ b/code/SIBOSDK/src/coreinit.a @@ -0,0 +1,257 @@ +(* Release 3.00 *) + +(* c_coreinit - common initialisation between PLIB and CLIB *) + +(* Copyright (C) 1991 Psion PLC. All Rights Reserved*) +(* Written by NSM.*) + +include "corelib.inc" +include "epocdefs.inc" + +module coreinit + +(***************************************************************************) +section +segment _MAGIC(MAGIC,68H) +segment _DATA(DATA,68H) +segment _CONST(DATA,48H) +segment _BSS(BSS,68H) +segment BSS_END(BSS,68H) + +group DGROUP(_MAGIC,_DATA,_CONST,_BSS,BSS_END) + +select _DATA + +public _winHandle : dw 0 +public __conName : db 'CON:*',0 + +(***************************************************************************) +section +segment _DATA(DATA,68H) +public __DefScreenRect : dw -1,0,0,0 + +(***************************************************************************) +section +segment _DATA(DATA,68H) +public __DefScreenMode : dw 0 + +(****************************************************************************) +section +segment _TEXT(CODE,28H) + +public __FatalErrorPos : + + push bx + mov bx, sp + mov ax, ss:[bx][2] + pop bx + ret 0 + +(****************************************************************************) +section +segment _TEXT(CODE,28H) + +public __FatalError : + + mov al, 80 + int ProcPanic + +(****************************************************************************) +section +segment _TEXT(CODE,28H) +segment _DATA(DATA,28H) + +extrn _winHandle +extrn _DatCommandPtr +extrn __DefScreenRect +extrn __DefScreenMode +extrn __conName + +select _TEXT + +extrn __FatalErrorPos +extrn __FatalError + +xMode = -2 +xParse = xMode-FullParseEnt +xBuf = xParse-MaxPathSize + +public _p_xwind : + push bp + mov bp, sp + add sp, xBuf + push ax + push bx + push cx + push dx + push di + push si +; + mov bx, [_DatCommandPtr] + test bx, bx + je noCommandLine + sub cx, cx + lea di, [bp][xBuf] + lea si, [bp][xParse] + sub al, al + mov ah, NmFilParse + int FilManager + jc noCommandLine + lea di, [bp][xBuf] + mov si, __conName + int StringCopy + add di, 5 + lea si, [bp][xBuf][FileSystemNameSize] + mov ax, [bp][xParse][FullParseDevice] + add al, ah + sub ah, ah + add si, ax + mov cl, [bp][xParse][FullParseName] + sub ch, ch + cld + rep ; movsb + sub al, al + stosb + jmp openCon +noCommandLine: + lea di, [bp][xBuf] + mov si, __conName + int StringCopy + mov byte [di][4], 0 +openCon: + lea bx, [bp][xBuf] + mov cx, -1 + mov ah, NmIoOpen + int DevManager + jnc openOk +; + call __FatalErrorPos + mov bx, FatalOpenConsole + jmp __FatalError +; +openOk: mov [_winHandle], ax +; + mov si, ds:[Datawserv_channel] + or si, si + jz old_window_server + mov al, [si][wserv_spec_info_version] + and al, 0FH + cmp al, 2 (* WS_VERSION_4 *) + jb old_window_server +; + sub sp, 32 (* SIZE W_SUPPORT_INFO *) + mov si, sp + mov ax, 0FF06H (* WOR_X_SUPPROT_INFO *) + int WservOpcodes + mov ax, [__DefScreenMode] + mov bx, [si] + add sp, 32 (* SIZE W_SUPPORT_INFO *) +; + test bx, 2 (* W_SUPPORT_CTBY_S3 *) + jz no_ctby_mode + test ax, 1 (* Use compatibility mode if set *) + jnz no_ctby_mode + push ax + push bx + mov word [bp][xMode], 20 (* P_SCR_COMPATIBILITY *) + lea cx, [bp][xMode] + xor ax, ax (* No compatibilty mode *) + push ax + mov dx, sp + mov bx, [_winHandle] + mov al, IoFuncSet + mov ah, NmIoWithWait + int IoManager + pop ax + pop bx + pop ax +; +no_ctby_mode: + test bx, 1 (* W_SUPPORT_CTBY_GREY *) + jz no_grey + test ax, 2 (* Use grey if set *) + jz no_grey +; + mov word [bp][xMode], 21 (* P_SCR_GREY *) + lea cx, [bp][xMode] + mov ax, TRUE + push ax + mov dx, sp + mov bx, [_winHandle] + mov al, IoFuncSet + mov ah, NmIoWithWait + int IoManager + pop ax +no_grey: +; +old_window_server: + mov di, __DefScreenRect + cmp word [di][RectTl][PointX], -1 + jne rectGood + sub ax, ax + mov [di][RectTl][PointX], ax + mov [di][RectTl][PointY], ax + mov ah, NmGenLcdType + int GenManager + mov bx, 60 + mov cx, 15 + cmp al, Lcd240X80 + jne try160X80 + mov bx, 40 + mov cx, 9 + jmp setBr +try160X80: + cmp al, Lcd160X80 + jne setBr + mov bx, 26 + mov cx, 9 +setBr: + mov [di][RectBr][PointX], bx + mov [di][RectBr][PointY], cx +rectGood: + mov word [bp][xMode], 5 (* P_SCR_WSET *) + lea cx, [bp][xMode] + mov dx, di + mov bx, [_winHandle] + mov al, IoFuncSet + mov ah, NmIoWithWait + int IoManager +; + mov word [bp][xMode], 3 (* P_SCR_POSA *) + lea cx, [bp][xMode] + xor ax, ax + push ax + push ax + mov dx, sp + mov al, IoFuncSet + mov ah, NmIoWithWait + int IoManager +; + lea di, [bp][xParse] + mov word [di], 1 + mov dx, di + mov word [bp][xMode], 9 (* P_SCR_CURSOR *) + mov al, IoFuncSet + mov ah, NmIoWithWait + int IoManager +; + pop si + pop di + pop dx + pop cx + pop bx + pop ax + mov sp, bp + pop bp + ret 0 +; + +(****************************************************************************) +section +segment _TEXT(CODE,28H) + +public _ClassTable : +public _ExtCatTable : + dw 0 + +end diff --git a/code/SIBOSDK/src/coreio.a b/code/SIBOSDK/src/coreio.a new file mode 100644 index 0000000..24607d9 --- /dev/null +++ b/code/SIBOSDK/src/coreio.a @@ -0,0 +1,1749 @@ +(* Release 3.00 *) + +(* c_coreio - low level IO stuff *) + +(* Copyright (C) 1989 Jensen and Partners. All Rights Reserved*) +(* Written by Simon Knight.*) + +(* Copyright (C) 1991 Psion PLC. All Rights Reserved*) +(* Written by NSM.*) + +include "corelib.inc" +include "epocdefs.inc" + +module coreio + +(***************************************************************************) +segment _DATA(DATA, 28H) + +public __fmode : dw O_TEXT (* default transaltion mode *) + +segment _BSS(BSS, 28H) + +public __fmask : org 2 (* default file permission mask *) + +segment _DATA(DATA, 28H) + +public __ungotchar : dw -1 (* temporary storage for console I/O *) + +segment _DATA(DATA, 28H) + +public __upperHex : db 'A' (* 'a' or 'A', chooses digit case *) + +segment _BSS(BSS, 28H) + +public __i_putch : org CodePtrSize +public __i_cgets : org CodePtrSize + +segment _BSS(BSS,28H) + +public __p_init : org 2 + +segment _BSS(BSS,28H) + +public __con_key : org ConEnt + +(****************************************************************************) +section +segment _TEXT(CODE,28H) +segment _DATA(DATA, 28H) + +extrn __p_init +extrn __i_putch +extrn __i_cgets +extrn __d_putch +extrn __d_cgets +extrn _winHandle + +select _TEXT + +extrn _p_xwind + +public _putch : + + cmp byte [__p_init], 0 + jne putchInitDone + mov word [__i_putch], __d_putch + mov word [__i_cgets], __d_cgets + not byte [__p_init] + cmp word [_winHandle], 0 + jne putchInitDone + call _p_xwind +putchInitDone: + jmp word [__i_putch] + +(****************************************************************************) +section +segment _TEXT(CODE,28H) +segment _DATA(DATA, 28H) + +extrn _winHandle + +select _TEXT + +public __d_putch : +(* +int putch(int c) +*) + + push bx + push cx + push dx + mov dx, 1 + mov cx, ax + cmp ax, 0AH + jne notNewLine + mov ax, 0A0DH + inc dx +notNewLine: + push cx + push ax + mov cx, sp + mov bx, [_winHandle] + mov ah, NmIoWrite + int IoManager + pop ax + pop ax + jnc putchExit + mov ax, -1 +putchExit: + pop dx + pop cx + pop bx + ret 0 + +(****************************************************************************) +section +segment _TEXT(CODE,28H) +segment _DATA(DATA, 28H) + +extrn __ungotchar +extrn _winHandle +extrn __con_key + +select _TEXT + +public _getch : +(* +int getch(void) +Checks for any character returned by ungetch then calls DOS. +*) + + mov ax, [__ungotchar] + cmp ax, -1 + jne charWaiting + push bx + push cx + push dx + mov cx, __con_key + mov dx, 1 + mov bx, [_winHandle] + mov ah, NmIoRead + int IoManager + pop dx + pop cx + pop bx + jc getchFailed + mov ax, [__con_key][ConKeyValue] + jmp charWaiting + +getchFailed: + sub ax, ax + +charWaiting: + mov word [__ungotchar], -1 + ret 0 + +(****************************************************************************) +section +segment _TEXT(CODE,28H) + +extrn _putch +extrn _getch + +select _TEXT + +public _getche : +(* +int getche(void) +Checks for any charcater returned by ungetch then calls DOS. +*) + + call _getch + test ah, ah + jne badForPutch + jmp near _putch +badForPutch: + ret 0 + +(****************************************************************************) +section +segment _TEXT(CODE,28H) +segment _DATA(DATA,28H) + +select _DATA + +extrn __ungotchar +extrn _winHandle + +select _TEXT + +public _kbhit : +(* +int kbhit(void) +Checks for any charcater waiting in keyboard buffer. +*) + + mov ax, [__ungotchar] + cmp ax, -1 + jne keyWaiting + push bx + push cx + push ax + mov cx, sp + mov bx, [_winHandle] + mov al, IoFuncTest + mov ah, NmIoWithWait + int IoManager + pop ax + pop cx + pop bx + jnc keyWaiting + sub ax, ax + +keyWaiting: + ret 0 + + +(******************************************************************************) +section +segment _TEXT(CODE,28H) +segment _DATA(DATA,28H) +segment _INIT(DATA,28H) +segment _BSS(BSS,28H) + +extrn __exit1 +extrn __exit1_vector + +select _BSS + +Buf0 : org BUFSIZ +Buf1 : org BUFSIZ + +select _DATA + +extrn __iob +extrn __openfd +extrn __openmp +extrn __openfl +extrn _winHandle +extrn __exit_io +extrn __argin +extrn __argout +extrn __argapp +extrn __open +extrn __creat + +HandleData : dw 4000H, 4002H, 6002H +StreamData : dw 405H, 0C06H, 602H +StreamBuffers : dw Buf0, Buf1, 0 + +public __iosetup : dw 0 + +select _TEXT + +extrn __InitLoop + +do_initio : (* defined later on ! *) + +select _INIT + +initio : dw MAGIC + db PR2 + dw do_initio + +select _DATA + +public __doserrno : dw 0, initio + +select _TEXT + +extrn _p_xwind +extrn __FatalErrorPos +extrn __FatalError + +public __initio : + (* check for character devices on default paths *) + push di + push si + mov word [__exit_io], __exit1 + cmp word [__iosetup], 0 + je doInitIo + jmp near ioDone +doInitIo: + not word [__iosetup] + call _p_xwind + sub bx, bx + mov cx, bx + mov si, bx + mov di, __iob +ioLoop: + mov [di][bx][_file], cx + mov ax, [si][StreamBuffers] + or ax, ax + jz noBuf + mov word [di][bx][_size], BUFSIZ + mov [di][bx][_base], ax + mov [di][bx][_ptr], ax +noBuf: + mov ax, [si][StreamData] + mov dx, [si][HandleData] + jcxz doStdin + cmp cl, 1 + jne doStdErr +doStdout: + cmp word [__argout], 0 + je doDefault + push ax + push bx + mov ax, [__argout] + cmp word [__argapp], 0 + jne doAppend +doCreat: + mov bx, FA_TEXT + call __creat + cmp ax, 1 + pop bx + pop ax + je doRestOfFlags + jmp initioFailed +doStdin: + cmp word [__argin], 0 + je doDefault + push ax + push bx + mov ax, [__argin] + mov bx, O_TEXT | SH_DENYWR + call __open + test ax, ax + pop bx + pop ax + je doRestOfFlags + jmp initioFailed +doDefault: + or dh, 20H + or ah, 2H +doStdErr: + push ax + mov ax, [_winHandle] + mov [si][__openmp], ax + pop ax + mov word [si][__openfl], E_CONS | E_DEVICE +doRestOfFlags: + mov [di][bx][_flag], ax + mov [si][__openfd], dx +setDevice: + add bx, _iobSize + add si, 2 + inc cx + cmp cx, 3 + je ioDone + jmp ioLoop + +ioDone: + pop si + pop di + jmp __InitLoop + +doAppend: + mov bx, O_TEXT | O_RDWR + call __open + cmp ax, 1 + mov ax, [__argout] + jne doCreat + pop bx + pop ax + or ax, _F_APP + or dx, O_APPEND + jmp doRestOfFlags + +initioFailed: + call __FatalErrorPos + mov bx, FatalInitIo + jmp __FatalError + +(***************************************************************************) +section +segment _TEXT(CODE,28H) +segment _DATA(DATA, 28H) + +extrn __seterrno +extrn __open_max +extrn __openmp + +select _TEXT + +public __getHandle : + + mov cx, [__open_max] + mov di, __openmp + sub ax, ax + cld + repne; scasw + jne noHandlesLeft + sub di, __openmp+2 + ret 0 +noHandlesLeft: + mov ax, EMFILE + call __seterrno + mov ax, -1 + stc + ret 0 + +(***************************************************************************) +section +segment _TEXT(CODE,28H) +segment _DATA(DATA, 28H) + +extrn __seterrno +extrn __open_max +extrn __openmp +extrn __openfl + +select _TEXT +extrn __FatalErrorPos +extrn __FatalError + +public __checkHandle : + mov bx, ax + cmp ax, [__open_max] + jae invalidHandle + sub ax, ax + call __seterrno + shl bx, 1 + mov ax, [__openfl][bx] + mov bx, [__openmp][bx] + test bx, bx + je invalidHandle + test ax, E_DEVICE + je notAConsol + cmp bx, 1 + jne notAConsol + call __FatalErrorPos + mov bx, FatalConIo + jmp __FatalError +notAConsol: + clc + ret 0 + +invalidHandle: + mov ax, EBADF + call __seterrno + mov ax, -1 + stc + ret 0 + +(***************************************************************************) +section +segment _TEXT(CODE,28H) +segment _DATA(DATA, 28H) + +extrn __checkHandle + +select _TEXT + +public _getRealHandle : +(* +void *getRealHandle(int handle) +Get the plib handle from the clib handle. +*) + + push bx + call __checkHandle + mov ax, 0 + jc getRealExit + mov ax, bx +getRealExit: + pop bx + ret 0 + +(***************************************************************************) +section +segment _TEXT(CODE,28H) +segment _DATA(DATA, 28H) + +extrn __ioerr +extrn __getHandle +extrn __openfl +extrn __openmp + +select _TEXT + +public __creat : +public __creat_trunc : +(* +int _creat_trunc(char *path, int permission) +Creates file or truncates existing one. +*) + + push cx + mov cx, ModeReplace + +doCreate: + push bx + push dx + push di + mov dx, bx + mov bx, ax + push cx + call __getHandle + pop cx + jc creatExit + or cx, ModeUpdate | ModeRandom + mov [__openfl][di], dx + test dx, FA_TEXT + je creatBinary + or cx, ModeStreamText +creatBinary: + mov ah, NmIoOpen + int DevManager + jc creatFailed + mov [__openmp][di], ax + mov ax, di + shr ax, 1 +creatExit: + pop di + pop dx + pop bx + pop cx + ret 0 + +creatFailed: + call __ioerr + mov ax, -1 + jmp creatExit + +public __creat_new : +public _creatnew : +(* +int _creat_new(char *path, int permission) +Creates new file. +*) + push cx + mov cx, ModeCreate + jmp doCreate + +public __creat_temp : +(* +int _creat_temp(char *path, int permission) +Creates new unique file. +*) + + push cx + mov cx, ModeUnique + jmp doCreate + +(****************************************************************************) +section +segment _TEXT(CODE,28H) + +extrn __creat_temp +extrn _strcpy +extrn _strlen + +public _creattemp : + + push bp + mov bp, sp + sub sp, 80H + push bx + push cx + push ax + push bx + mov bx, ax + lea ax, [bp][-80H] + call _strcpy + lea ax, [bp][-80H] + call _strlen + cmp ax, 3 + je skipCheck + lea bx, [bp][-80H] + add bx, ax + cmp byte [bx], '\' + je skipCheck + mov word [bx], '\' +skipCheck: + lea ax, [bp][-80H] + pop bx + call __creat_temp + mov cx, ax + pop ax + lea bx, [bp][-80H] + add bx, 5 + call _strcpy + mov ax, cx + pop cx + pop bx + mov sp, bp + pop bp + ret 0 + +(****************************************************************************) +section +segment _TEXT(CODE,28H) + +public __exists : + + push bx + push cx + sub sp, FileEnt + mov cx, sp + mov bx, ax + sub al, al + mov ah, NmFilStatusGet + int FilManager + mov ax, 0 + jc existsExit + inc ax +existsExit: + add sp, FileEnt + pop cx + pop bx + ret 0 + +(****************************************************************************) +section +segment _DATA(DATA, 28H) +segment _TEXT(CODE,28H) + +extrn __ioerr +extrn __getHandle +extrn __openmp +extrn __openfl + +select _TEXT + +public __open : +(* +int _open(char *path, int access) +opens file and returns handle. +*) + + push bx + push cx + push dx + push di + mov dx, bx + mov bx, ax + call __getHandle + jc openExit + mov cx, ModeOpen | ModeRandom + mov word [__openfl][di], 0 + test dx, O_TEXT + je openBinary + or cx, ModeStreamText +openBinary: + test dx, O_RDWR + je openReadonly + or cx, ModeUpdate +openReadonly: + and dl, 0F0H + cmp dl, SH_DENYWR + je allowShare + cmp dl, SH_DENYNO + jne noShare +allowShare: + or cx, ModeShare +noShare: + mov ah, NmIoOpen + int DevManager + jc openFailed + mov [__openmp][di], ax + mov ax, di + shr ax, 1 +openExit: + pop di + pop dx + pop cx + pop bx + ret 0 +openFailed: + call __ioerr + mov ax, -1 + jmp openExit + +(******************************************************************************) +section +segment _TEXT(CODE,28H) +segment _DATA(DATA,28H) + +extrn __openmp +extrn __openfl + +extrn __ioerr +extrn __checkHandle +extrn __getHandle + +select _TEXT + +public __dup : +(* +int _dup(int handle) +returns the next free file handle. +*) + + push bx + push cx + push dx + push di + mov dx, ax + call __checkHandle + jc dupFailed + call __getHandle + jc dupFailed + mov bx, dx + shl bx, 1 + mov ax, [__openmp][bx] + mov [__openmp][di], ax + mov ax, [__openfl][bx] + mov [__openfl][di], ax + mov ax, di + shr ax, 1 +dupFailed: + pop di + pop dx + pop cx + pop bx + ret 0 + +(******************************************************************************) +section +segment _TEXT(CODE,28H) +segment _DATA(DATA,28H) + +extrn __open_max +extrn __openmp +extrn __openfl + +select _TEXT + +extrn __ioerr +extrn __checkHandle +extrn __close + +public __dup2 : +(* +int _dup2(int oldhandle, int newhandle ) +close newhandle if open and duplicates oldhandle. +*) + + push bx + push cx + push dx + push di + mov cx, ax + mov dx, bx + call __checkHandle + jc dup2Failed + cmp dx, [__open_max] + jae dup2Failed + mov di, dx + shl di, 1 + cmp word [__openmp][di], 0 + je available + mov ax, dx + call __close +available: + mov bx, cx + shl bx, 1 + mov ax, [__openmp][bx] + mov [__openmp][di], ax + mov ax, [__openfl][bx] + mov [__openfl][di], ax + sub ax, ax +dup2Failed: + pop di + pop dx + pop cx + pop bx + ret 0 + +(*************************************************************************) +section +segment _TEXT(CODE,28H) +segment _DATA(DATA, 28H) + +_1bs : db 08H,20H,08H +_2bs : db 08H,08H,20H,20H,08H,08H + +extrn __ioerr +extrn __open_max +extrn __openfl +extrn __openmp +extrn _winHandle +extrn __checkHandle +extrn _getch +extrn _putch + +select _TEXT + +public __read : +(* +int _read(int handle, void *buffer, int num) +reads num bytes from file handle int buffer. +Returns number of bytes read or -1 for error. +*) + + push bx + push cx + push dx + push di + push si + mov di, cx + mov si, cx + jcxz readComplete + mov cx, bx + call __checkHandle + jc readExit + test ax, E_CONS + jne readConsole +readLoop: + mov dx, di + cmp dx, FileMaxStreamSize + jbe inRange + mov dx, FileMaxStreamSize +inRange: + push dx + mov ah, NmIoRead + int IoManager + pop dx + jc readError + cmp ax, dx + jne readShort + add cx, dx + sub di, dx + jne readLoop +readComplete: + mov ax, si + sub ax, di +readExit: + pop si + pop di + pop dx + pop cx + pop bx + ret 0 + +readError: + mov di, si + cmp al, EofErr + je readComplete + call __ioerr + mov ax, -1 + jmp readExit + +readShort: + sub di, ax + jmp readComplete + +readConsole: + cld + xchg cx, di +readCLoop: + call _getch + test ah, ah + jne readCLoop + cmp al, 0DH + jne tryBS + mov al, 0AH + call _putch + +saveAndComplete: + mov ax, 0A0DH + stosw + dec cx + dec cx + jmp readCComplete + +tryBS: + cmp al, 08H + jne gotChar + cmp cx, si + je readCLoop + dec di + inc cx + push bx + push cx + push dx + mov bx, [_winHandle] + mov cx, _1bs + mov dx, 3 + cmp byte [di], ' ' + jae notControl + mov cx, _2bs + mov dl, 6 +notControl: + mov ah, NmIoWrite + int IoManager + pop dx + pop cx + pop bx + jmp readCLoop + +gotChar: + cmp al, ' ' + jae outNotControl + push ax + mov al, '^' + call _putch + pop ax + push ax + add al, '@' + call _putch + pop ax + jmp saveAndContinue +outNotControl: + call _putch +saveAndContinue: + stosb + loop readCLoop + +readCComplete: + xchg cx, di + jmp readComplete + + +(*************************************************************************) +section +segment _TEXT(CODE,28H) +segment _DATA(DATA, 28H) + +extrn _errno +extrn __openfd + +select _TEXT + +extrn __read +extrn __ioerr +extrn _lseek +extrn __write + +public _write : + +temp = -2 +appbuf = -4 +writesize = -6 +flag = -7 +reset = -8 +handle = -10 +buffer = -12 +num = -14 + +locals = 14 + +WRITE_BUF_SIZE = 400H + + push bp + mov bp, sp + sub sp, locals + push dx + push di + push si + mov [bp][handle], ax + mov [bp][buffer], bx + mov [bp][num], cx + + mov byte [bp][reset], 0 + mov bx, [bp][handle] + shl bx, 1 + mov cx, [__openfd][bx] + jcxz near writeInvalid + test cx, O_RDWR+O_WRONLY (* test for correct access mode *) + je near writeAccess + cmp word [bp][num], 0 + je near writeEOF (* don't write zero bytes *) + test cx, O_APPEND + je dontAppend + mov di, cx (* append to EOF if flag set *) + sub ax, ax + mov dx, SEEK_END + test cx, O_TEXT + jz appNotText + dec ax + mov cx, ax + mov bx, ax + mov ax, [bp][handle] + call _lseek + cmp dx, -1 + je nextSeek + cmp ax, -1 + je nextSeek + mov ax, [bp][handle] + mov cx, 1 + lea bx, [bp][appbuf] + call __read + cmp word [_errno], 0 + jne near writeError + mov ax, -1 + mov dx, SEEK_END + cmp byte [bp][appbuf], CTLZ + je ctlzPresent + inc ax +ctlzPresent: + jmp appNotText +nextSeek: + mov dx, SEEK_END + sub ax, ax +appNotText: + mov cx, ax + mov bx, ax + mov ax, [bp][handle] + call _lseek +appendDone: + mov cx, di +dontAppend: + test cx, O_TEXT + je near writeBinary +writeText: (* test mode *) + test cx, _O_EOF (* error if EOF flag set *) + jne near writeEOF + mov cx, WRITE_BUF_SIZE + 2 + mov ah, NmHeapAllocateCell + int HeapManager + jc near writeNomem + inc ax + mov [bp][temp], ax + not byte [bp][reset] + shr cx, 1 (* write size is half that of buffer *) + dec cx + mov [bp][writesize], cx + mov si, [bp][buffer] +writeMainLoop: (* main loop - translate and *) + mov cx, [bp][num] (* write a block *) + jcxz allWritten + cmp cx, [bp][writesize] (* exit when all written *) + jb cxRight + mov cx, [bp][writesize] +cxRight: + sub [bp][num], cx + mov di, [bp][temp] + mov ah, 0AH + mov [di][-1], ah (* Dummy at buffer-1 *) + mov bh, CTLZ + mov bl, 0DH + (* this next loop is the time *) +writeTransLoop: (* one where transaltion takes place *) + lodsb + cmp al, ah + je doTrans (* no jump for no translate *) +doneTrans: + stosb + cmp al, bh + je writeCtlz (* ctl Z - terminate output *) + dec cx + jcxz writeBlock (* repeat loop body *) + lodsb + cmp al, ah + je doTrans + stosb + cmp al, bh + je writeCtlz + loop writeTransLoop + jmp writeBlock +doTrans: + cmp [di][-1], bl (* CR inserted here *) + je doneTrans + mov [di], bl + inc di + jmp doneTrans + +writeCtlz: + mov byte [bp][flag], 1 + jmp writeWrite +writeBlock: + mov byte [bp][flag], 0 (* write transalted block *) +writeWrite: + push cx + mov ax, [bp][handle] + mov bx, [bp][temp] + sub di, bx + mov cx, di + call __write + pop cx + cmp word [_errno], 0 + jne writeError (* write error *) +writeOK: + cmp byte [bp][flag], 0 + je writeMainLoop (* go back for another block *) +allWritten: + mov bx, [bp][handle] + shl bx, 1 + cmp byte [bp][flag], 0 + je dontSet + test word [__openfd][bx], O_DEVICE (* if !device and ctl Z set EOF flag *) + jne dontSet + or word [__openfd][bx], _O_EOF +dontSet: + sub si, [bp][buffer] + jmp writeDone +writeBinary: (* binary output done here *) + mov ax, [bp][handle] + mov cx, [bp][num] + mov bx, [bp][buffer] + call __write + cmp word [_errno], 0 + jne writeError + mov si, ax + mov bx, [bp][handle] + shl bx, 1 +writeDone: + or word [__openfd][bx], O_CHANGED (* set file changed flag *) +writeEnd: + cmp byte [bp][reset], 0 + je writeNoCell + mov bx, [bp][temp] + dec bx + mov ah, NmHeapFreeCell + int HeapManager +writeNoCell: + mov ax, si (* return *) + pop si + pop di + pop dx + mov sp, bp + pop bp + ret 0 + +writeError: (* error return *) + mov si, -1 + mov bx, ax + jmp writeSetErr +writeEOF: (* EOF return *) + sub si, si + jmp writeEnd +writeAccess: (* invalid access mode *) + mov si, -1 + mov bx, EACCESS + jmp writeSetErr +writeInvalid: (* bad file *) + mov si, -1 + mov bx, EBADF + jmp writeSetErr +writeNomem: (* no memory for buffer *) + mov bx, ENOMEM +writeSetErr: (* set errno *) + mov ax, bx + call __ioerr (* set errno *) + jmp writeEnd + +(*************************************************************************) +section +segment _TEXT(CODE,28H) + +extrn _errno +extrn __openfd +extrn __open_max +extrn __read +extrn __ioerr + +select _TEXT + +public _read : + +handle = -2 +buffer = -4 +num = -6 +locals = 6 + + push bp + mov bp, sp + sub sp, locals + push dx + push di + push si + mov [bp][handle], ax + mov [bp][buffer], bx + mov [bp][num], cx + mov bx, [bp][handle] + shl bx, 1 + mov cx, [__openfd][bx] + jcxz near readInvalid + test cx, O_WRONLY + jne near readAccess (* access mode invalid *) + cmp word [bp][num], 0 (* read zero - do nothing *) + je near readEOF + test cx, O_TEXT + je near readBinary +readText: (* test mode *) + test cx, _O_EOF + jne near readEOF (* error - EOF flag set *) + mov cx, [bp][num] + mov bx, [bp][buffer] + mov di, bx + mov ax, [bp][handle] + call __read + cmp word [_errno], 0 + jne near readError +readOK: + mov cx, ax + jcxz readCtlz + cmp cx, 1 + je readOne +readOneContinue: + mov ah, 0DH + mov bh, CTLZ + mov si, [bp][buffer] +readTransLoop: (* translation loop *) + lodsb + cmp al, ah + je missCR (* skip LF *) + stosb + cmp al, bh + je readCtlz (* hit ctl Z - terminate input *) +missCR: + loop readTransLoop + jmp readDone +readCtlz: + mov bx, [bp][handle] + shl bx, 1 + test word [__openfd][bx], O_DEVICE (* if !device + ctl Z set EOF *) + jne dontSet + or word [__openfd][bx], _O_EOF + jcxz dontSet + dec di +dontSet: + jmp readDone +readBinary: (* binary read done here *) + mov ax, [bp][handle] + mov cx, [bp][num] + mov bx, [bp][buffer] + call __read + jmp readExit +readDone: + sub di, [bp][buffer] +readEnd: + mov ax, di +readExit: + pop si + pop di + pop dx + mov sp, bp + pop bp + ret 0 + +readError: (* return error *) + mov di, -1 + mov bx, ax + jmp readSetErr +readEOF: (* return EOF *) + sub di, di + jmp readEnd +readAccess: (* invbalid access mode *) + mov di, -1 + mov bx, EACCESS + jmp readSetErr +readInvalid: (* file not open *) + mov di, -1 + mov bx, EBADF +readSetErr: (* set errno *) + mov ax, bx + call __ioerr (* set errno *) + jmp readEnd + +readOne: + cmp word [bp][num], 1 + je readExit + jmp readOneContinue + +(*************************************************************************) +section +segment _DATA(DATA, 28H) +segment _TEXT(CODE,28H) + +extrn __ioerr +extrn __open_max +extrn __openfl +extrn __openmp +extrn __checkHandle + +select _TEXT + +public __write : +(* +int _write(int handle, void *buffer, int num) +writes num bytes to file handle from buffer. +Returns number of bytes written or -1 for error. Low level DOS function. +*) + + push bx + push cx + push dx + push di + push si + push bp + mov di, cx + mov si, cx + mov cx, bx + call __checkHandle + jc writeExit + mov bp, FileMaxStreamSize + test ax, E_DEVICE + je writeLoop + mov bp, 128 +writeLoop: + mov dx, di + cmp dx, bp + jbe inRange + mov dx, bp +inRange: + mov ah, NmIoWrite + int IoManager + jc writeError + add cx, dx + sub di, dx + jne writeLoop + mov ax, si +writeExit: + pop bp + pop si + pop di + pop dx + pop cx + pop bx + ret 0 + +writeError: + call __ioerr + mov ax, -1 + jmp writeExit + +(***************************************************************************) +section +segment _DATA(DATA, 28H) +segment _TEXT(CODE,28H) + +extrn __ioerr +extrn __openmp +extrn __openfl +extrn __open_max + +select _TEXT + +extrn __checkHandle +extrn __FsChanToName +extrn __chmod +extrn __seterrno + +public __close : +(* +int _close(int handle) +closes file and returns 0 if successful. Low level DOS function. +*) + + push bp + mov bp, sp + sub sp, 80H + push bx + push cx + push di + mov di, ax + + + mov bx, ax + cmp ax, [__open_max] + jae closeInvalidHandle + sub ax, ax + call __seterrno + shl bx, 1 + mov ax, [__openfl][bx] + mov bx, [__openmp][bx] + test bx, bx + je closeInvalidHandle + test ax, E_DEVICE + je closeNotAConsol + cmp bx, 1 + je doNoClose +closeNotAConsol: + call anyOtherHandles +doNoClose: + mov ax, 1 + je skipClose + push bx + mov ax, bx + lea bx, [bp][-80H] + call __FsChanToName + pop bx + mov ah, NmIoClose + int IoManager + jc closeFailed + sub ax, ax +skipClose: + mov word [di][__openmp], 0 + test ax, ax + jne closeExit + mov ax, [di][__openfl] + test ax, E_DEVICE + jne closeExit + and ax, FA_RDONLY | FA_HIDDEN | FA_SYSTEM + je closeExit + mov cx, ax + mov bx, 1 + lea ax, [bp][-80H] + call __chmod + sub ax, ax +closeExit: + pop di + pop cx + pop bx + mov sp, bp + pop bp + ret 0 + +closeInvalidHandle: + mov ax, EBADF + call __seterrno + mov ax, -1 + stc + jmp closeExit + +closeFailed: + call __ioerr + mov ax, -1 + jmp skipClose + +anyOtherHandles: + push cx + push si + shl di, 1 + mov cx, [__open_max] + sub si, si +anyLoop: + cmp si, di + je notThisOne + cmp [__openmp][si], bx + je gotOne +notThisOne: + inc si + inc si + loop anyLoop + inc cx +gotOne: + pop si + pop cx + ret 0 + +(****************************************************************************) +section +segment _DATA(DATA,28H) +segment _TEXT(CODE,28H) + +extrn __ioerr +extrn __openfl +extrn __checkHandle + +select _TEXT + +public __eof : +(* +int _eof(int handle) +returns file status - EOF 1, error -1, else 0. +*) + + push bx + push cx + push dx + push di + push si + mov di, ax + call __checkHandle + jc eofExit + sub ax, ax + shl dx, 1 + test word [di][__openfl], E_DEVICE + jne eofExit + push ax + push ax + mov di, sp + push ax + push ax + mov dx, sp + mov cx, SeekFromCurrent + mov ah, NmIoSeek + int IoManager + jc eofFailed + mov dx, di + mov cx, SeekFromEnd + mov ah, NmIoSeek + int IoManager + jc eofFailed + mov si, sp + sub dx, dx + mov ax, [si][2] + cmp [di][2], ax + jne notEof + mov ax, [si] + cmp [di], ax + jne notEof + inc dx +notEof: + mov [di], dx + mov dx, si + mov cx, SeekFromStart + mov ah, NmIoSeek + int IoManager + jc eofFailed + mov ax, [di] +eofExitPop: + add sp, 8 +eofExit: + pop si + pop di + pop dx + pop cx + pop bx + ret 0 + +eofFailed: + call __ioerr + mov ax, -1 + jmp eofExitPop + +(******************************************************************************) +section +segment _TEXT(CODE,28H) +segment _DATA(DATA, 28H) + +extrn __openfl + +select _TEXT + +extrn __checkHandle + +public _isatty : +(* +int isatty (int handle) +The return value is true (1) if handle is attached to a character device +such as the console or printer, or false (0) if handle is for an ordinary +file or is not valid. +*) + + push bx + push cx + push dx + push di + mov di, ax + call __checkHandle + jc isattyExit + sub ax, ax + shl di, 1 + test word [di][__openfl], E_DEVICE + je isattyExit + inc ax +isattyExit: + pop di + pop dx + pop cx + pop bx + ret 0 + +(*****************************************************************************) +section +segment _TEXT(CODE,28H) + +extrn __ioerr +extrn __lseek +extrn __checkHandle + +public _lseek : +(* +long lseek(int handle, long offset, int where) +positions handles file pointer and returns new offset. +*) + + push bx + call __checkHandle + jc seekError + mov ax, bx + pop bx + jmp near __lseek +seekError: + cwd + ret 0 + +(******************************************************************************) +section +segment _TEXT(CODE,28H) +segment _DATA(DATA, 28H) + +extrn __ioerr + +select _TEXT + +extrn __checkHandle + +public _tell : +(* +long tell(int handle) +Returns offset of file pointer. +*) + + push bx + push cx + sub bx, bx + push bx + push bx + call __checkHandle + jc tellErr1 + mov cx, SeekFromCurrent + mov dx, sp + mov ah, NmIoSeek + int IoManager + jc tellErr + pop ax + pop dx +tellOk: + pop cx + pop bx + ret 0 +tellErr: + call __ioerr (* set errno *) + mov ax, -1 (* error return -1L *) +tellErr1: + cwd + add sp, 4 + jmp tellOk + +(*****************************************************************************) +section +segment _DATA(DATA, 28H) +segment _TEXT(CODE,28H) + +extrn __ioerr + +select _TEXT + +public _rmdir : +public _unlink : +(* +int unlink(char *filename) +Deletes file. Returns 0 if successful or -1 and sets errno. +*) + + push bx + mov bx, ax + sub al, al + mov ah, NmFilDelete + int FilManager + jnc unlinkOK + call __ioerr (* set errno *) + mov ax, -1 + jmp unlinkDone (* return -1 *) +unlinkOK: + sub ax, ax +unlinkDone: + pop bx + ret 0 + +(*****************************************************************************) +section +segment _DATA(DATA, 28H) +segment _TEXT(CODE,28H) + +extrn __ioerr + +select _TEXT + +public _rename : +(* +int rename(char *oldfile, char *newfile) +Renames file. Returns 0 if successful or -1 and sets errno. +*) + + push bx + push cx + mov cx, bx + mov bx, ax + sub al, al + mov ah, NmFilRename + int FilManager + jnc renameOK + call __ioerr (* set errno *) + mov ax, -1 + jmp renameDone (* return -1 *) +renameOK: + sub ax, ax +renameDone: + pop cx + pop bx + ret 0 + +(****************************************************************************) +section +segment _TEXT(CODE,28H) + +extrn __doMakeAndChange + +public _mkdir : +(* +int mkdir(const char *path) +makes new sub-directory. +returns 0 if sucessful or -1 if not. +errno is set to ENOENT if the path was not found or EACCES if access denied. +*) + + push si + mov si, ax + mov ax, NmFilMakeDirectory * 100H + jmp near __doMakeAndChange + +(******************************************************************************) +section +segment _TEXT(CODE,28H) +segment _DATA(DATA, 28H) + +extrn __ioerr + +select _TEXT + +public _chdir : + +(* +int chdir(const char *path) +Changes current working directory. +returns 0 if sucessful or -1 if not (errno is set to ENOENT). +*) + + push si + mov si, ax + mov ax, NmFilPathSet * 100H +public __doMakeAndChange : + push di + push bx + sub sp, 80H + mov di, sp + push ax + int StringCopy + int StringLength + add di, ax + dec di + cmp byte [di], '\' + je skipCheck + mov word [di][1], '\' +skipCheck: + pop ax + mov bx, sp + int FilManager + jc chError + sub ax, ax + jmp chDone +chError: + call __ioerr (* set errno *) + mov ax, -1 (* return -1 *) +chDone: + add sp, 80H + pop bx + pop di + pop si + ret 0 + +end diff --git a/code/SIBOSDK/src/coremain.a b/code/SIBOSDK/src/coremain.a new file mode 100644 index 0000000..bc2e2fe --- /dev/null +++ b/code/SIBOSDK/src/coremain.a @@ -0,0 +1,673 @@ +(* Release 3.00 *) + +(* CoreMain - process startup and exit, args, environment. *) + +(* Copyright (C) 1989 Jensen and Partners. All Rights Reserved*) +(* Written by Simon Knight.*) + +(* Copyright (C) 1991 Psion PLC. All Rights Reserved*) +(* Written by NSM.*) + +include "corelib.inc" +include "epocdefs.inc" + +module CoreMain + +(****************************************************************************) +segment _MAGIC(DATA,28H) +segment _INIT(DATA,28H) +segment _CONST(DATA,28H) +segment _DATA(DATA,28H) +segment _BSS(BSS,28H) +segment _BSS_END(BSS,28H) + +group DGROUP(_MAGIC,_INIT,_CONST,_DATA,_BSS,_BSS_END) + +select _BSS + +public __argbuf : org 128 (* command line buffer *) +public __osmajor : org 2 +public __osminor : org 2 +public __exit_stk : org 32*CodePtrSize (* at/onexit function stack *) +public __exit_io : org CodePtrSize +public __exit_tmp : org CodePtrSize +public __exit_proc : org CodePtrSize +public __real_in : org CodePtrSize +public __real_out : org CodePtrSize +public __sigsetup : org 2 +public __exitbreak : org CodePtrSize +public __exitsig : org CodePtrSize +public @InitCount : org 2 +public @InitEnd : org 2 +public @InitDone : org 2 +public @ExitCode : org 2 +public @StackContextSP : org 2 +public @StackContextBP : org 2 + +select _DATA + +extrn __Term2 +extrn __init_start +extrn __bss_start + +public __exit_ptr : dw __exit_stk + (32*CodePtrSize) +public __exit_top : dw __exit_stk + (32*CodePtrSize) +public standard@haltChain : dw __Term2 +public @InitPointer : dw __init_start +public @InitPriority : db PRMAX +public __arg_init : db 0 + +(****************************************************************************) +section +segment _TEXT(CODE,28H) +segment _DATA(DATA, 28H) + +extrn __exit + +select _DATA + +extrn __exit +extrn __exit_io +extrn __exit_tmp +extrn __exit_proc +extrn __init_start +extrn __const_start +extrn @RecursiveExit +extrn @InitPointer +extrn @InitCount +extrn @InitPriority +extrn @InitEnd +extrn @InitDone +extrn @ExitCode +extrn @StackContextSP +extrn @StackContextBP +extrn $Stage2 + +select _TEXT + +public _exit : + + mov [@ExitCode], ax + cmp byte [@RecursiveExit], 0 + je notAgain + call __exit +notAgain: + not byte [@RecursiveExit] + mov sp, [@StackContextSP] + mov bp, [@StackContextBP] + jmp near $TerminateProcess + +public __InitLoop : + + push di + push si + mov bx, [@InitPointer] + jmp traverseLoop +nextLoop: + add bx, InitSize +chainLoop: +traverseLoop: + cmp bx, [@InitEnd] + jae endOfArray + mov al, [@InitPriority] + cmp al, [bx][Priority] + jne nextLoop + lea ax, [bx][InitSize] + mov [@InitPointer], ax + dec word [@InitCount] + call [bx][ProcVar] + mov bx, [@InitPointer] + cmp word [@InitDone], 0 + je traverseLoop +initLoopRet: + pop si + pop di + ret 0 + +endOfArray: + cmp word [@InitCount], 0 + je stageComplete + +endOfList: + dec byte [@InitPriority] + js stageComplete + mov bx, __init_start + jmp chainLoop + +stageComplete: + inc word [@InitDone] + mov [@StackContextBP], bp + mov [@StackContextSP], sp + call $Stage2 + mov [@ExitCode], ax + +$TerminateProcess: + +public __Term2 : + extrn __exit_ptr + extrn __exit_top + extrn standard@haltChain + +(* reset halt chain to allow it to be re-used in termination code *) + + mov bx, here + xchg bx, [standard@haltChain] + call bx + +here: + mov bp, [@StackContextBP] + mov sp, [@StackContextSP] + mov si, [__exit_ptr] + mov di, [__exit_top] +exitLoop: + cmp si, di + je loopDone + call [si] + add si, 2 + jmp exitLoop +loopDone: + + jmp initLoopRet + +public __cleanup : + + mov cx, [__exit_io] + jcxz noCall1 + call cx +noCall1: + mov cx, [__exit_tmp] + jcxz noCall2 + call cx +noCall2: + mov cx, [__exit_proc] + jcxz noCall3 + call cx +noCall3: + ret 0 + +(******************************************************************************) +section +segment _TEXT(CODE,28H) +segment _BSS(BSS,28H) + +__env_buffer : org 256 + +select _TEXT + +public _getenv : + + push di + push si + mov si, __env_buffer + mov di, ax + mov ah, NmGenEnvStringGet + int GenManager + mov ax, si + jnc getenvExit + sub ax, ax +getenvExit: + pop si + pop di + ret 0 + +(******************************************************************************) +section +segment _TEXT(CODE,28H) + +extrn _strlen +extrn _strcpy +extrn _strchr + +public _putenv : + + push bx + push di + push si + sub sp, (256+18) + cld + + mov bx, ax + call _strlen + mov di, ax + test ax, ax + je putenvFailed + cmp ax, (256+18) + jae putenvFailed + mov ax, sp + call _strcpy + mov bl, '=' + sub bh, bh + call _strchr + mov bx, ax + mov ah, NmGenEnvStringDelete + test bx, bx + je putenvDelete + mov si, bx + mov byte [si], 0 + inc si + cmp byte [si], 0 + je putenvDelete + mov ah, NmGenEnvStringSet +putenvDelete: + mov di, sp + int GenManager + jc putenvFailed + sub ax, ax +putenvExit: + add sp, (256+18) + pop si + pop di + pop bx + ret 0 + +putenvFailed: + mov ax, -1 + jmp putenvExit + +(****************************************************************************) +section +segment _TEXT(CODE,28H) +segment _DATA(DATA,28H) + +extrn @InitCount +extrn @InitEnd +extrn @InitDone +extrn __init_start +extrn __const_start + +select _TEXT + +public __InitSetup : + + mov ax, __const_start + sub ax, __init_start + mov bl, InitSize + div bl + sub ah, ah + mov [@InitCount], ax + mul bl + add ax, __init_start + mov [@InitEnd], ax + and word [@InitDone], 0 + ret 0 + +(****************************************************************************) +section +segment _TEXT(CODE,28H) +segment _DATA(DATA, 28H) + +extrn __argv +extrn __argc + +select _TEXT + +extrn _main + +public __init2 : + + mov ax, [__argc] + mov bx, __argv + jmp near _main + +(****************************************************************************) +section +segment _INIT(DATA,28H) +segment _TEXT(CODE,28H) +segment _DATA(DATA,28H) +segment _BSS(BSS, 28H) + +extrn __setargv +extrn __InitLoop + +select _TEXT + +do_initargc : (* defined later on ! *) + +select _INIT + +initargc : dw MAGIC + db PR1 + dw do_initargc + +select _BSS + +public __argv : org 32*DataPtrSize +public __argin : org DataPtrSize +public __argout : org DataPtrSize +public __argapp : org 2 + +select _DATA + +public __argc : dw initargc + +select _TEXT + + call __setargv + jmp __InitLoop + +(****************************************************************************) +section +segment _TEXT(CODE,28H) +segment _DATA(DATA, 28H) + +extrn __exit + +select _DATA + +extrn __osmajor +extrn __osminor + +select _TEXT + +public __osversion : + +(* +void __osversion(void) +checks Epoc/Os version into __osver +*) + + mov ah, NmGenVersion + int GenManager + push ax + shr ax, 1 + shr ax, 1 + shr ax, 1 + shr ax, 1 + mov [__osmajor], ah + mov [__osminor], al + pop ax + and ah, 0FH + mov al, 0AH + mul ah + add [__osminor], ax + ret 0 + +(**************************************************************************) +section +segment _TEXT(CODE,28H) +segment _DATA(DATA,28H) + +select _DATA + +extrn __argv +extrn __argbuf +extrn __argc +extrn __argin +extrn __argout +extrn __argapp +extrn __arg_init +extrn _DatCommandPtr + +select _TEXT + +extrn _strlen + +public __setargv : + + push di + push si + cld + cmp byte [__arg_init], 0 + jne initDone + not byte [__arg_init] + mov word [__argc], 0 + mov di, [_DatCommandPtr] + test di, di + je initDone + mov bx, __argv + call saveArg + mov ax, di + call _strlen + add di, ax + inc di + mov si, di + lodsb + cbw + add ax, si + mov dx, ax + mov di, __argbuf +convLoop: + cmp si, dx + jae initDone + lodsb + test al, al + je initDone + cmp al, ' ' + je convLoop + cmp al, '<' + je gotInRedir + cmp al, '>' + je gotOutRedir + cmp al, '"' + je gotString + dec si + mov al, ' ' +gotString: + mov cl, al + call saveArg +locateLoop: + cmp si, dx + jae gotLocate + lodsb + test al, al + je gotLocate + cmp al, cl + je gotLocate + stosb + jmp locateLoop +gotLocate: + sub al, al + stosb + jmp convLoop +initDone: + pop si + pop di + ret 0 +gotInRedir: + push bx + mov bx, __argin + jmp goLocate +gotOutRedir: + cmp byte [si], '>' + jne notAppend + lodsb + mov word [__argapp], ModeAppend +notAppend: + push bx + mov bx, __argout +goLocate: + cmp si, dx + jae noFileName + lodsb + test al, al + je noFileName + cmp al, ' ' + je goLocate + dec si + mov [bx], di + mov cl, ' ' + pop bx + jmp locateLoop +noFileName: + pop bx + jmp initDone + +saveArg: + cmp word [__argc], 32 + jae noRoomForMore + mov [bx], di + inc bx + inc bx + inc word [__argc] +noRoomForMore: + ret 0 + +(****************************************************************************) +section +segment _TEXT(CODE,28H) +segment _DATA(DATA, 28H) + +select _DATA + +extrn __sigsetup +extrn __exitbreak +extrn __exitsig + +select _TEXT + +extrn __FloatFinish + +public __exit : + +(* +void __exit(int code) +terminates process. +*) + + mov di, ax + mov cx, [__exitbreak] + jcxz noBreak + call cx +noBreak: + mov cx, [__exitsig] + jcxz noSig + call cx +noSig: + + call __FloatFinish + + mov ah, NmProcId + int ProcManager + mov bx, ax + mov ax, di + mov ah, NmProcKill + int ProcManager + +(****************************************************************************) +section +segment _DATA(DATA, 28H) +segment _TEXT(CODE,28H) + +extrn __exit_proc +extrn __exitbreak +extrn __exitsig +extrn __FloatFinish + +public __term_process : + + mov cx, [__exit_proc] + jcxz noCall4 + call cx +noCall4: + mov cx, [__exitbreak] + jcxz noBreak + call cx +noBreak: + mov cx, [__exitsig] + jcxz noSig + call cx +noSig: + jmp near __FloatFinish + +(****************************************************************************) +section +segment _TEXT(CODE,28H) +segment _DATA(DATA, 28H) + +select _DATA + +message : db 0AH,'Floating Point Not Loaded',0AH,0 + +select _TEXT + +extrn _puts + +public __real_pdef : +public __real_sdef : + + mov ax, message + jmp _puts + +(****************************************************************************) +section +segment _TEXT(CODE,28H) +segment _MAGIC(DATA,28H) +segment _INIT(DATA,28H) +segment _CONST(DATA,28H) +segment _DATA(DATA,28H) +segment _BSS(BSS,28H) +segment _BSS_END(BSS,28H) + +group DGROUP(_MAGIC,_INIT,_CONST,_DATA,_BSS,_BSS_END) + +extrn __EpocInit +extrn __exit +extrn __cleanup +extrn __osversion +extrn __FloatInit +extrn __InitSetup +extrn __InitLoop +extrn __init2 +extrn @ExitCode +select _TEXT (* Process initialisation starts here *) + +public __startup : + + call __EpocInit + + call __FloatInit (* initialise floating point if present *) + call __osversion (* get Epoc/Os version first *) + + call __InitSetup + call __InitLoop + + call __cleanup + + mov ax, [@ExitCode] + jmp near __exit + +public $Stage2 : + + call __init2 + +(****************************************************************************) +section +segment _TEXT(CODE,28H) +segment _DATA(DATA,28H) + +extrn __real_in +extrn __real_out +extrn __rreal_in +extrn __rreal_out + +select _TEXT + +extrn __initsig + +public __fp_1 : + + mov word [__real_in], __rreal_in (* initialise 'C' fp output *) + mov word [__real_out], __rreal_out + jmp near __initsig + +(****************************************************************************) +section +segment _TEXT(CODE,28H) +segment _DATA(DATA,28H) + +extrn __real_in +extrn __real_out +extrn __real_pdef +extrn __real_sdef + +select _TEXT + +public __fp_0 : + + mov word [__real_in], __real_sdef + mov word [__real_out], __real_pdef + ret 0 + +end + + diff --git a/code/SIBOSDK/src/coremath.a b/code/SIBOSDK/src/coremath.a new file mode 100644 index 0000000..f491a3e --- /dev/null +++ b/code/SIBOSDK/src/coremath.a @@ -0,0 +1,1259 @@ +(************************************************************************) +(* *) +(* Release 3.00 *) +(* *) +(* CoreMATH - Common math support module. *) +(* *) +(* Copyright (C) 1989, 1990 Jensen and Partners. All Rights Reserved *) +(* Written by Simon Knight. *) +(* *) +(* Copyright (C) 1991 Psion PLC. All Rights Reserved *) +(* Modified by NSM. *) +(* *) +(************************************************************************) + +include "corelib.inc" +include "epocdefs.inc" + +module CoreMath + +(****************************************************************************) +segment _BSS(BSS,28H) + +public _matherr : org CodePtrSize +public __SH_sword : org 2 +public __exc_addr : org 2 + +segment _BSS(BSS,28H) + +public __fac : org 10 + +segment _DATA(DATA,28H) + +public _HUGE : db 098H,060H,0B9H,0D7H,0FFH,0FFH,0EFH,07FH + +segment _DATA(DATA,28H) + +public _LHUGE : db 0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FEH,07FH + +(****************************************************************************) +section + +extrn FIDRQQ +extrn _matherr +extrn FIWRQQ +extrn __seterrno + + +segment _TEXT(CODE,00048H) (*segment length = 000A2H*) + +public __report_math_error : + push bp + mov bp,sp + sub sp,30H + push di + push si + push cx + fwait + fld st(0),st(1) + fwait + fstp tbyte [bp][-30H],st(0) + fwait + fst st(1),st(0) + mov cx,ax + cmp word [_matherr],0 + je $1 + xor si,si +$0: + mov di,si + add di,bx + mov al,cs:[di] + mov [bp][si][-0AH],al + inc si + cmp si,0AH + jl $0 + mov [bp][-26H],cx + fwait + fld st(0),st(5) + fwait + fstp qword [bp][-22H],st(0) + nop + fwait + fwait + fld st(0),st(6) + fwait + fstp qword [bp][-1AH],st(0) + nop + fwait + lea ax,[bp][-0AH] + mov [bp][-24H],ax + lea ax,[bp][-26H] + call word [_matherr] + test ax,ax + jne $3 +$1: + cmp cx,1 + jne $4 + mov ax,EDOM +$2: + call __seterrno + fwait + fld st(0),st(1) + fwait + fstp st(1),st(0) + jmp $5 +$3: + fwait + fld qword st(0),[bp][-12H] + fwait + fstp st(1),st(0) + jmp $5 +$4: + mov ax,ERANGE + jmp $2 +$5: + fwait + fld tbyte st(0),[bp][-30H] + fwait + fstp st(2),st(0) + pop cx + pop si + pop di + mov sp,bp + pop bp + ret 0 + +segment _TEXT(CODE,28H) + +two: dw 2 + +extrn __report_math_error + +__lib_error: + push bp + push ax + push bx + push cx + push dx + mov bp,sp + sub sp,2 + test byte cs:[si][4], f_st5 (* is arg1 in st5? *) + jz not_st5 + fld st(0),st(5) + fstp st(1),st(0) + jmp st5_done +not_st5: + fst st(5), st(0) +st5_done: + ftst st(0) + fstsw [bp][-2] + fwait + test byte [bp][-1], 1 + mov ax, cs:[si][2] + jz me_positive + mov ax, cs:[si][0] +me_positive: + call ax + fstp st(1),st(0) + or ax,ax + jz me_ok + test byte cs:[si][4], f_two + jnz has_two + fldz st(0) + fstp st(7),st(0) +has_two: + lea bx,[si][5] + call __report_math_error +me_ok: + mov sp,bp + pop dx + pop cx + pop bx + pop ax + pop bp + ret 0 + +segment _TEXT(CODE,28H) +err_domain: + fldz st(0) + mov ax, _DOMAIN + ret 0 + +segment _TEXT(CODE,28H) +err_underflow: + fldz st(0) + mov ax, _UNDERFLOW + ret 0 + +segment _TEXT(CODE,28H) +err_plus_infinity: + extrn _HUGE + fld qword st(0), [_HUGE] + mov ax, _OVERFLOW + ret 0 + +segment _TEXT(CODE,28H) +err_minus_infinity: + call err_plus_infinity + fchs st(0) + ret 0 + +segment _TEXT(CODE,28H) +one:dw 1 +check_abs_one: + fld st(0),st(0) + fabs st(0) + ficomp word st(0), cs:[one] + fstsw [bp][-2] + fwait + test byte [bp][-1], 40H + jz ab1_err + ret 0 +ab1_err: + add sp,2 + jmp err_domain + +segment _TEXT(CODE,28H) +ldexp_err_pos: + fld st(0),st(6) + ftst st(0) + fstsw [bp][-2] + fstp st(0), st(0) + test byte [bp][-1], 1 + jnz err_underflow + jmp err_plus_infinity +ldexp_err_neg: + fld st(0),st(6) + ftst st(0) + fstsw [bp][-2] + fstp st(0), st(0) + test byte [bp][-1], 1 + jnz err_underflow + jmp err_minus_infinity + +segment _TEXT(CODE,28H) +public _hypotl: +public _hypot: +hypotCommon: + fmul st(0), st(0) + fld st(0), st(6) + fmul st(0), st(0) + faddp st(1), st(0) + fsqrt st(0) + ret 0 + +segment _TEXT(CODE,28H) + +public _ceill: +public _ceil: + push bp + mov bp,sp + sub sp,2 + +ceilCommon: + fstcw [bp][-2] + fwait + and byte [bp][-1], ~4 (* round towards +inf *) + fldcw [bp][-2] + frndint st(0) + or byte [bp][-1], 4 (* restore to chop *) + fldcw [bp][-2] + fwait + mov sp,bp + pop bp + ret 0 + +segment _TEXT(CODE,28H) +public _floorl: +public _floor: + push bp + mov bp,sp + sub sp,2 +floorCommon: + fstcw [bp][-2] + fwait + and byte [bp][-1], ~8 (* round towards -inf *) + fldcw [bp][-2] + frndint st(0) + or byte [bp][-1], 8 (* restore to chop *) + fldcw [bp][-2] + fwait + mov sp,bp + pop bp + ret 0 + +segment _TEXT(CODE,28H) +public __round: + frndint st(0) + ret 0 + +segment _TEXT(CODE,28H) +public __bcd: + push bp (* new *) + mov bp, sp (* new *) + sub sp, 2 (* new *) + fstcw [bp][-2] (* new *) + (* ensure round to nearest (80387 compatibility problem) *) + fwait (* new *) + push [bp][-2] (* new *) + and word [bp][-2], ~0C00H (* new *) + fldcw [bp][-2] (* new *) + + fld st(0), st(0) + xchg ax,bp + fbstp tbyte [bp], st(0) + xchg ax,bp + + pop [bp][-2] (* new *) + fldcw [bp][-2] (* new *) + fwait (* new *) + mov sp, bp (* new *) + pop bp (* new *) + ret 0 + +segment _TEXT(CODE,28H) +(* compute 2^st(0) , result is represented as st(0) * 2^st(4) *) +four: dw 4 +pow2: + fld1 st(0) + fxch st(0), st(1) + fst st(5), st(0) + frndint st(0) + fsub st(0), st(1) + fxch st(0), st(5) + fsub st(0), st(5) (* we now know that st(0) is in range [0..2) *) + fidiv word st(0), cs:[four] (* now in range [0..0.5] *) + f2xm1 st(0) + faddp st(1), st(0) + fmul st(0), st(0) + fmul st(0), st(0) + ret 0 + +segment _TEXT(CODE,28H) +public _fmodl: +public _fmod: + push bp + mov bp,sp +fmodCommon: + sub sp,2 + fld st(0), st(6) + ftst st(0) + fstsw [bp][-2] + test byte [bp][-1],40H + jnz fmod_zero + fxch st(0), st(1) +fmod_more: + fprem st(0) + fstsw [bp][-2] + fwait + test byte [bp][-1], 4 + jnz fmod_more +fmod_zero: + fstp st(1),st(0) + mov sp,bp + pop bp + ret 0 + +segment _TEXT(CODE,28H) +public _frexpl : +public _frexp : + push bp + mov bp,sp + sub sp,2 + xchg bx,ax +frexpCommon: + ftst st(0) + fstsw [bp][-2] + fwait + test byte [bp][-1],40H + jnz frexp_zero + fxtract st(0) + fxch st(0), st(1) + fistp word [bx], st(0) + fwait + inc word [bx] + fidiv word st(0), cs:[two] +frexp_exit: + xchg bx,ax + mov sp,bp + pop bp + ret 0 +frexp_zero: + and word [bx], 0 + jmp frexp_exit + +segment _TEXT(CODE,28H) +public __clear87 : + push bx + push ax + mov bx, sp (* get current status word into ax *) + fstsw ss:[bx] + fclex + pop ax + pop bx (* clear status word *) + ret 0 + +segment _TEXT(CODE,28H) +public __fpreset : + ret 0 + +segment _TEXT(CODE,28H) +public __status87 : + push bx + push ax + mov bx, sp (* get current status word into ax *) + fstsw ss:[bx] + fwait + pop ax + pop bx + ret 0 + +segment _TEXT(CODE,28H) +public __control87 : +new = -2 +mask = -4 +locals = 4 + + push bp + mov bp, sp (* get current control word into ax *) + sub sp, locals + push bx + push cx + push dx + mov [bp][new], ax + mov [bp][mask], bx + push ax + mov bx, sp + fstcw ss:[bx] + fwait + pop ax (* ax has original value *) + + mov cx, [bp][mask] + jcxz con87Done (* mask is zero - return *) + mov dx, [bp][new] + and dx, cx (* ctrl = ((ctrl &~mask) | (new & mask)) *) + not cx + and ax, cx + or ax, dx + mov [bp][new], ax + fldcw [bp][new] +con87Done: + pop dx + pop cx + pop bx + mov sp, bp + pop bp + ret 0 + +segment _TEXT(CODE,28H) +Pi_By_4: dw 0C235H, 02168H, 0DAA2H, 0C90FH, 03FFEH +public _sin : +public _sinl : + push bp + mov bp, sp + sub sp, 2 + push cx + mov cl, 0 + jmp trig +public _cos: +public _cosl : + push bp + mov bp, sp + sub sp, 2 + push cx + mov cl, 2 + jmp trig +public _tan : +public _tanl : + push bp + mov bp, sp + sub sp, 2 + push cx + mov cl, 4 +trig: + push ax +trigCommon: + fxam st(0) (* '87 works while we enter routine*) + fstsw [bp][-2] + fwait + mov ah, [bp][-1] + fabs st(0) + fld tbyte st(0), cs:[Pi_By_4] + fxch st(0),st(1) + fprem st(0) + mov ch, ah + and ch, 2 + shr ch, 1 (* ch := sign *) + fstsw [bp][-2] + fwait + mov ax, [bp][-2] + mov al, ah + and al, 3 (* select the C3, C1, and C0 status bits*) + shl ah, 1 + shl ah, 1 + rcl al, 1 (* arrange them in the ls 3 bits of BX*) + add al, 0FCH + rcl al, 1 (* al now contains the octant number*) + cmp cl, 2 (* are we doing Cosine ?*) + jne trig_notCosine + add al, cl (* Cos (x) = Sin (x + 2 octants)*) + mov ch, 0 (* Cosine has even symmetry around 0*) +trig_notCosine: + and al, 7 + test al, 1 + jz trig_evens + fsubp st(1),st(0) (* overwrites pi/4 in st(1), pops.*) + jmp trig_ptan +trig_evens: + fstp st(1),st(0) +trig_ptan: + fptan st(0) + cmp cl, 4 + je trig_tangent + test al, 3 + jpe trig_sineOctant +trig_cosOctant: + fxch st(0), st(1) +trig_sineOctant: + fmul st(0), st(0) + fstp st(7), st(0) + fld st(0), st(0) + fmul st(0), st(0) + fadd st(0), st(7) + fsqrt st(0) + shr al, 1 + shr al, 1 + xor al, ch + jz trig_sineDiv + fchs st(0) +trig_sineDiv: + fdivp st(1), st(0) + jmp trig_end +trig_tangent: + mov ah, al + shr ah, 1 + and ah, 1 + xor ah, ch + jz trig_tanSigned + fchs st(0) +trig_tanSigned: + test al, 3 + jpe trig_ratio + fdivrp st(1),st(0) + jmp trig_end +trig_ratio: + fdivp st(1), st(0) +trig_end: + pop ax + pop cx + mov sp, bp + pop bp + ret 0 + +segment _TEXT(CODE,28H) +Pi_By_2: dw 0C235H, 02168H, 0DAA2H, 0C90FH, 03FFFH + +segment _TEXT(CODE,28H) +public _atan2l: +public _atan2: + push bp + mov bp,sp + sub sp,4 +atan2Common: + call atan20 + mov sp,bp + pop bp + ret 0 +atan20: + ftst st(0) + fstsw [bp][-2] + fwait + test byte [bp][-1],1 + je atan21 + fchs st(0) + call atan21 + fchs st(0) + ret 0 +atan21: + fld st(0), st(6) + ftst st(0) + fstsw [bp][-4] + fwait + test byte [bp][-3],1 + je atan22 + fchs st(0) + call atan22 + fldpi st(0) + fsubrp st(1),st(0) + ret 0 +atan22: + test byte [bp][-3],40H + jnz maybe_zero_zero +not_zero_zero: + fcom st(0), st(1) + fstsw [bp][-2] + fwait + test byte [bp][-1],1 + jz atan23 + fxch st(0), st(1) + fpatan st(1), st(0) + fld tbyte st(0),cs:[Pi_By_2] + fsubrp st(1),st(0) + ret 0 +atan23: + fpatan st(1),st(0) + ret 0 +maybe_zero_zero: + test byte [bp][-1],40H + jz not_zero_zero + fstp st(0), st(0) + push si + mov si, atan2_err_data + call __lib_error + pop si + ret 0 +atan2_err_data: dw err_domain, err_domain; db 0, "atan2", 0 + +segment _TEXT(CODE,28H) + +public _atanl: +public _atan: + push bp + mov bp,sp + sub sp,2 +atanCommon: + call atan0 + mov sp,bp + pop bp + ret 0 +atan0: + ftst st(0) + fstsw [bp][-2] + fwait + test byte [bp][-1],1 + je atan1 + fchs st(0) + call atan1 + fchs st(0) + ret 0 +atan1: + fld1 st(0) + fcom st(0), st(1) + fstsw [bp][-2] + fwait + test byte [bp][-1],1 + jnz atan2 + fpatan st(1), st(0) + ret 0 +atan2: + fxch st(0), st(1) + fpatan st(1),st(0) + fld tbyte st(0),cs:[Pi_By_2] + fsubrp st(1),st(0) + ret 0 + +segment _TEXT(CODE,28H) +public _logl : +public _log : + push bp + mov bp,sp + sub sp,2 +logCommon: + ftst st(0) + fstsw [bp][-2] + fwait + test byte [bp][-1], 41H + jnz log_error + fldln2 st(0) + fxch st(0),st(1) + fyl2x st(1),st(0) +log_exit: + mov sp,bp + pop bp + ret 0 +log_error: + push si + mov si, log_err_data + call __lib_error + pop si + jmp log_exit +log_err_data: dw err_domain, err_minus_infinity; db 0, "log", 0 + +segment _TEXT(CODE,28H) +public _log10l : +public _log10 : + push bp + mov bp,sp + sub sp,2 +log10Common: + ftst st(0) + fstsw [bp][-2] + fwait + test byte [bp][-1], 41H + jnz log10_error + fldlg2 st(0) + fxch st(0),st(1) + fyl2x st(1),st(0) +log10_exit: + mov sp,bp + pop bp + ret 0 +log10_error: + push si + mov si, log10_err_data + call __lib_error + pop si + jmp log10_exit +log10_err_data: dw err_domain, err_minus_infinity; db 0, "log10", 0 + +segment _TEXT(CODE,28H) +__math_magic_start: + +(* routines which use 8087 exception handling *) +(* to avoid explicit checks *) + +segment _TEXT(CODE,28H) +public _fabsl : +public _fabs: + mov byte ss:[InMathLib], 1 +fabsCommon: + fabs st(0) + mov byte ss:[InMathLib], 0DEH + ret 0 + +segment _TEXT(CODE,28H) +public _sqrtl : +public _sqrt : + mov byte ss:[InMathLib], 1 +sqrtCommon: +(* Return the square root of x, which must be greater than zero. *) + fsqrt st(0) (*invalid op possible*) + fwait + mov byte ss:[InMathLib], 0DEH +sqrt_exit: + ret 0 + dw magic, sqrt_exit, err_domain, err_domain; db 0, "sqrt", 0 + +segment _TEXT(CODE,28H) +public _expl : +public _exp : + mov byte ss:[InMathLib], 1 + push bp + mov bp,sp + sub sp,2 +expCommon: + fst st(5), st(0) (* save parameter for error processing *) + fldl2e st(0) + fmulp st(1), st(0) + fist word [bp][-2], st(0) (* to check that it is not too large *) + fwait + call pow2 + fld st(0), st(4) (* retrieve integral part *) + fxch st(1), st(0) + fscale st(0), st(1) + fstp st(1),st(0) +exp_exit: + mov sp,bp + pop bp + mov byte ss:[InMathLib], 0DEH + ret 0 + dw magic, exp_exit, err_underflow, err_plus_infinity; db f_st5, "exp", 0 + +segment _TEXT(CODE,28H) +public __pow_int: + push cx + push bx + mov bx,ax + call powi0 + pop bx + pop cx + ret 0 + +powi0: + test ax,ax + jg powi3 + jne powi2 + fld1 st(0) + fstp st(1),st(0) + ret 0 + +powi2: + neg ax + call powi3 + fld1 st(0) + fdivrp st(1),st(0) + ret 0 + +powi3: + mov cx,17 + fld st(0), st(0) +powi4: + dec cx + add ax,ax + jnc powi4 + jmp powi7 +powi6: + fmul st(0),st(0) + add ax,ax + jnc powi7 + fmul st(0),st(1) +powi7: + loop powi6 + fstp st(1),st(0) +powi7_exit: + ret 0 + dw magic, powi7_exit, powi_err_neg, powi_err_pos; db f_st5, "pow", 0 +powi_err_neg: + test bx,bx + jl err_underflow + test bx,1 + jz err_plus_infinity + jmp err_minus_infinity +powi_err_pos: + test bx,bx + jl err_underflow + jmp err_plus_infinity + +segment _TEXT(CODE,28H) +public _powl : +public _pow : + mov byte ss:[InMathLib], 1 + push bp + mov bp,sp + sub sp,4 +powCommon: + ftst st(0) + fstsw [bp][-2] + fwait + test byte [bp][-1], 41H + jnz pow_integral + fst st(5), st(0) (* save parameter for error processing *) + fld1 st(0) + fxch st(0),st(1) + fyl2x st(1),st(0) + fmul st(0), st(6) + fist word [bp][-2], st(0) (* to check that it is not too large *) + fwait +pow1: + call pow2 + fld st(0), st(4) (* retrieve integral part *) + fxch st(1), st(0) + fscale st(0), st(1) + fstp st(1),st(0) +pow_exit: + mov sp,bp + pop bp + mov byte ss:[InMathLib], 0DEH + ret 0 + dw magic, pow_exit, err_pow_neg, err_pow_pos; db f_st5+f_two, "pow", 0 + +pow_integral: + test byte [bp][-1], 40H + jnz pow_dom_err + fld st(0), st(6) + fist word [bp][-4], st(0) + ficomp word st(0), [bp][-4] + fstsw [bp][-2] + fwait + test byte [bp][-1], 40H + jz pow_dom_err + mov ax, [bp][-4] + call __pow_int + jmp pow_exit + dw magic, pow_exit, err_domain, err_domain; db f_st5+f_two, "pow", 0 + +err_pow_pos: + fld st(0), st(6) + ftst st(0) + fstsw [bp][-2] + fstp st(0),st(0) + test byte [bp][-1], 1 + jz err_plus_infinity + jmp err_underflow + +err_pow_neg: + fld st(0), st(6) + fistp word [bp][-2], st(0) + mov ax, [bp][-2] + call __pow_int +pown_exit: + ret 0 + dw magic, pown_exit, err_domain, err_domain; db f_st5+f_two, "pow", 0 + +pow_dom_err: + push si + mov si, pow_dom_err_data + call __lib_error + pop si + jmp pow_exit +pow_dom_err_data: dw err_domain, err_domain; db 0, "pow", 0 + + +segment _TEXT(CODE,28H) +public _tanhl : +public _tanh : + mov byte ss:[InMathLib], 1 + push bp + mov bp,sp + sub sp,2 +tanhCommon: + fst st(5), st(0) (* save for error processing *) + fldl2e st(0) + fmulp st(1), st(0) + fist word [bp][-2], st(0) (* to check that it is not too large *) + fwait + call pow2 + fld st(0), st(4) (* retrieve integral part *) + fxch st(1), st(0) + fscale st(0), st(1) + fstp st(1), st(0) + fld1 st(0) + fdiv st(0), st(1) (* Exp (-x) *) + fst st(7), st(0) + fadd st(0), st(1) + fxch st(0), st(1) + fsub st(0), st(7) + fdivrp st(1), st(0) +tanh_exit: + mov sp,bp + pop bp + mov byte ss:[InMathLib], 0DEH + ret 0 + dw magic, tanh_exit, tanh_one, tanh_minus_one; db f_st5, "tanh", 0 + +tanh_one: + sub ax,ax + fld1 st(0) + ret 0 + +tanh_minus_one: + call tanh_one + fchs st(0) + ret 0 + +segment _TEXT(CODE,28H) +public _sinhl : +public _sinh : + mov byte ss:[InMathLib], 1 + push bp + mov bp,sp + sub sp,2 +sinhCommon: + fst st(5), st(0) (* save for error processing *) + fldl2e st(0) + fmulp st(1), st(0) + fist word [bp][-2], st(0) (* to check that it is not too large *) + fwait + call pow2 + fld st(0), st(4) (* retrieve integral part *) + fxch st(1), st(0) + fscale st(0), st(1) + fstp st(1), st(0) + fld1 st(0) + fchs st(0) + fdiv st(0), st(1) (* - Exp (-x) *) + faddp st(1), st(0) + fidiv word st(0), cs:[two] +sinh_exit: + mov sp,bp + pop bp + mov byte ss:[InMathLib], 0DEH + ret 0 + dw magic, sinh_exit, err_minus_infinity, err_plus_infinity; db f_st5, "sinh", 0 + +segment _TEXT(CODE,28H) +public _coshl : +public _cosh : + mov byte ss:[InMathLib], 1 + push bp + mov bp,sp + sub sp,2 +coshCommon: + fst st(5), st(0) (* save for error processing *) + fabs st(0) + fldl2e st(0) + fmulp st(1), st(0) + fist word [bp][-2], st(0) (* to check that it is not too large *) + fwait + call pow2 + fld st(0), st(4) (* retrieve integral part *) + fxch st(1), st(0) + fscale st(0), st(1) + fstp st(1), st(0) + fld1 st(0) + fdiv st(0), st(1) (* Exp (-x) *) + faddp st(1), st(0) + fidiv word st(0), cs:[two] +cosh_exit: + mov sp,bp + pop bp + mov byte ss:[InMathLib], 0DEH + ret 0 + dw magic, cosh_exit, err_plus_infinity, err_plus_infinity; db f_st5, "cosh", 0 + +segment _TEXT(CODE,28H) +public _asinl : +public _asin: + mov byte ss:[InMathLib], 1 + push bp + mov bp,sp + sub sp,2 +asinCommon: + fst st(5), st(0) + fmul st(0), st(0) + fld1 st(0) + fsubrp st(1),st(0) + fsqrt st(0) + fwait + fdivr st(0),st(5) + fwait + call atan0 +asin_exit: + mov sp,bp + pop bp + mov byte ss:[InMathLib], 0DEH + ret 0 + dw magic, asin_exit, err_asin_neg, err_asin_pos; db f_st5, "asin", 0 + +err_asin_pos: + call check_abs_one + fld1 st(0) + fstp st(1),st(0) + fchs st(0) + fldpi st(0) + fscale st(0),st(1) + sub ax,ax + ret 0 + +err_asin_neg: + call err_asin_pos + fchs st(0) + ret 0 + +segment _TEXT(CODE,28H) +public _acosl : +public _acos : + mov byte ss:[InMathLib], 1 + push bp + mov bp,sp + sub sp,2 +acosCommon: + fst st(5), st(0) + fmul st(0), st(0) + fld1 st(0) + fsubrp st(1),st(0) + fsqrt st(0) + fdivr st(0),st(5) + fwait + call atan0 + fld tbyte st(0), cs:[Pi_By_2] + fsubrp st(1), st(0) +acos_exit: + mov sp,bp + pop bp + mov byte ss:[InMathLib], 0DEH + ret 0 + dw magic, acos_exit, err_acos_neg, err_acos_pos; db f_st5, "acos", 0 + +err_acos_pos: + call check_abs_one + fldz st(0) + sub ax,ax + ret 0 + +err_acos_neg: + call check_abs_one + fldpi st(0) + sub ax,ax + ret 0 + + +segment _TEXT(CODE,28H) +public _ldexpl : +public _ldexp: + mov byte ss:[InMathLib], 1 + push bp + mov bp,sp + push ax + fst st(5), st(0) + fild word st(0), [bp][-2] +ldexpCommon: + fst st(7), st(0) + fxch st(0),st(1) + fscale st(0), st(1) + fstp st(1), st(0) +ldexp_exit: + mov sp,bp + pop bp + mov byte ss:[InMathLib], 0DEH + ret 0 + dw magic, ldexp_exit, ldexp_err_neg, ldexp_err_pos; db f_st5+f_two, "ldexp", 0 + +segment _TEXT(CODE,28H) +ten:dw 10 + +public __acvt : + +(* converts ascii string of digits into packed BCD then into double *) + +flag = -2 +mbuf = -6 +exp = -8 +len = -10 +old_cw = -12 +stat_w = -14 +man = -24 +locals = 10 + + +_PNT = 4 +_MNEG = 1 +_STD = 8 +ERANGE = 34 + + mov byte ss:[InMathLib], 1 + push bp + mov bp, sp + sub sp, locals + mov [bp][flag], ax + mov [bp][mbuf], bx + mov [bp][exp], cx + mov [bp][len], dx + sub sp, 4 + mov cx, 5 + sub ax, ax +clearLoop: (* clear BCD local *) + push ax + loop clearLoop + push si + + mov cx, [bp][len] + mov si, [bp][mbuf] + lea bx, [bp][man] + shr cx, 1 + jnc acvtEven + sub ah, ah + add bx, cx + inc cx + jmp acvtOdd +acvtEven: + jcxz acvtZero + dec cx + add bx, cx + inc cx +acvtPack: (* pack number *) + lodsb + push cx + mov cl, 4 + shl al, cl + pop cx + mov ah, al +acvtOdd: + lodsb + and al, 0FH + or al, ah + mov ss:[bx], al + dec bx + loop acvtPack +acvtZero: + fild word st(0), cs:[ten] + fstp st(1), st(0) + mov ax, [bp][exp] + test ax,ax + jge positive_exp + neg ax + call __pow_int + fbld tbyte st(0), [bp][man] (* load mantissa *) + fxch st(1), st(0) + fdivp st(1), st(0) + fwait + jmp acvt_test_sign + dw magic, acvt_err_exit, err_underflow, err_underflow; db 0, "acvt", 0 +positive_exp: + call __pow_int + fbld tbyte st(0), [bp][man] (* load mantissa *) + fxch st(1), st(0) (* necessary for overflow handling *) + fmulp st(1), st(0) +acvt_test_sign: + test word [bp][flag], _MNEG + je acvt_exit + fchs st(0) (* change sign if negative *) +acvt_exit: + pop si + mov sp, bp + pop bp + mov byte ss:[InMathLib], 0DEH + ret 0 + dw magic, acvt_err_exit, err_minus_infinity, err_plus_infinity; db 0, "acvt", 0 +acvt_err_exit: + test word [bp][flag], _STD (* if called from strtod *) + jnz acvt_exit (* set errno on over/underflow *) + (* should restore errno here *) + jmp acvt_exit + +extrn __exc_addr + +segment _TEXT(CODE,28H) + +public __bcd_to_int : (* si = bcd, di = int mantissa *) + + ret 0 + +segment _TEXT(CODE,28H) +segment _DATA(DATA,28H) + +select _TEXT + +__math_magic_end: +public __math_excep: + (* called from floating point exception handler *) + (* 8087 status word on stack *) + + push bp + mov bp,sp + sub sp,2 + jmp pop_8087 +pop_8087_loop: + fstp st(0), st(0) +pop_8087: + fstsw [bp][-2] + fwait + and word [bp][-2], 3800H + cmp word [bp][-2], 0800H + jnz pop_8087_loop + cmp byte [InMathLib], 1 + jne user_error + mov byte [InMathLib], 0DEH + + (* search for handler *) + push si + push ax + push bx + mov si,[bp][4] +search_loop: + inc si + cmp word cs:[si], magic + jne search_loop + add si, 4 + mov ax, cs:[si][-2] (* resume address *) + mov [bp][4],ax (* adjust local return address *) + call __lib_error + pop bx + pop ax + pop si + mov sp,bp + pop bp + add sp, 2 + ret 0 (* discard ret to __sigFp *) + +user_error: + push ax + mov ax, [bp][4] + mov [__exc_addr], ax + pop ax + mov sp, bp + pop bp + ret 0 + +end + diff --git a/code/SIBOSDK/src/coremem.a b/code/SIBOSDK/src/coremem.a new file mode 100644 index 0000000..da3c9a6 --- /dev/null +++ b/code/SIBOSDK/src/coremem.a @@ -0,0 +1,202 @@ +(************************************************************************) +(* *) +(* Release 3.00 *) +(* *) +(* CoreMem - Common memory management module. *) +(* *) +(* Copyright (C) 1989, 1990 Jensen and Partners. All Rights Reserved *) +(* Written by Simon Knight. *) +(* *) +(* Copyright (C) 1991 Psion PLC. All Rights Reserved *) +(* Modified by NSM. *) +(* *) +(************************************************************************) + +include "corelib.inc" +include "epocdefs.inc" + +module CoreMem + +(***************************************************************************) +section +segment _TEXT(CODE,28H) +segment _DATA(DATA,28H) + +extrn _errno + +select _TEXT + + +public __ncalloc : +public _calloc : + + push cx + push dx + mul bx + or dx, dx + je __nmallocEntry + +__nmallocError : (* arrive here to return NULL *) + mov word [_errno], ENOMEM + sub ax, ax + pop dx + pop cx + ret 0 + +public __nmalloc : +public _malloc : + + push cx + push dx + or dl, 1 + +__nmallocEntry: + + or ax, ax + je __nmallocError (* return NULL if size = 0 *) + mov cx, ax + mov ah, NmHeapAllocateCell + int HeapManager + jc __nmallocError + test dl, dl + jne __noZeroFill (* was malloc, so no zero fill *) + push di + mov di, ax + mov dx, ax + sub ax, ax + cld + shr cx, 1 + rep; stosw + pop di + mov ax, dx +__noZeroFill: + pop dx + pop cx + ret 0 + + +(***************************************************************************) +section +segment _TEXT(CODE,28H) + +select _TEXT + +public _coreleft : +public __memavl : +public _nearcoreleft : + + push bx + mov ah, NmHeapFreeMemory + int HeapManager + pop bx + ret 0 + +(***************************************************************************) +section + +segment _TEXT(CODE,28H) + +select _TEXT + +public __nfree : +public _free : + + push ax + push bx + mov bx, ax + mov ah, NmHeapFreeCell + int HeapManager + pop bx + pop ax + ret 0 + +(***************************************************************************) +section +segment _TEXT(CODE,28H) + +select _TEXT + +public __msize : +public __nmsize : + + push bx + mov bx, ax + mov ah, NmHeapCellSize + int HeapManager + pop bx + ret 0 + +(***************************************************************************) +section +segment _TEXT(CODE,28H) + +extrn __nheapchk + +select _TEXT + +public __heapchk : + + jmp near __nheapchk + +(***************************************************************************) +section +segment _TEXT(CODE,28H) + +extrn __nheapset + +select _TEXT + +public __heapset : + + jmp near __nheapset + +(***************************************************************************) +section +segment _TEXT(CODE,28H) + +extrn __nheapwalk + +select _TEXT + +public __heapwalk : + + jmp near __nheapwalk + +(***************************************************************************) +section +segment _TEXT(CODE,28H) + +extrn _errno +extrn __nfree + +select _TEXT + +public __nrealloc : +public _realloc : + + test bx, bx + jne _notFree + push bx + mov bx, ax + call __nfree + pop bx + sub ax, ax + ret 0 + +_notFree: + push bx + push cx + mov cx, bx + mov bx, ax + mov ah, NmHeapReAllocateCell + int HeapManager + jnc reAllocExit + mov word [_errno], ENOMEM + sub ax, ax + +reAllocExit: + pop cx + pop bx + ret 0 + +end diff --git a/code/SIBOSDK/src/corertl.a b/code/SIBOSDK/src/corertl.a new file mode 100644 index 0000000..06c751d --- /dev/null +++ b/code/SIBOSDK/src/corertl.a @@ -0,0 +1,1149 @@ +(************************************************************************) +(* *) +(* Release 3.00 *) +(* *) +(* CoreRTL - Common run-time support module. *) +(* *) +(* Copyright (C) 1989, 1990 Jensen and Partners. All Rights Reserved *) +(* Written by Simon Knight. *) +(* *) +(* Copyright (C) 1991 Psion PLC. All Rights Reserved *) +(* Modified by NSM. *) +(* *) +(************************************************************************) + +include "corelib.inc" +include "epocdefs.inc" + +module CoreRTL + +(****************************************************************************) +section +segment _TEXT(CODE,28H); + +public N$StdRet : + + pop ax + pop bx + pop cx + pop dx + pop si + pop di + mov sp, bp + pop bp + ret 0 + +section +segment _TEXT(CODE,28H); + + +public N$UnsMol : High1 = frame+6; Low1 = frame+4; High2 = frame+2; Low2 = frame +public N$SgnMol : +(* Unsigned/signed multiplication *) +(* On overflow: modulus 2^32 wrap-around *) + push bp + mov bp,sp + + mov ax,[bp][High1] + and ax,ax + jnz UnsMol2 + add ax,[bp][High2] + jnz UnsMol1 + mov ax,[bp][Low1] + mul word [bp][Low2] + + pop bp + ret near 8 + +UnsMol1: + mul word [bp][Low1] + mov dx,[bp][Low1] + mov bp,[bp][Low2] + xchg bp,ax + mul dx + add dx,bp + pop bp + ret near 8 + +UnsMol2: + mov dx,[bp][High2] + and dx,dx + jnz UnsMol3 + mul word [bp][Low2] + mov dx,[bp][Low1] + mov bp,[bp][Low2] + xchg bp,ax + mul dx + add dx,bp + pop bp + ret near 8 + +UnsMol3: + push cx + mul word [bp][Low2] + mov cx,ax + mov ax,[bp][High2] + mul word [bp][Low1] + add cx,ax + mov ax,[bp][Low1] + mul word [bp][Low2] + add dx,cx + pop cx + pop bp + ret near 8 + +section +segment _TEXT(CODE,28H); + +extrn N$UnsMul + +public N$SgnDiv : High1 = frame+6; Low1 = frame+4; High2 = frame+2; Low2 = frame +(*Signed division *) +(*On overflow: result MAXINT, OF set *) + push bp + mov bp,sp + push cx + push si + + xor si,si +(* DIV / 0 Test *) + mov dx,[bp][High2] + or dx,[bp][Low2] + jnz DivOK + extrn N$CnsDiv + add sp, 6 + jmp N$CnsDiv +DivOK: + mov dx,[bp][High1] + and dx,dx + jge SgnDiv5 + not si + neg dx + neg word [bp][Low1] + sbb dx,0 + mov [bp][High1],dx +SgnDiv5: + mov dx,[bp][High2] + and dx,dx + jg SgnDiv1 + jz SgnDiv6 + not si + neg dx + neg word [bp][Low2] + sbb dx,0 + mov [bp][High2],dx + jnz SgnDiv1 + +SgnDiv6: + mov cx,[bp][Low2] + jcxz SgnDiv0 + mov dx,[bp][High1] + cmp dx,cx + jae SgnDivA + mov ax,[bp][Low1] + div cx + xor dx,dx + +SgnDiv9: + add ax,si + adc dx,si + xor ax,si + xor dx,si + +SgnDiv7: + pop si + pop cx + pop bp + ret near 8 + +SgnDivA: + mov ax,dx + xor dx,dx + div cx + mov cx,ax + mov ax,[bp][Low1] + div word [bp][Low2] + mov dx,cx + jmp SgnDiv9 + +SgnDiv1: + push bx + mov cx,dx + mov bx,[bp][Low2] + mov dx,[bp][High1] + mov ax,[bp][Low1] + push cx + push bx +SgnDiv2: + shr dx,1 + rcr ax,1 + shr cx,1 + rcr bx,1 + and cx,cx + jnz SgnDiv2 + div bx + mov bx,ax + push cx + push ax + call near N$UnsMul + jo SgnDiv3 + cmp dx,[bp][High1] + ja SgnDiv3 + jb SgnDiv4 + cmp ax,[bp][Low1] + jbe SgnDiv4 +SgnDiv3: + dec bx +SgnDiv4: + mov ax,bx + xor dx,dx + pop bx + jmp SgnDiv9 + +SgnDiv0: + mov al,100 + add al,al + mov ax,0FFFFH + mov dx,07FFFH + jmp SgnDiv7 + +section +segment _TEXT(CODE,28H); + +extrn N$UnsMul + +public N$UnsDiv : High1 = frame+6; Low1 = frame+4; High2 = frame+2; Low2 = frame +(*Unsigned division *) +(*On overflow: result MAXCARD, OF set *) + push bp + mov bp,sp + push cx + +(* DIV / 0 Test *) + mov cx,[bp][High2] + or cx,[bp][Low2] + jnz DivOK + extrn N$CnsDiv + add sp, 4 + jmp N$CnsDiv +DivOK: + mov cx,[bp][High2] + and cx,cx + jnz UnsDiv1 + add cx,[bp][Low2] + jz UnsDiv0 + + mov dx,[bp][High1] + cmp dx,cx + jae UnsDiv7 (*!!!!New special case *) + mov ax,[bp][Low1] + div cx + xor dx,dx + +UnsDiv8: + and ax,ax +UnsDiv9: + pop cx + pop bp + ret near 8 + +UnsDiv7: + mov ax,dx + xor dx,dx + div cx + mov cx,ax + mov ax,[bp][Low1] + div word [bp][Low2] + mov dx,cx + jmp UnsDiv8 + +UnsDiv1: + push bx + mov dx,[bp][High1] + mov ax,[bp][Low1] + mov bx,[bp][Low2] + push cx + push bx +UnsDiv2: + shr dx,1 + rcr ax,1 + shr cx,1 + rcr bx,1 + and cx,cx + jnz UnsDiv2 + div bx + mov bx,ax + push cx + push ax + call near N$UnsMul + jo UnsDiv3 + cmp dx,[bp][High1] + jb UnsDiv4 + ja UnsDiv3 + cmp ax,[bp][Low1] + jbe UnsDiv4 +UnsDiv3: + dec bx +UnsDiv4: + mov ax,bx + xor dx,dx + pop bx + jmp UnsDiv8 + +UnsDiv0: + mov al,100 + add al,al + mov ax,0FFFFH + mov dx,ax + jmp UnsDiv9 + + +section +segment _TEXT(CODE,28H); + +extrn N$UnsMul + +public N$SgnRem : High1 = frame+6; Low1 = frame+4; High2 = frame+2; Low2 = frame +(*Signed remainder *) +(*On overflow: result 0, OF set *) + push bp + mov bp,sp + push cx + push si + +(* DIV / 0 Test *) + mov dx,[bp][High2] + or dx,[bp][Low2] + jnz DivOK + extrn N$CnsDiv + add sp, 6 + jmp N$CnsDiv +DivOK: + xor si,si + mov dx,[bp][High1] + and dx,dx + jge SgnRem5 + not si + neg dx + neg word [bp][Low1] + sbb dx,0 + mov [bp][High1],dx +SgnRem5: + mov dx,[bp][High2] + and dx,dx + jg SgnRem1 + jz SgnRem6 + neg dx + neg word [bp][Low2] + sbb dx,0 + mov [bp][High2],dx + jnz SgnRem1 + +SgnRem6: + mov cx,[bp][Low2] + jcxz SgnRem0 + mov ax,[bp][High1] + div cx + mov ax,[bp][Low1] + div cx + mov ax,dx + xor dx,dx + +SgnRem9: + add ax,si + adc dx,si + xor ax,si + xor dx,si + +SgnRem7: + pop si + pop cx + pop bp + ret near 8 + +SgnRem1: + push bx + mov cx,dx + mov bx,[bp][Low2] + mov dx,[bp][High1] + mov ax,[bp][Low1] + push cx + push bx +SgnRem2: + shr dx,1 + rcr ax,1 + shr cx,1 + rcr bx,1 + and cx,cx + jnz SgnRem2 + div bx + push cx + push ax + call near N$UnsMul + cmp dx,[bp][High1] + ja SgnRem3 + jb SgnRem4 + cmp ax,[bp][Low1] + jbe SgnRem4 +SgnRem3: + sub ax,[bp][Low2] + sbb dx,[bp][High2] +SgnRem4: + sub ax,[bp][Low1] + sbb dx,[bp][High1] + neg dx + neg ax + sbb dx,cx + pop bx + jmp SgnRem9 + +SgnRem0: + sub dx,dx + mov al,100 + add al,al + mov ax,dx + jmp SgnRem7 + +section +segment _TEXT(CODE,28H); + +extrn N$UnsMul + +public N$SgnMod : High1 = frame+6; Low1 = frame+4; High2 = frame+2; Low2 = frame +(*Signed modulus *) +(*On overflow: result 0, OF set *) + push bp + mov bp,sp + push cx + push bx + +(* DIV / 0 Test *) + mov dx,[bp][High2] + or dx,[bp][Low2] + jnz DivOK + extrn N$CnsDiv + add sp, 6 + jmp N$CnsDiv +DivOK: + mov dx,[bp][High1] + mov bh, dh + and dx,dx + jge SgnMod5 + neg dx + neg word [bp][Low1] + sbb dx,0 + mov [bp][High1],dx +SgnMod5: + mov dx,[bp][High2] + mov bl,dh + and dx,dx + jg SgnMod1 + jz SgnMod6 + neg dx + neg word [bp][Low2] + sbb dx,0 + mov [bp][High2],dx + jnz SgnMod1 + +SgnMod6: + mov cx,[bp][Low2] + jcxz SgnMod0 + mov ax,[bp][High1] + div cx + mov ax,[bp][Low1] + div cx + mov ax,dx + xor dx,dx + +SgnMod9: + mov cx,ax + or cx,dx + jz SgnMod7 + xor bh,bl + jge SgnMod10 + sub ax,[bp][Low2] + sbb dx,[bp][High2] + not bl +SgnMod10: + shl bl,1 + jnc SgnMod7 + neg dx + neg ax + sbb dx,0 +SgnMod7: + pop bx + pop cx + pop bp + ret near 8 + +SgnMod1: + push si + mov cx,dx + mov si,[bp][Low2] + mov dx,[bp][High1] + mov ax,[bp][Low1] + push cx + push si +SgnMod2: + shr dx,1 + rcr ax,1 + shr cx,1 + rcr si,1 + and cx,cx + jnz SgnMod2 + div si + push cx + push ax + call near N$UnsMul + cmp dx,[bp][High1] + ja SgnMod3 + jb SgnMod4 + cmp ax,[bp][Low1] + jbe SgnMod4 +SgnMod3: + sub ax,[bp][Low2] + sbb dx,[bp][High2] +SgnMod4: + sub ax,[bp][Low1] + sbb dx,[bp][High1] + neg dx + neg ax + sbb dx,cx + pop si + jmp SgnMod9 + +SgnMod0: (* overflow *) + sub dx,dx + mov al,100 + add al,al + mov ax,dx + jmp SgnMod7 + +section +segment _TEXT(CODE,28H); + +extrn N$UnsMul + +public N$UnsRem : High1 = frame+6; Low1 = frame+4; High2 = frame+2; Low2 = frame +(*Unsigned remainder/modulus *) +(*On overflow: result 0, OF set *) + push bp + mov bp,sp + push cx + +(* DIV / 0 Test *) + mov cx,[bp][High2] + or cx,[bp][Low2] + jnz DivOK + extrn N$CnsDiv + add sp, 4 + jmp N$CnsDiv +DivOK: + mov cx,[bp][High2] + and cx,cx + jnz UnsRem1 + add cx,[bp][Low2] + jz UnsRem0 + mov ax,[bp][High1] + xor dx,dx + div cx + mov ax,[bp][Low1] + div cx + mov ax,dx + xor dx,dx + +UnsRem9: + pop cx + pop bp + ret near 8 + +UnsRem1: + push bx + mov dx,[bp][High1] + mov ax,[bp][Low1] + mov bx,[bp][Low2] + push cx + push bx +UnsRem2: + shr dx,1 + rcr ax,1 + shr cx,1 + rcr bx,1 + and cx,cx + jnz UnsRem2 + div bx + sub ax,1 + adc ax,0 + push cx + push ax + call near N$UnsMul + add ax,[bp][Low2] + adc dx,[bp][High2] + jc UnsRem3 + cmp dx,[bp][High1] + jb UnsRem4 + ja UnsRem3 + cmp ax,[bp][Low1] + jbe UnsRem4 +UnsRem3: + sub ax,[bp][Low2] + sbb dx,[bp][High2] +UnsRem4: + sub ax,[bp][Low1] + sbb dx,[bp][High1] + neg dx + neg ax + sbb dx,cx + and ax,ax + pop bx + jmp UnsRem9 + +UnsRem0: + xor dx,dx + mov al,100 + add al,al + mov ax,dx + jmp UnsRem9 + +section +segment _TEXT(CODE,28H); + +public N$UnsMul : High1 = frame+6; Low1 = frame+4; High2 = frame+2; Low2 = frame +(*Unsigned multiplication *) +(*On overflow: result MAXCARD, OF set *) + push bp + mov bp,sp + + mov ax,[bp][High1] + and ax,ax + jnz UnsMul1 + add ax,[bp][High2] + jnz UnsMul2 + mov ax,[bp][Low1] + mul word [bp][Low2] + +UnsMul8: + and ax,ax +UnsMul9: + pop bp + ret near 8 + +UnsMul1: + cmp word [bp][High2],0 + jnz UnsMul0 + mul word [bp][Low2] + jmp UnsMul3 +UnsMul2: + mul word [bp][Low1] +UnsMul3: + jc UnsMul0 + mov dx,[bp][Low1] + mov bp,[bp][Low2] + xchg ax,bp + mul dx + add dx,bp + jnc UnsMul8 + +UnsMul0: + mov al,100 + add al,al + stc + mov ax,0FFFFH + mov dx,ax + jmp UnsMul9 + +section +segment _TEXT(CODE,28H); + +public N$SgnMul : High1 = frame+6; Low1 = frame+4; High2 = frame+2; Low2 = frame +(*Signed multiplication *) +(*On overflow: result MAXINT, OF set *) + push bp + mov bp,sp + push si + + xor si,si + mov dx,[bp][High1] + and dx,dx + jge SgnMul5 + not si + neg dx + neg word [bp][Low1] + sbb dx,0 + mov [bp][High1],dx +SgnMul5: + mov dx,[bp][High2] + and dx,dx + jg SgnMul6 + jz SgnMul1 + not si + neg dx + neg word [bp][Low2] + sbb dx,0 + jz SgnMul1 + +SgnMul6: + cmp word [bp][High1],0 + jnz SgnMul0 + mov ax,dx + mul word [bp][Low1] + jmp SgnMul2 +SgnMul1: + mov ax,[bp][High1] + and ax,ax + jz SgnMul2 + mul word [bp][Low2] +SgnMul2: + jc SgnMul0 + mov dx,[bp][Low1] + mov bp,[bp][Low2] + xchg ax,bp + mul dx + add dx,bp + jc SgnMul0 + js SgnMul0 + + add ax,si + adc dx,si + xor ax,si + xor dx,si + +SgnMul7: + pop si + pop bp + ret near 8 + +SgnMul0: + mov al,100 + add al,al + mov ax,0FFFFH + mov dx,07FFFH + jmp SgnMul7 + +section +segment _TEXT(CODE,28H); + +public N$LngShl : + xor ch,ch + jcxz $lshl1 +$lshl2: + shl ax,1 + rcl dx,1 + loop $lshl2 +$lshl1: + ret near 0 + +section +segment _TEXT(CODE,28H); + +public N$LngShr : + xor ch,ch + jcxz $lshr1 +$lshr2: + sar dx,1 + rcr ax,1 + loop $lshr2 +$lshr1: + ret near 0 + +section +segment _TEXT(CODE,28H); + +public N$ULngShr : + xor ch,ch + jcxz $ulshr1 +$ulshr2: shr dx,1 + rcr ax,1 + loop $ulshr2 +$ulshr1: + ret near 0 + +section +segment _TEXT(CODE,28H); + +public N$MovByt : SourceSeg =frame+8; SourceOff = frame+6; DestSeg = frame+4; DestOff = frame+2; Count = frame + push bp + mov bp,sp + push cx; push si; push di + mov cx, [bp][Count] + mov di, [bp][DestOff] + mov si, [bp][SourceOff] + rep; movsb; + pop di; pop si; pop cx + pop bp + ret near 10 + +section +segment _TEXT(CODE,28H); + +public N$PushByt : SourceSeg = frame+4; SourceOff = frame+2; Count = frame + push bp + mov bp,sp + sub sp, [bp][Count] + push [bp][2] (* return ip *) + push cx; push si; push di + mov si, [bp][SourceOff] + mov cx, [bp][Count] + mov bp, [bp] (* restore bp *) + mov di, sp + add di, frame+frame+14 + rep; movsb + pop di; pop si; pop cx + ret near frame+6 + +section +segment _TEXT(CODE,28H); + +public N$PopByt : Data = frame+6; DestSeg = frame+4; DestOff = frame+2; Count = frame + push bp + mov bp,sp + push cx; push si; push di + mov cx, [bp][Count] + mov di, [bp][DestOff] + lea si, [bp][Data] + rep; movsb + lea bp, [si][-frame] + pop di; pop si; pop cx + pop [bp] + pop [bp][2] + mov sp, bp + pop bp + ret near 0 + +section +segment _TEXT(CODE,28H); + +public N$SetOr : Data = frame+2; Count = frame + push bp + mov bp, sp + push ax; push bx; push cx; push si + mov cx, [bp][Count] + lea bp, [bp][Data] + mov si, cx +$loop: + mov al, [bp] + or [bp][si], al + inc bp + loop $loop + sub bp, frame + pop si; pop cx; pop bx; pop ax + pop [bp] + pop [bp][2] + mov sp, bp + pop bp + ret near 0 + +section +segment _TEXT(CODE,28H); + +public N$SetDif : Data = frame+2; Count = frame + push bp + mov bp, sp + push ax; push bx; push cx; push si + mov cx, [bp][Count] + lea bp, [bp][Data] + mov si, cx +$loop: + mov al, [bp] + not al + and [bp][si], al + inc bp + loop $loop + sub bp, frame + pop si; pop cx; pop bx; pop ax + pop [bp] + pop [bp][2] + mov sp, bp + pop bp + ret near 0 + +section +segment _TEXT(CODE,28H); + +public N$SetXor : Data = frame+2; Count = frame + push bp + mov bp, sp + push ax; push bx; push cx; push si + mov cx, [bp][Count] + lea bp, [bp][Data] + mov si, cx +$loop: + mov al, [bp] + xor [bp][si], al + inc bp + loop $loop + sub bp, frame + pop si; pop cx; pop bx; pop ax + pop [bp] + pop [bp][2] + mov sp, bp + pop bp + ret near 0 + +section +segment _TEXT(CODE,28H); + +public N$SetAnd : Data = frame+2; Count = frame + push bp + mov bp, sp + push ax; push bx; push cx; push si + mov cx, [bp][Count] + lea bp, [bp][Data] + mov si, cx +$loop: + mov al, [bp] + and [bp][si], al + inc bp + loop $loop + sub bp, frame + pop si; pop cx; pop bx; pop ax + pop [bp] + pop [bp][2] + mov sp, bp + pop bp + ret near 0 + +section +segment _TEXT(CODE,28H); + +public N$DupByt : Seg = frame+6; Off = frame+4; Data = frame+2; Count = frame + push bp + mov bp,sp + push di; push cx; push ax + mov al, [bp][Data] + mov cx, [bp][Count] + mov di, [bp][Off] + mov ah, al + shr cx,1 + rep; stosw + jnc $DupBytExit + stosb +$DupBytExit: + pop ax; pop cx; pop di + pop bp + ret near 8 + +section +segment _TEXT(CODE,28H); + +public N$EquByte : Data = frame+2; Count = frame +(* result in flags and ax *) + push bp + mov bp, sp + push cx; push si; push di + mov cx, [bp][Count] + lea si, [bp][Data] + mov di, si + add di, cx + mov bp, di + add bp, cx + repz; cmpsb + pop di; pop si; pop cx (* pop was wrong order *) + lea bp, [bp][-frame] (* build return link, preserve flags!!*) + pop [bp] + pop [bp][2] + mov sp, bp + pop bp + mov ax,0 + jnz $not_equal + mov al, 1 +$not_equal: + ret near 0 + +segment _TEXT(CODE,28H); + +public N$NotEquByte : Data = frame+2; Count = frame +(* result in flags and ax *) + push bp + mov bp, sp + push cx; push si; push di + mov cx, [bp][Count] + lea si, [bp][Data] + mov di, si + add di, cx + mov bp, di + add bp, cx + repz; cmpsb + pop di; pop si; pop cx (* pop was wrong order *) + lea bp, [bp][-frame] (* build return link, preserve flags!!*) + pop [bp] + pop [bp][2] + mov sp, bp + pop bp + mov ax,0 + jz $equal + inc ax +$equal: + ret near 0 + +section +segment _TEXT(CODE,28H); + +public N$HugeSub : p = frame+4; q = frame + push bp + mov bp, sp + push bx; push cx + mov ax, [bp][p] + mov dx, [bp][p][2] + mov bx, [bp][q][2] + mov cx, DOSHUGESHIFT + shr bx, cl + shr dx, cl + sub ax, [bp][q] + sbb dx, bx + pop cx; pop bx + pop bp + ret near 8 + +section +segment _TEXT(CODE,28H); + +public N$LngRol : + push bx + and cx, 31 + cmp cx, 16 + jb $1 + sub cx, 16 + xchg ax,dx +$1: + rol ax, cl + rol dx, cl + mov bx, 1 + rol bx, cl + dec bx + mov cx, ax + xor cx, dx + and cx, bx + xor ax, cx + xor dx, cx + pop bx + ret near 0 + +section +segment _TEXT(CODE,28H); + +public N$SetRng : Start = frame+4; Stop = frame+2; Count = frame + push bp + mov bp, sp + sub sp, [bp][Count] + push [bp][2] (* return ip *) + push ax; push bx; push cx; push dx; push si; push di + mov bx, [bp][Count] + mov si, [bp][Start] + mov dx, [bp][Stop] + mov bp, [bp] + + mov di, sp; add di, frame+frame+18 + + add bx, di (*End*) + mov ax, si (*Start*) + cmp ax, dx (*Stop*) + ja $lastpart + + mov cx, ax + shr cx, 1; shr cx, 1; shr cx, 1 + sub al, al + rep; stosb + + mov cl, si (*Start*) + and cl, 7 + mov al, 0FFH + shl al, cl + stosb + + mov cx, dx (*Stop*) + shr cx, 1; shr cx, 1; shr cx, 1 + mov ax, si (*Start*) + shr ax, 1; shr ax, 1; shr ax, 1 + sub cx, ax + jz $one_byte_non_zero + dec cx + mov al, 0FFH + rep; stosb +$done_all_ones: + mov cl, 7 + sub cl, dl (*Stop*) + and cl, 7 + mov al, 0FFH + shr al, cl + stosb + +$lastpart: + mov cx, bx (*End*) + sub cx, di + sub al,al + rep; stosb + + pop di; pop si; pop dx; pop cx; pop bx; pop ax; + ret near frame+6 + +$one_byte_non_zero: + mov cl, 7 + sub cl, dl (*Stop*) + and cl, 7 + mov al, 0FFH + shr al, cl + and es:[di][-1], al + jmp $lastpart + +section +segment _TEXT(CODE,28H); + +extrn __FatalError +extrn __stk_base + +IPVar = 0 + +public N$StkChk : + + add bp, 100H + cmp sp, bp + jb stackError + ret 0 +stackError: + mov bx, sp + mov ax, ss:[bx][IPVar] + mov bx, FatalStackCheck + jmp __FatalError + +section +segment _TEXT(CODE,28H); + +extrn __FatalError +extrn CoreSig@CnsHandler + +IPVar = 8 + +public N$CnsStk : push ax; mov ax, 1 ; jmp N$cns +public N$CnsPtr : push ax; mov ax, 2 ; jmp N$cns +public N$CnsIdx : push ax; mov ax, 9 ; jmp N$cns +public N$CnsOvr : push ax; mov ax, 4 ; jmp N$cns +public N$CnsRng : push ax; mov ax, 5 ; jmp N$cns +public N$CnsRet : push ax; mov ax, 6 ; jmp N$cns +public N$CnsCase : push ax; mov ax, 7 ; jmp N$cns +public N$CnsDiv : push ax; mov ax, 8 ; jmp N$cns +public N$CnsPVC : push ax; mov ax, 0AH + +N$cns: + push bx + push cx + push dx + mov cx, ax + mov bx, sp + mov ax, ss:[bx][IPVar] + mov bx, cx + cmp word ss:[CoreSig@CnsHandler], 0 + je noHandler + call near ss:[CoreSig@CnsHandler] + or al, al + jz noHandler + pop dx + pop cx + pop bx + pop ax + ret 0 +noHandler: + jmp __FatalError + +end + diff --git a/code/SIBOSDK/src/coresig.a b/code/SIBOSDK/src/coresig.a new file mode 100644 index 0000000..6bcd10a --- /dev/null +++ b/code/SIBOSDK/src/coresig.a @@ -0,0 +1,525 @@ +(* Release 3.00 *) + +(* c_signal - signal module *) + +(* Copyright (C) 1989 Jensen and Partners. All Rights Reserved*) +(* Written by Simon Knight.*) + +(* Copyright (C) 1991 Psion PLC. All Rights Reserved*) +(* Modified by NSM.*) + +include "corelib.inc" +include "epocdefs.inc" + +module csignal + +(***************************************************************************) +segment _BSS(BSS, 28H) + +public CoreSig@CnsHandler : org CodePtrSize + +segment _BSS(BSS, 28H) + +public __sigTable : org 46 + +segment _BSS(BSS, 28H) + +public @RecursiveExit : org 2 + +segment _BSS(BSS, 28H) + +public _errno : org 2 + +(***************************************************************************) +section +segment _TEXT(CODE,28H) +segment _DATA(DATA, 28H) + +extrn _errno + +select _TEXT + +public __seterrno : + + mov [_errno], ax + ret 0 + +(****************************************************************************) +section +segment _TEXT(CODE,28H) +segment _DATA(DATA, 28H) + +extrn _errno + +select _TEXT + +public __errno__ : + + mov ax, _errno + ret 0 + +(****************************************************************************) +section +segment _TEXT(CODE,28H) +segment _DATA(DATA, 28H) + +extrn _errno +extrn __doserrno + +validError: + db 0, -1, -2, -5, -6, -7, -9 + db -10,-15,-16,-18,-32,-33,-36 + db -37,-39,-40,-41,-42,-66, 1 + +select _TEXT + +public __ioerr : + + cbw + mov [__doserrno], ax + push bx + cmp ax, -128 + jl invalid + cmp ax, 0 + jg invalid + mov bx, validError +locateLoop: + cmp [bx], al + je errorOk + inc bx + cmp byte [bx], 1 + jne locateLoop +invalid: + mov ax, EFAULT +errorOk: + pop bx + mov [_errno], ax + ret 0 + + dw __doserrno + + +(****************************************************************************) +section +segment _TEXT(CODE,28H) +segment _DATA(DATA, 28H) + +select _TEXT (* must be in TEXT *) + +extrn __FloatJmpSave +extrn __FloatJmpRestore +extrn _DatClassHandle +extrn _DatClassPtr +extrn _DatEnterFramePtr +extrn _DatOsFramePtr + +public _setjmp : +public __setjmp : +(* +int setjmp(jmp_buf task_state) +Saves current task state and returns 0. +*) + push bp + mov bp, sp + push di + mov di, ax + call __FloatJmpSave + pushf + pop ax + stosw + mov ax, [bp][2] + stosw + lea ax, [bp][4] + stosw + mov ax, [bp] + stosw + mov ax, si + stosw + mov ax, [bp][-2] + stosw + mov ax, dx + stosw + mov ax, cx + stosw + mov ax, bx + stosw + mov ax,[_DatClassHandle] + stosw + mov ax,[_DatClassPtr] + stosw + mov ax,[_DatEnterFramePtr] + stosw + mov ax,[_DatOsFramePtr] + stosw + sub ax, ax + pop di + pop bp + ret 0 + +(* _setjmp ENDP *) + +public _longjmp : +(* +void longjmp ( task_state, val); +Restores task state and jumps to landing_zone. +Returns val. (If val == 0, val++) +*) + + mov si, ax + cmp bx, 1 (* generates carry if BX = 0 *) + adc bx, 0 (* (val) BX = (BX) ? BX : 1; *) + call __FloatJmpRestore + mov di, [si][_j_di] + mov dx, [si][_j_dx] + mov cx, [si][_j_cx] + mov ax, [si][_j_classHandle] + mov [_DatClassHandle], ax + mov ax, [si][_j_classPtr] + mov [_DatClassPtr], ax + mov ax, [si][_j_enterFrame] + mov [_DatEnterFramePtr], ax + cli + mov sp, [si][_j_sp] + mov bp, [si][_j_bp] + mov ax, [si][_j_osFrame] + mov [_DatOsFramePtr], ax + push [si][_j_flag] + popf + push [si][_j_ip] + mov ax, bx + mov bx, [si][_j_bx] + mov si, [si][_j_si] + ret 0 + +(* _longjmp ENDP *) + +(****************************************************************************) +section +segment _TEXT(CODE,28H) +segment _DATA(DATA,28H) + +select _DATA + +HeadMsg : db 'Process Terminated', 0 + +select _TEXT + +public __sysmsg : + mov bx, HeadMsg + mov cx, ax + sub dx, dx + mov di, dx + mov si, dx + mov ah, NmGenNotify + int GenManager + ret 0 + +(****************************************************************************) +section +segment _TEXT(CODE,28H) +segment _INIT(DATA,28H) +segment _DATA(DATA,28H) + +extrn __initsig +extrn __InitLoop + +select _TEXT + +do_initsig : (* defined later on ! *) + +select _INIT +initsig : dw MAGIC + db PR3 + dw do_initsig + +select _DATA +public __NSIG : dw 22, initsig + +select _TEXT + + call __initsig + jmp __InitLoop + +(****************************************************************************) +section +segment _TEXT(CODE,28H) +segment _DATA(DATA,28H) +segment _BSS(BSS,28H) + +extrn __FatalError +extrn __FatalErrorPos +extrn __table_raise + +select _BSS + +extrn __sigTable + SIGINT = 2 + SIGILL = 8 + SIGFPE = 16 + SIGSEGV = 22 + SIGTERM = 30 + SIGUSR1 = 32 + SIGUSR2 = 34 + SIGUSR3 = 40 + SIGABRT = 44 + +select _DATA + +DefMsg : db 'By Signal', 0 +FpeMsg : db 'By Floating Point Exception', 0 +Usr1Msg : db 'By User 1 Signal', 0 +Usr2Msg : db 'By User 2 Signal', 0 +Usr3Msg : db 'By User 3 Signal', 0 +AbrtMsg : db 'By Abort', 0 + +extrn __sigsetup +extrn __exitsig +extrn __sysmsg +extrn __FloatMathExcepDos +extrn __NSIG +extrn __SH_sword +extrn __exc_addr + +select _TEXT + +SIG_ERR = -1 +SIG_DFL = 0 +SIG_IGN = 1 + +__do_exitsig : + + ret 0 + +public __initsig : + + (* set up handler table *) + cmp word [__sigsetup], 0 + jnz near noInit + not word [__sigsetup] + mov bx, __sigTable + mov word [__exitsig], __do_exitsig + mov ax, SIG_DFL + mov [bx][SIGABRT], ax (* SIGABRT *) + mov [bx][SIGILL], ax (* SIGILL *) + mov [bx][SIGSEGV], ax (* SIGSEGV *) + mov [bx][SIGINT], ax (* SIGINT *) + mov [bx][SIGFPE], ax (* SIGFPE *) + mov [bx][SIGTERM], ax (* SIGTERM *) + mov [bx][SIGUSR1], ax (* SIGUSR1 *) + mov [bx][SIGUSR2], ax (* SIGUSR2 *) + mov [bx][SIGUSR3], ax (* SIGUSR3 *) + +noInit: + ret 0 + +public __sigIgnore : + +(* A signal is ignored by doing nothing. *) + + ret 0 + +public __sigDefault : + +(* Default action when a signal occurs is to exit the program. *) + + push ax + cmp ax, 8 + je typeFPE + cmp ax, 16 + je typeUsr1 + cmp ax, 17 + je typeUsr2 + cmp ax, 20 + je typeUsr3 + cmp ax, 22 + je typeABRT +typeDEFAULT: + mov ax, DefMsg + jmp sendMessage +typeFPE: + mov ax, FpeMsg + jmp sendMessage +typeUsr1: + mov ax, Usr1Msg + jmp sendMessage +typeUsr2: + mov ax, Usr2Msg + jmp sendMessage +typeUsr3: + mov ax, Usr3Msg + jmp sendMessage +typeABRT: + mov ax, AbrtMsg + +sendMessage: + call __sysmsg + call __FatalErrorPos + pop cx + mov bx, FatalSignal + cmp cx, 8 + jne notFP + mov ax, [__exc_addr] +notFP: + jmp __FatalError + +public __sigFp : + call __FloatMathExcepDos + push ax + push bx + push cx + push dx + push di + push si + mov bx, SIGFPE + mov ax, [__SH_sword] + mov cx, 8 +transLoop: + shr ax, 1 + jc foundBit + loop transLoop +foundBit: + mov ax, 89H + sub ax, cx + call __table_raise + pop si + pop di + pop dx + pop cx + pop bx + pop ax + ret 0 + +(****************************************************************************) +section +segment _TEXT(CODE,28H) +segment _DATA(DATA,28H) +segment _BSS(BSS,28H) + +extrn __NSIG +extrn __sigTable +extrn __sigIgnore +extrn __sigDefault +extrn __seterrno + +select _TEXT + +public _signal : +(* +void ( *signal(int sig, void ( * func)()))(); +sets signal handler to func. +Returns old function pointer. +*) + +EINVAL = 19 + + push bx + push cx + + mov cx, bx + mov bx, ax + or bx, bx + je sigErr + cmp bx, [__NSIG] + ja sigErr + shl bx, 1 (* calculate table index *) + add bx, __sigTable + mov ax, [bx] + mov [bx], cx (* store new function pointer *) +sigDone: + pop cx + pop bx + ret 0 +sigErr: + mov ax, EINVAL + call __seterrno + mov ax, -1 + jmp sigDone + +public _raise : +(* +int raise(sig); +raises signal. +*) + + push bx + push cx + mov cx, bx + mov bx, ax + or bx, bx + je raiseErr + cmp bx, [__NSIG] + ja raiseErr + shl bx, 1 (* calculate table index *) + mov ax, cx + call __table_raise + sub ax, ax +raiseDone: + pop cx + pop bx + ret 0 +raiseErr: (* return -1 *) + mov ax, -1 + jmp raiseDone + +SIG_DFL = 0 +SIG_IGN = 1 + +SIGINT = 2 +SIGILL = 8 +SIGFPE = 16 +SIGSEGV = 22 +SIGTERM = 30 +SIGUSR1 = 32 +SIGUSR2 = 34 +SIGUSR3 = 40 +SIGABRT = 44 + +public __table_raise : (* bx = sig num offset, ax = arg *) + + push bx + push cx + push dx + mov dx, ax + mov ax, bx + shr ax, 1 + mov cx, [bx][__sigTable] + cmp bx, SIGTERM + je doDFL + cmp bx, SIGABRT + je doDFL + cmp bx, SIGILL + je doDFL + cmp bx, SIGSEGV + je doDFL + cmp bx, SIGINT + je doDFL + cmp bx, SIGFPE + je doDFL + cmp bx, SIGUSR1 + je doDFL + cmp bx, SIGUSR2 + je doDFL + cmp bx, SIGUSR3 + jne dontSet +doDFL: + mov word [bx][__sigTable], SIG_DFL +dontSet: + cmp cx, 1 + jbe defRaise + mov bx, dx + call cx +trDone: + pop dx + pop cx + pop bx + ret 0 + +defRaise: + jcxz callDefault + call __sigIgnore + jmp trDone +callDefault: + call __sigDefault + jmp trDone + +end diff --git a/code/SIBOSDK/src/cpplow.a b/code/SIBOSDK/src/cpplow.a new file mode 100644 index 0000000..cc29ce4 --- /dev/null +++ b/code/SIBOSDK/src/cpplow.a @@ -0,0 +1,159 @@ +(* Release 3.10 *) +(*-------------------------------------------------------------------------* +* * +* CPPLOW.A - C++ assembler implementations * +* * +* COPYRIGHT (C) 1989..1992 Clarion Software Corporation. * +* All Rights Reserved * +* * +*--------------------------------------------------------------------------*) + +include "corelib.inc" + +module cpplow + +(******************************************************************************) +section + +segment _TEXT(CODE,28H) +segment _DATA(DATA,28H) +segment _INIT(DATA,28H) + +extrn __init_standard + +select _TEXT + +do_initstandard : (* defined later on ! *) + +select _INIT +initio : dw MAGIC + db PRL + dw do_initstandard + +select _DATA +public __assign_init_magic : dw 0, initio + +select _TEXT + + call __init_standard + ret 0 + +(******************************************************************************) +section + +segment _TEXT(CODE,28H) +segment _DATA(DATA,28H) +segment _INIT(DATA,28H) + +extrn __init_con + +select _TEXT + +do_initcon : (* defined later on ! *) + +select _INIT +initcon : dw MAGIC + db PRL + dw do_initcon + +select _DATA +public __flush_init_magic : dw 0, initcon + +select _TEXT + call __init_con + ret 0 + +(***************************************************************************) +section +segment _DATA(DATA,28H) +segment _TEXT(CODE,28H) + +(* +void _call_ctors(void *(*ctor)(void *), char *obj_ptr, int vbnum, int n, int siz); +void _call_dtors(void (*dtor)(void *), char *obj_ptr, int vbnum, int n, int siz); +*) +sframe = 4 +tor = sframe +objptr = 2+sframe +vbnum = 4+sframe +n = 6+sframe +siz = 8+sframe + + +public __call_ctors : + + push bp + mov bp, sp + push di + push si + sub di, di +ctorsCommon: + mov cx, [bp][n] + jcxz ctDone +ctLoop: + push cx + or di, di + jz noDec + mov cx, [bp][siz] + sub [bp][objptr], cx +noDec: + mov si, 3 + mov ax, [bp][objptr] + mov bx, di + mov cx, [bp][vbnum] + mov dx, di + sub cx, si + jle ctCallConst +ctPushLoop: + push dx + loop ctPushLoop +ctCallConst: + mov cx, di + call word [bp][tor] + or di, di + jnz noInc + mov cx, [bp][siz] + add [bp][objptr], cx +noInc: + pop cx + loop ctLoop +ctDone: + pop si + pop di + pop bp + ret 0 + +public __call_dtors : + + push bp + mov bp, sp + push di + push si + mov di, 1 + jmp ctorsCommon + +(***************************************************************************) +section +segment _TEXT(CODE,28H) + +extrn __bcd + +public __cvt_bcd : + + xchg ax, bx + fbld st(0), ss:[bx] + fstp st(1), st(0) + xchg ax, bx + ret 0 + +public __real_to_dec : + + push bp + mov bp, sp + mov bx, ax + fld st(0), st(0) + fistp qword [bx], st(0) + pop bp + ret 0 + +end diff --git a/code/SIBOSDK/src/cstr.a b/code/SIBOSDK/src/cstr.a new file mode 100644 index 0000000..66288ae --- /dev/null +++ b/code/SIBOSDK/src/cstr.a @@ -0,0 +1,1272 @@ +(* Release 3.00 *) + +(* c_str - common string functions *) + +(* Copyright (C) 1989 Jensen and Partners. All Rights Reserved*) +(* Written by Simon Knight.*) + +(* Copyright (C) 1991 Psion PLC. All Rights Reserved*) +(* Modified by NSM.*) + +include "corelib.inc" + +module cstr + +segment _TEXT(CODE,28H) + +(* string - string manipulation routines for signed character srtings *) + +(*****************************************************************************) +section +segment _TEXT(CODE,28H) + +public _strcpy : + +(* strcpy *) + + push cx + push dx + push di + push si + mov di, bx + mov si, bx + mov dx, ax + mov cx, -1 + sub al, al +repne ; scasb + not cx + mov di, dx + shr cx, 1 +rep; movsw + adc cx, cx +rep; movsb + mov ax, dx (* return destination address *) + pop si + pop di + pop dx + pop cx + ret 0 + + +(***************************************************************************) +section +segment _TEXT(CODE,28H) + +public _strcat : + +(* +char *strcat(char *dest, const char *source) + +Appends source to dest. +returns destination address. +*) + + push cx + push dx + push di + push si + mov si, bx + mov di, ax + mov dx, ax + mov cx, 0FFFFH + mov al, 0 +repne ; scasb (* find end of destination string *) + dec di +catLoop: + lodsw + or al, al + jz endOfString + stosw + or ah, ah + loopne catLoop + jmp catDone +endOfString: + stosb +catDone: + mov ax, dx (* return destination address *) + pop si + pop di + pop dx + pop cx + ret 0 + +(*************************************************************************) +section +segment _TEXT(CODE,28H) + +public _stpcpy : + +(* +char *stpcpy(char *dest, const char *source) + +Appends string source to string dest. +Returns destination address + strlen +. +*) + + push cx + push di + push si + mov si, bx + mov di, ax + mov cx, 0FFFFH +pcpyLoop: + lodsw + or al, al + jz endOfString + stosw + or ah, ah + loopne pcpyLoop + jmp pcpyDone +endOfString: + stosb +pcpyDone: + mov ax, di (* return address of terminating zero *) + dec ax + pop si + pop di + pop cx + ret 0 + +(**************************************************************************) + +section +segment _TEXT(CODE,28H) + +public _strchr : + + push cx + push dx + push di + mov di, ax + mov dx, ax + mov cx, -1 + sub al, al +repne ; scasb + not cx + mov di, dx + mov al, bl +repne; scasb + jnz notFound + dec di (* return address of target *) + mov ax, di +chrDone: + pop di + pop dx + pop cx + ret 0 +notFound: + sub ax, ax + jmp chrDone + +(**************************************************************************) +section +segment _TEXT(CODE,28H) + +public _strcmp : +public _strcoll : + +(* strcmp *) + + push cx + push di + push si + mov si, ax + mov di, bx + mov cx, -1 + sub ax, ax +repne ; scasb + not cx + mov di, bx +repe; cmpsb + jz ncmpDone + jb ncmpLess +ncmpMore: + inc ax + jmp ncmpDone +ncmpLess: + dec ax +ncmpDone: + pop si + pop di + pop cx + ret 0 + +(***************************************************************************) +section +segment _TEXT(CODE,28H) + +public _strcspn : + +(* +int strcspn(const char *s1, const char *s2) + +Returns length of initial segment of s1 not containing characters from s2. +*) + + push cx + push di + push si + mov si, ax + mov cx, 0FFFFH +cspnLoop: + lodsb + or al, al (* end of string ? *) + je cspnDone + mov di, bx +ctLoop: (* search second string *) + mov ah, [di] + cmp al, ah + je cspnDone (* Found Matching character - get out *) + inc di + or ah, ah + jne ctLoop (* repeat compare loop *) + loop cspnLoop (* do next charcter in target string *) +cspnDone: + not cx (* return length to Matching character *) + mov ax, cx + pop si + pop di + pop cx + ret 0 + +(***************************************************************************) +section +segment _TEXT(CODE,28H) + + +extrn _malloc (* used to allocate memory for new string in strdup *) + + +public _strdup : + +(* +char *strdup(const char *s) + +Allocates memory with malloc and copies string s to that address. +Returns pointer to new copy or NULL if call to malloc failed. +*) + + push bx + push cx + push di + push si + mov si, ax + mov di, ax + mov cx, 0FFFFH + sub ax, ax +repne ; scasb (* get length of string plus terminator 0 *) + not cx + push cx + mov ax, cx + call _malloc + pop cx + or ax, ax + je dupnocopy + mov di, ax +rep ; movsb (* copy string *) +dupnocopy: + pop si + pop di + pop cx + pop bx + ret 0 + + +(**************************************************************************) +section +segment _TEXT(CODE,28H) + +public _stricmp : + +(* +int stricmp(const char *s1, const char *s2) + +Unsigned case insensitive comparison of s1 and s2. +Returns -1 if s1 s2. +*) + + push cx + push dx + push di + push si + mov si, ax + mov di, bx + mov cx, 0FFFFH + sub ax, ax +icmpLoop: + lodsb + cmp al, 'z' (* convert to upper if lower *) + ja inotlowa + cmp al, 'a' + jb inotlowa + sub al, 20H +inotlowa: + mov bl, [di] + inc di + cmp bl, 'z' (* convert to upper if lower *) + ja inotlowb + cmp bl, 'a' + jb inotlowb + sub bl, 20H +inotlowb: + cmp al, bl + jb iLessThan + ja iGreaterThan + or al, al + loopnz icmpLoop +icmpSame: + sub ax, ax (* return 0 *) + jmp icmpDone +iLessThan: + mov ax, -1 (* return -1 *) + jmp icmpDone +iGreaterThan: + mov ax, 1 +icmpDone: + pop si + pop di + pop dx + pop cx + ret 0 + + +(**************************************************************************) +section +segment _TEXT(CODE,28H) + +public _strlen : + +(* +size_t strlen(const char *s) + +Returns length of s excluding terminating zero. +*) + + + push cx + push di + mov di, ax + mov cx, 0FFFFH + sub al, al +repne ; scasb (* get length of string *) + not cx + mov ax, cx + dec ax (* return value is length of string *) + pop di + pop cx + ret 0 + +(**************************************************************************) +section +segment _TEXT(CODE,28H) + +public _strlwr : + +(* +char *strlwr(char *s) + +Converts string s to lower case. +returns s. +*) + + push bx + push cx + push di + push si + mov si, ax + mov di, ax + mov bx, ax + mov cx, 0FFFFH +lwrLoop: + lodsb (* load *) + or al, al + je lwrDone (* end of string *) + cmp al, 'Z' + ja lwrNoChange + cmp al, 'A' + jb lwrNoChange + add al, 20H (* convert *) +lwrNoChange: + stosb (* store *) + loop lwrLoop +lwrDone: + mov ax, bx (* return string address *) + pop si + pop di + pop cx + pop bx + ret 0 + +(**************************************************************************) +section +segment _TEXT(CODE,28H) + +public _strncat : + +(* +char *strncat(char *dest, const char *source, int num) + +Concatenates dest and upto num characters from source. +returns destination address. +*) + + push dx + push di + push si + mov si, bx + mov di, ax + mov dx, ax + mov bx, cx + mov cx, 0FFFFH + sub al, al +repne ; scasb (* find end of destination string *) + dec di + mov cx, bx (* count *) + jcxz ncatDone +ncatLoop: + lodsb (* use lodsb/stosb to avoid mem/immed compare *) + stosb + or al, al + je ncatDone + loop ncatLoop + mov byte [di], 0 (* terminate new string *) +ncatDone: + mov ax, dx (* return destination address *) + pop si + pop di + pop dx + ret 0 + +(*****************************************************************************) +section +segment _TEXT(CODE,28H) + +public _strncmp : + +(* strncmp *) + + push dx + push di + push si + mov si, ax + mov di, bx + mov dx, bx + mov bx, cx + sub ax, ax +repne ; scasb + jcxz stringLong + sub bx, cx +stringLong: + mov cx, bx + mov di, dx +repe; cmpsb + jz ncmpDone + jl ncmpLess +ncmpMore: + inc ax + jmp ncmpDone +ncmpLess: + dec ax +ncmpDone: + pop si + pop di + pop dx + ret 0 + +(**************************************************************************) +section +segment _TEXT(CODE,28H) + +public _strncpy : + +(* +char *strcpy(char *dest, const char *source, int num) + +copies up to num characters to dest. +returns destination address. +*) + + push dx + push di + push si + mov si, bx + mov di, ax + mov dx, ax + jcxz ncpyDone +ncpyLoop: + lodsb (* avoids mem/immed compare *) + stosb + or al, al + loopne ncpyLoop +ncpyDone: +rep ; stosb + mov ax, dx (* return destination address *) + pop si + pop di + pop dx + ret 0 + +(**************************************************************************) +section +segment _TEXT(CODE,28H) + +public _strxfrm : + + push dx + push di + push si + mov si, bx + mov di, ax + mov dx, cx + jcxz ncpyDone +ncpyLoop: + lodsb (* avoids mem/immed compare *) + stosb + or al, al + je ncpyDone + loop ncpyLoop + sub al, al + stosb +ncpyDone: + mov ax, dx + inc ax + pop si + pop di + pop dx + ret 0 + + +(**************************************************************************) +section +segment _TEXT(CODE,28H) + +public _mbstowcs : +public _wcstombs : + + push dx + push di + push si + mov si, bx + mov di, ax + mov bx, cx + jcxz ncpyDone +ncpyLoop: + lodsb (* avoids mem/immed compare *) + stosb + or al, al + je ncpyDone + loop ncpyLoop +ncpyDone: + mov ax, bx + sub ax, cx + pop si + pop di + pop dx + ret 0 + + +(**************************************************************************) +section +segment _TEXT(CODE,28H) + +public _strnicmp : + +(* +int strnicmp(const char *s1, const char *s2, int num) + + +Compares up to num characters. +Returns < 0 if s1 0 if s1 > s2. +*) + + push dx + push di + push si + mov si, ax + mov di, bx + sub ax, ax + jcxz nicmpDone +nicmpLoop: + lodsb + cmp al, 'z' (* convert to upper if lower *) + ja notlowa + cmp al, 'a' + jb notlowa + sub al, 20H +notlowa: + mov bl, [di] + inc di (* convert to upper if lower *) + cmp bl, 'z' + ja notlowb + cmp bl, 'a' + jb notlowb + sub bl, 20H +notlowb: + cmp al, bl + jl nicmpLessThan + jg nicmpGreaterThan + or al, al + loopne nicmpLoop +nicmpSame: + sub ax, ax (* return 0 *) + jmp nicmpDone +nicmpLessThan: + mov ax, -1 (* return -1 *) + jmp nicmpDone +nicmpGreaterThan: + mov ax, 1 (* return 1 *) +nicmpDone: + pop si + pop di + pop dx + ret 0 + +(*****************************************************************************) +section +segment _TEXT(CODE,28H) + +public _strnset : + +(* +char *strnset(char *s, char c, unsigned num) + +sets up to num characters to c +returns s. +*) + + push di + mov di, ax + push ax + mov al, bl + jcxz nsetDone +nsetLoop: + cmp byte [di], 0 + je nsetDone + stosb + loop nsetLoop +nsetDone: + pop ax (* return string address *) + pop di + ret 0 + +(*****************************************************************************) +section +segment _TEXT(CODE,28H) + +public _strpbrk : + +(* +int strpbrk(const char *s1, const char *s2) + +returns address of first occurrence of any character from s2. +*) + + push cx + push di + push si + mov si, ax + mov cx, 0FFFFH +pbrkLoop: + lodsb + or al, al (* end of string ? *) + je pbrkDone + mov di, bx +ktLoop: (* search in second string *) + mov ah, [di] + cmp al, ah + je pbrkFound (* Found Matching character *) + inc di + or ah, ah + jne ktLoop (* repeat *) + loop pbrkLoop (* do next character in target string *) +pbrkDone: + sub ax, ax + jmp pbrkFinish +pbrkFound: + dec si (* return address of first Match *) + mov ax, si +pbrkFinish: + pop si + pop di + pop cx + ret 0 + +(*******************************************************************************) +section +segment _TEXT(CODE,28H) + +public _strrchr : + +(* +char *strrchr(const char *s, int c) + +searches string for last occurrence c. +returns address of target byte if Found. +*) + + push cx + push dx + push di + mov di, ax + mov dx, ax + mov cx, 0FFFFH + sub al, al +repne ; scasb (* find end of string *) + dec di + std + mov al, bl + not cx +repne ; scasb (* search *) + je rchrFound +rchrnotFound: + sub ax, ax (* return NULL *) + jmp rchrDone +rchrFound: + inc di (* return address of Matching character *) + mov ax, di +rchrDone: + cld + pop di + pop dx + pop cx + ret 0 + +(******************************************************************************) +section +segment _TEXT(CODE,28H) + +public _strrev : + +(* +char *strrev(char *s) + +reverses s. +*) + + push cx + push dx + push di + push si + mov si, ax + mov di, ax + mov dx, ax + sub al, al + mov cx, 0FFFFH +repne ; scasb + cmp cx, 0FFFDH (* find end of string *) + jae revDone + sub di, 2 + mov cx, 0FFFFH +revLoop: + mov al, [di] (* get end character *) + movsb (* move beginning to end *) + sub di, 2 + mov [si][-1], al (* store end character *) + cmp si, di + jae revDone (* exit at crossover *) + loop revLoop +revDone: + mov ax, dx (* return address of string *) + pop si + pop di + pop dx + pop cx + ret 0 + +(*****************************************************************************) +section +segment _TEXT(CODE,28H) + +public _strset : + +(* +char *strset(char *s, int c) + +sets characters to c +returns s. +*) + + push cx + push dx + push di + mov di, ax + mov dx, ax + mov cx, -1 + sub al, al +repne ; scasb + not cx + dec cx + mov al, bl + mov ah, al + mov di, dx + shr cx, 1 +rep; stosw + adc cx, cx +rep; stosb + mov ax, dx (* return address of string *) + pop di + pop dx + pop cx + ret 0 + +(********************************************************************************) +section +segment _TEXT(CODE,28H) + +public _strspn : + +(* +int strspn(const char *s1, const char *s2) + +returns length of initial segment of s1 containing characters from s2. +*) + + push cx + push dx + push di + push si + mov si, ax + mov dx, bx + mov cx, 0FFFFH +spnLoop: + lodsb + or al, al (* end of string ? *) + je spnDone + mov di, dx + +stLoop: (* search second string *) + mov ah, [di] + cmp al, ah + je spnMatch (* Found Matching character *) + inc di + or ah, ah + jne stLoop (* repeat *) + jmp spnDone (* no Match Found *) +spnMatch: + loop spnLoop (* do next charcter in target string *) +spnDone: + not cx (* return length to non Matching character *) + mov ax, cx + pop si + pop di + pop dx + pop cx + ret 0 + +(*****************************************************************************) +section +segment _TEXT(CODE,28H) + +public _strstr : + +(* +char *strstr(const char *s1, const char *s2) + +returns address of first occurrence of s2 in s1, or NULL if not Found. +*) + + +s1 = -4 +s2 = -8 +len1 = -10 +len2 = -12 +locals = 12 + + push bp + mov bp, sp + sub sp, locals + push cx + push dx + push di + push si + mov di, bx + mov [bp][s2], bx + mov [bp][s1], ax + mov cx, 0FFFFH (* get length of s2 - saves time in loop *) + sub al, al +repne ; scasb + not cx + dec cx + jcxz s2Null + mov [bp][len2], cx + mov di, [bp][s1] + mov dx, di + mov cx, 0FFFFH (* get length of s2 - saves time in loop *) +repne ; scasb + not cx + dec cx + mov si, [bp][s2] + mov di, dx + mov dx, si + mov al, [si] +strLoop: +repne ; scasb + jnz strNotFound + push cx + push di + dec di + mov cx, [bp][len2] +repe ; cmpsb + pop di + pop cx + je strFound + mov si, dx + jmp strLoop +strNotFound: + sub ax, ax + jmp strFinish +strFound: + mov ax, di + dec ax +strFinish: + pop si + pop di + pop dx + pop cx + mov sp, bp + pop bp + ret 0 + +s2Null: + mov ax, [bp][s1] + jmp strFinish + +(****************************************************************************) +section +segment _TEXT(CODE,28H) + +public _strupr : + +(* +char *strupr(char *s) + +converts lower case characters to upper case. +returns s. +*) + + push bx + push cx + push di + push si + mov si, ax + mov di, ax + mov bx, ax + mov cx, 0FFFFH +uprLoop: + lodsb + or al, al + je uprDone (* end of string Found *) + cmp al, 'z' (* change if lower *) + ja uprNoChange + cmp al, 'a' + jb uprNoChange + sub al, 20H (* convert to upper *) +uprNoChange: + stosb + loop uprLoop +uprDone: (* return address of string *) + mov ax, bx + pop si + pop di + pop cx + pop bx + ret 0 + +(***************************************************************************) + +section + +segment _TEXT(CODE,28H) + + +public _memcpy : + +(* +void *memcpy(void *dest, void *source, unsigned num) + +Copies num bytes from source to dest (Does not handle any overlap). +Returns destination address. +*) + + push di + push si + mov si, bx + mov di, ax + jcxz noMove + test al, 1 + jz evenAdd (* word align *) + movsb + dec cx +evenAdd: + shr cx, 1 +rep ; movsw (* move words *) + adc cx, cx +rep ; movsb (* move odd byte *) +noMove: + pop si + pop di + ret 0 + +(****************************************************************************) +section +segment _TEXT(CODE,28H) + +public _memccpy : + +(* +void *memccpy(void *dest, void *source, unsigned char c, unsigned num) + +Copying stops after copying c or after num bytes. +returns destination address. +*) + + push dx + push di + push si + mov si, bx + mov di, ax + xchg cx, dx + jcxz ccpyDone +ccpyLoop: + lodsb (* use lods/stos to get byte in al for compare *) + stosb + cmp al, dl (* faster than movs + reg/mem cmp *) + je ccpyDone + loop ccpyLoop + sub ax, ax + jmp ccopyExit +ccpyDone: + mov ax, di +ccopyExit: + pop si + pop di + pop dx + ret 0 + +(****************************************************************************) +section +segment _TEXT(CODE,28H) + +public _memchr : + +(* +void *memchr(void *s, char c, unsigned num) + +searches num bytes for c. +returns source address. +*) + + + push di + mov di, ax + mov al, bl + jcxz chrFound +repne ; scasb + je chrFound + sub ax, ax (* not found - return value NULL *) + jmp chrDone +chrFound: + dec di (* found - return address. *) + mov ax, di +chrDone: + pop di + ret 0 + + +(****************************************************************************) +section +segment _TEXT(CODE,28H) + +public _memset : + +(* +void *memset(void *s, char c, unsigned num) + +Sets num bytes to c. +Returns buffer address. +*) + + push dx + push di + mov di, ax + mov dx, ax + mov al, bl + jcxz noMove + mov ah, al + test di, 1 + jz evenAdd + stosb (* word align *) + dec cx +evenAdd: + shr cx, 1 +rep ; stosw (* move words *) + adc cx, cx +rep ; stosb (* move odd byte *) +noMove: + mov ax, dx + pop di + pop dx + ret 0 + +(******************************************************************************) +section +segment _TEXT(CODE,28H) + +public _memcmp : +(* +int memcmp(void *s1, void *s2, unsigned num) + +Performs unsigned comparison of s1 and s2 and returns < 0 if s1 0 if s1 > s2. +*) + + push di + push si + mov si, ax + mov di, bx + sub ax, ax (* same - return value is 0 *) + jcxz cmpDone +repe ; cmpsb (* compare *) + jz cmpDone + sbb ax, ax + sbb ax, -1 +cmpDone: + pop si + pop di + ret 0 + +(***************************************************************************) +section +segment _TEXT(CODE,28H) + +public _memicmp : + +(* +int memicmp(void *s1, void *s2, unsigned num) + +Performs case insensitive comparison of s1 and s2, returning < 0 if s1 0 if s1 > s2. +*) + + push di + push si + mov si, ax + mov di, bx + sub ax, ax + jcxz icmpSame +icmpLoop: + lodsb + cmp al, 'z' (* if lower convert to upper *) + ja inotlowa + cmp al, 'a' + jb inotlowa + sub al, 20H +inotlowa: + mov bl, [di] + inc di + cmp bl, 'z' (* if lower convert to upper *) + ja inotlowb + cmp bl, 'a' + jb inotlowb + sub bl, 20H +inotlowb: + sub al, bl + jne icmpDifferent + loop icmpLoop + sub ax, ax + jmp icmpSame +icmpDifferent: + mov al, 0 + sbb al, al + sbb al, -1 + cbw +icmpSame: + pop si + pop di + ret 0 + +(***************************************************************************) +section +segment _TEXT(CODE,28H) + +public _memwset : + +(* +void *memwset(void *s, char c, unsigned num) + +Sets num words to c. +Returns buffer address. +*) + + push dx + push di + mov di, ax + mov ax, bx + mov dx, di +rep ; stosw + mov ax, dx + pop di + pop dx + ret 0 + +(*****************************************************************************) +section +segment _TEXT(CODE,28H) + +public _memwcpy : + +(* +void *memwcpy(void *dest, void *source, unsigned num) + +Copies num words form source to dest (Does not handle overlap). +Returns destination address. +*) + + push di + push si + mov si, bx + mov di, ax +rep ; movsw + pop si + pop di + ret 0 + +(*****************************************************************************) +section +segment _TEXT(CODE,28H) + +public _setmem : + +(* +void setmem(void *s, unsigned num, char c) + +ets num bytes to c. +Returns nothing. +*) + + + push di + mov di, ax + mov al, cl + mov cx, bx +(*%E *) + jcxz noMove + mov ah, al + test di, 1 + jz evenAdd + stosb + dec cx (* word align *) +evenAdd: + shr cx, 1 +rep ; stosw (* move words *) + adc cx, cx +rep ; stosb (* move odd byte *) +noMove: + pop di + ret 0 + +end + + + diff --git a/code/SIBOSDK/src/csys.c b/code/SIBOSDK/src/csys.c new file mode 100644 index 0000000..373029b --- /dev/null +++ b/code/SIBOSDK/src/csys.c @@ -0,0 +1,437 @@ +/* Release 3.00 */ + +/*-------------------------------------------------------------------------* +* * +* csys.c - common system functions. * +* * +* COPYRIGHT (C) 1989 Jensen and Partners. All Rights Reserved * +* Written by Simon Knight. * +* * +* COPYRIGHT (C) 1991 Psion PLC. All Rights Reserved * +* Modified by NSM. * +* * +*--------------------------------------------------------------------------*/ + +#define _USE_CONIO +#define _USE_TIME +#include + +/*-------------------------------------------------------------------------* +* exit functions - terminate process after closing open files. * +*--------------------------------------------------------------------------*/ + +void _exit1(void) +{ + int n; + + _flushall(); + n=0; + while(n < _open_max) + { + if(_openfd[n]) + close(n); + n++; + } + return; +} + +void _exit2(void) +{ + int n; + char *tmp; + + n=0; + while (n < _open_max) + { + if ((tmp=_tmpfiles[n])!=NULL) + { + if(_openfd[n]) + close(n); + unlink(tmp); + } + n++; + } + return; +} + +/*-------------------------------------------------------------------------* +* abort - print message and raise ABORT signal. * +*--------------------------------------------------------------------------*/ + +void abort(void) +{ + fputs("Abnormal Program Termination\n", stderr); + raise(SIGABRT); + return; +} + +/*-------------------------------------------------------------------------* +* atexit - put function pointer on stack to be called by exit. * +*--------------------------------------------------------------------------*/ + +int atexit(void (* func)(void)) +{ + int ret; + + if(_exit_ptr != _exit_stk) /* return if stack full */ + { + *(--_exit_ptr)=func; /* push func */ + ret=0; + } + else + ret=-1; + return(ret); +} + +/*-------------------------------------------------------------------------* +* onexit - put function pointer on stack to be called by exit. * +*--------------------------------------------------------------------------*/ + +void (* onexit(void (* func)(void)))() +{ + void (* ret)(void); + + if(_exit_ptr != _exit_stk) /* return if stack full */ + { + *(--_exit_ptr)=func; /* push func */ + ret=func; + } + else + ret=NULL; + return(ret); +} + +/*-------------------------------------------------------------------------* +* system - execute command.com. * +*--------------------------------------------------------------------------*/ + +int system(const char *command) +{ + char *compath; + + compath=getenv("COMSPEC"); /* use COMSPEC to find command.com */ + if(compath == NULL) + compath="ROM::SYS$SHLL"; + if(command == NULL) + { + if(!_exists(compath)) /* does file exist ? */ + { + errno=ENOENT; + return(0); + } + return(1); + } + flushall(); /* flush open streams */ + return(spawnl(P_WAIT,compath,"",command,NULL)); +} + +/*-------------------------------------------------------------------------* +* exec?? - execute child process. * +*--------------------------------------------------------------------------*/ + +#pragma warn(wpnu => off) + +int execl(const char *path, char *arg0, ...) +{ + va_list argptr; + + va_start(argptr, path); + return(_execc(path, (char **) argptr, _E_EXEC)); +} + +int execlp(const char *path, char *arg0, ...) +{ + va_list argptr; + + va_start(argptr, path); + return(_execc(path, (char **) argptr, _E_EXEC|_E_SEARCH)); +} + +int execv(const char *path, char *argv[]) +{ + return(_execc(path, argv, _E_EXEC)); +} + +int execvp(const char *path, char *argv[]) +{ + return(_execc(path, argv, _E_EXEC|_E_SEARCH)); +} + +/*-------------------------------------------------------------------------* +* spawn?? - spawn child process. * +*--------------------------------------------------------------------------*/ + +int spawnl(int mode, const char *path, char *arg0, ...) +{ + va_list argptr; + + va_start(argptr, path); + return(_execc(path, (char **) argptr, mode)); +} + +int spawnlp(int mode, const char *path, char *arg0, ...) +{ + va_list argptr; + + va_start(argptr, path); + return(_execc(path, (char **) argptr, mode|_E_SEARCH)); +} + +int spawnv(int mode, const char *path, char *argv[]) + +{ + return(_execc(path, argv, mode)); +} + +#pragma warn(wpnu => on) + +int spawnvp(int mode, const char *path, char *argv[]) +{ + return(_execc(path, argv, mode|_E_SEARCH)); +} + +/*-------------------------------------------------------------------------* +* searchenv - find file using environment string * +*--------------------------------------------------------------------------*/ + +void _searchenv(const char *name, const char *env, char *path) +{ + char *envpath; + int n, p, c; + int length; + + if((envpath=getenv(env)) == NULL) + { + path[0]=0; + return; + } + length=strlen(name)+1; + getcwd(path, 0x80); /* try current directory */ + n=strlen(path); + path[n++]='\\'; + memcpy(&path[n], name, length); + if(_exists(path)) + { + return; /* found it already */ + } + n=0; + p=0; + do /* search each path */ + { + while((c=envpath[n++]) && (c != ';')) + { + path[p++]= (char) c; + } + if(path[p-1] != '\\') + path[p++]='\\'; + memcpy(&path[p], name, length); + if(_exists(path)) + { + return; /* found it */ + } + p=0; + } while (envpath[n-1]); + path[0]=0; /* couldn't find file */ + return; +} + +void sleep(unsigned seconds) +{ + _sleepTenths(seconds*10l); +} + +static void call_test1(void) +{ + calloc(0, 0); + free(NULL); + malloc(0); + realloc(NULL, 0); + _ncalloc(0, 0); + _nfree(NULL); + _nmalloc(0); + _nrealloc(NULL, 0); + + _msize(NULL); + _memmax(); + _memavl(); + _heapchk(); + _heapset(0); + _heapwalk(NULL); + coreleft(); + _freect(0); + + _nheapchk(); + _nheapset(0); + _nheapwalk(NULL); + _nmsize(NULL); + nearcoreleft(); +} + +static void call_test3(void) +{ + cgets(NULL); + cputs(NULL); + getch(); + getche(); + kbhit(); + putch(0); + ungetch(0); +} + +static void call_test4(void) +{ + chdir(NULL); + getcurdir(0, NULL); + getcwd(NULL, 0); + _getdrive(); + mkdir(NULL); + rmdir(NULL); + + getdisk(); + searchpath(NULL); + setdisk(0); +} + +static void call_test6(void) +{ + access(NULL, 0); + chmod(NULL, 0); + chsize(0, 0L); +} + +static void call_test7(void) +{ + abs(0); + acos(0.0); + asin(0.0); + atan(0.0); + atan2(0.0, 0.0); + atof(NULL); + ceil(0.0); + cos(0.0); + cosh(0.0); + exp(0.0); + fabs(0.0); + floor(0.0); + fmod(0.0, 0.0); + frexp(0.0, NULL); + labs(0L); + ldexp(0.0, 0); + log(0.0); + log10(0.0); + modf(0.0, NULL); + poly(0.0, 0, NULL); + pow(0.0, 0.0); + sin(0.0); + sinh(0.0); + sqrt(0.0); + strtod(NULL, NULL); + tan(0.0); + tanh(0.0); + matherr(NULL); + hypot(0.0, 0.0); + pow10(0); + _fpreset(); +} + +static void call_test8(void) +{ + void *ptr=NULL; + + memccpy(ptr, ptr, 0, 0); + memchr(ptr, 0, 0); + memcmp(ptr, ptr, 0); + memcpy(ptr, ptr, 0); + memicmp(ptr, ptr, 0); + memmove(ptr, ptr, 0); + memset(ptr, 0, 0); + movmem(ptr, ptr, 0); + setmem(ptr, 0, 0); + + memwmove(ptr, ptr, 0); + memwset(ptr, 0, 0); + memwcpy(ptr, ptr, 0); +} + +static void call_test9(void) +{ + signal(0, NULL); + raise(0); +} + +static void call_test10(void) +{ + fgetc(NULL); + fputc(0, NULL); + rename(NULL, NULL); + unlink(NULL); +} + +static void call_test11(void) +{ + delay(0); + getenv(NULL); + mblen(NULL, 0); + mbtowc(NULL, NULL, 0); + wctomb(NULL, 0); + mbstowcs(NULL, NULL, 0); + wcstombs(NULL, NULL, 0); + ecvt(0.0, 0, NULL, NULL); + _exit(0); + fcvt(0.0, 0, NULL, NULL); + gcvt(0.0, 0, NULL); + itoa(0, NULL, 0); + _lrotl(0L, 0); + _lrotr(0L, 0); + ltoa(0L, NULL, 0); + _searchenv(NULL, NULL, NULL); + _rotl(0, 0); + _rotr(0, 0); + swab(NULL, NULL, 0); + ultoa(0L, NULL, 0); +} + +static void call_test12(void) +{ + void *ptr=NULL; + + strcat(ptr, ptr); + strcmp(ptr, ptr); + strcpy(ptr, ptr); + strlen(ptr); + strset(ptr, 0); + stpcpy(ptr, ptr); + strchr(ptr, 0); + strcoll(ptr, ptr); + strxfrm(ptr, ptr, 0); + strcspn(ptr, ptr); + strdup(ptr); + strerror(0); + stricmp(ptr, ptr); + strlwr(ptr); + strncat(ptr, ptr, 0); + strncmp(ptr, ptr, 0); + strncpy(ptr, ptr, 0); + strnicmp(ptr, ptr, 0); + strnset(ptr, 0, 0); + strpbrk(ptr, ptr); + strrchr(ptr, 0); + strrev(ptr); + strspn(ptr, ptr); + strstr(ptr, ptr); + strtok(ptr, ptr); + strupr(ptr); +} + +static void call_test13(void) +{ + settime(NULL); + gettime(NULL); + setdate(NULL); + getdate(NULL); + utime(NULL, NULL); + get_utime(0); + _filetime(0, NULL); +} + + \ No newline at end of file diff --git a/code/SIBOSDK/src/epoc.a b/code/SIBOSDK/src/epoc.a new file mode 100644 index 0000000..6485729 --- /dev/null +++ b/code/SIBOSDK/src/epoc.a @@ -0,0 +1,751 @@ +(* *) +(* Release 3.00 *) +(* *) +(* Epoc/Os - Interface routines *) +(* *) +(* Copyright (C) 1991 Psion PLC. All Rights Reserved *) +(* Written by NSM. *) +(* *) +(************************************************************************) + +include "corelib.inc" +include "epocdefs.inc" + +module Epoc + +(***************************************************************************) +section +segment _TEXT(CODE,28H) +segment _DATA(DATA,28H) + +__ServerName: db "SYS$FSRV.*",0 +__FileDevName: db "FIL",0 + +segment _BSS(BSS,28H) + +public __FServerPid : org 2 (* File server process id *) +public __FilDeviceHandle : org 2 (* File device driver handle *) + +select _TEXT + +public __EpocInit : + + sub al, al + mov ah, NmFilConnect + int FilManager + sub bx, bx + sub sp, MaxNameESize + 2 + mov si, sp + mov di, __ServerName + mov ah, NmProcFind + int ProcManager + mov [__FServerPid], ax + sub bx, bx + mov dx, LDDSignature + mov di, __FileDevName + mov si, sp + mov ah, NmDevFind + int DevManager + mov [__FilDeviceHandle], ax + add sp, MaxNameESize + 2 + ret 0 + +(***************************************************************************) +section +segment _TEXT(CODE,28H) + +public __allocInfo : + + push ax + push bx + push di + push si + mov si, ax (* Arg 1 *) + mov ah, NmProcId + int ProcManager + mov di, ax + int GenDataSegment + and di, PidMask + mov ax, es:[di][ProcMemBasePtr] + test ax, ax + je infoExit + mov [bx], ax + add ax, MemEnt + mov [si], ax +infoExit: + pushf + cli + mov bx, ss + mov es, bx + popf + pop si + pop di + pop bx + pop ax + ret 0 + +(***************************************************************************) +section +segment _TEXT(CODE,28H) + +select _TEXT + + +public __heapTop : + + push bx + mov ah, NmProcId + int ProcManager + mov bx, ax + and bx, PidMask + int GenDataSegment + mov bx, es:[bx][ProcDataSeg] + pushf + cli + mov ax, es:[bx][SegEnt][SegBase] + sub ax, es:[bx][SegBase] + mov bx, ss + mov es, bx + popf + shl ax, 1 + shl ax, 1 + shl ax, 1 + shl ax, 1 + pop bx + ret 0 + +(***************************************************************************) +section +segment _TEXT(CODE,28H) + +public _getpid : + + mov ah, NmProcId + int ProcManager + ret 0 + +(***************************************************************************) +section +segment _TEXT(CODE,28H) + +public __getDateAndTime : + + pop ax + sub sp, DateEnt + mov si, sp + sub sp, DyScEnt + mov di, sp + push ax + push bx + mov ah, NmTimGetSystemTime + int TimManager + push cx + push dx + mov cx, ax + mov dx, bx + mov ah, NmTimSystemTimeToDaySeconds + int TimManager + pop dx + pop cx + xchg di, si + mov ah, NmTimDaySecondsToDate + int TimManager + pop bx + ret 0 + +(***************************************************************************) +section +segment _TEXT(CODE,28H) + +public __setDateAndTime : + + lea si, [di][-DyScEnt] + xchg si, di + mov ah, NmTimDateToDaySeconds + int TimManager + xchg si, di + mov ah, NmTimDaySecondsToSystemTime + int TimManager + push bx + push cx + push dx + mov cx, ax + mov dx, bx + mov ah, NmTimSetSystemTime + int TimManager + pop dx + pop cx + pop bx + ret 0 + +(****************************************************************************) +section +segment _TEXT(CODE,28H) + +(* WORDREGS Structure *) + +_ax = 0 +_bx = 2 +_cx = 4 +_dx = 6 +_si = 8 +_di = 10 +_cflag = 12 +_flags = 14 + +extrn __ioerr + +public _int86x : +public _int86 : +(* +int int86(int intnum, union REGS *inregs, union REGS *outregs) +loads 086 registers and executes interrupt. AX value is returned. If the +carry flag is set cflag is !=0 and _doserrno is set to the error code. +*) + + push di + push si + mov si, bx + mov di, cx + int GenIntByNumber + mov [di][_flags], ax + mov word [di][_cflag], 0 + jnc noCarry + inc word [di][_cflag] + mov ax, [di][_ax] + call __ioerr +noCarry: + mov ax, [di][_ax] + pop si + pop di + ret 0 + +(******************************************************************************) +section +segment _TEXT(CODE,28H) + +public _intr : + +(* REGPACK Structure *) + +r_ax = 0 +r_bx = 2 +r_cx = 4 +r_dx = 6 +r_bp = 8 +r_si = 10 +r_di = 12 +r_ds = 14 +r_es = 16 +r_flags = 18 + + push ax + push bx + push di + push si + mov si, bx + mov di, bx + mov bx, [si][r_si] + xchg bx, [si][r_bp] + xchg bx, [si][r_di] + mov [si][r_di], bx + int GenIntByNumber + mov [di][r_flags], ax + mov ax, [di][r_di] + xchg ax, [di][r_bp] + xchg ax, [di][r_si] + mov [di][r_di], bx + pop si + pop di + pop bx + pop ax + ret 0 + +(******************************************************************************) +section +segment _TEXT(CODE,28H) + +public __iopen : + + push dx + push di + mov di, ax + sub dx, dx + mov ah, NmIoOpen + int DevManager + jc openFailed + mov [di], ax + sub al, al +openFailed: + cbw + pop di + pop dx + ret 0 + +(******************************************************************************) +section +segment _TEXT(CODE,28H) + +public __iow2 : +public __iow3 : +public __iow4 : + + xchg ax, bx + mov ah, NmIoWithWait + int IoManager + jnc iowOk + cbw +iowOk: + ret 0 + +(******************************************************************************) +section +segment _TEXT(CODE,28H) + +public __parse : + + push di + push si + mov si, dx + mov di, cx + mov cx, bx + mov bx, ax + sub al, al + mov ah, NmFilParse + int FilManager + jc parseFailed + sub al, al +parseFailed: + cbw + pop si + pop di + ret 0 + +(******************************************************************************) +section +segment _TEXT(CODE,28H) + +DaySeconds = -DyScEnt +DateF = -(DyScEnt+DateEnt) +locals = (DyScEnt+DateEnt) + +public __convTimeToDos : + + push di + push si + push dx + push cx + push bp + mov bp, sp + sub sp, locals + mov cx, bx + mov dx, ax + mov ax, cx + cmp dh, 0A6H + sbb ax, 012CEH + jnc timeOk + mov cx, 012CEH + mov dx, 0A600H +timeOk: + lea di, [bp][DaySeconds] + mov ah, NmTimSystemTimeToDaySeconds + int TimManager + mov si, di + lea di, [bp][DateF] + mov ah, NmTimDaySecondsToDate + int TimManager + xor ah, ah + mov al, [di][DateHour] + mov cx, 6 + shl ax, cl + or al, [di][DateMinute] + dec cx + shl ax, cl + mov bl, [di][DateSecond] + shr bl, 1 + or al, bl + xor dh, dh + mov dl, [di][DateYear] + sub dl, 80 + mov cx, 4 + shl dx, cl + or dl, [di][DateMonth] + inc dx + inc cx + shl dx, cl + or dl, [di][DateDay] + inc dx + add sp, locals + pop bp + pop cx + mov di, cx + mov [di], dx + pop dx + mov di, dx + mov [di], ax + pop si + pop di + ret 0 + +(******************************************************************************) +section +segment _TEXT(CODE,28H) +segment _DATA(DATA,28H) + +extrn __FServerPid +extrn __FilDeviceHandle + +select _TEXT + +public __FsChanToName : + + push ax + push bx + push cx + push di + push si + push bx + push si + mov di, sp + mov si, ax + mov ax, [__FilDeviceHandle] + cmp [si][ChanLibHandle], ax + je isAFileHandle + pop si + pop di + and byte [di], 0 + jmp chanExit +isAFileHandle: + mov si, [si][FilHandle] + add si, FsyFileName + mov bx, [__FServerPid] + mov cx, 2 + int ProcCopyFromById + pop si + pop di + mov cx, MaxPathSize + int ProcCopyFromById +chanExit: + pop si + pop di + pop cx + pop bx + pop ax + ret 0 + +(******************************************************************************) +section +segment _TEXT(CODE,28H) +segment _DATA(DATA,28H) + +extrn __FServerPid +extrn __FilDeviceHandle + +select _TEXT + +public __FsChanToMode : + + push bx + push cx + push di + push si + mov di, sp + mov si, ax + mov ax, [__FilDeviceHandle] + cmp [si][ChanLibHandle], ax + mov ax, -1 + jne modeExit + push ax + mov di, sp + mov si, [si][FilHandle] + add si, FsyFileMode + mov bx, [__FServerPid] + mov cx, 2 + int ProcCopyFromById + pop ax +modeExit: + pop si + pop di + pop cx + pop bx + ret 0 + +(******************************************************************************) +section +segment _TEXT(CODE,28H) + +public __systemTimeToDaySeconds : + + push ax + push cx + push dx + push di + mov di, cx + mov dx, ax + mov cx, bx + mov ah, NmTimSystemTimeToDaySeconds + int TimManager + pop di + pop dx + pop cx + pop ax + ret 0 + +(******************************************************************************) +section +segment _TEXT(CODE,28H) + +public __daySecondsToSystemTime : + + push bx + push si + mov si, ax + mov ah, NmTimDaySecondsToSystemTime + int TimManager + mov dx, ax + mov ax, bx + pop si + pop bx + ret 0 + +(******************************************************************************) +section +segment _TEXT(CODE,28H) + +public __daySecondsToDate : + + push ax + push di + push si + mov si, ax + mov di, bx + mov ah, NmTimDaySecondsToDate + int TimManager + pop si + pop di + pop ax + ret 0 + +(******************************************************************************) +section +segment _TEXT(CODE,28H) + +public __dateToDaySeconds : + + push di + push si + mov si, ax + mov di, bx + mov ah, NmTimDateToDaySeconds + int TimManager + mov ax, 0 + jnc convOk + dec ax +convOk: + pop si + pop di + ret 0 + +(******************************************************************************) +section +segment _TEXT(CODE,28H) + +public __date : + + push bx + mov ah, NmTimGetSystemTime + int TimManager + mov dx, ax + mov ax, bx + pop bx + ret 0 + +(******************************************************************************) +section +segment _TEXT(CODE,28H) + +public __fileInfo : + + push bx + push cx + mov cx, bx + mov bx, ax + sub al, al + mov ah, NmFilStatusGet + int FilManager + jc gotFailed + sub al, al +gotFailed: + cbw + pop cx + pop bx + ret 0 + +(******************************************************************************) +section +segment _TEXT(CODE,28H) + +public __fileSetModTime : + + push bx + push cx + push di + mov di, cx + mov cx, bx + mov bx, ax + sub al, al + mov ah, NmFilSetFileDate + int FilManager + jc setFailed + sub al, al +setFailed: + cbw + pop di + pop cx + pop bx + ret 0 + +(******************************************************************************) +section +segment _TEXT(CODE,28H) + +public __getPath : + + push ax + push bx + mov bx, ax + sub al, al + mov ah, NmFilPathGet + int FilManager + pop bx + pop ax + ret 0 + +(******************************************************************************) +section +segment _TEXT(CODE,28H) + +public __setPath : + + push ax + push bx + mov bx, ax + sub al, al + mov ah, NmFilPathSet + int FilManager + jc setFailed + sub al, al +setFailed: + cbw + pop bx + pop ax + ret 0 + +(******************************************************************************) +section +segment _TEXT(CODE,28H) + +public __sleepTenths : + + push ax + push cx + push dx + mov dx, ax + mov cx, bx + mov ah, NmTimSleepForTenths + int TimManager + pop dx + pop cx + pop ax + ret 0 + +(******************************************************************************) +section +segment _TEXT(CODE,28H) + +public ___execc : + + push bx + push cx + push di + push ax + mov di, sp + mov cx, bx + mov bx, ax + sub al, al + mov ah, NmFilExecute + int FilManager + jnc gotHandle + cbw + mov [di], ax +gotHandle: + pop ax + pop di + pop cx + pop bx + ret 0 + +(******************************************************************************) +section +segment _TEXT(CODE,28H) + +public __logon : + + push bx + push di + mov di, bx + mov bx, ax + mov ah, NmIoSignalKillAsynchronous + int IoManager + jc logonFailed + sub al, al +logonFailed: + cbw + pop di + pop bx + ret 0 + +(******************************************************************************) +section +segment _TEXT(CODE,28H) + +public __waitStat : + + push ax + push di + mov di, ax + mov ah, NmIoWaitForStatus + int IoManager + pop di + pop ax + ret 0 + +(******************************************************************************) +section +segment _TEXT(CODE,28H) + +public __resume : + + push bx + mov bx, ax + mov ah, NmProcResume + int ProcManager + jc resFailed + sub al, al +resFailed: + cbw + pop bx + ret 0 + +(******************************************************************************) +section +segment _TEXT(CODE,28H) + +public __getErrorText : + + mov ah, NmGenGetErrorText + int GenManager + mov ax, bx + ret 0 + +end diff --git a/code/SIBOSDK/src/epoc1.c b/code/SIBOSDK/src/epoc1.c new file mode 100644 index 0000000..dbb11b3 --- /dev/null +++ b/code/SIBOSDK/src/epoc1.c @@ -0,0 +1,744 @@ +/* Release 3.00 */ + +/*-------------------------------------------------------------------------* +* * +* Epoc1.c - Epoc/Os interface routines * +* * +* COPYRIGHT (C) 1991 Psion PLC. All Rights Reserved * +* Written by NSM. * +* * +*--------------------------------------------------------------------------*/ + +#define _USE_CONIO +#define _USE_TIME +#include + +#define SZMBLK sizeof(_MBLOCK) /* size of free cell header */ +#define SZHD sizeof(unsigned int) /* size of allocated cell header */ + +extern char DatHeapLocked; + +int _nheapwalk(struct _nheapinfo *pE) +/* +Walks through every cell in the heap (whether allocated +or free) from low to high address. Also checks the heap +for consistency and returns an error if something is wrong. +*/ + { + int ret; + _MBLOCK *p1,*p2; + + ret=_HEAPOK; + DatHeapLocked++; + if (pE->_pentry==NULL) + { + if (_allocInfo(&p1,&p2)==0) + { + ret=_HEAPEMPTY; + goto walkExit; + } + goto advanceFreePtr; + } + else + { + if (pE->_useflag) /* Was allocated */ + { + p1=(_MBLOCK *)(((char *)pE->_pentry)-SZHD); + p2=pE->_secret; + } + else /* Was free */ + { + p2=(_MBLOCK *)(((char *)pE->_pentry)-SZMBLK); + p1=pE->_secret; + } + if (p1mlen); + else /* Free cell is before allocated cell */ + { +advanceFreePtr: + p2=p2->mnext; /* Points to first free cell */ + if (p2!=NULL && + ((((int)p2)&1) || (p2>_heapTop()-1) || + (p2->mnext && p2->mnextmlenmlen&1) || + p1->mlen>((char *)p2-(char *)p1)) + { +badNode: + ret=_HEAPBADNODE; + } + pE->_pentry=(int *)(((char *)p1)+SZHD); + pE->_size=p1->mlen-SZHD; + pE->_secret=p2; + pE->_useflag=1; + } + else if (p2) + { + p1=(_MBLOCK *)(((char *)p2)+p2->mlen); /* next allocated cell */ +returnFree: + pE->_pentry=(int *)(((char *)p2)+SZMBLK); + pE->_size=p2->mlen-SZMBLK; + pE->_secret=p1; + pE->_useflag=0; + } + else if (_heapTop()!=p1) + goto badNode; + else + ret=_HEAPEND; +walkExit: + DatHeapLocked--; + return(ret); + } + +static int heapDoIt(int flag,int fill) +/* +Actually does _nheapchk() and _nheapset(). +*/ + { + int ret; + struct _nheapinfo hi; + + hi._pentry=NULL; + while ((ret=_nheapwalk(&hi))==_HEAPOK) + { + if (flag && hi._useflag==0) + memset(hi._pentry,(char)fill,hi._size); + } + if (ret==_HEAPEND) + ret=_HEAPOK; + return(ret); + } + +int _nheapchk(void) +/* +Check the entire heap for consistency. +*/ + { + + return(heapDoIt(0,0)); + } + +int _nheapset(int fill) +/* +Check the entire heap for consistency and fill all +free cells with fill as we go along. +*/ + { + + return(heapDoIt(1,fill)); + } + +size_t _memmax(void) +/* +Returns the size of the biggest free cell. +*/ + { + size_t ret,i; + _MBLOCK *p1,*p2; + + ret=0; + DatHeapLocked++; + if (_allocInfo(&p1,&p2)==0) + goto memExit; + while ((p2=p2->mnext)!=NULL) /* Scan free cells */ + { + i=p2->mlen-sizeof(unsigned int); + if (i>ret) + ret=i; + } + i=(unsigned int)0xfe00-(unsigned int)_heapTop()-sizeof(unsigned int); + if (i>ret) + ret=i; +memExit: + DatHeapLocked--; + return(ret); + } + +static unsigned int memCalc(unsigned int num,unsigned int den) +/* +Works out how many times den will fit into num, where num is +the size of a free block in the heap. +*/ + { + unsigned int ret; + + num-=sizeof(unsigned int); + ret=num/den; + if (ret && (num%den)mnext)!=NULL) /* Scan free cells */ + ret+=memCalc(p2->mlen,_size); + ret+=memCalc((unsigned int)0xfe00-(unsigned int)_heapTop(),_size); +freeExit: + DatHeapLocked--; + return(ret); + } + +char *_d_cgets(char *s) +/* +Read a string of characters directly from the console. +*/ + { + int i,c,maxLen,ql; + char *p,*q; + static char _b1[] = {'\b',' ','\b'}; + static char _b2[] = {'\b','\b',' ',' ','\b','\b'}; + static char _cr[] = {'\r'}; + + maxLen=(s[0]&0xff); + p=(&s[2]); + i=0; + while ((c=getch())!='\r') + { + if (c=='\b') + { + if (i) + { + i--; + if (p[i]<' ') + { + q=(&_b2[0]); + ql=sizeof(_b2); + } + else + { + q=(&_b1[0]); + ql=sizeof(_b1); + } + _iow4(winHandle,P_FWRITE,q,&ql); + } + } + else if (iff_reserved[0]; + r->handle=h; + r->ctl=_dNext; + r->magic=_dctl[_dNext].magic; + r->attrib=(attrib&0xff); + r->first=ENOENT; + _dctl[_dNext++].handle=h; + if (_dNext>=MAXD) + _dNext=0; + return(findnext(b)); +} + +int findnext(struct ffblk *b) +/* +Find the next directory entry. +*/ + { + int a; + _DRES *r; + P_INFO f; + + r=(_DRES *)&b->ff_reserved[0]; + if (_dctl[r->ctl].magic!=r->magic) + { +failed: + errno=(r->first ? ENOENT : ENMFILE); + return(-1); + } + do + { + if ((a=_iow4(r->handle,P_FREAD,&b->ff_name[0],&f))<0) + { + _iow2(r->handle,P_FCLOSE); + _dctl[r->ctl].handle=0; + _dctl[r->ctl].magic++; + _ioerr(a); + return(-1); + } + a=f.status&(FA_HIDDEN|FA_SYSTEM|FA_LABEL|FA_DIREC); + } while (a && (a&r->attrib)==0); + b->ff_attrib=(f.status&0xff)^1; + b->ff_fsize=f.size; + _convTimeToDos(f.modst,&b->ff_fdate,&b->ff_ftime); + return(0); + } + +int utime(char *path,struct utm *ftime) +/* +Set the modification time of a file. +*/ + { + INT ret; + P_DATE dt; + P_DAYSEC ds; + time_t t; + + if (ftime) + { + dt.year=ftime->u_year+80; + dt.month=ftime->u_mon-1; + dt.day=ftime->u_day-1; + dt.hour=ftime->u_hour; + dt.minute=ftime->u_min; + dt.second=ftime->u_sec; + _dateToDaySeconds(&dt,&ds); + t=_daySecondsToSystemTime(&ds); + } + else + t=_date(); + if ((ret=_fileSetModTime(path,t))<0) + { + _ioerr(ret); + return(-1); + } + return(0); + } + +int _filetime(int handle,struct utm *ftime) +/* +Get the modified time of the file open on handle. +*/ + { + int ret; + char name[P_FNAMESIZE]; + P_DAYSEC ds; + P_DATE dt; + P_INFO pI; + + _FsChanToName(getRealHandle(handle),&name[0]); + if (name[0]) + { + if ((ret=_fileInfo(&name[0],&pI))<0) + { + _ioerr(ret); + return(-1); + } + _systemTimeToDaySeconds((time_t)pI.modst,&ds); + _daySecondsToDate(&ds,&dt); + if (dt.year<80) + goto baseDate; + } + else + { +baseDate: + memset(&dt,0,sizeof(dt)); + dt.year=80; + } + ftime->u_year=dt.year-80; + ftime->u_mon=dt.month+1; + ftime->u_day=dt.day+1; + ftime->u_hour=dt.hour; + ftime->u_min=dt.minute; + ftime->u_sec=dt.second; + return(0); + } + +int _filedrive(int handle) +/* +Return the drive letter if on LOC:: file system. +*/ + { + char name[P_FNAMESIZE]; + + _FsChanToName(getRealHandle(handle),&name[0]); + if (name[0] && memcmp("LOC",&_pname[0],3)==0) + return(name[5]-'A'); + return(0); + } + +int _execc(const char *path, char **argv, int mode) +/* +Generalised exec call. +*/ + { + int pid; + WORD stat; + char *p,*pe,*s,name[P_FNAMESIZE],command[0x80]; + + if (mode&_E_SEARCH) + { + mode&=(~_E_SEARCH); + if (_parse(path,".img",&_pname[0],&_pinfo)<0) + { + errno=EINVAL; + return(-1); + } + _searchenv(&_pname[_pinfo.system+_pinfo.device+_pinfo.path],"PATH",&name[0]); + if (name[0]==0) + { + errno=ENOENT; + return(-1); + } + } + else + strcpy(&name[0],path); + argv++; + p=(&command[0]); + pe=p+0x7f; + while (*argv) + { + *p++=' '; + s=(*argv++); + while (p=pe) + { + errno=E2BIG; + return(-1); + } + } + *p++=0; + command[0]=p-(&command[1]); + if ((pid=__execc(&name[0],&command[0]))<0) + { + _ioerr(pid); + return(-1); + } + if (mode&_E_EXEC || mode==P_OVERLAY) + { + _resume(pid); + exit(0); + } + if (mode==P_NOWAIT) + { + _resume(pid); + return(pid); + } + _logon(pid,&stat); + _resume(pid); + _waitStat(&stat); + return(stat); + } + +int getdisk(void) +/* +Get the current disk. +*/ + { + + _getPath(&_pname[0]); + if (!_isloc(&_pname[0])) + return(0); + return(_pname[5]-'A'); + } + +int setdisk(int drive) +/* +Set the current disk. +*/ + { + void *h; + + _getPath(&_pname[0]); + if (!_isloc(&_pname[0])) + return(0); + _pname[5]='A'+drive; + _setPath(&_pname[0]); + _iopen(&h,"LOC::",P_FDEVICE); + drive=0; + while (_iow3(h,P_FREAD,&_pname[0])>=0) + drive++; + _iow2(h,P_FCLOSE); + return(drive); + } + +int getftime(int handle,struct ftime *f) +/* +Get the file time from and open file. +*/ + { + int ret; + struct utm ftime; + + if ((ret=_filetime(handle, &ftime))<0) + return(ret); + f->ft_tsec = (unsigned) (ftime.u_sec>>1); + f->ft_min = (unsigned) ftime.u_min; + f->ft_hour= (unsigned) ftime.u_hour; + f->ft_day= (unsigned) ftime.u_day; + f->ft_month= (unsigned) ftime.u_mon; + f->ft_year=ftime.u_year+1980; + return(0); + } + +long _lseek(void *handle, long offset, int where) +/* +Seek on a file by handle. +*/ + { + int ret,mode; + long endPos,newPos; + + switch (where) + { + case SEEK_CUR: + mode=P_FCUR; + goto doSeek; + case SEEK_END: + mode=P_FEND; +doSeek: + newPos=0l; + _iow4(handle,P_FSEEK,&mode,&newPos); + newPos+=offset; + break; + case SEEK_SET: + newPos=offset; + } + if (newPos<0) + newPos=0; + endPos=newPos; + mode=P_FABS; + if ((ret=_iow4(handle,P_FSEEK,&mode,&newPos))<0) + goto failed; + if (newPos!=endPos) + { + newPos=endPos; + if (_FsChanToMode(handle)&P_FUPDATE) + { + if ((ret=_iow3(handle,P_FSETEOF,&newPos))<0) + goto failed; + if ((ret=_iow4(handle,P_FSEEK,&mode,&newPos))<0) + { +failed: + _ioerr(ret); + return(-1); + } + } + } + return(newPos); + } + +void gotoxy(int x, int y) +/* +Position the consol channel. +*/ + { + UWORD mode; + P_POINT p; + + p.x=x-1; + p.y=y-1; + mode=P_SCR_POSA; + _iow4(winHandle,P_FSET,&mode,&p); + } + +int wherex(void) +/* +Return the X cursor position. +*/ + { + P_RECTP rp; + + _iow3(winHandle,P_FSENSE,&rp); + return(rp.p.x+1); + } + +int wherey(void) +/* +Return the Y cursor position. +*/ + { + P_RECTP rp; + + _iow3(winHandle,P_FSENSE,&rp); + return(rp.p.y+1); + } + +void clrscr(void) +/* +Clear the screen. +*/ + { + UWORD mode; + P_RECTP rp; + + _iow3(winHandle,P_FSENSE,&rp); + mode=P_SCR_CLR; + _iow4(winHandle,P_FSET,&mode,&rp.r); + gotoxy(1,1); + } + +void cursoron(void) +/* +Switch the cursor on. +*/ + { + UWORD mode,flag; + + flag=TRUE; + mode=P_SCR_CURSOR; + _iow4(winHandle,P_FSET,&mode,&flag); + } + +void cursoroff(void) +/* +Switch the cursor off. +*/ + { + UWORD mode,flag; + + flag=FALSE; + mode=P_SCR_CURSOR; + _iow4(winHandle,P_FSET,&mode,&flag); + } + +void setwrap(int flag) +/* +Switch the wrap mode. +*/ + { + UWORD mode; + + flag=(flag ? 1 : 0); + mode=P_SCR_WLOCK; + _iow4(winHandle,P_FSET,&mode,&flag); + } + +static void xLine(int flag) +/* +Insert or delete the line containg the cursor. +*/ + { + UWORD mode; + P_RECTP rp; + + _iow3(winHandle,P_FSENSE,&rp); + rp.r.tl.x=0; + rp.r.tl.y=rp.p.y; + rp.p.x=0; + rp.p.y=flag; + mode=P_SCR_SCROLL; + _iow4(winHandle,P_FSET,&mode,&rp); + } + +void insline(void) +/* +Insert a line. +*/ + { + + xLine(1); + } + +void delline(void) +/* +Delete a line. +*/ + { + + xLine(-1); + } + +void clreol(void) +/* +Clear to the end of line. +*/ + { + UWORD mode; + P_RECTP rp; + + _iow3(winHandle,P_FSENSE,&rp); + rp.r.tl=rp.p; + rp.r.br.y=rp.p.y+1; + mode=P_SCR_CLR; + _iow4(winHandle,P_FSET,&mode,&rp.r); + } + diff --git a/code/SIBOSDK/src/fstream.cpp b/code/SIBOSDK/src/fstream.cpp new file mode 100644 index 0000000..d22f2b7 --- /dev/null +++ b/code/SIBOSDK/src/fstream.cpp @@ -0,0 +1,468 @@ +/* Release 3.10 */ +/*-------------------------------------------------------------------------* +* * +* FSTREAM.CPP - 2.1 file stream class implementations. * +* * +* COPYRIGHT (C) 1989..1992 Clarion Software Corporation. * +* All Rights Reserved * +* * +*--------------------------------------------------------------------------*/ + +#include +#include + +#pragma module(init_prio=>22) + +_STATIC int get_mode(int h); + +//************************************************************************** +// fstream implementation +//************************************************************************** + +const int filebuf::openprot = S_IREAD|S_IWRITE; + + +filebuf::filebuf() { + + xfd=EOF; + opened=0; + mode=0; + last_seek=0; + in_start=NULL; + setp(base(), ebuf()); + setg(base(), ebuf(), ebuf()); +} + +filebuf::filebuf(int h) { + + xfd=h; + if(h != -1) { + opened=1; + mode=get_mode(h); + } + else + opened=0; + last_seek=0; + in_start=NULL; + setp(base(), ebuf()); + setg(base(), ebuf(), ebuf()); +} + +filebuf::filebuf(int h, char *s, int sz) : streambuf(s, sz) { + + xfd=h; + if(h != -1) { + opened=1; + mode=get_mode(h); + } + else + opened=0; + last_seek=0; + in_start=NULL; + if(unbuffered()) { + setb(lahead, &lahead[1], 0); + setp(base(), base()); + unbuffered(1); + } + else + setp(base(), ebuf()); + setg(base(), ebuf(), ebuf()); +} + +filebuf::~filebuf() { + + if(xfd != EOF) + close(); +} + +filebuf* filebuf::open(const char *path, int fmode, int permission) + { + unsigned om; + + if(opened) + close(); + if(fmode&ios::binary) + om=O_BINARY; + else + om=O_TEXT; + if((fmode&(ios::in|ios::out)) == (ios::in|ios::out)) + om|=O_RDWR; + else if(fmode&ios::in) + om|=O_RDONLY; + else if(fmode&ios::out) + om|=O_WRONLY; + if(om&(O_WRONLY|O_RDWR)) + { + if(fmode&ios::app) + om|=O_APPEND; + if(fmode&ios::trunc) + om|=O_TRUNC; + if(!(fmode&ios::nocreate)) + om|=O_CREAT; + } + if((fmode&ios::noreplace) && (_exists(path))) + xfd=EOF; + else + xfd=::open(path, om, permission); // translate fmode + if(xfd != EOF) + { + opened=1; + mode =fmode; + if(fmode&(ios::ate|ios::app)) + last_seek=lseek(xfd, 0L, SEEK_END); + else + last_seek=0; + return this; + } + else + { + opened=0; + return NULL; + } + } + +filebuf* filebuf::close() { + + if(opened) { + sync(); + ::close(xfd); + } + return this; +} + +filebuf* filebuf::attach(int h) { + + if(opened) + return 0; + xfd=h; + if(h != EOF) { + opened=1; + mode=get_mode(h); + } + else + opened=0; + return this; +} + +_STATIC int get_mode(int h) { + + int mode; + + if(h >= _open_max) + return (ios::in|ios::out); + if(_openfd[h]&O_BINARY) + mode=ios::binary; + else + mode=0; + if(_openfd[h]&O_RDWR) + mode |= ios::in|ios::out; + else if(_openfd[h]&O_WRONLY) + mode |= ios::out; + else + mode |= ios::in; + if(_openfd[h]&O_APPEND) + mode |= ios::app; + return mode; +} + +_STATIC int translate(char *buf, int num, int h) { + + int ip, op, c; + + ip=0; + op=0; + while(ip < num) { + c=buf[ip]; + if(c != 0xD) { + buf[op++]=c; + } + ++ip; + } + if((buf[ip-1] == 0xD) && (num > 1)) + ::lseek(h, -1L, SEEK_CUR); + return op; +} + +_STATIC int real_off(char *buf, int num) { + + int p, n; + + p=0; + n=0; + if(num > 0) { + while(p < num) { + if(buf[p++] == 0xA) + n+=2; + else + ++n; + } + return n; + } + while(p >= num) { + if(buf[--p] == 0xA) + n+=2; + else + ++n; + } + return -n; +} + +int filebuf::last_op() { + + int ret; + + if(pptr() > pbase()) + ret= ios::out; + else if(in_start) + ret= ios::in; + else + ret = 0; + return ret; +} + +int filebuf::overflow(int c) { + + int nw; + + if(unbuffered()) { + if((c == EOF) || (::write(xfd, &c, sizeof(char)) == -1)) + return EOF; + nw=1; + } + else { + nw=pptr()-pbase(); + if(nw) { + if(::write(xfd, pbase(), nw) == -1) + return EOF; + } + } + last_seek+=nw; + setp(pbase(), epptr()); + if((c != EOF) && (!unbuffered())) + sputc(c); + return c; +} + +int filebuf::underflow() { + + int nr; + + if(unbuffered()) + in_start=eback(); + else + in_start=eback()+4; + nr=ebuf()-in_start; + last_seek=tell(xfd); + if((nr=::_read(xfd, in_start, nr)) <= 0) + return EOF; + if(!(mode&ios::binary)) + nr=translate(in_start, nr, xfd); + setg(eback(), in_start, in_start+nr); + return (unsigned char) *gptr(); +} + +int filebuf::sync() { + + streampos pos; + int lo; + + if(!opened) + return EOF; + lo=last_op(); + if(lo == ios::out) + overflow(); + else if(lo == ios::in) { + if(mode&ios::binary) + pos = gptr()-in_start + last_seek; + else + pos = real_off(in_start, gptr()-in_start) + last_seek; + last_seek = ::lseek(xfd, pos, SEEK_SET); + } + else + return 0; + setp(pbase(), epptr()); + setg(base(), ebuf(), ebuf()); + in_start=NULL; + return 0; +} + +streampos filebuf::seekoff(streamoff off, ios::seek_dir d, int ) { + + streampos p; + ios::seek_dir dir; + int lo; + + if(opened) { + if((!unbuffered()) && (d == ios::cur)) { + lo=last_op(); + if(lo == ios::out) { + if(mode&ios::binary) + p = pptr()-pbase(); + else + p = real_off(pbase(), pptr()-pbase()); + } + else if(lo == ios::in) { + if(mode&ios::binary) + p = gptr()-in_start; + else + p = real_off(eback(), gptr()-in_start); + } + else + p=0; + p += last_seek + off; + dir=ios::beg; + } + else { + p=off; + dir=d; + } + sync(); + last_seek = ::lseek(xfd, p, dir); + setp(pbase(), epptr()); + setg(base(), ebuf(), ebuf()); + return last_seek; + } + return (streampos) -1; +} + +streambuf* filebuf::setbuf(char *s, int sz) { + + if(opened || (base() && (!unbuffered()))) + return NULL; + setb(s, s+sz, 0); + if(s) { + setp(s, s+sz); + setg(s, s+sz, s+sz); + } + else { + setp(NULL, NULL); + setg(NULL, NULL, NULL); + } + return this; +} + +//**************************************************************************//************************************************************************** +// fstreambase implementation +//************************************************************************** + +fstreambase::fstreambase() { + +} + +fstreambase::fstreambase(int h) : buf(h) { + +} + + +fstreambase::fstreambase(int h, char *s, int sz) : buf(h, s, sz) { + +} + +fstreambase::fstreambase(const char *path, int mode, int permission) { + + buf.open(path, mode, permission); + if(!buf.is_open()) + setstate(failbit); +} + + +fstreambase::~fstreambase() { + +} + +void fstreambase::open(const char *path, int mode, int permission) { + + buf.open(path, mode, permission); + if(!buf.is_open()) + state|=failbit; +} + +void fstreambase::attach(int h) { + + if(buf.attach(h) == NULL) + state|=failbit; +} + +void fstreambase::close() { + + buf.close(); +} + +void fstreambase::setbuf(char *b, int sz) { + + buf.setbuf(b, sz); +} + +//**************************************************************************//************************************************************************** +// ifstream implementation +//************************************************************************** + +ifstream::ifstream() : istream(rdbuf()) { + +} + +ifstream::ifstream(const char* path, int mode, int prot) : istream(rdbuf()) { + + if(rdbuf()->open(path, mode, prot) == NULL) + setstate(badbit); +} + +ifstream::ifstream(int h) : istream(rdbuf()), + fstreambase(h) { + +} + +ifstream::ifstream(int h, char* b, int sz) : istream(rdbuf()), + fstreambase(h, b, sz) { +} + +ifstream::~ifstream() { + +} + +ofstream::ofstream() : ostream(rdbuf()) { + +} + +ofstream::ofstream(const char* path, int mode, int prot) : ostream(rdbuf()) { + + if(rdbuf()->open(path, mode, prot) == NULL) + setstate(badbit); +} + +ofstream::ofstream(int h) : ostream(rdbuf()), + fstreambase(h) { + +} + +ofstream::ofstream(int h, char* b, int sz) : ostream(rdbuf()), + fstreambase(h, b, sz) { +} + +ofstream::~ofstream() { + +} + +fstream::fstream() : iostream(rdbuf()) { + +} + +fstream::fstream(const char* path, int mode, int prot) : iostream(rdbuf()) { + + if(rdbuf()->open(path, mode, prot) == NULL) + setstate(badbit); +} + +fstream::fstream(int h) : iostream(rdbuf()), + fstreambase(h) { + +} + +fstream::fstream(int h, char* b, int sz) : iostream(rdbuf()), + fstreambase(h, b, sz) { +} + +fstream::~fstream() { + +} + \ No newline at end of file diff --git a/code/SIBOSDK/src/iclib.a b/code/SIBOSDK/src/iclib.a new file mode 100644 index 0000000..cede6f7 --- /dev/null +++ b/code/SIBOSDK/src/iclib.a @@ -0,0 +1,9 @@ +(* 8K Epoc C header for use with CLIB *) +(* Release 1.00F NSM *) +(* Copyright (C) Psion PLC 1991 *) + +StackSize = 2000H + +include "iclib.inc" + + diff --git a/code/SIBOSDK/src/iclib.inc b/code/SIBOSDK/src/iclib.inc new file mode 100644 index 0000000..7d33eca --- /dev/null +++ b/code/SIBOSDK/src/iclib.inc @@ -0,0 +1,103 @@ +(* Epoc C header for use with CLIB include file *) +(* Release 1.00F NSM *) +(* Copyright (C) Psion PLC 1991 *) + +include "epocdefs.inc" + +module iclib + +section + +segment _TEXT(CODE,68H) + +segment STACK(STACK,74H) +public __stack_start: + +segment _MAGIC(MAGIC,68H) +public _DatWordDead: dw 0 +public _DatHandNext: dw 0 +public _DatHandPrev: dw 0 +public _DatCountrySeg: dw 0 +public _DatClassHandle: dw 0 +public _DatClassPtr: dw 0 +public _DatEClassHandle: dw 0 +public _DatEClassPtr: dw 0 +public _DatEnterFramePtr: dw 0 +public _w_ws: dw 0 +public _w_am: dw 0 +public _wClientData: dw 0 +public _wserv_channel: dw 0 +public _T: dw 0 +public _r: dw 0 +public _DatOsFramePtr: dw 0 +public _DatATFlag: db 0 +public _DatHeapLocked: db 0 +public _DatProcessNamePtr: dw 0 +public _DatCommandPtr: dw 0 +public _DatTest: dw 0 +public _DatApp1: dw 0 +public _DatApp2: dw 0 +public _DatApp3: dw 0 +public _DatApp4: dw 0 +public _DatApp5: dw 0 +public _DatApp6: dw 0 +public _DatApp7: dw 0 +public _DatDialogPtr: dw 0 +public _DatGate: dw 0 +public _DatLocked: dw 0 +public _DatStatusNamePtr: dw 0 +public _DatUsedPathNamePtr: dw 0 +org StackSize-40H + +segment _INIT(DATA,48H) +public __init_start: + +segment _CONST(DATA,48H) +public __const_start: + dw 0 + +segment _DATA(DATA,68H) +public __data_start: + +segment _BSS(BSS,68H) +public __bss_start: + +segment _BSS_END(BSS,68H) +public __bss_end: + +group DGROUP(_MAGIC,_INIT,_CONST,_DATA,_BSS,_BSS_END) + +select _TEXT + +extrn __startup +extrn _exit +extrn _ExtCatTable +extrn _ClassTable + +public __begin : + + call __startup + ret far 0 + + dw __bss_start + dw _ExtCatTable + dw _ClassTable + dw _DatWordDead + dw __bss_end + +public _p_leave: + int LibLeave + int LibSendExit + + dw __init_start + dw __const_start + +public _p_exit: + mov ax, bx + jmp _exit + +public _p_abort: + mov ax, FailedToStartErr + jmp _exit + +end * diff --git a/code/SIBOSDK/src/iclib2.a b/code/SIBOSDK/src/iclib2.a new file mode 100644 index 0000000..5d632be --- /dev/null +++ b/code/SIBOSDK/src/iclib2.a @@ -0,0 +1,8 @@ +(* 2K stack Epoc C header for use with CLIB *) +(* Release 1.00F NSM *) +(* Copyright (C) Psion PLC 1991 *) + +StackSize = 800H + +include "iclib.inc" + diff --git a/code/SIBOSDK/src/iclib4.a b/code/SIBOSDK/src/iclib4.a new file mode 100644 index 0000000..678005f --- /dev/null +++ b/code/SIBOSDK/src/iclib4.a @@ -0,0 +1,8 @@ +(* 4K stack Epoc C header for use with CLIB *) +(* Release 1.00F NSM *) +(* Copyright (C) Psion PLC 1991 *) + +StackSize = 1000H + +include "iclib.inc" + diff --git a/code/SIBOSDK/src/inst.bat b/code/SIBOSDK/src/inst.bat new file mode 100644 index 0000000..54e8558 --- /dev/null +++ b/code/SIBOSDK/src/inst.bat @@ -0,0 +1,9 @@ +copy iclib*.obj ..\lib +copy iplib*.obj ..\lib +copy icat.obj ..\lib +copy r_emul.obj ..\lib +copy nofloat.obj ..\lib +copy rlib.lib ..\lib +copy clib.lib ..\lib +copy sys$8087.ldd ..\lib + diff --git a/code/SIBOSDK/src/ioinline.cpp b/code/SIBOSDK/src/ioinline.cpp new file mode 100644 index 0000000..13afed0 --- /dev/null +++ b/code/SIBOSDK/src/ioinline.cpp @@ -0,0 +1,332 @@ +/* Release 3.10 */ +/*-------------------------------------------------------------------------* +* * +* IOINLINE.CPP - 2.0 stream class small inline implementations. * +* * +* COPYRIGHT (C) 1989..1992 Clarion Software Corporation. * +* All Rights Reserved * +* * +*--------------------------------------------------------------------------*/ + +#undef _SMALL_INLINE +#include +#include + +streambuf* ios::rdbuf() { + return _bp; +} +ostream* ios::tie() { + return x_tie; +} + +char ios::fill() { + return x_fill; +} + +int ios::precision() { + return x_precision; +} + +int ios::rdstate() { + return state; +} + +int ios::eof() { + return (state&eofbit); +} + +int ios::fail() { + return (state&(failbit|badbit|hardfail)); +} + +int ios::bad() { + return (state&(badbit|hardfail)); +} + +int ios::good() { + return (state == 0); +} + +long ios::flags() { + return x_flags; +} + +int ios::width() { + return x_width; +} + +int ios::width(int _w) { + int _temp = x_width; + x_width = _w; + return _temp; +} + +char ios::fill(char _w) { + char _temp = x_fill; + x_fill = _w; + return _temp; +} + +int ios::precision(int _w) { + int _temp = x_precision; + x_precision = _w; + return _temp; +} + +ios::operator void* () { + return (fail()|eof()) ? 0 : this; +} + +ios::operator! () { + return (fail()|eof()); +} + +char * streambuf::base() { + return _base; +} + +char * streambuf::pbase() { + return _pbase; +} + +char * streambuf::pptr() { + return _pptr; +} + +char * streambuf::epptr() { + return _epptr; +} + +char * streambuf::gptr() { + return _gptr; +} + +char * streambuf::egptr() { + return _egptr; +} + +char * streambuf::eback() { + return _eback; +} + +char * streambuf::ebuf() { + return _ebuf; +} + +int streambuf::unbuffered() { + return _unbuf; +} + +int streambuf::blen() { + return (int) (_ebuf - _base); +} + +void streambuf::pbump(int _n) { + _pptr += _n; +} + +void streambuf::gbump(int _n) { + _gptr += _n; +} + +void streambuf::unbuffered(int _ub) { + _unbuf = (_ub != 0); +} + +int streambuf::in_avail() { + return (_egptr > _gptr) ? (int)(_egptr - _gptr): 0; +} + +int streambuf::out_waiting() { + return _pptr ? (int)(_pptr - _pbase): 0; +} + +int streambuf::allocate() { + return((_base || _unbuf) ? 0 : doallocate()); +} + +int streambuf::sgetc() { + return ((_gptr >= _egptr) ? underflow() : (unsigned char) *_gptr); +} + +int streambuf::snextc() { + return ((++_gptr >= _egptr) ? do_snextc() : (unsigned char) *_gptr); +} + +int streambuf::sbumpc() { + return ((_gptr >= _egptr) && (underflow() == EOF) ? EOF : (unsigned char) *_gptr++); +} + +void streambuf::stossc() { + if (_gptr >= _egptr) + underflow(); + else + ++_gptr; +} + +int streambuf::sputbackc(char _c) { + return (_gptr > _eback) ? *--_gptr = _c : pbackfail(_c) ; +} + +int streambuf::sputc(int _c) { + return (_pptr >= _epptr) ? overflow(_c) : (*_pptr++=_c); +} + + +int istream::gcount() { + return _gcount; +} + +int istream::ipfx(int _need) { + if( _need ? (ispecial&~skipping) : ispecial) + return do_ipfx(_need); + return 1; +} + +int istream::ipfx0() { + return ispecial ? do_ipfx(0) : 1; +} + +int istream::ipfx1() { + return (ispecial&~skipping) ? do_ipfx(1) : 1; +} + +istream& istream::operator>>(unsigned char& _c) { + if(ipfx0()) { + if(_bp->in_avail()) + _c = _bp->sbumpc(); + else + _c = do_get(); + } + return *this; +} + +istream& istream::operator>>(signed char& _c) { + if(ipfx0()) { + if(_bp->in_avail()) + _c = _bp->sbumpc(); + else + _c = do_get(); + } + return *this; +} + +istream& istream::operator>>(char& _c) { + if(ipfx0()) { + if(_bp->in_avail()) + _c = _bp->sbumpc(); + else + _c = do_get(); + } + return *this; +} + +istream& istream::operator>>(unsigned char* _s) { + return *this>>(signed char *) _s; +} + +istream& istream::operator>>(char* _s) { + return *this>>(signed char *) _s; +} + +istream& istream::get(unsigned char* _s, int _l, char _t) { + return get((signed char *)_s, _l, _t); +} + +istream& istream::get(char* _s, int _l, char _t) { + return get((signed char *)_s, _l, _t); +} + +istream& istream::read(unsigned char* _s, int _l) { + return read((signed char *)_s, _l); +} + +istream& istream::read(char* _s, int _l) { + return read((signed char *)_s, _l); +} + +istream& istream::getline(unsigned char* _s, int _l, char _t) { + return getline((signed char *)_s, _l, _t); +} + +istream& istream::getline(char* _s, int _l, char _t) { + return getline((signed char *)_s, _l, _t); +} + +int istream::sync() { + return _bp->sync(); +} + +istream& istream::operator>> (istream& (*_f)(istream&)) { + return (*_f)(*this); +} + +int istream::peek() { + return ipfx1() ? _bp->sgetc() : EOF; +} + +int ostream::opfx() { + return ospecial ? do_opfx() : 1; +} + +void ostream::osfx() { + if((x_flags&(stdio|unitbuf)) || (ospecial)) do_osfx(); +} + +ostream& ostream::operator<<(unsigned char _c) { + return *this <<(signed char ) _c; +} + +ostream& ostream::operator<<(char _c) { + return *this <<(signed char ) _c; +} + +ostream& ostream::operator<<(short _i) { + return *this<<(long)_i; +} + +ostream& ostream::operator<<(unsigned short _i) { + return *this<<(unsigned long)_i; +} + +ostream& ostream::operator<<(int _i) { + return *this<<(long)_i; +} + +ostream& ostream::operator<<(unsigned int _i) { + return *this<<(unsigned long)_i; +} + +ostream& ostream::operator<<(float _f) { + return *this<<(long double)_f; +} + +ostream& ostream::operator<<(double _f) { + return *this<<(long double)_f; +} + +ostream& ostream::operator<<(ostream& (*_f)(ostream&)) { + return (*_f)(*this); +} + +ostream& ostream::write(const signed char *_s, int _n) { + return write((const char *)_s, _n); +} + +ostream& ostream::write(const unsigned char *_s, int _n) { + return write((const char *)_s, _n); +} + +ostream& ostream::put(char _c) { + if(_bp->sputc(_c) == EOF) + setstate(badbit); + return *this; +} + +ostream& ostream::operator<<(const signed char *_s) { + return *this<<(const char *) _s; +} +ostream& ostream::operator<<(const unsigned char *_s) { + return *this<<(const char *) _s; +} + \ No newline at end of file diff --git a/code/SIBOSDK/src/iostream.cpp b/code/SIBOSDK/src/iostream.cpp new file mode 100644 index 0000000..d02b518 --- /dev/null +++ b/code/SIBOSDK/src/iostream.cpp @@ -0,0 +1,1693 @@ +/* Release 3.10 */ +/*-------------------------------------------------------------------------* +* * +* IOSTREAM.CPP - 2.1 stream class implementations. * +* * +* COPYRIGHT (C) 1989..1992 Clarion Software Corporation. * +* All Rights Reserved * +* * +*--------------------------------------------------------------------------*/ + +#include +#include +#include +#include +#include + +extern "C" char *_ld_format(char *_fmt_buf, LONGDOUBLE num, int flag, int prec); +extern "C" char *_v_format(unsigned long, char *s); + +#pragma module(init_prio=>22) + +//************************************************************************** +// ios implementation +//************************************************************************** + +const long ios::basefield = dec|oct|hex; +const long ios::adjustfield = left|right|internal; +const long ios::floatfield = scientific|fixed; +void (*ios::stdioflush)() = NULL; +long ios::nextbit = 10; +int ios::usercount = 0; + +long ios::flags(long f) { + + long t; + + t=x_flags; + x_flags=f; + return t; +} + +long ios::setf(long sbits,long fld) + { + long t; + + t=x_flags&fld; + x_flags&=~fld; + sbits&=fld; + x_flags|=sbits; + return t; + } + +long ios::setf(long sbits) { + + long t; + + t=x_flags; + x_flags|=sbits; + return t; +} + +long ios::unsetf(long sbits) { + + long t; + + t=x_flags; + x_flags&=~sbits; + return t; +} + + +ostream* ios::tie(ostream* ost) { + + ostream* t; + + t=x_tie; + x_tie=ost; + return t; +} + +ios::ios(streambuf *sb) { + + init(sb); +} + +void ios::init(streambuf *sb) { + + _bp=sb; + x_tie=NULL; + state=0; + ispecial=skipping; + ospecial=0; + x_flags=skipws|right|scientific; + x_precision=6; + x_width=0; + x_fill=' '; + userwords=NULL; + nwords=0; + delbuf=0; +} + +ios::ios() { + +} + +ios::~ios() { + +} + +int ios::skip(int sk) { + + int t; + + t=((x_flags&skipws) != 0); + if(sk) { + x_flags|=skipws; + ispecial|=skipping; + } + else { + x_flags&=~skipws; + ispecial&= (~skipping); + } + return(t); +} + +long ios::bitalloc() { + + if(nextbit >= 31) + return 0; + return 1<<++nextbit; +} + +int ios::xalloc() { + + return usercount++; +} + + +_STATIC long err_ret=0; +_STATIC void * err_ret_ptr=NULL; + +long& ios::iword(int n) { + + if((n >= 0) && (n < usercount)) { + if(n >= nwords) + uresize(n); + if(userwords) + return userwords[n].x; + } + setstate(failbit); + return err_ret; +} + + +void* & ios::pword(int n) { + + if((n >= 0) && (n < usercount)) { + if(n >= nwords) + uresize(n); + if(userwords) + return userwords[n].p; + } + setstate(failbit); + return err_ret_ptr; +} + +void ios::uresize(int n) { + + nwords=n+1; + userwords=(ios::ios_user_union *) realloc(userwords, nwords); +} + + +#ifndef _WINDOWS +_STATIC stdiobuf cin_sb (stdin); +_STATIC stdiobuf cout_sb(stdout); +_STATIC stdiobuf cerr_sb(stderr); +_STATIC stdiobuf clog_sb(stderr); + + +void ios::sync_with_stdio() { + + static done=0; + + if(!done) { + done=1; + cin=(streambuf *) &cin_sb; + cout=(streambuf *) &cout_sb; + cerr=(streambuf *) &cerr_sb; + clog=(streambuf *) &clog_sb; + cin.setf(ios::unitbuf|stdio); + cout.setf(ios::unitbuf|stdio); + clog.setf(ios::unitbuf|stdio); + } +} +#endif + +void ios::setstate(int st) { + + state|=st; +} + +void ios::clear(int st) { + + state=st; +} + +//************************************************************************** +// streambuf implementation +//************************************************************************** + + +streambuf::streambuf() { + + char *b=new char[512]; + + _base=NULL; + setbuf(b, 512); + _alloc=1; +} + +streambuf::streambuf(char *s, int sz) { + + _base=NULL; + setbuf(s, sz); + _alloc=0; +} + +streambuf::~streambuf() { + + if(_alloc && _base) + delete _base; +} + + +streambuf * streambuf::setbuf(char *s, int sz, int pos) { + + if(_base) + return NULL; + setb(s, s+sz); + if(s && sz) { + setp(s+pos, s+sz/2); + setg(s+sz/2, s+sz/2+pos, s+sz); + } + else { + setp(NULL, NULL); + setg(NULL, NULL, NULL); + } + return this; +} + +streambuf* streambuf::setbuf(char *s, int sz) { + + if(_base) + return NULL; + setb(s, s+sz); + if(s && sz) { + setp(s, s+sz/2); + setg(s+sz/2, s+sz, s+sz); + } + else { + setp(NULL, NULL); + setg(NULL, NULL, NULL); + } + return this; +} + +int streambuf::sputn(const char *_s, int _n) { + + if(_n <= (_epptr - _pptr)) { + memcpy(_pptr, _s, _n); + pbump(_n); + return _n; + } + return do_sputn(_s, _n); +} + +int streambuf::do_sputn(const char *_s, int _n) { + + int t, nw; + + nw=0; + while(nw < _n) { + if(_pptr >= _epptr) + overflow(_s[nw++]); + t = _epptr - _pptr; + if(t) { // special case for unbuffered + memcpy(_pptr, &_s[nw], t); + nw+=t; + pbump(t); + } + } + return nw; +} + +int streambuf::overflow(int) { + + return EOF; +} + +int streambuf::sgetn(char *_s, int _n) { + + if(_n <= (_egptr - _gptr)) { + memcpy(_s, _gptr, _n); + gbump(_n); + return _n; + } + return do_sgetn(_s, _n); +} + + +int streambuf::do_sgetn(char *_s, int _n) { + + int t, nr; + + nr=0; + while(nr < _n) { + if(_gptr >= _egptr) { + if(underflow() == EOF) + break; + } + t = _egptr - _gptr; + memcpy(&_s[nr], _gptr, t); + nr+=t; + gbump(t); + } + return nr; +} + +int streambuf::underflow() { + + return EOF; +} + +int streambuf::pbackfail(int) { + + return EOF; +} + +streampos streambuf::seekoff(streamoff, ios::seek_dir, int) { + + return EOF; +} + +streampos streambuf::seekpos(streamoff off, int mode) { + + streampos pos; + + if((pos=seekoff(off, ios::beg, mode)) == EOF) + return EOF; + return pos; +} + +int streambuf::sync() { + + if(_gptr == _egptr) + return 0; + return EOF; +} + +int streambuf::dbp() { + +#ifndef _WINDOWS + printf("base = %p, ebuf = %p, pbase = %p\n", _base, _ebuf, _pbase); + printf("pptr = %p, epptr = %p\n", _pptr, _epptr); + printf("gptr = %p, egptr = %p, eback = %p\n", _gptr, _egptr, _eback); +#endif + return 1; +} +void streambuf::setp(char *p, char *ep) { + + _pbase=p; + _pptr=p; + _epptr=ep; +} + +void streambuf::setg(char *eb, char *g, char *eg) { + + _eback=eb; + _gptr=g; + _egptr=eg; +} + +void streambuf::setb(char *b, char *eb, int i) { + + if(_base && _alloc) + delete _base; + _base=b; + _ebuf=eb; + _alloc=i; + _unbuf=((!b) && (!eb)); +} + +int streambuf::doallocate() { + + char *b; + + b=new char[512]; + if(b == NULL) + return EOF; + _alloc=1; + setbuf(b, 512); + return 1; +} + +int streambuf::do_snextc() { + + int na; + + na=_gptr-_egptr; + underflow(); + if(na > 0) + _gptr+=na; + return *_gptr; +} + +//************************************************************************** +// istream implementation +//************************************************************************** + +istream::istream(streambuf *sb) { + + ios::init(sb); + _gcount=0; +} + +istream::~istream() { + if(delbuf) + delete _bp; +} + +istream::istream() { + + _gcount=0; +} + +istream::istream(streambuf *sb, int sk, ostream* tie) { + + ios::init(sb); + x_tie=tie; + skip(sk); + _gcount=0; +} + + +istream::istream(int sz, char* b, int sk) : ios() { + + streambuf *p; + + p=new streambuf(b, sz); + ios::init(p); + skip(sk); + _gcount=0; + delbuf=1; +} + +istream::istream(int fd, int sk, ostream* tie) : ios() { + + filebuf *f; + + f=new filebuf(fd); + ios::init(f); + x_tie=tie; + skip(sk); + _gcount=0; + delbuf=1; +} + +istream& istream::seekg(streampos p) { + + state &= ~(failbit|eofbit); + if(state == goodbit) + _bp->seekoff(p, ios::beg, ios::in); + return *this; +} + +istream& istream::seekg(streamoff p, ios::seek_dir d) { + + state &= ~(failbit|eofbit); + if(state == goodbit) + _bp->seekoff(p, d, ios::in); + return *this; +} + +streampos istream::tellg() { + + if(state == goodbit) + return _bp->seekoff(0L, ios::cur, ios::in); + return (streampos) -1; +} + +istream& istream::ignore(int n, int delim) { + + int c, cnt; + + cnt=0; + while(cnt++ < n) { + if(((c=_bp->sbumpc()) == delim) && (delim != EOF)) { + _bp->sputbackc(c); + break; + } + if(c == EOF) { + setstate(failbit|eofbit); + break; + } + } + return *this; +} + +istream& istream::read(signed char* s, int n) { + + int cnt, c; + + _gcount=0; + if(state == goodbit) { + cnt=0; + while(cnt < n) { + c=_bp->sbumpc(); + if(c == EOF) { + setstate(eofbit|failbit); + break; + } + s[cnt++]=c; + ++_gcount; + } + } + return *this; +} + +istream& istream::putback(char c) { + + if(state == goodbit) { + if(_bp->sputbackc(c) == EOF) + setstate(eofbit|failbit); + } + return *this; +} + +istream& istream::getline(signed char* s, int n, char t) { + + int c, p=0; + + if(ipfx1()) { + while(p < n-1) { + c=_bp->sbumpc(); + if(c == t) { + break; + } + if(c == EOF) { + setstate(eofbit); + if(p == 0) + setstate(failbit); + break; + } + s[p++]=c; + } + } + s[p]='\0'; + return *this; +} + +istream& istream::operator>>(signed char *s) { + + int lim, c, p=0; + + if(x_width) { + lim=x_width-1; + x_width=0; + } + else + lim = INT_MAX; + _gcount=0; + if(ipfx0()) { + while(p < lim) { + c=_bp->sbumpc(); + if(c == EOF) { + setstate(failbit|eofbit); + break; + } + if(isspace(c)) { + _bp->sputbackc(c); + break; + } + s[p++]=c; + ++_gcount; + } + } + s[p]='\0'; + return *this; +} + +istream& istream::get(signed char *s, int len, char delim) { + + int c, p=0; + + _gcount=0; + if(ipfx1()) { + while(p < len-1) { + c=_bp->sbumpc(); + if(c == delim) { + _bp->sputbackc(c); + break; + } + if(c == EOF) { + setstate(eofbit); + if(p == 0) + setstate(failbit); + break; + } + s[p++]=c; + ++_gcount; + } + } + s[p]='\0'; + return *this; +} + +istream& istream::get(unsigned char& _c) { + + if( ipfx1() ) { + if( _bp->in_avail() ) { + _gcount = 1; + _c = _bp->sbumpc(); + } + else + _c = do_get(); + } + return *this; +} + +istream& istream::get(signed char& _c) { + + if( ipfx1() ) { + if( _bp->in_avail()) { + _gcount = 1; + _c = _bp->sbumpc(); + } + else + _c = do_get(); + } + return *this; +} + +istream& istream::get( char& _c) { + + if( ipfx1() ) { + if( _bp->in_avail()) { + _gcount = 1; + _c = _bp->sbumpc(); + } + else + _c = do_get(); + } + return *this; +} + + +int istream::get() { + + if( ipfx1() ) { + int _c = _bp->sbumpc(); + if( _c == EOF ) + setstate(eofbit); + else + _gcount = 1; + return _c; + } + return EOF; +} + + +istream& istream::get(streambuf& s, char t) { + + int c, lim; + + if(x_width) { + lim=x_width; + x_width=0; + } + else + lim=INT_MAX; + _gcount=0; + if(state == goodbit) { + while(lim--) { + c=_bp->sbumpc(); + if(c == EOF) { + setstate(eofbit); + break; + } + if(c == t) { + _bp->sputbackc(c); + break; + } + if(s.sputc(c) == EOF) { + setstate(failbit); + break; + } + ++_gcount; + } + } + return *this; +} + +istream& istream::operator>>(ios& (*f)(ios &)) { + + f(*this); // NB !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + return *this; +} + +_STATIC long double getreal(istream& is, int& pass) { + + int n=0; + char c; + char _fmt_buf[64]; + int good_scan=0; + + is >> c; + while(is.good()) + { + if((c == '+') || (c == '-')) { /* leading sign */ + good_scan=1; + _fmt_buf[n++]= (char) c; + c= is.get(); + if(!is.good()) + break; + } + for(int q=0; q<2; q++) { + while(isdigit(c)) { /* get digits */ + good_scan=1; + _fmt_buf[n++]= (char) c; + c= is.get(); + if(!is.good()) + break; + } + if((c == DEC_POINT) && (q == 0)) { /* decimal point */ + _fmt_buf[n++]= (char) c; + c= is.get(); + if(!is.good()) + break; + } + else if(q == 0) + break; + } /* go back for more digits if first iteration */ + if((c == 'E') || (c == 'D') || (c == 'e') || (c == 'd')) { + _fmt_buf[n++]= (char) c; + c= is.get(); + if(!is.good()) + break; + } + else + break; + if((c == '+') || (c == '-')) { + _fmt_buf[n++]= (char) c; + c= is.get(); + if(!is.good()) + break; + } /* exponent digits */ + while(isdigit(c)) { + good_scan=1; + _fmt_buf[n++]= (char) c; + c= is.get(); + if(!is.good()) + break; + } + break; + } + _fmt_buf[n]=0; /* terminate string */ + if(is.good()) + is.putback(c); + pass=good_scan; + return atofl(_fmt_buf); /* convert and assign if not suppressed */ +} + +_STATIC long getlong(istream& is, int us, int& pass) { + + int negative=0, flag=0; + long temp=0; + int good_scan=0; + char c; + + is >> c; + if(!is.good()) + goto error; + if(c == '+') { + good_scan=1; + c= is.get(); + if(!is.good()) + goto error; + } + else if(c == '-') { /* number is negative */ + good_scan=1; + negative=1; + c= is.get(); + if(!is.good()) + goto error; + else if(us) + return(0); + } + if(c =='0') { + good_scan=1; + flag=_OCT; + c= is.get(); + if(!is.good()) + goto error; + c=tolower(c); + if(c == 'x') { + flag=_HEX; + c= is.get(); + if(!is.good()) + goto error; + } + } + if(is.flags()&ios::dec) { + if(flag == _HEX) + c='x'; + flag=0; + } + switch(flag) { + case _HEX : + while(isxdigit(c=tolower(c))) { + temp*=16; + if(!isdigit(c)) + c-=87; + else + c-='0'; + temp+=c; + c= is.get(); + if(!is.good()) + goto error; + } + break; + case _OCT : + while((c >= '0') && (c <= '7')) { + temp*=8; + temp+=c-'0'; + c= is.get(); + if(!is.good()) + goto error; + } + break; + default : + while(isdigit(c)) { + good_scan=1; + temp*=10; + temp+=c-'0'; + c= is.get(); + if(!is.good()) + goto error; + } + break; + } + c=tolower(c); + if((c != 'u') && (c != 'l')) + is.putback(c); +error: + if(negative) + return -temp; + pass=good_scan; + return temp; +} + +istream& istream::operator>>(short& s) { + + short t; + int pass; + + t=getlong(*this, 0, pass); + if(pass) + s=(short) t; + else + setstate(failbit); + return *this; +} + +istream& istream::operator>>(int& i) { + + int t; + int pass; + + t=(int)getlong(*this, 0, pass); + if(pass) + i=(int) t; + else + setstate(failbit); + return *this; +} + +istream& istream::operator>>(long& l) { + + long t; + int pass; + + t=getlong(*this, 0, pass); + if(pass) + l= t; + else + setstate(failbit); + return *this; +} + +istream& istream::operator>>(unsigned short& s) { + + unsigned short t; + int pass; + + t=getlong(*this, 1, pass); + if(pass) + s=(unsigned short) t; + else + setstate(failbit); + return *this; +} + +istream& istream::operator>>(unsigned int& i) { + + unsigned int t; + int pass; + + t=(unsigned)getlong(*this, 1, pass); + if(pass) + i=(unsigned int) t; + else + setstate(failbit); + return *this; +} + +istream& istream::operator>>(unsigned long& l) { + + unsigned long t; + int pass; + + t=getlong(*this, 1, pass); + if(pass) + l= (unsigned long) t; + else + setstate(failbit); + return *this; +} + +istream& istream::operator>>(long double& ld) { + + long double t; + int pass; + + t=getreal(*this, pass); + if(pass) + ld= t; + else + setstate(failbit); + return *this; +} + +istream& istream::operator>>(double& d) { + + long double t; + int pass; + + t=getreal(*this, pass); + if(pass) + d= (double) t; + else + setstate(failbit); + return *this; +} + +istream& istream::operator>>(float& f) { + + long double t; + int pass; + + t=getreal(*this, pass); + if(pass) + f= (float) t; + else + setstate(failbit); + return *this; +} + +istream& istream::operator>>(streambuf* sb) { + + + int c; + + if(state == goodbit) { + while(1) { + if(!ipfx0()) + break; + c=_bp->sbumpc(); + if(c == EOF) { + setstate(eofbit); + break; + } + if(sb->sputc(c) == EOF) { + putback(c); + break; + } + ++_gcount; + } + } + return *this; +} + +int istream::do_ipfx(int need) { + + if(state != goodbit) + return 0; + if((!need) || (need > _bp->in_avail())) { // skip and flush tie + if(x_tie) + x_tie->flush(); + if(ispecial&skipping) + eatwhite(); + } + return (state == goodbit); +} + +void istream::eatwhite() { + + int c; + + while(isspace(c=_bp->sgetc())) { + _bp->stossc(); + } + if(c == EOF) + setstate(failbit|eofbit); +} + + +int istream::do_get() { + + int t; + + if ((t=_bp->underflow()) == EOF) + setstate(eofbit); + else { + _bp->sbumpc(); + return t; + } +} + +//************************************************************************** +// ostream implementation +//************************************************************************** + +ostream::ostream(streambuf *sb) { + + ios::init(sb); + ospecial=translate; +} + +ostream::~ostream() { + if(delbuf) + delete _bp; +} + +ostream::ostream() { + + ospecial=translate; +} + + +ostream::ostream(int sz, char* b) { + + streambuf *p; + + p=new streambuf(b, sz); + ios::init(p); + delbuf=1; + ospecial=translate; +} + +ostream::ostream(int fd) { + + filebuf *f; + + f=new filebuf(fd); + ios::init(f); + delbuf=1; + ospecial=translate; +} + +ostream& ostream::seekp(streampos p) { + + state &= ~(failbit|eofbit); + if(state == goodbit) + _bp->seekoff(p, ios::beg, ios::out); + return *this; +} + +ostream& ostream::seekp(streamoff p, ios::seek_dir d) { + + if(state == goodbit) + _bp->seekoff(p, d, ios::out); + return *this; +} + +streampos ostream::tellp() { + + if(state == goodbit) + return _bp->seekoff(0L, ios::cur, ios::out); + return (streampos) -1; +} + +ostream& ostream::write(const char*s, int n) { + + int cnt; + + if(state == goodbit) { + if(ospecial) { + cnt=0; + while(cnt < n) { + if(_bp->sputc((unsigned char) s[cnt]) == EOF) { + setstate(failbit); + break; + } + ++cnt; + } + } + else { + if(_bp->sputn(s, n) != n) + setstate(failbit); + } + } + return *this; +} + + +_STATIC int pad_output(ostream& os, int l) { + int pw; + + pw=os.width(); + while(pw > l) { + if(os.rdbuf()->sputc(os.fill()) == EOF) { + return EOF; + } + --pw; + } + os.width(0); + return 0; +} + + +ostream& ostream::operator<<(signed char c) { + + if(opfx()) { + if(!(x_flags&left)) { + if(pad_output(*this, 1) == EOF) { + setstate(failbit); + return *this; + } + } + if(state == goodbit) { + if(_bp->sputc(c) == EOF) + setstate(failbit); + else { + if(x_flags&left) { + if(pad_output(*this, 1) == EOF) + setstate(failbit); + return *this; + } + } + } + osfx(); + } + return *this; +} + +void ostream::outlong(unsigned long l, int issigned) { + + int radix, np, len, signchar; + char fmt_buf[64]; + int c; + + if(x_flags&hex) + radix=16; + else if(x_flags&oct) + radix=8; + else + radix=10; + np=3; + if(issigned) + ltoa(l, &fmt_buf[np], radix); + else + ltoa(l, &fmt_buf[np], radix); + + if(x_flags&showbase) { + if(x_flags&hex) + fmt_buf[--np]='x'; + if(x_flags&(hex|oct)) + fmt_buf[--np]='0'; + } + if(x_flags&uppercase) + strupr(&fmt_buf[np]); + else + strlwr(&fmt_buf[np]); + if(((x_flags&showpos) && (!(x_flags&(hex|oct)))) || (l < 0)) { + if(l >= 0) + fmt_buf[--np]= '+'; + else + fmt_buf[--np]= ' '; + signchar=1; + } + else + signchar=0; + len=strlen(&fmt_buf[np]); + + if((x_flags&right) || (!(x_flags&adjustfield))) { + if(pad_output(*this, len) == EOF) { + setstate(failbit); + return; + } + } + if(x_flags&internal) { + int dec=0; + if(signchar || (x_flags&showbase)) { + c=_bp->sputc(fmt_buf[np++]); + ++dec; + if((x_flags&hex) && (x_flags&showbase)) { + c=_bp->sputc(fmt_buf[np++]); + ++dec; + } + if(c == EOF) { + setstate(failbit); + return; + } + } + if(pad_output(*this, len) == EOF) { + setstate(failbit); + return; + } + len-=dec; + } + int n=0; + while(n++ < len) { + if(_bp->sputc(fmt_buf[np++]) == EOF) { + setstate(failbit); + return; + } + } + if(x_flags&left) { + if(pad_output(*this, len) == EOF) + setstate(failbit); + } + return; +} + + +ostream& ostream::operator<<(long l) { + + if(opfx()) { + outlong((unsigned long) l, 1); + osfx(); + } + return *this; +} + +ostream& ostream::operator<<(unsigned long l) { + + if(opfx()) { + outlong(l, 0); + osfx(); + } + return *this; +} + +ostream& ostream::operator<<(long double ld) { + + unsigned flag, signchar, len; + char buf[64]; + char *res; + + if(opfx()) { + if(x_flags&scientific) + flag=(PF_EXP|PF_CPP); + else if(x_flags&fixed) + flag=PF_CPP; + else + flag=(PF_GTYPE|PF_CPP); + if(x_flags&showpoint) + flag|=PF_HASH; + if(x_flags&showpos) + flag|=PF_SIGN; + + res=_ld_format(buf, ld, flag, x_precision); + + signchar=((res[0] == '+') || (res[0] == '-')); + len=strlen(res); + + int p=0; + if(x_flags&right) { + if(pad_output(*this, len) == EOF) { + setstate(failbit); + return *this; + } + } + if((x_flags&internal) && (signchar)){ + if(_bp->sputc(res[p++]) == EOF) { + setstate(failbit); + return *this; + } + if(pad_output(*this, len) == EOF) { + setstate(failbit); + return *this; + } + --len; + } + int n=0; + while(n++ < len) { + if(_bp->sputc(res[p++]) == EOF) { + setstate(failbit); + return *this; + } + } + if(x_flags&left) { + if(pad_output(*this, len) == EOF) { + setstate(failbit); + return *this; + } + } + osfx(); + } + return *this; +} + +void ostream::outstr(const char *s) { + + int len, p=0; + + len=strlen(s); + if((x_width) && (len > x_width)) + len=x_width; + if(!(x_flags&left)) { + if(pad_output(*this, len) == EOF) { + setstate(failbit); + return; + } + } + while(p < len) { + if(_bp->sputc(s[p++]) == EOF) { + setstate(badbit); + return; + } + } + if(x_flags&left) { + if(pad_output(*this, len) == EOF) { + setstate(failbit); + return; + } + } + x_width=0; +} + +ostream& ostream::operator<<(void *p) { + + char buf[12]; + char *ob; + + if(opfx()) { + ob=&buf[2]; + _v_format((unsigned long) p, ob); + if(x_flags&ios::showbase) { + buf[0]='0'; + buf[0]='x'; + ob=buf; + } + outstr(ob); + osfx(); + } + return *this; +} + +ostream& ostream::operator<<(streambuf *sb) { + + int c, lim; + + if(opfx()) { + if(x_width) { + lim=x_width; + x_width=0; + } + else + lim=INT_MAX; + while((lim--) && ((c=sb->sbumpc()) != EOF)) { + if(_bp->sputc(c) == EOF) { + setstate(failbit); + break; + } + } + osfx(); + } + return *this; +} + +ostream& ostream::operator<<(ios& (*f)(ios &i)) { + + if(opfx()) { + f(*this); + osfx(); + } + return *this; +} + +ostream& ostream::operator<<(const char *s) { + + if(opfx()) { + outstr(s); + osfx(); + } + return *this; +} + + +int ostream::do_opfx() { + + if(state != goodbit) + return 0; + if(x_tie) + x_tie->flush(); + return 1; +} + + +int ostream::do_osfx() { + + if(x_flags&unitbuf) + flush(); +#ifndef _WINDOWS + if(x_flags&stdio) { + ::fflush(stdin); + ::fflush(stdout); + } +#endif + return good(); +} + +ostream& ostream::flush() { + + if(_bp->sync() == EOF) + setstate(failbit); + return(*this); +} + +//************************************************************************** +// iostream implementation +//************************************************************************** + + +iostream::iostream(streambuf *sb) : istream(sb), ostream(sb) { + +} + +iostream::iostream() { + +} + +iostream::~iostream() { + +} + +//************************************************************************** +// withassign stream implementation +//************************************************************************** + +ostream_withassign::ostream_withassign() { + + assign_const=_assign_init_magic; +} + +ostream_withassign::~ostream_withassign() { + +} + +istream_withassign::istream_withassign() { + + assign_const=_assign_init_magic; +} + +istream_withassign::~istream_withassign() { + +} + +iostream_withassign::iostream_withassign() { + + assign_const=_assign_init_magic; +} + +iostream_withassign::~iostream_withassign() { + +} + +istream_withassign& istream_withassign::operator=(istream& is) { + + ios::init(is.rdbuf()); + x_tie=is.tie(); + state=is.rdstate(); + x_flags=is.flags(); + x_precision=is.precision(); + x_width=is.width(); + x_fill=is.fill(); + return *this; +} + +istream_withassign& istream_withassign::operator=(streambuf* sb) { + + ios::init(sb); + return *this; +} + +ostream_withassign& ostream_withassign::operator=(ostream& os) { + + ios::init(os.rdbuf()); + x_tie=os.tie(); + state=os.rdstate(); + x_flags=os.flags(); + x_precision=os.precision(); + x_width=os.width(); + x_fill=os.fill(); + return *this; +} + +ostream_withassign& ostream_withassign::operator=(streambuf* sb) { + + ios::init(sb); + return *this; +} + +iostream_withassign& iostream_withassign::operator=(ios& iost) { + + ios::init(iost.rdbuf()); + x_tie=iost.tie(); + state=iost.rdstate(); + x_flags=iost.flags(); + x_precision=iost.precision(); + x_width=iost.width(); + x_fill=iost.fill(); + return *this; +} + +iostream_withassign& iostream_withassign::operator=(streambuf* sb) { + + ios::init(sb); + return *this; +} +ostream& endl(ostream& os) { + + os << "\n"; + return os; +} + +ostream& ends(ostream& os) { + + os.put('\0'); + return os; +} + +ostream& flush(ostream& os) { + + os.flush(); + return os; +} + +ios& dec(ios& i) { + + i.setf(ios::dec, ios::basefield); + return i; +} + +ios& hex(ios& i) { + + i.setf(ios::hex, ios::basefield); + return i; +} + +ios& oct(ios& i) { + + i.setf(ios::oct, ios::basefield); + return i; +} + +istream& ws(istream& is) { + + int c; + + while(isspace(c=is.get())); + if(c != EOF) + is.rdbuf()->sputbackc(c); + return is; +} + +_STATIC char _cin_buf[BUFSIZ]; +_STATIC char _cout_buf[BUFSIZ]; +_STATIC char _clog_buf[BUFSIZ]; + + +_STATIC filebuf cin_fb (0, _cin_buf, BUFSIZ); +_STATIC filebuf cout_fb(1, _cout_buf, BUFSIZ); +_STATIC filebuf cerr_fb(2, NULL, 0); +_STATIC filebuf clog_fb(2, _clog_buf, BUFSIZ); + +extern "C" void _init_standard() { + + cin=(streambuf *) &cin_fb; + cout=(streambuf *) &cout_fb; + cout.setf(ios::unitbuf); + cerr=(streambuf *) &cerr_fb; + clog=(streambuf *) &clog_fb; + clog.setf(ios::unitbuf); +} + +static ios& set_width(ios& iosc, int wid) { + + iosc.width(wid); + return iosc; +} + + +smanip_int setw(int _n) { + + return smanip_int(set_width, _n); +} + +static ios& set_base(ios& iosc, int bas) { + + iosc.setf(bas, ios::basefield); + return iosc; +} + + +smanip_int setbase(int _b) { + + return smanip_int(set_base, _b); +} + +static ios& reset_flags(ios& iosc, long f) { + + iosc.unsetf(f); + return iosc; +} + + +smanip_long resetiosflags(long _f) { + + return smanip_long(reset_flags, _f); +} + +static ios& set_flags(ios& iosc, long f) { + + iosc.flags(f); + return iosc; +} + +smanip_long setiosflags(long _f) { + + return smanip_long(set_flags, _f); +} + +static ios& set_fill(ios& iosc, int fl) { + + iosc.fill(fl); + return iosc; +} + + +smanip_int setfill(int _f) { + + return smanip_int(set_fill, _f); +} + +static ios& set_precision(ios& iosc, int pr) { + + iosc.precision(pr); + return iosc; +} + + +smanip_int setprecision(int _p) { + + return smanip_int(set_precision, _p); +} + + +istream_withassign cin; +ostream_withassign cout; +ostream_withassign cerr; +ostream_withassign clog; + +int genericerror(int code, char *m) { + + cerr << m; + exit(code); + return 0; +} + + \ No newline at end of file diff --git a/code/SIBOSDK/src/iplib.a b/code/SIBOSDK/src/iplib.a new file mode 100644 index 0000000..80ab344 --- /dev/null +++ b/code/SIBOSDK/src/iplib.a @@ -0,0 +1,9 @@ +(* 4K Epoc C header for use with PLIB *) +(* Release 1.00F NSM *) +(* Copyright (C) Psion PLC 1991 *) + +StackSize = 1000H + +include "iplib.inc" + + diff --git a/code/SIBOSDK/src/iplib.inc b/code/SIBOSDK/src/iplib.inc new file mode 100644 index 0000000..5453a77 --- /dev/null +++ b/code/SIBOSDK/src/iplib.inc @@ -0,0 +1,233 @@ +(* Epoc C header for use with PLIB include file *) +(* Release 1.10F NSM *) +(* Copyright (C) Psion PLC 1991-93 *) + +include "epocdefs.inc" + +Priority = 2 +ProcVar = 3 +InitSize = 5 +PRMAX = 32 + +module iplib + +section + +segment _TEXT(CODE,68H) + +segment STACK(STACK,74H) +public __stack_start: + +segment _MAGIC(MAGIC,68H) +public _DatWordDead: dw 0 +public _DatHandNext: dw 0 +public _DatHandPrev: dw 0 +public _DatCountrySeg: dw 0 +public _DatClassHandle: dw 0 +public _DatClassPtr: dw 0 +public _DatEClassHandle: dw 0 +public _DatEClassPtr: dw 0 +public _DatEnterFramePtr: dw 0 +public _w_ws: dw 0 +public _w_am: dw 0 +public _wClientData: dw 0 +public _wserv_channel: dw 0 +public _T: dw 0 +public _r: dw 0 +public _DatOsFramePtr: dw 0 +public _DatATFlag: db 0 +public _DatHeapLocked: db 0 +public _DatProcessNamePtr: dw 0 +public _DatCommandPtr: dw 0 +public _DatTest: dw 0 +public _DatApp1: dw 0 +public _DatApp2: dw 0 +public _DatApp3: dw 0 +public _DatApp4: dw 0 +public _DatApp5: dw 0 +public _DatApp6: dw 0 +public _DatApp7: dw 0 +public _DatDialogPtr: dw 0 +public _DatGate: dw 0 +public _DatLocked: dw 0 +public _DatStatusNamePtr: dw 0 +public _DatUsedPathNamePtr: dw 0 +org StackSize-40H + +segment _INIT(DATA,48H) +public __init_begin: + dw 0 +public __init_start: + +segment _CONST(DATA,48H) +public __const_start: + dw 0 + +segment _DATA(DATA,68H) +public __data_start: +public CoreSig@CnsHandler : dw 0 + +segment _BSS(BSS,68H) +public __bss_start: +public __SH_sword: + org 2 + +segment BSS_END(BSS,68H) +public __bss_end: + +select _DATA +extrn @InitPointer +extrn @InitPriority + +select _BSS +extrn @InitCount +extrn @InitEnd +extrn @InitDone +extrn @ExitCode +extrn @StackContextSP +extrn @StackContextBP + +group DGROUP(_MAGIC,_INIT,_CONST,_DATA,_BSS,BSS_END) + +select _TEXT +public __init0: + +extrn _main +extrn __FloatInit +extrn __FloatFinish +extrn __FloatMathExcepDos +extrn __FatalErrorPos +extrn __FatalError +extrn _ClassTable +extrn _ExtCatTable +extrn __InitSetup +extrn __InitLoop + + call __begin + ret far 0 + + dw __bss_start + dw _ExtCatTable + dw _ClassTable + dw _DatWordDead + dw __bss_end + +public _p_leave: + int LibLeave + int LibSendExit + + dw __init_start + dw __const_start + +public __begin: + sub al, al + mov ah, NmFilConnect + int FilManager + jc _p_abort + call __FloatInit + call __InitSetup + call __InitLoop +doExit: + call __FloatFinish + mov ah, NmProcId + int ProcManager + mov bx, ax + mov ax, [@ExitCode] + mov ah, NmProcKill + int ProcManager + +public _p_abort: + mov al, FailedToStartErr + mov [@ExitCode], ax + jmp doExit + +public __fp_0: + ret 0 + +public __fp_1: + ret 0 + +public __sigFp: + jmp __FloatMathExcepDos + +public __math_excep: + call __FatalErrorPos + mov bx, FatalMathException + jmp __FatalError + +public __InitSetup : + mov ax, __const_start + sub ax, __init_start + mov bl, InitSize + div bl + sub ah, ah + mov [@InitCount], ax + mul bl + add ax, __init_start + mov [@InitEnd], ax + and word [@InitDone], 0 + ret 0 + +public __InitLoop : + push di + push si + mov bx, [@InitPointer] + jmp traverseLoop +nextLoop: + add bx, InitSize +chainLoop: +traverseLoop: + cmp bx, [@InitEnd] + jae endOfArray + mov al, [@InitPriority] + cmp al, [bx][Priority] + jne nextLoop + lea ax, [bx][InitSize] + mov [@InitPointer], ax + dec word [@InitCount] + call [bx][ProcVar] + mov bx, [@InitPointer] + cmp word [@InitDone], 0 + je traverseLoop +initLoopRet: + pop si + pop di + ret 0 + +endOfArray: + cmp word [@InitCount], 0 + je stageComplete + +endOfList: + dec byte [@InitPriority] + js stageComplete + mov bx, __init_start + jmp chainLoop + +stageComplete: + inc word [@InitDone] + mov [@StackContextBP], bp + mov [@StackContextSP], sp + call _main + mov [@ExitCode], ax + jmp initLoopRet + +public _p_exit: + mov sp, [@StackContextSP] + mov bp, [@StackContextBP] + mov [@ExitCode], bx + jmp initLoopRet + +select _DATA +public @InitPointer : dw __init_start +public @InitPriority : db PRMAX + +select _BSS +public @InitCount : org 2 +public @InitEnd : org 2 +public @InitDone : org 2 +public @ExitCode : org 2 +public @StackContextSP : org 2 +public @StackContextBP : org 2 + +end * diff --git a/code/SIBOSDK/src/iplib2.a b/code/SIBOSDK/src/iplib2.a new file mode 100644 index 0000000..15b0e34 --- /dev/null +++ b/code/SIBOSDK/src/iplib2.a @@ -0,0 +1,9 @@ +(* 2K Epoc C header for use with PLIB *) +(* Release 1.00F NSM *) +(* Copyright (C) Psion PLC 1991 *) + +StackSize = 800H + +include "iplib.inc" + + diff --git a/code/SIBOSDK/src/iplib8.a b/code/SIBOSDK/src/iplib8.a new file mode 100644 index 0000000..273ccd8 --- /dev/null +++ b/code/SIBOSDK/src/iplib8.a @@ -0,0 +1,9 @@ +(* 8K Epoc C header for use with PLIB *) +(* Release 1.00F NSM *) +(* Copyright (C) Psion PLC 1991 *) + +StackSize = 2000H + +include "iplib.inc" + + diff --git a/code/SIBOSDK/src/new.cpp b/code/SIBOSDK/src/new.cpp new file mode 100644 index 0000000..3e3d176 --- /dev/null +++ b/code/SIBOSDK/src/new.cpp @@ -0,0 +1,90 @@ +/* Release 3.10 */ +/*-------------------------------------------------------------------------* +* * +* NEW.CPP - new implementations. * +* * +* COPYRIGHT (C) 1989..1992 Clarion Software Corporation. * +* All Rights Reserved * +* * +*--------------------------------------------------------------------------*/ + +#include +#include + +#pragma module(init_prio=>22) + +_STATIC void (*new_handler)(void); + +#pragma save, call(reg_return=>(ax,bx)) +void* operator new(unsigned size) { + + void *b; + + b=p_alloc(size); + if((b == NULL) && (new_handler) && (size)) + new_handler(); + return b; +} +#pragma restore + +void* operator new(unsigned, void *place) { + + return place; +} + +void operator delete(void *p) { + + p_free(p); +} + +void (* set_new_handler(void(*nh)()))() { + + void (* ret)(); + + ret=new_handler; + new_handler=nh; + return ret; +} + +extern "C" void * _vec_new( char * obj_ptr, unsigned n, unsigned siz, ctor_t ctor, unsigned vbnum) { + + unsigned *h; + + if (! obj_ptr) { + h=(unsigned *)p_alloc(n * siz + sizeof(unsigned)); + if(h == NULL) { + if(new_handler) + new_handler(); + return NULL; + } + *h=n; + obj_ptr= (char *)(h + 1); + } + + if (ctor) + _call_ctors(ctor, (char *) obj_ptr, vbnum, n, siz); + + return obj_ptr; +} + +extern "C" void _vec_delete( char * obj_ptr, unsigned siz, dtor_t dtor, unsigned _free, unsigned vbnum, unsigned static_num) + { + unsigned n; + unsigned *tmp; + + if (obj_ptr) + { + tmp = (unsigned *)obj_ptr-1; + if(dtor) + { + if(_free) + n=*tmp; + else + n=static_num; + obj_ptr+=n*siz; + _call_dtors(dtor,obj_ptr,vbnum,n,siz); + } + if(_free) + p_free(tmp); + } + } diff --git a/code/SIBOSDK/src/nofloat.a b/code/SIBOSDK/src/nofloat.a new file mode 100644 index 0000000..df1fa60 --- /dev/null +++ b/code/SIBOSDK/src/nofloat.a @@ -0,0 +1,33 @@ +(* Release 3.00 *) + +module nofloat + +public FIDRQQ (* wait, esc*) = 0 +public FIARQQ (* wait, ds:*) = 0 +public FICRQQ (* wait, cs:*) = 0 +public FIERQQ (* wait, es:*) = 0 +public FISRQQ (* wait, ss:*) = 0 + +public FIWRQQ (* nop, wait*) = 0 + +public FJARQQ (* Esc nn -> ds:nn*) = 0 +public FJCRQQ (* Esc nn -> cs:nn*) = 0 +public FJSRQQ (* Esc nn -> es:nn*) = 0 +public FJERQQ (* ???????????????*) = 0 + +public FIXRQQ = 0 (* brings this module in - known to linker *) + +segment _TEXT(CODE,28H) + +extrn __fp_0 + +public __FloatInit : + jmp __fp_0 +public __FloatFinish: +public __FloatInitInstance: +public __FloatJmpSave : +public __FloatJmpRestore : +public __FloatMathExcepDos : + ret 0 + +end diff --git a/code/SIBOSDK/src/printf.c b/code/SIBOSDK/src/printf.c new file mode 100644 index 0000000..3e3091b --- /dev/null +++ b/code/SIBOSDK/src/printf.c @@ -0,0 +1,923 @@ +/* Release 3.00 */ + +/*-------------------------------------------------------------------------* +* * +* printf.c - formatted output module * +* * +* COPYRIGHT (C) 1989 Jensen and Partners. All Rights Reserved * +* Written by Simon Knight. * +* * +* COPYRIGHT (C) 1991 Psion PLC. All Rights Reserved * +* Modified by NSM. * +* * +*--------------------------------------------------------------------------*/ + +#define _USE_CONIO +#include + +#define _VPUTC(c) _vputc(c) + +_STATIC int _insert_str(char *s, char c, int num); + +_STATIC int _con_flush(FILE *st); +_STATIC int _buf_flush(FILE *st); + +enum modifier { none, /* modifier prefixes */ + shortmod, /* short integer */ + longmod, /* long integer */ + ldmod }; /* LONGDOUBLE - syntax only */ + +_STATIC void _vprinter(const char *format, va_list _v_argptr) +{ + int n, p, c; + int np; + int pad; + int radix; + int pretemp; + int width, precision; + enum modifier mod; /* modifier type */ + int genflag; + long target; + char *in_str; + char _fmt_buf[64], *plist; + + n=0; + _vp_ret=0; + while((c=format[n++]) !=0) /* main loop to scan format string */ + { + switch(c) + { + case '%': + goto arg_eval; /* scan format spec */ +arg_eval_ret: +#pragma warn(wubd => off) + n+=p; +#pragma warn(wubd => on) + break; + default: /* output character */ + _VPUTC(c); + break; + } + } + return; + +arg_eval: + /* evaluate and output argument */ + plist=(char *) &format[n]; + p=0; /* set local format subscript */ + _upperHex='a'; /* default PF_HEX digit case */ + genflag=0; /* all flags to default */ + +/*************************************************************************** +* This paragraph reads any flags from the format string. The optimal * +* path is for no flags. Multiple flags are permitted. * +***************************************************************************/ + c=plist[p++]; + if(c == '%') + { + _VPUTC(c); + goto arg_eval_ret; + } + while(c != 0) + { + switch(c) + { + case '-': + genflag|=PF_LEFT; + goto cont; + case '+': + genflag|=PF_SIGN; + goto cont; + case '\ ': + genflag|=PF_SPACE; + goto cont; + case '#': + genflag|=PF_HASH; + goto cont; + case '0': + genflag|=PF_ZFLAG; + goto cont; + default: + goto noflag; + } +cont: + c=plist[p++]; + } +noflag: + if((genflag&PF_ZFLAG) && (genflag&PF_LEFT)) + genflag&=(~PF_ZFLAG); + if((genflag&PF_SIGN) && (genflag&PF_SPACE)) + genflag&=(~PF_SPACE); +/*************************************************************************** +* The next paragraph evaluates any width parameter if present. There is * +* no limit on field width apart from integer range. * +***************************************************************************/ + + width=0; + while (isdigit(c)) + { + width *= 10; + width += c- 0x30; + c=plist[p++]; + } + if(c == '*') /* _width is argument */ + { + width = va_arg(_v_argptr, int); + if(width < 0) + { + width*= -1; + genflag|=PF_LEFT; + genflag&=(~PF_ZFLAG); + } + c=plist[p++]; + } + +/*************************************************************************** +* The next paragraph evaluates any precision parameter if present. * +* Default precisions are set by the data type functions. PF_NOPOINT * +* if precision implicitly set to 0. Maximum precison is 32 digits. * +***************************************************************************/ + + precision=0; + pretemp=0; + if(c == '.') + { + while(isdigit(c=plist[p++])) + { + pretemp *= 10; + pretemp += c - 0x30; + } + if(c == '*') /* precision is argument */ + { + pretemp = va_arg(_v_argptr, int); + c=plist[p++]; + } + if(pretemp >= 0) + { + if(pretemp == 0) /* precision explicitly zero */ + genflag|=PF_NOPOINT; + else + { + precision=pretemp; /* precision non zero */ + if(precision > 32) + precision = 32; + } + genflag|=PF_PSET; + } + } + +/*************************************************************************** +* The next paragraph evaluates any type modifiers present. The optimal * +* path is for no modifiers * +***************************************************************************/ + + switch(c) + { + case 0 : /* incomplete spec - return for */ + case '\ ': /* literal output */ + _VPUTC('%'); + p=0; + goto arg_eval_ret; + case 'h': + mod=shortmod; /* short integer */ + goto modcont; + case 'l': + mod=longmod; /* long integer */ + goto modcont; + case 'L': + mod=ldmod; /* LONGDOUBLE ( no semantics) */ + goto modcont; + default: + mod=none; + break; +modcont: + c=plist[p++]; + break; + } + +/*************************************************************************** +* The next paragraph is the main switch for data types. Arguments are * +* fetched and evaluated by the appropriate conversion function with the * +* result in a buffer. The address of this buffer is passed to the * +* appropriate output section - _int_out, _real_out or _str_out. * +***************************************************************************/ + + switch(c) + { + case 'i': /* integer types */ + case 'd': + genflag|=PF_IS_SIGNED; + radix=10; + switch(mod) + { + case longmod: + target=va_arg(_v_argptr, long); + break; + case shortmod: + target= (long) va_arg(_v_argptr, short); + break; + default: + target= (long) va_arg(_v_argptr, int); + break; + } + goto int_out; + case 'u': /* unsigned */ + radix=10; + goto get_uns; + case 'o': /* octal */ + genflag|=PF_OCT; + radix=8; + goto get_uns; +do_nptr: + case 'X': /* PF_HEX */ + genflag|=PF_UPPER; + _upperHex= 'A'; + case 'x': + genflag|=PF_HEX; + radix=16; +get_uns: + switch(mod) + { + case longmod: + target=va_arg(_v_argptr, long); + break; + case shortmod: + target= (long) (unsigned) va_arg(_v_argptr, short); + break; + default: + target= (long) (unsigned) va_arg(_v_argptr, int); + break; + } + goto int_out; +int_ret: + break; + case 'E': /* reals */ + genflag|=PF_UPPER; /* exponent form */ + case 'e': + genflag|=PF_EXP; + case 'f': + goto do_real; + case 'G': + genflag|=PF_UPPER; + case 'g': + genflag|=PF_GTYPE; +do_real: + if(mod == ldmod) + genflag |= PF_LDMOD; + if((precision == 0) && ((genflag&PF_NOPOINT)==0)) + precision=6; + _v_argptr=_real_out(_v_argptr, genflag, width, precision); + break; + case 'c': /* character */ + if(!(genflag&PF_LEFT)) + { + while(width > 1) + { + _VPUTC(' '); + --width; + } + } + _VPUTC(va_arg(_v_argptr, int)); + while(width > 1) + { + _VPUTC(' '); + --width; + } + goto arg_eval_ret; + case 's': + genflag&= ~PF_ZFLAG; + precision=pretemp; + in_str= (char *)(va_arg(_v_argptr, char *)); + if(in_str) + _str_out(in_str, genflag, width, precision); + break; + case 'n': + switch(mod) + { + case longmod: + *(va_arg(_v_argptr, long *)) = _vp_ret; + break; + default : + *(va_arg(_v_argptr, int *)) = _vp_ret; + break; + } + goto arg_eval_ret; + case 'p': /* pointer */ + precision=4; + mod=none; + goto do_nptr; + default: /* invalid type - return for literal output */ + _VPUTC('%'); + p=0; + goto arg_eval_ret; + } + goto arg_eval_ret; + +/*************************************************************************** +* This paragraph handles precision and format for the integer value * +* now in the form of an ASCIIZ string. * +***************************************************************************/ + +int_out: + + np=50; + if(genflag&PF_IS_SIGNED) + ltoa(target, &_fmt_buf[50], radix); + else + ultoa(target, &_fmt_buf[50], radix); + if(precision == 0) /* set default precision */ + { + if((target == 0) && (genflag&PF_NOPOINT)) { + np=0; + if((genflag&PF_SPACE) && ((genflag&PF_IS_SIGNED))) + _fmt_buf[np++]='\ '; + _fmt_buf[np]='\0'; + _justify(_fmt_buf, genflag, width); /* and ouput */ + goto int_ret; + } + precision = 1; + } + + if((genflag&PF_ZFLAG) && (!(genflag&PF_PSET))) + { + precision=width; + width=0; + if(((target < 0) || (genflag&PF_SIGN)) && (precision > 0)) + --precision; + } + genflag&= ~PF_ZFLAG; + if((target < 0) && (genflag&PF_IS_SIGNED)) + np++; + pad = precision - strlen(&_fmt_buf[np]); /* pad with '0' to precision */ + while(pad > 0) + { + _fmt_buf[--np]='0'; + pad--; + } + if(genflag&(PF_HEX|PF_OCT)) /* PF_HEX and octal prefix */ + { + if((genflag&PF_HASH) && (target)) + { + if(genflag&PF_HEX) + { + if(genflag&PF_UPPER) + _fmt_buf[--np]='X'; + else + _fmt_buf[--np]='x'; + } + _fmt_buf[--np]= '0'; + } + } + if(genflag&PF_IS_SIGNED) + { /* set +/- */ + if(target >= 0) + { + if(genflag&PF_SIGN) /* leading + required */ + _fmt_buf[--np]= '+'; + else if(genflag&PF_SPACE) /* leading PF_SPACE required */ + _fmt_buf[--np]= ' '; + } + else + _fmt_buf[--np]='-'; /* copy existing PF_SIGN */ + } + _justify(&_fmt_buf[np], genflag, width); /* and ouput */ + goto int_ret; + + +} /* end of vprinter */ + + +/*************************************************************************** +* This next paragraph handles precision and format for the real value * +* now in the form of an ASCCIZ string. * +***************************************************************************/ + +va_list _rreal_out(va_list _v_argptr, int flag, int wid, int prec) +{ + char _fmt_buf[64]; + LONGDOUBLE ld; + + if(flag&PF_LDMOD) + ld=va_arg(_v_argptr, LONGDOUBLE); + else + ld=(LONGDOUBLE) va_arg(_v_argptr, double); + _f_fmt(_fmt_buf, ld, flag, prec); + _justify(_fmt_buf, flag, wid); + return(_v_argptr); +} + +_STATIC int _insert_str(char *s, char c, int num) +{ /* insert characters into string */ + movmem(s, s+num, strlen(s)+1); + setmem(s, num, c); + return(num); +} + +/*************************************************************************** +* This next function handles far pointer arguments. * +***************************************************************************/ + + +char *_fptoa(unsigned long ptr, char *s) + { + int pad; + unsigned off; + + _upperHex='A'; + ultoa(ptr>>16, s, 16); + s[4]=0; + pad=4-strlen(s); + if(pad > 0) + _insert_str(s, '0', pad); + s[4]=':'; + off=(unsigned) ptr; + ultoa((unsigned long) off, &s[5], 16); + pad=4-strlen(&s[5]); + s[9]=0; + if(pad > 0) + _insert_str(&s[5], '0', pad); + _upperHex='a'; + return(s); + } + +char *_f_fmt(char *_fmt_buf, LONGDOUBLE num, int flag, int prec) +{ + int np, nq; + char extemp[18], out_str[64]; + int dec, csign; + int fd; + int r, t; + int round, noround, tzeros; + + np=0; + nq=0; + _cvt( num, 18, &dec, &csign, out_str); + if(abs(dec) > 30) /* default to exponential form */ + flag|=PF_EXP; + if(csign) /* set PF_SIGN */ + _fmt_buf[np++]='-'; + else if(flag&PF_SIGN) + _fmt_buf[np++]= '+'; /* leading + */ + else if(flag&PF_SPACE) + _fmt_buf[np++]= ' '; /* leading space */ + if(flag&PF_HASH) + flag&=~PF_NOPOINT; /* force decimal point */ + fd=np; + +/*************************************************************************** +* This paragraph evaluates whether the exponential form is required and * +* copies the first digit of the mantissa and inserts the decimal point * +* If the exponent form is not being used, the position of the decimal * +* point is calulated and 0s are inserted if necessary. * +***************************************************************************/ + + if( ((flag&PF_GTYPE) && ((dec > (prec)) || (dec < -4))) || (flag&PF_EXP)) + { + flag|=PF_EXP; /* get first digit and decimal point */ + _fmt_buf[np++]=out_str[nq++]; + if(flag&PF_GTYPE) + --prec; + if(!(flag&PF_NOPOINT)) + _fmt_buf[np++]=DEC_POINT; + } + else + { + flag&=~PF_EXP; + if(dec <= 0) /* if negative exponent pad */ + { + _fmt_buf[np++]='0'; + if(!(flag&PF_NOPOINT)) + { + r=dec; + _fmt_buf[np++]=DEC_POINT; + while(r++ < 0) + { + if(--prec < 0) { + nq=-1; /* dont round */ + break; + } + _fmt_buf[np++]='0'; + } + } + else + nq=-1; + } + else /* positive exponent */ + { + r=dec; + while(r-- > 0) + { + t=out_str[nq++]; + if(nq > 17) + t='0'; + _fmt_buf[np++]= (char) t; + if(flag&PF_GTYPE) + { + if(prec-- == 0) + break; + } + } + if(!(flag&PF_NOPOINT)) + _fmt_buf[np++]=DEC_POINT; + } + } + +/*************************************************************************** +* This paragraph copies the digits to the right of the decimal point * +* to the limit of precison, padding with 0s if necessary. * +***************************************************************************/ + + noround=FALSE; + tzeros=FALSE; + if(!(flag&PF_NOPOINT)) /* copy digits to precision */ + { + tzeros=TRUE; + while(prec > 0) + { + if(nq > 17) + { + noround=TRUE; + break; + } + _fmt_buf[np++]=out_str[nq++]; + prec--; + } + if (prec > 0) + { /* pad to precision if necessary */ + noround=TRUE; + if((!(flag&PF_GTYPE)) || (flag&PF_HASH)) + { + while(prec-- > 0) + { + _fmt_buf[np++]='0'; + } + } + } + } + _fmt_buf[np]=0; + +/*************************************************************************** +* This paragraph rounds the copied number if any digits remain unused. * +***************************************************************************/ + + if(nq != -1) { + round=out_str[nq]; + if((!noround) && (isdigit(round))) /* round if any digits remain */ + { + r=np-1; + if(round >= '5') + { + while(r >= fd-1) + { + if(_fmt_buf[r] == DEC_POINT) /* skip decimal point */ + r--; + if(++_fmt_buf[r] > '9') + _fmt_buf[r--]='0'; + else + break; /* no carry */ + if(r < fd) + { + if(flag&PF_EXP) /* handle high order carry */ + { + _fmt_buf[r+1]='1'; + ++dec; + } + else + { + _insert_str(&_fmt_buf[fd], '1', 1); + np++; + } + break; + } + } + } + } + } + + if((tzeros) && (flag&(PF_GTYPE|PF_CPP)) && (!(flag&PF_HASH))) + { + while(_fmt_buf[--np] == '0') + { + _fmt_buf[np]=0; + } + ++np; + } + +/*************************************************************************** +* If required, this paragraph converts the exponent to ASCII string and * +* copies it to the target buffer. * +***************************************************************************/ + + if((_fmt_buf[np-1] == DEC_POINT) && (!(flag&PF_HASH))) + --np; + if((flag&PF_EXP) && ((dec != 1) || (!(flag&PF_GTYPE)))) + { + if(flag&PF_UPPER) + _fmt_buf[np++]='E'; + else + _fmt_buf[np++]='e'; + if(--dec < 0) + { + _fmt_buf[np++]='-'; + dec=abs(dec); + } + else + _fmt_buf[np++]='+'; + itoa(dec, extemp, 10); + t=strlen(extemp); + r=2-t; + if(r < 0 ) + r=0; + while(r--) + { /* insert leading 0s */ + _fmt_buf[np++]='0'; + } + r=0; + while(r < t) + { + _fmt_buf[np++]=extemp[r++]; + } + } + +/*************************************************************************** +* This paragraph terminates the string and calls the function which * +* justifies the number within its field width and outputs it. * +***************************************************************************/ + _fmt_buf[np]=0; + return(_fmt_buf); +} + +void _vp_setbuf(FILE *st, char *buffer) +{ + st->_base=buffer; + st->_ptr=buffer; + st->_size=PF_TEMP_BUF; + st->_cnt=PF_TEMP_BUF; + st->_flag|=_F_UBUF; + st->_flag&=(~_F_RST); + return; +} + +void _vp_freebuf(FILE *st) +{ + st->_size=0; + st->_cnt=0; + st->_flag&=(~_F_UBUF); + return; +} + +/*-------------------------------------------------------------------------* +* printf.c - formatted output to stdout * +* This function provides formatted output to stdout for a variable * +* number of arguments. * +*--------------------------------------------------------------------------*/ + +int printf(const char *format, ...) +{ + va_list _v_argptr; + int temp_buf, ret; + + temp_buf=0; + if(stdout->_size == 0) + { + char buffer[PF_TEMP_BUF]; + + stdout->_flag|=_F_RST; + _vp_setbuf(stdout, buffer); + temp_buf=1; + } + _vp_flush=_flusher; /* set output flusher */ + _stream=stdout; + va_start(_v_argptr, format); /* initialise argument pointer */ + _vprinter(format, _v_argptr); /* do it */ + if(temp_buf) + { + _flusher(stdout); + stdout->_flag|=_F_RST; + _vp_freebuf(stdout); + } + else if(stdout->_flag&_F_DEV) + _flusher(stdout); + ret=_vp_ret; + return(ret); /* return number of characters output */ +} + +/*-------------------------------------------------------------------------* +* cprintf.c - formatted output to console * +* This function provides formatted output to console for a variable * +* number of arguments. * +*--------------------------------------------------------------------------*/ + +int _con_flush(FILE *st) +{ + int n, num; + char *buf; + + n=0; + buf=st->_base; + num=st->_cnt; + if(num < 0) + num=0; + num=st->_size-num; + while(num-- > 0) + { + putch(buf[n++]); + } + st->_cnt=st->_size; + st->_ptr=st->_base; + return(0); +} + +int cprintf(const char *format, ...) +{ + + va_list _v_argptr; + FILE cst; + char cbuf[PF_VBSIZE]; + int ret; + + _vp_flush=_con_flush; /* set output function */ + cst._cnt=PF_VBSIZE; + cst._size=PF_VBSIZE; + cst._base=cbuf; + cst._ptr=cbuf; + _stream=&cst; + va_start(_v_argptr, format); /* initialise argument pointer */ + _vprinter(format, _v_argptr); /* do it */ + _con_flush(&cst); + ret=_vp_ret; + return(ret); /* return number of characters output */ +} + +/*-------------------------------------------------------------------------* +* sprintf.c - formatted output to buffer * +* This function provides formatted output to a character buffer for a * +* variable number of arguments. * +*--------------------------------------------------------------------------*/ + +int _buf_flush(FILE *st) +{ + st->_cnt=st->_size; + st->_ptr=st->_base; + return(0); +} + +int sprintf(char *s, const char *format, ...) +{ + va_list _v_argptr; + FILE sst; + int ret; + + _vp_flush=_buf_flush; /* set output function */ + sst._base=s; + sst._ptr=s; + sst._cnt=INT_MAX-1; + sst._size=INT_MAX-1; + sst._flag=_F_BIN; + _stream=&sst; + va_start(_v_argptr, format); /* initialise argument pointer */ + _vprinter(format, _v_argptr); /* do it */ + *sst._ptr=0; + ret=_vp_ret; + return(ret); /* return number of characters output */ +} + +/*-------------------------------------------------------------------------* +* fprintf.c - formatted output to stream * +* This function provides formatted output to stream for a variable * +* number of arguments. * +*--------------------------------------------------------------------------*/ + +int fprintf(FILE *st, const char *format, ...) +{ + va_list _v_argptr; + int temp_buf, ret; + + temp_buf=0; + if((st->_flag&_F_IN) || (!(st->_flag&_F_WRIT))) + return(-1); + if(st->_size == 0) + { + char buffer[PF_TEMP_BUF]; + + st->_flag|=_F_RST; + _vp_setbuf(st, buffer); + temp_buf=1; + } + _vp_flush=_flusher; /* set output function */ + _stream=st; /* initialise file pointer */ + va_start(_v_argptr, format); /* initialise argument pointer */ + _vprinter(format, _v_argptr); /* do it */ + if(temp_buf) + { + _flusher(st); + st->_flag|=_F_RST; + _vp_freebuf(st); + } + else if(st->_flag&_F_DEV) + _flusher(st); + ret=_vp_ret; + return(ret); /* return number of characters output */ +} + +/*-------------------------------------------------------------------------* +* vprintf.c - formatted output to stdout * +* This function provides formatted output to stdout for a variable * +* number of arguments. * +*--------------------------------------------------------------------------*/ + +int vprintf(const char *format, va_list param) +{ + va_list _v_argptr; + int temp_buf, ret; + + temp_buf=0; + if(stdout->_size == 0) + { + char buffer[PF_TEMP_BUF]; + + stdout->_flag|=_F_RST; + _vp_setbuf(stdout, buffer); + temp_buf=1; + } + _vp_flush=_flusher; /* set output function */ + _v_argptr= param; /* initialise argument pointer */ + _stream=stdout; + _vprinter(format, _v_argptr); /* do it */ + if(temp_buf) + { + _flusher(stdout); + stdout->_flag|=_F_RST; + _vp_freebuf(stdout); + } + else if(stdout->_flag&_F_DEV) + _flusher(stdout); + ret=_vp_ret; + return(ret); /* return number of characters output */ +} + +/*-------------------------------------------------------------------------* +* vsprintf.c - formatted output to buffer * +* This function provides formatted output to a character buffer for a * +* variable number of arguments. * +*--------------------------------------------------------------------------*/ + +int vsprintf(char *s, const char *format, va_list param) +{ + va_list _v_argptr; + FILE sst; + int ret; + + _vp_flush=_buf_flush; /* set output function */ + sst._base=s; + sst._ptr=s; + sst._cnt=INT_MAX-1; + sst._size=INT_MAX-1; + sst._flag=_F_BIN; + _stream=&sst; + _v_argptr= param; /* initialise argument pointer */ + _vprinter(format, _v_argptr); /* do it */ + *sst._ptr=0; /* terminator for output string */ + ret=_vp_ret; + return(ret); /* return number of characters output */ +} + +/*-------------------------------------------------------------------------* +* vfprintf.c - formatted output to stream * +* This function provides formatted output to stream for a variable * +* number of arguments. * +*--------------------------------------------------------------------------*/ + +int vfprintf(FILE *st, const char *format, va_list param) +{ + va_list _v_argptr; + int temp_buf, ret; + + temp_buf=0; + if((st->_flag&_F_IN) || (!(st->_flag&_F_WRIT))) + return(-1); + if(st->_size == 0) + { + char buffer[PF_TEMP_BUF]; + + st->_flag|=_F_RST; + _vp_setbuf(st, buffer); + temp_buf=1; + } + _vp_flush=_flusher; /* set output function */ + _stream=st; /* set file pointer */ + _v_argptr=param; /* initialise argument pointer */ + _vprinter(format, _v_argptr); /* do it */ + if(temp_buf) + { + char buffer[PF_TEMP_BUF]; + + _flusher(st); + st->_flag|=_F_RST; + _vp_setbuf(st, buffer); + } + else if(st->_flag&_F_DEV) + _flusher(st); + ret=_vp_ret; + return(ret); /* return number of characters output */ +} diff --git a/code/SIBOSDK/src/r_emul.a b/code/SIBOSDK/src/r_emul.a new file mode 100644 index 0000000..057c087 --- /dev/null +++ b/code/SIBOSDK/src/r_emul.a @@ -0,0 +1,136 @@ +(* Release 3.00 *) + +module r_emul + +include "corelib.inc" +include "epocdefs.inc" + +public FIDRQQ = 05C32H +public FIWRQQ = 0A23DH + +public FIERQQ = 01632H +public FIARQQ = 0FE32H +public FISRQQ = 00632H +public FICRQQ = 00E32H + +public FJERQQ = 00000H +public FJARQQ = 04000H +public FJSRQQ = 08000H +public FJCRQQ = 0C000H + +public FIXRQQ = 0 + +segment _TEXT(CODE,28H) +segment _DATA(DATA,28H) + +__emName: db 'SYS$8087.LDD',0 +__lddName: db 'EM$:',0 +__lddNameX: db 'EM$',0 + +extrn __SH_sword +extrn _DatCommandPtr + +segment _DATA(DATA,28H) + +__FChan: dw 0 + +select _TEXT + +extrn __fp_1 +extrn __sigFp +extrn __math_excep +extrn __FatalErrorPos +extrn __FatalError + +xEnv = -256 +xBuf = xEnv-MaxPathSize + +public __FloatInit: + + push bp + mov bp, sp + add sp, xBuf +; + sub dx, dx + mov cx, [_DatCommandPtr] + jcxz noCommandLine +tryAgain: + mov bx, __emName + lea di, [bp][xBuf] + sub si, si + sub al, al + mov ah, NmFilParse + int FilManager + jc noCommandLine + mov bx, di + xor al, al + mov ah, NmDevLoadLDD + int DevManager + jnc loadedLdd + cmp al, ExistsErr + je loadedLdd + test dx, dx + jne openFailed +noCommandLine: + inc dx + lea si, [bp][xEnv] + mov di, __lddNameX + mov ah, NmGenEnvStringGet + int GenManager + jc openFailed + mov cx, si + jmp tryAgain +loadedLdd: + mov dx, __sigFp + mov cx, -1 + mov bx, __lddName + mov ah, NmIoOpen + int DevManager + jc openFailed + mov [__FChan], ax +; + mov sp, bp + pop bp + jmp __fp_1 +; +openFailed: + call __FatalErrorPos + mov bx, 0FFFFH + jmp __FatalError + +public __FloatFinish: + + mov bx, [__FChan] + test bx, bx + je skipClose + mov ah, NmIoClose + int IoManager + mov bx, __lddNameX + mov dx, LDDSignature + mov ah, NmDevDelete + int DevManager +skipClose: + ret 0 + +public __FloatMathExcepDos : + fstsw [__SH_sword] + fclex + jmp near __math_excep + +public __FloatJmpSave : + + fld st(0), st(1) + fstp tbyte [di][_j_st1], st(0) + fld st(0), st(2) + fstp tbyte [di][_j_st2], st(0) + ret 0 + +public __FloatJmpRestore : + + fld tbyte st(0), [si][_j_st1] + fstp st(2), st(0) + fld tbyte st(0), [si][_j_st2] + fstp st(3), st(0) + ret 0 + +end diff --git a/code/SIBOSDK/src/scanf.c b/code/SIBOSDK/src/scanf.c new file mode 100644 index 0000000..3129409 --- /dev/null +++ b/code/SIBOSDK/src/scanf.c @@ -0,0 +1,899 @@ +/* Release 3.00 */ + +/*-------------------------------------------------------------------------* +* * +* r_scanf.c - MSDOS formatted input module * +* * +* COPYRIGHT (C) 1989 Jensen and Partners. All Rights Reserved * +* Written by Simon Knight. * +* * +* COPYRIGHT (C) 1991 Psion PLC. All Rights Reserved * +* Modified by NSM. * +* * +*--------------------------------------------------------------------------*/ + +#define _USE_CONIO +#include + +_STATIC void _vscanner(const char *param_list, va_list _v_argptr); +_STATIC va_list _get_int(int pmod, int smod, unsigned flag, int width, va_list _v_argptr); +_STATIC va_list _get_char(int pmod, unsigned flag, int width, int setwidth, va_list _v_argptr); +_STATIC va_list _get_str(int pmod, unsigned flag, int width, va_list _v_argptr); +_STATIC va_list _get_str_delim(char *s, int pmod, unsigned flag, int width, va_list _v_argptr); +_STATIC va_list _get_pointer(int pmod, unsigned flag, va_list _v_argptr); +_STATIC int _skip_space(void); +_STATIC int _scan_input(int scan_state); +_STATIC int _isterm(char *s, char tc); +_STATIC int _buf_fil(FILE *st); +_STATIC int _con_fil(FILE *st); + +int _vgetc(void); +int _vungetc(int c); + +enum modifier { none, /* modifier prefixes */ + shortmod, /* short integer */ + longmod, /* long integer */ + ldmod }; /* LONGDOUBLE */ + +#define _VGETC() _vgetc() +#define _VUNGETC(c) _vungetc(c) +#define _SKIP_SPACE() _skip_space() +#define _SCAN_INPUT(scan_state) _scan_input(scan_state) + +/**************************************************************************** +* this function scans the format string. * +****************************************************************************/ + +_STATIC void _vscanner(const char *plist, va_list _v_argptr) +{ + int n; + int c, i; + int p, f; + int pmod, smod; + int width, setwidth; + unsigned flag; + char *tlist; + + n=0; + _s_args=0; + _vs_count=0; /* zero counts */ + while((c=plist[n++]) != 0) /* scan format string */ + { + if(_v_argptr == NULL) + break; + if(isspace(c)) /* skip white space characters */ + { /* between input data */ + while(isspace(i=_VGETC())); /* force end of file */ + if(i > 0) + { + _VUNGETC(i); + continue; + } + else + return; + } + if(c == '%') /* evaluate format spec */ + { + tlist=(char *) &plist[n]; + goto _fmt_eval; +_fmt_eval_ret: +#pragma warn(wubd => off) + if(p) + { + n+=p; +#pragma warn(wubd => on) + continue; + } + else /* format spec error */ + { /* get next character and */ + if((c=plist[n++]) == 0) /* check against input */ + break; + } + } + if(c != (i =_VGETC())) /* if input char doesn't match - */ + { + _VUNGETC(c); + break; /* terminate */ + } + } + _vs_count++; + return; + +/**************************************************************************** +* This routine evaluates the format spec. * +****************************************************************************/ + +_fmt_eval: + + p=0; + flag=0; + f=tlist[0]; + if(f == '*') + { + flag|=SF_SUPRESS; /* suppress asignment */ + p++; + } + +/*************************************************************************** +* The next paragraph evaluates any width parameter if present. There is * +* no limit on field width apart from integer range. * +***************************************************************************/ + + width=0; + f=tlist[p++]; + while (isdigit(f)) + { + width *= 10; + width += f- 0x30; + f=tlist[p++]; + } + if(!width) + { + setwidth=0; /* width explicitly 0 */ + width=SHRT_MAX; + } + else + setwidth=width; + +/*************************************************************************** +* This paragraph evaluates any pointer modifiers present. The optimal * +* path is for no modifiers * +***************************************************************************/ + + pmod=none; + +/*************************************************************************** +* This paragraph evaluates any size modifiers present. The optimal * +* path is for no modifiers * +***************************************************************************/ + + switch(f) + { + case 0 : /* incomplete spec - return */ + case '\ ': + p=0; + goto _fmt_eval_ret; + case 'h': + smod=shortmod; /* short integer */ + f=tlist[p++]; + break; + case 'L': + smod=ldmod; /* LONGDOUBLE */ + f=tlist[p++]; + break; + case 'l': + smod=longmod; /* long integer */ + f=tlist[p++]; + break; + default: + smod=none; + break; + } + +/*************************************************************************** +* This paragraph is the main type switch. The argument pointer is taken * +* from the argument list and input and conversion functions called, where* +* if not disabled, an assignment is made. * +***************************************************************************/ + + switch(f) + { + case 'i': + flag|=SF_WILD; + goto _do_int; + break; + case 'd': + goto _do_int; + break; + case 'o': + flag|=SF_OCT; + goto _do_int; + break; + case 'X': + case 'x': + flag|=SF_HEX; + goto _do_int; + break; + case 'U': + flag|=SF_UPPER; + case 'u': + flag|=SF_NSIGNED; +_do_int: + _v_argptr=_get_int(pmod, smod, flag, width, _v_argptr); + break; + case 'E': /* real types */ + case 'e': + case 'f': + case 'G': + case 'g': + _v_argptr=_real_in(pmod, smod, flag, width, _v_argptr); + break; + case 'c': /* character */ + _v_argptr=_get_char(pmod, flag, width, setwidth, _v_argptr); + break; + case 's': /* string */ + _v_argptr=_get_str(pmod, flag, width, _v_argptr); + break; + case '[': /* deliminated string */ + _v_argptr=_get_str_delim(&tlist[p], pmod, flag, width, _v_argptr); + while((tlist[p++] != ']') && (p-1)); + break; + case 'n': /* character count */ + if(smod == longmod) + *(va_arg(_v_argptr, long *)) = _vs_count; + else + *(va_arg(_v_argptr, int *)) = _vs_count; + break; + case 'p': /* pointer */ + flag|=(SF_HEX); + pmod=none; + goto _do_int; + default: + p=0; + goto _fmt_eval_ret; + } + goto _fmt_eval_ret; /* return */ +} + +_STATIC int _skip_space() +{ + int i; + + while(isspace(i=_VGETC())); /* skip white space in stream */ + if(i >= 0) + { + _VUNGETC(i); + return(0); + } + else if(_s_args == 0) + longjmp(_EOFhandler, 1); + return(-1); +} + +_STATIC int _scan_input(int scan_state) +{ + int c; + + c=_VGETC(); + if(c != -1) + return(c); + if((_s_args == 0) && (scan_state == 0)) + longjmp(_EOFhandler, 1); + return(-1); +} + +/**************************************************************************** +* This function scans the input stream and converts to an integer. * +****************************************************************************/ + +_STATIC va_list _get_int(int pmod, int smod, unsigned flag, int width, va_list _v_argptr) +{ + unsigned long temp; + int c, good_scan; + int negative; + void *iptr; + + temp=0; + good_scan=0; + negative=FALSE; + if(_SKIP_SPACE() == -1) + return(_v_argptr); + c=_SCAN_INPUT(good_scan); + if((c == '+') && (width)) + { + if((c=_SCAN_INPUT(good_scan)) == -1) + return(_v_argptr); + --width; + } + else if((c == '-') && (width)) + { /* number is negative */ + negative=TRUE; + if((c=_SCAN_INPUT(good_scan)) == -1) + return(_v_argptr); + --width; + } + if(flag&SF_WILD) + { /* get dec oct or hex */ + if((c =='0') && (width)) + { + flag|=SF_OCT; + --width; + good_scan=1; + c=_SCAN_INPUT(good_scan); + c=tolower(c); + if(c == 'x') + { + flag|=SF_HEX; + if((c=_SCAN_INPUT(good_scan)) == -1) + return(_v_argptr); + --width; + } + } + } + if(flag&SF_HEX) /* convert hex */ + { + if((c =='0') && (width)) + { + --width; + good_scan=1; + c=_SCAN_INPUT(good_scan); + c=tolower(c); + if(c == 'x') + { + if((c=_SCAN_INPUT(good_scan)) == -1) + return(_v_argptr); + --width; + } + } + while((isxdigit(c=tolower(c))) && (width >0)) + { + good_scan=1; + temp*=16; + if(!isdigit(c)) + c-=87; + else + c-='0'; + temp+=c; + c=_SCAN_INPUT(good_scan); + --width; + } + } + else if(flag&SF_OCT) /* convert octal */ + { + while((c >= '0') && (c <= '7') && (width>0)) + { + good_scan=1; + temp*=8; + temp+=c-'0'; + c=_SCAN_INPUT(good_scan); + --width; + } + } + else /* convert decimal */ + { + while((isdigit(c)) && (width>0)) + { + good_scan=1; + temp*=10; + temp+=c-'0'; + c=_SCAN_INPUT(good_scan); + --width; + } + } + _VUNGETC(c); + if((!(flag&SF_NSIGNED)) && (negative)) /* ignore '-' if unsigned */ + temp*= -1; + if(!good_scan) + return(NULL); + if(!(flag&SF_SUPRESS)) /* assign field unless suppressed */ + { + if(flag&SF_UPPER) + smod=longmod; + iptr = (va_arg(_v_argptr, void *)); + switch(smod) + { + case shortmod: + *((short *) iptr) = (short) temp; + break; + case longmod: + *((long *) iptr) = (long) temp; + break; + default: + *((int *) iptr) = (int) temp; + break; + } + _s_args++; /* inc argument counter */ + } + return(_v_argptr); +} + +/**************************************************************************** +* This function scans the input stream and converts to real. * +****************************************************************************/ + +#pragma warn(wall => off) + +va_list _rreal_in(int pmod, int smod, unsigned flag, int width, va_list _v_argptr) +{ + int n, q, c, good_scan; + LONGDOUBLE volatile dtemp; + char _fmt_buf[64]; /* buffer for formatted number */ + void *dptr; + + n=0; + good_scan=0; + if(_SKIP_SPACE() == -1) + return(_v_argptr); + c=_SCAN_INPUT(good_scan); + while(1) + { + if((c == '+') || (c == '-')) /* leading sign */ + { + _fmt_buf[n++]= (char) c; + if((c=_SCAN_INPUT(good_scan)) == -1) + return(_v_argptr); + --width; + } /* width check always after _VGETC */ + for(q=0; q<2; q++) + { + while((isdigit(c)) && (width)) /* get digits */ + { + good_scan=1; + _fmt_buf[n++]= (char) c; + c=_SCAN_INPUT(good_scan); + --width; + } + if((c == DEC_POINT) && (q == 0) && (width)) /* decimal point */ + { + _fmt_buf[n++]= (char) c; + if((c=_SCAN_INPUT(good_scan)) == -1) + break; + --width; + } + else if(q == 0) + break; + } /* go back for more digits if first iteration */ + if(!width) + break; /* exponent */ + if((c == 'E') || (c == 'e') || (c == 'D') || (c == 'd')) + { + _fmt_buf[n++]= (char) c; + c=_SCAN_INPUT(good_scan); + --width; + } + else + break; + if(!width) /* exponent leading sign */ + break; + if((c == '+') || (c == '-')) + { + _fmt_buf[n++]= (char) c; + c=_SCAN_INPUT(good_scan); + --width; + } /* exponent digits */ + while((isdigit(c)) && (width)) + { + _fmt_buf[n++]= (char) c; + c=_SCAN_INPUT(good_scan); + --width; + } + break; + } + _fmt_buf[n]=0; /* terminate string */ + _VUNGETC(c); + if(!good_scan) + return(NULL); + if(!(flag&SF_SUPRESS)) + { + dtemp=atofl(_fmt_buf); /* convert and assign if not suppressed */ + dptr = (va_arg(_v_argptr, void *)); + switch(smod) + { + case ldmod : + *((LONGDOUBLE *) dptr) = dtemp; + break; + case longmod : + *((double *) dptr) = (double) dtemp; + break; + default : + *((float *) dptr) = (float) dtemp; + break; + } + _s_args++; + } + return(_v_argptr); +} + +/**************************************************************************** +* This function scans the input stream for the next width characters even * +* if white space. * +****************************************************************************/ + +_STATIC va_list _get_char(int pmod, unsigned flag, int width, int setwidth, va_list _v_argptr) +{ + int c, n, good_scan; + char *array; + + n=0; + good_scan=0; + if(!setwidth) /* width = 1 if not set */ + width=1; + if(!(flag&SF_SUPRESS)) /* if not suppressed get char pointer */ + { + array=va_arg(_v_argptr, char *); + } + while(width) + { /* scan input */ + if((c=_SCAN_INPUT(good_scan)) == -1) + break; + --width; + good_scan=1; + if(!(flag&SF_SUPRESS)) /* assign if not suppressed */ + { + array[n++]=(char) c; /* terminate string if not suppressed */ + } + } + if(good_scan) + ++_s_args; + else + return(NULL); + return(_v_argptr); +} + +/**************************************************************************** +* This function scans the input stream for the next width characters * +* until it finds a white space character. * +****************************************************************************/ + +_STATIC va_list _get_str(int pmod, unsigned flag, int width, va_list _v_argptr) +{ + int c, n, good_scan; + char *array; + + n=0; + good_scan=0; + if(_SKIP_SPACE() == -1) + return(_v_argptr); + c=_SCAN_INPUT(good_scan); + if(!(flag&SF_SUPRESS)) /* get char pointer if not suppressed */ + { + array=va_arg(_v_argptr, char *); + } + while (width) + { + if(isspace(c)) /* terminate if white-space or EOF */ + break; + good_scan=1; + if(!(flag&SF_SUPRESS)) /* assign if not suppressed */ + { + array[n++]=(char) c; + } + if((c=_SCAN_INPUT(good_scan)) == -1) + break; + --width; + } + _VUNGETC(c); + if(!(flag&SF_SUPRESS)) /* terminate string if not suppressed */ + { + array[n]='\0'; /* terminate string if not suppressed */ + } + if(good_scan) + ++_s_args; + else + return(NULL); + return(_v_argptr); +} + +/**************************************************************************** +* This function scans the input stream for the next width characters * +* until it finds a white space character. * +****************************************************************************/ + +_STATIC va_list _get_str_delim(char *s, int pmod, unsigned flag , int width, va_list _v_argptr) +{ + int c, n, good_scan; + char *array; + + n=0; + good_scan=0; + if((c=_SCAN_INPUT(good_scan)) == -1) + return(_v_argptr); + if(!(flag&SF_SUPRESS)) /* get char pointer unless suppressed */ + { + array=va_arg(_v_argptr, char *); + } + while(width) + { + if(_isterm(s, (char)c)) /* terminate if a deliminating character */ + break; + good_scan=1; + if(!(flag&SF_SUPRESS)) /* asign if not suppressed */ + { + array[n++]=(char) c; + } + if((c=_SCAN_INPUT(good_scan)) == -1) + break; + width--; + } + _VUNGETC(c); + if(!(flag&SF_SUPRESS)) + { + array[n]='\0'; /* terminate string if not suppressed */ + } + if(good_scan) + ++_s_args; + else + return(NULL); + return(_v_argptr); +} + +/**************************************************************************** +* This function scans the format string for deliminating characters. * +* It returns TRUE if the character is a deliminator. * +****************************************************************************/ + +_STATIC int _isterm(char *s, char tc) +{ + int n; + int first; + + n=0; + first=TRUE; + if(s[n] == '^') /* charcaters in set are deliminators */ + { + n++; + while(((s[n] != ']') || (first)) && (s[n])) + { + first=FALSE; + if(tc == s[n++]) + return(TRUE); + } + return(FALSE); + } /* characters not in set are deliminators */ + else + { + while(((s[n] != ']') || (first)) && (s[n])) + { + first=FALSE; + if(tc == s[n++]) + return(FALSE); + } + return(TRUE); + } +} + +#pragma warn(wall => on) +#pragma warn(wpnu => off) + +/*-------------------------------------------------------------------------* +* scanf.c - formatted input from stdin * +* This function provides formatted input from stdin for a variable * +* number of arguments. * +*--------------------------------------------------------------------------*/ + +int scanf(const char *format, ...) +{ + va_list _v_argptr; + int temp_buf, ret; + + temp_buf=0; + if(stdin->_size == 0) + { + char buffer[PF_TEMP_BUF]; + stdin->_flag|=_F_RST; + _vp_setbuf(stdin, buffer); + stdin->_cnt=0; + temp_buf=1; + } + _vs_fill=_filler; /* set put_back function */ + _stream=stdin; + va_start(_v_argptr, format); /* initialise argument pointer */ + if(setjmp(_EOFhandler)) /* EOF in input function arrives here */ + { + ret=-1; + goto sf_out; + } + _vscanner(format, _v_argptr); /* do it */ + ret=_s_args; +sf_out: + if(temp_buf) + { + fflush(stdin); + _vp_freebuf(stdin); + } + return(ret); /* return number of fields assigned */ +} + +/*-------------------------------------------------------------------------* +* cscanf.c - formatted input from console * +* This function provides formatted input from console for a variable * +* number of arguments. * +*--------------------------------------------------------------------------*/ + +int _con_fil(FILE *st) +{ + int c; + + st->_ptr=st->_base; + st->_cnt=st->_size; + c=getche(); + *st->_ptr= (char ) c; + if(c == 13) + ungetch(10); + if(c == _CTLZ) + return(EOF); + return(1); +} + +int cscanf(const char *format, ...) +{ + va_list _v_argptr; + FILE cst; + char cbuf[2]; + + cst._cnt=0; + cst._size=1; + cst._base=cbuf; + cst._ptr=cbuf; + _stream=&cst; + _vs_fill=_con_fil; /* set filler function */ + va_start(_v_argptr, format); /* initialise argument pointer */ + if(setjmp(_EOFhandler)) /* EOF in input function arrives here */ + return(EOF); + _vscanner(format, _v_argptr); /* do it */ + return(_s_args); /* return number of fields assigned */ +} + +/*-------------------------------------------------------------------------* +* sscanf.c - formatted input from buffer * +* This function provides formatted input from a character buffer for a * +* variable number of arguments. * +*--------------------------------------------------------------------------*/ + +int _buf_fil(FILE *st) +{ + return(-1); +} + +int sscanf(const char *s, const char *format, ...) +{ + va_list _v_argptr; + FILE sst; + + _vs_fill=_buf_fil; /* set filler function */ + sst._cnt=strlen(s)+1; + sst._ptr=(char *) s; + sst._flag=_F_BIN; + _stream=&sst; + va_start(_v_argptr, format); /* initialise argument pointer */ + if(setjmp(_EOFhandler)) /* EOF arrives here */ + return(EOF); + _vscanner(format, _v_argptr); /* do it */ + return(_s_args); /* return number of fields assigned */ +} + +/*-------------------------------------------------------------------------* +* fscanf.c - formatted input from stream * +* This function provides formatted input from stream for a variable * +* number of arguments. * +*--------------------------------------------------------------------------*/ + +int fscanf(FILE *st, const char *format, ...) +{ + va_list _v_argptr; + int temp_buf, ret; + + temp_buf=0; + if((st->_flag&_F_OUT) || (!(st->_flag&_F_READ))) + return(-1); + if(st->_size == 0) + { + char buffer[PF_TEMP_BUF]; + st->_flag|=_F_RST; + _vp_setbuf(st, buffer); + st->_cnt=0; + temp_buf=1; + } + _vs_fill=_filler; /* set put_back function */ + _stream=st; + va_start(_v_argptr, format); /* initialise argument pointer */ + if(setjmp(_EOFhandler)) /* EOF in input function arrives here */ + { + ret=-1; + goto fsf_out; + } + _vscanner(format, _v_argptr); /* do it */ + ret=_s_args; +fsf_out: + if(temp_buf) + { + fflush(st); + _vp_freebuf(st); + } + return(ret); /* return number of fields assigned */ +} + +/*-------------------------------------------------------------------------* +* vscanf.c - formatted input from stdin * +* This function provides formatted input from stdin for a variable * +* number of arguments. * +*--------------------------------------------------------------------------*/ + +int vscanf(const char *format, va_list argptr) +{ + va_list _v_argptr; + int temp_buf, ret; + + temp_buf=0; + if(stdin->_size == 0) + { + char buffer[PF_TEMP_BUF]; + + stdin->_flag|=_F_RST; + _vp_setbuf(stdin, buffer); + stdin->_cnt=0; + temp_buf=1; + } + _vs_fill=_filler; /* set put_back function */ + _stream=stdin; + _v_argptr=argptr; /* initialise argument pointer */ + if(setjmp(_EOFhandler)) /* EOF in input function arrives here */ + { + ret=-1; + goto vsf_out; + } + _vscanner(format, _v_argptr); /* do it */ + ret=_s_args; +vsf_out: + if(temp_buf) + { + fflush(stdin); + _vp_freebuf(stdin); + } + return(ret); /* return number of fields assigned */ +} + +/*-------------------------------------------------------------------------* +* vsscanf.c - formatted input from buffer * +* This function provides formatted input from a character buffer for a * +* variable number of arguments. * +*--------------------------------------------------------------------------*/ + +int vsscanf(const char *s, const char *format, va_list argptr) +{ + va_list _v_argptr; + FILE sst; + + _vs_fill=_buf_fil; /* set filler function */ + sst._cnt=strlen(s)+1; + sst._ptr=(char *) s; + sst._flag=_F_BIN; + _stream=&sst; + _v_argptr=argptr; /* initialise argument pointer */ + if(setjmp(_EOFhandler)) /* EOF arrives here */ + return(EOF); + _vscanner(format, _v_argptr); /* do it */ + return(_s_args); /* return number of fields assigned */ +} + +/*-------------------------------------------------------------------------* +* vfscanf.c - formatted input from stream * +* This function provides formatted input from stream for a variable * +* number of arguments. * +*--------------------------------------------------------------------------*/ + +int vfscanf(FILE *st, const char *format, va_list argptr) +{ + va_list _v_argptr; + int temp_buf, ret; + + temp_buf=0; + if((st->_flag&_F_OUT) || (!(st->_flag&_F_READ))) + return(-1); + if(st->_size == 0) + { + char buffer[PF_TEMP_BUF]; + st->_flag|=_F_RST; + _vp_setbuf(st, buffer); + st->_cnt=0; + temp_buf=1; + } + _vs_fill=_filler; /* set put_back function */ + _stream=st; + _v_argptr=argptr; /* initialise argument pointer */ + if(setjmp(_EOFhandler)) /* EOF in input function arrives here */ + { + ret=-1; + goto vfsf_out; + } + _vscanner(format, _v_argptr); /* do it */ + ret=_s_args; +vfsf_out: + if(temp_buf) + { + fflush(st); + _vp_freebuf(st); + } + return(ret); /* return number of fields assigned */ +} + diff --git a/code/SIBOSDK/src/stdiostr.cpp b/code/SIBOSDK/src/stdiostr.cpp new file mode 100644 index 0000000..b60827c --- /dev/null +++ b/code/SIBOSDK/src/stdiostr.cpp @@ -0,0 +1,157 @@ +/* Release 3.10 */ +/*-------------------------------------------------------------------------* +* * +* STDIOSTR.CPP - 2.0 stream class implementations. * +* * +* COPYRIGHT (C) 1989..1992 Clarion Software Corporation. * +* All Rights Reserved * +* * +*--------------------------------------------------------------------------*/ + +#include +#include + +#pragma module(init_prio=>22) + +stdiobuf::stdiobuf(FILE *f) : streambuf(NULL, 0) { + + if(unbuffered()) { + setb(lahead, &lahead[1], 0); + unbuffered(1); + } + setp(base(), base()); + setg(base(), ebuf(), ebuf()); + sio=f; + last_seek=0; + gs=0; + sync(); +} + +stdiobuf::~stdiobuf() { + +// fclose(f); +} + +int stdiobuf::overflow(int c) { + + int nw; + + if(unbuffered()) { + if((c == EOF) || (fputc(c, sio) == EOF)) + return EOF; + } + else { + nw=pptr()-pbase(); + if(nw) { + if(::fwrite(pbase(), sizeof(char), nw, sio) != nw) + return EOF; + } + } + last_seek=ftell(sio); + setp(pbase(), epptr()); + if((c != EOF) && (!unbuffered())) + sputc(c); + return c; +} + +int stdiobuf::last_op() { + + int ret; + + if(pptr() > pbase()) + ret= ios::out; + else if(gs) + ret= ios::in; + else + ret = 0; + return ret; +} + +int stdiobuf::pbackfail(int c) { + + if(!unbuffered()) + sync(); + return ungetc(c, sio); +} + +int stdiobuf::sync() { + + if(unbuffered()) { + setp(base(), base()); + setg(base(), ebuf(), ebuf()); + return fflush(sio); + } + if(last_op() == ios::out) + overflow(); + else if(last_op() == ios::in) { + last_seek+= gptr()-eback(); + ::fseek(sio, last_seek, SEEK_SET); + } + else + return 0; + setp(base(), ebuf()); + setg(base(), ebuf(), ebuf()); + gs=0; + return 0; +} + +int stdiobuf::underflow() { + + int nr, c; + + gs=1; + nr=ebuf()-eback(); + last_seek=ftell(sio); + if(nr == 1) { + c=fgetc(sio); + if(c == EOF) + return EOF; + *eback()=c; + } + else { + nr=fread(eback(), sizeof(char), nr, sio); + if(ferror(sio) || (nr == 0)) + return EOF; + } + setg(eback(), eback(), eback()+nr); + return *gptr(); +} + +streampos stdiobuf::seekoff(streamoff off, ios::seek_dir d, int) { + + streampos p; + ios::seek_dir dir; + + if(d == ios::cur) { + if(last_op() == ios::out) + p = pptr()-pbase(); + else if(last_op() == ios::in) + p = gptr()-eback(); + else + p=0; + p += last_seek + off; + dir=ios::beg; + } + else { + p=off; + dir=d; + } + sync(); + last_seek = p; + fseek(sio, p, dir); + setp(base(), epptr()); + setg(base(), ebuf(), ebuf()); + return last_seek; +} + + +stdiostream::stdiostream(FILE *f) : ios(&buf), + buf(f) { + +} + +stdiostream::~stdiostream() { + +} + + \ No newline at end of file diff --git a/code/SIBOSDK/src/stream.cpp b/code/SIBOSDK/src/stream.cpp new file mode 100644 index 0000000..5a1ecf4 --- /dev/null +++ b/code/SIBOSDK/src/stream.cpp @@ -0,0 +1,709 @@ +/* Release 3.10 */ +/*-------------------------------------------------------------------------* +* * +* STREAM.CPP - 1.2 stream class implementations. * +* * +* COPYRIGHT (C) 1989..1992 Clarion Software Corporation. * +* All Rights Reserved * +* * +*--------------------------------------------------------------------------*/ + +#define _NO_IO +#include +#include + +#pragma module(init_prio=>22) + +struct whitespace WS; + +#define CIRC_BUF_SIZE 1024 +#define MAX_STRING 512 + +#pragma save +#pragma call(near_call=>on, reg_param=>(ax,bx,cx,dx), reg_saved=>(ax,bx,cx,dx,di,si,ds,st1,st2)) +static void outstr(ostream& st, char *s); +static char *doconv(long val, int width, int radix); +static char *getbuf(int sz); +#pragma restore + +int streambuf::allocate() { + + base=new char[BUFSIZ]; + if(base) { + didalloc=1; + setbuf(base, BUFSIZ, 0); + return(0); + } + return(-1); +} + +streambuf * streambuf::setbuf(char *b, int sz, unsigned pos) { + + if(didalloc && base) + delete base; + base=b; + if(base && pos < sz) { + eptr=b+sz; + pptr=b+pos; + gptr=b+pos; + return(this); + } + return(NULL); +} + +int streambuf::overflow(int) { + + return EOF; +} + +int streambuf::underflow() { + + return EOF; +} + +void streambuf::terminate() { + + if(pptr < eptr) + *pptr = '\0'; +} + +streambuf::~streambuf() { + + if(didalloc) + delete base; +} + +int streambuf::snextc() { + + if(pptr == eptr) + return underflow(); + return *pptr++; +} + +int streambuf::sputc(int c) { + + if(gptr == eptr) + return overflow(c); + *gptr++ = c; + return c; +} + +void streambuf::sputbackc(char c) { + + if((pptr != base) || (c != EOF)) + *--pptr = c; +} + +/****************************************************************************/ +// conversion fiunction implementation +/****************************************************************************/ + +static char *getbuf(int sz) { + + static char buffer[CIRC_BUF_SIZE]; + static char *curpos=buffer; + char *ret; + + if(curpos+sz < buffer+CIRC_BUF_SIZE) { + ret=curpos; + curpos+=sz; + } + else if(sz < CIRC_BUF_SIZE) { + ret=buffer; + curpos=buffer; + } + else + ret=NULL; + return ret; +} + + +static char *doconv(long val, int width, int radix) { + + char nbuf[32]; + char *obuf; + int l, pad; + + ltoa(val, nbuf, radix); + l=strlen(nbuf); + if(width > 0) { + if(l > width) { + l = width; + nbuf[l]='\0'; + } + pad = width-l; + if(pad+l > (MAX_STRING-1)) + pad=(MAX_STRING-1)-l; + } + else + pad=0; + obuf=getbuf(pad+l+1); + if(pad) + memset(obuf, ' ', pad); + strcpy(&obuf[pad], nbuf); + return(obuf); +} + +char *dec(long val, int width) { + + return(doconv(val, width, 10)); +} + +char *hex(long val, int width) { + + return(doconv(val, width, 16)); +} + +char *oct(long val, int width) { + + return(doconv(val, width, 8)); +} + +char *chr(int c, int width) { + + char *obuf; + + if(--width > 0) { + if(width > (MAX_STRING-2)) + width = (MAX_STRING-2); + } + else + width=0; + obuf=getbuf(width+2); + if(width) + memset(obuf, ' ', width); + obuf[width]=c; + obuf[width+1]='\0'; + return obuf; +} + +char *str(const char *s, int width) { + + int l, pad; + char *obuf; + + l=strlen(s); + if(width > 0) { + if(l > width) + l = width; + pad = width-l; + if(pad+l > (MAX_STRING-1)) + pad=(MAX_STRING-1)-l; + } + else + pad=0; + obuf=getbuf(pad+l+1); + if(pad) + memset(obuf, ' ', pad); + memcpy(&obuf[pad], s, l); + obuf[pad+l]='\0'; + return(obuf); +} + +char *form(char *format, ...) { + + va_list _v_argptr; + char nbuf[MAX_STRING]; + char *obuf; + + va_start(_v_argptr, format); + vsprintf(nbuf, format, _v_argptr); + obuf=getbuf(strlen(nbuf)+1); + strcpy(obuf, nbuf); + return obuf; +} + + +/****************************************************************************/ +// filebuf implementation +/****************************************************************************/ + +filebuf::filebuf(FILE *f) { + + file=f; + if(file) { + fd=fileno(f); + isopen=1; + didalloc=0; + } + else + isopen=0; +} + +filebuf::filebuf(int h) { + + file=::fdopen(h, "r+"); + if(file) { + fd=h; + isopen=1; + didalloc=0; + } + else + isopen=0; +} + +filebuf::filebuf(int h, char *buf, int sz) { + + file=::fdopen(h, "r+"); + if(file) { + fd=h; + isopen=1; + didalloc=0; + ::setvbuf(file, buf, _IOFBF, sz); + } + else + isopen=0; +} + +static char *modes[3]={"r", + "w", + "a" }; + +filebuf* filebuf::open(char *path, int open_mode) { + + if(file) + close(); + file=::fopen(path, modes[open_mode]); + if(file) { + fd=fileno(file); + isopen=1; + didalloc=0; + return(this); + } + isopen=0; + return(NULL); +} + +int filebuf::close() { + + isopen=0; + return ::fclose(file); +} + + +void filebuf::terminate() { + +} + + +/****************************************************************************/ +// ostream implementation +/****************************************************************************/ + +static void outstr(ostream& st, char *s) { + + int c, n=0; + + while((st.good()) && ((c=s[n++]) != '\0')) { + st.put(c); + } +} + +ostream::ostream(streambuf *sb) { + + stream=sb; + mystream=0; + state=_good; +} + +ostream::ostream(int h) { + + stream = new filebuf(h); + mystream=1; + state=_good; + +} + +ostream::ostream(int len, char *buf) { + + stream = new streambuf(buf, len); + mystream=1; + state=_good; +} + + +ostream& ostream::operator <<(int i) { + + char o[32]; + + ltoa((long) i, o, 10); + outstr(*this, o); + return *this; +} + +ostream& ostream::operator <<(long l) { + + char o[32]; + + ltoa(l, o, 10); + outstr(*this, o); + return *this; +} + +ostream& ostream::operator <<(unsigned long ul) { + + char o[32]; + + ultoa(ul, o, 10); + outstr(*this, o); + return *this; +} + +ostream& ostream::operator <<(const char *s) { + + outstr(*this, (char *)s); + return *this; +} + +ostream& ostream::operator <<(double d) { + + char o[32]; + + gcvtl((long double) d, 18, o); + outstr(*this, o); + return *this; +} + +ostream& ostream::operator <<(long double ld) { + + char o[32]; + + gcvtl(ld, 18, o); + outstr(*this, o); + return *this; +} + + +ostream& ostream::flush() { + + if(stream->file) + fflush(stream->file); + else { + stream->pptr=stream->base; + stream->gptr=stream->base; + } + state=_good; + return *this; +} + +/****************************************************************************/ +// istream implementation +/****************************************************************************/ + +long double istream::getreal() { + + int c, n=0; + char _fmt_buf[64]; + + if(tied_to) + tied_to->flush(); + if(skipping) + *this >> WS; + c=stream->snextc(); + while(c != EOF) + { + if((c == '+') || (c == '-')) { /* leading sign */ + _fmt_buf[n++]= (char) c; + c=stream->snextc(); + if(c == EOF) + break; + } + for(int q=0; q<2; q++) { + while(isdigit(c)) { /* get digits */ + _fmt_buf[n++]= (char) c; + c=stream->snextc(); + if(c == EOF) + break; + } + if((c == '.') && (q == 0)) { /* decimal point */ + _fmt_buf[n++]= (char) c; + c=stream->snextc(); + if(c == EOF) + break; + } + else if(q == 0) + break; + } /* go back for more digits if first iteration */ + c= toupper(c); + if((c == 'E') || (c == 'D')) { + _fmt_buf[n++]= (char) c; + c=stream->snextc(); + if(c == EOF) + break; + } + else + break; + if((c == '+') || (c == '-')) { + _fmt_buf[n++]= (char) c; + c=stream->snextc(); + if(c == EOF) + break; + } /* exponent digits */ + while(isdigit(c)) { + _fmt_buf[n++]= (char) c; + c=stream->snextc(); + if(c == EOF) + break; + } + break; + } + _fmt_buf[n]=0; /* terminate string */ + if(c != EOF) + stream->sputbackc(c); + else { + state = _fail|_eof; + if((stream->file) && (ferror(stream->file))) + state = _bad; + } + return atofl(_fmt_buf); /* convert and assign if not suppressed */ +} + +long istream::getlong(int us) { + + int c, negative=0, flag=0; + long temp=0; + int _goodscan=0; + + if(tied_to) + tied_to->flush(); + if(skipping) + *this >> WS; + c=stream->snextc(); + if(c == EOF) + goto error; + if(c == '+') { + _goodscan=1; + c=stream->snextc(); + if(c == EOF) + goto error; + } + else if(c == '-') { /* number is negative */ + _goodscan=1; + negative=1; + c=stream->snextc(); + if(c == EOF) + goto error; + else if(us) { + state = _fail; + return(0); + } + } + if(c =='0') { + _goodscan=1; + flag=_OCT; + c=stream->snextc(); + if(c == EOF) + goto error; + c=tolower(c); + if(c == 'x') { + flag=_HEX; + c=stream->snextc(); + if(c == EOF) + goto error; + } + } + if(flag == _HEX) { + while(isxdigit(c=tolower(c))) { + temp*=16; + if(!isdigit(c)) + c-=87; + else + c-='0'; + temp+=c; + c=stream->snextc(); + if(c == EOF) + goto error; + } + } + else if(flag == _OCT) { + while((c >= '0') && (c <= '7')) { + temp*=8; + temp+=c-'0'; + c=stream->snextc(); + if(c == EOF) + goto error; + } + } + else { + while(isdigit(c)) { + _goodscan=1; + temp*=10; + temp+=c-'0'; + c=stream->snextc(); + if(c == EOF) + goto error; + } + } +error: + if(!_goodscan) { + state = _fail|_eof; + if((stream->file) && (ferror(stream->file))) + state = _bad; + return(0); + } + c=tolower(c); + if((c != 'u') && (c != 'l')) + stream->sputbackc(c); + if(negative) + return -temp; + return temp; +} + +istream::istream(streambuf *st, int sk, ostream* tie) { + + tied_to=tie; + stream=st; + skipping=sk; + mystream=0; + if(st) + state=_good; +} + +istream::istream(int sz, char* buf, int sk) { + + tied_to=NULL; + stream= new streambuf(buf, sz); + skipping=sk; + mystream=1; + if(stream) + state=_good; +} + +istream::istream(int h, int sk, ostream* tie) { + + tied_to=tie; + stream= new filebuf(h); + skipping=sk; + mystream=1; + if(stream) + state=_good; +} + +istream& istream::operator>>(unsigned char& c) { + + int t; + + if(state == _good) { + if(tied_to) + tied_to->flush(); + do { + t=stream->snextc(); + } while ((skipping) && (isspace(t))); + if(t == EOF) { + state = _fail|_eof; + if((stream->file) && (ferror(stream->file))) + state = _bad; + } + else + c=t; + } + return *this; +} + +istream& istream::operator>>(float& f) { + + f=(float) getreal(); + return *this; +} + +istream& istream::operator>>(double& d) { + + d=(double) getreal(); + return *this; +} + +istream& istream::operator>>(long double& ld) { + + ld= getreal(); + return *this; +} + +istream& istream::operator>>(char *s) { + + int c, n=0; + + if(state == _good) { + if(tied_to) + tied_to->flush(); + do { + c=stream->snextc(); + } while ((skipping) && (isspace(c))); + while(!isspace(c)) { + if(c == EOF) { + state = _fail|_eof; + if((stream->file) && (ferror(stream->file))) + state = _bad; + break; + + } + s[n++]=c; + c=stream->snextc(); + } + s[n] = '\0'; + } + return *this; +} + +istream& istream::operator>>(whitespace& w) { + + if(state == _good) { + if(tied_to) + tied_to->flush(); + do { + w.x=stream->snextc(); + } while (isspace(w.x)); + stream->sputbackc(w.x); + } + return *this; + +} + +istream& istream::get(char& c) { + + int t; + + if(state == _good) { + t=stream->snextc(); + if(t == EOF) { + state = _fail|_eof; + if((stream->file) && (ferror(stream->file))) + state = _bad; + } + else + c=t; + } + return *this; +} + +istream& istream::get(char *s, int len, int term) { + + int c, n=0; + + if(state == _good) { + while(n < len) { + c=stream->snextc(); + if(c == EOF) { + state = _fail|_eof; + if((stream->file) && (ferror(stream->file))) + state = _bad; + break; + } + if(c == term) { + stream->sputbackc(c); + break; + } + s[n++]=c; + } + s[n] = '\0'; + } + return *this; +} + +static filebuf inbuf(&_iob[0]); +static filebuf outbuf(&_iob[1]); +static filebuf errbuf(&_iob[2]); + +istream cin(&inbuf, 1, &cout); +ostream cout(&outbuf); +ostream cerr(&errbuf); + \ No newline at end of file diff --git a/code/SIBOSDK/src/strstrea.cpp b/code/SIBOSDK/src/strstrea.cpp new file mode 100644 index 0000000..a212f36 --- /dev/null +++ b/code/SIBOSDK/src/strstrea.cpp @@ -0,0 +1,291 @@ +/* Release 3.10 */ +/*-------------------------------------------------------------------------* +* * +* STRSTREAM.CPP - 2.1 file stream class implementations. * +* * +* COPYRIGHT (C) 1989..1992 Clarion Software Corporation. * +* All Rights Reserved * +* * +*--------------------------------------------------------------------------*/ + +#include +#include + +#pragma module(init_prio=>22) + +//************************************************************************** +// strstreambuf implementation +//************************************************************************** + + +strstreambuf::strstreambuf() : streambuf(NULL, 0) { + + flags=dynamic; + allocf=NULL; + freef=NULL; + next_alloc=512; + init(NULL, 0, NULL); +} + +strstreambuf::strstreambuf(int n) : streambuf(NULL, 0) { + + flags=dynamic; + allocf=NULL; + freef=NULL; + next_alloc=n; + init(NULL, 0, NULL); +} +strstreambuf::strstreambuf(void * (*a)(long), void (*f)(void*)) : streambuf(NULL, 0) { + + flags=dynamic; + allocf=a; + freef=f; + next_alloc=512; + init(NULL, 0, NULL); +} + +strstreambuf::strstreambuf(char *ptr, int n, char *pstart) : streambuf(NULL, 0) { + + int len; + + if(n < 0) { + flags=unlimited; + len= INT_MAX; + } + else + flags=0; + if(n == 0) + len=strlen((char *)ptr); + else if(n > 0) + len=n; + next_alloc=0; + allocf=NULL; + freef=NULL; + init(ptr, len, pstart); +} + +strstreambuf::~strstreambuf() { + + if((flags&dynamic) && (!(flags&frozen))) { + if(freef) + freef(base()); + else + delete base(); + } +} + +void strstreambuf::freeze(int f) { + + flags |= frozen*(f == 1); +} + + +char *strstreambuf::str() { + + flags |= frozen; + return base(); +} + + +int strstreambuf::doallocate() { + + char *b; + + b=(char *) allocf(512); + if(b == NULL) + return EOF; + setb(b, b+512, 1); + setg(b, b, b+512); + setp(b, b+512); + return 1; +} + +int strstreambuf::overflow(int c) { + + char *nb, *ob; + int old_size, new_size, in_pbuf, in_gbuf; + + if(flags&frozen) + return EOF; + + old_size=ebuf()-base(); + new_size=old_size+next_alloc; + in_pbuf=pptr()-pbase(); + in_gbuf=gptr()-eback(); + ob=base(); + + if(allocf) + nb = (char *) allocf(new_size); + else + nb = new char[new_size]; + if(nb == NULL) + return EOF; + setb(nb, nb+new_size); + setg(nb, nb, nb+new_size); + setp(nb, nb+new_size); + if(ob) { + memcpy(nb, ob, old_size); + pbump(in_pbuf); + gbump(in_gbuf); + if(freef) + freef(ob); + else + delete ob; + } + if(c != EOF) + sputc(c); + return c; +} + +int strstreambuf::underflow() { + + return EOF; +} + + +streambuf *strstreambuf::setbuf(char *b, int n) { + + if(b == NULL) + next_alloc=n; + else { + setb(b, b+512, 0); + setg(b, b, b+512); + setp(b, b+512); + } + return this; +} + +streampos strstreambuf::seekoff(streamoff pos, ios::seek_dir d, int mode) { + + streampos ret; + + if(mode & ios::in) { + switch(d) { + case ios::beg : + setg(eback(), eback()+pos, egptr()); + break; + case ios::cur : + gbump((int)pos); + break; + case ios::end : + setg(eback(), egptr()+pos, egptr()); + break; + } + if((gptr() > egptr()) || (gptr() < eback())) + return -1L; + ret = gptr()-eback(); + } + + if(mode & ios::out) { + switch(d) { + case ios::beg : + setp(pbase(), epptr()); + pbump((int)pos); + break; + case ios::cur : + pbump((int)pos); + break; + case ios::end : + setp(pbase(), epptr()); + pbump((int)(epptr()-pbase()+pos)); + break; + } + if((pptr() > epptr()) || (pptr() < base())) + return -1L; + ret = pptr()-pbase(); + } + return ret; +} + + +void strstreambuf::init(char *ptr, int sz, char *pstart) { + + char *eg, *pp; + + setb(ptr, ptr+sz, 0); + + if(pstart == NULL) { + eg=ebuf(); + pp=ebuf(); + } + else { + eg=pstart; + pp=pstart; + } + setg(ptr, ptr, eg); + setp(pp, ebuf()); +} + +//************************************************************************** +// strstreambase implementation +//************************************************************************** + + +strstreambase::strstreambase(char *g, int n, char *p) : buf(g, n, p) { + + ios::init(&buf); + +} + +strstreambase::strstreambase() { + + ios::init(&buf); +} + +strstreambase::~strstreambase() { + +} + +//************************************************************************** +// istrstream implementation +//************************************************************************** + +istrstream::istrstream(char *s) : strstreambase(s, 0, NULL), + istream(rdbuf()) { + +} + +istrstream::istrstream(char *s, int n) : strstreambase(s, n, NULL), + istream(rdbuf()) { + +} + +istrstream::~istrstream() { + +} + +ostrstream::ostrstream() : ostream(rdbuf()) { + +} + +ostrstream::ostrstream(char *cp, int n, int mode) : strstreambase(cp, n, cp), + ostream(rdbuf()) { + if(mode&(ios::ate|ios::app)) + seekp(strlen(cp)); +} + +ostrstream::~ostrstream() { + +} + +//************************************************************************** +// istrstream implementation +//************************************************************************** + +strstream::strstream() : strstreambase(), + iostream(rdbuf()) { + +} + +strstream::strstream(char *cp, int n, int mode) : strstreambase(cp, n, cp), + iostream(rdbuf()) { + + if(mode&(ios::ate|ios::app)) + seekp(strlen(cp)); +} + +strstream::~strstream() { + +} + + \ No newline at end of file diff --git a/code/SIBOSDK/sys/ct.bat b/code/SIBOSDK/sys/ct.bat new file mode 100644 index 0000000..2b379f5 --- /dev/null +++ b/code/SIBOSDK/sys/ct.bat @@ -0,0 +1,6 @@ +@echo off +ctran %1 -e\sibosdk\include\ -x\sibosdk\include\ -g\sibosdk\include\ -c -l -s -v +if errorlevel 1 goto end +call cc %1 +ecobj %1 +:end diff --git a/code/SIBOSDK/sys/ctskel.bat b/code/SIBOSDK/sys/ctskel.bat new file mode 100644 index 0000000..8297906 --- /dev/null +++ b/code/SIBOSDK/sys/ctskel.bat @@ -0,0 +1,2 @@ +@echo off +ctran %1 -e\sibosdk\include\ -s -v -k diff --git a/code/SIBOSDK/sys/debug.app b/code/SIBOSDK/sys/debug.app new file mode 100644 index 0000000..5d197e5 Binary files /dev/null and b/code/SIBOSDK/sys/debug.app differ diff --git a/code/SIBOSDK/sys/flman.app b/code/SIBOSDK/sys/flman.app new file mode 100644 index 0000000..c5ecb83 Binary files /dev/null and b/code/SIBOSDK/sys/flman.app differ diff --git a/code/SIBOSDK/sys/rch.bat b/code/SIBOSDK/sys/rch.bat new file mode 100644 index 0000000..847ace9 --- /dev/null +++ b/code/SIBOSDK/sys/rch.bat @@ -0,0 +1,2 @@ +@echo off +rchuf hwim -v -i%1 diff --git a/code/SIBOSDK/sys/re.bat b/code/SIBOSDK/sys/re.bat new file mode 100644 index 0000000..00aefe9 --- /dev/null +++ b/code/SIBOSDK/sys/re.bat @@ -0,0 +1,7 @@ +@echo off +rgprep %1.re %1.rex +lprep -i\sibosdk\include\ -o%1.i %1.rex +del %1.rex +rgcomp.exe %1.i \sibosdk\include\%1 +del %1.i + diff --git a/code/SIBOSDK/sys/rs.bat b/code/SIBOSDK/sys/rs.bat new file mode 100644 index 0000000..393704e --- /dev/null +++ b/code/SIBOSDK/sys/rs.bat @@ -0,0 +1,2 @@ +@echo off +rcomp.exe -S%1 -O%1 -I\sibosdk\include\ -G\sibosdk\include\%1 diff --git a/code/SIBOSDK/sys/sdbg.cfg b/code/SIBOSDK/sys/sdbg.cfg new file mode 100644 index 0000000..161d716 --- /dev/null +++ b/code/SIBOSDK/sys/sdbg.cfg @@ -0,0 +1,39 @@ +! Sample configuration file for the Series-3 Debugger +! Consists of a set of keywords and values. + +! Specifies the paths to search for source level maps and tables +! in addition to the current directory +! (commented out) +! SOURCE_PATH=c:\sibosdk\hwdemo\ +! SOURCE_PATH=d:\dirname\ + +! Pass zero-length command line to load and run commands +! (commented out) +! NO_COMMAND_LINE + +! Turns beep that normally accompanies temporary display of +! error message off +! (commented out) +! BEEP_OFF + +! Specifies the tab stop width used when displaying source code +TAB_WIDTH=4 + +! Specifies breakpoints to set up +BREAKPOINT=p_panic + +! Specifies where the debugger will run the process to before it +! reports the loading of the process is complete. +INITIAL_IP=main + +! Specifies what accelerators function keys are to be assigned to +! F1 to F10 may be assigned to accelerators +F2=B +F3=X +F4=H +F5=M +F6=V +F7=T +F8=S +F9=R +F10=G diff --git a/code/SIBOSDK/sys/ts.red b/code/SIBOSDK/sys/ts.red new file mode 100644 index 0000000..0977de6 --- /dev/null +++ b/code/SIBOSDK/sys/ts.red @@ -0,0 +1,16 @@ +*.PR = .; C:\SIBOSDK\PR; +*.H = .; C:\SIBOSDK\INCLUDE; +*.HPP = .; C:\SIBOSDK\INCLUDE; +*.RH = .; C:\SIBOSDK\INCLUDE; +*.G = .; C:\SIBOSDK\INCLUDE; +*.RG = .; C:\SIBOSDK\INCLUDE; +*.XG = .; C:\SIBOSDK\INCLUDE; +*.RSG = .; C:\SIBOSDK\INCLUDE; +*.INC = .; C:\SIBOSDK\INCLUDE; +*.C = .; C:\SIBOSDK\SRC; +*.CPP = .; C:\SIBOSDK\SRC; +*.CAT = .; C:\SIBOSDK\SRC; +*.A = .; C:\SIBOSDK\SRC; +*.OBJ = .; C:\SIBOSDK\LIB; +*.LIB = .; C:\SIBOSDK\LIB; +*.HLP = C:\TS\DOC; diff --git a/code/SIBOSDK/sys/tsmain.txt b/code/SIBOSDK/sys/tsmain.txt new file mode 100644 index 0000000..71849d1 --- /dev/null +++ b/code/SIBOSDK/sys/tsmain.txt @@ -0,0 +1,875 @@ + +!!------- Menu definition for TS Environment ------------------ + +! LinePull | [ TopSpeed ] + + {F}iles | [Files] + + {L} - Load file | LoadFile + {V} - View file | LoadF RO + {P} - Pick file | PickFile + {S} - Save file | SaveFile + {A} - All save | SaveAllF + {C} - Change dir | ChangeDir + {F} - Files dir | Directory + {D} - DOS shell | DOSShell + {E} - Execute | Execute + {Q} - Quit | Quit + + {E}dit | Editor + + {C}ompile | Compiler + + {L}ink | Linker + + {M}ake | Make + + {R}un | Run program + + {P}roject | {ProjOptions} [Project Options] + {N} - New project : ________ | ProjNew + {E} - Edit project file | ProjEdit + ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + {S} - System : ________ | MakeOpt[S|auto|dos|os2|win|epoc] { SYSTEMFI } + {T} - Target type : ___ | MakeOpt[T|exe|lib|dll|img|app|dyl|ldd|pdd] { TARGETTY } + {M} - Memory model : ________ | { MEMORYMO } +!if smallmodel + {S} - Small | ModelOpt[small] +!end +!if compactmodel + {C} - Compact | ModelOpt[compact] +!end +!if mediummodel + {M} - Medium | ModelOpt[medium] +!end +!if largemodel + {L} - Large | ModelOpt[large] +!end +!if xlargemodel + {X} - XLarge | ModelOpt[xlarge] +!end +!if mthreadmodel + {T} - MThread | ModelOpt[mthread] +!end +!if overlaymodel + {O} - Overlay | ModelOpt[overlay] +!end +!if dynalinkmodel + {D} - Dynalink | ModelOpt[dynalink] +!end +!if extendedmodel + {E} - Extended | ModelOpt[extended] +!end +!if extendmtmodel + {F} - ExtendMT | ModelOpt[extendmt] +!end + {V} - VID : ____ | MakeOpt[debug|vid] { VID:off } + {C} - Runtime checks... | { Runtime checks... } + {N} - Nil pointer checks : ___ | MakeOpt [check|nil_ptr] { Nil pointer checks } + {A} - Array index checks : ___ | MakeOpt [check|index] { Array index checks } + {S} - Stack overflow checks : ___ | MakeOpt [check|stack] { Stack overflow checks } + {R} - Range checks : ___ | MakeOpt [check|range] { Range checks } + {O} - Overflow checks : ___ | MakeOpt [check|overflow] { Overflow checks } +!if pas|mod + {G} - Guard conversions (Pas/M2) : ___ | MakeOpt [check|guard] { Guard conversions (Pas/M2) } +!end +!if pas + {V} - Variant records (Pas) : ___ | MakeOpt [check|field] { Variant records (Pas) } +!end + {O} - Optimisation options... | [ Optimizations ] { Optimization options... } + {T} - Optimize for speed : _____ | MakeOpt [optimize|speed] { Optimize for speed } + {E} - Common subexpressions : ___ | MakeOpt [optimize|cse] { Common subexpressions } + {C} - Constant optimization : ___ | MakeOpt [optimize|const] { Constant optimization } + {H} - Peephole : ___ | MakeOpt [optimize|peep_hole] { Peephole } + {J} - Jump optimization : ___ | MakeOpt [optimize|jump] { Jump optimization } + {L} - Loop optimization : ___ | MakeOpt [optimize|loop] { Loop optimization } + {A} - Alias optimization : ___ | MakeOpt [optimize|alias] { Alias optimization } + {R} - Register usage : ___ | MakeOpt [optimize|regass] { Register usage } + {F} - Stack frame : ___ | MakeOpt [optimize|stk_frame] { Stack frame } + ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + {P} - Processor : ___ | MakeOpt [optimize|cpu] { Processor } + {Q} - Coprocessor : ___ | MakeOpt [optimize|copro] { Coprocessor } + {S} - Smart linking : ___ | MakeOpt [module|smart_link] { Smart linking } + {P} - Project options... | { Project options... } + {J} - Calling convention : _____ | MakeOpt[J|jpi|stack] { Calling convention } + {M} - Map file : ___ | MakeOpt [link_option|map] { Map file } + {C} - Case sensitive link : ___ | MakeOpt [link_option|case] { Case sensitive link } + {S} - SmartMethod linking : ___ | MakeOpt [link_option|smart_method] { SmartMethod linking } + {H} - Share identical constants : ___ | MakeOpt [link_option|share_const] { Share identical constants } + {L} - Linker warnings : ___ | EnvOpt [L] { Linker warnings } + {W} - Warnings limit : ___ | EnvOpt [W] { Warnings limit } + {E} - Errors limit : ___ | EnvOpt [E] { Errors limit } + {R} - Remake all : ___ | EnvOpt [R] { Remake all } + {L} - Language options... | { Language options... } +!if pas + {P} - Pascal auto syntax check : ___ | EnvOpt[V] { Pascal auto syntax check } + {I} - Strict ISO standard (Pascal) : ___ | MakeOpt[option|iso] { Strict ISO standard (Pascal) } +!end +!if mod + {M} - Modula-2 auto syntax check : ___ | EnvOpt[U] { Modula-2 auto syntax check } + {B} - Bitwise boolean operators (M2) : ___ | MakeOpt[option|bit_opr] { Bitwise boolean operators (M2) } +!end +!if c|cpp + {A} - ANSI keywords only (C/C++) : ___ | MakeOpt[option|ansi] { ANSI keywords only (C/C++) } + {E} - Language extensions (C/C++) : ___ | MakeOpt[option|lang_ext] { Language extensions (C/C++) } + {N} - Nested comments (C/C++) : ___ | MakeOpt[option|nest_cmt] { Nested comments (C/C++) } + {J} - Default char unsigned (C/C++) : ___ | MakeOpt[option|uns_char] { Default char unsigned (C/C++) } + {Z} - Generate prototypes (C only) : ___ | MakeOpt[option|prototypes] { Generate prototypes (C only) } + {O} - Preprocessor output... | { Preprocessor output... } + {P} - Preprocessor output only : ___ | MakeOpt[option|pre_proc] { Preprocessor output... } + {L} - Minimize blank lines : ___ | MakeOpt[option|min_line] { Preprocessor output... } + {C} - Preserve comments : ___ | MakeOpt[option|incl_cmt] { Preprocessor output... } + ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + {V} - ANSI Violation Warnings... | [ ANSI Violations ] { ANSI Violation Warnings... } + {A} - Pointer conversion : _____ | MakeOpt [warn|wpcv] { Pointer conversion } + {B} - Declaration has no effect : _____ | MakeOpt [warn|wdne] { Declaration has no effect } + {C} - Storage class redeclared in declaration : _____ | MakeOpt [warn|wsto] { Storage class redeclared in declaration } + {D} - Unexpected text in preprocessor command : _____ | MakeOpt [warn|wtxt] { Unexpected text in preprocessor command } + {E} - No expression in return statement : _____ | MakeOpt [warn|wnre] { No expression in return statement } + {F} - No value returned in function : _____ | MakeOpt [warn|wnrv] { No value returned in function } + {G} - Value of escape sequence is too big : _____ | MakeOpt [warn|wetb] { Value of escape sequence is too big } + {H} - Value of constant is out of range : _____ | MakeOpt [warn|wcor] { Value of constant is out of range } + {I} - Default type promotion on parameter : _____ | MakeOpt [warn|wpin] { Default type promotion on parameter } + {J} - Function redeclared with fixed parameters : _____ | MakeOpt [warn|wrfp] { Function redeclared with fixed parameters } + {K} - Constant expression overflows : _____ | MakeOpt [warn|wovr] { Constant expression overflows } + {L} - Parameter type incompatible with previous : _____ | MakeOpt [warn|wpic] { Parameter type incompatible with previous } + {T} - Type Check Warnings... | [ Type Checking ] { Type Check Warnings... } + {A} - Function not declared : _____ | MakeOpt [warn|wfnd] { Function not declared } + {B} - Function has no prototype : _____ | MakeOpt [warn|wpnd] { Function has no prototype } + {C} - Different 'const' attributes : _____ | MakeOpt [warn|watr] { Different 'const' attributes } + {D} - Far to near pointer conversion : _____ | MakeOpt [warn|wftn] { Far to near pointer conversion } + {E} - Near to far pointer conversion : _____ | MakeOpt [warn|wntf] { Near to far pointer conversion } + {F} - Conversion may lose significant digits : _____ | MakeOpt [warn|wcld] { Conversion may lose significant digits } + {G} - Constant is long : _____ | MakeOpt [warn|wclt] { Constant is long } + {X} - Possible errors... | [ Possible Errors ] { Possible errors... } + {A} - Code has no effect : _____ | MakeOpt [warn|wcne] { Code has no effect } + {B} - Assignment in test expression : _____ | MakeOpt [warn|wait] { Assignment in test expression } + {C} - Returns the address of a local variable : _____ | MakeOpt [warn|wral] { Returns the address of a local variable } + {D} - Variable declared but never used : _____ | MakeOpt [warn|wdnu] { Variable declared but never used } + {E} - Variable is assigned but never used : _____ | MakeOpt [warn|wvnu] { Variable is assigned but never used } + {F} - Possible use of variable before assignment : _____ | MakeOpt [warn|wubd] { Possible use of variable before assignment } + {G} - Parameter never used in function : _____ | MakeOpt [warn|wpnu] { Parameter never used in function } + {H} - Unknown pragma : _____ | MakeOpt [warn|wprg] { Unknown pragma } + {I} - Address for local variable not in DGROUP : _____ | MakeOpt [warn|wnid] { Address for local variable not in DGROUP } +!if cpp + {C} - C++ warnings... | [ C++ Warnings ] { C++ warnings... } + {A} - No access specifier for base class : _____ | MakeOpt [warn|wacc] { No access specifier for base class } + {B} - Obsolete 'overload' keyword : _____ | MakeOpt [warn|wovl] { Obsolete 'overload' keyword } + {C} - Obsolete expression in delete : _____ | MakeOpt [warn|wdel] { Obsolete expression in delete } + {D} - Object in code segment initialized : _____ | MakeOpt [warn|wcic] { Object in code segment initialized } + {E} - Class definition in function return type : _____ | MakeOpt [warn|wcrt] { Class definition in function return type } +!end +!end + {O}ptions | [ Options ] {Options} +!if os2 + {V} - VIO screen output : ___ | EnvOpt[S] { Snowcheck/VIO } +!end +!if dos + {V} - Snow check : ___ | EnvOpt[S] { Snowcheck/VIO } +!end + {D} - Delayed screen update : ___ | EnvOpt[D] { Delayed screen update } +!if dos + {H} - High background : ___ | EnvOpt[H] { High background } +!end + {C} - Solid cursor : ___ | EnvOpt[C] { Solid cursor } +!if dos + {X} - Use expanded memory : ___ | EnvOpt[M] { Use expanded memory } +!end + {N} - Enable mouse : ___ | EnvOpt[N] { Enable mouse } + {Q} - Help line : ___ | EnvOpt[Q] { Help line } + {R} - Run options... | { Run options... } + {C} - Command line | Command Line + {A} - Auto make : ___ | RunOpt[A] +!if os2 + {S} - Session run : ___ | RunOpt[S] +!end + {T} - Timed run : ___ | RunOpt[T] + {S} - Setup options... | [Setup] { Setup options... } + {A} - Auto save files : ___ | EdOpt[A] { Setup options... } + {F} - Default editor filenames... | Default Filenames + {X} - Default editor extensions... | Default Extensions + {N} - Number of backups : ___ | No Of Backups + {T} - Top editor scroll zone : ___ | Top Scroll Zone + {B} - Bottom editor scroll zone : ___ | Bottom Scroll Zone + ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + {R} - Load redirection file | Load Red File + {E} - Edit redirection file | Red Edit + {J} - Load keyboard macro file | Load Macs + {K} - Save keyboard macro file | Save Macs + {L} - Load option/window cfg file | Load Config File + {O} - Save option/window cfg file | Save Config File + {U}tilities | [Utilities] {Utilities} + {A} - ASCII table | Asciitab + {C} - Calculator | Calculator + {E} - Find run-time error | Find Error + {F} - File search | WildSearch + {S} - Search list | Search List + {L} - Locate file | Locate File + {K} - Keyboard codes | ScanCodes + {P} - Print file | Print + {Q} - Print settings | PrintSet + {R} - Review DOS screen | Review Screen + {V} - View file as data | View File + {H} - Help window | Help + {I} - System Info | Info + + {V}ID | {VID} Run program[VID] + +! key | Edit1 +! key | Edit2 +! key | Edit3 +! key | Edit4 +! key | Edit5 +! key | Edit6 +! key | Edit7 +! key | Edit8 +! key | Edit9 +! key | Edit0 +! key | Zoom Window +! key | Cycle Windows +! key | CutKey +! key | WinKey + + +!!----- Editor menus and keys - Active in editor windows ------ +! Editor +! Pop Up | [ Editor Menu ] {Edit1} + {L} - load new file | Ed Load File + {V} - view file read only | Ed Load F RO + {S} - save file | Save File + {W} - write to ... | Ed Write File + {Q} - quick commands | [ Quick Menu ] + {F} - find | Ed Find + {A} - replace | Ed Replace + {E} - top of window | Ed Start Screen + {X} - bottom of window | Ed End Screen + {R} - top of file | Ed Start File + {C} - bottom of file | Ed End File + {S} - start of line | Ed Start Line + {D} - end of line | Ed End Line + {B} - beginning of block | Ed Goto Begin Block + {K} - end of block | Ed Goto End Block + {P} - previous position | Ed Prev Position + {Y} - delete to end of line | Ed Del End Line + {L} - restore line | Ed Restore Line + {G} - goto line | Ed Goto Line + {1} - goto marker 1 | Ed Goto M1 + {2} - goto marker 2 | Ed Goto M2 + {K} - block commands | [ Block Menu ] + {D} - save file | Save File + {A} - all save | Save All Files + {B} - begin block | Ed Begin Block + {K} - end block | Ed End Block + {H} - hide block | Ed Hide Block + {T} - mark word | Ed Mark Word + {L} - mark line | Ed Mark Line + {C} - copy block | Ed Copy Block + {V} - move block | Ed Move Block + {Y} - delete block | Ed Del Block + {R} - read block | Ed Read Block + {W} - write block | Ed Write Block + {G} - get block | Ed Get Block + {P} - print block | Ed Print Block + {I} - indent block | Ed Indent Block + {U} - undo deletion | Ed Undo + {Q} - quit file | Ed Quit + {1} - set marker 1 | Ed Set M1 + {2} - set marker 2 | Ed Set M2 + + {O} - editor options | [ Options Menu ] + {V} - insert mode : ___ | EdOpt[V] + {I} - auto indent : ___ | EdOpt[I] + {T} - hard tabs : ___ | EdOpt[T] + {C} - control chars : ___ | EdOpt[C] + {R} - read only : ___ | Toggle RO + {W} - tab width : ___ | Ed Tab Width +!if mod + {U} - auto uppercase : ___ | EdOpt[U] +!end + +! key | Ed Word Left +! key | Ed Page Down +! key | Ed Move Right +! key | Ed Move Up +! key | Ed Word Right +! key | Ed Del Forward +! key | Ed Del Backward +! key | Ed Tab +! key | Ed Find Again +! key | Ed Ins Line +! key | Ed Ins Below +! key | Ed Prefix +! key | Ed Page Up +! key | Ed Move Left +! key | Ed Del Word +! key | Ed Upper Case +! key | Ed Scrl Down +! key | Ed Move Down +! key | Ed Del Line +! key | Ed Scrl Up +! key | Ed Next Error +! key | Ed Prev Error +! key | Ed Case Correct +! key | Ed Err Extension +! key | Paste + + +!! Text messages for TopSpeed environment +!! ====================================== + +! MsgText +001 7 +002 TopSpeed Release 3.10 +003 Clarion Software Corporation Copyright (C) 1992 +004 Multi-Language Programming Environment DOS Release 3.10 +!if os2 +005 Multi-Language Programming Environment OS/2 Release 3.10 +!end +!if xtd +005 Multi-Language Programming Environment XTD Release 3.10 +!end +006 Serial number: @ +007 Copyright (C) 1988-1992 +008 Release 3.10 +009 Clarion Software Corporation +010 Error: Menu text line @ +011 : " +012 " duplicate key +013 " not recognized +014 TS.MNU : Too many keys defined +015 Menu definition too large +016 Not Enough Memory +017 Date Not set +018 Not enough memory to run Help +019 Save file @ +020 Sharing @ +021 Change directory to @ +022 Load file +023 New file: @ +024 Window 1: |Window 2: |Window 3: |Window 4: |Window 5: |Window 6: |Window 7: |Window 8: |Window 9: @ +025 BAK +026 BKn +027 Saving @ +028 Write to file: @ +029 Writing @ +030 Write block to file: @ +031 Read block +032 File to read: @ +033 File not found. +034 PRN +035 Printing +036 \_!%$@? +037 Window to copy block from: @ +038 Block not defined in window. +039 Indent size: (+/-) +040 Search string not found. +041 Find: |Options: @ +042 Find: |Replace with: |Options: @ +043 {Esc}-cancel +044 Replace +045 Line length error +046 ^P +047 Insert @ +048 Overwrite +049 Line @ +050 Col @ +051 Total file size is too big! (>1MB) +052 File too big! (>500KB) +053 Warning, Disk almost full! +054 Failed to load file @ +055 File read failure on @ +056 Copy Data fail (source) +057 Load file +058 New file: @ +059 (Y/N): @ +060 {~17~217}-select {~25}-pick file {Tab}-history {Esc}-cancel +061 YN +062 Press Esc @ +063 {~17~217}-select {Tab}-history {Esc}-cancel +064 Recolor {~27~26}-background {~24~25}-foreground {PgUp}/{PgDn}/{*}-select area {Esc}-exit @ +065 Window @ +066 Write fail, Disk full? @ +067 Execute failure on @ +068 Error: @ +069 SYSTEM ERROR @ +070 File: @ +071 Terminate environment? +072 Abort or Retry? (A/R) +073 AR +074 Project name: @ +075 Run +076 Command line: @ +077 Change directory +078 New directory: @ +079 File directory +080 File mask: @ +081 pm +082 am +083 All : |Window 1: |Window 2: |Window 3: |Window 4: |Window 5: |Window 6: |Window 7: |Window 8: |Window 9: |Window 0: @ +!! 84-88 spare +089 Swapping out TopSpeed Environment +090 ..More: +091 View file (read only) +092 Filename: @ +093 File not found +094 Invalid CFG file +095 Too many lines in redirection file +096 OS Command Shell +097 Type EXIT to return to TopSpeed Environment +098 Program terminated +099 .EXE +100 on @ +101 off +102 Redirection filename: @ +103 Set High Background on exit from Environment? +104 Top scroll zone size: @ +105 Bottom scroll zone size: @ +106 No of backups: @ +107 Execute: @ +108 Goto line: @ +109 Tab width: @ +110 Searching @ +111 Block delete too big to be "undone" - Delete anyway? +!! 112-115 *spare* +116 {F1}-help {~24~25}-choose {~17~217}-select {CtrlY}-delete {Esc}-close +117 Pick file @ +!! 118 *spare* +119 {F1}-help {~27~26~24~25}-choose {~17~217}-select {Esc}-close +120 +121 Invalid directory: @ +122 Overwrite old @ +123 File " +124 " not found. +125 File: @ +126 Compile +127 Cut text {~27~26~24~25}-move {Ctrl~27~26}-fast move {B}-begin block {~17~217}-end block +128 ALL +129 Error: Unknown extension: @ +130 Search string: |Files to search: |Options: @ +131 Directories not allowed +132 No match found +133 Syntax Error +134 Project: @ +135 New limit: @ +!!136-138 spare +139 Sizes = Code: @ +140 Const: @ +141 Data: @ +142 PR +143 Copy project from: @ +144 Press {Esc} to abort +145 Press any key to continue +146 Project @ +147 Alt|Ctrl|Shift|UpArr|PgDn|DownArr|PgUp|Home|End|Del|Tab|Equal|LeftArr|RightArr|Ins|Enter|Esc|PageDown|PageUp|Space +148 Options: +149 {~17~217}-edit warnings/errors {Esc}-continue +150 Time taken (H:M:S:HS) = +151 File not found: @ +152 TopSpeed r3.5á +154 Save Macro File? +155 Read Only +156 Press {CtrlBreak} to abort +157 Made @ +158 Line +159 found +160 warning @ +161 warnings +162 error @ +163 errors @ +164 No +165 Make: @ +166 Link: @ +167 Run: @ +!!168 spare +169 Make completed +170 Press Ù to edit +171 Press key to continue +172 Compile completed +173 Make aborted +174 RED +175 TS.RED +176 CFG +177 TS.CFG +178 TS.SES +179 {U}-no case {W}-word {B}-back {G}-global {L}-local {R}-rest {N}-no ask {num}-repeat num +180 BUWGLNR* +181 {~27~26~24~25 Home End PgUp PgDn}-move @ +182 {Shift ~27~26~24~25}-resize @ +183 {~17~217}-recolor @ +184 Execute : unable to find @ +!! default filename +185 *.* +!! default extension +186 @ +187 Filename not found or extension not recognized: @ +188 C:\OSO001.MSG +189 TS.MAC +190 MAC +191 Press key to define +192 Too many errors/warnings +193 /C START "TS SHELL" /F/K @ +194 Compiler not installed for this language +195 {F1}-help {F10}-main menu {Esc}-close {Alt-X}-exit +196 {F1}-help {F5}-zoom {F6}-cycle {F9}-edit menu {F10}-main menu {Esc}-close {Alt-X}-exit +197 Recording macro for key: {} Press Alt= to End. +198 {ScrlLock}-exit @ +199 {AltW}-exit @ + +!! OS Errors +200 Out of memory +201 Dynamic pool limit exceeded +210 Invalid function number +211 File not found +212 Path not found +213 Too many open files (no handles left) +214 Access denied +215 Invalid handle +216 Memory control blocks destroyed +217 Insufficient memory +218 Invalid memory block address +219 Invalid environment +220 Invalid format +221 Invalid access code +222 Invalid data +223 DOS System Error: @ +224 Invalid drive was specified +225 Attempt to remove the current directory +226 Not same device +227 No more files +228 Attempt to write on write-protected diskette +229 Unknown unit +230 Drive not ready +231 Unknown command +232 Data error (CRC) +233 Bad request structure length +234 Seek error +235 Unknown media type +236 Sector not found +237 Printer out of paper +238 Write fault +239 Read fault +240 General failure +241 Sharing Violation +242 Lock Violation +243 Invalid disk change +244 FCB unavailable +245 File exists +246 Write failed (disk full?) + +300 Print File +301 Lines per page : |Page width : |Top margin : |Left margin : |Page heading : |Init string : | +302 Form Feed string : |Final string : |Output file/device : |Options : @ +303 Printer Options {H}-Heading {F}ile date {W}-Wrap {Esc}-Exit +305 Printing @ +306 Printer Settings +307 File to print: @ +308 Locate file: |Drives : @ +309 Files found: @ + + +310 Unexpected option: @ +311 Valid options are: +312 filename Edit filename. +313 /n filename Edit file in editor window n (1-9). +314 /L Set 43/50 line mode +315 /N New session (ignore TS.SES). +319 DLL load failed: @ +322 Total size loaded +323 Time|Date|Current Directory|#|Editor Windows|Size|Disk Free Space|Processor|Co-Processor|TopSpeed Version +325 Environment Information @ +331 Unknown|V20|V30|8088|8086|80188|80186|80286|80386|i486 +333 None|8087|80287|80387 + +340 TopSpeed Help System @ +341 {*}-wildcard search {U}-ignore case {1-9}-editor to load {R}-use redirection +342 *UR +349 Cannot find file ERRORINF.$$$ +350 ERRORINF.$$$ +351 Program : @ +352 Error : @ +353 at CS:IP : @ +354 Segment : @ +355 Source : @ +356 Near procedure : @ +357 Line @ +358 Col @ +359 Not enough information to find error +360 Remake program with debug information +361 DBD +362 EXE +363 MAP +364 Find error in source? +365 HLP +366 TSMAIN +367 $index +368 {F1}-index {~27~26~24~25}-choose {~17~217}-select topic {Esc}-close +369 {F1}-index {~27~26~24~25}-choose {~17~217}-select topic {PgDn}-next page {Esc}-close +370 {F1}-index {~27~26~24~25}-choose {~17~217}-select topic {PgUp}-prev page {Esc}-close +371 {F1}-index {~27~26~24~25}-choose {~17~217}-select topic {PgUp}-prev page {PgDn}-next page {Esc}-close +372 Help file " +373 " not found. +374 More.. +375 ÍKeyboard codesÍDecÍÍHexÍÍÍÍÍÍÍ +376 Keyboard character codes Press any key Press {Esc} twice to exit +377 Ascii code : @ +378 Extended code: @ +379 Key name : @ +380 ÍDÍÍHÍÍChÍÍCtrlÍNmÍÍÍÍÍDÍÍHÍÍChÍÍCtrlÍÍNm +381 ÍDÍÍHÍÍChÍÍÍDÍÍHÍÍChÍÍÍDÍÍHÍÍChÍÍDÍÍHÍÍCh +382 ÍDÍÍHÍÍChÍÍÍDÍÍHÍÍChÍÍÍDÍÍHÍDisplayÍAttrÍ +383 Ascii Table {PgUp}-prev page {PgDn}-next page {Esc}-Close +384 Black|Blue|Green|Cyan|Red|Magenta|Brown|Light Gray|Dark Gray|Light Blue|Light Green|Light Cyan|Light Red|Light Magenta|Yellow|White +385 View File {PgUp}-prev page {PgDn}-next page {Esc}-Close +386 File to view: @ +387 File: @ +390 ÉÍÍÍËÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍËÍÍÍ» +391 º º º º +392 ÈÍÍÍÊÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÊÍÍͼ +393 {d}ec {a}nd ³ {+} {-} {s} ³ {m+} {m-} +394 {h}ex {o}r ³ {*} {/} {%} ³ {m*} {m/} +395 {b}in {x}or ³ {=} {c}lr ³ {m=} {mr} {mc} +396 Dec|Hex|Bin|M +397 0123456789ABCDEF>dhbaox+-s*/%=cmr +398 Calculator + +400 UNNAMED +401 TEMPLATE +402 does not exist. Create? @ +403 Error in project file + +!! Help to extension mapping +450 TSMOD *.mod *.def +451 TSPAS *.pas *.itf +452 TSC *.c *.h +453 TSCPP *.cpp *.hpp +454 TSASM *.a *.inc + +!! Include file extensions (used by /ZI) +499 DEF ITF H HPP INC + +!! Overlay/DLL run-time errors (+500) +500 DLL error: @ +501 Loader cannot find entry point of main program. +502 Module count exceeded. +503 Wrong DLL version. +504 DLL corrupt. +505 Illegal fixup type found in imported module. +506 Imported module not found. +507 Relocation information corrupt. +508 Imported module not and .EXE or .DLL file. +509 Incorrect .DLL file format. +510 No memory available - load phase 1. +511 Module failed to initialize. +512 Error opening file. +513 No memory available - load phase 2. +514 Error reading file. +515 Error seeking file. +516 Internal error. + +!! Runtime errors (+600) +599 User error +600 Unknown type of error : +601 Stack overflow +602 Null pointer de-reference +603 Termination caused by signal. (User break or Floating point) +604 Arithmetic Overflow +605 Variable out of range +606 No return value from function +607 No matching Case Label +608 Long Integer Divide By Zero +609 Index out of range +610 Pure Virtual Function Called +616 Memory allocation initialisation (Out Of Memory) +617 I/O initialisation (Out Of Memory) +618 Invalid use of near heap in DLL +619 Complex Number Error +633 Dos Re-entered +634 NullProc Called +648 Invalid window +649 Use memory allocation +650 Settitle memory allocation +651 Initialisation error +652 new, Out Of Memory +653 dispose, Invalid Pointer +654 _wrint, Illegal Parameter +655 _wrint, Conversion Error +656 _wrchar, Illegal Parameter +657 _wrbool, Illegal Parameter +658 _wrastr, Illegal Parameter +659 _wrcstr, Illegal Parameter +660 _wrreal, Illegal Parameter +661 _wrreal, Conversion Error +662 _f_wrint, Illegal Parameter +663 _f_wrint, Conversion Error +664 Too many processes +665 New process memory allocation +666 Signal memory allocation +667 Scheduler memory allocation +668 Initialisation error +669 Stop process error +672 StopProcess - Corrupt Process +673 TRANSFER - Corrupt Process +674 ExecCmd, Memory Failure +675 ExecCmd, Command Line Too Long +676 ExecCmd, Command Processor Failed To Load +680 StartScheduler error +681 StopScheduler error +682 StartProcess error +683 SEND error +684 WAIT error +685 Notify error +686 Init error +687 Delay error +688 Illegal Assignment +696 Dos environment memory allocation +697 _f_wrchar, Illegal Parameter +698 _f_wrbool, Illegal Parameter +699 _f_wrastr, Illegal Parameter +700 _f_wrcstr, Illegal Parameter +701 _f_wrreal, Illegal Parameter +702 _f_wrreal, Conversion Error +703 _rdint, Invalid Integer +704 _rdreal, Invalid Real Number +705 _f_rdint, Invalid Integer +706 _f_rdreal, Invalid Real Number +707 assign, File Already Open +708 reset, No File Name +709 put, Invalid Mode +710 put, Write Error +711 put, Write Error +737 NearMakeHeap, Invalid Argument +738 NearHeapAllocate, Invalid Argument +739 NearHeapDeallocate, Invalid Argument +740 NearHeapAvail, Invalid Argument +741 NearHeapTotalAvail, Invalid Argument +742 NearHeapChangeSize, Invalid Argument +743 NearHeapChangeAlloc, Invalid Argument +744 FarHeapAllocate, Out Of Memory +745 FarHeapDeallocate, Invalid Argument +746 FarHeapDeallocate, Heap Corrupt +747 FarHeapChangeAlloc, Invalid Argument +748 FarAllocate, Out Of Memory +749 NearMakeHeap, Size Too Small +750 NearHeapAllocate, Out Of Memory +751 NearHeapDellocate, Invalid Argument +752 NearAllocate, Out Of Memory +753 Far Heap Call, Not Supported Under OS2 +754 ShtHeap.Initialize, Heap too small +755 ShtHeap.Increase, Not Enough Space +756 ShtHeap.Allocate, Size Error +757 ShtHeap.Allocate, Out Of Memory +758 ShtHeap.Free, Invalid Pointer +759 ShtHeap.Test, Heap Corruption +760 Close, Invalid Handle +762 Open, File Access Error +763 OpenRead, File Access Error +764 Append, File Access Error +765 Create, File Access Error +766 WrBin Error +767 RdBin Error +768 FIO Internal Error, Write Error Flushing File +769 GetPos, Write Seek Error +770 Seek, Write Seek Error +772 Truncate, File Write Error +774 Erase, File Name Error +775 Rename, File Name Error +776 ChDir, Directory Name Error +777 MkDir, Directory Name Error +778 RmDir, Directory Name Error +779 GetDir, Drive Number Error +780 ReadFirstEntry Error +781 ReadNextEntry Error +785 Assign Buffer, Invalid File Handle +786 Assign Buffer, Invalid Buffer Size +787 Assign Buffer, Stream Table Full +788 FIO Directory Call, Not Supported Under OS2 +790 IO.RedirectInput Error +791 IO.RedirectOutput Error +792 StartScheduler, System Error +793 StartProcess, System Error +794 StartProcess, SetPriority - System Error +795 StartProcess, SuspendThread - System Error +796 SEND, Semaphore System Error +797 WAIT, Semaphore System Error +798 Notify, Semaphore System Error +799 Init, Semaphore System Error +800 Delay, Sleep System Error +801 Launch, System Error +802 NewProcess, Too Many Threads +803 IOTRANSFER, Invalid Argument +809 Graphics Call, Not Supported Under OS2 +810 OSFatalError, Operating System Error +824 Undefined method called +825 get, Invalid Mode +826 get, End Of File +827 get, Read Error +828 close, Invalid Operation +829 eoln, End Of File +830 eoln, Invalid File +831 eoln, End Of File +832 eof, Invalid Operation +833 ln, Illegal Parameter +834 sqrt, Illegal Parameter +835 put, File Undefined +836 get, File Undefined +837 FlsBuf, Stream Not Buffered +838 FilBuf, Stream Not Buffered +840 BlockRead, I/O Error +841 GetMem, Out Of Memory +842 FilePos, Invalid File +843 FileSize, Invalid File +844 Seek, Invalid File +845 Rename, Invalid File +846 Append, File Not Assiged +847 MkDir, Invalid Path +848 RmDir, Invalid Path +849 ChDir, Invalid Path +850 OS2 Library, Function Not Supported +851 Windows Library, Function Not Supported +855 User Break + + +!! Batch introductory screen +!! ========================= + +940 ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» +941 º TopSpeed Release 3.10 Copyright (C) 1992 Clarion Software Corporation º +942 º º +943 º Usage: TSC filename(s) [options] Compile file(s) º +944 º TSC projectname /m [options] Make project º +945 º TSC projectname /l [options] Link project º +946 ÇÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ Options ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄĶ +947 º /v0 no VID information /v1 minimum VID information º +948 º /v2 full VID information /b generate line numbers º +949 º º +950 º /rs stack overflow checking /rn nil pointer checking º +951 º /ro overflow checking /rr range checking º +952 º /ri array index checking /cc const in code º +953 º /a+ Strict ANSI only /e- language extensions off º +954 º /j+ default char is unsigned /n+ allow nested comments º +955 º /dnnn define macro /unnn undefine predefined macro º +956 º /p preprocessor output /pc ... with comments º +957 º /pl ... minimize blank space /zg generate prototypes º +958 º /wxxx+ enable warning xxx /wxxx- disable warning xxx º +959 º /wxxx* treat warning as an error /w+ enable all warnings º +960 º /w- disable all warnings /w* turn warnings into errors º +961 More.. º +962 ÇÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ Model Options ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄĶ +963 º /ms small model /mm medium model º +964 º /mc compact model /ml large model º +965 º /mx extra large model /mt multi thread model º +966 º /mo overlay model /md dynalink model º +967 º /me extended model /mf extended mthread model º +968 ÇÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ Optimization Options ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄĶ +969 º /ox- disable all optimizations º +970 º /ot- disable time optimization /oe- disable CSE optimization º +971 º /oc- disable constant optimization /oh- disable peep hole optim. º +972 º /oj- disable jump optimization /ol- disable loop optimization º +973 º /oa- disable alias optimization /or- disable register optim. º +974 º /of- disable stack frame optim. /opx select processor 80x86 º +975 º /oq0 select fp-emulator (default) /oqx select co-processor 80x87 º +976 ÇÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ Misc. Options ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄĶ +977 º /fpnnn define project file /y use DOS environment vars º +978 º /Iddd include files directory /zq quiet mode º +979 º /snnn=nnn set project system macro /r remake all º +980 ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ diff --git a/code/SIBOSDK/sys/tsprj.txt b/code/SIBOSDK/sys/tsprj.txt new file mode 100644 index 0000000..74c421d --- /dev/null +++ b/code/SIBOSDK/sys/tsprj.txt @@ -0,0 +1,617 @@ +! Project Predefined +!! predefine TopSpeed compilers +!if mod +#declare_compiler mod= +'#set make=%%remake_jpi + #if %%make #then #rundll TSMOD %%src %%obj #endif + #pragma link(%%obj) + #set tsm2=on' +!end +!if pas +#declare_compiler pas= +'#set make=%%remake_jpi + #if %%make #then #rundll TSPAS %%src %%obj #endif + #pragma link(%%obj) + #set tspas=on' +#declare_compiler plg= +'#set make=%%remake_jpi + #if %%make #then #rundll TSPAS_LG %%src %%obj #endif + #pragma link(%%obj) + #set tspas=on' +!end +!if cpp +#declare_compiler cpp= +'#set make=%%remake_jpi + #if %%make #then + #rundll TSCPP %%src %%obj + #if %%system=epoc #then + #run "ecppfx -s %%obj" no_window no_abort + #endif + #endif + #pragma link_option(decode=>on) + #pragma link(%%obj) + #set tsc=on #set tscpp=on' +!! This declaration is overriden by the one below if TopSpeed C is installed +#declare_compiler c= +'#set make=%%remake_jpi + #if %%make #then #rundll TSCPP %%src %%obj #endif + #pragma link(%%obj) + #set tsc=on' +!end +!if c +#declare_compiler c= +'#set make=%%remake_jpi + #if %%make #then #rundll TSC %%src %%obj #endif + #pragma link(%%obj) + #set tsc=on' +!end +!if asm +#declare_compiler a= +'#set make=%%remake_jpi + #if %%make #then #rundll TSASM %%src %%obj #endif + #pragma link(%%obj)' +!end +!if masm +#declare_compiler asm= +'#set make=%%remake + #if %%make #then + #edit save %%src + #run "masm %%src,%%obj; >masmtmp.$$$" no_window no_abort + #file adderrors masmtmp.$$$ + #file delete masmtmp.$$$ + #endif + #pragma link(%%obj)' +!end + +#declare_compiler rc= +'#split %%obj + #set obj = %%name.res + #set make=%%remake + #if %%make #then + #edit save %%src + #run "tsrc %%src >rctmp.$$$" no_window no_abort + #file adderrors rctmp.$$$ + #file delete rctmp.$$$ + #endif + #pragma link(%%obj)' + +#declare_compiler cat= +'#split %%src + #set make=%%remake + #if %%make #or %%name.g #older %%name.cat #then + #run "ctran %%name -c -s -v -l -e..\include\ -x..\include\ -g..\include\" no_window no_abort + #rundll TSC %%name.c %%name.obj + #run "ecobj %%name.obj" no_window no_abort + #endif + #pragma link(%%name.obj)' + +#if %action%=compile #then +!! declarations to allow compilation of include files +!if mod + #declare_compiler def='#rundll TSMOD %%src %%obj' +!end +!if cpp + #declare_compiler hpp='#rundll TSCPP %%src %%obj' + #declare_compiler h='#rundll TSCPP %%src %%obj' +!end +!if C + #declare_compiler h='#rundll TSC %%src %%obj' +!end +#endif + +!! End of compiler predefinition section +!! ========================================================================= +! Project Model +!! The following lines are executed whenever the #model command is used +!! in a project file. + +#pragma call(near_call=>on,same_ds=>on,ds_eq_ss=>on,overlay=>off) +#pragma data(far_ext=>off,near_ptr=>on,threshold=>65535,const_in_code=>off,ss_in_dgroup=>on,ds_dynamic=>off) +#pragma define(_fdata=>off,_fcall=>off,_fptr=>off,_mthread=>off) +#pragma link_option(map=>on,case=>on,pack=>on,oldexe=>off) +#pragma define(M_I86SM=>off,M_I86CM=>off,M_I86MM=>off,M_I86LM=>off,M_I86XM=>off,M_I86TM=>off,M_I86MTM=>off,M_I86OM=>off,M_I86DM=>off) + +!! PSION SIBO change +#pragma optimize(speed=>off) +#if %system=epoc #then + #if #not %model=small #then + #error "ERROR - must use small model for epoc" + #endif + #if #not %filetype=img #then + #if #not %filetype=dyl #then + #error "ERROR - illegal parameter in #system: %filetype" + #endif + #endif + #if "%epocinit"="" #then + #set epocinit=iclib + #endif +#endif +!! end of PSION SIBO change + +#if "%system"="" #then + #error "#model not preceded by #system" +!if smallmodel +#elsif %model=small #then + #set M=S + #pragma define(M_I86SM=>on) +!end +!if compactmodel +#elsif %model=compact #then + #set M=C + #pragma call(ds_eq_ss=>off) + #pragma data(near_ptr=>off,threshold=>32767,ss_in_dgroup=>off) + #pragma define(_fptr=>on) + #pragma define(M_I86CM=>on) +!end +!if mediummodel +#elsif %model=medium #then + #set M=M + #pragma call(near_call=>off) + #pragma define(_fcall=>on) + #pragma define(M_I86MM=>on) +!end +!if largemodel +#elsif %model=large #then + #set M=L + #pragma call(near_call=>off,ds_eq_ss=>off),data(near_ptr=>off,threshold=>32767,ss_in_dgroup=>off) + #pragma define(_fcall=>on,_fptr=>on) + #pragma define(M_I86LM=>on) +!end +!if xlargemodel +#elsif %model=xlarge #then + #if #not %system=win #then + #set M=X + #pragma call(near_call=>off,same_ds=>off,ds_eq_ss=>off),data(far_ext=>on,near_ptr=>off,const_in_code=>on,ss_in_dgroup=>off,ds_dynamic=>on) + #pragma define(_fcall=>on, _fdata=>on,_fptr=>on) + #pragma define(M_I86XM=>on) + #else + #error "Extra-large model not available for Windows programs" + #endif +!end +!if mthreadmodel +#elsif %model=mthread #then + #if #not %system=win #then + #set M=T + #pragma call(near_call=>off,same_ds=>off,ds_eq_ss=>off),data(far_ext=>on,near_ptr=>off,const_in_code=>on,ss_in_dgroup=>off,ds_dynamic=>on) + #pragma define(_fcall=>on, _fdata=>on,_fptr=>on,_mthread=>on) + #pragma define(M_I86TM=>on,M_I86MTM=>on) + #else + #error "Multi-thread model not available for Windows programs" + #endif +!end +!if overlaymodel +#elsif %model=overlay #then + #if %system=dos #then + #set M=O + #pragma call(near_call=>off,same_ds=>off,overlay=>on,ds_eq_ss=>off),data(far_ext=>on,near_ptr=>off,const_in_code=>off,ss_in_dgroup=>off,ds_dynamic=>on) + #pragma define(_fcall=>on,_fdata=>on,_fptr=>on,_mthread=>on) + #pragma define(M_I86OM=>on) + #else + #error "Overlay model not available for %system programs" + #endif +!end +!if dynalinkmodel +#elsif %model=dynalink #then + #if #not %system=win #then + #set M=D + #pragma call(near_call=>off,same_ds=>off,ds_eq_ss=>off),data(far_ext=>on,near_ptr=>off,ss_in_dgroup=>off,ds_dynamic=>on) + #if %system=dos #then + #pragma call(overlay=>on) + #else + #pragma data(const_in_code=>on) + #endif + #pragma define(_fcall=>on,_fdata=>on,_fptr=>on,_mthread=>on) + #pragma define(M_I86DM=>on) + #pragma link_option(smart_method=>off) + #else + #error "Dynalink model not available for Windows programs" + #endif +!end +#else + #error "Unrecognized argument %model" +#endif + +#if "%jpicall"="" #then #set jpicall=jpi #endif +#if %jpicall=jpi #then + #pragma call(reg_saved=>(ax,bx,cx,dx,si,di,ds,st1,st2)) + #pragma call(reg_param=>(ax,bx,cx,dx,st0,st6,st5,st4,st3)) + #pragma call(reg_return=>(ax,dx,st0)) + #pragma call(standard_conv=>off,standard_float=>off,opt_var_arg=>on) + #if %model=overlay #or (%model=dynalink #and %system=dos) #then + #pragma call(opt_var_arg=>off) + #endif + #set C=_ + #pragma define(_jpicall=>on) +#elsif %jpicall=stack #then + #pragma call(reg_saved=>(si,di,ds,st1,st2)) + #pragma call(reg_param=>()) + #pragma call(reg_return=>(ax,dx)) + #pragma call(standard_conv=>on,standard_float=>on,opt_var_arg=>off) + #set C=F + #pragma define(_jpicall=>off) +#else + #error "Unrecognized argument %jpicall" +#endif + +#if %system=win #then + #set O=W + #pragma link_option(pack=>off,windows=>on),call(windows=>on) +#elsif %system=dos #then + #set O=R + #pragma link_option(oldexe=>on,pack=>off),call(windows=>off) + #pragma optimize(cpu=>86) +#elsif %system=os2 #then + #set O=P + #pragma optimize(cpu=>286),call(windows=>off) +!! PSION SIBO change +#elsif %system=epoc #then + #set O=R + #pragma link_option(case=>on,oldexe=>on,pack=>off) + #pragma optimize(cpu=>86) + #pragma data(no_far_data=>on) + #pragma define(EPOC=>1) + #if "%epocinit"="iclib" #then + #pragma data(stack_size=>8192) + #elsif "%epocinit"="iclib4" #then + #pragma data(stack_size=>4096) + #elsif "%epocinit"="iclib2" #then + #pragma data(stack_size=>2048) + #elsif "%epocinit"="iplib8" #then + #pragma data(stack_size=>8192) + #elsif "%epocinit"="iplib" #then + #pragma data(stack_size=>4096) + #elsif "%epocinit"="iplib2" #then + #pragma data(stack_size=>2048) + #else + #error "Unknown epocinit: %epocinit" + #endif +!! end of PSION SIBO change +#else + #error "Unknown argument to #system: %system" +#endif + +!! defines used by library source files +!! you may wish to disable these in order to share OS2/DOS object files +!! _DLL may not be disabled +#pragma define(_ENV=>off,_WINDOWS=>off,_DLL=>off,_WINDLL=>off,_OVL=>off,_OS2=>off,__OS2__=>off,__MSDOS__=>off) +#if %system=os2 #then #pragma define(__OS2__=>on,_OS2=>on) #endif +#if %system=dos #then #pragma define(__MSDOS__=>on) #endif +#if %system=win #then #pragma define(_WINDOWS=>on) #endif +#if %model=overlay #then #pragma define(_OVL=>on) #endif +#if %model=dynalink #then #pragma define(_DLL=>on) #endif + +!! End of Project model section +!! ========================================================================= +! Project Link +!! The following lines are executed whenever a #link command is executed in +!! a project file + +#autocompile + +!! Calculate lfiletype - the type of file being made for this #link only +!! Default is the filetype specified by #system (%filetype) + +#if "%filetype"="" #then +!! PSION SIBO change + #if %system=epoc #then + #set filetype=img + #else + #set filetype=exe + #endif +!! end of PSION SIBO change +#endif + +#split %link_arg +#if "%ext"="" #then + #set lfiletype_=%filetype + #set ext=%filetype +#elsif (%ext=exe) #or (%ext=dll) #or (%ext=lib) #then + #set lfiletype_=%ext +#else + #set lfiletype_=%filetype +#endif + +!! PSION SIBO change +#if %system=epoc #then + #if %filetype=img #then + #set epoctype=t1 + #elsif %filetype=dyl #then + #set epoctype=t4 + #endif +#endif +!! end of PSION SIBO change + +!! Calculate any additional libraries or object files that need to be linked + +#if #not %lfiletype_=lib #then + #if %system=win #then + #if %lfiletype_=dll #then + #compile initwdll.a + #pragma linkfirst(initwdll.obj) + #elsif %filetype=exe #then + #if "%tsm2" #or "%tspas" #then + #compile initmwin.a + #pragma linkfirst(initmwin.obj) + #else + #compile initwin.a + #pragma linkfirst(initwin.obj) + #endif + #else + #error "Unknown argument to #system: %filetype" + #endif + #else + #if %lfiletype_=dll #then + #pragma linkfirst(initdll.obj) + #elsif %lfiletype_=exe #then + #if (#not ("%tsc" #or "%tscpp")) #and (%system = dos) + #and (("%model"=xlarge) #or ("%model"=mthread)) #then + #pragma linkfirst(initnew.obj) + #elsif "%pm_api" #and (%system=os2) #then + #pragma link_option(pm=>on,non_pm=>off) + #pragma linkfirst(initpm.obj) +!! PSION SIBO change + #elsif %system=epoc #then + #if %filetype=img #then + #pragma linkfirst(%epocinit.obj) + #else + #pragma linkfirst(icat.obj) + #endif +!! end of PSION SIBO change + #else + #pragma linkfirst(initexe.obj) + #endif + #if (%system=os2) #then + #if "%pm_compat" #then + #pragma link_option(pm=>on,non_pm=>on) + #elsif "%pm_noncompat" #then + #pragma link_option(pm=>off,non_pm=>on) + #endif + #endif + #else + !! PSION SIBO change + #if %system=epoc #then + #if %filetype=img #then + #pragma linkfirst(%epocinit.obj) + #else + #pragma linkfirst(icat.obj) + #endif + #else + #error "Unknown argument to #system: %filetype" + #endif +!! end of PSION SIBO change + #endif + #endif + +!! calculate jpilib_ + + #set prefix_="%O%%M%%C%" + #if (%lfiletype_=dll) #and (%system=win) #then + #set jpilib_="%prefix_%comd.lib" + #else + #set jpilib_="%prefix_%com.lib" + #endif + #if "%tsc" #then + #set jpilib_="%jpilib_,%prefix_%clib.lib" + #endif + + #if "%tscpp" #then + #if %model=dynalink #then + #set CPPprefix_="%O%%M%%C%" + #else + #set CPPprefix_="C%M%%C%" + #endif + #set jpilib_="%jpilib_,%CPPprefix_%slib.lib" + #if "%usertool" #then + #set jpilib_="%jpilib_,%CPPprefix_%rtool.lib" + #endif + #if "%usermath" #then + #set jpilib_="%jpilib_,%CPPprefix_%rmath.lib" + #endif + #endif + + #if "%tsm2" #then + #set jpilib_="%jpilib_,%prefix_%m2.lib" + #if "%tsc" #then + #set jpilib_="%jpilib_, %prefix_%mlibc.lib" + #if "%cwindow"=jpi #then + #set jpilib_="%jpilib_, %prefix_%wind.lib" + #endif + #else + #set jpilib_="%jpilib_, %prefix_%mlib.lib" + #endif + #endif + + #if "%tspas" #then + #if %model=dynalink #then + #if %tsc #then + #set jpilib_="%jpilib_,%prefix_%pasc.lib" + #elsif %tsm2 #then + #set jpilib_="%jpilib_,%prefix_%pasm.lib" + #else + #set jpilib_="%jpilib_,%prefix_%pas.lib" + #endif + #else + #set jpilib_="%jpilib_,%prefix_%pas.lib" + #endif + #if "%tsc" #then + #set jpilib_="%jpilib_,%prefix_%mlibc.lib" + #if "%cwindow"=jpi #then + #set jpilib_="%jpilib_,%prefix_%wind.lib" + #endif + #elsif "%tsm2" #then + #set jpilib_="%jpilib_,%prefix_%mlib.lib" + #else + #set jpilib_="%jpilib_,%prefix_%plib.lib" + #endif + #pragma link_option(case=>off) + #endif + + #if "%cgraph"=jpi #then + #set jpilib_="%jpilib_,%prefix_%graph.lib" + #elsif "%cgraph"=borland #then + #set jpilib_="%jpilib_,graphics.lib" + #endif + + #if ("%cwindow"=jpi) #and #not(("%tsm2") #or("%tspas")) #then + #set jpilib_="%jpilib_,%prefix_%wind.lib" + #elsif "%cwindow"=borland #then + #set jpilib_="%jpilib_,%prefix_%borw.lib" + #endif + + #if "%system"=os2 #then + #if "%pm_api" #then + #set jpilib_="%jpilib_,pmjpi.lib,os2jpi.lib" + #else + #set jpilib_="%jpilib_,os2jpi.lib" + #endif + #elsif (%model=overlay) #or (%model=dynalink) #then + #set jpilib_="%jpilib_,loader.lib" + #endif + +!! PSION SIBO change + #if %system=epoc #then + #if "%epocinit"="iclib" #or "%epocinit"="iclib4" #or "%epocinit"="iclib2" #then + #if %filetype=img #then + #pragma link(clib.lib) + #endif + #endif + #set jpilib_="plib.lib" + #endif +!! end of PSION SIBO change + + #pragma link(%jpilib_) +!! PSION SIBO change + #if %system=epoc #then + #pragma link(wlib.lib) + #pragma link(rlib.lib) + #endif +!! end of PSION SIBO change +#endif + +!! Now do the link +#if (%ext=dll) #then + #pragma link_option(smart_method=>off) + #if (%system=dos) #then + #if #not ((%model=overlay) #or (%model=dynalink)) #then + #error "DOS DLLs must use overlay or dynalink model" + #endif + #elsif (%system=os2) #then + #if #not ((%model=xlarge) #or (%model=mthread) #or (%model=dynalink)) #then + #error "OS2 DLLs must use xlarge, mthread or dynalink model" + #endif + #endif +#endif + +#if "%ext%"=lib #then + #dolink %name%.%ext% +#elsif ("%model"=overlay) #or ((%system=dos) #and ("%model"=dynalink)) #then + #if "%ext%"=dll #then + #if #not "%manual_export" #then + #if #exists %name%.exp #then + #implib %name%.lib %name%.exp + #else + #implib %name%.lib + #endif + #endif + #else + #pragma link_option(stub=>ovlload.exe) + #endif + #pragma link_option(map=>on,oldexe=>off,overlay=>on,pack=>off) + #dolink %name%.%ext% + #message "link complete" + #set ovrexe_=%name%.%ext% + #set ovrmap_=%name%.map + #if #exists %name%.exp #then + #set ovrexp_=%name%.exp + #else + #set ovrexp_=overlay.exp + #endif + #if %make #or %ovrexe_ #older %ovrexp_ #then + #message "Patching EXE header" + #exemod %ovrexe_ %ovrexp_ %ovrmap_ + #endif +#elsif (%system=os2) #and ("%ext%"=dll) #then + #if #not "%manual_export" #then + #if #exists %name%.exp #then + #implib %name%.lib %name%.exp + #else + #implib %name%.lib + #endif + #endif + #pragma link_option(map=>on,oldexe=>off) + #dolink %name%.%ext% + #message "link complete" +#elsif %system = win #then + #set link_arg=%name%.%ext% + #set winexp_=%name%.exp + #set winexe_=%name%.%ext% + #set winlib_=%name%.lib + #set winmap_=%name%.map + #implib %winlib_ %winexp_ + #pragma link_option(map=>on,oldexe=>off,windows=>on,export=>on) + #pragma link(windows.lib) + #if "%winmath" = chip #then + #pragma link(noemul.obj) + #elsif "%winmath" = emu #then + #pragma link(winfloat.obj) + #pragma link(win87em.lib) + #elsif "%winmath" = none #then + #pragma link(nofloat.obj) + #else + #error "Please set project system macro 'winmath' to 'chip', 'emu' or 'none'" + #endif + #dolink %link_arg + #message "link complete" + #if "%make" #then + #exemod %winexe_ %winexp_ %winmap_ + #endif +!! PSION SIBO change +#elsif %system=epoc #then + #dolink %name%.exe +!! end of PSION SIBO change +#else + #dolink %name%.%ext% +#endif + +!! PSION SIBO change +!! convert the .exe file to a .img or .dyl file +#if %system=epoc #then + #if %name%.%filetype% #older %name%.exe #then + #set afl="" + #set dfl="" + #if "%version"="" #then #set version=0x100f #endif + #message "Making %name%.%filetype%" + #if %filetype=img #then + #if #exists %name%.afl #then #set afl="-a%name%.afl" #endif + #if #exists %name%.dfl #then #set dfl="-d%name%.dfl" #endif + #if "%priority"="" #then #set priority=0x80 #endif + #if "%heapsize"="" #then #set heapsize=0x80 #endif + #else + #set priority="" + #set heapsize="" + #endif + #run "emake >make.$$$ -b %afl% %dfl% -o%name% -s -v%version% -p%priority% -h%heapsize% -%epoctype% %name%.exe" no_window no_abort + #file adderrors make.$$$ + #file delete make.$$$ + #endif +#endif +!! #run "emake >make.$$$ -b -o%name% -s -v%version% -%epoctype% %name%" no_window no_abort +!! end of PSION SIBO change + +!! Reset macros indicating what libraries are required + +#set tsc=off +#set tscpp=off +#set tspas=off +#set tsm2=off +#set cwindow="" +#set cgraph="" +#set pm_api="" +#set pm_compat="" +#set pm_noncompat="" +#set manual_export="" + +!! End of Project Link section +! Project End +!! ========================================================================= + diff --git a/code/SIBOSDK/tprint/dedlg.c b/code/SIBOSDK/tprint/dedlg.c new file mode 100644 index 0000000..2f99e3b --- /dev/null +++ b/code/SIBOSDK/tprint/dedlg.c @@ -0,0 +1,17 @@ +/* DEDLG.C */ + +#include +#include + +#pragma METHOD_CALL + +METHOD INT dedlg_dl_key(PR_DLGBOX *self) + { + RBUF_LP *prbuf; + + prbuf=self->dlgbox.rbuf; + prbuf->dayno=hDlgSenseDtedit(1); + prbuf->ndays=hDlgSenseNcedit(2); + prbuf->gap=hDlgSenseChlist(3); + return(WN_KEY_CHANGED); + } diff --git a/code/SIBOSDK/tprint/delp.c b/code/SIBOSDK/tprint/delp.c new file mode 100644 index 0000000..5c16996 --- /dev/null +++ b/code/SIBOSDK/tprint/delp.c @@ -0,0 +1,105 @@ +/* DELP.C */ + +#include +#include +#include + +#define TIME_FMT_FLAGS (PR_TIME_MONTH_NAME|PR_TIME_SUFFIX_NAME) + +LOCAL_C VOID InitTimeObject(PR_DELP *self) + { + P_DAYSEC ds; + SE_TIME_FORMAT fmt; + + ds.day=self->delp.rbuf.dayno; + ds.sec=0; + self->delp.time=f_new(CAT_DEMO_OLIB,C_TIME); + p_send4(self->delp.time,O_TO_SET,SET_TIME_DAYSEC,&ds); + fmt.flags=TIME_FMT_FLAGS; + p_send4(self->delp.time,O_TO_SET_FORMAT,&fmt,TIME_FMT_FLAGS); + } + +LOCAL_C UINT SenseBufWidth(PR_DELP *self,TEXT *pb) + { + return(p_send4(self,O_LPR_SENSE_BUF_WIDTH,pb,p_slen(pb))); + } + +LOCAL_C VOID FindWidthFirstColumn(PR_DELP *self) + { + INT i; + TEXT buf[E_MAX_DAY_NAME]; + UWORD wid; + + for (i=0; i<7; i++) + { + p_nmday(&buf[0],i); + wid=SenseBufWidth(self,&buf[0]); + if (wid>self->delp.colwid) + self->delp.colwid=wid; + } + self->delp.colwid+=SenseBufWidth(self," "); /* two spaces */ + if (self->delp.colwid>(3*self->lprinter.width/4)) + { + hInfoPrint(DELP_PAPER_NARROW); + p_sleep(20); + p_leave(RUN_ACTIVE_CLEANUP_NONOTIFY); + } + self->lprinter.subsqind=self->delp.colwid; + } + +#pragma METHOD_CALL + +METHOD VOID delp_lpr_init(PR_DELP *self,RBUF_LP *prbuf) + { + self->delp.rbuf=(*prbuf); + p_supersend2(self,O_LPR_INIT); + } + +METHOD INT delp_lpr_sense_text(PR_DELP *self,WDR_PRINT *pr) + { + P_DATE dt; + P_DAYSEC ds; + + if (!self->delp.time) + { + InitTimeObject(self); + FindWidthFirstColumn(self); + } + else if (!self->delp.rbuf.ndays) + return(FALSE); + switch (self->delp.state++) + { + case DELP_STATE_COL1: + if (self->delp.rbuf.gap) + { + p_send4(self->delp.time,O_TO_SENSE,SENSE_TIME_DATE,&dt); + if (!dt.day) + { + pr->down=pr->height; + if (self->delp.rbuf.gap==1) + pr->down>>=1; + } + } + p_send4(self->delp.time,O_TO_SENSE,SENSE_TIME_DAYSEC,&ds); + p_nmday(&self->delp.dname[0],P_WEEK(ds.day)); + self->delp.right=self->delp.colwid + -SenseBufWidth(self,&self->delp.dname[0]); + pr->buf=(&self->delp.dname[0]); + break; + case DELP_STATE_COL2: + pr->flags&=(~(WDR_PRINT_LINE|WDR_PRINT_TEXT)); + pr->flags|=WDR_PRINT_RIGHT; + pr->right=self->delp.right; + return(TRUE); + case DELP_STATE_COL3: + p_send4(self->delp.time,O_TO_SENSE,SENSE_TIME_DATESTR,&self->delp.buf[0]); + pr->buf=(&self->delp.buf[0]); + pr->flags&=(~WDR_PRINT_LINE); + pr->indent=self->delp.colwid; + self->delp.rbuf.ndays--; + p_send4(self->delp.time,O_TO_ADD_DAYS,1,0); + self->delp.state=DELP_STATE_COL1; + } + pr->blen=p_slen(pr->buf); + return(TRUE); + } diff --git a/code/SIBOSDK/tprint/demain.c b/code/SIBOSDK/tprint/demain.c new file mode 100644 index 0000000..3ab9cf7 --- /dev/null +++ b/code/SIBOSDK/tprint/demain.c @@ -0,0 +1,17 @@ +/* DEMAIN.C */ + +#include + +GLDEF_C VOID main(VOID) + { + IN_HWIMMAN app; + IN_WSERV wserv; + + p_linklib(0); + app.flags=FLG_APPMAN_RSCFILE|FLG_APPMAN_SRSCFILE|FLG_APPMAN_CLEAN|FLG_APPMAN_FULLSCREEN; + app.wserv_cat=p_getlibh(CAT_DEMO_DEMO); + app.wserv_class=C_DEWSERV; + wserv.com_cat=p_getlibh(CAT_DEMO_HWIM); + wserv.com_class=C_COMMAN; + p_send4(p_new(CAT_DEMO_HWIM,C_HWIMMAN),O_AM_INIT,&app,&wserv); + } diff --git a/code/SIBOSDK/tprint/demo.cat b/code/SIBOSDK/tprint/demo.cat new file mode 100644 index 0000000..e8f5520 --- /dev/null +++ b/code/SIBOSDK/tprint/demo.cat @@ -0,0 +1,51 @@ +IMAGE demo + +EXTERNAL olib +EXTERNAL hwim + +INCLUDE hwimman.g +INCLUDE dlgbox.g +INCLUDE lprinter.g +INCLUDE time.g +INCLUDE epoc.h + +CLASS dewserv wserv + { + REPLACE ws_dyn_init + } + +CLASS dedlg dlgbox + { + REPLACE dl_key + TYPES + { + typedef struct + { + UWORD dayno; + UWORD ndays; + UWORD gap; + } RBUF_LP; + } + } + +CLASS delp lprinter + { + REPLACE lpr_init + REPLACE lpr_sense_text + CONSTANTS + { + DELP_STATE_COL1 0 + DELP_STATE_COL2 1 + DELP_STATE_COL3 2 + } + PROPERTY 1 + { + VOID *time; + UWORD colwid; + UWORD right; + UWORD state; + RBUF_LP rbuf; + TEXT dname[E_MAX_DAY_NAME]; + TEXT buf[LN_TIME_DATE_STR]; + } + } diff --git a/code/SIBOSDK/tprint/demo.pic b/code/SIBOSDK/tprint/demo.pic new file mode 100644 index 0000000..d980c34 Binary files /dev/null and b/code/SIBOSDK/tprint/demo.pic differ diff --git a/code/SIBOSDK/tprint/demo.rss b/code/SIBOSDK/tprint/demo.rss new file mode 100644 index 0000000..b4ff082 --- /dev/null +++ b/code/SIBOSDK/tprint/demo.rss @@ -0,0 +1,55 @@ +/* DEMO.RSS */ + +#include +#include + +RESOURCE WSERV_INFO demo_accs + { + menbar_id=0; + first_com=0; + accel={'x'}; + } + +RESOURCE MENU delp_gap_chlist + { + items = + { + CHOICE_ITEM { str="No gap";}, + CHOICE_ITEM { str="Half a line";}, + CHOICE_ITEM { str="Complete line";} + }; + } + +RESOURCE DIALOG delp_dlg + { + title="Print list of days"; + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_RBUF_FILLED; + controls= + { + CONTROL + { + class=C_DTEDIT; + prompt="Start date"; + info=DTEDIT { flags=IN_DTEDIT_DDMMYYYY;}; + }, + CONTROL + { + class=C_NCEDIT; + prompt="Number of days to print"; + info=NCEDIT + { + low=10; + current=20; + high=200; + }; + }, + CONTROL + { + class=C_CHLIST; + prompt="Space between months"; + info=CHLIST { rid=delp_gap_chlist; }; + } + }; + } + +RESOURCE STRING delp_paper_narrow { str="Paper size too narrow"; } diff --git a/code/SIBOSDK/tprint/dewserv.c b/code/SIBOSDK/tprint/dewserv.c new file mode 100644 index 0000000..dd67cfe --- /dev/null +++ b/code/SIBOSDK/tprint/dewserv.c @@ -0,0 +1,29 @@ +/* DEWSERV.C */ + +#include +#include +#include + +LOCAL_C INT LaunchDialog(INT class,INT resid,VOID *rbuf) + { + DL_DATA dld; + + dld.id=resid; + dld.rbuf=rbuf; + dld.pdlg=NULL; + return hLaunchDial(CAT_DEMO_DEMO,class,&dld); + } + +#pragma METHOD_CALL + +METHOD VOID dewserv_ws_dyn_init(PR_DEWSERV *self) + { + RBUF_LP rbuf; + + if (LaunchDialog(C_DEDLG,DELP_DLG,&rbuf)) + { + p_send2(self,O_WS_EDIT_PRINT_CONTEXT); + hDestroy(f_newsend(CAT_DEMO_DEMO,C_DELP,O_LPR_INIT,&rbuf)); + } + p_exit(0); + } diff --git a/code/SIBOSDK/tprint/make.bat b/code/SIBOSDK/tprint/make.bat new file mode 100644 index 0000000..158073b --- /dev/null +++ b/code/SIBOSDK/tprint/make.bat @@ -0,0 +1,3 @@ +@echo off +tscx /m tprint +tscx /m tprint diff --git a/code/SIBOSDK/tprint/tprint.afl b/code/SIBOSDK/tprint/tprint.afl new file mode 100644 index 0000000..88c6f9b --- /dev/null +++ b/code/SIBOSDK/tprint/tprint.afl @@ -0,0 +1,2 @@ +demo.pic +demo.rzc diff --git a/code/SIBOSDK/tprint/tprint.pr b/code/SIBOSDK/tprint/tprint.pr new file mode 100644 index 0000000..31f72af --- /dev/null +++ b/code/SIBOSDK/tprint/tprint.pr @@ -0,0 +1,31 @@ +#system epoc img +#set epocinit=iplib +#model small jpi + +#abort on + +#compile demo.cat + +#if %remake #or (demo.rsg #older demo.rss) #then + #file delete demo.rsg + #run "rs demo" no_window no_abort +#endif + +#if demo.rzc #older demo.rsg #then + #run "rch demo" no_window no_abort + #file delete tprint.img +#endif + +#compile delp.c +#compile dedlg.c +#compile demain.c +#compile dewserv.c + +#if (tprint.img #older tprint.afl) #or (tprint.img #older demo.pic) #then + #file delete tprint.img +#endif + +#pragma link(olib.lib) +#pragma link(hwim.lib) + +#link tprint.img diff --git a/code/SIBOSDK/tprint/tprrel.prj b/code/SIBOSDK/tprint/tprrel.prj new file mode 100644 index 0000000..51cfa87 --- /dev/null +++ b/code/SIBOSDK/tprint/tprrel.prj @@ -0,0 +1,14 @@ +tprrel.prj ! releases source files +tprint.pr ! TS project file +make.bat ! makes TPRINT.IMG +! +demo.cat ! category file +demo.rss ! resource script +! +delp.c ! line printer +dedlg.c ! dialog +demain.c ! main +dewserv.c ! window server subclass +! +tprint.afl ! add file list +demo.pic ! icon diff --git a/code/SIBOSDK/wd/bj.wd b/code/SIBOSDK/wd/bj.wd new file mode 100644 index 0000000..bb1ad74 --- /dev/null +++ b/code/SIBOSDK/wd/bj.wd @@ -0,0 +1,206 @@ +! BJ.WD +! Printer driver file for Cannon BJ series printers + +COMMANDS +!<27>[K<4><0><0><36><1><65> +! <4><0> - 4 bytes remaining +! <0> - init to user-defined settings +! <36> - ID for BJ-10e +! <1> - Character set 2 +! <65> - Multiligual 850 (64) + Auto Sheet Feeder (1) + RESET "<27>[K<4><0><0><36><1><65>" + FORM_LENGTH "<27>C%c" +!<27>A<1> - set line spacing to 1/72 inch +!<27>2 - enable the above + PREAMBLE "<27>A<1><27>2" +!<27>[K<1><0><0> +! <4><0> - 1 bytes remaining +! <0> - init to user-defined settings + POSTAMBLE "<27>[K<1><0><0>" + BOLD_ON "<27>E" + BOLD_OFF "<27>F" + ITALIC_ON "<27>-<1>" + ITALIC_OFF "<27>-<0>" + UNDERLINE_ON "<27>-<1>" + UNDERLINE_OFF "<27>-<0>" + SUBSCRIPT_ON "<27>S<1>" + SUBSCRIPT_OFF "<27>T" + SUPERSCRIPT_ON "<27>S<0>" + SUPERSCRIPT_OFF "<27>T" + NEW_PAGE "<12>" + CARRIAGE_RETURN "<13>" + MOVE_DOWN "*<10>" + MOVE_RIGHT_PREFIX "" + MOVE_RIGHT "<27>d%w" + MOVE_RIGHT_SUFFIX "" +END_COMMANDS + +TRANSLATES telephone + 5:35 +END_TRANSLATES + +WIDTHS wid_prop12 + 0:10 1:10 2:10 3:10 4:10 + 5:10 ! telephone character must be the same as # (35) + 6:10 + 7:10 ! non-breaking hyphen must be the same as hyphen (45) + 8:10 + 9:10 ! tab must be the same as space (32) + 10:10 11:10 12:10 13:10 + 14:10 ! potential hyphen must be the same as hyphen (45) + 15:10 ! non-breaking space must be the same as space (32) + 16:10 + 17:10 18:10 19:10 20:10 21:10 22:10 23:10 24:10 + 25:10 26:10 27:10 28:10 29:10 30:10 31:14 32:10 + 33:10 34:10 35:10 36:10 37:10 38:12 39:6 40:10 + 41:10 42:10 43:10 44:10 45:10 46:10 47:10 48:10 + 49:10 50:10 51:10 52:10 53:10 54:10 55:10 56:10 + 57:10 58:10 59:10 60:10 61:10 62:10 63:10 64:10 + 65:14 66:14 67:14 68:14 69:12 70:12 71:14 72:14 + 73:8 74:10 75:14 76:12 77:14 78:14 79:14 80:12 + 81:14 82:14 83:12 84:14 85:14 86:14 87:14 88:14 + 89:14 90:12 91:10 92:10 93:10 94:10 95:10 96:10 + 97:10 98:12 99:10 100:12 101:10 102:8 103:12 104:12 + 105:6 106:6 107:12 108:6 109:14 110:12 111:10 112:12 + 113:12 114:10 115:10 116:8 117:12 118:12 119:14 120:12 + 121:12 122:10 123:10 124:10 125:10 126:10 127:10 128:14 + 129:12 130:10 131:10 132:10 133:10 134:10 135:10 136:10 + 137:10 138:10 139:6 140:6 141:6 142:14 143:14 144:12 + 145:14 146:14 147:10 148:10 149:10 150:12 151:12 152:12 + 153:14 154:14 155:10 156:10 157:14 158:10 159:10 160:10 + 161:6 162:10 163:12 164:12 165:14 166:10 167:10 168:10 + 169:10 170:10 171:10 172:10 173:10 174:14 175:14 176:10 + 177:10 178:10 179:10 180:10 181:14 182:14 183:14 184:10 + 185:10 186:10 187:10 188:10 189:10 190:10 191:10 192:10 + 193:10 194:10 195:10 196:10 197:10 198:10 199:14 200:10 + 201:10 202:10 203:10 204:10 205:10 206:10 207:10 208:12 + 209:14 210:12 211:12 212:12 213:6 214:8 215:8 216:8 + 217:10 218:10 219:10 220:10 221:10 222:8 223:10 224:14 + 225:12 226:14 227:14 228:10 229:14 230:10 231:12 232:14 + 233:14 234:14 235:14 236:12 237:14 238:10 239:10 240:10 + 241:10 242:10 243:10 244:10 245:10 246:10 247:10 248:10 + 249:10 250:10 251:10 252:10 253:10 254:10 255:10 +END_WIDTHS + +TYPEFACE pica + NAME "Pica" + SERIF + TYPE COURIER + TRANSLATE telephone + FONT + HEIGHT 200 ! 10 point + WIDTH 7 ! 17 cpi + WIDTH_BOLD 12 ! 10 cpi + WIDTH_ITALIC 7 + WIDTH_BOLD_ITALIC 12 + ! I<18> 17 cpi [@400<17><1> single height and width + COMMAND "<27>I<18><27>[@<4><0><0><0><17><1>" + FONT + HEIGHT 240 ! 12 point + WIDTH 12 ! 10 cpi + ! I<2> 10 cpi [@400<17><1> single height and width + COMMAND "<27>I<2><27>[@<4><0><0><0><17><1>" + FONT + HEIGHT 260 ! 13 point + WIDTH 14 ! 8.5 cpi + WIDTH_BOLD 24 ! 5 cpi + WIDTH_ITALIC 14 + WIDTH_BOLD_ITALIC 24 + ! I<18> 17 cpi [@400<17><2> single height and double width + COMMAND "<27>I<18><27>[@<4><0><0><0><17><2>" + FONT + HEIGHT 320 ! 16 point + WIDTH 24 ! 5 cpi + ! I<2> 10 cpi [@400<17><2> single height and double width + COMMAND "<27>I<2><27>[@<4><0><0><0><17><2>" + FONT + HEIGHT 440 ! 22 point + WIDTH 12 ! 10 cpi + ! I<2> 10 cpi [@400<18><1> double height and single width + COMMAND "<27>I<2><27>[@<4><0><0><0><18><1>" + FONT + HEIGHT 480 ! 24 point + WIDTH 24 ! 5 cpi + ! I<2> 10 cpi [@400<18><2> double height and double width + COMMAND "<27>I<2><27>[@<4><0><0><0><18><2>" + END_FONT +END_TYPEFACE + +TYPEFACE elite + NAME "Elite" + SERIF + TYPE ELITE + TRANSLATE telephone + FONT + HEIGHT 200 ! 10 point + WIDTH 10 + ! I<10> 12 cpi [@400<17><1> single height and width + COMMAND "<27>I<10><27>[@<4><0><0><0><17><1>" + FONT + HEIGHT 280 + WIDTH 20 + ! I<10> 12 cpi [@400<17><2> single height and double width + COMMAND "<27>I<10><27>[@<4><0><0><0><17><2>" + FONT + HEIGHT 360 + WIDTH 10 + ! I<10> 12 cpi [@400<18><1> double height and single width + COMMAND "<27>I<10><27>[@<4><0><0><0><18><1>" + FONT + HEIGHT 400 + WIDTH 20 + ! I<10> 12 cpi [@400<18><2> double height and double width + COMMAND "<27>I<10><27>[@<4><0><0><0><18><2>" + END_FONT +END_TYPEFACE + +TYPEFACE proportional + NAME "Proportional" + MULTIPLE_WIDTH_TABLES + PROPORTIONAL + SERIF + TYPE TIMES_ROMAN + TRANSLATE telephone + FONT + HEIGHT 240 + WIDTH wid_prop12 + ! P<1> proportional [@400<17><1> single height and width + COMMAND "<27>P<1><27>[@<4><0><0><0><17><1>" + FONT + HEIGHT 320 + WIDTH_SCALE 2 + WIDTH wid_prop12 + ! P<1> proportional [@400<17><2> single height and double width + COMMAND "<27>P<1><27>[@<4><0><0><0><17><2>" + FONT + HEIGHT 440 + WIDTH wid_prop12 + ! P<1> proportional [@400<18><1> double height and single width + COMMAND "<27>P<1><27>[@<4><0><0><0><18><1>" + FONT + HEIGHT 480 + WIDTH_SCALE 2 + WIDTH wid_prop12 + ! P<1> proportional [@400<18><2> double height and double width + COMMAND "<27>P<1><27>[@<4><0><0><0><18><2>" + END_FONT +END_TYPEFACE + +MODEL + NAME "Canon BJ-10e" + NAME "IBM Proprinter X24E" + MIN_X 12 ! 12 twips = 1/120 inch + MIN_Y 20 ! 20 twips = 1/72 inch + SKIP_X 8 ! 1/15 inch + SKIP_Y 18 ! 1/4 inch + TYPEFACE pica,elite,proportional +END_MODEL + +MODEL + NAME "Canon BJ-30" + MIN_X 12 ! 12 twips = 1/120 in + MIN_Y 20 ! 20 twips = 1/72 in + SKIP_X 8 ! skipx 1/15 inch + SKIP_Y 18 ! skipy 1/4 + TYPEFACE pica,proportional +END_MODEL diff --git a/code/SIBOSDK/wd/epson.wd b/code/SIBOSDK/wd/epson.wd new file mode 100644 index 0000000..6871417 --- /dev/null +++ b/code/SIBOSDK/wd/epson.wd @@ -0,0 +1,252 @@ +! EPSON.WD +! Printer driver file for EPSON RX & LQ printers + +COMMANDS + RESET "<27>@" + FORM_LENGTH "<27>C%c" +! <27>A<1> 1/60 inch line spacing or 1/72 for RX +! <27>l<0> left margin to zero +! <27>N<0> no bottom margin + PREAMBLE "<27>A<1><27>l<0><27>N<0>" + POSTAMBLE "<13><27>@" + BOLD_ON "<27>G" + BOLD_OFF "<27>H" + ITALIC_ON "<27>4" + ITALIC_OFF "<27>5" + UNDERLINE_ON "<27>-<1>" + UNDERLINE_OFF "<27>-<0>" + SUBSCRIPT_ON "<27>S<1>" + SUBSCRIPT_OFF "<27>T" + SUPERSCRIPT_ON "<27>S<0>" + SUPERSCRIPT_OFF "<27>T" + NEW_PAGE "<12>" + CARRIAGE_RETURN "<13>" + MOVE_DOWN "*<10>" + MOVE_RIGHT_PREFIX "<27>Y%w" ! number of bit image data + MOVE_RIGHT "*<0>" ! zero bit image + MOVE_RIGHT_SUFFIX "" +END_COMMANDS + +TRANSLATES translate + 5:35 +END_TRANSLATES + +WIDTHS prop + 0:5 1:5 2:5 3:5 4:5 + 5:5 ! telephone character must be the same as # (35) + 6:5 + 7:5 ! non-breaking hyphen must be the same as hyphen (45) + 8:5 + 9:5 ! tab must be the same as space (32) + 10:5 11:5 12:5 13:5 + 14:5 ! potential hyphen must be the same as hyphen (45) + 15:5 ! non-breaking space must be the same as space (32) + 16:5 + 17:5 18:5 19:5 20:5 21:5 22:5 23:5 24:5 + 25:5 26:5 27:5 28:5 29:5 30:5 31:5 32:5 + 33:3 34:5 35:5 36:5 37:6 38:6 39:3 40:4 + 41:4 42:5 43:5 44:3 45:5 46:3 47:5 48:5 + 49:5 50:5 51:5 52:5 53:5 54:5 55:5 56:5 + 57:5 58:3 59:3 60:5 61:5 62:5 63:5 64:6 + 65:6 66:6 67:6 68:6 69:6 70:6 71:6 72:6 + 73:4 74:5 75:6 76:6 77:7 78:6 79:6 80:6 + 81:6 82:6 83:6 84:6 85:7 86:6 87:7 88:6 + 89:6 90:5 91:4 92:5 93:4 94:5 95:5 96:3 + 97:5 98:6 99:5 100:6 101:5 102:4 103:6 104:6 + 105:3 106:4 107:6 108:3 109:7 110:6 111:5 112:6 + 113:6 114:5 115:5 116:4 117:6 118:6 119:7 120:5 + 121:6 122:5 123:4 124:3 125:4 126:5 127:6 + 128:6 + 129:6 130:5 131:5 132:5 133:5 134:5 135:5 136:5 + 137:5 138:5 139:3 140:3 141:3 142:6 143:6 144:6 + 145:7 146:7 147:5 148:5 149:5 150:6 151:6 152:6 + 153:6 154:7 155:5 156:5 157:6 158:5 159:5 160:5 + 161:3 162:5 163:6 164:6 165:6 166:5 167:5 168:5 + 169:6 170:5 171:5 172:5 173:5 174:5 175:5 176:5 + 177:5 178:5 179:5 180:5 181:6 182:6 183:6 184:6 + 185:5 186:5 187:5 188:5 189:5 190:6 191:5 192:5 + 193:5 194:5 195:5 196:5 197:5 198:5 199:6 200:5 + 201:5 202:5 203:5 204:5 205:5 206:5 207:5 208:6 + 209:6 210:6 211:6 212:6 213:3 214:4 215:4 216:4 + 217:5 218:5 219:5 220:5 221:3 222:4 223:5 224:6 + 225:5 226:6 227:6 228:5 229:6 230:5 231:6 232:6 + 233:7 234:7 235:7 236:6 237:6 238:5 239:3 240:5 + 241:5 242:5 243:5 244:5 245:5 246:5 247:5 248:5 + 249:5 250:5 251:4 252:4 253:5 254:5 255:5 +END_WIDTHS + +TYPEFACE pica_rx + NAME "Pica" + TYPE COURIER + TRANSLATE translate +! rx_pica_cond="<27>p<0><27>P<27><15><27>W<0>" +! rx_pica_cond_enlg="<27>p<0><27>P<27><15><27>W<1>" + FONT + HEIGHT 240 ! 12 point + WIDTH 12 ! 10 cpi + ! rx_pica + COMMAND "<27>p<0><27>P<27><18><27>W<0>" + END_FONT + FONT + HEIGHT 320 ! 16 point + WIDTH 24 ! 5 cpi + ! rx_pica_enlg + COMMAND "<27>p<0><27>P<27><18><27>W<1>" + END_FONT +END_TYPEFACE + +TYPEFACE elite_rx + NAME "Elite" + TYPE ELITE + TRANSLATE translate + FONT + HEIGHT 200 ! 10 point + WIDTH 10 ! 12 cpi + ! rx_elite + COMMAND "<27>p<0><27>M<27><18><27>W<0>" + END_FONT + FONT + HEIGHT 280 ! 14 point + WIDTH 20 ! 6 cpi + ! rx_elite_enlg + COMMAND "<27>p<0><27>M<27><18><27>W<1>" + END_FONT +END_TYPEFACE + +TYPEFACE pica + NAME "Pica" + TYPE COURIER + TRANSLATE translate +! pica_cond_enlg_doub="<27>w<1><27>k<2><27>!<36>" + FONT + HEIGHT 200 ! 10 point + WIDTH 7 ! 17 cpi + ! pica_cond + COMMAND "<27>w<0><27>k<2><27>!<4>" + FONT + HEIGHT 240 ! 12 point + WIDTH 12 ! 10 cpi + ! pica + COMMAND "<27>w<0><27>k<2><27>!<0>" + FONT + HEIGHT 260 ! 13 point + WIDTH 14 ! 8.5 cpi + ! pica_cond_enlg + COMMAND "<27>w<0><27>k<2><27>!<36>" + FONT + HEIGHT 320 ! 16 cpi + WIDTH 24 ! 5 cpi + ! pica_enlg + COMMAND "<27>w<0><27>k<2><27>!<32>" + FONT + HEIGHT 440 ! 22 point + WIDTH 12 ! 10 cpi + ! pica_doub + COMMAND "<27>w<1><27>k<2><27>!<0>" + FONT + HEIGHT 480 ! 24 point + WIDTH 24 ! 5 cpi + ! pica_enlg_doub + COMMAND "<27>w<1><27>k<2><27>!<32>" + END_FONT +END_TYPEFACE + +TYPEFACE elite + NAME "Elite" + TYPE ELITE + TRANSLATE translate +! elite_enlg="<27>w<0><27>k<2><27>!<33>" +! elite_doub="<27>w<1><27>k<2><27>!<1>" + FONT + HEIGHT 180 ! 9 point + WIDTH 6 + ! elite_cond + COMMAND "<27>w<0><27>k<2><27>!<5>" + FONT + HEIGHT 200 + WIDTH 10 + ! elite + COMMAND "<27>w<0><27>k<2><27>!<1>" + FONT + HEIGHT 240 + WIDTH 12 + ! elite_cond_enlg + COMMAND "<27>w<0><27>k<2><27>!<37>" + FONT + HEIGHT 380 + WIDTH 12 + ! elite_cond_enlg_doub + COMMAND "<27>w<1><27>k<2><27>!<37>" + FONT + HEIGHT 400 + WIDTH 20 + ! elite_enlg_doub + COMMAND "<27>w<1><27>k<2><27>!<33>" + END_FONT +END_TYPEFACE + +TYPEFACE times + NAME "Times" + PROPORTIONAL + SERIF + TYPE TIMES_ROMAN + TRANSLATE translate + FONT + HEIGHT 200 + WIDTH prop + ! times_cond + COMMAND "<27>w<0><27>k<0><27>!<6>" + END_FONT + FONT + HEIGHT 240 + WIDTH_SCALE 2 + WIDTH prop + ! times + COMMAND "<27>w<0><27>k<0><27>!<2>" + END_FONT + FONT + HEIGHT 320 + WIDTH_SCALE 4 + WIDTH prop + ! times_enlg + COMMAND "<27>w<0><27>k<0><27>!<34>" + END_FONT + FONT + HEIGHT 440 + WIDTH_SCALE 2 + WIDTH prop + ! times_doub + COMMAND "<27>w<1><27>k<0><27>!<2>" + END_FONT + FONT + HEIGHT 480 + WIDTH_SCALE 4 + WIDTH prop + ! times_enlg_doub + COMMAND "<27>w<1><27>k<0><27>!<34>" + END_FONT +END_TYPEFACE + +! helvetica="<27>w<0><27>k<2><27>!<2>" +! helvetica_cond="<27>w<0><27>k<2><27>!<6>" +! helvetica_enlg="<27>w<0><27>k<2><27>!<34>" +! helvetica_doub="<27>w<1><27>k<2><27>!<2>" +! helvetica_enlg_doub="<27>w<1><27>k<2><27>!<34>" + +MODEL + NAME "Epson RX" + MIN_X 12 ! 12 TWIPS 1/120 in + MIN_Y 20 ! 20 TWIPS 1/72 in + SKIP_X 15 ! SKIPX 1/8 INCH + SKIP_Y 30 ! SKIPY 1/2 INCH + TYPEFACE pica_rx,elite_rx +END_MODEL + +MODEL + NAME "Epson LQ" + MIN_X 12 ! 12 TWIPS 1/120 in + MIN_Y 24 ! 24 TWIPS 1/60 in + SKIP_X 15 ! SKIPX 1/8 INCH + SKIP_Y 30 ! SKIPY 1/2 INCH + TYPEFACE pica,elite,times +END_MODEL diff --git a/code/SIBOSDK/wd/general.wd b/code/SIBOSDK/wd/general.wd new file mode 100644 index 0000000..dcc5f68 --- /dev/null +++ b/code/SIBOSDK/wd/general.wd @@ -0,0 +1,49 @@ +! GENERAL.WD +! General printer driver file, supports minimal TTY functionality + +COMMANDS + RESET "" + FORM_LENGTH "" + PREAMBLE "" + POSTAMBLE "" + BOLD_ON "" + BOLD_OFF "" + ITALIC_ON "" + ITALIC_OFF "" + UNDERLINE_ON "" + UNDERLINE_OFF "" + SUBSCRIPT_ON "" + SUBSCRIPT_OFF "" + SUPERSCRIPT_ON "" + SUPERSCRIPT_OFF "" + MOVE_DOWN "*<10>" + MOVE_RIGHT_PREFIX "" + MOVE_RIGHT "*<32>" + MOVE_RIGHT_SUFFIX "" + NEW_PAGE "<12>" + CARRIAGE_RETURN "<13>" +END_COMMANDS + +TRANSLATES telephone + 5:35 +END_TRANSLATES + +TYPEFACE courier + NAME "Mono" + TYPE COURIER + TRANSLATE telephone + FONT + HEIGHT 240 + WIDTH 1 + COMMAND "" + END_FONT +END_TYPEFACE + +MODEL + NAME "$" + MIN_X 144 ! 144 twips = 1/10 in, one character + MIN_Y 240 ! 240 twips = 1/6 in, one line + SKIP_X 0 + SKIP_Y 0 + TYPEFACE courier +END_MODEL diff --git a/code/SIBOSDK/wd/hp2.wd b/code/SIBOSDK/wd/hp2.wd new file mode 100644 index 0000000..b863983 --- /dev/null +++ b/code/SIBOSDK/wd/hp2.wd @@ -0,0 +1,166 @@ +! HP2.WD +! Printer driver file for HP II laser printers + +COMMANDS + HP_PCL_COMPATIBLE + RESET "<27>E" + FORM_LENGTH "<27>&l%dP" +!<27>&l +! 0o - Portrait +! 0e - top margin to zero +! 0C - VMI to zero +!<27>9 - clear horizontal margins +!<27>(8U - ASCII Roman-8 symbol set + PREAMBLE "<27>&l0o0e0C<27>9<27>(8U" + POSTAMBLE "<27>E" + BOLD_ON "<27>(s3B" + BOLD_OFF "<27>(s0B" + ITALIC_ON "<27>(s1S" + ITALIC_OFF "<27>(s0S" + UNDERLINE_ON "<27>&dD" + UNDERLINE_OFF "<27>&d@" + SUPERSCRIPT_ON "<27>&a-60V" + SUPERSCRIPT_OFF "<27>&a+60V" + SUBSCRIPT_ON "<27>&a+60V" + SUBSCRIPT_OFF "<27>&a-60V" + NEW_PAGE "<12>" + CARRIAGE_RETURN "<13>" + MOVE_DOWN "<27>&a+%dV" + MOVE_RIGHT_PREFIX "" + MOVE_RIGHT "<27>&a+%dH" + MOVE_RIGHT_SUFFIX "" + LANDSCAPE "<27>&l1o0E<27>9" +END_COMMANDS + +TRANSLATES roman8 + 5:35 + 128:180 + 129:207 + 130:197 + 131:192 + 132:204 + 133:200 + 134:212 + 135:181 + 136:193 + 137:205 + 138:201 + 139:221 + 140:209 + 141:217 + 142:216 + 143:208 + 144:220 + 145:215 + 146:211 + 147:194 + 148:206 + 149:202 + 150:195 + 151:203 + 152:239 + 153:218 + 154:219 + 155:214 + 156:187 + 157:210 + 158:120 + 159:190 + 160:196 + 161:213 + 162:198 + 163:199 + 164:183 + 165:182 + 166:249 + 167:250 + 168:185 + 169:82 + 171:248 + 172:247 + 173:184 + 174:251 + 175:253 + 181:224 + 182:162 + 183:161 + 184:67 + 189:191 + 190:188 + 198:226 + 199:225 + 207:186 + 208:228 + 209:227 + 210:164 + 211:165 + 212:163 + 213:108 + 214:229 + 215:166 + 216:167 + 219:252 + 221:124 + 222:230 + 224:231 + 225:222 + 226:223 + 227:232 + 228:234 + 229:233 + 230:243 + 231:241 + 232:240 + 233:237 + 234:174 + 235:173 + 236:178 + 237:177 + 238:176 + 239:168 + 240:45 + 241:254 + 242:61 + 243:245 + 245:189 + 248:179 + 249:171 + 250:242 + 251:49 + 252:51 + 253:50 + 254:242 +END_TRANSLATES + +TYPEFACE lineprinter + NAME "Lineprinter" + TYPE LINEPRINTER + TRANSLATE roman8 + FONT + HEIGHT 170 + WIDTH 43 + COMMAND "<27>(s0p16.67h8.5v0T" + END_FONT +END_TYPEFACE + +TYPEFACE courier + NAME "Courier" + SERIF + TYPE COURIER + TRANSLATE roman8 + FONT + HEIGHT 240 + WIDTH 72 + COMMAND "<27>(s0p10h12v3T" + END_FONT +END_TYPEFACE + +MODEL + NAME "HP LaserJet series II" + LANDSCAPE_AVAILABLE + MIN_X 2 ! twips + MIN_Y 2 ! twips + SKIP_X 180 + SKIP_Y 0 + TYPEFACE courier,lineprinter +END_MODEL diff --git a/code/SIBOSDK/wd/hp2p.wd b/code/SIBOSDK/wd/hp2p.wd new file mode 100644 index 0000000..6ec762a --- /dev/null +++ b/code/SIBOSDK/wd/hp2p.wd @@ -0,0 +1,75 @@ +! HP2P.WD +! Printer driver file for HP IIP and IID laser printers + +COMMANDS + HP_PCL_COMPATIBLE + RESET "<27>E" + FORM_LENGTH "<27>&l%dP" +!<27>&l +! 0o - Portrait +! 0e - top margin to zero +! 0C - VMI to zero +!<27>9 - clear horizontal margins +!<27>(12U - code page 850 character set + PREAMBLE "<27>&l0o0e0C<27>9<27>(12U" + POSTAMBLE "<27>E" + BOLD_ON "<27>(s3B" + BOLD_OFF "<27>(s0B" + ITALIC_ON "<27>(s1S" + ITALIC_OFF "<27>(s0S" + UNDERLINE_ON "<27>&dD" + UNDERLINE_OFF "<27>&d@" + SUPERSCRIPT_ON "<27>&a-60V" + SUPERSCRIPT_OFF "<27>&a+60V" + SUBSCRIPT_ON "<27>&a+60V" + SUBSCRIPT_OFF "<27>&a-60V" + NEW_PAGE "<12>" + CARRIAGE_RETURN "<13>" + MOVE_DOWN "<27>&a+%dV" + MOVE_RIGHT_PREFIX "" + MOVE_RIGHT "<27>&a+%dH" + MOVE_RIGHT_SUFFIX "" + LANDSCAPE "<27>&l1o0E<27>9" +END_COMMANDS + +TRANSLATES telephone + 5:35 +END_TRANSLATES + +TYPEFACE lineprinter + NAME "Lineprinter" + TYPE LINEPRINTER + TRANSLATE telephone + FONT + HEIGHT 170 + WIDTH 43 + COMMAND "<27>(s0p16.67h8.5v0T" + END_FONT +END_TYPEFACE + +TYPEFACE courier + NAME "Courier" + SERIF + TYPE COURIER + TRANSLATE telephone + FONT + HEIGHT 200 + WIDTH 60 + COMMAND "<27>(s0p12h10v3T" + FONT + HEIGHT 240 + WIDTH 72 + COMMAND "<27>(s0p10h12v3T" + END_FONT +END_TYPEFACE + +MODEL + NAME "HP LaserJet IID" + NAME "HP LaserJet IIP" + LANDSCAPE_AVAILABLE + MIN_X 2 ! twips + MIN_Y 2 ! twips + SKIP_X 180 + SKIP_Y 0 + TYPEFACE courier,lineprinter +END_MODEL diff --git a/code/SIBOSDK/wd/hp3.wd b/code/SIBOSDK/wd/hp3.wd new file mode 100644 index 0000000..7609ead --- /dev/null +++ b/code/SIBOSDK/wd/hp3.wd @@ -0,0 +1,470 @@ +! HP3.WD +! Printer driver file for HP laser printers + +COMMANDS commands + HP_PCL_COMPATIBLE + RESET "<27>E" + FORM_LENGTH "<27>&l%dP" +!<27>&l +! 0o - Portrait +! 0e - top margin to zero +! 0C - VMI to zero +!<27>9 - clear horizontal margins +!<27>(12U - code page 850 character set + PREAMBLE "<27>&l0o0e0C<27>9<27>(12U" + POSTAMBLE "<27>E" + BOLD_ON "<27>(s3B" + BOLD_OFF "<27>(s0B" + ITALIC_ON "<27>(s1S" + ITALIC_OFF "<27>(s0S" + UNDERLINE_ON "<27>&d0D" + UNDERLINE_OFF "<27>&d@" + SUPERSCRIPT_ON "<27>&a-60V" + SUPERSCRIPT_OFF "<27>&a+60V" + SUBSCRIPT_ON "<27>&a+60V" + SUBSCRIPT_OFF "<27>&a-60V" + NEW_PAGE "<12>" + CARRIAGE_RETURN "<13>" + MOVE_DOWN "<27>&a+%dV" + MOVE_RIGHT_PREFIX "" + MOVE_RIGHT "<27>*p+%dX" + MOVE_RIGHT_SUFFIX "" + LANDSCAPE "<27>&l1o0E<27>9" +END_COMMANDS + +TRANSLATES telephone + 5:35 ! must ensure width of 5 = width of 35 +END_TRANSLATES + +WIDTHS cgtimes_std + 0:207 1:207 2:207 3:207 4:207 + 5:104 ! telephone character must be the same as # (35) + 6:207 + 7:69 ! non-breaking hyphen must be the same as hyphen (45) + 8:207 + 9:61 ! tab must be the same as space (32) + 10:207 11:150 12:150 13:104 + 14:69 ! potential hyphen must be the same as hyphen (45) + 15:61 ! non-breaking space must be the same as space (32) + 16:150 + 17:150 18:150 19:108 20:104 21:104 22:207 23:150 24:150 + 25:150 26:150 27:150 28:184 29:150 30:150 31:150 32:61 + 33:69 34:96 35:104 36:104 37:184 38:161 39:69 40:69 + 41:69 42:104 43:184 44:69 45:69 46:69 47:69 48:104 + 49:104 50:104 51:104 52:104 53:104 54:104 55:104 56:104 + 57:104 58:69 59:69 60:207 61:184 62:207 63:92 64:184 +! A B C D E F G H + 65:150 66:131 67:142 68:154 69:131 70:123 71:150 72:154 +! I J K L M N O P + 73:69 74:81 75:146 76:131 77:188 78:154 79:150 80:119 +! Q R S T U V W X + 81:150 82:138 83:111 84:131 85:154 86:150 87:196 88:150 +! Y Z + 89:150 90:134 91:69 92:69 93:69 94:104 95:104 96:104 +! a b c d e f g h + 97:92 98:104 99:92 100:104 101:92 102:69 103:104 104:104 +! i j k l m n o p + 105:58 106:58 107:104 108:58 109:161 110:104 111:104 112:104 +! q r s t u v w x + 113:104 114:77 115:81 116:58 117:104 118:104 119:150 120:104 +! y z + 121:104 122:92 123:92 124:104 125:92 126:104 127:207 128:142 + 129:104 130:92 131:92 132:92 133:92 134:92 135:92 136:92 + 137:92 138:92 139:58 140:58 141:58 142:150 143:150 144:131 + 145:138 146:184 147:104 148:104 149:104 150:104 151:104 152:104 + 153:150 154:154 155:104 156:104 157:154 158:182 159:104 160:92 + 161:58 162:104 163:104 164:104 165:154 166:104 167:104 168:92 + 169:104 170:184 171:184 172:184 173:69 174:85 175:85 176:207 + 177:207 178:207 179:207 180:207 181:150 182:150 183:150 184:105 + 185:207 186:207 187:207 188:207 189:105 190:104 191:207 192:207 + 193:207 194:207 195:207 196:207 197:207 198:92 199:150 200:207 + 201:207 202:207 203:207 204:207 205:207 206:207 207:104 208:104 + 209:154 210:129 211:129 212:129 213:58 214:70 215:70 216:70 + 217:207 218:207 219:207 220:207 221:104 222:70 223:207 224:152 + 225:104 226:152 227:152 228:104 229:152 230:115 231:106 232:122 + 233:154 234:154 235:154 236:104 237:150 238:105 239:104 240:72 + 241:184 242:104 243:183 244:104 245:104 246:184 247:104 248:104 + 249:104 250:1 251:73 252:73 253:73 254:104 255:104 +END_WIDTHS + +WIDTHS cgtimes_italic + 0:207 + 1:207 2:207 3:207 4:207 + 5:104 ! telephone character must be the same as # (35) + 6:207 + 7:69 ! non-breaking hyphen must be the same as hyphen (45) + 8:207 + 9:61 ! tab must be the same as space (32) + 10:207 11:150 12:150 13:104 + 14:69 ! potential hyphen must be the same as hyphen (45) + 15:61 ! non-breaking space must be the same as space (32) + 16:150 + 17:150 18:150 19:103 20:104 21:104 22:207 23:150 24:150 + 25:150 26:150 27:150 28:184 29:150 30:150 31:150 32:61 + 33:69 34:100 35:104 36:104 37:184 38:161 39:69 40:69 + 41:69 42:104 43:184 44:69 45:69 46:69 47:69 48:104 + 49:104 50:104 51:104 52:104 53:104 54:104 55:104 56:104 + 57:104 58:69 59:69 60:207 61:184 62:207 63:104 64:184 + 65:127 66:127 67:138 68:150 69:127 70:119 71:150 72:150 + 73:69 74:92 75:138 76:115 77:170 78:138 79:150 80:127 + 81:150 82:127 83:104 84:115 85:150 86:127 87:170 88:127 + 89:115 90:115 91:69 92:69 93:69 94:104 95:104 96:104 + 97:104 98:104 99:92 100:104 101:92 102:58 103:104 104:104 + 105:58 106:58 107:92 108:58 109:150 110:104 111:104 112:104 + 113:104 114:81 115:81 116:58 117:104 118:92 119:138 120:92 + 121:92 122:81 123:92 124:104 125:92 126:104 127:207 128:138 + 129:104 130:92 131:104 132:104 133:104 134:104 135:92 136:92 + 137:92 138:92 139:58 140:58 141:58 142:127 143:127 144:127 + 145:138 146:184 147:104 148:104 149:104 150:104 151:104 152:92 + 153:150 154:150 155:104 156:104 157:151 158:183 159:104 160:104 + 161:58 162:104 163:104 164:104 165:138 166:104 167:104 168:104 + 169:104 170:184 171:184 172:184 173:69 174:96 175:96 176:207 + 177:207 178:207 179:207 180:207 181:127 182:127 183:127 184:105 + 185:207 186:207 187:207 188:207 189:105 190:105 191:207 192:207 + 193:207 194:207 195:207 196:207 197:207 198:104 199:127 200:207 + 201:207 202:207 203:207 204:207 205:207 206:207 207:104 208:104 + 209:148 210:127 211:127 212:127 213:58 214:70 215:70 216:70 + 217:207 218:207 219:207 220:207 221:104 222:70 223:207 224:152 + 225:104 226:152 227:152 228:104 229:152 230:115 231:106 232:126 + 233:150 234:150 235:150 236:92 237:115 238:105 239:104 240:72 + 241:184 242:104 243:182 244:104 245:104 246:184 247:104 248:104 + 249:104 250:2 251:73 252:73 253:73 254:104 255:104 +END_WIDTHS + +WIDTHS cgtimes_bold + 0:207 + 1:207 2:207 3:207 4:207 + 5:104 ! telephone character must be the same as # (35) + 6:207 + 7:69 ! non-breaking hyphen must be the same as hyphen (45) + 8:207 + 9:61 ! tab must be the same as space (32) + 10:207 11:150 12:150 13:104 + 14:69 ! potential hyphen must be the same as hyphen (45) + 15:61 ! non-breaking space must be the same as space (32) + 16:150 + 17:150 18:150 19:119 20:104 21:104 22:207 23:150 24:150 + 25:150 26:150 27:150 28:184 29:150 30:150 31:150 32:61 + 33:69 34:96 35:104 36:104 37:184 38:169 39:69 40:69 + 41:69 42:104 43:184 44:69 45:69 46:69 47:69 48:104 + 49:104 50:104 51:104 52:104 53:104 54:104 55:104 56:104 + 57:104 58:69 59:69 60:207 61:184 62:207 63:104 64:184 + 65:150 66:138 67:150 68:150 69:138 70:127 71:161 72:161 + 73:81 74:100 75:161 76:138 77:196 78:150 79:161 80:127 + 81:161 82:150 83:115 84:138 85:150 86:150 87:207 88:150 + 89:150 90:138 91:69 92:69 93:69 94:104 95:104 96:104 + 97:104 98:115 99:92 100:115 101:92 102:73 103:104 104:115 + 105:58 106:69 107:115 108:58 109:171 110:115 111:104 112:115 + 113:115 114:92 115:81 116:69 117:115 118:104 119:150 120:104 + 121:104 122:92 123:104 124:104 125:104 126:104 127:207 128:150 + 129:115 130:92 131:104 132:104 133:104 134:104 135:92 136:92 + 137:92 138:92 139:58 140:58 141:58 142:150 143:150 144:138 + 145:150 146:215 147:104 148:104 149:104 150:115 151:115 152:104 + 153:161 154:150 155:104 156:104 157:163 158:182 159:104 160:104 + 161:58 162:104 163:115 164:115 165:150 166:104 167:104 168:104 + 169:104 170:184 171:184 172:184 173:69 174:88 175:88 176:207 + 177:207 178:207 179:207 180:207 181:150 182:150 183:150 184:105 + 185:207 186:207 187:207 188:207 189:105 190:104 191:207 192:207 + 193:207 194:207 195:207 196:207 197:207 198:104 199:150 200:207 + 201:207 202:207 203:207 204:207 205:207 206:207 207:104 208:104 + 209:148 210:137 211:137 212:137 213:58 214:80 215:80 216:80 + 217:207 218:207 219:207 220:207 221:104 222:80 223:207 224:162 + 225:115 226:162 227:162 228:104 229:162 230:115 231:116 232:126 + 233:150 234:150 235:150 236:104 237:150 238:105 239:104 240:72 + 241:184 242:104 243:183 244:104 245:104 246:184 247:104 248:104 + 249:104 250:23 251:73 252:73 253:73 254:104 255:104 +END_WIDTHS + +WIDTHS cgtimes_bold_italic + 0:207 + 1:207 2:207 3:207 4:207 + 5:104 ! telephone character must be the same as # (35) + 6:207 + 7:69 ! non-breaking hyphen must be the same as hyphen (45) + 8:207 + 9:61 ! tab must be the same as space (32) + 10:207 11:150 12:150 13:104 + 14:69 ! potential hyphen must be the same as hyphen (45) + 15:61 ! non-breaking space must be the same as space (32) + 16:150 + 17:150 18:150 19:131 20:104 21:104 22:207 23:150 24:150 + 25:150 26:150 27:150 28:184 29:150 30:150 31:150 32:61 + 33:81 34:108 35:104 36:104 37:184 38:161 39:69 40:69 + 41:69 42:104 43:184 44:69 45:69 46:69 47:69 48:104 + 49:104 50:104 51:104 52:104 53:104 54:104 55:104 56:104 + 57:104 58:69 59:69 60:207 61:184 62:207 63:104 64:184 + 65:138 66:138 67:138 68:150 69:138 70:127 71:150 72:161 + 73:81 74:104 75:138 76:127 77:184 78:150 79:150 80:127 + 81:146 82:138 83:115 84:127 85:150 86:138 87:184 88:138 + 89:127 90:127 91:69 92:69 93:69 94:104 95:104 96:104 + 97:104 98:104 99:92 100:104 101:92 102:73 103:104 104:115 + 105:58 106:58 107:104 108:58 109:161 110:115 111:104 112:104 + 113:104 114:81 115:81 116:58 117:115 118:92 119:138 120:104 + 121:92 122:81 123:104 124:104 125:104 126:104 127:207 128:138 + 129:115 130:92 131:104 132:104 133:104 134:104 135:92 136:92 + 137:92 138:92 139:58 140:58 141:58 142:138 143:138 144:138 + 145:146 146:192 147:104 148:104 149:104 150:115 151:115 152:92 + 153:150 154:150 155:104 156:104 157:151 158:184 159:104 160:104 + 161:58 162:104 163:115 164:115 165:150 166:104 167:104 168:104 + 169:104 170:184 171:184 172:184 173:81 174:92 175:92 176:207 + 177:207 178:207 179:207 180:207 181:138 182:138 183:138 184:105 + 185:207 186:207 187:207 188:207 189:105 190:105 191:207 192:207 + 193:207 194:207 195:207 196:207 197:207 198:104 199:138 200:207 + 201:207 202:207 203:207 204:207 205:207 206:207 207:104 208:104 + 209:148 210:137 211:137 212:137 213:58 214:80 215:80 216:80 + 217:207 218:207 219:207 220:207 221:104 222:80 223:207 224:152 + 225:104 226:152 227:152 228:104 229:152 230:115 231:106 232:126 + 233:150 234:150 235:150 236:90 237:127 238:105 239:104 240:72 + 241:184 242:104 243:183 244:104 245:104 246:184 247:104 248:104 + 249:104 250:18 251:69 252:69 253:69 254:104 255:104 +END_WIDTHS + +WIDTHS univers_std + 0:207 1:207 2:207 3:207 4:207 + 5:131 ! telephone character must be the same as # (35) + 6:207 + 7:69 ! non-breaking hyphen must be the same as hyphen (45) + 8:207 + 9:69 ! tab must be the same as space (32) + 10:207 11:150 12:150 13:104 + 14:69 ! potential hyphen must be the same as hyphen (45) + 15:69 ! non-breaking space must be the same as space (32) + 16:150 + 17:150 18:150 19:110 20:131 21:131 22:207 23:150 24:150 + 25:150 26:150 27:150 28:207 29:150 30:150 31:150 32:69 + 33:69 34:104 35:131 36:131 37:207 38:158 39:69 40:69 + 41:69 42:131 43:207 44:69 45:69 46:69 47:69 48:131 + 49:131 50:131 51:131 52:131 53:131 54:131 55:131 56:131 + 57:131 58:69 59:69 60:207 61:207 62:207 63:108 64:207 + 65:154 66:131 67:146 68:150 69:119 70:115 71:154 72:150 + 73:58 74:115 75:138 76:111 77:188 78:150 79:158 80:123 + 81:161 82:134 83:134 84:131 85:150 86:150 87:207 88:150 + 89:142 90:127 91:69 92:69 93:69 94:131 95:104 96:131 + 97:111 98:119 99:111 100:119 101:111 102:77 103:119 104:119 + 105:50 106:50 107:111 108:50 109:181 110:119 111:119 112:119 + 113:119 114:73 115:104 116:77 117:119 118:115 119:181 120:115 + 121:115 122:100 123:92 124:104 125:92 126:131 127:207 128:146 + 129:119 130:111 131:111 132:111 133:111 134:111 135:111 136:111 + 137:111 138:111 139:50 140:50 141:50 142:154 143:154 144:119 + 145:177 146:204 147:119 148:119 149:119 150:119 151:119 152:115 + 153:158 154:150 155:122 156:131 157:160 158:207 159:131 160:111 + 161:50 162:119 163:119 164:119 165:150 166:85 167:85 168:108 + 169:104 170:207 171:207 172:207 173:69 174:115 175:115 176:207 + 177:207 178:207 179:207 180:207 181:154 182:154 183:154 184:105 + 185:207 186:207 187:207 188:207 189:129 190:129 191:207 192:207 + 193:207 194:207 195:207 196:207 197:207 198:114 199:154 200:207 + 201:207 202:207 203:207 204:207 205:207 206:207 207:128 208:121 + 209:150 210:119 211:119 212:119 213:51 214:58 215:58 216:58 + 217:207 218:207 219:207 220:207 221:105 222:58 223:207 224:158 + 225:127 226:158 227:158 228:119 229:158 230:115 231:119 232:126 + 233:150 234:150 235:150 236:118 237:141 238:129 239:129 240:72 + 241:207 242:106 243:207 244:130 245:130 246:207 247:129 248:131 + 249:129 250:25 251:81 252:81 253:81 254:104 255:104 +END_WIDTHS + +WIDTHS univers_italic + 0:207 + 1:207 2:207 3:207 4:207 + 5:131 ! telephone character must be the same as # (35) + 6:207 + 7:69 ! non-breaking hyphen must be the same as hyphen (45) + 8:207 + 9:69 ! tab must be the same as space (32) + 10:207 11:150 12:150 13:104 + 14:69 ! potential hyphen must be the same as hyphen (45) + 15:69 ! non-breaking space must be the same as space (32) + 16:150 + 17:150 18:150 19:114 20:131 21:131 22:207 23:150 24:150 + 25:150 26:150 27:150 28:207 29:150 30:150 31:150 32:69 + 33:69 34:104 35:131 36:131 37:207 38:158 39:69 40:69 + 41:69 42:131 43:207 44:69 45:69 46:69 47:69 48:131 + 49:131 50:131 51:131 52:131 53:131 54:131 55:131 56:131 + 57:131 58:69 59:69 60:207 61:207 62:207 63:108 64:207 + 65:154 66:131 67:146 68:150 69:119 70:115 71:154 72:150 + 73:58 74:115 75:138 76:111 77:188 78:150 79:158 80:123 + 81:161 82:134 83:134 84:131 85:150 86:150 87:207 88:150 + 89:142 90:127 91:69 92:69 93:69 94:131 95:104 96:131 + 97:111 98:119 99:111 100:119 101:111 102:77 103:119 104:119 + 105:50 106:50 107:111 108:50 109:181 110:119 111:119 112:119 + 113:119 114:73 115:104 116:77 117:119 118:115 119:181 120:115 + 121:115 122:100 123:92 124:104 125:92 126:131 127:207 128:146 + 129:119 130:111 131:111 132:111 133:111 134:111 135:111 136:111 + 137:111 138:111 139:50 140:50 141:50 142:154 143:154 144:119 + 145:177 146:204 147:119 148:119 149:119 150:119 151:119 152:115 + 153:158 154:150 155:122 156:131 157:160 158:207 159:131 160:111 + 161:50 162:119 163:119 164:119 165:150 166:85 167:85 168:108 + 169:104 170:207 171:207 172:207 173:69 174:115 175:115 176:207 + 177:207 178:207 179:207 180:207 181:154 182:154 183:154 184:105 + 185:207 186:207 187:207 188:207 189:129 190:129 191:207 192:207 + 193:207 194:207 195:207 196:207 197:207 198:111 199:154 200:207 + 201:207 202:207 203:207 204:207 205:207 206:207 207:128 208:121 + 209:150 210:119 211:119 212:119 213:51 214:58 215:58 216:58 + 217:207 218:207 219:207 220:207 221:105 222:58 223:207 224:158 + 225:127 226:158 227:158 228:119 229:158 230:115 231:119 232:126 + 233:150 234:150 235:150 236:115 237:142 238:129 239:129 240:72 + 241:207 242:106 243:207 244:130 245:130 246:207 247:129 248:131 + 249:129 250:16 251:81 252:81 253:81 254:104 255:104 +END_WIDTHS + +WIDTHS univers_bold + 0:207 + 1:207 2:207 3:207 4:207 + 5:131 ! telephone character must be the same as # (35) + 6:207 + 7:69 ! non-breaking hyphen must be the same as hyphen (45) + 8:207 + 9:69 ! tab must be the same as space (32) + 10:207 11:150 12:150 13:104 + 14:69 ! potential hyphen must be the same as hyphen (45) + 15:69 ! non-breaking space must be the same as space (32) + 16:150 + 17:150 18:150 19:115 20:131 21:131 22:207 23:150 24:150 + 25:150 26:150 27:150 28:207 29:150 30:150 31:150 32:69 + 33:69 34:108 35:131 36:131 37:207 38:158 39:69 40:69 + 41:69 42:131 43:207 44:69 45:69 46:69 47:69 48:131 + 49:131 50:131 51:131 52:131 53:131 54:131 55:131 56:131 + 57:131 58:69 59:69 60:207 61:207 62:207 63:108 64:207 + 65:154 66:131 67:146 68:150 69:119 70:115 71:154 72:150 + 73:58 74:115 75:138 76:111 77:188 78:150 79:158 80:123 + 81:161 82:134 83:134 84:131 85:150 86:150 87:207 88:150 + 89:142 90:127 91:69 92:69 93:69 94:131 95:104 96:131 + 97:111 98:119 99:111 100:119 101:111 102:77 103:119 104:119 + 105:50 106:50 107:111 108:50 109:181 110:119 111:119 112:119 + 113:119 114:73 115:104 116:77 117:119 118:115 119:181 120:115 + 121:115 122:100 123:104 124:104 125:104 126:131 127:207 128:146 + 129:119 130:111 131:111 132:111 133:111 134:111 135:111 136:111 + 137:111 138:111 139:50 140:50 141:50 142:154 143:154 144:119 + 145:177 146:204 147:119 148:119 149:119 150:119 151:119 152:115 + 153:158 154:150 155:122 156:131 157:160 158:207 159:131 160:111 + 161:50 162:119 163:119 164:119 165:150 166:85 167:85 168:108 + 169:104 170:207 171:207 172:207 173:69 174:115 175:115 176:207 + 177:207 178:207 179:207 180:207 181:154 182:154 183:154 184:105 + 185:207 186:207 187:207 188:207 189:129 190:129 191:207 192:207 + 193:207 194:207 195:207 196:207 197:207 198:111 199:154 200:207 + 201:207 202:207 203:207 204:207 205:207 206:207 207:128 208:121 + 209:150 210:119 211:119 212:119 213:51 214:58 215:58 216:58 + 217:207 218:207 219:207 220:207 221:105 222:58 223:207 224:158 + 225:127 226:158 227:158 228:119 229:158 230:123 231:119 232:126 + 233:150 234:150 235:150 236:115 237:142 238:129 239:129 240:72 + 241:207 242:106 243:207 244:130 245:130 246:207 247:129 248:131 + 249:129 250:33 251:81 252:81 253:81 254:104 255:104 +END_WIDTHS + +WIDTHS univers_bold_italic + 0:207 + 1:207 2:207 3:207 4:207 + 5:131 ! telephone character must be the same as # (35) + 6:207 + 7:69 ! non-breaking hyphen must be the same as hyphen (45) + 8:207 + 9:69 ! tab must be the same as space (32) + 10:207 11:150 12:150 13:104 + 14:69 ! potential hyphen must be the same as hyphen (45) + 15:69 ! non-breaking space must be the same as space (32) + 16:150 + 17:150 18:150 19:125 20:131 21:131 22:207 23:150 24:150 + 25:150 26:150 27:150 28:207 29:150 30:150 31:150 32:69 + 33:69 34:111 35:131 36:131 37:207 38:158 39:69 40:69 + 41:69 42:131 43:207 44:69 45:69 46:69 47:69 48:131 + 49:131 50:131 51:131 52:131 53:131 54:131 55:131 56:131 + 57:131 58:69 59:69 60:207 61:207 62:207 63:108 64:207 + 65:154 66:131 67:146 68:150 69:119 70:115 71:154 72:150 + 73:58 74:115 75:138 76:111 77:188 78:150 79:158 80:123 + 81:161 82:134 83:134 84:131 85:150 86:150 87:207 88:150 + 89:142 90:127 91:69 92:69 93:69 94:131 95:104 96:131 + 97:111 98:119 99:111 100:119 101:111 102:77 103:119 104:119 + 105:50 106:50 107:111 108:50 109:181 110:119 111:119 112:119 + 113:119 114:73 115:104 116:77 117:119 118:115 119:181 120:115 + 121:115 122:100 123:104 124:104 125:104 126:131 127:207 128:146 + 129:119 130:111 131:111 132:111 133:111 134:111 135:111 136:111 + 137:111 138:111 139:50 140:50 141:50 142:154 143:154 144:119 + 145:177 146:204 147:119 148:119 149:119 150:119 151:119 152:115 + 153:158 154:150 155:122 156:131 157:160 158:207 159:131 160:111 + 161:50 162:119 163:119 164:119 165:150 166:85 167:85 168:108 + 169:104 170:207 171:207 172:207 173:69 174:115 175:115 176:207 + 177:207 178:207 179:207 180:207 181:154 182:154 183:154 184:105 + 185:207 186:207 187:207 188:207 189:129 190:129 191:207 192:207 + 193:207 194:207 195:207 196:207 197:207 198:111 199:154 200:207 + 201:207 202:207 203:207 204:207 205:207 206:207 207:128 208:121 + 209:150 210:119 211:119 212:119 213:51 214:58 215:58 216:58 + 217:207 218:207 219:207 220:207 221:105 222:58 223:207 224:158 + 225:127 226:158 227:158 228:119 229:158 230:123 231:119 232:126 + 233:150 234:150 235:150 236:115 237:142 238:129 239:129 240:72 + 241:207 242:106 243:207 244:130 245:130 246:207 247:129 248:131 + 249:129 250:37 251:81 252:81 253:81 254:104 255:104 +END_WIDTHS + +TYPEFACE courier + NAME "Courier" + TYPE COURIER + SERIF + TRANSLATE telephone + FONT + HEIGHT 200 + WIDTH 25 + COMMAND "<27>(s0p12h10v3T" + FONT + HEIGHT 240 + WIDTH 30 + COMMAND "<27>(s0p10h12v3T" + END_FONT +END_TYPEFACE + +TYPEFACE lineprinter + NAME "Lineprinter" + TYPE LINEPRINTER + TRANSLATE telephone + FONT + HEIGHT 170 + WIDTH 18 + COMMAND "<27>(s0p16.67h8.5v0T" + END_FONT +END_TYPEFACE + +TYPEFACE cgtimes + NAME "CG Times" + PROPORTIONAL + SCALED + SERIF + TYPE TIMES_ROMAN + TRANSLATE telephone + FONT + HEIGHT 80 ! min font height 80 twips = 4 point + HEIGHT_MAX 1200 ! max font height 1200 twips ( = 60 point) + HEIGHT_DELTA 20 ! delta font height 20 twips = 1 point + WIDTH cgtimes_std + WIDTH_BOLD cgtimes_bold + WIDTH_ITALIC cgtimes_italic + WIDTH_BOLD_ITALIC cgtimes_bold_italic + COMMAND "<27>(s1p%dv4101T" + END_FONT +END_TYPEFACE + +TYPEFACE univers + NAME "Univers" + PROPORTIONAL + SCALED + TYPE HELVETICA + TRANSLATE telephone + FONT + HEIGHT 80 ! min font height 80 twips = 4 point + HEIGHT_MAX 1200 ! max font height 1200 twips ( = 60 point) + HEIGHT_DELTA 20 ! delta font height 20 twips = 1 point + WIDTH univers_std + WIDTH_BOLD univers_bold + WIDTH_ITALIC univers_italic + WIDTH_BOLD_ITALIC univers_bold_italic + COMMAND "<27>(s1p%dv4148T" + END_FONT +END_TYPEFACE + +MODEL + NAME "HP LaserJet III" + LANDSCAPE_AVAILABLE + MIN_X_IS_DOTS_PER_INCH + MIN_X 300 ! minx = 1/300 inch + MIN_Y 2 ! twips + SKIP_X 75 + SKIP_Y 0 + TYPEFACE courier,lineprinter,cgtimes,univers +END_MODEL diff --git a/code/SIBOSDK/wdrprint/decomman.c b/code/SIBOSDK/wdrprint/decomman.c new file mode 100644 index 0000000..3b699ce --- /dev/null +++ b/code/SIBOSDK/wdrprint/decomman.c @@ -0,0 +1,139 @@ +/* DECOMMAN.C */ + +#include +#include +#include +#include + +GLREF_D PR_WSERV *w_ws; +GLREF_D PR_DECOMMAN *DatApp2; + +#define SAVED_FILE_NAME "LOC::M:\\WDRPRINT.CFG" + +LOCAL_C VOID TryLoadPrintContext(VOID) + { + P_INFO junk; + VOID *fcb; + VOID *printer; + UBYTE buf[512]; + INT blen; + INT ind; + UBYTE *p1,*p2,*p3,*p4; + + if (p_finfo(SAVED_FILE_NAME,&junk)) + return; /* eg file does not exist */ + f_open(&fcb,SAVED_FILE_NAME,P_FOPEN|P_FSTREAM|P_FSHARE); + blen=f_read(fcb,&buf[0],512); + p_close(fcb); + if (blen<=sizeof(PRINTER_PARAMS)+2) + goto file_corrupt; + p1=(&buf[0]); + blen-=sizeof(PRINTER_PARAMS); + p2=p1+sizeof(PRINTER_PARAMS); + ind=p_bloc(p2+1,blen-1,0); + if (ind<0) + goto file_corrupt; + p3=p2+1+ind+1; + blen-=1+ind+1; + if (blen<=0) + goto file_corrupt; + ind=p_bloc(p3,blen,0); + if (ind<0) + goto file_corrupt; + p4=p3+ind+1; + blen-=ind+1; + if (blen<=0) + goto file_corrupt; + ind=p_bloc(p4,blen,0); + if (ind!=blen-1) + { + file_corrupt: + hInfoPrint(DELETING_CORRUPT_FILE); + p_delete(SAVED_FILE_NAME); + return; + } + p_send2(w_ws,O_WS_ENS_PRINT_CONTEXT); + printer=w_ws->wserv.printer; + p_bcpy((VOID *)p_send2(printer,O_PR_GET_PARAMS),p1,sizeof(PRINTER_PARAMS)); + p_send5(printer,O_PR_SET_MODEL,FALSE,p2+1,*p2); + p_send4(printer,O_PR_SET_HD,PRINTER_HDR_TOP,p3); + p_send4(printer,O_PR_SET_HD,PRINTER_HDR_BOT,p4); + } + +#pragma save,ENTER_CALL + +LOCAL_C INT SavePrintContext(VOID) + { + VOID *fcb; + VOID *printer; + TEXT *p; + struct + { + UBYTE model; + TEXT name[P_FNAMESIZE+1]; + } m; + + printer=w_ws->wserv.printer; + if (!printer) + return(0); + f_open(&fcb,SAVED_FILE_NAME,P_FREPLACE|P_FSTREAM|P_FUPDATE); + p=(TEXT *)p_send2(printer,O_PR_GET_PARAMS); + f_write(fcb,p,sizeof(PRINTER_PARAMS)); + m.model=p_send3(printer,O_PR_SENSE_MODEL,&m.name[0]); + f_write(fcb,&m.model,1+p_slen(&m.name[0])+1); + p=(TEXT *)p_send3(printer,O_PR_GET_HD,PRINTER_HDR_TOP); + f_write(fcb,p,p_slen(p)+1); + p=(TEXT *)p_send3(printer,O_PR_GET_HD,PRINTER_HDR_BOT); + f_write(fcb,p,p_slen(p)+1); + p_close(fcb); + return(0); + } + +#pragma restore + +LOCAL_C INT LaunchDialog(INT class,INT resid,VOID *rbuf) + { + DL_DATA dld; + + dld.id=resid; + dld.rbuf=rbuf; + dld.pdlg=NULL; + return hLaunchDial(CAT_DEMO_DEMO,class,&dld); + } + +LOCAL_C VOID PrintOrPreview(INT commid) + { + commid=(commid==O_DEC_PREVIEW? O_DEC_PRINT_DIRECT: 0); + hDestroy(f_newsend(CAT_DEMO_DEMO,C_DELP,O_LPR_INIT,commid)); + } + +#pragma METHOD_CALL + +METHOD VOID decomman_com_init(PR_DECOMMAN *self) + { + DatApp2=self; + TryLoadPrintContext(); + } + +METHOD VOID decomman_com_exit(PR_DECOMMAN *self) + { + if (p_enter1(SavePrintContext)) + p_delete(SAVED_FILE_NAME); + p_exit(0); + } + +METHOD VOID decomman_dec_psetup(VOID) + { + p_send2(w_ws,O_WS_EDIT_PRINT_CONTEXT); + } + +METHOD VOID decomman_dec_preview(PR_DECOMMAN *self,INT commid) + { + if (LaunchDialog(C_DEDLG,DELP_DLG,&commid)) + PrintOrPreview(commid); + } + +METHOD VOID decomman_dec_print_direct(VOID) + { + PrintOrPreview(O_DEC_PRINT); + } diff --git a/code/SIBOSDK/wdrprint/dedlg.c b/code/SIBOSDK/wdrprint/dedlg.c new file mode 100644 index 0000000..6125139 --- /dev/null +++ b/code/SIBOSDK/wdrprint/dedlg.c @@ -0,0 +1,31 @@ +/* DEDLG.C */ + +#include +#include +#include + +GLREF_D PR_DECOMMAN *DatApp2; + +#pragma METHOD_CALL + +METHOD VOID dedlg_dl_dyn_init(PR_DLGBOX *self) + { + INT commid; + + commid=(*(INT *)self->dlgbox.rbuf); + if (commid==O_DEC_PREVIEW) + hDlgSetTitleByRid(DELP_PREVIEW_TITLE); + if (!DatApp2->decomman.dets.dayno) + return; + hDlgSetDtedit(1,DatApp2->decomman.dets.dayno); + hDlgSetNcedit(2,DatApp2->decomman.dets.ndays); + hDlgSetChlist(3,DatApp2->decomman.dets.gap); + } + +METHOD INT dedlg_dl_key(PR_DLGBOX *self) + { + DatApp2->decomman.dets.dayno=hDlgSenseDtedit(1); + DatApp2->decomman.dets.ndays=hDlgSenseNcedit(2); + DatApp2->decomman.dets.gap=hDlgSenseChlist(3); + return(WN_KEY_CHANGED); + } diff --git a/code/SIBOSDK/wdrprint/delp.c b/code/SIBOSDK/wdrprint/delp.c new file mode 100644 index 0000000..58bfc19 --- /dev/null +++ b/code/SIBOSDK/wdrprint/delp.c @@ -0,0 +1,111 @@ +/* DELP.C */ + +#include +#include +#include + +GLREF_D PR_DECOMMAN *DatApp2; + +#define TIME_FMT_FLAGS (PR_TIME_MONTH_NAME|PR_TIME_SUFFIX_NAME) + +LOCAL_C VOID InitTimeObject(PR_DELP *self) + { + P_DAYSEC ds; + SE_TIME_FORMAT fmt; + + ds.day=DatApp2->decomman.dets.dayno; + ds.sec=0; + self->delp.time=f_new(CAT_DEMO_OLIB,C_TIME); + p_send4(self->delp.time,O_TO_SET,SET_TIME_DAYSEC,&ds); + fmt.flags=TIME_FMT_FLAGS; + p_send4(self->delp.time,O_TO_SET_FORMAT,&fmt,TIME_FMT_FLAGS); + } + +LOCAL_C UINT SenseBufWidth(PR_DELP *self,TEXT *pb) + { + return(p_send5(self->lprinter.wdr,O_WDR_SENSE_WIDTH, + self->delp.wtab,pb,p_slen(pb))); + } + +LOCAL_C VOID FindWidthFirstColumn(PR_DELP *self) + { + INT i; + TEXT buf[E_MAX_DAY_NAME]; + UWORD wid; + + for (i=0; i<7; i++) + { + p_nmday(&buf[0],i); + wid=SenseBufWidth(self,&buf[0]); + if (wid>self->delp.colwid) + self->delp.colwid=wid; + } + self->delp.colwid+=SenseBufWidth(self," "); /* two spaces */ + if (self->delp.colwid>(3*self->lprinter.width/4)) + { + hInfoPrint(DELP_PAPER_NARROW); + p_leave(RUN_ACTIVE_CLEANUP_NONOTIFY); + } + self->lprinter.subsqind=self->delp.colwid; + } + +LOCAL_C VOID InitWidthTable(PR_DELP *self) + { + self->delp.wtab=(VOID *)p_send5(self->lprinter.wdr,O_WDR_GET_WIDTH_TABLE, + self->lprinter.f.fid,self->lprinter.f.height, + self->lprinter.f.style|WDR_STYLE_BOLD); + } + +#pragma METHOD_CALL + +METHOD INT delp_lpr_sense_text(PR_DELP *self,WDR_PRINT *pr) + { + P_DATE dt; + P_DAYSEC ds; + + if (!self->delp.time) + { + self->delp.ndays=DatApp2->decomman.dets.ndays; + InitTimeObject(self); + InitWidthTable(self); + FindWidthFirstColumn(self); + } + else if (!self->delp.ndays) + return(FALSE); + switch (self->delp.state++) + { + case DELP_STATE_COL1: + if (DatApp2->decomman.dets.gap) + { + p_send4(self->delp.time,O_TO_SENSE,SENSE_TIME_DATE,&dt); + if (!dt.day) + { + pr->down=pr->height; + if (DatApp2->decomman.dets.gap==1) + pr->down>>=1; + } + } + p_send4(self->delp.time,O_TO_SENSE,SENSE_TIME_DAYSEC,&ds); + p_nmday(&self->delp.dname[0],P_WEEK(ds.day)); + self->delp.right=self->delp.colwid + -SenseBufWidth(self,&self->delp.dname[0]); + pr->buf=(&self->delp.dname[0]); + pr->style|=WDR_STYLE_BOLD; + break; + case DELP_STATE_COL2: + pr->flags&=(~(WDR_PRINT_LINE|WDR_PRINT_TEXT)); + pr->flags|=WDR_PRINT_RIGHT; + pr->right=self->delp.right; + return(TRUE); + case DELP_STATE_COL3: + p_send4(self->delp.time,O_TO_SENSE,SENSE_TIME_DATESTR,&self->delp.buf[0]); + pr->buf=(&self->delp.buf[0]); + pr->flags&=(~WDR_PRINT_LINE); + pr->indent=self->delp.colwid; + self->delp.ndays--; + p_send4(self->delp.time,O_TO_ADD_DAYS,1,0); + self->delp.state=DELP_STATE_COL1; + } + pr->blen=p_slen(pr->buf); + return(TRUE); + } diff --git a/code/SIBOSDK/wdrprint/demain.c b/code/SIBOSDK/wdrprint/demain.c new file mode 100644 index 0000000..d85a73d --- /dev/null +++ b/code/SIBOSDK/wdrprint/demain.c @@ -0,0 +1,17 @@ +/* DEMAIN.C */ + +#include + +GLDEF_C VOID main(VOID) + { + IN_HWIMMAN app; + IN_WSERV wserv; + + p_linklib(0); + app.flags=FLG_APPMAN_RSCFILE|FLG_APPMAN_SRSCFILE| + FLG_APPMAN_CLEAN|FLG_APPMAN_FULLSCREEN; + wserv.com_cat=app.wserv_cat=p_getlibh(CAT_DEMO_DEMO); + app.wserv_class=C_DEWSERV; + wserv.com_class=C_DECOMMAN; + p_send4(p_new(CAT_DEMO_HWIM,C_HWIMMAN),O_AM_INIT,&app,&wserv); + } diff --git a/code/SIBOSDK/wdrprint/demo.cat b/code/SIBOSDK/wdrprint/demo.cat new file mode 100644 index 0000000..9a524a6 --- /dev/null +++ b/code/SIBOSDK/wdrprint/demo.cat @@ -0,0 +1,67 @@ +IMAGE demo + +EXTERNAL olib +EXTERNAL hwim +EXTERNAL xadd + +INCLUDE hwimman.g +INCLUDE dlgbox.g +INCLUDE xprinter.g +INCLUDE time.g +INCLUDE epoc.h + +CLASS dewserv wserv + { + REPLACE ws_dyn_init + } + +CLASS decomman comman + { + REPLACE com_init + REPLACE com_exit + ADD dec_psetup + ADD dec_preview + ADD dec_print=decomman_dec_preview + ADD dec_print_direct + TYPES + { + typedef struct + { + UWORD dayno; + UWORD ndays; + UWORD gap; + } DE_PRINT_DETAILS; + } + PROPERTY + { + DE_PRINT_DETAILS dets; + } + } + +CLASS dedlg dlgbox + { + REPLACE dl_dyn_init + REPLACE dl_key + } + +CLASS delp xprinter + { + REPLACE lpr_sense_text + CONSTANTS + { + DELP_STATE_COL1 0 + DELP_STATE_COL2 1 + DELP_STATE_COL3 2 + } + PROPERTY 1 + { + VOID *time; + VOID *wtab; + UWORD colwid; + UWORD right; + UWORD state; + UWORD ndays; + TEXT dname[E_MAX_DAY_NAME]; + TEXT buf[LN_TIME_DATE_STR]; + } + } diff --git a/code/SIBOSDK/wdrprint/demo.pic b/code/SIBOSDK/wdrprint/demo.pic new file mode 100644 index 0000000..d980c34 Binary files /dev/null and b/code/SIBOSDK/wdrprint/demo.pic differ diff --git a/code/SIBOSDK/wdrprint/demo.re b/code/SIBOSDK/wdrprint/demo.re new file mode 100644 index 0000000..c6ea162 --- /dev/null +++ b/code/SIBOSDK/wdrprint/demo.re @@ -0,0 +1,6 @@ +#include + +_O_COM_EXIT +_O_DEC_PSETUP +_O_DEC_PREVIEW +_O_DEC_PRINT diff --git a/code/SIBOSDK/wdrprint/demo.rss b/code/SIBOSDK/wdrprint/demo.rss new file mode 100644 index 0000000..c89f52f --- /dev/null +++ b/code/SIBOSDK/wdrprint/demo.rss @@ -0,0 +1,98 @@ +/* DEMO.RSS */ + +#include +#include +#include + +RESOURCE WSERV_INFO demo_accs + { + menbar_id=demo_menubar; + first_com=O_COM_EXIT; + accel={'x', + 'y','*','p'}; + } + +RESOURCE MENU_BAR demo_menubar + { + items = + { + MENU_BAR_ITEM + { + menu_id=special_menu; + mb_item="Demo"; + } + }; + } + +RESOURCE MENU special_menu + { + items = + { + MENU_ITEM + { + com_id=O_DEC_PSETUP; + mn_item="Print setup"; + }, + MENU_ITEM + { + com_id=O_DEC_PREVIEW; + mn_item="Preview"; + }, + MENU_ITEM + { + com_id=O_DEC_PRINT|BREAK_LINE_FOLLOWS; + mn_item="Print"; + }, + MENU_ITEM + { + com_id=O_COM_EXIT; + mn_item="Exit"; + } + }; + } + +RESOURCE MENU delp_gap_chlist + { + items = + { + CHOICE_ITEM { str="No gap";}, + CHOICE_ITEM { str="Half a line";}, + CHOICE_ITEM { str="Complete line";} + }; + } + +RESOURCE DIALOG delp_dlg + { + title="Print list of days"; + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_RBUF_FILLED; + controls= + { + CONTROL + { + class=C_DTEDIT; + prompt="Start date"; + info=DTEDIT { flags=IN_DTEDIT_DDMMYYYY;}; + }, + CONTROL + { + class=C_NCEDIT; + prompt="Number of days to print"; + info=NCEDIT + { + low=10; + current=20; + high=200; + }; + }, + CONTROL + { + class=C_CHLIST; + prompt="Space between months"; + info=CHLIST { rid=delp_gap_chlist; }; + } + }; + } + +RESOURCE STRING delp_paper_narrow { str="Paper size too narrow"; } +RESOURCE STRING delp_preview_title { str="Preview list of days"; } +RESOURCE STRING deleting_corrupt_file { str="Deleting corrupt file"; } diff --git a/code/SIBOSDK/wdrprint/dewserv.c b/code/SIBOSDK/wdrprint/dewserv.c new file mode 100644 index 0000000..95ce6c3 --- /dev/null +++ b/code/SIBOSDK/wdrprint/dewserv.c @@ -0,0 +1,38 @@ +/* DEWSERV.C */ + +#include +#include + +GLREF_D WSERV_SPEC *wserv_channel; + +LOCAL_C INT StatusWindowWidth(VOID) + { + P_EXTENT ext; + + wInquireStatusWindow(-1,&ext); + return(ext.width); + } + +LOCAL_C VOID InitClientWindow(PR_DEWSERV *self) + { + W_WINDATA wd; + PR_WIN *cliwin; + + wd.extent.tl.x=wd.extent.tl.y=0; + wd.extent.height=wserv_channel->conn.info.pixels.y; + wd.extent.width=wserv_channel->conn.info.pixels.x-StatusWindowWidth(); + cliwin=f_newsend(CAT_DEMO_HWIM,C_BWIN,O_WN_CONNECT,NULL,W_WIN_EXTENT,&wd); + self->wserv.cli=cliwin; + cliwin->win.flags=PR_BWIN_CORNER_4|PR_BWIN_SHADOW_1; + p_send3(cliwin,O_WN_EMPHASISE,TRUE); + hInitVis(cliwin); + } + +#pragma METHOD_CALL + +METHOD VOID dewserv_ws_dyn_init(PR_DEWSERV *self) + { + wsSetList(W_STATUS_WINDOW_ICON,NULL,0); + wStatusWindow(W_STATUS_WINDOW_BIG); + InitClientWindow(self); + } diff --git a/code/SIBOSDK/wdrprint/make.bat b/code/SIBOSDK/wdrprint/make.bat new file mode 100644 index 0000000..e28ef10 --- /dev/null +++ b/code/SIBOSDK/wdrprint/make.bat @@ -0,0 +1,3 @@ +@echo off +tscx /m wdrprint +tscx /m wdrprint diff --git a/code/SIBOSDK/wdrprint/wdrprint.afl b/code/SIBOSDK/wdrprint/wdrprint.afl new file mode 100644 index 0000000..88c6f9b --- /dev/null +++ b/code/SIBOSDK/wdrprint/wdrprint.afl @@ -0,0 +1,2 @@ +demo.pic +demo.rzc diff --git a/code/SIBOSDK/wdrprint/wdrprint.pr b/code/SIBOSDK/wdrprint/wdrprint.pr new file mode 100644 index 0000000..65e2af2 --- /dev/null +++ b/code/SIBOSDK/wdrprint/wdrprint.pr @@ -0,0 +1,34 @@ +#system epoc img +#set epocinit=iplib +#model small jpi + +#compile demo.cat + +#if %remake #or (demo.rg #older demo.re) #or (demo.rg #older demo.g) #then + #run "re demo" no_window no_abort +#endif + +#if (demo.rsg #older demo.rss) #or (demo.rsg #older demo.rg) #then + #file delete demo.rsg + #run "rs demo" no_window no_abort +#endif + +#if demo.rzc #older demo.rsg #then + #run "rch demo" no_window no_abort + #file delete wdrprint.img +#endif + +#compile decomman.c +#compile delp.c +#compile dedlg.c +#compile demain.c +#compile dewserv.c + +#if (wdrprint.img #older wdrprint.afl) #or (wdrprint.img #older demo.pic) #then + #file delete wdrprint.img +#endif + +#pragma link(olib.lib) +#pragma link(hwim.lib) + +#link wdrprint.img diff --git a/code/SIBOSDK/wdrprint/wdrprrel.prj b/code/SIBOSDK/wdrprint/wdrprrel.prj new file mode 100644 index 0000000..71b7561 --- /dev/null +++ b/code/SIBOSDK/wdrprint/wdrprrel.prj @@ -0,0 +1,16 @@ +wdrprrel.prj ! releases source files +wdrprint.pr ! TS project file +make.bat ! makes WDRPRINT.IMG +! +demo.cat ! category file +demo.re ! resource externals +demo.rss ! resource script +! +decomman.c ! command manager +delp.c ! line printer subclass +dedlg.c ! dialog +demain.c ! main +dewserv.c ! window server subclass +! +wdrprint.afl ! add file list +demo.pic ! icon diff --git a/code/SIBOSDK/wkdemo/charger.c b/code/SIBOSDK/wkdemo/charger.c new file mode 100644 index 0000000..f1fef28 --- /dev/null +++ b/code/SIBOSDK/wkdemo/charger.c @@ -0,0 +1,212 @@ +/* Fastcharger for Workabout */ +/* Example application */ +/* (C) Copyright Psion Software PLC 1997 */ +#include +#include +#include +#include +#include +#include "fcharge.h" +GLREF_D VOID *winHandle; +LOCAL_C VOID State(WORD Val) + { + switch (Val) + { + case 0: + p_printf(" Unknown"); + break; + case 1: + p_printf(" Not Charging"); + break; + case 2: + p_printf(" Fast Charging"); + break; + case 3: + p_printf(" Topping Off"); + break; + default: + p_printf(" Trickle"); + } + } +GLDEF_C VOID main(VOID) + { + VOID *pcb; + WORD One,OldOne; + WORD Two,OldTwo; + WORD KStat,Disch; + WORD LogOne[100]; + WORD LogTwo[100]; + WORD P1=0,P2=0,Temp; + ULONG TTime; + P_CON_KBREC Key; + TEXT X1Str[11]; + WORD X1=0; + ULONG XE=0,DischTime; + TEXT *X1Ptr; + INT Item; + for(Item=0;Item<100;Item++) + { + LogOne[Item]=0; + LogTwo[Item]=0; + } + + p_devdel("FCG",E_LDD); + p_printf("Loading"); + if(p_loadldd("m:\\sys$fchg.ldd")<0) + p_panic(0); + p_printf("Opening test"); + if(p_open(&pcb,"FCG:A",-1)<0) + p_panic(1); + p_printf("Closing test"); + if(p_close(pcb)<0) + p_panic(2); + p_printf("Opening test part II"); + if(p_open(&pcb,"FCG:A",-1)<0) + p_panic(3); + p_printf("Cant remove test"); + if(p_devdel("FCG:",E_LDD)>=0) + p_panic(4); + p_printf("Setting the charge Mode"); + p_iow(pcb,P_FCHG_READCHARGEMODE,&One); + if (One!=(P_FCHG_DEFAULTCC | P_FCHG_CTIME1C)) + p_panic(5); + p_printf("Test the charge Mode"); + if (p_iow(pcb,P_FCHG_SETCHARGEMODE,&One)!=0) + p_panic(6); + p_printf("Set Rubbish charge Mode"); + One=-1; + if (p_iow(pcb,P_FCHG_SETCHARGEMODE,&One)==0) + p_panic(7); + p_iow(pcb,P_FCHG_READSTATUS,&One,&Two); + p_print("Battery one:"); + State(One); + p_print("Battery two:"); + State(Two); +/* p_printf("Asynch test1"); + p_iow(pcb,P_FCHG_ASYNCHREAD,&One,&Two); + p_print("Battery one:"); + State(One); + p_print("Battery two:"); + State(Two); + p_printf("Asynch test2"); + p_iow(pcb,P_FCHG_ASYNCHREAD,&One,&Two); + p_print("Battery one:"); + State(One); + p_print("Battery two:"); + State(Two);*/ + p_ioc4(winHandle,P_FREAD,&KStat,&Key); + TTime=p_date(); + Disch=0; + DischTime=0; + FOREVER + { + if (KStat!=E_FILE_PENDING) /* Was it the keyboard */ + { + p_iowait(); /* not really the way to do this -oh well */ + if (Key.keycode=='Q' || Key.keycode=='q' || Key.keycode==27) + p_exit(0); + else if (Key.keycode=='D' || Key.keycode=='d') + { + p_printf("Start discharge"); + TTime=p_date(); + if (p_iow(pcb,P_FCHG_DISCHARGE)) + p_panic(8); + Disch=1; + } + else if (Key.keycode=='F' || Key.keycode=='f') + { + p_printf("Start Fastcharge1"); + TTime=p_date(); + if (p_iow(pcb,P_FCHG_FASTCHARGE1)) + p_panic(9); + } + else if (Key.keycode=='G' || Key.keycode=='g') + { + p_printf("Start Fastcharge2"); + TTime=p_date(); + if (p_iow(pcb,P_FCHG_FASTCHARGE2)) + p_panic(9); + } + else if (Key.keycode=='C' || Key.keycode=='c') + { + p_getl("Current: ",&X1Str[0],10); + X1Ptr=&X1Str[0]; + p_stoi(&X1Ptr,&X1); + } + else if (Key.keycode=='/' || Key.keycode=='?') + { + if (Disch==1) + p_printf("Discharging: %d",(p_date()-TTime)); + else + { + p_printf("Discharge Time: %dl",DischTime); + if (X1>0 && DischTime>0) + { + XE=(850*60*60*10)/X1; + XE=(DischTime*100*10)/XE; + p_printf("Capacity (Cell) %d%%",(UWORD)(XE)); + } + } + } + else if (Key.keycode=='1') + { + p_printf("Battery one Log"); + Temp=0; + while (Temp0) + State(LogOne[Temp-1]); + } + else if (Key.keycode=='2') + { + p_printf("Battery two Log"); + Temp=0; + while (Temp0) + State(LogTwo[Temp-1]); + } + else if (Key.keycode=='H' || Key.keycode=='h' || Key.keycode==290 || Key.keycode==291) + { + p_printf(""); + p_printf("C...Enter Discharge current"); + p_printf("D...Start Discharge"); + p_printf("F...Fastcharge Battery1"); + p_printf("G...Fastcharge Battery2"); + p_printf("?...Show Discharge time"); + p_printf("1...Show Battery1 Log"); + p_printf("2...Show Battery2 Log"); + p_printf("Q...Quit"); + p_printf(""); + } + p_ioc4(winHandle,P_FREAD,&KStat,&Key); + } + OldOne=One; + OldTwo=Two; + p_iow(pcb,P_FCHG_READSTATUS,&One,&Two); + if (OldOne!=One || OldTwo!=Two) + { + if (OldOne==1 && Disch==1 && One!=1) + { + Disch=0; + DischTime=(p_date()-TTime); + p_printf("Discharge Time: %d",DischTime); + } + p_printf("Time: %d",(p_date()-TTime)); + if (One!=OldOne) + { + if (P1>50) + P1=0; + LogOne[P1++]=One; + } + if (Two!=OldTwo) + { + if (P2>50) + P2=0; + LogTwo[P2++]=Two; + } + p_print("Battery one:"); + State(One); + p_print("Battery two:"); + State(Two); + } + } +} diff --git a/code/SIBOSDK/wkdemo/charger.pr b/code/SIBOSDK/wkdemo/charger.pr new file mode 100644 index 0000000..998a9e7 --- /dev/null +++ b/code/SIBOSDK/wkdemo/charger.pr @@ -0,0 +1,8 @@ +#system epoc img +#model small jpi +#pragma define(EPOC=>1,JPIC=>1) + +#compile %main +#link %prjname + + diff --git a/code/SIBOSDK/wkdemo/checkvid.bat b/code/SIBOSDK/wkdemo/checkvid.bat new file mode 100644 index 0000000..5c6199f --- /dev/null +++ b/code/SIBOSDK/wkdemo/checkvid.bat @@ -0,0 +1,2 @@ +@if not "%jpivid%"=="v2" set jpivid=v0 + diff --git a/code/SIBOSDK/wkdemo/dummy.pic b/code/SIBOSDK/wkdemo/dummy.pic new file mode 100644 index 0000000..e69de29 diff --git a/code/SIBOSDK/wkdemo/lcdcomm.c b/code/SIBOSDK/wkdemo/lcdcomm.c new file mode 100644 index 0000000..1296e62 --- /dev/null +++ b/code/SIBOSDK/wkdemo/lcdcomm.c @@ -0,0 +1,62 @@ +/* +File: LCDCOMM.C + +Methods for Class: lcdcomm (Superclass: comman). +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +GLREF_D PR_LCDCOMM *DatApp2; /* Command Manager */ +GLREF_D PR_LCDVIEW *DatApp3; /* Main Client Window */ + +LOCAL_C INT lLaunchDlg(P_CATID cat,UINT class,UINT id,VOID *prbuf) + { + DL_DATA dl_data; + + dl_data.id = id; + dl_data.rbuf = prbuf; + dl_data.pdlg = NULL; + return(hLaunchDial(cat,class,&dl_data)); + } + +LOCAL_C INT lLaunchDlgLcdtest(UINT class,UINT id,VOID *prbuf) + { /* Launches an LCDTEST category dialog. */ + return(lLaunchDlg(CAT_LCDTEST_LCDTEST,class,id,prbuf)); + } + +LOCAL_C INT lLaunchDlgLcdtestNull(UINT class,UINT id) + { /* Launches a LCDTEST category dialog with rbuf set to NULL. */ + return(lLaunchDlgLcdtest(class,id,NULL)); + } + +#pragma METHOD_CALL + +METHOD VOID lcdcomm_com_init(PR_LCDCOMM *self) + { + DatApp2 = self; + self->lcdcomm.sound.duration = 5; + self->lcdcomm.sound.pitch = 320; + } + +METHOD VOID lcdcomm_com_exit(PR_LCDCOMM *self) + { /* Exit application. */ + p_supersend2(self,O_COM_EXIT); + } + +METHOD VOID lcdcomm_cm_backlight(PR_LCDCOMM *self) + { /* Switch backlight on/off. */ + lLaunchDlgLcdtestNull(C_LCD_BACKLIGHT,D_BACKLIGHT); + } + +METHOD VOID lcdcomm_cm_sound(PR_LCDCOMM *self) + { /* Make a beep by calling p_sound() */ + lLaunchDlgLcdtest(C_LCD_SOUND,D_SOUND,&self->lcdcomm.sound); + } diff --git a/code/SIBOSDK/wkdemo/lcdcomm.cl b/code/SIBOSDK/wkdemo/lcdcomm.cl new file mode 100644 index 0000000..bc7afe7 --- /dev/null +++ b/code/SIBOSDK/wkdemo/lcdcomm.cl @@ -0,0 +1,30 @@ +NAME lcdcomm + +INCLUDE p_std.h +INCLUDE p_object.h +INCLUDE olib.g +INCLUDE comman.g + +CLASS lcdcomm comman +LCD Test command manager + { + REPLACE com_init ! + REPLACE com_exit ! Exit application + ADD cm_backlight ! Turn backlight on/off + ADD cm_sound ! Make a beep by calling p_sound() + TYPES + { + typedef struct + { + INT duration; ticks + INT pitch; frequency = 512/pitch kHz + } LCDCOMM_SOUND_INFO; + } + PROPERTY + { + UBYTE Status; + UBYTE Prefs; + LCDCOMM_SOUND_INFO sound; + } + } + diff --git a/code/SIBOSDK/wkdemo/lcddlgs.c b/code/SIBOSDK/wkdemo/lcddlgs.c new file mode 100644 index 0000000..c8f2a3d --- /dev/null +++ b/code/SIBOSDK/wkdemo/lcddlgs.c @@ -0,0 +1,60 @@ +/* +File: LCDDLGS.C + +Methods for dialogs +*/ +#include +#include +#include +#include +#include +#include +#include + +#define RBUFLEN 50 /* Buffer length for resource strings */ + +/* Set backlight & time dialog: position/index values */ +#define BACKLIGHT_OFFON 1 + +/* Sound test dialog: position/index values */ +#define SOUND_DURATION 1 +#define SOUND_PITCH 2 + +#pragma METHOD_CALL + +METHOD VOID lcd_backlight_dl_dyn_init(PR_DLGBOX *self) + { + if(p_backlight(E_BACKLIGHT_QUERY)) + hDlgSetChlistOn(BACKLIGHT_OFFON); + } + +METHOD VOID lcd_backlight_dl_changed(PR_DLGBOX *self, INT pos) + { + p_backlight(hDlgSenseChlist(BACKLIGHT_OFFON)? + E_BACKLIGHT_ON: E_BACKLIGHT_OFF); + } + +METHOD INT lcd_backlight_dl_key(PR_DLGBOX *self, INT pos, INT keycode) + { + lcd_backlight_dl_changed(self,pos); + return WN_KEY_CHANGED; + } + + +METHOD VOID lcd_sound_dl_dyn_init(PR_DLGBOX *self) + { + LCDCOMM_SOUND_INFO *const pInfo = self->dlgbox.rbuf; + + hDlgSetNcedit(SOUND_DURATION,pInfo->duration); + hDlgSetNcedit(SOUND_PITCH,pInfo->pitch); + } + +METHOD INT lcd_sound_dl_key(PR_DLGBOX *self, INT pos, INT keycode) + { + LCDCOMM_SOUND_INFO *const pInfo = self->dlgbox.rbuf; + + pInfo->duration = hDlgSenseNcedit(SOUND_DURATION); + pInfo->pitch = hDlgSenseNcedit(SOUND_PITCH); + p_sound(pInfo->duration,pInfo->pitch); + return WN_KEY_CHANGED; + } diff --git a/code/SIBOSDK/wkdemo/lcddlgs.cl b/code/SIBOSDK/wkdemo/lcddlgs.cl new file mode 100644 index 0000000..a1581fe --- /dev/null +++ b/code/SIBOSDK/wkdemo/lcddlgs.cl @@ -0,0 +1,21 @@ +NAME lcddlgs + +INCLUDE p_std.h +INCLUDE p_object.h +INCLUDE olib.g +INCLUDE hwim.g +INCLUDE dlgbox.g + + +CLASS lcd_backlight dlgbox + { + REPLACE dl_dyn_init + REPLACE dl_changed + REPLACE dl_key + } + +CLASS lcd_sound dlgbox + { + REPLACE dl_dyn_init + REPLACE dl_key + } diff --git a/code/SIBOSDK/wkdemo/lcdmain.c b/code/SIBOSDK/wkdemo/lcdmain.c new file mode 100644 index 0000000..3d76fdd --- /dev/null +++ b/code/SIBOSDK/wkdemo/lcdmain.c @@ -0,0 +1,28 @@ +/* +File: LCDMAIN.C +*/ + +#include +#include +#include +#include +#include + +#pragma METHOD_CALL + +GLDEF_C VOID main(VOID) + { + IN_HWIMMAN app; + IN_WSERV wserv; + + p_linklib(0); + app.flags = FLG_APPMAN_RSCFILE + | FLG_APPMAN_CLEAN + | FLG_APPMAN_SRSCFILE + | FLG_APPMAN_FULLSCREEN + | FLG_APPMAN_ONLYONE; + app.wserv_cat = wserv.com_cat = p_getlibh(CAT_LCDTEST_LCDTEST); + app.wserv_class = C_LCDWSERV; + wserv.com_class = C_LCDCOMM; + p_send4(p_new(CAT_LCDTEST_HWIM,C_HWIMMAN),O_AM_INIT,&app,&wserv); + } /* never returns */ diff --git a/code/SIBOSDK/wkdemo/lcdtest.afl b/code/SIBOSDK/wkdemo/lcdtest.afl new file mode 100644 index 0000000..284bca9 --- /dev/null +++ b/code/SIBOSDK/wkdemo/lcdtest.afl @@ -0,0 +1,2 @@ +dummy.pic +lcdtest.rzc diff --git a/code/SIBOSDK/wkdemo/lcdtest.cat b/code/SIBOSDK/wkdemo/lcdtest.cat new file mode 100644 index 0000000..9cfc758 --- /dev/null +++ b/code/SIBOSDK/wkdemo/lcdtest.cat @@ -0,0 +1,13 @@ +IMAGE lcdtest + +EXTERNAL olib +EXTERNAL hwim + +INCLUDE p_std.h +INCLUDE p_object.h + +REQUIRE lcdwserv +REQUIRE lcdcomm +REQUIRE lcdview +REQUIRE lcddlgs + diff --git a/code/SIBOSDK/wkdemo/lcdtest.pr b/code/SIBOSDK/wkdemo/lcdtest.pr new file mode 100644 index 0000000..f92dd87 --- /dev/null +++ b/code/SIBOSDK/wkdemo/lcdtest.pr @@ -0,0 +1,40 @@ +#system epoc img +#set epocinit=iplib +#model small jpi + +#abort on + +#set version=0x100F +#set priority=0x80 +#set heapsize=0x80 + +#compile %main.cat + +#if %remake #or (%main.rg #older %main.re) #or (%main.rg #older %main.g) #then + #run "re %main" no_window no_abort +#endif + +#if (%main.rsg #older %main.rss) #or (%main.rsg #older %main.rg) #then + #file delete %main.rsg + #run "rs %main" no_window no_abort +#endif + +#if %main.rzc #older %main.rsg #then + #run "rch %main" no_window no_abort +#endif + +#compile lcdmain.c +#compile lcdwserv.c +#compile lcdcomm.c +#compile lcdview.c +#compile lcddlgs.c + +#if (%main.img #older %main.afl) #or (%main.img #older %main.pic) #then + #file delete %main.img +#endif + +#pragma link(olib.lib) +#pragma link(hwim.lib) + +#link %main + diff --git a/code/SIBOSDK/wkdemo/lcdtest.re b/code/SIBOSDK/wkdemo/lcdtest.re new file mode 100644 index 0000000..6594e2b --- /dev/null +++ b/code/SIBOSDK/wkdemo/lcdtest.re @@ -0,0 +1,7 @@ +/* LCDTEST.RE */ + +#include + +_O_COM_EXIT +_O_CM_BACKLIGHT +_O_CM_SOUND diff --git a/code/SIBOSDK/wkdemo/lcdtest.rss b/code/SIBOSDK/wkdemo/lcdtest.rss new file mode 100644 index 0000000..26967cf --- /dev/null +++ b/code/SIBOSDK/wkdemo/lcdtest.rss @@ -0,0 +1,156 @@ +/* +LCDTEST.RSS +*/ + +#include +#include +#include +#include +#include + +/* accelerators, menu bar and menu */ +RESOURCE WSERV_INFO accs_lcdview + { + menbar_id=menubar_lcdview; + first_com=O_COM_EXIT; +/* FT: following are accelerators for the main menu items. + Comments by each show which main menu tile it belongs to */ + accel={'x', /* Exit */ + 'b', /* Backlight */ + 's' /* Sound */ + }; + } + +RESOURCE MENU_BAR menubar_lcdview + { + items = + { + MENU_BAR_ITEM + { + menu_id=menu_control; + mb_item="Control"; + }, + MENU_BAR_ITEM + { + menu_id=menu_special; + mb_item="Special"; + } + }; + } + +RESOURCE MENU menu_control + { + items = + { + MENU_ITEM + { + com_id=O_CM_BACKLIGHT; + mn_item="Backlight"; + }, + MENU_ITEM + { + com_id=O_CM_SOUND; + mn_item="Sound"; + } + }; + } + +RESOURCE MENU menu_special + { + items = + { + MENU_ITEM + { + com_id=O_COM_EXIT; + mn_item="Exit"; + } + }; + } + +/* String resources */ +RESOURCE STRING s_copyright + {str="¸ Copyright Psion PLC 1994";} + +/* Dialog resources */ + +RESOURCE DIALOG d_backlight + { + title="Set backlight"; + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_RBUF_FILLED; + controls= + { + CONTROL + { + class=C_CHLIST; + flags=DLGBOX_ITEM_NOTIFY_CHANGED; + prompt="Backlight"; + info=CHLIST {rid=-SYS_OFFON_MENU;}; + } + }; + } + +RESOURCE DIALOG d_sound + { + title="Make test sound"; + flags=DLGBOX_NOTIFY_ENTER|DLGBOX_RBUF_FILLED; + controls= + { + CONTROL + { + class=C_NCEDIT; + prompt="Duration (ticks)"; + info=NCEDIT {}; + }, + CONTROL + { + class=C_NCEDIT; + prompt="Pitch (512/kHz)"; + info=NCEDIT {}; + } + }; + } + +/* Help resources */ +RESOURCE HELP_ARRAY h_help +{ +topic="Lcdtest: 1.23w"; /* place holder for version number */ +topic_id=h_help_index; +} + +RESOURCE TOPIC_ARRAY h_help_index +{ +id_lst= +{ +h_numkeys, +h_arrows +}; +} + +RESOURCE HELP_ARRAY h_numkeys +{ +topic="Numeric keys"; +strlst= +{ +STRING {str="0. Reverse video";}, +STRING {str="1. `HHH' pattern";}, +STRING {str="2. ON/OFF pattern";}, +STRING {str="3. All ON pattern";}, +STRING {str="4. All OFF pattern";}, +STRING {str="5. Grey pattern";}, +STRING {str="6. Random chars?";} +}; +} + +RESOURCE HELP_ARRAY h_arrows +{ +topic="Arrow keys"; +strlst= +{ +STRING {str="These move the grey";}, +STRING {str="pattern up or down";}, +STRING {str="& vary the start of";}, +STRING {str="the letter pattern.";}, +STRING {str="They do not affect";}, +STRING {str="any other pattern.";} +}; +} diff --git a/code/SIBOSDK/wkdemo/lcdview.c b/code/SIBOSDK/wkdemo/lcdview.c new file mode 100644 index 0000000..83fe93a --- /dev/null +++ b/code/SIBOSDK/wkdemo/lcdview.c @@ -0,0 +1,240 @@ +/* +File: LCDVIEW.C + +Methods for Class: cpview (Superclass: win). + +Main client window +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define FONT_DEF FONT_ID_MONO_8x8 +#define CHARBUFFSIZE 64 + +GLREF_D PR_GATE *DatGate; +GLREF_D WSERV_SPEC *wserv_channel; +GLREF_D PR_LCDVIEW *DatApp3; /* Main Client Window */ + +LOCAL_C VOID lSetDisplayInfo(LCD_DISP_INFO * pLinfo) + { + G_FONT_INFO finfo; + + gFontInfo(pLinfo->textfont,G_STY_MONO,&finfo); + pLinfo->numwidth = finfo.numeric_width; + pLinfo->textheight = finfo.height; + pLinfo->textascent = finfo.ascent; + pLinfo->lineheight = finfo.height + 2; + pLinfo->lineascent = finfo.ascent + 2; + pLinfo->scrlines = wserv_channel->conn.info.pixels.y + /pLinfo->lineheight; + pLinfo->scrwidth = wserv_channel->conn.info.pixels.x; + } + +LOCAL_C VOID lSetGCTemp(UWORD fid, UWORD style) +/* Sets font and style */ + { + G_GC g_gc; + + g_gc.font = fid; + g_gc.style = (BYTE)style; + gSetGC(WS_TEMPORARY_GC,G_GC_MASK_FONT|G_GC_MASK_STYLE,&g_gc); + } + +LOCAL_C VOID lFillCharBuff(PR_LCDVIEW *const self, TEXT *pTxt, INT size) + { + INT jj; + + for(jj = 0; jj < size; ++jj, ++pTxt) + { + *pTxt = self->lcdview.letter; + ++self->lcdview.letter; + if(self->lcdview.letter > 'Z') + self->lcdview.letter = 'A'; + } + } + +LOCAL_C VOID lDrawPatternHHH(PR_LCDVIEW *const self) + { + P_RECT rect0; + P_RECT rect1; + TEXT xBuff[CHARBUFFSIZE]; + INT row; + INT chars; + UINT width; + + p_bfil(&xBuff[0],sizeof(xBuff),'H'); + + /* Set font and style */ + lSetGCTemp(self->lcdview.dinfo.textfont,G_STY_MONO); + rect1 = rect0 = *((P_RECT*)&self->lcdview.extent); + gClrRect(&rect1,G_TRMODE_CLR); + width = self->lcdview.dinfo.scrwidth; + chars = gTextCount(self->lcdview.dinfo.textfont,G_STY_MONO, + &xBuff[0],sizeof(xBuff),&width); + + rect0.tl.y = 25; + ++rect0.tl.x; + --rect0.br.x; + for(row = 0; row < 5; ++row) + { + rect0.br.y = rect0.tl.y + self->lcdview.dinfo.lineheight; + gPrintBoxText(&rect0,self->lcdview.dinfo.lineascent, + G_TEXT_ALIGN_LEFT,0,&xBuff[0],chars); + rect0.tl.y += 10; + } + + gDrawBox(&rect1); + } + +LOCAL_C VOID lDrawPatternOnOff(PR_LCDVIEW *const self) + { /* Alternate pixels On/Off */ + gFillPattern((P_RECT*)&self->lcdview.extent, + WS_BITMAP_GREY,G_TRMODE_REPL); + } + +LOCAL_C VOID lDrawPatternON(PR_LCDVIEW *const self) + { /* All pixels ON */ + gClrRect((P_RECT*)&self->lcdview.extent,G_TRMODE_SET); + } + +LOCAL_C VOID lDrawPatternOFF(PR_LCDVIEW *const self) + { /* All pixels OFF */ + gClrRect((P_RECT*)&self->lcdview.extent,G_TRMODE_CLR); + } + +LOCAL_C VOID lDrawPatternGrey(PR_LCDVIEW *const self) + { + INT row; + P_RECT rect0; + G_GC g_gc; + + gClrRect((P_RECT*)&self->lcdview.extent,G_TRMODE_CLR); + g_gc.flags = G_GC_FLAG_GREY_PLANE; + gSetGC(WS_TEMPORARY_GC,G_GC_MASK_GREY,&g_gc); + rect0 = *((P_RECT*)&self->lcdview.extent); + rect0.tl.y = self->lcdview.offset % (self->lcdview.dinfo.lineheight+1); + for(row = 0; row < self->lcdview.dinfo.scrlines; ++row) + { + rect0.br.y = rect0.tl.y + self->lcdview.dinfo.lineheight; + gClrRect(&rect0,row%2? G_TRMODE_SET: G_TRMODE_CLR); + rect0.tl.y += self->lcdview.dinfo.lineheight; + } + gClrRect(&rect0,G_TRMODE_CLR); + g_gc.flags = 0; + gSetGC(WS_TEMPORARY_GC,G_GC_MASK_GREY,&g_gc); + } + +LOCAL_C VOID lDrawPatternChars(PR_LCDVIEW *const self) + { + P_RECT rect0; + TEXT xBuff[CHARBUFFSIZE]; + INT row; + INT chars; + UINT width; + + /* Set font and style */ + lSetGCTemp(self->lcdview.dinfo.textfont,G_STY_MONO); + p_bcpy(&rect0,&self->lcdview.extent,sizeof(rect0)); + gClrRect(&rect0,G_TRMODE_CLR); + for(row = 0; row < self->lcdview.dinfo.scrlines; ++row) + { + rect0.br.y = rect0.tl.y + self->lcdview.dinfo.lineheight; + lFillCharBuff(self,&xBuff[0],sizeof(xBuff)); + width = self->lcdview.dinfo.scrwidth; + chars = gTextCount(self->lcdview.dinfo.textfont,G_STY_MONO, + &xBuff[0],sizeof(xBuff),&width); + self->lcdview.letter = xBuff[chars]; + gPrintBoxText(&rect0,self->lcdview.dinfo.lineascent, + G_TEXT_ALIGN_LEFT,0,&xBuff[0],chars); + rect0.tl.y += self->lcdview.dinfo.lineheight; + } + } + +LOCAL_C VOID SetPattern(PR_LCDVIEW *const self, VOID(*func)(PR_LCDVIEW *)) + { + self->lcdview.funct = (VOID(*)(VOID*))func; + } + +#pragma METHOD_CALL + +METHOD VOID lcdview_wn_init(PR_LCDVIEW *const self) + { + W_WINDATA wd; + + wd.background = W_WIN_BACK_CLR|W_WIN_BACK_GREY_CLR; + wd.flags = 0; + wd.extent.tl.x = wd.extent.tl.y = 0; + wd.extent.width = wserv_channel->conn.info.pixels.x; + wd.extent.height = wserv_channel->conn.info.pixels.y; + self->lcdview.extent = wd.extent; + p_send5(self,O_WN_CONNECT,NULL_D,W_WIN_ALL_FLAGS|W_WIN_EXTENT|W_WIN_BACKGROUND,&wd); + wStatusWindow(W_STATUS_WINDOW_OFF); + wsSetList(W_STATUS_WINDOW_ICON,NULL_D,0); + + self->lcdview.letter = 'A'; + self->lcdview.dinfo.textfont = FONT_DEF; + lSetDisplayInfo(&self->lcdview.dinfo); + SetPattern(self,lDrawPatternHHH); + } + +METHOD VOID lcdview_wn_draw(PR_LCDVIEW *const self) + { + (*self->lcdview.funct)(self); + if(self->lcdview.status & LCD_STAT_INVERSE) + gInvObloid(&self->lcdview.extent); + } + +METHOD INT lcdview_wn_key(PR_LCDVIEW *const self,UINT key,UINT mod) + { + switch(key) + { + case '0': + gCreateTempGC0(self->win.id); + gInvObloid(&self->lcdview.extent); + self->lcdview.status ^= LCD_STAT_INVERSE; + gFreeTempGC(); + return WN_KEY_NO_CHANGE; + case '1': + SetPattern(self,lDrawPatternHHH); + break; /* to WN_DODRAW */ + case '2': + SetPattern(self,lDrawPatternOnOff); + break; /* to WN_DODRAW */ + case '3': + SetPattern(self,lDrawPatternON); + break; /* to WN_DODRAW */ + case '4': + SetPattern(self,lDrawPatternOFF); + break; /* to WN_DODRAW */ + case '5': + SetPattern(self,lDrawPatternGrey); + break; /* to WN_DODRAW */ + case '6': + SetPattern(self,lDrawPatternChars); + break; /* to WN_DODRAW */ + case W_KEY_UP: + ++self->lcdview.offset; + break; /* to WN_DODRAW */ + case W_KEY_DOWN: + --self->lcdview.offset; + break; /* to WN_DODRAW */ + case W_KEY_HOME: + self->lcdview.offset = 0; + break; /* to WN_DODRAW */ + case W_KEY_END: + self->lcdview.offset = self->lcdview.dinfo.lineheight; + break; /* to WN_DODRAW */ + default: + return WN_KEY_NO_CHANGE; + } /* End switch() */ + p_send2(self,O_WN_DODRAW); + return WN_KEY_NO_CHANGE; + } diff --git a/code/SIBOSDK/wkdemo/lcdview.cl b/code/SIBOSDK/wkdemo/lcdview.cl new file mode 100644 index 0000000..489730a --- /dev/null +++ b/code/SIBOSDK/wkdemo/lcdview.cl @@ -0,0 +1,45 @@ +NAME lcdview + +INCLUDE p_std.h +INCLUDE p_object.h +INCLUDE olib.g +INCLUDE hwim.g +INCLUDE hwimman.g +INCLUDE edwin.g + +CLASS lcdview win +Command Processor client window + { + REPLACE wn_init Initialise client window + REPLACE wn_draw + REPLACE wn_key + CONSTANTS + { + LCD_STAT_INVERSE 0x0001 Set if video reversed + } + TYPES + { + typedef struct + { + UWORD textfont; text font ID + UBYTE numwidth; max font numeric_width + UBYTE textheight; text font height + UBYTE textascent; text font ascent + UBYTE lineheight; max font height plus 1/2 pixels + UBYTE lineascent; max font ascent plus 1/2 pixels + UBYTE scrlines; lines on screen + INT scrwidth; screen width + } LCD_DISP_INFO; display line info. + } + PROPERTY + { + UWORD status; flags + BYTE letter; for random letters on screen + UBYTE offset; to top of grey pattern + P_EXTENT extent; view extent + VOID (*funct)(VOID *self); pattern function + LCD_DISP_INFO dinfo; output display info (based on current font) + } + } + + diff --git a/code/SIBOSDK/wkdemo/lcdwserv.c b/code/SIBOSDK/wkdemo/lcdwserv.c new file mode 100644 index 0000000..43fce0b --- /dev/null +++ b/code/SIBOSDK/wkdemo/lcdwserv.c @@ -0,0 +1,59 @@ +/* +File: LCDWSERV.C + +Methods for Class: lcdwserv (Superclass: wserv). +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +GLREF_D PR_HWIMMAN *w_am; +GLREF_D UBYTE *DatUsedPathNamePtr; +GLREF_D UBYTE *DatCommandPtr; +GLREF_D PR_LCDVIEW *DatApp3; /* Main Client Window */ + +LOCAL_C VOID lLoadOwnVersionText(TEXT *pb) + { + ImgHeader head; + VOID *pcb; + INT val; + + f_open(&pcb,(TEXT *)DatCommandPtr,P_FOPEN|P_FSHARE|P_FSTREAM); + val = p_read(pcb,&head,sizeof(head)); + p_close(pcb); + if(val != sizeof(head)) + p_leave(E_FILE_INVALID); + p_atos(pb,"%u.%03x",head.CodeVersion>>12,head.CodeVersion&0xfff); + } + +#pragma METHOD_CALL + +METHOD VOID lcdwserv_ws_dyn_init(PR_LCDWSERV *self) + { + /* create and initialise the client window */ + p_send2(DatApp3=(PR_LCDVIEW *)f_new(CAT_LCDTEST_LCDTEST,C_LCDVIEW),O_WN_INIT); + self->wserv.cli =(PR_WIN *)DatApp3; + + self->wserv.help_index_id = H_HELP; + hInitVis(self->wserv.cli); + hInfoPrint(S_COPYRIGHT); + } + +METHOD VOID lcdwserv_ws_do_help(PR_LCDWSERV *self,INT start_id) + { + TEXT *pTxt; /* points into Help screen title buffer */ + + p_supersend3(self,O_WS_DO_HELP,start_id); + if (start_id!=H_HELP) + return; + pTxt=(&((PR_HELPDLG *)self->wserv.dial)->helpdlg.listbox->helplist.title[0]); + pTxt += p_slen(pTxt)-5; /* position back before 1.23w */ + lLoadOwnVersionText(pTxt); + } diff --git a/code/SIBOSDK/wkdemo/lcdwserv.cl b/code/SIBOSDK/wkdemo/lcdwserv.cl new file mode 100644 index 0000000..4c60c02 --- /dev/null +++ b/code/SIBOSDK/wkdemo/lcdwserv.cl @@ -0,0 +1,14 @@ +NAME lcdwserv + +INCLUDE p_std.h +INCLUDE p_object.h +INCLUDE olib.g +INCLUDE hwim.g +INCLUDE hwimman.g + +CLASS lcdwserv wserv + { + REPLACE ws_dyn_init Startup code + REPLACE ws_do_help Set application version number + } + diff --git a/code/SIBOSDK/wkdemo/make.bat b/code/SIBOSDK/wkdemo/make.bat new file mode 100644 index 0000000..319ca30 --- /dev/null +++ b/code/SIBOSDK/wkdemo/make.bat @@ -0,0 +1,9 @@ +@echo off +call checkvid +if not exist %1.pr goto error +tscx /m %1 /%jpivid% +tscx /m %1 /%jpivid% +goto end +:error +echo Project file %1.pr does not exist +:end diff --git a/code/SIBOSDK/wkdemo/tables.c b/code/SIBOSDK/wkdemo/tables.c new file mode 100644 index 0000000..43e16c4 --- /dev/null +++ b/code/SIBOSDK/wkdemo/tables.c @@ -0,0 +1,629 @@ +/* + + TABLES.C + +*/ + +#include +#include +#include +#include +#include + + +GLREF_D UWORD DatLocked; + +LOCAL_D TEXT *cmds[]= + { + "rReset score", + "lLimits", + "mMode", + "tTiming", + "xExit", + NULL + }; + +#define TABLES_ITEMS 5 + +LOCAL_D H_MENU_DATA mdata[]= + { + "Tables",TABLES_ITEMS, + NULL + }; + +GLDEF_D TEXT ** _cmds=(&cmds[0]); +GLDEF_D H_MENU_DATA * _mdata=(&mdata[0]); + + +LOCAL_D UINT MainWid; + +typedef struct + { + UWORD TableEnd; + UWORD MaxTable; + UWORD Tested; + UWORD Correct; + UWORD Timing; + UWORD Mode; + } TSTATE; + +LOCAL_D TSTATE state={12,12,0,0,5,1}; + +LOCAL_D TEXT *EnvName="TABLES"; +#define ENV_NAME_LEN 6 + +LOCAL_D ULONG seed; + +LOCAL_D VOID *timH; +LOCAL_D WORD timactive; +LOCAL_D WORD timstat; +LOCAL_D ULONG timint; +LOCAL_D WORD timcount; +LOCAL_D WORD timtotcnt; + + +LOCAL_C VOID DrawLine(INT j,TEXT *pb) + { + P_RECT box; + + box.tl.x=4; + box.br.x=189-4; + box.tl.y=4+13*j; + box.br.y=box.tl.y+13; + gPrintBoxText(&box,11,G_TEXT_ALIGN_CENTRE,0,pb,p_slen(pb)); + } + +LOCAL_C VOID DisplayScores(VOID) + { + TEXT buf[40]; + + p_atos(&buf[0],"Score: %u correct out of %u",state.Correct,state.Tested); + DrawLine(0,&buf[0]); + } + +LOCAL_C VOID DisplayMode(VOID) + { + TEXT *pb; + TEXT buf[40]; + + if (state.Mode==1) + pb="Testing all tables"; + else + { + p_atos(&buf[0],"Testing %d times table",state.Mode); + pb=(&buf[0]); + } + DrawLine(1,pb); + } + +LOCAL_C VOID DisplayLimits(VOID) + { + TEXT buf[40]; + + p_atos(&buf[0],"(up to %d times %d)", + (state.Mode==1? state.MaxTable: state.Mode),state.TableEnd); + DrawLine(2,&buf[0]); + } + +LOCAL_C VOID DrawButton(INT state) + { + P_RECT box; + + box.tl.x=34+38; + box.br.x=34+38+38; + box.tl.y=57; + box.br.y=57+14; + wDrawButton(&box,"Enter",state); + } + +LOCAL_C VOID DisplayPressButton(VOID) + { + gPrintText(34,66,"Press",5); + DrawButton(FALSE); + gPrintText(34+38+38+4,66,"to test",7); + } + +LOCAL_C VOID Display(VOID) + { + DisplayScores(); + DisplayMode(); + DisplayLimits(); + DisplayPressButton(); + } + +LOCAL_C VOID ResetScore(VOID) + { + if (!state.Tested) + { + wInfoMsg("No score to reset"); + return; + } + if (uOpenDialog("Reset score to zero")) + return; + if (uAddButtonList("No",-'n',"Yes",'y',NULL)) + return; + if (uRunDialog()=='y') + { + state.Tested=0; + state.Correct=0; + DisplayScores(); + } + } + +LOCAL_C VOID ChangeLimits(VOID) + { + LONG lTableEnd; + LONG lMaxTable; + H_DI_NUMBER end; + H_DI_NUMBER last; + + lTableEnd=state.TableEnd; + lMaxTable=state.MaxTable; + if (uOpenDialog("Limits for testing")) + return; + end.value=(&lTableEnd); + end.low=10; + end.high=99; + if (uAddDialogItem(H_DIALOG_NUMBER,"Tables end at",&end)) + return; + last.value=(&lMaxTable); + last.low=2; + last.high=99; + if (uAddDialogItem(H_DIALOG_NUMBER,"Highest table",&last)) + return; + if (uRunDialog()<=0) + return; + state.TableEnd=lTableEnd; + state.MaxTable=lMaxTable; + if (state.Mode>state.MaxTable) + state.Mode=state.MaxTable; + DisplayMode(); + DisplayLimits(); + } + +LOCAL_C VOID ChangeTiming(VOID) + { + LONG lTiming; + H_DI_NUMBER tim; + + lTiming=state.Timing; + if (uOpenDialog("Timing")) + return; + tim.value=(&lTiming); + tim.low=1; + tim.high=20; + if (uAddDialogItem(H_DIALOG_NUMBER,"Number of seconds allowed",&tim)) + return; + if (uRunDialog()<=0) + return; + state.Timing=lTiming; + } + +GLREF_D UWORD _SmallFontDialog; + +LOCAL_C VOID ChangeMode(VOID) + { + H_DI_CHOICE ch; + INT j; + TEXT buf[20]; + + _SmallFontDialog=TRUE; + if (uOpenDialog("Mode")) + return; + if (uBeginDCL(&ch)) + return; + if (uGrowDCL(&ch,"All tables")) + return; + for (j=2; j<=state.MaxTable; j++) + { + p_atos(&buf[0],"%d times table",j); + if (uGrowDCL(&ch,&buf[0])) + return; + } + if (uAddDCL("Test which tables",&state.Mode,&ch)) + return; + if (uRunDialog()<=0) + return; + DisplayMode(); + DisplayLimits(); + } + +LOCAL_C VOID ExitApplication(VOID) + { + uErrorValue(p_setenviron(EnvName,ENV_NAME_LEN,&state,sizeof(TSTATE))); + p_exit(0); + } + +LOCAL_C VOID ManageCommand(INT index) + { + switch (index) + { + case 0: + ResetScore(); + break; + case 1: + ChangeLimits(); + break; + case 2: + ChangeMode(); + break; + case 3: + ChangeTiming(); + break; + case 4: + ExitApplication(); + } + } + +LOCAL_C VOID TryExecuteCommand(INT keycode) + { + keycode=uLocateCommand(keycode); + if (keycode>=0) + ManageCommand(keycode); + } + +LOCAL_C INT FindRandom(INT low,INT high) + { + INT range; + + range=high-low+1; + return(low+(INT)(p_randl(&seed)%range)); + } + +LOCAL_C VOID FindFactors(WORD *pa,WORD *pb) + { + *pa=(state.Mode==1? FindRandom(2,state.MaxTable): state.Mode); + *pb=FindRandom(2,state.TableEnd); + } + +LOCAL_C VOID SwitchStyle(INT style) + { + G_GC gc; + + gc.style=style; + gSetGC(0,G_GC_MASK_STYLE,&gc); + } + +LOCAL_C VOID *CreateEditor(VOID) + { + H_EDIT_BOX heb; + + heb.maxchars=4; + heb.vulen=30; + heb.pos.x=113; + heb.pos.y=53; + heb.win=MainWid; + heb.font=WS_FONT_BASE+9; + heb.style=G_STY_DOUBLE; + return(hEBOpen(H_EDIT_BOX_FONT,&heb)); + } + +LOCAL_C VOID ClearBottomArea(VOID) + { + P_RECT box; + + box.tl.x=4; + box.br.x=189-4; + box.tl.y=4+3*13; + box.br.y=100-4; + gClrRect(&box,G_TRMODE_CLR); + } + +LOCAL_C VOID Beep(VOID) + { + p_sound(-5,320); + } + +LOCAL_C VOID SelectAll(VOID *ebH) + { + hEBSetSelect(ebH,0,p_slen(hEBSenseText(ebH))); + } + +LOCAL_C INT SenseNumberTyped(VOID *ebH) + { + TEXT *pb; + WORD num; + + pb=hEBSenseText(ebH); + if (!*pb) + return(0); + p_stoi(&pb,&num); + return(num); + } + +LOCAL_C INT AddTextItem(TEXT *pmt,TEXT *pbod) + { + H_DI_TEXT txt; + TEXT buf[20]; + + txt.type=H_DTEXT_ALIGN_CENTRE; + uZTStoBCS(txt.str=(&buf[0]),pbod); + return(uAddDialogItem(H_DIALOG_TEXT,pmt,&txt)); + } + +LOCAL_C INT Complain(INT a,INT b,INT c) + { + TEXT buf[20]; + + if (uOpenDialog("Incorrect")) + return(-1); + p_atos(&buf[0],"%d \236 %d",a,b); + if (AddTextItem("The question",&buf[0])) + return(-1); + buf[p_itob(&buf[0],c)]=0; + if (AddTextItem("Your answer",&buf[0])) + return(-1); + if (uAddButtonList("Help",W_KEY_ESCAPE,"Retry",W_KEY_RETURN,NULL)) + return(-1); + if (uRunDialog()==W_KEY_RETURN) + return(0); + p_atos(&buf[0],"%d \236 %d = %d",a,b,a*b); + if (uOpenDialog(&buf[0])) + return(-1); + if (uAddButtonList("Continue",W_KEY_RETURN,NULL)) + return(-1); + uRunDialog(); + return(-1); + } + +LOCAL_C INT BadKey(INT k) + { + return(k<256 && p_isprint(k) && !p_isdigit(k)); + } + +LOCAL_C VOID CancelTimer(VOID) + { + if (timactive) + { + p_iow2(timH,P_FCANCEL); + p_waitstat(&timstat); + } + timactive=FALSE; + } + +LOCAL_C VOID QueueTimer(VOID) + { + CancelTimer(); + p_ioa4(timH,P_FRELATIVE,&timstat,&timint); + timactive=TRUE; + } + +LOCAL_C VOID InitialiseTimer(VOID) + { + if (state.Timing<=4) + { + timint=5; + timcount=2*state.Timing; + } + else + { + timint=10; + timcount=state.Timing; + } + timtotcnt=timcount; + QueueTimer(); + } + +LOCAL_C VOID GetBarChartRect(P_RECT *pbox) + { + pbox->tl.x=9; + pbox->br.x=180; + pbox->tl.y=82; + pbox->br.y=88; + } + +LOCAL_C VOID IncrementBarChart(VOID) + { + P_RECT box; + + timcount--; + GetBarChartRect(&box); + box.br.x=9+171*(timtotcnt-timcount)/timtotcnt; + gFillPattern(&box,WS_BITMAP_GREY,G_TRMODE_REPL); + } + +LOCAL_C VOID ClearBarChart(VOID) + { + P_RECT box; + + GetBarChartRect(&box); + gClrRect(&box,G_TRMODE_CLR); + } + +LOCAL_C VOID DisplayQuestion(VOID) + { + TEXT buf[30]; + WMSG_KEY key; + WORD keyactive; + WORD keystat; + P_RECT box; + VOID *ebH; + WORD a; + WORD b; + WORD c; + WORD ans; + + ebH=CreateEditor(); + if (!ebH) + return; + ClearBottomArea(); + hEBEmphasise(ebH,TRUE); + FindFactors(&a,&b); + ans=a*b; + p_atos(&buf[0],"%d \236 %d = ",a,b); + box.tl.x=53; + box.br.x=113; + box.tl.y=52; + box.br.y=52+22; + SwitchStyle(G_STY_DOUBLE); + gPrintBoxText(&box,20,G_TEXT_ALIGN_RIGHT,0,&buf[0],p_slen(&buf[0])); + SwitchStyle(G_STY_NORMAL); + box.tl.x=8; + box.br.x=189-8; + box.tl.y=81; + box.br.y=81+8; + gBorderRect(&box,W_BORD_CORNER_1); + DatLocked=TRUE; + state.Tested++; + keyactive=FALSE; + InitialiseTimer(); + FOREVER + { + if (keyactive) + wFlush(); + else + { + uGetKeyA(&keystat,&key); + keyactive=TRUE; + } + p_iowait(); + if (keystat==E_FILE_PENDING) + { + timactive=FALSE; + IncrementBarChart(); + if (!timcount) + { + wFlush(); + p_sleep(2); + goto CheckAnswer; + } + QueueTimer(); + continue; + } + keyactive=FALSE; + if (BadKey(key.keycode)) + Beep(); + else if (key.keycode!=W_KEY_RETURN) + hEBHandleKey(ebH,key.keycode,key.modifiers); + else + { + CheckAnswer: + c=SenseNumberTyped(ebH); + if (c==ans) + { + state.Correct++; + break; + } + Beep(); + hEBEmphasise(ebH,FALSE); + if (Complain(a,b,c)) + break; + DisplayScores(); + state.Tested++; + hEBEmphasise(ebH,TRUE); + SelectAll(ebH); + ClearBarChart(); + InitialiseTimer(); + } + } + DatLocked=FALSE; + hEBClose(ebH); + ClearBottomArea(); + DisplayPressButton(); + CancelTimer(); + } + +LOCAL_C VOID MakeButtonDance(VOID) + { + DrawButton(TRUE); + wFlush(); + p_sleep(2); + DrawButton(FALSE); + wFlush(); + p_sleep(2); + } + +LOCAL_C VOID DoTest(VOID) + { + MakeButtonDance(); + DisplayQuestion(); + DisplayScores(); + } + +LOCAL_C VOID MainLoop(VOID) + { + INT ret; + WMSG_KEY key; + + FOREVER + { + uGetKey(&key); + if (key.keycode&W_EVENT_KEY) + { + if (key.keycode==CONS_EVENT_COMMAND) + ExitApplication(); + } + else if (key.keycode&W_SPECIAL_KEY) + TryExecuteCommand(key.keycode&(~W_SPECIAL_KEY)); + else if (key.keycode==W_KEY_MENU && !(key.modifiers&W_CTRL_MODIFIER)) + { + ret=uPresentMenus(); + if (ret>0) + TryExecuteCommand(ret); + } + else if (key.keycode==W_KEY_RETURN) + DoTest(); + } + } + +LOCAL_C VOID ReadState(VOID) + { + INT len; + UBYTE buf[P_ENVMAX]; + + len=p_getenviron(EnvName,ENV_NAME_LEN,&buf[0]); + if (len<0 || len!=sizeof(TSTATE)) + return; + p_bcpy(&state,&buf[0],sizeof(TSTATE)); + } + +LOCAL_C VOID InitSeed(VOID) + { + seed=p_date(); + } + +LOCAL_C VOID ReduceScreenSize(VOID) + { + W_WINDATA wd; + + wd.extent.tl.x=wd.extent.tl.y=0; + wd.extent.width=189; + wd.extent.height=100; + wSetWindow(MainWid,W_WIN_EXTENT,&wd); + if (uErrorValue(wCheckPoint())) + p_exit(0); + } + +LOCAL_C VOID CreateGC(VOID) + { + INT hgc; + + hgc=gCreateGC0(uFindMainWid()); + if (hgc<0) + p_exit(hgc); + } + +LOCAL_C VOID SpecificInit(VOID) + { + uEscape(FALSE); + hCrackCommandLine(); + MainWid=uFindMainWid(); + ReduceScreenSize(); + CreateGC(); + gBorder(W_BORD_CORNER_4); + wsEnable(); + ReadState(); + Display(); + InitSeed(); + p_open(&timH,"TIM:",-1); + } + +GLREF_D UWORD _UseFullScreen; + +GLDEF_C VOID main(VOID) + { + _UseFullScreen=TRUE; + uCommonInit(); + SpecificInit(); + MainLoop(); + } diff --git a/code/SIBOSDK/wkdemo/tables.pr b/code/SIBOSDK/wkdemo/tables.pr new file mode 100644 index 0000000..408c49b --- /dev/null +++ b/code/SIBOSDK/wkdemo/tables.pr @@ -0,0 +1,6 @@ +#system epoc img +#set epocinit=iplib +#model small jpi +#compile %main +#pragma link(hwif.lib) +#link %main diff --git a/code/SIBOSDK/wkdemo/vid.bat b/code/SIBOSDK/wkdemo/vid.bat new file mode 100644 index 0000000..4ccb4d5 --- /dev/null +++ b/code/SIBOSDK/wkdemo/vid.bat @@ -0,0 +1,22 @@ +@echo off +goto X%1X +:Xv0X +:XoffX +set jpivid=v0 +echo VID is now OFF +goto :end +:Xv2X +:XonX +set jpivid=v2 +echo VID is now ON +goto :end +:XX +call checkvid +goto %jpivid% +:v0 +echo VID is OFF +goto end +:v2 +echo VID is ON +:end +