|
Has anyone written RPG interfaces for IBM's Linguistic Tools (written in C)? I have interfaced with many C programs (without knowing much C), but I can't seem to figure out how to interface with procedures like the following. What kind of data type is LX_CB_P? I am assuming that it is a C object, but I don't see how to obtain the C object in the first place. There are many other source files that come with IBM's Linguistic Tools and I searched them all looking for a place where LX_CB_P was defined - I found nothing. Any insight is appreciated. /* ================================================================ * * Function Name: SpellVerify * * Description: Verifies spellings in a block of text * * Input Fields: pNLPCB - Pointer to NLP Control Block. The * following fields MUST already be set: * lx_serv_area_p * lx_dict_tkns * lx_dict_tkns_ct * pText - Pointer to null-delimited block of text * * Output Fields: (None) * * Return Value: (None) * * Side Effects: Values set in NLP Control Block * * ================================================================ */ void SpellVerify(LX_CB_P pNLPCB, LX_PUCHAR pText) { LX_ELEMENT DataEle; /* Data Element structure for Poe input */ LX_PUCHAR pReplyArea; /* Dynamically allocated reply area. */ LX_ULONG nElem; /* output element loop counter */ LX_UINT nChar; /* character loop counter */ LX_PELEMENT pCurrEle; /* Used to parse reply area output */ LX_UINT ReplySize; /* Reply area size */ /*----------------------------------------------------------------*/ /* When determining the size of reply area to hold output from */ /* block-format spell verify, allocate an area large enough to */ /* hold at least one LX_ELEMENT structure. Whatever the reply */ /* area size, if a return code of LX_REPLY_FULL is produced, the */ /* application must issue a continue reply to process the rest of */ /* the output. This sample provides a reply area big enough to */ /* hold the result for one hundred words. */ /*----------------------------------------------------------------*/ ReplySize = 100 * sizeof(LX_ELEMENT); pReplyArea = malloc(ReplySize); /* Create data element structure based on input string */ DataEle.lx_data_p = pText; DataEle.lx_data_len = strlen(pText); DataEle.lx_type = LX_TEXT; /* Set up parms in NLP control block */ pNLPCB->lx_rqst_type = LX_NEW_REQ; pNLPCB->lx_func_code = LX_SPELL_VERIFY; pNLPCB->lx_spell_ver_f = LX_TRUE; pNLPCB->lx_art_checker_f = LX_TRUE; #if defined(LX_OS400) || defined(LX_OS390_OE) pNLPCB->lx_num_cpg = LX_CP_LATIN_HOST; #elif defined(LX_AIX) || defined(LX_HPUX) || defined(LX_SUN) || defined(LX_SCO) || defined(LX_SEQUENT) || defined(LX_MONTEREY) || defined(LX_LINUX) pNLPCB->lx_num_cpg = LX_CP_LATIN_ISO; #elif defined(LX_MAC) pNLPCB->lx_num_cpg = LX_CP_LATIN_MAC; #elif defined(LX_OS232) pNLPCB->lx_num_cpg = LX_CP_LATIN_PC; #elif defined(LX_WIN) || defined(LX_WIN32) pNLPCB->lx_num_cpg = LX_CP_LATIN_WIN; #endif pNLPCB->lx_reply_p = pReplyArea; pNLPCB->lx_reply_size = ReplySize; /* Block input format */ pNLPCB->lx_elt_format = LX_BLOCK_FORMAT; pNLPCB->lx_elements_ct = 1; pNLPCB->lx_elements_p = &DataEle; NlpEntry(pNLPCB); printf("Spell verify rc = %d\n", pNLPCB->lx_rc); /* Print data (if any) in reply area */ pCurrEle = (LX_PELEMENT) pReplyArea; for (nElem = 0; nElem < pNLPCB->lx_delivered_out_units; ++nElem) { printf(" %d ", pCurrEle->lx_rc); printf(" %d ", pCurrEle->lx_data_len); for (nChar = 0; nChar < pCurrEle->lx_data_len; ++nChar) printf("%c", pCurrEle->lx_data_p[nChar]); if (pCurrEle->lx_rc == LX_WORD_NOT_FOUND) printf("\t<-- Word not found"); if (pCurrEle->lx_databyte & LX_BAD_PREV) printf("\tLX_BAD_PREV"); if (pCurrEle->lx_databyte & LX_BAD_NEXT) printf("\tLX_BAD_NEXT"); printf("\n"); ++pCurrEle; } free(pReplyArea); pNLPCB->lx_reply_p = NULL; printf("\n"); return; }
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.