FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour Nombre de las variables locales
Posts: 10
Joined: Tue Jun 28, 2011 08:26 PM
Nombre de las variables locales
Posted: Tue Nov 19, 2013 01:59 PM

Buenos d铆as,

He estado echando un ojo a diferentes funciones pero ninguna da el resultado que quiero. Se trata del informe de errores que se genera autom谩ticamente cuando una aplicaci贸n falla y se genera el "error.log".
Me gustar铆a saber si existe alguna forma para lograr saber cu谩l es el nombre de las variables locales internamente en mi programa y mostrarlo en este informe de forma que se facilite la depuraci贸n de los programas.

Ejemplo:
- En uno de mis informes de errores aparece -> Local 14: N 825236739
- Lo que quiero que aparezca -> miContador: N 825236739

Gracias. Un saludo.

Posts: 989
Joined: Thu Nov 24, 2005 03:01 PM
Re: Nombre de las variables locales
Posted: Tue Nov 19, 2013 04:21 PM

No se me ocurre una forma sencilla. Hasta donde s茅, tanto Locals como Statics se usan por direcci贸n que se asigna en compilaci贸n, no se utiliza el nombre o SYMBOL en tiempo de ejecuci贸n.
La 煤nica cosa que tal vez pueda dar alg煤n tipo de soluci贸n ser铆a si al incluir DebugInfo (/d) se incluyan en el ejecutable informacion sobre locals y statics, pero no estoy muy seguro.
Probablemente Antonio pueda decir si es posible, hay que estar muy puesto con el debugger :)
De todas maneras, si funcionase, ser铆a excelente poder tener el nomber de las vars en el error.log.

Saludos
Carlos Mora
http://harbouradvisor.blogspot.com/
StackOverflow http://stackoverflow.com/users/549761/carlos-mora
鈥淚f you think education is expensive, try ignorance"
Posts: 10
Joined: Tue Jun 28, 2011 08:26 PM
Re: Nombre de las variables locales
Posted: Thu Nov 21, 2013 01:41 PM
Hola de nuevo,
He visto que en algunos errores si que aparece el nombre de algunas variables, pero no se como lo obtiene, un ejemplo es:

- Error description: Error BASE/1003 Variable does not exist: miVariable

A ver si alguien tiene alguna idea....
Gracias.
Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: Nombre de las variables locales
Posted: Thu Nov 21, 2013 01:52 PM

Muestra un ejemplo autocontenido de como tu haces las declaraciones de las variables> LOCAL, PRIVATE, MEMVAR Y PUBLIC en tu aplicacio贸n.

Salu2.

Jo茫o Santos - S茫o Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 1515
Joined: Thu Oct 30, 2008 02:37 PM
Re: Nombre de las variables locales
Posted: Thu Nov 21, 2013 02:56 PM

Lo que yo pienso del tema: simple especulacion:

Tengamos en cuenta que cuando se produce un error, el nombre de la variable va contenido en oErr:Operation.
Lo que yo me imagino, es que el "variable does not exist" se saca "por descarte": descartados otros errores, se le asigna esa descripcion.
Por tanto, y a lo que vamos, el nombre de la variable es conocido porque al no haber sido declarada (Local) el compilador no la tradujo y simplemente QUEDO COMO UNA OPERACION 隆隆 DESCONOCIDA !! a la que se le asigna un texto de error por descarte.

Fin de la especulacion.

Saludos a todos

Posts: 654
Joined: Mon May 29, 2006 03:14 PM
Re: Nombre de las variables locales
Posted: Thu Nov 21, 2013 03:39 PM
sergisenna wrote: - Error description: Error BASE/1003 Variable does not exist: miVariable

Son los errores de CLIPPER (Guias NG fichero C52G02B.NG):

Code (fw): Select all Collapse
 BASE/1003 聽 聽Undefined variable
聽 聽 聽 聽 聽 聽 聽 (Variable no definida)

聽 聽 聽Causa: Ha especificado una variable que no existe o que no est聽
聽 聽 聽visible.

聽 聽 聽Soluciones:

聽 聽 聽1. Si ha especificado un campo de base de datos, aseg拢rese de que ha
聽 聽 聽 聽 abierto el fichero de base de datos correcto y de que ha seleccionado
聽 聽 聽 聽 el 聽rea de trabajo correcta. Si no desea seleccionar otra 聽rea de
聽 聽 聽 聽 trabajo, anteponga a la referencia del campo el alias del 聽rea de
聽 聽 聽 聽 trabajo correspondiente.

