home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 2 BBS / 02-BBS.zip / msgapi38.zip / INCLUDE / API_SQP.H < prev    next >
Text File  |  1991-11-16  |  6KB  |  107 lines

  1. /***************************************************************************
  2.  *                                                                         *
  3.  *  MSGAPI Source Code, Version 2.00                                       *
  4.  *  Copyright 1989-1991 by Scott J. Dudley.  All rights reserved.          *
  5.  *                                                                         *
  6.  *  Private include file for API_SQ.C                                      *
  7.  *                                                                         *
  8.  *  For complete details of the licensing restrictions, please refer to    *
  9.  *  the licence agreement, which is published in its entirety in           *
  10.  *  README.1ST.                                                            *
  11.  *                                                                         *
  12.  *  USE OF THIS FILE IS SUBJECT TO THE RESTRICTIONS CONTAINED IN THE       *
  13.  *  MSGAPI LICENSING AGREEMENT.  IF YOU DO NOT FIND THE TEXT OF THIS       *
  14.  *  AGREEMENT IN ANY OF THE AFOREMENTIONED FILES, OR IF YOU DO NOT HAVE    *
  15.  *  THESE FILES, YOU SHOULD IMMEDIATELY CONTACT THE AUTHOR AT ONE OF THE   *
  16.  *  ADDRESSES LISTED BELOW.  IN NO EVENT SHOULD YOU PROCEED TO USE THIS    *
  17.  *  FILE WITHOUT HAVING ACCEPTED THE TERMS OF THE MSGAPI LICENSING         *
  18.  *  AGREEMENT, OR SUCH OTHER AGREEMENT AS YOU ARE ABLE TO REACH WITH THE   *
  19.  *  AUTHOR.                                                                *
  20.  *                                                                         *
  21.  *  You can contact the author at one of the address listed below:         *
  22.  *                                                                         *
  23.  *  Scott Dudley           FidoNet  1:249/106                              *
  24.  *  777 Downing St.        Internet f106.n249.z1.fidonet.org               *
  25.  *  Kingston, Ont.         BBS      (613) 389-8315   HST/14.4k, 24hrs      *
  26.  *  Canada - K7M 5N3                                                       *
  27.  *                                                                         *
  28.  ***************************************************************************/
  29.  
  30. /* $Id: api_sqp.h_v 1.0 1991/11/16 16:16:51 sjd Rel sjd $ */
  31.  
  32. static sword EXPENTRY SquishCloseArea(MSG *sq);
  33. static MSGH * EXPENTRY SquishOpenMsg(MSG *sq,word mode,dword msgnum);
  34. static sword EXPENTRY SquishCloseMsg(MSGH *msgh);
  35. static dword EXPENTRY SquishReadMsg(MSGH *msgh,XMSG *msg,dword offset,dword bytes,byte *text,dword clen,byte *ctxt);
  36. static sword EXPENTRY SquishWriteMsg(MSGH *msgh,word append,XMSG *msg,byte *text,dword textlen,dword totlen,dword clen,byte *ctxt);
  37. static sword EXPENTRY SquishKillMsg(MSG *sq,dword msgnum);
  38. static sword EXPENTRY SquishLock(MSG *sq);
  39. static sword EXPENTRY SquishUnlock(MSG *sq);
  40. static sword EXPENTRY SquishSetCurPos(MSGH *msgh,dword pos);
  41. static dword EXPENTRY SquishGetCurPos(MSGH *msgh);
  42. static UMSGID EXPENTRY SquishMsgnToUid(MSG *sq,dword msgnum);
  43. static dword EXPENTRY SquishUidToMsgn(MSG *sq,UMSGID umsgid,word type);
  44. static dword EXPENTRY SquishGetHighWater(MSG *mh);
  45. static sword EXPENTRY SquishSetHighWater(MSG *sq,dword hwm);
  46. static dword EXPENTRY SquishGetTextLen(MSGH *msgh);
  47. static dword EXPENTRY SquishGetCtrlLen(MSGH *msgh);
  48. static sword MSGAPI _OpenSquish(MSG *sq,word *mode);
  49. static SQHDR * MSGAPI _SquishGotoMsg(MSG *sq,dword msgnum,FOFS *seek_frame,SQIDX *idx,word updptrs);
  50. static MSGH * _SquishOpenMsgRead(MSG *sq,word mode,dword msgnum);
  51. static sword MSGAPI _SquishReadHeader(MSG *sq,dword ofs,SQHDR *hdr);
  52. static sword MSGAPI _SquishWriteHeader(MSG *sq,dword ofs,SQHDR *hdr);
  53. static sword MSGAPI _SquishUpdateHeaderNext(MSG *sq,dword ofs,SQHDR *hdr,dword newval);
  54. static sword MSGAPI _SquishUpdateHeaderPrev(MSG *sq,dword ofs,SQHDR *hdr,dword newval);
  55. static sword MSGAPI _SquishWriteSq(MSG *sq);
  56. static sword MSGAPI _SquishUpdateSq(MSG *sq, word force);
  57. static void MSGAPI Init_Hdr(SQHDR *sh);
  58. static void SqbaseToSq(struct _sqbase *sqbase,MSG *sq);
  59. static void SqToSqbase(MSG *sq,struct _sqbase *sqbase);
  60. static sword near AddIndex(MSG *sq,SQIDX *ix,dword msgnum);
  61. static sword near Add_To_Free_Chain(MSG *sq,FOFS killofs,SQHDR *killhdr);
  62. static sword near _SquishReadIndex(MSG *sq);
  63. static sword near _SquishWriteIndex(MSG *sq);
  64. static sword near _SquishGetIdxFrame(MSG *sq,dword num,SQIDX *idx);
  65. static void far * near farmemmove(void far *destin,const void far *source,unsigned n);
  66. static void far * near farmemset(void far *s,int c,size_t length);
  67. static int near _SquishLock(MSG *sq);
  68. static void near _SquishUnlock(MSG *sq);
  69. static sword near _SquishFindFree(MSG *sq, FOFS *this_frame, dword totlen,
  70.                                   dword clen, SQHDR *freehdr,
  71.                                   FOFS *last_frame, SQHDR *lhdr, MSGH *msgh);
  72.  
  73.  
  74. #define fop_wpb (O_CREAT | O_TRUNC | O_RDWR | O_BINARY)
  75. #define fop_rpb (O_RDWR | O_BINARY)
  76.  
  77. #define Sqd ((struct _sqdata *)(sq->apidata))
  78. #define MsghSqd ((struct _sqdata *)(((struct _msgh far *)msgh)->sq->apidata))
  79.  
  80.  
  81. static struct _apifuncs sq_funcs=
  82. {
  83.   SquishCloseArea,
  84.   SquishOpenMsg,
  85.   SquishCloseMsg,
  86.   SquishReadMsg,
  87.   SquishWriteMsg,
  88.   SquishKillMsg,
  89.   SquishLock,
  90.   SquishUnlock,
  91.   SquishSetCurPos,
  92.   SquishGetCurPos,
  93.   SquishMsgnToUid,
  94.   SquishUidToMsgn,
  95.   SquishGetHighWater,
  96.   SquishSetHighWater,
  97.   SquishGetTextLen,
  98.   SquishGetCtrlLen
  99. };
  100.  
  101.  
  102. static byte *ss_sqd="%s.sqd";
  103. static byte *ss_sqi="%s.sqi";
  104.  
  105. static struct _sqdata * _junksq;
  106.  
  107.