Revision: 833 Author: john.boyer@xxxxxxxxxxxxxxxxx Date: Thu Nov 1 18:35:08 2012 Log: adjustments needed for compilation on Windows http://code.google.com/p/liblouis/source/detail?r=833 Modified: /trunk/liblouis/lou_translateString.c /trunk/liblouis/transcommon.ci ======================================= --- /trunk/liblouis/lou_translateString.c Mon Oct 22 06:19:53 2012 +++ /trunk/liblouis/lou_translateString.c Thu Nov 1 18:35:08 2012 @@ -59,17 +59,16 @@ int *inputPos, int *cursorPos, int modex) { return trace_translate (tableList, inbufx, inlen, outbuf, outlen, - typeform, spacing, outputPos, inputPos, cursorPos, - NULL, NULL, modex); + typeform, spacing, outputPos, inputPos, cursorPos, + NULL, NULL, modex); } int -trace_translate (const char *tableList, const widechar* inbufx, - int* inlen, widechar* outbuf, int* outlen, - char* typeform, char* spacing, int* outputPos, - int* inputPos, int* cursorPos, - TranslationTableRule** rules, int* rulesLen, - int modex) +trace_translate (const char *tableList, const widechar * inbufx, + int *inlen, widechar * outbuf, int *outlen, + char *typeform, char *spacing, int *outputPos, + int *inputPos, int *cursorPos, + TranslationTableRule ** rules, int *rulesLen, int modex) { int k; int goodTrans = 1; @@ -161,13 +160,16 @@ memset (destSpacing, '*', destmax); } appliedRulesCount = 0; - if (rules != NULL && rulesLen != NULL) { - appliedRules = rules; - maxAppliedRules = *rulesLen; - } else { - appliedRules = NULL; - maxAppliedRules = 0; - } + if (rules != NULL && rulesLen != NULL) + { + appliedRules = rules; + maxAppliedRules = *rulesLen; + } + else + { + appliedRules = NULL; + maxAppliedRules = 0; + } currentPass = 0; if ((mode & pass1Only)) { @@ -265,37 +267,51 @@ } int EXPORT_CALL -lou_translatePrehyphenated (const char* tableList, - const widechar* inbufx, int* inlen, - widechar* outbuf, int* outlen, - char* typeform, char* spacing, - int* outputPos, int* inputPos, int* cursorPos, - char* inputHyphens, char* outputHyphens, - int modex) { +lou_translatePrehyphenated (const char *tableList, + const widechar * inbufx, int *inlen, + widechar * outbuf, int *outlen, + char *typeform, char *spacing, + int *outputPos, int *inputPos, int *cursorPos, + char *inputHyphens, char *outputHyphens, + int modex) +{ int rv = 1; - int* alloc_inputPos = NULL; - if (inputHyphens != NULL) { + int *alloc_inputPos = NULL; + if (inputHyphens != NULL) + { if (outputHyphens == NULL) - return 0; - if (inputPos == NULL) { - alloc_inputPos = malloc(*outlen * sizeof(int)); - inputPos = alloc_inputPos; }} - if (lou_translate(tableList, inbufx, inlen, outbuf, outlen, typeform, - spacing, outputPos, inputPos, cursorPos, modex)) { - if (inputHyphens != NULL) { - int inpos = 0; - for (int outpos = 0; outpos < *outlen; outpos++) { - int new_inpos = inputPos[outpos]; - if (new_inpos < inpos) { - rv = 0; - break; } - if (new_inpos > inpos) - outputHyphens[outpos] = inputHyphens[new_inpos]; - else - outputHyphens[outpos] = '0'; - inpos = new_inpos; }}} + return 0; + if (inputPos == NULL) + { + alloc_inputPos = malloc (*outlen * sizeof (int)); + inputPos = alloc_inputPos; + } + } + if (lou_translate (tableList, inbufx, inlen, outbuf, outlen, typeform, + spacing, outputPos, inputPos, cursorPos, modex)) + { + if (inputHyphens != NULL) + { + int inpos = 0; + int outpos; + for (outpos = 0; outpos < *outlen; outpos++) + { + int new_inpos = inputPos[outpos]; + if (new_inpos < inpos) + { + rv = 0; + break; + } + if (new_inpos > inpos) + outputHyphens[outpos] = inputHyphens[new_inpos]; + else + outputHyphens[outpos] = '0'; + inpos = new_inpos; + } + } + } if (alloc_inputPos != NULL) - free(alloc_inputPos); + free (alloc_inputPos); return rv; } @@ -1789,7 +1805,7 @@ goto failure; for_selectRule (); if (appliedRules != NULL && appliedRulesCount < maxAppliedRules) - appliedRules[appliedRulesCount++] = transRule; + appliedRules[appliedRulesCount++] = transRule; srcIncremented = 1; prevSrc = src; switch (transOpcode) /*Rules that pre-empt context and swap */ ======================================= --- /trunk/liblouis/transcommon.ci Mon Oct 22 06:19:53 2012 +++ /trunk/liblouis/transcommon.ci Thu Nov 1 18:35:08 2012 @@ -80,7 +80,7 @@ static int *inputPositions; static int cursorPosition; static int cursorStatus; -static TranslationTableRule** appliedRules; +static const TranslationTableRule** appliedRules; static int maxAppliedRules; static int appliedRulesCount; For a description of the software, to download it and links to project pages go to http://www.abilitiessoft.com