聽 聽 聽2. Si ha especificado una variable privada o p拢blica, aseg拢rese de que
聽 聽 聽 聽 la ha creado utilizando una sentencia PRIVATE o PUBLIC.

聽 聽 聽3. Si ha especificado una referencia de variable local o est聽tica dentro
聽 聽 聽 聽 de una variable macro, reordene el c垄digo para que se referencie a la
聽 聽 聽 聽 variable directamente (las variables locales y est聽ticas no son
聽 聽 聽 聽 visibles dentro de las variables macro).

聽 聽 聽La opci垄n del compilador /W resulta muy 拢til para encontrar errores de
聽 聽 聽escritura o especificaci垄n incorrecta de referencias de variables.

聽 聽 聽Consulte tambi鈥歯: El cap隆tulo Conceptos B聽sicos de la gu隆a de
聽 聽 聽Programaci垄n y Utilidades.


Code (fw): Select all Collapse
 Overview -- Errores de Ejecuci垄n
脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛
聽Mensajes de Error BASE

聽BASE/1001 聽 聽Undefined function
聽BASE/1002 聽 聽Undefined alias
聽BASE/1003 聽 聽Undefined variable
聽BASE/1004 聽 聽No exported method
聽BASE/1005 聽 聽No exported variable
聽BASE/1065 聽 聽Argument error: &
聽BASE/1066 聽 聽Argument error: conditional
聽BASE/1067 聽 聽Argument error: array dimension
聽BASE/1068 聽 聽Argument error: array access
聽BASE/1069 聽 聽Argument error: array assign
聽BASE/1070 聽 聽Argument error: ==
聽BASE/1071 聽 聽Argument error: =
聽BASE/1072 聽 聽Argument error: <>
聽BASE/1073 聽 聽Argument error: <
聽BASE/1074 聽 聽Argument error: <=
聽BASE/1075 聽 聽Argument error:>
聽BASE/1076 聽 聽Argument error.>=
聽BASE/1077 聽 聽Argument error: .NOT.
聽BASE/1078 聽 聽Argument error: .AND.
聽BASE/1079 聽 聽Argument error: .OR.
聽BASE/1080 聽 聽Argument error: -
聽BASE/1081 聽 聽Argument error: +
聽BASE/1082 聽 聽Argument error: -
聽BASE/1083 聽 聽Argument error:*
聽BASE/1084 聽 聽Argument error: /
聽BASE/1085 聽 聽Argument error: %
聽BASE/1086 聽 聽Argument error: ++
聽BASE/1087 聽 聽Argument error: --
聽BASE/1088 聽 聽Argument error: ^^
聽BASE/1089 聽 聽Argument error: ABS
聽BASE/1090 聽 聽Argument error: INT
聽BASE/1091 聽 聽Argument error: WORD
聽BASE/1092 聽 聽Argument error: MIN
聽BASE/1093 聽 聽Argument error: MAX
聽BASE/1094 聽 聽Argument error: ROUND
聽BASE/1095 聽 聽Argument error: LOG
聽BASE/1096 聽 聽Argument error: EXP
聽BASE/1097 聽 聽Argument error: SQRT
聽BASE/1098 聽 聽Argument error: VAL
聽BASE/1099 聽 聽Argument error: STR
聽BASE/1100 聽 聽Argument error: TRIM
聽BASE/1101 聽 聽Argument error: LTRIM
聽BASE/1102 聽 聽Argument error: UPPER
聽BASE/1103 聽 聽Argument error: LOWER
聽BASE/1104 聽 聽Argument error: CHR
聽BASE/1105 聽 聽Argument error: SPACE
聽BASE/1106 聽 聽Argument error: REPLICATE
聽BASE/1107 聽 聽Argument error: ASC
聽BASE/1108 聽 聽Argument error: AT
聽BASE/1109 聽 聽Argument error: $
聽BASE/1110 聽 聽Argument error: SUBSTR
聽BASE/1111 聽 聽Argument error: LEN
聽BASE/1112 聽 聽Argument error: YEAR
聽BASE/1113 聽 聽Argument error: MONTH
聽BASE/1114 聽 聽Argument error: DAY
聽BASE/1115 聽 聽Argument error: DOW
聽BASE/1116 聽 聽Argument error: CMONTH
聽BASE/1117 聽 聽Argument error: CDOW
聽BASE/1118 聽 聽Argument error: DTOC
聽BASE/1119 聽 聽Argument error: CTOD
聽BASE/1120 聽 聽Argument error: DTOS
聽BASE/1121 聽 聽Argument error: TYPE
聽BASE/1122 聽 聽Argument error: TRANSFORM
聽BASE/1123 聽 聽Argument error: AADD
聽BASE/1124 聽 聽Argument error: LEFT
聽BASE/1131 聽 聽Bound error: array dimension
聽BASE/1132 聽 聽Bound error: array access
聽BASE/1133 聽 聽Bound error: array assign
聽BASE/1187 聽 聽Bound error: AADD
聽BASE/1209 聽 聽String overflow: +
聽BASE/1210 聽 聽String overflow: -
聽BASE/1233 聽 聽String overflow: 聽SPACE
聽BASE/1234 聽 聽String overflow: REPLICATE
聽BASE/1340 聽 聽Zero divisor: /
聽BASE/1341 聽 聽Zero divisor: %
聽BASE/1449 聽 聽Syntax error: &
聽BASE/1513 聽 聽Operation too complex: &
聽BASE/2005 聽 聽Open error
聽BASE/2006 聽 聽Create error
聽BASE/2011 聽 聽Open error (TYPE command)
聽BASE/2012 聽 聽Open error (COPY FILE command)
聽BASE/5300 聽 聽Memory low
脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛
聽Mensajes de Error TERM

