diff options
author | Jean-Michel Trivi <jmtrivi@google.com> | 2010-02-09 18:55:56 -0800 |
---|---|---|
committer | Jean-Michel Trivi <jmtrivi@google.com> | 2010-02-09 18:55:56 -0800 |
commit | e9f72c8954f29f10cb4feb16d328a1b5c1fd7169 (patch) | |
tree | 91a67176eca914b3defe801e7fbedf9a594804ba | |
parent | fb6d3dae347f47107e5767f1ec6e87ed0bf9875a (diff) | |
download | external_svox-e9f72c8954f29f10cb4feb16d328a1b5c1fd7169.zip external_svox-e9f72c8954f29f10cb4feb16d328a1b5c1fd7169.tar.gz external_svox-e9f72c8954f29f10cb4feb16d328a1b5c1fd7169.tar.bz2 |
Patch from SVOX: 1.1.0.2 Engine Release
Issues fixed since 1.1.0.0:
- closing tags not interpreted in some cases where enclosed text
contains a smaller-then sign
- Discontinuities in energy transformation
- Lexicon Access: entry with empty phonetic transcription mistaken
as :G2P in seldom cases
-rw-r--r-- | pico/lib/picoacph.c | 4 | ||||
-rw-r--r-- | pico/lib/picoapi.c | 9 | ||||
-rw-r--r-- | pico/lib/picoapi.h | 4 | ||||
-rw-r--r-- | pico/lib/picocep.c | 4 | ||||
-rw-r--r-- | pico/lib/picoctrl.c | 8 | ||||
-rw-r--r-- | pico/lib/picoctrl.h | 2 | ||||
-rw-r--r-- | pico/lib/picodata.c | 2 | ||||
-rw-r--r-- | pico/lib/picodefs.h | 9 | ||||
-rw-r--r-- | pico/lib/picoklex.c | 2 | ||||
-rw-r--r-- | pico/lib/picopam.c | 6 | ||||
-rw-r--r-- | pico/lib/picopr.c | 8 | ||||
-rw-r--r-- | pico/lib/picosa.c | 4 | ||||
-rw-r--r-- | pico/lib/picosig.c | 8 | ||||
-rw-r--r-- | pico/lib/picosig2.c | 68 | ||||
-rw-r--r-- | pico/lib/picosig2.h | 2 | ||||
-rw-r--r-- | pico/lib/picospho.c | 2 | ||||
-rw-r--r-- | pico/lib/picotok.c | 44 | ||||
-rw-r--r-- | pico/lib/picowa.c | 4 |
18 files changed, 118 insertions, 72 deletions
diff --git a/pico/lib/picoacph.c b/pico/lib/picoacph.c index c06e860..d59b03d 100644 --- a/pico/lib/picoacph.c +++ b/pico/lib/picoacph.c @@ -157,7 +157,7 @@ typedef struct acph_subobj { } acph_subobj_t; -static pico_status_t acphInitialize(register picodata_ProcessingUnit this, picoos_int32 r_mode) { +static pico_status_t acphInitialize(register picodata_ProcessingUnit this, picoos_int32 resetMode) { acph_subobj_t * acph; picoos_uint16 i; @@ -193,7 +193,7 @@ static pico_status_t acphInitialize(register picodata_ProcessingUnit this, picoo acph->cbuf[i] = 0; } - if (r_mode == PICO_RESET_SOFT) { + if (resetMode == PICO_RESET_SOFT) { /*following initializations needed only at startup or after a full reset*/ return PICO_OK; } diff --git a/pico/lib/picoapi.c b/pico/lib/picoapi.c index affd780..576100c 100644 --- a/pico/lib/picoapi.c +++ b/pico/lib/picoapi.c @@ -660,7 +660,7 @@ PICO_FUNC pico_getData( /** * pico_resetEngine : Resets the engine * @param engine : pointer to a Pico engine handle - * @param r_mode : reset mode + * @param resetMode : reset mode; one of PICO_RESET_FULL or PICO_RESET_SOFT * @return PICO_OK : successful * @return PICO_ERR_INVALID_HANDLE, PICO_ERR_NULLPTR_ACCESS : errors * @callgraph @@ -668,7 +668,7 @@ PICO_FUNC pico_getData( */ PICO_FUNC pico_resetEngine( pico_Engine engine, - pico_Status r_mode) + pico_Int32 resetMode) { pico_Status status = PICO_OK; @@ -677,10 +677,9 @@ PICO_FUNC pico_resetEngine( } else { picoctrl_engResetExceptionManager((picoctrl_Engine) engine); - if (r_mode<PICO_RESET_FULL) r_mode = PICO_RESET_FULL; - if (r_mode>PICO_RESET_SOFT) r_mode = PICO_RESET_FULL; + resetMode = (PICO_RESET_SOFT == resetMode) ? PICO_RESET_SOFT : PICO_RESET_FULL; - status = picoctrl_engReset((picoctrl_Engine) engine, (picoos_int32)r_mode); + status = picoctrl_engReset((picoctrl_Engine) engine, (picoos_int32)resetMode); } return status; diff --git a/pico/lib/picoapi.h b/pico/lib/picoapi.h index 8a5725b..aa60358 100644 --- a/pico/lib/picoapi.h +++ b/pico/lib/picoapi.h @@ -420,10 +420,12 @@ PICO_FUNC pico_getData( /** Resets the engine and clears all engine-internal buffers, in particular text input and signal data output buffers. + 'resetMode' is one of 'PICO_RESET_SOFT', to be used to flush the engine, + or 'PICO_RESET_FULL', to reset the engine after an engine error. */ PICO_FUNC pico_resetEngine( pico_Engine engine, - pico_Status r_mode + pico_Int32 resetMode ); diff --git a/pico/lib/picocep.c b/pico/lib/picocep.c index bb80c3d..f706bcd 100644 --- a/pico/lib/picocep.c +++ b/pico/lib/picocep.c @@ -285,7 +285,7 @@ static picodata_step_result_t cepStep(register picodata_ProcessingUnit this, * @callgraph * @callergraph */ -static pico_status_t cepInitialize(register picodata_ProcessingUnit this, picoos_int32 r_mode) +static pico_status_t cepInitialize(register picodata_ProcessingUnit this, picoos_int32 resetMode) { /*pico_status_t nRes;*/ cep_subobj_t * cep; @@ -328,7 +328,7 @@ static pico_status_t cepInitialize(register picodata_ProcessingUnit this, picoos ------------------------------------------------------------------*/ cep->activeEndPos = PICOCEP_MAXWINLEN; - if (r_mode == PICO_RESET_FULL) { + if (resetMode == PICO_RESET_FULL) { /* kb pdflfz */ cep->pdflfz = picokpdf_getPdfMUL( this->voice->kbArray[PICOKNOW_KBID_PDF_LFZ]); diff --git a/pico/lib/picoctrl.c b/pico/lib/picoctrl.c index 25550f2..3c65831 100644 --- a/pico/lib/picoctrl.c +++ b/pico/lib/picoctrl.c @@ -90,7 +90,7 @@ typedef struct ctrl_subobj { * @callgraph * @callergraph */ -static pico_status_t ctrlInitialize(register picodata_ProcessingUnit this, picoos_int32 r_mode) { +static pico_status_t ctrlInitialize(register picodata_ProcessingUnit this, picoos_int32 resetMode) { register ctrl_subobj_t * ctrl; pico_status_t status= PICO_OK; picoos_int8 i; @@ -104,7 +104,7 @@ static pico_status_t ctrlInitialize(register picodata_ProcessingUnit this, picoo status = PICO_OK; for (i = 0; i < ctrl->numProcUnits; i++) { if (PICO_OK == status) { - status = ctrl->procUnit[i]->initialize(ctrl->procUnit[i], r_mode); + status = ctrl->procUnit[i]->initialize(ctrl->procUnit[i], resetMode); PICODBG_DEBUG(("(re-)initializing procUnit[%i] returned status %i",i, status)); } if (PICO_OK == status) { @@ -521,7 +521,7 @@ typedef struct picoctrl_engine { * @callgraph * @callergraph */ -pico_status_t picoctrl_engReset(picoctrl_Engine this, picoos_int32 r_mode) +pico_status_t picoctrl_engReset(picoctrl_Engine this, picoos_int32 resetMode) { pico_status_t status; @@ -532,7 +532,7 @@ pico_status_t picoctrl_engReset(picoctrl_Engine this, picoos_int32 r_mode) status = this->control->terminate(this->control); if (PICO_OK == status) { - status = this->control->initialize(this->control, r_mode); + status = this->control->initialize(this->control, resetMode); } if (PICO_OK == status) { status = picodata_cbReset(this->cbIn); diff --git a/pico/lib/picoctrl.h b/pico/lib/picoctrl.h index ff85d5a..f7b9b6e 100644 --- a/pico/lib/picoctrl.h +++ b/pico/lib/picoctrl.h @@ -70,7 +70,7 @@ pico_status_t picoctrl_engFeedText( pico_status_t picoctrl_engReset( picoctrl_Engine engine, - picoos_int32 r_mode); + picoos_int32 resetMode); picoos_Common picoctrl_engGetCommon(picoctrl_Engine this); diff --git a/pico/lib/picodata.c b/pico/lib/picodata.c index b886959..efae3b2 100644 --- a/pico/lib/picodata.c +++ b/pico/lib/picodata.c @@ -574,7 +574,7 @@ typedef struct simple_pu_data picorsrc_Voice voice; } simple_pu_data_t; -static pico_status_t puSimpleInitialize (register picodata_ProcessingUnit this, picoos_int32 r_mode) { +static pico_status_t puSimpleInitialize (register picodata_ProcessingUnit this, picoos_int32 resetMode) { return PICO_OK; } diff --git a/pico/lib/picodefs.h b/pico/lib/picodefs.h index 8c24039..24c59bd 100644 --- a/pico/lib/picodefs.h +++ b/pico/lib/picodefs.h @@ -156,11 +156,12 @@ typedef signed int pico_Status; #define PICO_STEP_ERROR (pico_Status) -200 -/* Engine reset modes ***********************************************************/ +/* ********************************************************************/ +/* resetEngine reset modes */ +/* ********************************************************************/ -/* general */ -#define PICO_RESET_FULL (pico_Status) 0 -#define PICO_RESET_SOFT (pico_Status) 0x10 +#define PICO_RESET_FULL 0 +#define PICO_RESET_SOFT 0x10 /* ********************************************************************/ diff --git a/pico/lib/picoklex.c b/pico/lib/picoklex.c index 7ff0a33..3f248b5 100644 --- a/pico/lib/picoklex.c +++ b/pico/lib/picoklex.c @@ -389,7 +389,7 @@ static void klex_setLexResult(const picoos_uint8 *lexentry, picoos_uint8 i; /* check if :G2P */ - if ((lexentry[lexentry[0] + 2]) == PICOKLEX_NEEDS_G2P) { + if ((2 < (lexentry[lexentry[0]])) && ((lexentry[lexentry[0] + 2]) == PICOKLEX_NEEDS_G2P)) { /* set pos */ lexres->posind[0] = lexentry[lexentry[0] + 1]; /* set rest */ diff --git a/pico/lib/picopam.c b/pico/lib/picopam.c index f3253a6..50ee4e3 100644 --- a/pico/lib/picopam.c +++ b/pico/lib/picopam.c @@ -386,7 +386,7 @@ typedef struct pam_subobj /*------------------------------------------------------------------ Service routines : ------------------------------------------------------------------*/ -static pico_status_t pam_initialize(register picodata_ProcessingUnit this, picoos_int32 r_mode); +static pico_status_t pam_initialize(register picodata_ProcessingUnit this, picoos_int32 resetMode); static pico_status_t pam_terminate(register picodata_ProcessingUnit this); static pico_status_t pam_allocate(picoos_MemoryManager mm, pam_subobj_t *pam); static void pam_deallocate(picoos_MemoryManager mm, pam_subobj_t *pam); @@ -556,7 +556,7 @@ static void pam_deallocate(picoos_MemoryManager mm, pam_subobj_t *pam) * @callgraph * @callergraph */ -static pico_status_t pam_initialize(register picodata_ProcessingUnit this, picoos_int32 r_mode) +static pico_status_t pam_initialize(register picodata_ProcessingUnit this, picoos_int32 resetMode) { pico_status_t nI, nJ; pam_subobj_t *pam; @@ -599,7 +599,7 @@ static pico_status_t pam_initialize(register picodata_ProcessingUnit this, picoo pam->nLastAttachedItemId = pam->nCurrAttachedItem = 0; pam->nAttachedItemsSize = 0; - if (r_mode == PICO_RESET_SOFT) { + if (resetMode == PICO_RESET_SOFT) { /*following initializations needed only at startup or after a full reset*/ return PICO_OK; } diff --git a/pico/lib/picopr.c b/pico/lib/picopr.c index d5371d7..0d615d9 100644 --- a/pico/lib/picopr.c +++ b/pico/lib/picopr.c @@ -3168,7 +3168,7 @@ extern void pr_treatItem (picodata_ProcessingUnit this, pr_subobj_t * pr, pr_ioI /* *****************************************************************************/ -pico_status_t prReset(register picodata_ProcessingUnit this, picoos_int32 r_mode) +pico_status_t prReset(register picodata_ProcessingUnit this, picoos_int32 resetMode) { picoos_int32 i; @@ -3227,7 +3227,7 @@ pico_status_t prReset(register picodata_ProcessingUnit this, picoos_int32 r_mode pr->forceOutput = FALSE; - if (r_mode == PICO_RESET_SOFT) { + if (resetMode == PICO_RESET_SOFT) { /*following initializations needed only at startup or after a full reset*/ return PICO_OK; } @@ -3244,14 +3244,14 @@ pico_status_t prReset(register picodata_ProcessingUnit this, picoos_int32 r_mode } -pico_status_t prInitialize(register picodata_ProcessingUnit this, picoos_int32 r_mode) +pico_status_t prInitialize(register picodata_ProcessingUnit this, picoos_int32 resetMode) { /* if (NULL == this || NULL == this->subObj) { return PICO_ERR_OTHER; } */ - return prReset(this, r_mode); + return prReset(this, resetMode); } diff --git a/pico/lib/picosa.c b/pico/lib/picosa.c index ab48713..8c58aa4 100644 --- a/pico/lib/picosa.c +++ b/pico/lib/picosa.c @@ -242,7 +242,7 @@ typedef struct sa_subobj { } sa_subobj_t; -static pico_status_t saInitialize(register picodata_ProcessingUnit this, picoos_int32 r_mode) { +static pico_status_t saInitialize(register picodata_ProcessingUnit this, picoos_int32 resetMode) { sa_subobj_t * sa; picoos_uint16 i; picokfst_FST fst; @@ -294,7 +294,7 @@ static pico_status_t saInitialize(register picodata_ProcessingUnit this, picoos_ sa->phonWritePos = 0; sa->nextReadPos = 0; - if (r_mode == PICO_RESET_SOFT) { + if (resetMode == PICO_RESET_SOFT) { /*following initializations needed only at startup or after a full reset*/ return PICO_OK; } diff --git a/pico/lib/picosig.c b/pico/lib/picosig.c index 4282e24..f224e65 100644 --- a/pico/lib/picosig.c +++ b/pico/lib/picosig.c @@ -114,7 +114,7 @@ typedef struct sig_subobj * @callgraph * @callergraph */ -static pico_status_t sigInitialize(register picodata_ProcessingUnit this, picoos_int32 r_mode) +static pico_status_t sigInitialize(register picodata_ProcessingUnit this, picoos_int32 resetMode) { sig_subobj_t *sig_subObj; if (NULL == this || NULL == this->subObj) { @@ -147,7 +147,7 @@ static pico_status_t sigInitialize(register picodata_ProcessingUnit this, picoos /*----------------------------------------------------------------- * MANAGE LINGWARE INITIALIZATION IF NEEDED ------------------------------------------------------------------*/ - if (r_mode == PICO_RESET_FULL) { + if (resetMode == PICO_RESET_FULL) { /*not done when resetting SOFT*/ sig_subObj->pdfmgc = picokpdf_getPdfMUL( this->voice->kbArray[PICOKNOW_KBID_PDF_MGC]); @@ -166,7 +166,7 @@ static pico_status_t sigInitialize(register picodata_ProcessingUnit this, picoos /*----------------------------------------------------------------- * Initialize memory for DSP * ------------------------------------------------------------------*/ - sigDspInitialize(&(sig_subObj->sig_inner), r_mode); + sigDspInitialize(&(sig_subObj->sig_inner), resetMode); /*----------------------------------------------------------------- * Initialize modifiers * ------------------------------------------------------------------*/ @@ -178,7 +178,7 @@ static pico_status_t sigInitialize(register picodata_ProcessingUnit this, picoos /*----------------------------------------------------------------- * Initialize memory for DSP * ------------------------------------------------------------------*/ - sigDspInitialize(&(sig_subObj->sig_inner), r_mode); + sigDspInitialize(&(sig_subObj->sig_inner), resetMode); } diff --git a/pico/lib/picosig2.c b/pico/lib/picosig2.c index 52943e6..509c33a 100644 --- a/pico/lib/picosig2.c +++ b/pico/lib/picosig2.c @@ -412,29 +412,14 @@ void sigDeallocate(picoos_MemoryManager mm, sig_innerobj_t *sig_inObj) * @callgraph * @callergraph */ -void sigDspInitialize(sig_innerobj_t *sig_inObj, picoos_int32 r_mode) +void sigDspInitialize(sig_innerobj_t *sig_inObj, picoos_int32 resetMode) { picoos_int32 i, j; picoos_int32 *pnt; - if (r_mode == PICO_RESET_SOFT) { + if (resetMode == PICO_RESET_SOFT) { /*minimal initialization when receiving a soft reset */ return; - /* - sig_inObj->voxbnd_p = (picoos_int32) ((picoos_single) sig_inObj->hfftsize_p - / ((picoos_single) sig_inObj->Fs_p / (picoos_single) 2) - * (picoos_single) sig_inObj->VCutoff_p); - sig_inObj->voxbnd2_p - = (picoos_int32) ((picoos_single) sig_inObj->hfftsize_p - / ((picoos_single) sig_inObj->Fs_p / (picoos_single) 2) - * (picoos_single) sig_inObj->UVCutoff_p); - sig_inObj->nextPeak_p = (((int) (PICODSP_FFTSIZE)) - / ((int) PICODSP_DISPLACE) - 1) * sig_inObj->hop_p; - for (i = 0; i < 2 * PICODSP_FFTSIZE; i++) { - sig_inObj->int_vec26[i] = 0; - } - return; - */ } /*----------------------------------------------------------------- * Initialization @@ -794,6 +779,8 @@ void impulse_response(sig_innerobj_t *sig_inObj) picoos_int32 *norm_window; /* - fixed point */ picoos_int32 *fr, *Fr, *Fi, *t1, ff; /* - fixed point */ + picoos_int32 mx,mn, rat; + /*Link local variables with sig object*/ m2 = sig_inObj->m2_p; m4 = m2 >> 1; @@ -818,16 +805,56 @@ void impulse_response(sig_innerobj_t *sig_inObj) /*window, normalize and differentiate*/ *E = norm_result(m2, fr, norm_window); - if (*E > 0) + if (*E > 0) { f = *E * PICODSP_FIXRESP_NORM; - else + } else { f = 20; /*PICODSP_FIXRESP_NORM*/ + } ff = (picoos_int32) f; if (ff < 1) ff = 1; /*normalize impulse response*/ t1 = fr;FAST_DEVICE(PICODSP_FFTSIZE,*(t1++) /= ff;); /* - fixed point */ + + mx = mn = 0; + t1 = fr; + FAST_DEVICE(PICODSP_FFTSIZE,if (*t1>mx) mx=*t1; if (*t1<mn) mn=*t1; t1++;); + mn = -mn; + if (mx>mn) { + rat = mx / (mn>>5); /* ratio * 32*/ + if (rat > 40) rat = 40; /* 1.25 * 32 */ + /* now rat is between 32 and 40 */ + switch (rat) { + case 32: /* do nothing */ + break; + case 33: + t1 = fr;FAST_DEVICE(PICODSP_FFTSIZE,if (*t1<0) *t1-=(-*t1)>>5; t1++;); + break; + case 34: + t1 = fr;FAST_DEVICE(PICODSP_FFTSIZE,if (*t1<0) *t1-=(-*t1)>>4; t1++;); + break; + case 35: + t1 = fr;FAST_DEVICE(PICODSP_FFTSIZE,if (*t1<0) *t1-=(((-*t1)>>5)+((-*t1)>>4)); t1++;); + break; + case 36: + t1 = fr;FAST_DEVICE(PICODSP_FFTSIZE,if (*t1<0) *t1-=(-*t1)>>3; t1++;); + break; + case 37: + t1 = fr;FAST_DEVICE(PICODSP_FFTSIZE,if (*t1<0) *t1-=(((-*t1)>>5)+((-*t1)>>3)); t1++;); + break; + case 38: + t1 = fr;FAST_DEVICE(PICODSP_FFTSIZE,if (*t1<0) *t1-=(((-*t1)>>4)+((-*t1)>>3)); t1++;); + break; + case 39: + t1 = fr;FAST_DEVICE(PICODSP_FFTSIZE,if (*t1<0) *t1-=(((-*t1)>>5)+((-*t1)>>4) + ((-*t1)>>3)); t1++;); + break; + case 40: + t1 = fr;FAST_DEVICE(PICODSP_FFTSIZE,if (*t1<0) *t1-=(-*t1)>>2; t1++;); + break; + } + } + } /* impulse_response */ /** @@ -4037,6 +4064,9 @@ static void get_simple_excitation(sig_innerobj_t *sig_inObj, F0 = sig_inObj->F0_p; voiced = sig_inObj->voiced_p; + E = (E > 5) ? 9 : (E > 1) ? 2 * E - 1 : E; + + /* shift previous excitation window by hop samples*/ for (nI = 0; nI < sig_inObj->nV; nI++) { sig_inObj->LocV[nI] = sig_inObj->LocV[nI] - hop; diff --git a/pico/lib/picosig2.h b/pico/lib/picosig2.h index 1b975db..e2577ff 100644 --- a/pico/lib/picosig2.h +++ b/pico/lib/picosig2.h @@ -139,7 +139,7 @@ typedef struct sig_innerobj extern pico_status_t sigAllocate(picoos_MemoryManager mm, sig_innerobj_t *sig_inObj); extern void sigDeallocate(picoos_MemoryManager mm, sig_innerobj_t *sig_inObj); -extern void sigDspInitialize(sig_innerobj_t *sig_inObj, picoos_int32 r_mode); +extern void sigDspInitialize(sig_innerobj_t *sig_inObj, picoos_int32 resetMode); /*------------------------------------------------------------------ Exported (to picosig.c) Processing routines : diff --git a/pico/lib/picospho.c b/pico/lib/picospho.c index bf9dd80..577d047 100644 --- a/pico/lib/picospho.c +++ b/pico/lib/picospho.c @@ -286,7 +286,7 @@ static pico_status_t sphoReset(register picodata_ProcessingUnit this) } -static pico_status_t sphoInitialize(register picodata_ProcessingUnit this, picoos_int32 r_mode) +static pico_status_t sphoInitialize(register picodata_ProcessingUnit this, picoos_int32 resetMode) { picoos_uint8 i; spho_subobj_t * spho; diff --git a/pico/lib/picotok.c b/pico/lib/picotok.c index 969e2a3..d51062a 100644 --- a/pico/lib/picotok.c +++ b/pico/lib/picotok.c @@ -205,6 +205,7 @@ struct MarkupParam { typedef struct MarkupParam MarkupParams[MAX_NR_MARKUP_PARAMS]; +typedef picoos_uchar utf8char0c[5]; /* one more than needed so it is ended always with 0c*/ /** subobject : TokenizeUnit * shortcut : tok @@ -213,7 +214,7 @@ typedef struct tok_subobj { picoos_int32 ignLevel; - picoos_uchar utf[5]; + utf8char0c utf; picoos_int32 utfpos; picoos_int32 utflen; @@ -638,7 +639,7 @@ static MarkupId tok_markupTagId (picoos_uchar tagId[]) } -extern void tok_checkLimits (picodata_ProcessingUnit this, picoos_uint32 * value, picoos_uint32 min, picoos_uint32 max, picoos_uchar valueType[]) +static void tok_checkLimits (picodata_ProcessingUnit this, picoos_uint32 * value, picoos_uint32 min, picoos_uint32 max, picoos_uchar valueType[]) { if ((((*value) < min) || ((*value) > max))) { picoos_emRaiseWarning(this->common->em, PICO_ERR_MARKUP_VALUE_OUT_OF_RANGE, (picoos_char*)"", (picoos_char*)"attempt to set illegal value %i for %s", *value, valueType); @@ -652,7 +653,9 @@ extern void tok_checkLimits (picodata_ProcessingUnit this, picoos_uint32 * value -extern void tok_checkRealLimits (picodata_ProcessingUnit this, picoos_single * value, picoos_single min, picoos_single max, picoos_uchar valueType[]) +/* + +static void tok_checkRealLimits (picodata_ProcessingUnit this, picoos_single * value, picoos_single min, picoos_single max, picoos_uchar valueType[]) { if ((((*value) < min) || ((*value) > max))) { picoos_emRaiseWarning(this->common->em, PICO_ERR_MARKUP_VALUE_OUT_OF_RANGE, (picoos_char*)"", (picoos_char*)"attempt to set illegal value %f for %s", *value, valueType); @@ -663,7 +666,7 @@ extern void tok_checkRealLimits (picodata_ProcessingUnit this, picoos_single * v } } } - +*/ #define VAL_STR_LEN 21 @@ -1229,8 +1232,10 @@ static void tok_putToMarkup (picodata_ProcessingUnit this, tok_subobj_t * tok, p break; } } - tok->markupStr[tok->markupPos] = str[i]; - tok->markupPos++; + if (tok->markupTagErr == MENone) { + tok->markupStr[tok->markupPos] = str[i]; + tok->markupPos++; + } /* else restart parsing at current char */ tok->markupStr[tok->markupPos] = 0; } /* @@ -1294,11 +1299,13 @@ static void tok_treatMarkup (picodata_ProcessingUnit this, tok_subobj_t * tok) static void tok_treatChar (picodata_ProcessingUnit this, tok_subobj_t * tok, picoos_uchar ch, picoos_bool markupHandling) { - picoos_int32 id; + picoos_int32 i, id; picoos_uint8 uval8; pico_tokenType type = PICODATA_ITEMINFO1_TOKTYPE_UNDEFINED; pico_tokenSubType subtype = -1; picoos_bool dummy; + utf8char0c utf2; + picoos_int32 utf2pos; if (ch == NULLC) { tok_treatSimpleToken(this, tok); @@ -1323,31 +1330,38 @@ static void tok_treatChar (picodata_ProcessingUnit this, tok_subobj_t * tok, pic } } dummy = picoktab_getIntPropTokenSubType(tok->graphTab, id, &subtype); - } else if (ch <= (picoos_uchar)' ') { + } else if (tok->utf[tok->utfpos-1] <= (picoos_uchar)' ') { type = PICODATA_ITEMINFO1_TOKTYPE_SPACE; subtype = -1; } else { type = PICODATA_ITEMINFO1_TOKTYPE_UNDEFINED; subtype = -1; } - if ((ch > (picoos_uchar)' ')) { + if ((tok->utf[tok->utfpos-1] > (picoos_uchar)' ')) { tok->nrEOL = 0; - } else if ((ch == EOL)) { + } else if ((tok->utf[tok->utfpos-1] == EOL)) { tok->nrEOL++; } if (markupHandling && (tok->markupState != MSNotInMarkup)) { tok_putToMarkup(this, tok, tok->utf); if (tok->markupState >= MSError) { + picoos_strlcpy(utf2, tok->utf, 5); + utf2pos = tok->utfpos; + /* treat string up to (but not including) current char as simple + token and restart markup tag parsing with current char */ tok_treatMarkupAsSimpleToken(this, tok); + for (i = 0; i < utf2pos; i++) { + tok_treatChar(this, tok, utf2[i], markupHandling); + } } else if (tok->markupState == MSGotEnd) { tok_treatMarkup(this, tok); } - } else if ((markupHandling && (ch == (picoos_uchar)'<'))) { + } else if ((markupHandling && (tok->utf[tok->utfpos-1] == (picoos_uchar)'<'))) { tok_putToMarkup(this, tok, tok->utf); } else if (type != PICODATA_ITEMINFO1_TOKTYPE_UNDEFINED) { if ((type != tok->tokenType) || (type == PICODATA_ITEMINFO1_TOKTYPE_CHAR) || (subtype != tok->tokenSubType)) { tok_treatSimpleToken(this, tok); - } else if ((ch == EOL) && (tok->nrEOL == 2)) { + } else if ((tok->utf[tok->utfpos-1] == EOL) && (tok->nrEOL == 2)) { tok_treatSimpleToken(this, tok); tok_putToSimpleToken(this, tok, (picoos_uchar*)".", PICODATA_ITEMINFO1_TOKTYPE_CHAR, -1); tok_treatSimpleToken(this, tok); @@ -1385,7 +1399,7 @@ static void tok_treatSimpleToken (picodata_ProcessingUnit this, tok_subobj_t * t /* *****************************************************************************/ -static pico_status_t tokReset(register picodata_ProcessingUnit this, picoos_int32 r_mode) +static pico_status_t tokReset(register picodata_ProcessingUnit this, picoos_int32 resetMode) { tok_subobj_t * tok; MarkupId mId; @@ -1449,7 +1463,7 @@ static pico_status_t tokReset(register picodata_ProcessingUnit this, picoos_int3 return PICO_OK; } -static pico_status_t tokInitialize(register picodata_ProcessingUnit this, picoos_int32 r_mode) +static pico_status_t tokInitialize(register picodata_ProcessingUnit this, picoos_int32 resetMode) { /* @@ -1460,7 +1474,7 @@ static pico_status_t tokInitialize(register picodata_ProcessingUnit this, picoos } tok = (tok_subobj_t *) this->subObj; */ - return tokReset(this, r_mode); + return tokReset(this, resetMode); } diff --git a/pico/lib/picowa.c b/pico/lib/picowa.c index ab8ca51..edbff7d 100644 --- a/pico/lib/picowa.c +++ b/pico/lib/picowa.c @@ -78,7 +78,7 @@ typedef struct wa_subobj { } wa_subobj_t; -static pico_status_t waInitialize(register picodata_ProcessingUnit this, picoos_int32 r_mode) { +static pico_status_t waInitialize(register picodata_ProcessingUnit this, picoos_int32 resetMode) { picoos_uint8 i; picoklex_Lex ulex; wa_subobj_t * wa; @@ -98,7 +98,7 @@ static pico_status_t waInitialize(register picodata_ProcessingUnit this, picoos_ wa->outBufSize = PICOWA_MAXITEMSIZE; wa->outLen = 0; - if (r_mode == PICO_RESET_SOFT) { + if (resetMode == PICO_RESET_SOFT) { /*following initializations needed only at startup or after a full reset*/ return PICO_OK; } |