From 4ee2b02130ff9cba7b8764db3c272ec78bbbcaf6 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Tue, 3 Aug 1999 13:11:36 +0000 Subject: [PATCH] *** empty log message *** --- harbour/ChangeLog | 28 ++++++ harbour/include/Makefile | 85 +++++++++------- harbour/include/compiler.h | 18 ++-- harbour/include/extend.h | 6 +- harbour/include/itemapi.h | 2 +- harbour/include/rddapi.h | 159 +++++++++++++++--------------- harbour/makefile.b16 | 2 +- harbour/source/rtl/console.c | 28 ++---- harbour/source/rtl/descend.c | 37 +++---- harbour/source/rtl/strings.c | 2 +- harbour/source/vm/hvm.c | 11 +-- harbour/terminal.b32 | 2 +- harbour/tests/working/descend.prg | 57 +++++++---- 13 files changed, 246 insertions(+), 191 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 1192fdcb61..1b79e43b36 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,31 @@ +19990803-14:55 GMT+1 Victor Szel + ! source/rtl/strings.c - ASC() fixed. It could return negative values + since a typecase (BYTE) was missing. + ! source/rtl/descend.c + * Fixed so that it's returning NIL type + on bad parameter type, and not "NIL" as a string. + * Fixed Chr(0) handling in the middle of the string. + * Fixed so that it returns DOUBLE type even when an integer + is passed, just like in Clipper. + + tests/working/descend.prg - Output to STD, plus some new tests. + ! source/rtl/console.c + makefile.b16 + makefile.b31 + terminal.b32 + WINDOWS define check removed. QOUT() will no longer + throw a MessageBox() when compiled wit -DWINDOWS + Since this by no means expected behaviour. + To throw a MessageBox() one should call a user function + to do this. + - source/vm/hvm.c + WINDOWS define check removed, since it was never defined, + in any current build system. + * include/rddapi.h + "Translated" to English. + + include/extend.h - Added hb_strdescend() function extern. + + include/itemapi.h - Added type EVALINFO_PTR + ! include/Makefile - Completed file lists. + 19990803-12:22 GMT+1 Victor Szel ! include/rddapi.h ITEM -> PHB_ITEM diff --git a/harbour/include/Makefile b/harbour/include/Makefile index 7ef2f6ff04..7c7eeea9f7 100644 --- a/harbour/include/Makefile +++ b/harbour/include/Makefile @@ -5,45 +5,58 @@ ROOT = ../ C_HEADERS=\ - box.h \ - compiler.h \ - ctoharb.h \ - dates.h \ - errorapi.h \ - extend.h \ - filesys.h \ - gtapi.h \ - hbdefs.h \ - hberrors.h \ - hbpp.h \ - hbsetup.h \ - hbver.h \ - init.h \ - initsymb.h \ - inkey.h \ - itemapi.h \ - pcode.h \ - run_exp.h \ - set.h \ + box.h \ + clipdefs.h \ + compiler.h \ + ctoharb.h \ + dates.h \ + errorapi.h \ + extend.h \ + filesys.h \ + gtapi.h \ + hbdefs.h \ + hberrors.h \ + hbpp.h \ + hbsetup.h \ + hbver.h \ + init.h \ + initsymb.h \ + inkey.h \ + itemapi.h \ + pcode.h \ + rddapi.h \ + run_exp.h \ + set.h \ PRG_HEADERS=\ - box.ch \ - classes.ch \ - color.ch \ - error.ch \ - fileio.ch \ - inkey.ch \ - rddsys.ch \ - set.ch \ - setcurs.ch \ + achoice.ch \ + assert.ch \ + box.ch \ + classes.ch \ + color.ch \ + common.ch \ + dbedit.ch \ + dbstruct.ch \ + directry.ch \ + error.ch \ + fileio.ch \ + getexit.ch \ + inkey.ch \ + memoedit.ch \ + rddsys.ch \ + set.ch \ + setcurs.ch \ + simpleio.ch \ API_HEADERS=\ - error.api \ - extend.api \ - filesys.api \ - fm.api \ - gt.api \ - item.api \ - rdd.api \ + caundoc.api \ + error.api \ + extend.api \ + filesys.api \ + fm.api \ + gt.api \ + item.api \ + rdd.api \ + vm.api \ include $(TOP)$(ROOT)config/header.cf diff --git a/harbour/include/compiler.h b/harbour/include/compiler.h index 92181d99f4..682d2dc835 100644 --- a/harbour/include/compiler.h +++ b/harbour/include/compiler.h @@ -29,7 +29,8 @@ /* compiler related declarations */ -typedef struct _VAR /* locals, static, public variables support */ +/* locals, static, public variables support */ +typedef struct _VAR { char *szName; /* variable name */ char *szAlias; /* variable alias namespace */ @@ -38,6 +39,7 @@ typedef struct _VAR /* locals, static, public variables support */ struct _VAR * pNext; /* pointer to next defined variable */ } VAR, * PVAR; +/* structure to hold a Clipper defined function */ typedef struct __FUNC /* functions definition support */ { char * szName; /* name of a defined Clipper function */ @@ -54,16 +56,18 @@ typedef struct __FUNC /* functions definition support */ WORD wStaticsBase; /* base for this function statics */ struct __FUNC * pOwner; /* pointer to the function/procedure that owns the codeblock */ struct __FUNC * pNext; /* pointer to the next defined function */ -} _FUNC, * PFUNCTION; /* structure to hold a Clipper defined function */ +} _FUNC, * PFUNCTION; +/* structure to control all Clipper defined functions */ typedef struct { PFUNCTION pFirst; /* pointer to the first defined funtion */ PFUNCTION pLast; /* pointer to the last defined function */ int iCount; /* number of defined functions */ -} FUNCTIONS; /* structure to control all Clipper defined functions */ +} FUNCTIONS; -typedef struct _COMSYMBOL /* compiler symbol support structure */ +/* compiler symbol support structure */ +typedef struct _COMSYMBOL { char * szName; /* the name of the symbol */ char cScope; /* the scope of the symbol */ @@ -71,14 +75,16 @@ typedef struct _COMSYMBOL /* compiler symbol support structure */ struct _COMSYMBOL * pNext; /* pointer to the next defined symbol */ } COMSYMBOL, * PCOMSYMBOL; -typedef struct /* symbol table support structures */ +/* symbol table support structures */ +typedef struct { PCOMSYMBOL pFirst; /* pointer to the first defined symbol */ PCOMSYMBOL pLast; /* pointer to the last defined symbol */ int iCount; /* number of defined symbols */ } SYMBOLS; -typedef struct _STACK_VAL_TYPE /* locals, static, public variables support */ +/* locals, static, public variables support */ +typedef struct _STACK_VAL_TYPE { char cType; /* type of stack value */ struct _STACK_VAL_TYPE * pPrev; /* pointer to previous stack value's type */ diff --git a/harbour/include/extend.h b/harbour/include/extend.h index c7b0ed23be..80a687dc58 100644 --- a/harbour/include/extend.h +++ b/harbour/include/extend.h @@ -42,7 +42,8 @@ struct _DYNSYM; /* forward declaration */ -typedef struct /* symbol support structure */ +/* symbol support structure */ +typedef struct { char* szName; /* the name of the symbol */ SYMBOLSCOPE cScope; /* the scope of the symbol */ @@ -307,6 +308,7 @@ extern void hb_arrayAdd( PHB_ITEM pArray, PHB_ITEM pItemValue ); extern int hb_stricmp( const char *s1, const char *s2 ); extern BOOL hb_strempty( char * szText, ULONG ulLen ); +extern char * hb_strdescend( char * szText, ULONG ulLen ); extern WORD hb_strgreater( char * sz1, char * sz2 ); extern void hb_strupr( char * szText ); extern BOOL hb_strMatchRegExp( char * szString, char * szMask ); @@ -333,7 +335,7 @@ extern PHB_ITEM hb_CodeblockGetRef( PHB_ITEM, PHB_ITEM ); extern void hb_CodeblockEvaluate( PHB_ITEM ); extern void hb_CodeblockCopy( PHB_ITEM, PHB_ITEM ); -/* Initialisation and closing memvars subsystem */ +/* memvars subsystem */ extern HB_HANDLE hb_MemvarValueNew( PHB_ITEM, int ); extern HB_VALUE_PTR * hb_MemvarValueBaseAddress( void ); extern void hb_MemvarsInit( void ); diff --git a/harbour/include/itemapi.h b/harbour/include/itemapi.h index 5673c52953..56a7369f5d 100644 --- a/harbour/include/itemapi.h +++ b/harbour/include/itemapi.h @@ -34,7 +34,7 @@ typedef struct { PHB_ITEM pItems[ HB_EVAL_PARAM_MAX_ + 1 ]; -} EVALINFO, * PEVALINFO; +} EVALINFO, * PEVALINFO, * EVALINFO_PTR; extern PHB_ITEM hb_evalLaunch ( PEVALINFO pEvalInfo ); extern BOOL hb_evalNew ( PEVALINFO pEvalInfo, PHB_ITEM pItem ); diff --git a/harbour/include/rddapi.h b/harbour/include/rddapi.h index 2437007604..bb8ee7f1af 100644 --- a/harbour/include/rddapi.h +++ b/harbour/include/rddapi.h @@ -82,7 +82,7 @@ typedef void * FARP; #define DBI_USER 1000 /* Start of user definable DBI_ values */ -/* codes for SELF_RECINFO() */ +/* Codes for SELF_RECINFO() */ #define DBRI_DELETED 1 #define DBRI_LOCKED 2 @@ -91,14 +91,14 @@ typedef void * FARP; #define DBRI_UPDATED 5 -/* codes for SELF_FIELDINFO() */ +/* Codes for SELF_FIELDINFO() */ #define DBS_NAME 1 #define DBS_TYPE 2 #define DBS_LEN 3 #define DBS_DEC 4 -/* codes for RawLock types */ +/* Codes for RawLock types */ #define FILE_LOCK 1 #define FILE_UNLOCK 2 @@ -160,7 +160,7 @@ typedef DBOPENINFO * LPDBOPENINFO; /* * DBORDERCONDINFO * --------------- -* La estructura de creaci¢n condicional de orden +* The Create Order conditional Info structure */ #ifdef 0 @@ -196,22 +196,21 @@ typedef DBORDERCONDINFO * LPDBORDERCONDINFO; /* * DBORDERCREATE * ------------- -* La estructura de creaci¢n de orden +* The Create Order Info structure */ #ifdef 0 typedef struct { - LPDBORDERCONDINFO lpdbOrdCondInfo; /* Informaci¢n condicional */ - BYTEP abBagName; /* Nombre del contenedor de ¢rdenes */ - BYTEP atomBagName; + LPDBORDERCONDINFO lpdbOrdCondInfo; /* Conditional information */ + BYTEP abBagName; /* Name of the Order bag */ + BYTEP atomBagName; /* Name of the Order */ PHB_ITEM itmOrder; - BOOL fUnique; /* Indicador que determina si todas */ + BOOL fUnique; /* Flag to determine if all keys are unique */ /* las claves con £nicas */ - PHB_ITEM itmCobExpr; /* Bloque de c¢digo conteniendo la */ - /* expresi¢n clave */ - PHB_ITEM abExpr; /* Cadena conteniendo la expresi¢n clave */ + PHB_ITEM itmCobExpr; /* Code block containing the KEY expression */ + PHB_ITEM abExpr; /* String containing the KEY expression */ } DBORDERCREATEINFO; typedef DBORDERCREATEINFO * LPDBORDERCREATEINFO; @@ -222,18 +221,18 @@ typedef DBORDERCREATEINFO * LPDBORDERCREATEINFO; /* * DBORDERINFO * ----------- -* La estructura de Set Index +* The Set Index Info structure */ #ifdef 0 typedef struct { - PHB_ITEM atomBagName; /* Nombre del contenedor de ¢rdenes */ - PHB_ITEM itmOrder; /* Nombre o n£mero de la orden */ + PHB_ITEM atomBagName; /* Name of the Order Bag */ + PHB_ITEM itmOrder; /* Name or Number of the Order */ - PHB_ITEM itmCobExpr; /* Bloque de c¢digo conteniendo la expresi¢n clave */ + PHB_ITEM itmCobExpr; /* Code block containing the KEY expression */ - PHB_ITEM itmResult; /* Resultado de la operaci¢n */ + PHB_ITEM itmResult; /* Operation result */ BOOL fAllTags; /* Indicador de todos los tags a abrir */ @@ -247,19 +246,19 @@ typedef DBORDERINFO * LPDBORDERINFO; /* * DBSCOPEINFO * ----------- -* La estructura de  mbito +* The Scope Info structure */ #ifdef 0 typedef struct { - PHB_ITEM itmCobFor; /* Bloque de c¢digo representaci¢n de una cl usula FOR */ - PHB_ITEM lpstrFor; /* Cadena representaci¢n de una cl usula FOR */ - PHB_ITEM itmCobWhile; /* Bloque de c¢digo representaci¢n de una cl usula WHILE */ - PHB_ITEM lpstrWhile; /* Cadena representaci¢n de una cl usula WHILE */ - PHB_ITEM lNext; + PHB_ITEM itmCobFor; /* Code Block representation of a FOR clause */ + PHB_ITEM lpstrFor; /* String representation of a FOR clause */ + PHB_ITEM itmCobWhile; /* Code Block representation of a WHILE clause */ + PHB_ITEM lpstrWhile; /* String representation of a WHILE clause */ + PHB_ITEM lNext; /* NEXT record */ PHB_ITEM itmRecID; - PHB_ITEM fRest; /* TRUE si se empieza desde el registro actual */ + PHB_ITEM fRest; /* TRUE if start from the current record */ BOOL fIgnoreFilter; BOOL fIncludeDeleted; @@ -276,14 +275,14 @@ typedef DBSCOPEINFO * LPDBSCOPEINFO; /* * DBFILTERINFO * ------------ -* La estructura de filtro +* The Filter Info structure */ #ifdef 0 typedef struct { - PHB_ITEM itmCobExpr; /* Bloque representaci¢n de la expresi¢n FILTER */ - PHB_ITEM abFilterText; /* Cadena representaci¢n de la expresi¢n FILTER */ + PHB_ITEM itmCobExpr; /* Block representation of the FILTER expression */ + PHB_ITEM abFilterText; /* String representation of FILTER expression */ BOOL fFilter; } DBFILTERINFO; @@ -295,19 +294,19 @@ typedef DBFILTERINFO * LPDBFILTERINFO; /* * DBRELINFO * ------------ -* La estrurcura de relaciones +* The Relationship Info structure */ #ifdef 0 typedef struct _DBRELINFO { - PHB_ITEM itmCobExpr; /* Bloque representaci¢n de la clave relacional SEEK */ - PHB_ITEM abKey; /* Cadena representaci¢n de la clave relacional SEEK */ + PHB_ITEM itmCobExpr; /* Block representation of the relational SEEK key */ + PHB_ITEM abKey; /* String representation of the relational SEEK key */ - struct _AREA *lpaParent; /* El padre de esta relaci¢n */ - struct _AREA *lpaChild; /* Los hijos del padre */ + struct _AREA *lpaParent; /* The parent of this relation */ + struct _AREA *lpaChild; /* The parents children */ - struct _DBRELINFO *lpdbriNext; /* Siguiente hijo o padre */ + struct _DBRELINFO *lpdbriNext; /* Next child or parent */ } DBRELINFO; @@ -319,17 +318,17 @@ typedef DBRELINFO * LPDBRELINFO; /* * DBEVALINFO * ------------ -* La estructura de evaluaci¢n +* The Evaluation Info structure * -* Contiene la informaci¢n necesaria para la evaluaci¢n de un bloque -* en cada registro del  rea de trabajo +* Contains information necessary for a block evaluation +* on each record of the workarea */ #ifdef 0 typedef struct { - PHB_ITEM itmBlock; /* El bloque a evaluar */ - DBSCOPEINFO dbsci; /* Ambito que limita la evaluaci¢n */ + PHB_ITEM itmBlock; /* The block to be evaluated */ + DBSCOPEINFO dbsci; /* Scope info that limits the evaluation */ } DBEVALINFO; typedef DBEVALINFO * LPDBEVALINFO; @@ -339,17 +338,17 @@ typedef DBEVALINFO * LPDBEVALINFO; /* * DBTRANSITEM * ------------ -* La estructura de transferencia +* The Transfer Item structure * -* Define un elemento de transferencia simple (normalmente un campo) -* de una base de datos a otra; utilizada por DBTRANSINFO +* Defines a single transfer item (usually a field) from +* one database to another; used by DBTRANSINFO */ #ifdef 0 typedef struct { - USHORT uiSource; /* N£mero de ¡ndice de campo del fuente */ - USHORT uiDest; /* N£mero de ¡ndice de campo del destino */ + USHORT uiSource; /* Field index number from the source */ + USHORT uiDest; /* Destination field index number */ } DBTRANSITEM; typedef DBTRANSITEM * LPDBTRANSITEM; @@ -359,23 +358,23 @@ typedef DBTRANSITEM * LPDBTRANSITEM; /* * DBTRANSINFO * ------------ -* La estructura de transferenciaz +* The Transfer Info structure * -* Define una transferencia de elementos de datos global de un -*  rea de trabajo a otra +* Defines a global transfer of data items from on workarea +* to another */ #ifdef 0 typedef struct { - struct _AREA *lpaSource; /* Puntero al  rea de trabajo fuente */ - struct _AREA *lpaDest; /* Puntero al  rea de trabajo destino */ - DBSCOPEINFO dbsci; /* Ambito de limitaci¢n de transferencia */ + struct _AREA *lpaSource; /* Pointer to source work area */ + struct _AREA *lpaDest; /* Pointer to dest work area */ + DBSCOPEINFO dbsci; /* Scope to limit transfer */ - USHORT uiFlags; /* Atributos de transferencia */ + USHORT uiFlags; /* Transfer attributes */ - USHORT uiItemCount; /* Contador de elementos */ - LPDBTRANSITEM lpTransItems; /* Matriz de elementos */ + USHORT uiItemCount; /* Number of items below */ + LPDBTRANSITEM lpTransItems; /* Array of items */ } DBTRANSINFO; typedef DBTRANSINFO * LPDBTRANSINFO; @@ -385,25 +384,24 @@ typedef DBTRANSINFO * LPDBTRANSINFO; /* * DBSORTITEM * ---------- -* La estructura de ordenaci¢n +* The Sort Item Structure * -* Una matriz de elementos que, juntos, indican el valor clave a -* utilizar al ordenar datos. El orden de la matriz determina el -* orden de la ordenaci¢n. +* An array of items that, together, indicate the key value to +* use while sorting data. The order of the array determines the +* order of the sorting. */ #ifdef 0 typedef struct { - USHORT uiField; /* Indice dentro de la estructura */ - /*  rea-de-trabajo->campos */ - USHORT uiFlags; /* Indicadores de ordenaci¢n */ + USHORT uiField; /* Index into the workarea->fields structure */ + USHORT uiFlags; /* Sort flags */ } DBSORTITEM; typedef DBSORTITEM * LPDBSORTITEM; #endif -/* Indicadores para DBSORTITEM */ +/* Flags for DBSORTITEM */ #define SF_ASCEND 1 #define SF_CASE 2 #define SF_DESCEND 4 @@ -416,19 +414,18 @@ typedef DBSORTITEM * LPDBSORTITEM; /* * DBSORTINFO * ---------- -* La estructura de ordenaci¢n +* The Sort Info Structure * -* Informaci¢n para la ordenaci¢n f¡sica en un  rea de trabajo +* Information for a physical sort on the workarea */ #ifdef 0 typedef struct { - DBTRANSINFO dbtri; /* Informaci¢n de transferencia del  rea de */ - /* trabajo destino */ - LPDBSORTITEM lpdbsItem; /* Campos que componen los valores claves en */ - /* la ordenaci¢n */ - USHORT uiItemCount; /* Contador de elementos */ + DBTRANSINFO dbtri; /* Destination workarea transfer information */ + + LPDBSORTITEM lpdbsItem; /* Fields which compose the key values for the sort */ + USHORT uiItemCount; /* The number of fields above */ } DBSORTINFO; @@ -439,9 +436,9 @@ typedef DBSORTINFO * LPDBSORTINFO; /* * DBLOCKINFO * ---------- -* La estructura de bloqueo +* The Lock Info Structure * -* Contiene informaci¢n de bloqueos de registro o fichero +* Information for a record or file lock */ #ifdef 0 @@ -859,11 +856,11 @@ typedef RDDFUNCS * PRDDFUNCS; #define SELF_TABLEEXT(w, fp) ((*(w)->lprfsHost->info)(w, DBI_TABLEEXT, fp)) -/*--------------------* M‚todos SUPER *------------------------*/ +/*--------------------* SUPER Methods *------------------------*/ #ifdef 0 -/* M‚todos de movimiento y posicionamiento */ +/* Movement and positioning methods */ #define SUPER_BOF(w, sp) ((*(SUPERTABLE)->bof)(w, sp)) #define SUPER_EOF(w, sp) ((*(SUPERTABLE)->eof)(w, sp)) @@ -878,7 +875,7 @@ typedef RDDFUNCS * PRDDFUNCS; #define SUPER_SKIPRAW(w, l) ((*(SUPERTABLE)->skipRaw)(w, l)) -/* Manejo de datos */ +/* Data management */ #define SUPER_ADDFIELD(w, ip) ((*(SUPERTABLE)->addField)(w, ip)) #define SUPER_APPEND(w,l) ((*(SUPERTABLE)->append)(w,l)) @@ -904,7 +901,7 @@ typedef RDDFUNCS * PRDDFUNCS; #define SUPER_SETFIELDEXTENT(w, s) ((*(SUPERTABLE)->setFieldExtent)(w, s)) -/* Manejo de  reas de trabajo/bases de datos */ +/* WorkArea/Database management */ #define SUPER_ALIAS(w, bp) ((*(SUPERTABLE)->alias)(w, bp)) #define SUPER_CLOSE(w) ((*(SUPERTABLE)->close)(w)) @@ -924,7 +921,7 @@ typedef RDDFUNCS * PRDDFUNCS; #define SUPER_ZAP(w) ((*(SUPERTABLE)->zap)(w)) -/* M‚todos relacionales */ +/* Relational Methods */ #define SUPER_CHILDEND(w, ip) ((*(SUPERTABLE)->childEnd)(w, ip)) #define SUPER_CHILDSTART(w, ip) ((*(SUPERTABLE)->childStart)(w, ip)) @@ -938,7 +935,7 @@ typedef RDDFUNCS * PRDDFUNCS; #define SUPER_SETREL(w, ip) ((*(SUPERTABLE)->setRel)(w, ip)) -/* Manejo de ¢rdenes */ +/* Order Management */ #define SUPER_ORDLSTADD(w, lp) ((*(SUPERTABLE)->orderListAdd)(w, lp)) #define SUPER_ORDLSTDELETE(w, lp) ((*(SUPERTABLE)->orderListDelete)(w, lp)) @@ -960,7 +957,7 @@ typedef RDDFUNCS * PRDDFUNCS; #define SUPER_ORDBAGEXT(w, p) ((*(SUPERTABLE)->orderInfo)(w, DBOI_BAGEXT, p)) -/* Establecimiento de filtros y  mbitos */ +/* Filters and Scope Settings */ #define SUPER_CLEARFILTER(w) ((*(SUPERTABLE)->clearFilter)(w)) #define SUPER_CLEARLOCATE(w) ((*(SUPERTABLE)->clearLocate)(w)) @@ -974,14 +971,14 @@ typedef RDDFUNCS * PRDDFUNCS; #define SUPER_SKIPSCOPE(w, bp, l) ((*(SUPERTABLE)->skipScope)(w, bp, l)) -/* Diversos */ +/* Miscellaneous */ #define SUPER_COMPILE(w, bp) ((*(SUPERTABLE)->compile)(w, bp)) #define SUPER_ERROR(w, ip) ((*(SUPERTABLE)->error)(w, ip)) #define SUPER_EVALBLOCK(w, v) ((*(SUPERTABLE)->evalBlock)(w, v)) -/* Operaciones de red */ +/* Network operations */ #define SUPER_GETLOCKS(w, g) ((*(SUPERTABLE)->info)(w, DBI_GETLOCKARRAY, g)) #define SUPER_RAWLOCK(w, i, l) ((*(SUPERTABLE)->rawlock)(w, i, l)) @@ -989,7 +986,7 @@ typedef RDDFUNCS * PRDDFUNCS; #define SUPER_UNLOCK(w) ((*(SUPERTABLE)->unlock)(w)) -/* Funciones de ficheros memo */ +/* Memofile functions */ #define SUPER_CLOSEMEMFILE(w) ((*(SUPERTABLE)->closeMemFile)(w)) #define SUPER_CREATEMEMFILE(w,bp) ((*(SUPERTABLE)->createMemFile)(w,bp)) @@ -998,13 +995,13 @@ typedef RDDFUNCS * PRDDFUNCS; #define SUPER_PUTVALUEFILE(w,i,bp) ((*(SUPERTABLE)->putValueFile)(w,i,bp)) -/* Manejo de cabeceras de ficheros de base de datos */ +/* Database file header handling */ #define SUPER_READDBHEADER(w) ((*(SUPERTABLE)->readDBHeader)(w)) #define SUPER_WRITEDBHEADER(w) ((*(SUPERTABLE)->writeDBHeader)(w)) -/* Operaciones Info */ +/* Info operations */ #define SUPER_RECSIZE(w, lp) ((*(SUPERTABLE)->info)(w, DBI_GETRECSIZE, lp)) #define SUPER_HEADERSIZE(w, fp) ((*(SUPERTABLE)->info)(w, DBI_GETHEADERSIZE, fp)) diff --git a/harbour/makefile.b16 b/harbour/makefile.b16 index e9138c7984..fbe84ac521 100644 --- a/harbour/makefile.b16 +++ b/harbour/makefile.b16 @@ -26,7 +26,7 @@ libs\win16\terminal.lib : console.obj console.obj : console.c extend.h hbdefs.h bcc -c -O2 -I.\include -o$@ source\rtl\console.c tlib .\libs\b16\terminal.lib -+$@,, - bcc -c -O2 -DWINDOWS _DHARBOUR_USE_GTAPI -I.\include -o$@ source\rtl\console.c + bcc -c -O2 -D_DHARBOUR_USE_GTAPI -I.\include -o$@ source\rtl\console.c tlib .\libs\win16\terminal.lib -+$@,, arrays.obj : arrays.c extend.h hbdefs.h diff --git a/harbour/source/rtl/console.c b/harbour/source/rtl/console.c index 09fdc755eb..d59ee76174 100644 --- a/harbour/source/rtl/console.c +++ b/harbour/source/rtl/console.c @@ -38,10 +38,6 @@ See doc/hdr_tpl.txt, Version 1.2 or later, for licensing terms. */ -#ifdef WINDOWS - #include -#endif - #include "hbsetup.h" #include "extend.h" #include "itemapi.h" @@ -536,20 +532,16 @@ HARBOUR HB_QQOUT( void ) /* writes a list of values to the current device (scree HARBOUR HB_QOUT( void ) { - #ifdef WINDOWS - MessageBox( 0, hb_parc( 1 ), "Harbour", 0 ); - #else - WORD count; - hb_altout( CrLf, CRLF_BUFFER_LEN-1 ); - if( hb_set.HB_SET_PRINTER && hb_set_printhan >= 0 ) - { - p_row++; - p_col = hb_set.HB_SET_MARGIN; - count = p_col; - while( count-- > 0 ) write( hb_set_printhan, " ", 1 ); - } - HB_QQOUT(); - #endif + WORD count; + hb_altout( CrLf, CRLF_BUFFER_LEN-1 ); + if( hb_set.HB_SET_PRINTER && hb_set_printhan >= 0 ) + { + p_row++; + p_col = hb_set.HB_SET_MARGIN; + count = p_col; + while( count-- > 0 ) write( hb_set_printhan, " ", 1 ); + } + HB_QQOUT(); } HARBOUR HB_SETPOS( void ) /* Sets the screen position */ diff --git a/harbour/source/rtl/descend.c b/harbour/source/rtl/descend.c index a8df43290e..0978c4de18 100644 --- a/harbour/source/rtl/descend.c +++ b/harbour/source/rtl/descend.c @@ -35,7 +35,7 @@ * $FUNCNAME$ * DESCEND * $CATEGORY$ - * + * * $ONELINER$ * Inverts an expression of string, logical, date or numeric type. * $SYNTAX$ @@ -74,17 +74,18 @@ HB_INIT_SYMBOLS_END( Descend__InitSymbols ); #if ! defined(__GNUC__) #pragma Descend__InitSymbols #endif - -char *hb_strdescend( char *string ) -{ - char *s; - if( string ) +char * hb_strdescend( char * szText, ULONG ulLen ) +{ + if (!(ulLen == 1 && szText[0] == 0)) { - for( s = string; *s; ++s ) + char *s; + + for( s = szText; ulLen--; ++s ) *s = 256 - *s; } - return string; + + return szText; } HARBOUR HB_DESCEND( void ) @@ -96,18 +97,22 @@ HARBOUR HB_DESCEND( void ) if( pItem ) { if( IS_STRING( pItem ) ) - hb_retc( hb_strdescend( pItem->item.asString.value ) ); + hb_retclen( hb_strdescend( pItem->item.asString.value, pItem->item.asString.length ), pItem->item.asString.length ); else if( IS_DATE( pItem ) ) hb_retnl( 5231808 - pItem->item.asDate.value ); - else if( IS_INTEGER( pItem ) ) - hb_retni( -1 * pItem->item.asInteger.value ); - else if( IS_LONG( pItem ) ) - hb_retnl( -1 * pItem->item.asLong.value ); - else if( IS_DOUBLE( pItem ) ) + else if( IS_NUMERIC( pItem ) ) { PHB_ITEM pReturn; + double dValue; - pReturn = hb_itemPutND( NULL, -1 * pItem->item.asDouble.value ); + if ( IS_DOUBLE( pItem ) ) + dValue = (double)pItem->item.asDouble.value; + else if( IS_INTEGER( pItem ) ) + dValue = (double)pItem->item.asInteger.value; + else if( IS_LONG( pItem ) ) + dValue = pItem->item.asLong.value; + + pReturn = hb_itemPutND( NULL, -1 * dValue ); hb_itemReturn( pReturn ); hb_itemRelease( pReturn ); @@ -117,8 +122,6 @@ HARBOUR HB_DESCEND( void ) } else if( IS_LOGICAL( pItem ) ) hb_retl( !pItem->item.asLogical.value ); - else - hb_retc( "NIL" ); } } } diff --git a/harbour/source/rtl/strings.c b/harbour/source/rtl/strings.c index 856a5cd387..5e4b07b619 100644 --- a/harbour/source/rtl/strings.c +++ b/harbour/source/rtl/strings.c @@ -664,7 +664,7 @@ HARBOUR HB_ASC(void) if( pText ) { if( pText->item.asString.length > 0 ) - hb_retni(*(pText->item.asString.value)); + hb_retni((BYTE)*(pText->item.asString.value)); else hb_retni(0); } diff --git a/harbour/source/vm/hvm.c b/harbour/source/vm/hvm.c index 4d58dbc841..bf0654cfdf 100644 --- a/harbour/source/vm/hvm.c +++ b/harbour/source/vm/hvm.c @@ -180,15 +180,8 @@ BYTE bErrorLevel = 0; /* application exit errorlevel */ /* application entry point */ -#ifdef WINDOWS - int __stdcall WinMain( long hIns, long hPrev, char * szCmds, int iCmdShow ) - { - int argc = 1; - char * argv[] = { "Test" }; -#else - int main( int argc, char * argv[] ) - { -#endif +int main( int argc, char * argv[] ) +{ int i; void ( * DontDiscardForceLink )( void ) = &ForceLink; diff --git a/harbour/terminal.b32 b/harbour/terminal.b32 index 94ec596fe0..b691d5479d 100644 --- a/harbour/terminal.b32 +++ b/harbour/terminal.b32 @@ -18,5 +18,5 @@ gtwin.obj : gtwin.c extend.h hbdefs.h bcc32 -wmsg -c -O2 -DHARBOUR_USE_GTAPI -I.\include -v -o$@ $< tlib .\libs\b32\terminal.lib -+$@,, del obj\console.obj - bcc32 -wmsg -c -O2 -DWINDOWS -I.\include -v -o$@ $< + bcc32 -wmsg -c -O2 -I.\include -v -o$@ $< tlib .\libs\win32\terminal.lib -+$@,, diff --git a/harbour/tests/working/descend.prg b/harbour/tests/working/descend.prg index 1cc98b9a5c..a75d9a38f9 100644 --- a/harbour/tests/working/descend.prg +++ b/harbour/tests/working/descend.prg @@ -8,32 +8,53 @@ function main() LOCAL dDate - QOut( Descend( "HARBOUR POWER & MAGIC" ) ) - QOut( Descend( Descend( "HARBOUR POWER & MAGIC" ) ) ) - QOut( Descend( .f. ) ) - QOut( Descend( .t. ) ) - QOut( Descend( 1 ) ) - QOut( Descend( -1 ) ) - QOut( Descend( Descend( 256 ) ) ) - QOut( Descend( 2.5 ) ) - QOut( Descend( -100.35 ) ) + OutSpec( Descend( "HARBOUR POWER & MAGIC" ) ) + OutSpec( Descend( Descend( "HARBOUR POWER & MAGIC" ) ) ) + OutSpec( Descend( .f. ) ) + OutSpec( Descend( .t. ) ) + OutSpec( Descend( 1 ) ) + OutSpec( Descend( -1 ) ) + OutSpec( Descend( Descend( 256 ) ) ) + OutSpec( Descend( 2.0 ) ) + OutSpec( Descend( 2.5 ) ) + OutSpec( Descend( -100.35 ) ) + OutSpec( Descend( -740.354 ) ) + OutSpec( Descend( -740.359 ) ) SET( _SET_DATEFORMAT, "dd/mm/yyyy" ) dDate := cToD( "31/12/2999" ) - QOut( dDate, dtos( dDate ), Descend( dDate ) ) + OutSpec( dDate, dtos( dDate ), Descend( dDate ) ) dDate := cToD( "1/1/0100" ) - QOut( dDate, dtos( dDate ), Descend( dDate ) ) + OutSpec( dDate, dtos( dDate ), Descend( dDate ) ) - QOut( date(), dtos( date() ), Descend( date() ) ) - QOut( date(), dtos( date() ), Descend( Descend( date() ) ) ) - QOut( date()+1, dtos( date()+1 ), Descend( date()+1 ) ) - QOut( date()+2, dtos( date()+2 ), Descend( date()+2 ) ) + OutSpec( date(), dtos( date() ), Descend( date() ) ) + OutSpec( date(), dtos( date() ), Descend( Descend( date() ) ) ) + OutSpec( date()+1, dtos( date()+1 ), Descend( date()+1 ) ) + OutSpec( date()+2, dtos( date()+2 ), Descend( date()+2 ) ) - QOut( Asc( Descend( chr(0) ) ) ) + OutSpec( Asc( Descend( "" ) ) ) + OutSpec( Descend( "" ) ) + OutSpec( Asc( Descend( chr(0) ) ) ) + OutSpec( Asc( Descend( chr(0) + "Hello" ) ) ) + OutSpec( Descend( chr(0) + "Hello" ) ) + OutSpec( Asc( Descend( "Hello" + Chr(0) + "world" ) ) ) + OutSpec( Descend( "Hello" + Chr(0) + "world" ) ) - QOut( Descend( { "A", "B" } ) ) - QOut( Descend( nil ) ) + OutSpec( Descend( { "A", "B" } ) ) + OutSpec( ValType( Descend( { "A", "B" } ) )) + OutSpec( Descend( nil ) ) + OutSpec( ValType( Descend( nil ) )) + OutSpec( Descend() ) + OutSpec( ValType( Descend() ) ) return nil + +STATIC FUNCTION OutSpec( cString ) + + OutStd( cString ) + OutStd( Chr(13) + Chr(10) ) + + RETURN NIL +