聽Print error
聽TERM/2013 聽 聽Create error (SET ALTERNATE command)
聽TERM/2014 聽 聽Create error (SET PRINTER command)
聽TERM/2015 聽 聽Open error (TO FILE clause)
脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛
聽Mensajes de Error DBFNTX

聽DBFNTX/1001 聽Open error (.dbf)
聽DBFNTX/1002 聽Open error (.dbt)
聽DBFNTX/1003 聽Open error (index)
聽DBFNTX/1004 聽Open error (creating .dbf)
聽DBFNTX/1005 聽Open error (creating .dbt)
聽DBFNTX/1006 聽Create error (creating index)
聽DBFNTX/1010 聽Read error
聽DBFNTX/1011 聽Write error
聽DBFNTX/1012 聽Corruption detected
聽DBFNTX/1020 聽Data type error
聽DBFNTX/1021 聽Data width error
聽DBFNTX/1022 聽Lock required
聽DBFNTX/1023 聽Exclusive required
聽DBFNTX/1024 聽Append lock failed
聽DBFNTX/1025 聽Write not allowed
聽DBFNTX/1026 聽Data width error
聽DBFNTX/1027 聽Limit exceeded
脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛
聽Mensajes de Error DBFNDX

聽DBFNDX/1001 聽Open error (.dbf)
聽DBFNDX/1002 聽Open error (.dbt)
聽DBFNDX/1003 聽Open error (index)
聽DBFNDX/1004 聽Open error (creating .dbf)
聽DBFNDX/1005 聽Open error (creating .dbt)
聽DBFNDX/1006 聽Create error (creating index)
聽DBFNDX/1010 聽Read error
聽DBFNDX/1011 聽Write error
聽DBFNDX/1012 聽Corruption detected
聽DBFNDX/1020 聽Data type error
聽DBFNDX/1021 聽Data width error
聽DBFNDX/1022 聽Lock required
聽DBFNDX/1023 聽Exclusive required
聽DBFNDX/1024 聽Append lock failed
聽DBFNDX/1025 聽Write not allowed
聽DBFNDX/1026 聽Data width error
聽DBFNDX/1027 聽Limit exceeded
脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛
聽Mensajes de Error DBCMD

聽DBCMD/1001 聽 Argument error
聽DBCMD/1003 聽 Argument error
聽DBCMD/1004 聽 Argument error
聽DBCMD/1005 聽 Argument error
聽DBCMD/1006 聽 Argument error
聽DBCMD/1007 聽 Argument error
聽DBCMD/1008 聽 Argument error
聽DBCMD/1009 聽 Argument error
脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛
聽Mensajes de Error Irrecuperable en Ejecuci垄n

