home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / samtexco.zip / imlsmp01.h < prev    next >
C/C++ Source or Header  |  2000-03-31  |  11KB  |  207 lines

  1. /*====================================================================*/
  2. /*                                                                    */
  3. /*  IBM Text Search API Sample Definitions                            */
  4. /*                                                                    */
  5. /*====================================================================*/
  6. /*                                                                    */
  7. /*  Name:               ehwsmp01.h                                    */
  8. /*  -----                                                             */
  9. /*                                                                    */
  10. /*  COPYRIGHT:                                                        */
  11. /*  ----------                                                        */
  12. /*   Digital Library Version 2 - 5648-A08.                            */
  13. /*   (C) Copyright IBM Corp. 1996.                                    */
  14. /*       All Rights Reserved                                          */
  15. /*   US Government Users Restricted Rights                            */
  16. /*   Use, duplication or disclosure restricted                        */
  17. /*        by GSA ADP Schedule                                         */
  18. /*   Contract with IBM Corp.                                          */
  19. /*   Licensed Materials - Property of IBM                             */
  20. /*                                                                    */
  21. /*  DISCLAIMER OF WARRANTIES:                                         */
  22. /*  -------------------------                                         */
  23. /*   The following [enclosed] code is sample code created by IBM      */
  24. /*   Corporation. This sample code is not part of any standard IBM    */
  25. /*   product and is provided to you solely for the purpose of         */
  26. /*   assisting you in the development of your applications.           */
  27. /*   The code is provided "AS IS", without warranty of any kind.      */
  28. /*   IBM shall not be liable for any damages arising out of your      */
  29. /*   use of the sample code, even if they have been advised of the    */
  30. /*   possibility of such damages.                                     */
  31. /*                                                                    */
  32. /*====================================================================*/
  33.  
  34. /*====================================================================*/
  35. /*  ehwsmp01.h (Include file for API sample applications              */
  36. /*             ehwsmp01.c ehwsmp02.c                                  */
  37. /*====================================================================*/
  38.  
  39. #if !defined(SMPAPIH_DEFINED)          /* already included  ?         */
  40. #define SMPAPIH_DEFINED                /* no !                        */
  41.  
  42. /*--------------------------------------------------------------------*/
  43. /*  Extension API definitions                                         */
  44. /*--------------------------------------------------------------------*/
  45. typedef  PCHAR              *PPCHAR;   /* pointer to CHAR pointer     */
  46. typedef  struct Data_Item    ITEM;     /* datastream item structure   */
  47. typedef  ITEM               *PITEM;    /* pointer to datastream item  */
  48.  
  49. /*--------------------------------------------------------------------*/
  50. /*  processing control definitions                                    */
  51. /*--------------------------------------------------------------------*/
  52.                                        /* function status code:       */
  53. #define  RC_FALSE                 0    /* function failed             */
  54. #define  RC_TRUE                  1    /* function succeeded          */
  55.  
  56. #define  SIZEOF_DATA_AREA    0x7fff    /* sizeof of work buffer       */
  57.                                        /* definition for the session: */
  58.                                        /* IRSL_LOCAL / IRSL_REMOTE    */
  59. #define  START_INDEXING           1    /* function start indexing     */
  60. #define  START_REORGANIZING       2    /* function start reorganizatio*/
  61. #define  SESSION_IRSL   IRSL_LOCAL     /* requested server location   */
  62.                                        /* definition for the queries: */
  63. #define  QUERY_CCSID    CCSID_00850    /* -- coded character set id   */
  64. #define  QUERY_LANG     LANG_ENU       /* -- language identifier      */
  65. #define  QUERY_WORD01   "compete"       /* -- word 1                   */
  66. #define  QUERY_WORD02   "application"   /* -- word 2                   */
  67. /*--------------------------------------------------------------------*/
  68. /*  Limits                                                            */
  69. /*--------------------------------------------------------------------*/
  70.                                        /* index table  definition:    */
  71. #define  LT_NUMBER_OF_INDEXES    10    /* maximum number of indexes   */
  72.                                        /* must be greater than zero   */
  73.                                        /* index info. definition:     */
  74. #define  LT_NUMBER_OF_RESULTS    10    /* maximum number of results   */
  75.                                        /* index info. definition:     */
  76. #define  LT_SIZEOF_LSCE_ITEM     40    /* maximum LSCE item length    */
  77.                                        /* must be greater than zero   */
  78.                                        /* result info. definition:    */
  79. #define  LT_RESULT_DOCUMENTS     30    /* maximum number of document  */
  80.                                        /* pointers in result info.    */
  81. #define  INDEXING_LIMIT           1    /* number of indexing requests */
  82.                                        /* on the indexing queue to    */
  83.                                        /* trigger the start indexing  */
  84. /*--------------------------------------------------------------------*/
  85. /*  macro definitions                                                 */
  86. /*--------------------------------------------------------------------*/
  87. /*--------------------------------------------------------------------*/
  88. /*  structure definitions                                             */
  89. /*--------------------------------------------------------------------*/
  90. typedef
  91. struct DataList                        /* chaining data structure     */
  92.   {
  93.   struct
  94.   DataList        *pNextData;          /* pointer to next data block  */
  95.   ULONG            ulDataLength;       /* length of current data blk  */
  96.   UCHAR            Data[1];            /* current block of data       */
  97.                                        /* in datastream format        */
  98.   }
  99.   LIST, *PLIST;
  100.  
  101. typedef
  102. struct ResultInfo                      /* result information          */
  103.   {
  104.   UCHAR            Header[8];          /* header text                 */
  105.   ULONG            ulInfoLength;       /* result information length   */
  106.   ULONG            ulHandle;           /* result handle               */
  107.   ULONG            ulSize;             /* result size                 */
  108.   ULONG            ulDataLength;       /* length of result datastream */
  109.   PLIST            pData;              /* result list datastream ptr  */
  110.   ULONG            ulDocumentCount;    /* number of document item ptr */
  111.   PITEM            pDocument[1];       /* pointer to document item    */
  112.   }
  113.   RESULT, *PRESULT;
  114.  
  115. typedef
  116. struct IndexInfo                       /* index information           */
  117.   {
  118.   UCHAR            Header[8];          /* header text                 */
  119.   ULONG            ulInfoLength;       /* length of index information */
  120.   ULONG            ulHandle;           /* index handle                */
  121.   UCHAR            Type;               /* index type                  */
  122.   UCHAR            Property;           /* index property              */
  123.   PITEM            pName;              /* pointer to index name item  */
  124.   PITEM            pDLLcl;             /* pointer to LS DLL item      */
  125.   PITEM            pDLLsrv;            /* pointer to LS DLL item      */
  126.   PRESULT          pResult;            /* recent result info. pointer */
  127.   ULONG            ulDataLength;       /* length of detail datastream */
  128.   UCHAR            Data[1];            /* index detail datastream     */
  129.   }
  130.   INDEX, *PINDEX, **PPINDEX;
  131.  
  132. typedef
  133. struct IndexTable                      /* index table                 */
  134.   {
  135.   UCHAR            Header[8];          /* header text                 */
  136.   ULONG            ulTableLength;      /* total length of table       */
  137.   USHORT           usIndexSlots;       /* total number of index slots */
  138.   USHORT           usIndexCount;       /* number of used index slots  */
  139.   PINDEX           pIndex[1];          /* index information entries   */
  140.   }
  141.   XTBL, *PXTBL;
  142.  
  143. typedef
  144. struct ServerInfo                      /* server information struct.  */
  145.   {
  146.   PVOID            pSession;           /* session pointer             */
  147.   PXTBL            pIndexTable;        /* index table pointer         */
  148.   UCHAR            Location;           /* server location             */
  149.   USHORT           usNameLength;       /* length of server name       */
  150.   UCHAR            Name[1];            /* server name                 */
  151.   }
  152.   SERVER, *PSERVER;
  153.  
  154. typedef
  155. struct ServerTable                     /* server table                */
  156.   {
  157.   UCHAR            Header[8];          /* header text                 */
  158.   ULONG            ulTableLength;      /* total length of table       */
  159.   USHORT           usServerCount;      /* number of table entries     */
  160.   SERVER           Server[1];          /* server table entries ...    */
  161.   }
  162.   SRVTBL, *PSRVTBL;
  163.  
  164. /*--------------------------------------------------------------------*/
  165. /*  function calls                                                    */
  166. /*--------------------------------------------------------------------*/
  167. static
  168. INT      WriteDataItem  (USHORT         usItemId,
  169.                          UCHAR          ItemType,
  170.                          USHORT         usValueLength,
  171.                          PCHAR          pValue,
  172.                          PULONG         pulAreaLength,
  173.                          PPCHAR         ppArea
  174.                         );
  175. static
  176. INT      ListServers    (SRVTBL       **ppServer);
  177.  
  178. static
  179. INT      ListIndexes    (PVOID          pSession,
  180.                          XTBL         **ppIndexTable
  181.                         );
  182. static
  183. INT      OpenIndex      (PVOID          pSession,
  184.                          INDEX        **ppIndex
  185.                         );
  186. static
  187. INT      ListResult     (PVOID          pSession,
  188.                          ULONG          ulResultHandle,
  189.                          ULONG          ulResultSize,
  190.                          ULONG          ulReferenceLimit,
  191.                          PINDEX         pIndex
  192.                         );
  193. static
  194. INT      DeleteResult   (PVOID          pSession,
  195.                          PINDEX         pIndex
  196.                         );
  197.  
  198. static
  199. VOID     HandleError    (PSRVTBL        pServerTable,
  200.                          PCHAR          pArea
  201.                         );
  202.  
  203. #endif                                 /* end of include switch       */
  204.  
  205. /*====================================================================*/
  206.  
  207.