1 unit smapi;
2 
3 interface
4 
5 uses gpcstrings;
6 {$define pack4}
7 {$packrecords 1}
8 const
9  MSGAREA_NORMAL:word=0;
10  MSGAREA_CREATE:word=1;
11  MSGAREA_CRIFNEC:word=2;
12  UID_EXACT:word=0;
13  UID_NEXT:word=1;
14  UID_PREV:word=2;
15 
16  MSGTYPE_SDM:word=1;
17  MSGTYPE_SQUISH:word=2;
18  MSGTYPE_ECHO:word=$80;
19 
20  MOPEN_CREATE:word=0;
21  MOPEN_READ:word=1;
22  MOPEN_WRITE:word=2;
23  MOPEN_RW:word=3;
24 
25 {$ifdef LINUX}
26   {$linklib smapi}
27   { $linklib gcc}
28   {$linklib c}
29 {$endif}
30 
31 {$ifdef GO32V2}
32   {$linklib smapidjp}
33   {$linklib c}
34 {$endif}
35 
36 const
37  msgid=$0201414;
38 
39  {_XMSG.ATTR}
40  MSGPRIVATE =01;
41  MSGCRASH   =$02;
42  MSGREAD    =$04;
43  MSGSENT    =$08;
44  MSGFILE    =$10;
45  MSGFWD     =$20;
46  MSGORPHAN  =$40;
47  MSGKILL    =$80;
48  MSGLOCAL   =$100;
49  MSGHOLD    =$200;
50  MSGXX2     =$400;
51  MSGFRQ     =$800;
52  MSGRRQ     =$1000;
53  MSGCPT     =$2000;
54  MSGARQ     =$4000;
55  MSGURQ     =$8000;
56  MSGSCANNED =$10000;
57 
58 
59 type
60  array035=array[0..35] of char;
61  p_netaddr=^netaddr;
62  netaddr=record
63            zone,net,node,point:word;
64           end;
65  pxmsg=^_xmsg;
66  _xmsg=record
67     attr:longint;
68     fromname:array035;
69     toname:array035;
70     subj:array[0..71] of char;
71     orig,dest:netaddr;
72     date_written,date_arrived:record
73          date:word;
74          {$ifdef pack4} timedummy:word; {$endif}
75          time:word;
76          {$ifdef pack4} datedummy:word; {$endif}
77     end;
78     {$ifdef pack4} timedummy2:word; {$endif}
79     utc_ofs:integer;
80     replyto:longint;
81     replies:array[0..9] of longint;
82     umsgid:longint;
83     __ftsc_date:array[0..19] of char;
84    end;
85  p_minf=^_minf;
86  _minf=record
87        req_version,def_zone,havesahre:word;
88       end;
89 
90  phmsg=^hmsg;
91  hmsg=record
92        sq:pointer;
93        id:longint;
94        bytes_written:longint;
95        cur_pos:longint;
96       end;
97 
98  pfkt=^fkt;
99  pharea=^harea;
100 
101  fkt=record
hnull102        CloseArea:function(mh:pharea):byte;cdecl;
103            {sword(EXPENTRY * CloseArea) (MSG * mh);}
104 
hnull105        OpenMsg:function(mh:pharea;mode:word;n:longint):phmsg;cdecl;
106            { MSGH *(EXPENTRY * OpenMsg) (MSG * mh, word mode, dword n);}
107 
hnull108        CloseMsg:function(mh:phmsg):integer;cdecl;
109            {sword(EXPENTRY * CloseMsg) (MSGH * msgh);}
110 
hnull111        ReadMsg:function(mh:phmsg;XMSG:PXMSG;ofs:longint;bytes:longint;text:pchar;cbyt:longint;ctxt:pchar):longint;cdecl;
112            {dword(EXPENTRY * ReadMsg) (MSGH * msgh, XMSG * msg, dword ofs, dword bytes, byte * text, dword cbyt, byte * ctxt);}
113 
hnull114        WriteMsg:function(mh:phmsg;appending:word;xmsg:pxmsg;text:pchar;textlen:longint;totlen:longint;clen:longint;ctxt:pchar):longint;cdecl;
115           {sword(EXPENTRY * WriteMsg) (MSGH * msgh, word append, XMSG * msg, byte * text, dword textlen, dword totlen, dword clen, byte * ctxt);}
116 
hnull117        KillMsg:function(mh:pharea;msgnum:longint):byte;cdecl;
118           {sword(EXPENTRY * KillMsg) (MSG * mh, dword msgnum);}
119 
hnull120        Lock:function(mh:pharea):byte;cdecl;
121           {sword(EXPENTRY * Lock) (MSG * mh);}
122 
hnull123        Unlock:function(mh:pharea):byte;cdecl;
124           {sword(EXPENTRY * Unlock) (MSG * mh);}
125 
hnull126        SetCurpos:function(mh:phmsg;pos:longint):byte;cdecl;
127           {sword(EXPENTRY * SetCurPos) (MSGH * msgh, dword pos);}
128 
hnull129        GetCurpos:function(mh:phmsg):longint;cdecl;
130           {dword(EXPENTRY * GetCurPos) (MSGH * msgh);}
131 
hnull132        MsgnToUid:function(mh:pharea;msgnum:longint):longint;cdecl;
133           {UMSGID(EXPENTRY * MsgnToUid) (MSG * mh, dword msgnum);}
134 
hnull135        UidToMsgn:function(mh:pharea;umsgid:longint;type_:word):longint;cdecl;
136           {dword(EXPENTRY * UidToMsgn) (MSG * mh, UMSGID umsgid, word type);}
137 
hnull138        GetHighWater:function(mh:pharea):longint;cdecl;
139           {dword(EXPENTRY * GetHighWater) (MSG * mh);}
140 
hnull141        SetHighWater:function(mh:pharea;hwm:longint):byte;cdecl;
142           {sword(EXPENTRY * SetHighWater) (MSG * mh, dword hwm);}
143 
sghnull144        GetTextLen:function(msgh:phmsg):longint;cdecl;
145           {dword(EXPENTRY * GetTextLen) (MSGH * msgh);}
146 
sghnull147        GetCtrlLen:function(msgh:phmsg):longint;cdecl;
148           {dword(EXPENTRY * GetCtrlLen) (MSGH * msgh);}
149      end;
150  harea=record
151        id:longint;
152        len:word;
153        type_:word;
154        num_msg:longint;
155        cur_msg:longint;
156        high_msg:longint;
157        high_water:longint;
158        sz_xmsg:word;
159 {       locked:byte;
160        isecho:byte; }
161        mix:word;
162        f:pfkt;
163 
164        apidata:pointer;
165         dummy:array[1..20000] of char; {very bad}
166       end;
167 
MsgOpenApinull168 function MsgOpenApi(_minf:p_minf):byte; cdecl; {return 0 if OK}
MsgCloseApinull169 function MsgCloseApi:byte;cdecl;
170 
MsgOpenAreanull171 function MsgOpenArea(name:pchar;mode:word;AreaType:word):pharea;cdecl;
InvalidMsghnull172 function InvalidMsgh(hmsg:phmsg):boolean;cdecl;
InvalidMhnull173 function InvalidMh(HAREA:pharea):boolean;cdecl;
MsgOpenMsgnull174 function MsgOpenMsg(h:pharea;mode:word;msgn:longint):phmsg;cdecl;
MsgReadMsgnull175 function MsgReadMsg(p:phmsg;ofs:longint;bytes:longint;text:pchar;cbtye:longint;ctext:pchar):longint;cdecl;
MsgValidatenull176 function MsgValidate(type_:word;name:pchar):byte;cdecl;
177          {sword EXPENTRY MsgValidate(word type, byte * name);}
178 
179 {function MsgGetCurMsg(HAREA:pharea):longint;
180 function MsgGetNumMsg(HAREA:pharea):longint;
181 function MsgGetHighMsg(HAREA:pharea):longint;
182 byte *EXPENTRY CvtCtrlToKludge(byte * ctrl);
183 byte *EXPENTRY GetCtrlToken(byte * where, byte * what);
184 byte *EXPENTRY CopyToControlBuf(byte * txt, byte ** newtext, unsigned *length);
185 word EXPENTRY NumKludges(char *txt);
186                                             }
187 {function RemoveFromCtrl(ctrl:pchar;what:pchar);cdecl;
188 function ConvertControlInfo(ctrl:pchar;orig:p_netaddr;dest:p_netaddr);cdecl;}
189 
190 
191 implementation
192 const
193    RCSID: PChar = '$Id$';
194 
195 {var
196  _msgapierror:word;external;}
197 {function RemoveFromCtrl(ctrl:pchar;what:pchar);cdecl;external;
198 function ConvertControlInfo(ctrl:pchar;orig:p_netaddr;dest:p_netaddr);cdecl;external;}
199 
MsgOpenApinull200 function MsgOpenApi(_minf:p_minf):byte; cdecl; external;
MsgCloseApinull201 function MsgCloseApi:byte;cdecl; external;
202 
MsgOpenAreanull203 function MsgOpenArea(name:pchar;mode:word;AreaType:word):pharea;cdecl; external;
204 
InvalidMhnull205 function InvalidMh(HAREA:pharea):boolean;cdecl;external;
InvalidMsghnull206 function InvalidMsgh(hmsg:phmsg):boolean;cdecl;external;
MsgOpenMsgnull207 function MsgOpenMsg(h:pharea;mode:word;msgn:longint):phmsg;cdecl;external;
MsgReadMsgnull208 function MsgReadMsg(p:phmsg;ofs:longint;bytes:longint;text:pchar;cbtye:longint;ctext:pchar):longint;cdecl;external;
MsgValidatenull209 function MsgValidate(type_:word;name:pchar):byte;cdecl;external;
210 {
211 function MsgGetCurMsg(HAREA:pharea):longint;
212 begin
213  MsgGetCurMsg:=HAREA^.cur_msg;
214 end;
215 
216 function MsgGetNumMsg(HAREA:pharea):longint;
217 begin
218  MsgGetNumMsg:=HAREA^.num_msg;
219 end;
220 
221 function MsgGetHighMsg(HAREA:pharea):longint;
222 begin
223  MsgGetHighMsg:=HAREA^.high_msg;
224 end;
225  }
226 
227 end.
228