聽24 聽 聽 聽 聽 聽 Write error
聽331 聽 聽 聽 聽 聽String/array memory overflow
聽332 聽 聽 聽 聽 聽String/array memory overflow
聽415 聽 聽 聽 聽 聽Cannot open overlay file
聽5302 聽 聽 聽 聽 Conventional memory exhausted
聽5304 聽 聽 聽 聽 Conventional memory exhausted
聽5306 聽 聽 聽 聽 Conventional memory exhausted
聽5312 聽 聽 聽 聽 Conventional memory exhausted

Code (fw): Select all Collapse
 Overview -- Mensajes de Error del Compilador
脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛
聽Mensajes de Advertencia del Compilador

聽C1001 聽 聽 聽 聽Return statement with no value in function
聽C1002 聽 聽 聽 聽Procedure returns value
聽C1003 聽 聽 聽 聽Ambiguous variable reference
聽C1004 聽 聽 聽 聽Ambiguous variable reference, assuming memvar
聽C1005 聽 聽 聽 聽Redefinition or duplicate definition of #define
聽C1007 聽 聽 聽 聽Function does not end with RETURN
脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛
聽Mensajes de Error del Compilador

聽C2001 聽 聽 聽 聽Syntax error
聽C2002 聽 聽 聽 聽Statement undetermined at end of line
聽C2003 聽 聽 聽 聽Syntax error in statement
聽C2004 聽 聽 聽 聽Illegal character
聽C2005 聽 聽 聽 聽Statement not recognized
聽C2006 聽 聽 聽 聽Statement not allowed outside procedure or function
聽C2007 聽 聽 聽 聽Unterminated string
聽C2009 聽 聽 聽 聽Invalid use of @ (pass-by-reference) operator
聽C2010 聽 聽 聽 聽Incorrect number of arguments
聽C2011 聽 聽 聽 聽EXIT statement with no loop in sight
聽C2012 聽 聽 聽 聽LOOP statement with no loop in sight
聽C2013 聽 聽 聽 聽EXIT statement violates enclosing SEQUENCE
聽C2014 聽 聽 聽 聽LOOP statement violates enclosing SEQUENCE
聽C2015 聽 聽 聽 聽Illegal initializer
聽C2016 聽 聽 聽 聽Name conflicts with previous declaration
聽C2017 聽 聽 聽 聽Duplicate variable declaration
聽C2018 聽 聽 聽 聽Outer block variable out of reach
聽C2019 聽 聽 聽 聽CALL of CA-Clipper procedure or function
聽C2020 聽 聽 聽 聽Mistreatment of CALLed symbol
聽C2021 聽 聽 聽 聽Redefinition of CA-Clipper procedure or function
聽C2022 聽 聽 聽 聽Redefinition of predefined function
聽C2023 聽 聽 聽 聽CA-Clipper definition of CALLed symbol
聽C2024 聽 聽 聽 聽Unclosed control structures
聽C2025 聽 聽 聽 聽ELSE does not match IF
聽C2026 聽 聽 聽 聽ELSEIF does not match IF
聽C2027 聽 聽 聽 聽ENDIF does not match IF
聽C2028 聽 聽 聽 聽ENDDO does not match WHILE
聽C2029 聽 聽 聽 聽NEXT does not match FOR
聽C2030 聽 聽 聽 聽ENDCASE does not match DO CASE
聽C2031 聽 聽 聽 聽CASE or OTHERWISE is not immediately within DO CASE
聽C2032 聽 聽 聽 聽TEXT statement error
聽C2033 聽 聽 聽 聽Missing ENDTEXT
聽C2034 聽 聽 聽 聽Formal parameters already declared
聽C2035 聽 聽 聽 聽Invalid Declaration
聽C2036 聽 聽 聽 聽Mayhem in CASE handler
聽C2037 聽 聽 聽 聽Invalid procedure name in DO statement
聽C2038 聽 聽 聽 聽Invalid target name in CALL statement
聽C2039 聽 聽 聽 聽Invalid selector in send
聽C2040 聽 聽 聽 聽Invalid unary inline operator
聽C2041 聽 聽 聽 聽Invalid binary operator
聽C2042 聽 聽 聽 聽Invalid Ivalue
聽C2043 聽 聽 聽 聽Invalid alias expression
聽C2044 聽 聽 聽 聽Invalid function name
聽C2045 聽 聽 聽 聽Target name was used previously in non-CALL context
聽C2046 聽 聽 聽 聽SEQUENCE nesting error
聽C2047 聽 聽 聽 聽GET contains complex macro
聽C2048 聽 聽 聽 聽GET contains both macro and declared symbol references
聽C2049 聽 聽 聽 聽Code block contains complex macro
聽C2050 聽 聽 聽 聽Code block contains both macro and declared symbol references
聽C2051 聽 聽 聽 聽LOCAL declaration follows executable statement
聽C2052 聽 聽 聽 聽MEMVAR declaration follows executable statement
聽C2053 聽 聽 聽 聽FIELD declaration follows executable statement
聽C2054 聽 聽 聽 聽STATIC declaration follows executable statement
聽C2055 聽 聽 聽 聽Syntax error in #define
聽C2056 聽 聽 聽 聽Unexpected end of file in #define
聽C2057 聽 聽 聽 聽Label missing in #define
聽C2058 聽 聽 聽 聽Comma or right parenthesis missing in #define
聽C2059 聽 聽 聽 聽Missing => in #translate/#command
聽C2060 聽 聽 聽 聽Unknown result marker in #translate/#command
聽C2061 聽 聽 聽 聽Label error in #translate/#command
聽C2062 聽 聽 聽 聽Bad match marker in #translate/#command
聽C2063 聽 聽 聽 聽Bad result marker #translate/#command
聽C2064 聽 聽 聽 聽Bad restricted match marker in #translate/#command
聽C2065 聽 聽 聽 聽Empty optional clause in #translate/#command
聽C2066 聽 聽 聽 聽Unclosed optional clause in #translate/#command
聽C2067 聽 聽 聽 聽Too many nested #ifdefs
聽C2068 聽 聽 聽 聽Error in #ifdef
聽C2069 聽 聽 聽 聽#endif does not match #ifdef
聽C2070 聽 聽 聽 聽#else does not match #ifdef
聽C2071 聽 聽 聽 聽Error in #undef
聽C2072 聽 聽 聽 聽Ambiguous match patterns in #translate/#command
聽C2073 聽 聽 聽 聽Result pattern contains nested clauses in #translate/#command
聽C2075 聽 聽 聽 聽Too many locals
聽C2076 聽 聽 聽 聽Too many parameters
聽C2077 聽 聽 聽 聽Too many parameters
聽C2078 聽 聽 聽 聽Circular #define
聽C2079 聽 聽 聽 聽Circular #translate/#command
聽C2086 聽 聽 聽 聽RETURN violates enclosing SEQUENCE
脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛脛
聽Mensajes de Error Grave del Compilador

