build: add the SIBO SDK
This commit is contained in:
Binary file not shown.
@@ -0,0 +1,94 @@
|
||||
/*
|
||||
TXTREAD.C
|
||||
*/
|
||||
|
||||
#include <p_std.h>
|
||||
#include <p_file.h>
|
||||
#include <wl$txt.g>
|
||||
#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);
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
TXTWRITE.C
|
||||
*/
|
||||
|
||||
#include <p_std.h>
|
||||
#include <p_file.h>
|
||||
#include <ws$txt.g>
|
||||
#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;p<pe;p++)
|
||||
{
|
||||
if (!*p)
|
||||
*p=CHAR_CR;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma METHOD_CALL
|
||||
|
||||
METHOD VOID txtsave_ao_init(PR_TXTSAVE *self)
|
||||
{
|
||||
OpenFile(self);
|
||||
self->txtsave.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.curtag<self->txtsave.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);
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -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
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,82 @@
|
||||
/*
|
||||
WPFCONV.H
|
||||
|
||||
Public word processor structures and prototypes for file conversion DYL code.
|
||||
*/
|
||||
|
||||
#ifndef SCRLAY_G
|
||||
#include <scrlay.g>
|
||||
#endif
|
||||
#ifndef PRINTER_G
|
||||
#include <printer.g>
|
||||
#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 *);
|
||||
@@ -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];
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user