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

  1.  
  2. /*====================================================================*/
  3. /*                                                                    */
  4. /*  SearchManager API Sample Definitions                              */
  5. /*                                                                    */
  6. /*====================================================================*/
  7. /*                                                                    */
  8. /*  Name:               SMPAPIH2.H                                    */
  9. /*  -----                                                             */
  10. /*                                                                    */
  11. /*  COPYRIGHT:                                                        */
  12. /*  ----------                                                        */
  13. /*   Copyright (C) International Business Machines Corp., 1993        */
  14. /*                                                                    */
  15. /*  DISCLAIMER OF WARRANTIES:                                         */
  16. /*  -------------------------                                         */
  17. /*   The following [enclosed] code is sample code created by IBM      */
  18. /*   Corporation. This sample code is not part of any standard IBM    */
  19. /*   product and is provided to you solely for the purpose of         */
  20. /*   assisting you in the development of your applications.           */
  21. /*   The code is provided "AS IS", without warranty of any kind.      */
  22. /*   IBM shall not be liable for any damages arising out of your      */
  23. /*   use of the sample code, even if they have been advised of the    */
  24. /*   possibility of such damages.                                     */
  25. /*                                                                    */
  26. /*====================================================================*/
  27.  
  28. /*====================================================================*/
  29. /*  smpapih2.h  (Include file for API sample application smpapia2.c)  */
  30. /*====================================================================*/
  31.  
  32. #if !defined(SMPAPIH_DEFINED)          /* already included  ?         */
  33. #define SMPAPIH_DEFINED                /* no !                        */
  34.  
  35. /*--------------------------------------------------------------------*/
  36. /*  Extension of OS/2 and API definitions                             */
  37. /*--------------------------------------------------------------------*/
  38. typedef  PCHAR              *PPCHAR;   /* pointer to CHAR pointer     */
  39. typedef  struct Data_Item    ITEM;     /* datastream item structure   */
  40. typedef  ITEM               *PITEM;    /* pointer to datastream item  */
  41.  
  42. /*--------------------------------------------------------------------*/
  43. /*  processing control definitions                                    */
  44. /*--------------------------------------------------------------------*/
  45.                                        /* function status code:       */
  46. #define  RC_FALSE                 0    /* function failed             */
  47. #define  RC_TRUE                  1    /* function succeeded          */
  48.  
  49. #define  SIZEOF_DATA_AREA    0x7fff    /* sizeof of work buffer       */
  50.                                        /* definition for the session: */
  51.                                        /* IRSL_LOCAL / IRSL_REMOTE    */
  52. #define  SESSION_IRSL   IRSL_LOCAL     /* requested server location   */
  53.                                        /* definition for the queries: */
  54. #define  QUERY_CCSID    CCSID_00850    /* -- coded character set id   */
  55. #define  QUERY_LANG     LANG_ENU       /* -- language id for English  */
  56. #define  QUERY_WORD01   "Suchbegriff"  /* -- word 1                   */
  57. #define  QUERY_WORD02   "timestamp"    /* -- word 2                   */
  58.  
  59. /*--------------------------------------------------------------------*/
  60. /*  Limits                                                            */
  61. /*--------------------------------------------------------------------*/
  62.                                        /* index table  definition:    */
  63. #define  LT_NUMBER_OF_INDEXES    10    /* maximum number of indexes   */
  64.                                        /* must be greater than zero   */
  65. #define  LT_NUMBER_OF_RESULTS    10    /* maximum number of results   */
  66.                                        /* index info. definition:     */
  67. #define  LT_SIZEOF_LSCE_ITEM     40    /* maximum length of client    */
  68.                                        /* library services executable */
  69.                                        /* result info. definition:    */
  70. #define  LT_RESULT_DOCUMENTS     30    /* maximum number of documents */
  71.                                        /* pointers in result info.    */
  72.  
  73. /*--------------------------------------------------------------------*/
  74. /*  macro definitions                                                 */
  75. /*--------------------------------------------------------------------*/
  76. /*--------------------------------------------------------------------*/
  77. /*  structure definitions                                             */
  78. /*--------------------------------------------------------------------*/
  79. typedef
  80. struct DataList                        /* chaining data structure     */
  81.   {
  82.   struct
  83.   DataList        *pNextData;          /* pointer to next data block  */
  84.   ULONG            ulDataLength;       /* length of current data blk  */
  85.   UCHAR            Data[1];            /* current block of data       */
  86.                                        /* in datastream format        */
  87.   }
  88.   LIST, *PLIST;
  89.  
  90. typedef
  91. struct DocumentInfo                    /* document information        */
  92.   {
  93.   PITEM            pIndex;             /* pointer to index item       */
  94.   PITEM            pDocument;          /* pointer to document item    */
  95.   PITEM            pRankValue;         /* pointer to rank value item  */
  96.   PITEM            pWordCount;         /* pointer to number of words  */
  97.   PITEM            pRankCount;         /* pointer to rank count item  */
  98.   }
  99. #ifndef _WIN32
  100.   DOCINFO, *PDOCINFO;
  101. #else
  102.   *PDOCINFO;
  103. #endif
  104.  
  105. typedef
  106. struct ResultInfo                      /* result information          */
  107.   {
  108.   UCHAR            Header[8];          /* header text                 */
  109.   ULONG            ulInfoLength;       /* result information length   */
  110.   ULONG            ulHandle;           /* result handle               */
  111.   ULONG            ulSize;             /* result size                 */
  112.   ULONG            ulDataLength;       /* length of result datastream */
  113.   PLIST            pData;              /* result list datastream ptr  */
  114.   ULONG            ulDocumentCount;    /* number of document item ptr */
  115.   PDOCINFO         pDocumentInfo;      /* index/document items        */
  116.   }
  117.   RESULT, *PRESULT, **PPRESULT;
  118.  
  119. typedef
  120. struct IndexInfo                       /* index information           */
  121.   {
  122.   UCHAR            Header[8];          /* header text                 */
  123.   ULONG            ulInfoLength;       /* length of index information */
  124.   ULONG            ulHandle;           /* index handle                */
  125.   UCHAR            Type;               /* index type                  */
  126.   UCHAR            Property;           /* index property              */
  127.   PITEM            pName;              /* pointer to index name item  */
  128.   PITEM            pDLL;               /* pointer to LS DLL item      */
  129.   ULONG            ulDataLength;       /* length of detail datastream */
  130.   UCHAR            Data[1];            /* index detail datastream     */
  131.   }
  132.   INDEX, *PINDEX, **PPINDEX;
  133.  
  134. typedef
  135. struct IndexTable                      /* index table                 */
  136.   {
  137.   UCHAR            Header[8];          /* header text                 */
  138.   ULONG            ulTableLength;      /* total length of table       */
  139.   USHORT           usIndexSlots;       /* total number of index slots */
  140.   USHORT           usIndexCount;       /* number of used index slots  */
  141.   USHORT           usResultCount;      /* number of used result slots */
  142.                                        /* ptrs to result datastreams  */
  143.   PRESULT          pResult[LT_NUMBER_OF_RESULTS];
  144.   PINDEX           pIndex[1];          /* index information entries   */
  145.   }
  146.   XTBL, *PXTBL;
  147.  
  148. typedef
  149. struct GroupTable                      /* index group table           */
  150.   {
  151.   UCHAR            Header[8];          /* header text                 */
  152.   ULONG            ulTableLength;      /* total length of table       */
  153.   USHORT           usHandleSlots;      /* total number of handle slots*/
  154.   USHORT           usHandleCount;      /* number of used handle slots */
  155.   ULONG            ulHandle[1];        /* index handle entries        */
  156.   }
  157.   HTBL, *PHTBL;
  158.  
  159. typedef
  160. struct ServerInfo                      /* server information struct.  */
  161.   {
  162.   PVOID            pSession;           /* session pointer             */
  163.   PXTBL            pIndexTable;        /* index table pointer         */
  164.   PHTBL            pGroupTable;        /* index group table pointer   */
  165.   UCHAR            Location;           /* server location             */
  166.   USHORT           usNameLength;       /* length of server name       */
  167.   UCHAR            Name[1];            /* server name                 */
  168.   }
  169.   SERV, *PSERVER;
  170.  
  171. typedef
  172. struct ServerTable                     /* server table                */
  173.   {
  174.   UCHAR            Header[8];          /* header text                 */
  175.   ULONG            ulTableLength;      /* total length of table       */
  176.   USHORT           usServerCount;      /* number of table entries     */
  177.   SERV           Server[1];          /* server table entries ...    */
  178.   }
  179.   SRVTBL, *PSRVTBL;
  180.  
  181. typedef
  182. struct IndexProblem                    /* index problem info          */
  183.   {
  184.   PCHAR            IndexName;          /* Index Name                  */
  185.   USHORT           usProblemRc;        /* return code                 */
  186.   }
  187.   INDEXPBL, *PINDEXPBL;
  188.  
  189. typedef
  190. struct IndexProblemTable               /* index problem table         */
  191.   {
  192.   UCHAR            Header[8];          /* header text                 */
  193.   ULONG            ulTableLength;      /* total length of table       */
  194.   USHORT           usTableEntries;     /* number of table entries     */
  195.   INDEXPBL         IdxProblem[1];      /* index problem entries...    */
  196.   }
  197.   PBLTBL, *PPBLTBL;
  198.  
  199. /*--------------------------------------------------------------------*/
  200. /*  function calls                                                    */
  201. /*--------------------------------------------------------------------*/
  202. static
  203. INT      WriteDataItem      (USHORT         usItemId,
  204.                              UCHAR          ItemType,
  205.                              USHORT         usValueLength,
  206.                              PCHAR          pValue,
  207.                              PULONG         pulAreaLength,
  208.                              PPCHAR         ppArea
  209.                             );
  210. static
  211. INT      ListServers        (SRVTBL       **ppServer);
  212.  
  213. static
  214. INT      ListIndexes        (PVOID          pSession,
  215.                              XTBL         **ppIndexTable
  216.                             );
  217. static
  218. INT      OpenIndex          (PVOID          pSession,
  219.                              INDEX        **ppIndex
  220.                             );
  221. static
  222. INT      ListResult         (PVOID          pSession,
  223.                              ULONG          ulResultHandle,
  224.                              ULONG          ulResultSize,
  225.                              ULONG          ulReferenceLimit,
  226.                              PXTBL          pIndexTable
  227.                             );
  228. static
  229. INT      DeleteResults       (PVOID         pSession,
  230.                               ULONG         ulResultHandle,
  231.                               PXTBL         pIndexTable
  232.                              );
  233.  
  234. static
  235. INT      GetProblemInfo      (PVOID         pSession,
  236.                               ULONG         ulResultHandle,
  237.                               PPBLTBL      *pProblemInfo
  238.                              );
  239.  
  240. static
  241. VOID     HandleExit          (PSRVTBL        pServerTable,
  242.                               PCHAR          pArea
  243.                              );
  244.  
  245. #endif                                 /* end of include switch       */
  246.  
  247. /*====================================================================*/
  248.  
  249.