聽C3001 聽 聽 聽 聽Out of memory
聽C3002 聽 聽 聽 聽Input buffer overflow
聽C3003 聽 聽 聽 聽Can't open intermediate file
聽C3004 聽 聽 聽 聽Bad command line option
聽C3005 聽 聽 聽 聽Bad command line parameter
聽C3006 聽 聽 聽 聽Can't create preprocessed output file
聽C3007 聽 聽 聽 聽Can't open #include file
聽C3008 聽 聽 聽 聽Bad filename in #include
聽C3009 聽 聽 聽 聽Too many nested #includes
聽C3010 聽 聽 聽 聽Invalid name follows #
聽C3011 聽 聽 聽 聽Can't open standard rule file
聽C3012 聽 聽 聽 聽Too many standard rules
聽C3013 聽 聽 聽 聽Expression stack overflow
聽C3014 聽 聽 聽 聽Expression stack underflow
聽C3015 聽 聽 聽 聽Control stack overflow
聽C3016 聽 聽 聽 聽Control stack underflow
聽C3017 聽 聽 聽 聽Error reading or opening script file
聽C3018 聽 聽 聽 聽Too many symbols
聽C3019 聽 聽 聽 聽Too many publics
聽C3020 聽 聽 聽 聽Too many segments
聽C3021 聽 聽 聽 聽Too many fixups
聽C3022 聽 聽 聽 聽Too many external references
聽C3023 聽 聽 聽 聽Too many labels
聽C3024 聽 聽 聽 聽Too many procs
聽C3025 聽 聽 聽 聽Too many proc requests
聽C3026 聽 聽 聽 聽Segment too big
聽C3027 聽 聽 聽 聽Proc too big
聽C3028 聽 聽 聽 聽Symbol table too big
聽C3029 聽 聽 聽 聽Write error to intermediate file
聽C3030 聽 聽 聽 聽Write error to OBJ
聽C3031 聽 聽 聽 聽Can't create OBJ
聽C3032 聽 聽 聽 聽Can't create intermediate file
Mi abuelo dec铆a: Los aviones vuelan porque Dios quiere, y los helic贸pteros ni Dios sabe porque vuelan.

