From 1879285bc9bad4717f5325482dd2e9cba361cb7f Mon Sep 17 00:00:00 2001 From: fdbozzo Date: Tue, 29 Jul 2014 18:32:31 +0200 Subject: [PATCH] =?UTF-8?q?Changeset:=20381=20fdbozzo=20-=2029/07/2014=201?= =?UTF-8?q?7:48:43:=20-=20Nuevos=20casos=20de=20prueba=20para=20detecci?= =?UTF-8?q?=C3=B3n=20correcta=20de=20text/endtext?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...or_base__IdentificarBloquesDeExclusion.prg | 61 +++++++++++++++++-- foxbin2prg.prg | 46 ++++++++++---- 2 files changed, 92 insertions(+), 15 deletions(-) diff --git a/TESTS/ut__foxbin2prg__c_conversor_base__IdentificarBloquesDeExclusion.prg b/TESTS/ut__foxbin2prg__c_conversor_base__IdentificarBloquesDeExclusion.prg index 0501f59..45e898f 100644 --- a/TESTS/ut__foxbin2prg__c_conversor_base__IdentificarBloquesDeExclusion.prg +++ b/TESTS/ut__foxbin2prg__c_conversor_base__IdentificarBloquesDeExclusion.prg @@ -159,7 +159,7 @@ DEFINE CLASS ut__foxbin2prg__c_conversor_base__IdentificarBloquesDeExclusion as ******************************************************************************************************************************************* - FUNCTION Deberia_NoEncontrarNingunBloque_TEXT_ENDTEXT_CuandoUnaLineaQueComienzaConUnCampoLlamado_Text_esEvaluado + FUNCTION Deberia_NoEncontrarBloque_TEXT_ENDTEXT_CuandoEvaluaUnaLineaQueComienzaConUnCampoLlamado_Text_YLineaAnteriorTerminaEn_PuntoYComa LOCAL lcMethod, laLineas(1), lnLineas, laPos(1,2), lnPos_Count, laExpected_Pos(1,2) LOCAL loObj AS c_conversor_prg_a_bin OF "FOXBIN2PRG.PRG" loObj = THIS.icObj @@ -174,7 +174,7 @@ DEFINE CLASS ut__foxbin2prg__c_conversor_base__IdentificarBloquesDeExclusion as *-- Code Block IF !FOUND() APPEND BLANK - REPLACE CURSOR WITH "cawlmain", START WITH 1, END WITH 999999, isnumeric WITH .F., lastused WITH "", ; && Worst case for next line + REPLACE CURSOR WITH "cawlmain", START WITH 1, END WITH 999999, isnumeric WITH .F., lastused WITH "", ; && Worst case for next line with a field called "text" TEXT WITH "Wärmeobjekte", standard WITH .T. ENDIF @@ -187,7 +187,7 @@ DEFINE CLASS ut__foxbin2prg__c_conversor_base__IdentificarBloquesDeExclusion as Empfaenger C(2),; Rohdatum C(8),; RohZeit C(4),; - LFDNr C(4),; && Worst case for next line + LFDNr C(4),; && Worst case for next line with a field called "text" Text C(26),; Trenner C(2),; DATUM D NULL,; @@ -204,7 +204,7 @@ DEFINE CLASS ut__foxbin2prg__c_conversor_base__IdentificarBloquesDeExclusion as lfdnr c(30) NULL DEFAULT .NULL.,; linkkey int,; email CHAR(60) NULL DEFAULT .NULL.,; - subject VARCHAR(254) NULL DEFAULT .NULL.,; && Worst case for next line + subject VARCHAR(254) NULL DEFAULT .NULL.,; && Worst case for next line with a field called "text" TEXT m NULL DEFAULT .NULL.,; docname c(50) NULL DEFAULT .NULL.,; versenden l NOT NULL DEFAULT .F.,; @@ -235,4 +235,57 @@ DEFINE CLASS ut__foxbin2prg__c_conversor_base__IdentificarBloquesDeExclusion as ENDFUNC + ******************************************************************************************************************************************* + FUNCTION Deberia_NoEncontrarBloque_TEXT_ENDTEXT_CuandoEvaluaUnaLineaQueComienzaConUnCampoLlamado_Text_YLineaAnteriorTerminaEn_Coma + LOCAL lcMethod, laLineas(1), lnLineas, laPos(1,2), lnPos_Count, laExpected_Pos(1,2) + LOCAL loObj AS c_conversor_prg_a_bin OF "FOXBIN2PRG.PRG" + loObj = THIS.icObj + + *-- Input and expected params + STORE '' TO lcMethod + laExpected_Pos(1,1) = 4 + laExpected_Pos(1,2) = 15 + + TEXT TO lcMethod NOSHOW TEXTMERGE FLAGS 1 PRETEXT 1+2+4 + <> myMethod_B + *-- Code Block + IF ODBC_Query.odbc + <> TO cSQL NOSHOW + update menuitems + set parent_menuitem_id = ?iParent_menuitem_id, && Worst case for next line with a field called "text" + text = ?strText, + command = ?strCommand, + message = ?strMessage, + keyname = ?strKeyname, + keylabel = ?strKeylabel, + skipfor = ?strSkipfor, + sequence = ?iSequence + where menuitem_id = ?iMenuitem_id + <> + ODBC_Query(cSQL) + ELSE + update menuitems; + set parent_menuitem_id = iParent_menuitem_id,; && Worst case for next line with a field called "text" + text = strText,; + command = strCommand,; + message = strMessage,; + keyname = strKeyname,; + keylabel = strKeylabel,; + skipfor = strSkipfor,; + sequence = iSequence; + where menuitem_id == iMenuitem_id + ENDIF + <> + ENDTEXT + + lnLineas = ALINES( laLineas, lcMethod ) + + *-- Test + loObj.identificarBloquesDeExclusion( @laLineas, lnLineas, , @laPos, @lnPos_Count ) + + THIS.Evaluate_results( @laExpected_Pos, @laPos, lnPos_Count ) + + ENDFUNC + + ENDDEFINE diff --git a/foxbin2prg.prg b/foxbin2prg.prg index e14cd3f..d0da57c 100644 --- a/foxbin2prg.prg +++ b/foxbin2prg.prg @@ -95,6 +95,7 @@ * 06/07/2014 FDBOZZO v1.19.26 Bug Fix cfg: ExtraBackupLevel no se tiene en cuenta cuando se usa multi-configuración * 02/06/2014 DH/FDBOZZO v1.19.27 Mejora: Agregado soporte para exportar datos para DIFF (no para importar) * 21/07/2014 FDBOZZO v1.19.28 Mejora: Agregada funcionalidad para filtrado de tablas y datos cuando se elige DBF_Conversion_Support:4 (Edyshor) +* 29/07/2014 FDBOZZO v1.19.29 Arreglo bug vcx/scx: Un campo de tabla llamado "text" que comienza la línea puede confundirse con la estructura TEXT/ENDTEXT y reconocer mal el resto del código * * *--------------------------------------------------------------------------------------------------- @@ -133,6 +134,7 @@ * 27/06/2014 Daniel Sánchez MEJORA v1.19.25: Si el campo memo "methods" de los vcx/scx contiene asteriscos fuera de lugar (que no debería), FoxBin2Prg falla. Debería poder procesarlo igual. * 02/06/2014 Doug Hennig MEJORA v1.19.22: Agregada funcionalidad para exportar los datos de las tablas al archivo db2 (Agregado en v1.19.27) * 21/07/2014 Edyshor PROPUESTA DE MEJORA db2 v1.19.27: Sería útil poder filtrar tablas y datos cuando se elige DBF_Conversion_Support:4 (Agregado en v1.19.28) +* 29/07/2014 M_N_M REPORTE BUG vcx/scx v1.19.28: Los campos de tabla con nombre "text" a veces provocan corrupción del binario generado (Arreglado en v1.19.29) * * *--------------------------------------------------------------------------------------------------- @@ -3585,6 +3587,7 @@ DEFINE CLASS c_conversor_prg_a_bin AS c_conversor_base + [] ; + [] ; + [] ; + + [] ; + [] ; + [] ; + [] ; @@ -3754,6 +3757,24 @@ DEFINE CLASS c_conversor_prg_a_bin AS c_conversor_base RETURN llEncontrado ENDPROC + + + PROCEDURE currentLineIsPreviousLineContinuation + LPARAMETERS taCodeLines, I + + LOCAL lcPrevLine, llIsContinuation + *-- Analizo la línea anterior para saber si termina con ";" o "," y la actual es continuación + IF I > 1 + lcPrevLine = taCodeLines(I-1) + ELSE + lcPrevLine = '' + ENDIF + .get_SeparatedLineAndComment( @lcPrevLine ) + IF INLIST( RIGHT( lcPrevLine,1 ), ';', ',' ) && Esta línea es continuación de la anterior + llIsContinuation = .T. + ENDIF + RETURN llIsContinuation + ENDPROC PROCEDURE identificarBloquesDeExclusion @@ -3799,7 +3820,8 @@ DEFINE CLASS c_conversor_prg_a_bin AS c_conversor_base FOR X = 1 TO lnID_Bloques_Count lnLen_IDFinBQ = LEN( ta_ID_Bloques(X,2) ) - IF .elTextoEvaluadoEsElTokenIndicado( @lcLine, @ta_ID_Bloques, lnLen_IDFinBQ, X, 1 ) + IF .elTextoEvaluadoEsElTokenIndicado( @lcLine, @ta_ID_Bloques, lnLen_IDFinBQ, X, 1 ) ; + AND NOT THIS.currentLineIsPreviousLineContinuation( @taCodeLines, I ) lnPrimerID = X lnAnidamientos = 1 EXIT @@ -3807,14 +3829,14 @@ DEFINE CLASS c_conversor_prg_a_bin AS c_conversor_base ENDFOR IF lnPrimerID > 0 && Se ha identificado un ID de bloque excluyente - IF I > 1 - *-- Analizo la línea anterior para saber si termina con ";" y la actual es continuación - lcPrevLine = taCodeLines(I-1) - .get_SeparatedLineAndComment( @lcPrevLine ) - IF RIGHT( lcPrevLine,1 ) = ';' && Esta línea es continuación de la anterior - LOOP - ENDIF - ENDIF + *IF I > 1 + * *-- Analizo la línea anterior para saber si termina con ";" o "," y la actual es continuación + * lcPrevLine = taCodeLines(I-1) + * .get_SeparatedLineAndComment( @lcPrevLine ) + * IF INLIST( RIGHT( lcPrevLine,1 ), ';', ',' ) && Esta línea es continuación de la anterior + * LOOP + * ENDIF + *ENDIF tnBloquesExclusion = tnBloquesExclusion + 1 lnLen_IDFinBQ = LEN( ta_ID_Bloques(lnPrimerID,2) ) @@ -3831,10 +3853,12 @@ DEFINE CLASS c_conversor_prg_a_bin AS c_conversor_base ENDIF DO CASE - CASE .elTextoEvaluadoEsElTokenIndicado( @lcLine, @ta_ID_Bloques, lnLen_IDFinBQ, X, 1 ) + CASE .elTextoEvaluadoEsElTokenIndicado( @lcLine, @ta_ID_Bloques, lnLen_IDFinBQ, X, 1 ) ; + AND NOT THIS.currentLineIsPreviousLineContinuation( @taCodeLines, I ) lnAnidamientos = lnAnidamientos + 1 - CASE .elTextoEvaluadoEsElTokenIndicado( @lcLine, @ta_ID_Bloques, lnLen_IDFinBQ, X, 2 ) + CASE .elTextoEvaluadoEsElTokenIndicado( @lcLine, @ta_ID_Bloques, lnLen_IDFinBQ, X, 2 ) ; + AND NOT THIS.currentLineIsPreviousLineContinuation( @taCodeLines, I ) lnAnidamientos = lnAnidamientos - 1 IF lnAnidamientos = 0