FWH 16.02, xHarbour 1.2.3, Harbour 3.2.0, WorkShop 4.5, AJ Make 0.30, Borlan BCC 7.00, VisualStudio 2013
Posts: 989
Joined: Thu Nov 24, 2005 03:01 PM
Re: Nombre de las variables locales
Posted: Sat Nov 23, 2013 07:41 PM
sergisenna wrote:Hola de nuevo,
He visto que en algunos errores si que aparece el nombre de algunas variables, pero no se como lo obtiene, un ejemplo es:

- Error description: Error BASE/1003 Variable does not exist: miVariable

A ver si alguien tiene alguna idea....
Gracias.

Creo que est谩s confundiendo: No obtiene ningun nombre, exactamente todo lo contrario: Has hecho referencia a un nombre(s铆mbolo) 'miVariable' que el compilador ha supuesto que existir铆a como campo, public o private cuando se ejecute el c贸digo, pero cuando ha llegado a ese punto del c贸digo no ha encontrado nada que se llame miVariable, y te lo est谩 reclamando.
Lo que se referencia por nombre en tiempo de ejecuci贸n son SOLO campos, publics y privates, el resto desaparece y solo se usa la direcci贸n que el compilador le asigna a cada variable en el segmento de memoria correspondiente, del m贸dulo (statics) o en la pila (locals).
Si hubieses compilado sin declaracion autom谩tica de variables, el error de variable no encontrada lo hubiese dado el mismo compilador.
Saludos
Carlos Mora
http://harbouradvisor.blogspot.com/
StackOverflow http://stackoverflow.com/users/549761/carlos-mora
鈥淚f you think education is expensive, try ignorance"
Posts: 10
Joined: Tue Jun 28, 2011 08:26 PM
Re: Nombre de las variables locales
Posted: Tue Nov 26, 2013 12:42 PM
Ok, creo que lo del error (1003) concreto ha quedado claro.
A煤n as铆 no se si existir谩 alguna manera de conseguir lo que propuse al principio, aunque solo sea con alg煤n tipo de variables. La propuesta era:


Ejemplo:
- En uno de mis informes de errores aparece -> Local 14: N 825236739
- Lo que quiero que aparezca -> miContador: N 825236739


Gracias por las respuestas!
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Nombre de las variables locales
Posted: Wed Nov 27, 2013 11:13 AM

El compilador (Harbour) no genera nombres (que irian a la tabla de s铆mbolos p煤blica) para las variables locales (local) y staticas (static), a menos que compilemos con la opci贸n /b de Harbour, que genera esa informaci贸n para usar el debugger, asi que sin /b s贸lo son referenciados desde la tabla de s铆mbolos local, en donde son usadas por su posici贸n

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1283
Joined: Fri Feb 10, 2006 02:34 PM
Re: Nombre de las variables locales
Posted: Wed Nov 27, 2013 01:37 PM
Hola,

La unica manera de obtener esta informaci贸n es activando el flag /b para activar el debugger. Actualmente activaria de manera automatica el debugger de FWH, pero es muy f谩cil en principio obtener esta informaci贸n, sin necesidad de que se nos active el debugger de FWH y obtener la informaci贸n dentro de un errorsysw.prg.

El inconveniente de esta t茅cnica es que solo es aconsejable para modos de testeo, ya que al compilar con /b, harbour realiza sus propios procesos para manejar la informaci贸n de depuraci贸n, y puede ralentizar el proceso.

B谩sicamente tendriamos de hacer:

Poner por ejemplo en el modulo principal:
Code (fw): Select all Collapse
#include "FiveWin.ch"

/* Mode of __dbgEntry calls (the first parameter) */
#define HB_DBG_GETENTRY 聽 聽 聽 6 聽/* initialize C __dbgEntry function pointer */
#define HB_DBG_ACTIVATE 聽 聽 聽 7 聽/* activate debugger interface */

STATIC aStack

FUNCTION __dbgGetStack() ; RETU aStack

*------------------------------------------------------------------------
FUNCTION __dbgEntry( nMode, uParam1, uParam2, uParam3, uParam4, uParam5 )
*------------------------------------------------------------------------

聽 聽DO CASE

聽 聽 聽 聽CASE nMode == HB_DBG_GETENTRY

聽 聽 聽 聽 聽 聽 __dbgSetEntry()

聽 聽 聽 聽CASE nMode == HB_DBG_ACTIVATE

聽 聽 聽 聽 聽 聽 aStack := uParam3

聽 聽ENDCASE

RETU NIL


Luego nos podriamos crear nuestro propio errsysw.prg

Code (fw): Select all Collapse
#include "FiveWin.ch"

external _fwGenError 聽 // Link FiveWin generic Error Objects Generator

#define NTRIM(n) 聽 聽( LTrim( Str( n ) ) )

//----------------------------------------------------------------------------//

// Note: automatically executes at startup

proc ErrorSys()
聽 聽 ErrorBlock( { | e | ErrorDialog( e ) } )
return

//----------------------------------------------------------------------------//

static function ErrorDialog( e ) // -> logical or quits App.

聽 聽local nI, cNameVar
聽 聽local nLevel := __dbgprocLevel() - 1
聽 聽local aPila 聽:= __dbgGetStack()[1]
聽 聽local aVar 聽 := aPila[5]
聽 聽local cTitle := aPila[1] + ' => Function ' + aPila[2] + ' (' + ltrim(str( aPila[3])) + ')'
聽 聽local cInfo 聽:= ''

聽 聽FOR nI := 1 TO Len( aVar )

聽 聽 聽 聽cNameVar 聽:= aVar[nI][1]
聽 聽 聽 聽nLevelVar := aVar[nI][2]
聽 聽 聽 聽uVal 聽 聽 聽:= __dbgvmVarLGet( nLevel , nLevelVar )

聽 聽 聽 聽cInfo += cNameVar + Chr( VK_TAB ) + cValToChar( uVal )
聽 聽 聽 聽cInfo += CRLF

聽 聽NEXT

聽 聽MsgInfo( cInfo, ctitle )

聽 聽QUIT

RETU NIL


Y Listos

Este codigo de test:

Code (fw): Select all Collapse
#include 'fivewin.ch'

FUNCTION Main()

聽 聽 LOCAL dMiVar := Date()
聽 聽 LOCAL nNace 聽:= 1967
聽 聽 LOCAL cName 聽:= 'Charly'
聽 聽 LOCAL aData 聽:= { 1111, 2222 }

聽 聽 MsgInfo( nEdad + cName )

RETU NIL


Produce este error:



A partir de aqui te puedes crear tu errsysw como mas se adapte a tus encesidades, pero entiendo que esta practica es solo aconsejable para depuraciones....
Salutacions, saludos, regards

"...programar es f谩cil, hacer programas es dif铆cil..."

UT Page -> https://carles9000.github.io/
Forum UT -> https://discord.gg/bq8a9yGMWh
HIX -> https://github.com/carles9000/hix
Posts: 989
Joined: Thu Nov 24, 2005 03:01 PM
Re: Nombre de las variables locales
Posted: Thu Nov 28, 2013 03:10 PM

Carles,

En 2 palabras: im presionante.

Es cierto que puede poner las cosas un poco m谩s pesadas, pero en desarrollo viene m谩s que bien.

Muchas gracias por la clase de 'debugging'

Un abrazo

Saludos
Carlos Mora
http://harbouradvisor.blogspot.com/
StackOverflow http://stackoverflow.com/users/549761/carlos-mora
鈥淚f you think education is expensive, try ignorance"
Posts: 1283
Joined: Fri Feb 10, 2006 02:34 PM
Re: Nombre de las variables locales
Posted: Fri Nov 29, 2013 02:35 PM

Hola

Carlos -> gracias :wink:

Evidentemente solo funciona con Harbour.... :D

Salutacions, saludos, regards

"...programar es f谩cil, hacer programas es dif铆cil..."

UT Page -> https://carles9000.github.io/
Forum UT -> https://discord.gg/bq8a9yGMWh
HIX -> https://github.com/carles9000/hix

Continue the discussion