From 2f1ea75a14efff433a6ed042ba68a4e898dd3587 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Fri, 6 Aug 1999 03:51:33 +0000 Subject: [PATCH] 19990806-05:31 GMT+1 --- harbour/ChangeLog | 36 ++++- harbour/funclist.txt | 2 +- harbour/include/Makefile | 1 + harbour/include/clipdefs.h | 2 +- harbour/include/extend.h | 71 +++++----- harbour/include/fm.api | 2 +- harbour/include/gtapi.h | 98 ++++++------- harbour/include/hb_vmpub.h | 73 +++++----- harbour/include/hbdefs.h | 21 +-- harbour/include/hbpp.h | 8 +- harbour/include/run_exp.h | 114 +++++++-------- harbour/include/vm.api | 32 ++--- harbour/make_tpl.bat | 5 +- harbour/make_tpl.cmd | 65 +++++++++ harbour/make_tpl.sh | 53 ++++++- harbour/source/rdd/dbcmd.c | 2 +- harbour/source/rtl/Makefile | 1 + harbour/source/rtl/achoice.prg | 4 +- harbour/source/rtl/classes.c | 34 ++--- harbour/source/rtl/do.c | 2 +- harbour/source/rtl/memvars.c | 32 ++--- harbour/source/rtl/menuto.prg | 246 ++++++++++++++++++--------------- harbour/source/rtl/readvar.prg | 45 ++++++ harbour/source/runner/runner.c | 2 +- harbour/source/vm/dynsym.c | 19 ++- harbour/source/vm/hvm.c | 21 +-- 26 files changed, 609 insertions(+), 382 deletions(-) create mode 100644 harbour/make_tpl.cmd create mode 100644 harbour/source/rtl/readvar.prg diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 2ff9137b0f..e936d05dea 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,34 @@ +19990806-05:31 GMT+1 Victor Szel + * source/rtl/menuto.prg + ! MENU TO made highly Clipper compatible (100%), with the addition of + the nesting capability. + (only BEGIN/END SEQUENCE and Break() support is missing) + * make_tpl.bat + make_tpl.cmd (added) + make_tpl.sh + * Updated and extended make file starter files. + * source/rtl/readvar.prg + source/rtl/Makefile + funclist.txt + + Added: READVAR() (used in MENU TO) + (Please update other makefiles accordingly) + * include/Makefile + ! hb_vmpub.h added + * source/rtl/achoice.prg + ! Fixed handling of Ctrl+PgUp/PgDn/Home/End when a user func was passed. + * source/rdd/dbcmd.c + source/rtl/classes.c + source/rtl/do.c + source/rtl/memvars.c + source/runner/runner.c + source/vm/dynsym.c + source/vm/hvm.c + include/extend.h + include/hb_vmpub.h + * DYNSYM -> HB_DYNS + PDYNSYM -> PHB_DYNS + * include/*.* - More small cleanups + 19990805-17:10 GMT+1 Victor Szel * source/rtl/setcolor.c ! #includes "extend.h" instead of "pcode.h" @@ -22,6 +53,7 @@ "~" hotkey char support removed, since there's no such in Clipper. + Test includes recursive capability ! Test added to Makefile + (Please update other makefiles accordingly) * source/rtl/achoice.prg + Added SETKEY() handling. * source/rtl/alert.prg @@ -37,9 +69,9 @@ include/rddapi.h include/rddapi.h source/rdd/dbf1.c - source/rdd/dbfntx\dbfntx1.c + source/rdd/dbfntx/dbfntx1.c source/rdd/dbcmd.c - source/rtl/gt\gtos2.c + source/rtl/gt/gtos2.c source/rtl/copyfile.c source/rtl/environ.c source/rtl/filesys.c diff --git a/harbour/funclist.txt b/harbour/funclist.txt index 9cf96d547c..9eb4b89187 100644 --- a/harbour/funclist.txt +++ b/harbour/funclist.txt @@ -188,7 +188,7 @@ READEXIT ;N; READINSERT ;N; READKEY ;N; READMODAL ;N; -READVAR ;N; +READVAR ;R; RECCOUNT ;N; RECNO ;N; RECSIZE ;N; diff --git a/harbour/include/Makefile b/harbour/include/Makefile index 246f53c215..1e47cddc95 100644 --- a/harbour/include/Makefile +++ b/harbour/include/Makefile @@ -19,6 +19,7 @@ C_HEADERS=\ hbpp.h \ hbsetup.h \ hbver.h \ + hb_vmpub.h \ init.h \ initsymc.h \ initsymd.h \ diff --git a/harbour/include/clipdefs.h b/harbour/include/clipdefs.h index da60f0fb21..2949a2f580 100644 --- a/harbour/include/clipdefs.h +++ b/harbour/include/clipdefs.h @@ -68,7 +68,7 @@ typedef ERRCODE IHELP; typedef ERRCODE ICODE; /* default func ptr -- USHORT return, USHORT param */ -typedef USHORT (far * FUNCP)(USHORT param, ...); +typedef USHORT ( * FUNCP )( USHORT param, ...); typedef FUNCP* FUNCPP; #define HIDE static diff --git a/harbour/include/extend.h b/harbour/include/extend.h index 9927a1d5c2..e804d89e44 100644 --- a/harbour/include/extend.h +++ b/harbour/include/extend.h @@ -40,7 +40,7 @@ #include "fm.api" #endif -struct _DYNSYM; /* forward declaration */ +struct _HB_DYNS; /* forward declaration */ /* symbol support structure */ typedef struct @@ -48,40 +48,40 @@ typedef struct char* szName; /* the name of the symbol */ SYMBOLSCOPE cScope; /* the scope of the symbol */ PHB_FUNC pFunPtr; /* function address for function symbol table entries */ - struct _DYNSYM * pDynSym; /* pointer to its dynamic symbol if defined */ + struct _HB_DYNS * pDynSym; /* pointer to its dynamic symbol if defined */ } HB_SYMB, * PHB_SYMB, * HB_SYMB_PTR; -/* Harbour Functions scope */ -#define FS_PUBLIC 0 -#define FS_STATIC 2 -#define FS_INIT 8 -#define FS_EXIT 16 -#define FS_INITEXIT ( FS_INIT | FS_EXIT ) -#define FS_MESSAGE 32 -#define FS_MEMVAR 128 +/* Harbour Functions scope (SYMBOLSCOPE) */ +#define FS_PUBLIC 0x00 +#define FS_STATIC 0x02 +#define FS_INIT 0x08 +#define FS_EXIT 0x10 +#define FS_INITEXIT ( FS_INIT | FS_EXIT ) +#define FS_MESSAGE 0x20 +#define FS_MEMVAR 0x80 extern void VirtualMachine( BYTE * pCode, PHB_SYMB pSymbols ); /* invokes the virtual machine */ extern void ProcessSymbols( PHB_SYMB pSymbols, WORD wSymbols ); /* statics symbols initialization */ /* items types */ -#define IT_NIL 0x0000 -#define IT_INTEGER 0x0002 -#define IT_LONG 0x0008 -#define IT_DOUBLE 0x0010 -#define IT_DATE 0x0020 -#define IT_LOGICAL 0x0080 -#define IT_SYMBOL 0x0100 -#define IT_ALIAS 0x0200 -#define IT_STRING 0x0400 -#define IT_MEMOFLAG 0x0800 -#define IT_MEMO ( IT_MEMOFLAG & IT_STRING ) -#define IT_BLOCK 0x1000 -#define IT_BYREF 0x2000 -#define IT_MEMVAR 0x4000 -#define IT_ARRAY 0x8000 -#define IT_OBJECT IT_ARRAY -#define IT_NUMERIC ( IT_INTEGER | IT_LONG | IT_DOUBLE ) -#define IT_ANY 0xFFFF +#define IT_NIL 0x0000 +#define IT_INTEGER 0x0002 +#define IT_LONG 0x0008 +#define IT_DOUBLE 0x0010 +#define IT_DATE 0x0020 +#define IT_LOGICAL 0x0080 +#define IT_SYMBOL 0x0100 +#define IT_ALIAS 0x0200 +#define IT_STRING 0x0400 +#define IT_MEMOFLAG 0x0800 +#define IT_MEMO ( IT_MEMOFLAG & IT_STRING ) +#define IT_BLOCK 0x1000 +#define IT_BYREF 0x2000 +#define IT_MEMVAR 0x4000 +#define IT_ARRAY 0x8000 +#define IT_OBJECT IT_ARRAY +#define IT_NUMERIC ( IT_INTEGER | IT_LONG | IT_DOUBLE ) +#define IT_ANY 0xFFFF /* forward declarations */ struct _HB_CODEBLOCK; @@ -214,18 +214,13 @@ typedef struct } STACK; /* dynamic symbol structure */ -typedef struct _DYNSYM +typedef struct _HB_DYNS { HB_HANDLE hArea; /* Workarea number */ HB_HANDLE hMemvar; /* Index number into memvars ( publics & privates ) array */ PHB_SYMB pSymbol; /* pointer to its relative local symbol */ PHB_FUNC pFunPtr; /* Pointer to the function address */ -} DYNSYM, * PDYNSYM, * DYNSYM_PTR; - -typedef struct -{ - PDYNSYM pDynSym; /* Pointer to dynamic symbol */ -} DYNHB_ITEM, * PDYNHB_ITEM, * DYNHB_ITEM_PTR; +} HB_DYNS, * PHB_DYNS, * HB_DYNS_PTR; /* internal structure for codeblocks */ typedef struct _HB_CODEBLOCK @@ -321,9 +316,9 @@ extern char * hb_GetClassName( PHB_ITEM pObject ); /* retrieves an object clas extern ULONG hb_isMessage( PHB_ITEM, char * ); /* dynamic symbol table management */ -extern PDYNSYM hb_GetDynSym( char * szName ); /* finds and creates a dynamic symbol if not found */ -extern PDYNSYM hb_NewDynSym( PHB_SYMB pSymbol ); /* creates a new dynamic symbol based on a local one */ -extern PDYNSYM hb_FindDynSym( char * szName ); /* finds a dynamic symbol */ +extern PHB_DYNS hb_GetDynSym( char * szName ); /* finds and creates a dynamic symbol if not found */ +extern PHB_DYNS hb_NewDynSym( PHB_SYMB pSymbol ); /* creates a new dynamic symbol based on a local one */ +extern PHB_DYNS hb_FindDynSym( char * szName ); /* finds a dynamic symbol */ extern void hb_LogDynSym( void ); /* displays all dynamic symbols */ extern void hb_ReleaseDynSym( void ); /* releases the memory of the dynamic symbol table */ extern PHB_SYMB hb_NewSymbol( char * szName ); diff --git a/harbour/include/fm.api b/harbour/include/fm.api index a7f57c254a..83f67547f8 100644 --- a/harbour/include/fm.api +++ b/harbour/include/fm.api @@ -20,6 +20,6 @@ /* Nant*cket Clipper Summer 87 compatible */ #define _exmgrab hb_xgrab -#define _exmback(p, s) hb_xfree(p) +#define _exmback(p, s) hb_xfree( p ) #endif /* HB_FM_API_ */ diff --git a/harbour/include/gtapi.h b/harbour/include/gtapi.h index afcea0e842..6444965f17 100644 --- a/harbour/include/gtapi.h +++ b/harbour/include/gtapi.h @@ -47,60 +47,60 @@ /* Public interface. These should never change, only be added to. */ -extern void hb_gtInit(void); -extern void hb_gtExit(void); -extern int hb_gtBox(USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, char * fpBoxString); -extern int hb_gtBoxD(USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight); -extern int hb_gtBoxS(USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight); -extern int hb_gtColorSelect(USHORT uiColorIndex); -extern int hb_gtDispBegin(void); -extern USHORT hb_gtDispCount(void); -extern int hb_gtDispEnd(void); -extern int hb_gtGetBlink(BOOL * bBlink); -extern int hb_gtGetColorStr(char * fpColorString); -extern int hb_gtGetCursor(USHORT * uipCursorShape); -extern int hb_gtGetPos(USHORT * uipRow, USHORT * uipCol); -extern BOOL hb_gtIsColor(void); -extern USHORT hb_gtMaxCol(void); -extern USHORT hb_gtMaxRow(void); -extern int hb_gtPostExt(void); -extern int hb_gtPreExt(void); -extern int hb_gtRectSize(USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, USHORT * uipBuffSize); -extern int hb_gtRepChar(USHORT uiRow, USHORT uiCol, USHORT uiChar, USHORT uiCount); -extern int hb_gtRest(USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, char * vlpScrBuff); -extern int hb_gtSave(USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, char * vlpScrBuff); -extern int hb_gtScrDim(USHORT * uipHeight, USHORT * uipWidth); -extern int hb_gtScroll(USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, SHORT iRows, SHORT iCols); -extern int hb_gtSetBlink(BOOL bBlink); -extern int hb_gtSetColorStr(char * fpColorString); -extern int hb_gtSetCursor(USHORT uiCursorShape); -extern int hb_gtSetMode(USHORT uiRows, USHORT uiCols); -extern int hb_gtSetPos(USHORT uiRow, USHORT uiCol); -extern int hb_gtSetSnowFlag(BOOL bNoSnow); -extern int hb_gtWrite(char * fpStr, ULONG length); -extern int hb_gtWriteAt(USHORT uiRow, USHORT uiCol, char * fpStr, ULONG length); -extern int hb_gtWriteCon(char * fpStr, ULONG length); +extern void hb_gtInit( void ); +extern void hb_gtExit( void ); +extern int hb_gtBox( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, char * fpBoxString ); +extern int hb_gtBoxD( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight ); +extern int hb_gtBoxS( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight ); +extern int hb_gtColorSelect( USHORT uiColorIndex ); +extern int hb_gtDispBegin( void ); +extern USHORT hb_gtDispCount( void ); +extern int hb_gtDispEnd( void ); +extern int hb_gtGetBlink( BOOL * bBlink ); +extern int hb_gtGetColorStr( char * fpColorString ); +extern int hb_gtGetCursor( USHORT * uipCursorShape ); +extern int hb_gtGetPos( USHORT * uipRow, USHORT * uipCol ); +extern BOOL hb_gtIsColor( void ); +extern USHORT hb_gtMaxCol( void ); +extern USHORT hb_gtMaxRow( void ); +extern int hb_gtPostExt( void ); +extern int hb_gtPreExt( void ); +extern int hb_gtRectSize( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, USHORT * uipBuffSize ); +extern int hb_gtRepChar( USHORT uiRow, USHORT uiCol, USHORT uiChar, USHORT uiCount ); +extern int hb_gtRest( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, char * vlpScrBuff ); +extern int hb_gtSave( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, char * vlpScrBuff ); +extern int hb_gtScrDim( USHORT * uipHeight, USHORT * uipWidth ); +extern int hb_gtScroll( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, SHORT iRows, SHORT iCols ); +extern int hb_gtSetBlink( BOOL bBlink ); +extern int hb_gtSetColorStr( char * fpColorString ); +extern int hb_gtSetCursor( USHORT uiCursorShape ); +extern int hb_gtSetMode( USHORT uiRows, USHORT uiCols ); +extern int hb_gtSetPos( USHORT uiRow, USHORT uiCol ); +extern int hb_gtSetSnowFlag( BOOL bNoSnow ); +extern int hb_gtWrite( char * fpStr, ULONG length ); +extern int hb_gtWriteAt( USHORT uiRow, USHORT uiCol, char * fpStr, ULONG length ); +extern int hb_gtWriteCon( char * fpStr, ULONG length ); /* private interface listed below. these are common to all platforms */ -extern void hb_gt_Init(void); -extern int hb_gt_IsColor(void); -extern void hb_gt_Done(void); -extern char hb_gt_GetScreenWidth(void); -extern char hb_gt_GetScreenHeight(void); -extern void hb_gt_SetPos(char cRow, char cCol); -extern char hb_gt_Col(void); -extern char hb_gt_Row(void); -extern void hb_gt_Scroll(char cTop, char cLeft, char cBottom, char cRight, char attribute, char vert, char horiz); -extern void hb_gt_SetCursorStyle(int style); -extern int hb_gt_GetCursorStyle(void); -extern void hb_gt_Puts(char cRow, char cCol, char attr, char *str, int len); -extern void hb_gt_GetText(char cTop, char cLeft, char cBottom, char cRight, char *dest); -extern void hb_gt_PutText(char cTop, char cLeft, char cBottom, char cRight, char *srce); +extern void hb_gt_Init( void ); +extern int hb_gt_IsColor( void ); +extern void hb_gt_Done( void ); +extern char hb_gt_GetScreenWidth( void ); +extern char hb_gt_GetScreenHeight( void ); +extern void hb_gt_SetPos( char cRow, char cCol ); +extern char hb_gt_Col( void ); +extern char hb_gt_Row( void ); +extern void hb_gt_Scroll( char cTop, char cLeft, char cBottom, char cRight, char attribute, char vert, char horiz ); +extern void hb_gt_SetCursorStyle( int style ); +extern int hb_gt_GetCursorStyle( void ); +extern void hb_gt_Puts( char cRow, char cCol, char attr, char *str, int len ); +extern void hb_gt_GetText( char cTop, char cLeft, char cBottom, char cRight, char *dest ); +extern void hb_gt_PutText( char cTop, char cLeft, char cBottom, char cRight, char *srce ); extern void hb_gt_SetAttribute( char cTop, char cLeft, char cBottom, char cRight, char attribute ); extern void hb_gt_DrawShadow( char cTop, char cLeft, char cBottom, char cRight, char attribute ); -extern void hb_gt_DispBegin(void); -extern void hb_gt_DispEnd(void); +extern void hb_gt_DispBegin( void ); +extern void hb_gt_DispEnd( void ); extern ULONG hb_gt_ScreenBuffer( ULONG buffer ); extern void hb_gt_SetMode( USHORT uiRows, USHORT uiCols ); diff --git a/harbour/include/hb_vmpub.h b/harbour/include/hb_vmpub.h index 20219bc918..5ab7a5c95f 100644 --- a/harbour/include/hb_vmpub.h +++ b/harbour/include/hb_vmpub.h @@ -2,30 +2,37 @@ * $Id$ */ -/* This is the header file which is included to every */ -/* Harbour generated C source file */ - /* - Copyright(C) 1999 by Antonio Linares. + Harbour Project source code + + This file provides the bare minimum of declarations + which is required to compile a Harbour generated .C file. + + Copyright (C) 1999 Victor Szel + www - http://www.harbour-project.org This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published - by the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version, with one exception: - This program is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the GNU General Public License for more details. + The exception is that if you link the Harbour Runtime Library (HRL) + and/or the Harbour Virtual Machine (HVM) with other files to produce + an executable, this does not by itself cause the resulting executable + to be covered by the GNU General Public License. Your use of that + executable is in no way restricted on account of linking the HRL + and/or HVM code into it. - You should have received a copy of the GNU General Public - License along with this program; if not, write to: + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - The Free Software Foundation, Inc., - 675 Mass Ave, Cambridge, MA 02139, USA. - - You can contact me at: alinares@fivetech.com - */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit + their web site at http://www.gnu.org/). +*/ #ifndef HB_VMPUB_H_ #define HB_VMPUB_H_ @@ -34,7 +41,7 @@ /* Dummy definitions */ -typedef void * PDYNSYM; +typedef void * PHB_DYNS; /* Parts copied from hbdefs.h */ @@ -48,11 +55,11 @@ typedef unsigned short int WORD; #ifdef _MSC_VER #define HARBOUR void #else -#ifdef __IBMCPP__ - #define HARBOUR void -#else - #define HARBOUR void pascal -#endif + #ifdef __IBMCPP__ + #define HARBOUR void + #else + #define HARBOUR void pascal + #endif #endif typedef void * PHB_FUNC; @@ -66,19 +73,19 @@ typedef struct char * szName; /* the name of the symbol */ SYMBOLSCOPE cScope; /* the scope of the symbol */ PHB_FUNC pFunPtr; /* function address for function symbol table entries */ - PDYNSYM pDynSym; /* pointer to its dynamic symbol if defined */ + PHB_DYNS pDynSym; /* pointer to its dynamic symbol if defined */ } HB_SYMB, * PHB_SYMB; extern void VirtualMachine( BYTE * pCode, PHB_SYMB pSymbols ); /* invokes the virtual machine */ -/* Harbour Functions scope */ -#define FS_PUBLIC 0 -#define FS_STATIC 2 -#define FS_INIT 8 -#define FS_EXIT 16 -#define FS_INITEXIT ( FS_INIT | FS_EXIT ) -#define FS_MESSAGE 32 -#define FS_MEMVAR 128 +/* Harbour Functions scope (SYMBOLSCOPE) */ +#define FS_PUBLIC 0x00 +#define FS_STATIC 0x02 +#define FS_INIT 0x08 +#define FS_EXIT 0x10 +#define FS_INITEXIT ( FS_INIT | FS_EXIT ) +#define FS_MESSAGE 0x20 +#define FS_MEMVAR 0x80 /* This should always follow the type declarations */ diff --git a/harbour/include/hbdefs.h b/harbour/include/hbdefs.h index 744fb9cb28..68b3c083d1 100644 --- a/harbour/include/hbdefs.h +++ b/harbour/include/hbdefs.h @@ -61,9 +61,9 @@ typedef int BOOL; #define FALSE 0 #define TRUE 1 -#define LOBYTE(w) ((BYTE)(w)) -#define HIBYTE(w) ((BYTE)(((WORD)(w) >> 8) & 0xFF)) -#define LOWORD(l) ((WORD)(l)) +#define LOBYTE(w) ((BYTE)(w)) +#define HIBYTE(w) ((BYTE)(((WORD)(w) >> 8) & 0xFF)) +#define LOWORD(l) ((WORD)(l)) #endif /* HB_DONT_DEFINE_BASIC_TYPES */ #endif /* __IBMCPP__ */ @@ -83,14 +83,15 @@ typedef int BOOL; #define HARBOUR void #define EXTERNAL_LINKAGE #else -#ifdef __IBMCPP__ - #define HARBOUR void - #define EXTERNAL_LINKAGE _LNK_CONV -#else - #define HARBOUR void pascal - #define EXTERNAL_LINKAGE -#endif + #ifdef __IBMCPP__ + #define HARBOUR void + #define EXTERNAL_LINKAGE _LNK_CONV + #else + #define HARBOUR void pascal + #define EXTERNAL_LINKAGE + #endif #endif + typedef HARBOUR ( * PHB_FUNC )( void ); typedef PHB_FUNC HB_FUNC_PTR; diff --git a/harbour/include/hbpp.h b/harbour/include/hbpp.h index c2102e7cee..4b1318c63e 100644 --- a/harbour/include/hbpp.h +++ b/harbour/include/hbpp.h @@ -45,7 +45,7 @@ typedef struct #define BUFF_SIZE 2048 #define INITIAL_ACOM_SIZE 200 -#define SKIPTABSPACES(sptr) while ( *sptr == ' ' || *sptr == '\t' ) (sptr)++ +#define SKIPTABSPACES( sptr ) while ( *sptr == ' ' || *sptr == '\t' ) (sptr)++ #define PATH_DELIMITER "/\\" #define IS_PATH_SEP( c ) (strchr(PATH_DELIMITER, (c))!=NULL) @@ -56,10 +56,10 @@ typedef struct extern int ParseDirective( char* ); extern int ParseExpression( char*, char* ); -extern int pp_RdStr(FILE*,char *,int,int,char*,int*,int*); -extern int pp_WrStr(FILE*,char *); +extern int pp_RdStr( FILE*,char *,int,int,char*,int*,int* ); +extern int pp_WrStr( FILE*,char * ); extern int strolen ( char* ); -extern int strocpy (char*, char* ); +extern int strocpy ( char*, char* ); extern char* strodup ( char * ); extern DEFINES *AddDefine( char * szDefine, char * szValue ); /* add a new Lex define from the command line */ diff --git a/harbour/include/run_exp.h b/harbour/include/run_exp.h index 75ff801f35..685da4e723 100644 --- a/harbour/include/run_exp.h +++ b/harbour/include/run_exp.h @@ -77,64 +77,64 @@ HARBOUR HB___MVPRIVATE(); */ HB_INIT_SYMBOLS_BEGIN( RUNNER ) -{ "HB_RUN", FS_PUBLIC, HB_HB_RUN , 0 }, -{ "__AGLOBALSTACK", FS_PUBLIC, HB___AGLOBALSTACK, 0 }, -{ "__APARAM", FS_PUBLIC, HB___APARAM , 0 }, -{ "__ASTACK", FS_PUBLIC, HB___ASTACK , 0 }, -{ "__ASTATIC", FS_PUBLIC, HB___ASTATIC , 0 }, +{ "HB_RUN", FS_PUBLIC, HB_HB_RUN , 0 }, +{ "__AGLOBALSTACK", FS_PUBLIC, HB___AGLOBALSTACK , 0 }, +{ "__APARAM", FS_PUBLIC, HB___APARAM , 0 }, +{ "__ASTACK", FS_PUBLIC, HB___ASTACK , 0 }, +{ "__ASTATIC", FS_PUBLIC, HB___ASTATIC , 0 }, { "__GLOBALSTACKLEN", FS_PUBLIC, HB___GLOBALSTACKLEN, 0 }, -{ "__STACKLEN", FS_PUBLIC, HB___STACKLEN , 0 }, -{ "__STATIC", FS_PUBLIC, HB___STATIC , 0 }, -{ "ACOS", FS_PUBLIC, HB_ACOS , 0 }, -{ "ASIN", FS_PUBLIC, HB_ASIN , 0 }, -{ "ATAN", FS_PUBLIC, HB_ATAN , 0 }, -{ "COS", FS_PUBLIC, HB_COS , 0 }, -{ "COSH", FS_PUBLIC, HB_COSH , 0 }, -{ "DATETIME", FS_PUBLIC, HB_DATETIME , 0 }, -{ "DEBUG", FS_PUBLIC, HB_DEBUG , 0 }, -{ "DEFAULT", FS_PUBLIC, HB_DEFAULT , 0 }, -{ "ERRORSYS", FS_PUBLIC, HB_ERRORSYS , 0 }, -{ "ERRORNEW", FS_PUBLIC, HB_ERRORNEW , 0 }, -{ "EVAL", FS_PUBLIC, HB_EVAL , 0 }, -{ "GT_ASCIISUM", FS_PUBLIC, HB_GT_ASCIISUM , 0 }, -{ "GT_ASCPOS", FS_PUBLIC, HB_GT_ASCPOS , 0 }, -{ "GT_ATDIFF", FS_PUBLIC, HB_GT_ATDIFF , 0 }, -{ "GT_CHAREVEN", FS_PUBLIC, HB_GT_CHAREVEN , 0 }, -{ "GT_CHARODD", FS_PUBLIC, HB_GT_CHARODD , 0 }, -{ "GT_CHARMIX", FS_PUBLIC, HB_GT_CHARMIX , 0 }, -{ "GT_CHRCOUNT", FS_PUBLIC, HB_GT_CHRCOUNT , 0 }, -{ "GT_CHRFIRST", FS_PUBLIC, HB_GT_CHRFIRST , 0 }, -{ "GT_CHRTOTAL", FS_PUBLIC, HB_GT_CHRTOTAL , 0 }, -{ "GT_STRCOUNT", FS_PUBLIC, HB_GT_STRCOUNT , 0 }, -{ "GT_STRCSPN", FS_PUBLIC, HB_GT_STRCSPN , 0 }, -{ "GT_STRDIFF", FS_PUBLIC, HB_GT_STRDIFF , 0 }, -{ "GT_STREXPAND", FS_PUBLIC, HB_GT_STREXPAND , 0 }, -{ "GT_STRLEFT", FS_PUBLIC, HB_GT_STRLEFT , 0 }, -{ "GT_STRPBRK", FS_PUBLIC, HB_GT_STRPBRK , 0 }, -{ "GT_STRRIGHT", FS_PUBLIC, HB_GT_STRRIGHT , 0 }, -{ "HB_FEOF", FS_PUBLIC, HB_HB_FEOF , 0 }, -{ "HB_FGOBOTTOM", FS_PUBLIC, HB_HB_FGOBOTTOM , 0 }, -{ "HB_FGOTO", FS_PUBLIC, HB_HB_FGOTO , 0 }, -{ "HB_FGOTOP", FS_PUBLIC, HB_HB_FGOTOP , 0 }, -{ "HB_FLASTREC", FS_PUBLIC, HB_HB_FLASTREC , 0 }, -{ "HB_FRECNO", FS_PUBLIC, HB_HB_FRECNO , 0 }, -{ "HB_FREADLN", FS_PUBLIC, HB_HB_FREADLN , 0 }, -{ "HB_FSKIP", FS_PUBLIC, HB_HB_FSKIP , 0 }, -{ "HB_FUSE", FS_PUBLIC, HB_HB_FUSE , 0 }, -{ "LOG10", FS_PUBLIC, HB_LOG10 , 0 }, -{ "PVALUE", FS_PUBLIC, HB_PVALUE , 0 }, -{ "ROT13", FS_PUBLIC, HB_ROT13 , 0 }, -{ "SIN", FS_PUBLIC, HB_SIN , 0 }, -{ "SINH", FS_PUBLIC, HB_SINH , 0 }, -{ "STRDUMP", FS_PUBLIC, HB_STRDUMP , 0 }, -{ "STRTOKEN", FS_PUBLIC, HB_STRTOKEN , 0 }, -{ "TAN", FS_PUBLIC, HB_TAN , 0 }, -{ "TANH", FS_PUBLIC, HB_TANH , 0 }, -{ "TFILEREAD", FS_PUBLIC, HB_TFILEREAD , 0 }, -{ "TOCHAR", FS_PUBLIC, HB_TOCHAR , 0 }, -{ "VALTYPE", FS_PUBLIC, HB_VALTYPE , 0 }, -{ "__MVPUBLIC", FS_PUBLIC, HB___MVPUBLIC , 0 }, -{ "__MVPRIVATE", FS_PUBLIC, HB___MVPRIVATE , 0 } +{ "__STACKLEN", FS_PUBLIC, HB___STACKLEN , 0 }, +{ "__STATIC", FS_PUBLIC, HB___STATIC , 0 }, +{ "ACOS", FS_PUBLIC, HB_ACOS , 0 }, +{ "ASIN", FS_PUBLIC, HB_ASIN , 0 }, +{ "ATAN", FS_PUBLIC, HB_ATAN , 0 }, +{ "COS", FS_PUBLIC, HB_COS , 0 }, +{ "COSH", FS_PUBLIC, HB_COSH , 0 }, +{ "DATETIME", FS_PUBLIC, HB_DATETIME , 0 }, +{ "DEBUG", FS_PUBLIC, HB_DEBUG , 0 }, +{ "DEFAULT", FS_PUBLIC, HB_DEFAULT , 0 }, +{ "ERRORSYS", FS_PUBLIC, HB_ERRORSYS , 0 }, +{ "ERRORNEW", FS_PUBLIC, HB_ERRORNEW , 0 }, +{ "EVAL", FS_PUBLIC, HB_EVAL , 0 }, +{ "GT_ASCIISUM", FS_PUBLIC, HB_GT_ASCIISUM , 0 }, +{ "GT_ASCPOS", FS_PUBLIC, HB_GT_ASCPOS , 0 }, +{ "GT_ATDIFF", FS_PUBLIC, HB_GT_ATDIFF , 0 }, +{ "GT_CHAREVEN", FS_PUBLIC, HB_GT_CHAREVEN , 0 }, +{ "GT_CHARODD", FS_PUBLIC, HB_GT_CHARODD , 0 }, +{ "GT_CHARMIX", FS_PUBLIC, HB_GT_CHARMIX , 0 }, +{ "GT_CHRCOUNT", FS_PUBLIC, HB_GT_CHRCOUNT , 0 }, +{ "GT_CHRFIRST", FS_PUBLIC, HB_GT_CHRFIRST , 0 }, +{ "GT_CHRTOTAL", FS_PUBLIC, HB_GT_CHRTOTAL , 0 }, +{ "GT_STRCOUNT", FS_PUBLIC, HB_GT_STRCOUNT , 0 }, +{ "GT_STRCSPN", FS_PUBLIC, HB_GT_STRCSPN , 0 }, +{ "GT_STRDIFF", FS_PUBLIC, HB_GT_STRDIFF , 0 }, +{ "GT_STREXPAND", FS_PUBLIC, HB_GT_STREXPAND , 0 }, +{ "GT_STRLEFT", FS_PUBLIC, HB_GT_STRLEFT , 0 }, +{ "GT_STRPBRK", FS_PUBLIC, HB_GT_STRPBRK , 0 }, +{ "GT_STRRIGHT", FS_PUBLIC, HB_GT_STRRIGHT , 0 }, +{ "HB_FEOF", FS_PUBLIC, HB_HB_FEOF , 0 }, +{ "HB_FGOBOTTOM", FS_PUBLIC, HB_HB_FGOBOTTOM , 0 }, +{ "HB_FGOTO", FS_PUBLIC, HB_HB_FGOTO , 0 }, +{ "HB_FGOTOP", FS_PUBLIC, HB_HB_FGOTOP , 0 }, +{ "HB_FLASTREC", FS_PUBLIC, HB_HB_FLASTREC , 0 }, +{ "HB_FRECNO", FS_PUBLIC, HB_HB_FRECNO , 0 }, +{ "HB_FREADLN", FS_PUBLIC, HB_HB_FREADLN , 0 }, +{ "HB_FSKIP", FS_PUBLIC, HB_HB_FSKIP , 0 }, +{ "HB_FUSE", FS_PUBLIC, HB_HB_FUSE , 0 }, +{ "LOG10", FS_PUBLIC, HB_LOG10 , 0 }, +{ "PVALUE", FS_PUBLIC, HB_PVALUE , 0 }, +{ "ROT13", FS_PUBLIC, HB_ROT13 , 0 }, +{ "SIN", FS_PUBLIC, HB_SIN , 0 }, +{ "SINH", FS_PUBLIC, HB_SINH , 0 }, +{ "STRDUMP", FS_PUBLIC, HB_STRDUMP , 0 }, +{ "STRTOKEN", FS_PUBLIC, HB_STRTOKEN , 0 }, +{ "TAN", FS_PUBLIC, HB_TAN , 0 }, +{ "TANH", FS_PUBLIC, HB_TANH , 0 }, +{ "TFILEREAD", FS_PUBLIC, HB_TFILEREAD , 0 }, +{ "TOCHAR", FS_PUBLIC, HB_TOCHAR , 0 }, +{ "VALTYPE", FS_PUBLIC, HB_VALTYPE , 0 }, +{ "__MVPUBLIC", FS_PUBLIC, HB___MVPUBLIC , 0 }, +{ "__MVPRIVATE", FS_PUBLIC, HB___MVPRIVATE , 0 } HB_INIT_SYMBOLS_END( RUNNER ); #if ! defined(__GNUC__) #pragma startup RUNNER diff --git a/harbour/include/vm.api b/harbour/include/vm.api index abec727fce..ebf04ee420 100644 --- a/harbour/include/vm.api +++ b/harbour/include/vm.api @@ -14,19 +14,19 @@ typedef void * HANDLE; /* Standard */ -#define _xvalloc(size, flags) hb_xalloc(size) -#define _xvfree(h) hb_xfree(h) -#define _xvrealloc(h, size, flags) hb_xrealloc(h, size) -#define _xvlock(h) (h) -#define _xvunlock(h) /* dummy */ +#define _xvalloc( size, flags ) hb_xalloc( size ) +#define _xvfree( h ) hb_xfree( h ) +#define _xvrealloc( h, size, flags ) hb_xrealloc( h, size ) +#define _xvlock( h ) ( h ) +#define _xvunlock( h ) /* dummy */ /* Wire */ -#define _xvwire(h) (h) -#define _xvunwire(h) /* dummy */ +#define _xvwire( h ) ( h ) +#define _xvunwire( h ) /* dummy */ /* State */ -#define _xvlockcount(h) (0) -#define _xvsize(h) hb_xsize(h) +#define _xvlockcount( h ) (0) +#define _xvsize( h ) hb_xsize( h ) /* -------------------------------------------------------- */ /* Warning: Heap functionality is not supported by Harbour. */ @@ -34,12 +34,12 @@ typedef void * HANDLE; /* -------------------------------------------------------- */ /* Heap */ -#define _xvheapnew(size) (0) -#define _xvheapdestroy(h) /* dummy */ -#define _xvheapresize(h, size) /* dummy */ -#define _xvheapalloc(h, size) (0) -#define _xvheapfree(h, offset) /* dummy */ -#define _xvheaplock(h, offset) (0) -#define _xvheapunlock(h, offset) /* dummy */ +#define _xvheapnew( size ) (0) +#define _xvheapdestroy( h ) /* dummy */ +#define _xvheapresize( h, size ) /* dummy */ +#define _xvheapalloc( h, size ) (0) +#define _xvheapfree( h, offset ) /* dummy */ +#define _xvheaplock( h, offset ) (0) +#define _xvheapunlock( h, offset ) /* dummy */ #endif /* HB_VM_API_ */ diff --git a/harbour/make_tpl.bat b/harbour/make_tpl.bat index a23afea61c..0248062a83 100644 --- a/harbour/make_tpl.bat +++ b/harbour/make_tpl.bat @@ -1,3 +1,6 @@ +@echo off + +rem Flavour: DOS/Windows batch file rem --------------------------------------------------------------- rem Template to initialize the environment before starting @@ -16,8 +19,6 @@ rem - clean rem - install rem --------------------------------------------------------------- -rem Under OS/2 you may rename this file to have a .CMD extension - rem --------------------------------------------------------------- rem Configuration for "install" command: diff --git a/harbour/make_tpl.cmd b/harbour/make_tpl.cmd new file mode 100644 index 0000000000..d60f1b9924 --- /dev/null +++ b/harbour/make_tpl.cmd @@ -0,0 +1,65 @@ +@echo off + +rem Flavour: OS/2 + +rem --------------------------------------------------------------- +rem Template to initialize the environment before starting +rem the GNU make system for Harbour +rem +rem For further information about the GNU make system please +rem check doc/gmake.txt +rem --------------------------------------------------------------- + +rem --------------------------------------------------------------- +rem Usage: make_tpl +rem +rem The following commands are currently supported: +rem - all (default) +rem - clean +rem - install +rem --------------------------------------------------------------- + +rem --------------------------------------------------------------- +rem Configuration for "install" command: + +set HB_BIN_INSTALL=bin\ +set HB_LIB_INSTALL=lib\ +set HB_INC_INSTALL=include\ + +rem --------------------------------------------------------------- +rem The following HB_ARCHITECTURE values are currently supported: +rem - dos +rem - win32 +rem - linux +rem - os2 + +set HB_ARCHITECTURE=os2 + +rem --------------------------------------------------------------- +rem The following HB_COMPILER values are currently supported: +rem - When HB_ARCHITECTURE=dos +rem - bcc31 +rem - djgpp +rem - watcom +rem - When HB_ARCHITECTURE=win32 +rem - bcc32 +rem - gcc +rem - icc +rem - msvc +rem - When HB_ARCHITECTURE=linux +rem - gcc +rem - When HB_ARCHITECTURE=os2 +rem - gcc +rem - icc + +set HB_COMPILER=gcc + +rem --------------------------------------------------------------- +rem Fine tuning of C compiler parameters for "all" command: + +set C_USR= + +rem --------------------------------------------------------------- +rem Start the GNU make system + +make %1 %2 %3 %4 %5 %6 %7 %8 %9 diff --git a/harbour/make_tpl.sh b/harbour/make_tpl.sh index f685953381..8af24b668d 100644 --- a/harbour/make_tpl.sh +++ b/harbour/make_tpl.sh @@ -1,19 +1,66 @@ #!/bin/bash +# Flavour: Bash script + # --------------------------------------------------------------- # Template to initialize the environment before starting -# the GNU make system for Harbour (Linux version) +# the GNU make system for Harbour # # For further information about the GNU make system please # check doc/gmake.txt # --------------------------------------------------------------- +# --------------------------------------------------------------- +# Usage: make_tpl.sh +# +# The following commands are currently supported: +# - all (default) +# - clean +# - install +# --------------------------------------------------------------- + +# --------------------------------------------------------------- +# Configuration for "install" command: + +export HB_BIN_INSTALL=bin/ +export HB_LIB_INSTALL=lib/ +export HB_INC_INSTALL=include/ + +# --------------------------------------------------------------- +# The following HB_ARCHITECTURE values are currently supported: +# - dos +# - win32 +# - linux +# - os2 + export HB_ARCHITECTURE=linux + +# --------------------------------------------------------------- +# The following HB_COMPILER values are currently supported: +# - When HB_ARCHITECTURE=dos +# - bcc31 +# - djgpp +# - watcom +# - When HB_ARCHITECTURE=win32 +# - bcc32 +# - gcc +# - icc +# - msvc +# - When HB_ARCHITECTURE=linux +# - gcc +# - When HB_ARCHITECTURE=os2 +# - gcc +# - icc + export HB_COMPILER=gcc +# --------------------------------------------------------------- +# Fine tuning of C compiler parameters for "all" command: + +export C_USR= + # --------------------------------------------------------------- # Start the GNU make system -make clean -make +make $* diff --git a/harbour/source/rdd/dbcmd.c b/harbour/source/rdd/dbcmd.c index 1b1d3ab2b2..65616ca602 100644 --- a/harbour/source/rdd/dbcmd.c +++ b/harbour/source/rdd/dbcmd.c @@ -168,7 +168,7 @@ static LPRDDNODE hb_FindRddNode( char * szDriver ) static int hb_rddRegister( char * szDriver, USHORT uiType ) { LPRDDNODE pRddNode, pRddNewNode; - PDYNSYM pGetFuncTable; + PHB_DYNS pGetFuncTable; char * szGetFuncTable; if( hb_FindRddNode( szDriver ) ) /* Duplicated RDD */ diff --git a/harbour/source/rtl/Makefile b/harbour/source/rtl/Makefile index 67b44825a4..22b9730dbd 100644 --- a/harbour/source/rtl/Makefile +++ b/harbour/source/rtl/Makefile @@ -45,6 +45,7 @@ PRG_SOURCES=\ errorsys.prg \ menuto.prg \ objfunc.prg \ + readvar.prg \ setkey.prg \ tclass.prg \ tget.prg \ diff --git a/harbour/source/rtl/achoice.prg b/harbour/source/rtl/achoice.prg index bb536de649..f7ae292eec 100644 --- a/harbour/source/rtl/achoice.prg +++ b/harbour/source/rtl/achoice.prg @@ -285,7 +285,7 @@ function achoice( nTop, nLft, nBtm, nRyt, acItems, xSelect, xUserFunc, nPos, nHi endif - case ( ( nKey == K_HOME ) .or. ( nKey == K_CTRL_PGUP ) ) .and. ( !lUserFunc ) + case nKey == K_CTRL_PGUP .or. ( nKey == K_HOME .and. !lUserFunc ) IF nPos == nFrstItem IF nAtTop == max( 1, nPos - nNumRows + 1 ) nMode := AC_HITTOP @@ -299,7 +299,7 @@ function achoice( nTop, nLft, nBtm, nRyt, acItems, xSelect, xUserFunc, nPos, nHi DispPage( acCopy, alSelect, nTop, nLft, nNumRows, nPos, nAtTop ) endif - case ( ( nKey == K_END ) .or. ( nKey == K_CTRL_PGDN ) ) .and. ( !lUserFunc ) + case nKey == K_CTRL_PGDN .or. ( nKey == K_END .and. !lUserFunc ) IF nPos == nLastItem IF nAtTop == min( nLastItem, nItems - nNumRows + 1 ) nMode := AC_HITBOTTOM diff --git a/harbour/source/rtl/classes.c b/harbour/source/rtl/classes.c index 800510964c..263a0e4e1e 100644 --- a/harbour/source/rtl/classes.c +++ b/harbour/source/rtl/classes.c @@ -80,13 +80,13 @@ typedef struct #define BUCKET 4 #define HASH_KEY (BASE_METHODS / BUCKET) -PCLASS pClasses = 0; -WORD wClasses = 0; -PMETHOD pMethod = 0; -PDYNSYM msgClassName = 0; -PDYNSYM msgClassH = 0; -PDYNSYM msgEval = 0; -PDYNSYM msgClassSel = 0; +PCLASS pClasses = 0; +WORD wClasses = 0; +PMETHOD pMethod = 0; +PHB_DYNS msgClassName = 0; +PHB_DYNS msgClassH = 0; +PHB_DYNS msgEval = 0; +PHB_DYNS msgClassSel = 0; /* All functions contained in classes.c */ @@ -190,7 +190,7 @@ HARBOUR HB_CLASSADD(void) PHB_ITEM pInit = hb_param( 5, IT_ANY ); PCLASS pClass; - PDYNSYM pMessage; + PHB_DYNS pMessage; PMETHOD pNewMeth; if( wClass && wClass <= wClasses ) @@ -346,7 +346,7 @@ HARBOUR HB_CLASSDEL(void) { PHB_ITEM pString = hb_param( 2, IT_STRING ); PHB_SYMB pMessage = hb_GetDynSym( pString->item.asString.value )->pSymbol; - PDYNSYM pMsg = ( PDYNSYM ) pMessage->pDynSym; + PHB_DYNS pMsg = pMessage->pDynSym; PCLASS pClass; WORD wClass = hb_parni( 1 ); @@ -447,7 +447,7 @@ HARBOUR HB_CLASSMOD(void) { PHB_ITEM pString = hb_param( 2, IT_STRING ); PHB_SYMB pMessage = hb_GetDynSym( pString->item.asString.value )->pSymbol; - PDYNSYM pMsg = ( PDYNSYM ) pMessage->pDynSym; + PHB_DYNS pMsg = pMessage->pDynSym; PCLASS pClass; WORD wClass = hb_parni( 1 ); @@ -549,7 +549,7 @@ static HARBOUR ClassSel(void) WORD wAt; WORD wPos = 0; PCLASS pClass; - PDYNSYM pMessage; + PHB_DYNS pMessage; PHB_ITEM pReturn = hb_itemNew( NULL ); PHB_ITEM pItem; PHB_ITEM pItemRef; @@ -570,7 +570,7 @@ static HARBOUR ClassSel(void) /* Create a transfer array */ for( wAt = 0; wAt < wLimit ; wAt++ ) { - pMessage = (PDYNSYM) pClass->pMethods[ wAt ].pMessage; + pMessage = pClass->pMethods[ wAt ].pMessage; if( pMessage ) /* Hash Entry used ? */ { pItem = hb_itemPutC( NULL, pMessage->pSymbol->szName ); @@ -725,10 +725,10 @@ static HARBOUR GetData( void ) */ PHB_FUNC hb_GetMethod( PHB_ITEM pObject, PHB_SYMB pMessage ) { - WORD wAt, wLimit, wMask; - WORD wClass; - PCLASS pClass; - PDYNSYM pMsg = ( PDYNSYM ) pMessage->pDynSym; + WORD wAt, wLimit, wMask; + WORD wClass; + PCLASS pClass; + PHB_DYNS pMsg = pMessage->pDynSym; if( pObject->type == IT_OBJECT ) wClass = pObject->item.asArray.value->wClass; @@ -985,7 +985,7 @@ static HARBOUR Virtual( void ) HARBOUR HB___INSTSUPER( void ) { PHB_ITEM pString = hb_param( 1, IT_STRING ); - PDYNSYM pDynSym; + PHB_DYNS pDynSym; BYTE bFound = FALSE; WORD w; diff --git a/harbour/source/rtl/do.c b/harbour/source/rtl/do.c index d4f757c8ee..4aa04c92fc 100644 --- a/harbour/source/rtl/do.c +++ b/harbour/source/rtl/do.c @@ -43,7 +43,7 @@ HARBOUR HB_DO( void ) pItem =hb_param( 1, IT_ANY ); if( IS_STRING(pItem) ) { - PDYNSYM pDynSym; + PHB_DYNS pDynSym; pDynSym =hb_GetDynSym( pItem->item.asString.value ); if( pDynSym ) diff --git a/harbour/source/rtl/memvars.c b/harbour/source/rtl/memvars.c index af5f5a840d..43a3ef25c1 100644 --- a/harbour/source/rtl/memvars.c +++ b/harbour/source/rtl/memvars.c @@ -42,7 +42,7 @@ #define VS_PRIVATE 64 #define VS_PUBLIC 128 -static PDYNSYM *_privateStack = NULL; +static PHB_DYNS * _privateStack = NULL; static ULONG _privateStackSize = 0; static ULONG _privateStackCnt = 0; static ULONG _privateStackBase = 0; @@ -61,8 +61,8 @@ static HB_VALUE_PTR _globalTable = NULL; */ static void hb_MemvarCreateFromItem( PHB_ITEM, BYTE, PHB_ITEM ); -static void hb_MemvarCreateFromDynSymbol( PDYNSYM, BYTE, PHB_ITEM ); -static void hb_MemvarAddPrivate( PDYNSYM ); +static void hb_MemvarCreateFromDynSymbol( PHB_DYNS, BYTE, PHB_ITEM ); +static void hb_MemvarAddPrivate( PHB_DYNS ); void hb_MemvarsInit( void ) { @@ -71,7 +71,7 @@ void hb_MemvarsInit( void ) _globalFreeCnt = 0; _globalFirstFree = _globalLastFree = 1; - _privateStack = (PDYNSYM *) hb_xgrab( sizeof(PDYNSYM) * TABLE_INITHB_VALUE ); + _privateStack = (PHB_DYNS *) hb_xgrab( sizeof(PHB_DYNS) * TABLE_INITHB_VALUE ); _privateStackSize = TABLE_INITHB_VALUE; _privateStackCnt = _privateStackBase = 0; } @@ -198,7 +198,7 @@ HB_HANDLE hb_MemvarValueNew( HB_ITEM_PTR pSource, int iTrueMemvar ) * an exit from the function/procedure) * */ -static void hb_MemvarAddPrivate( PDYNSYM pDynSym ) +static void hb_MemvarAddPrivate( PHB_DYNS pDynSym ) { /* Allocate the value from the end of table */ @@ -207,7 +207,7 @@ static void hb_MemvarAddPrivate( PDYNSYM pDynSym ) /* No more free values in the table - expand the table */ _privateStackSize += TABLE_EXPANDHB_VALUE; - _privateStack =(PDYNSYM *) hb_xrealloc( _privateStack, sizeof(PDYNSYM) * _privateStackSize ); + _privateStack =(PHB_DYNS *) hb_xrealloc( _privateStack, sizeof(PHB_DYNS) * _privateStackSize ); } _privateStack[ _privateStackCnt++ ] =pDynSym; @@ -336,9 +336,9 @@ void hb_MemvarValueDecRef( HB_HANDLE hValue ) */ void hb_MemvarSetValue( PHB_SYMB pMemvarSymb, HB_ITEM_PTR pItem ) { - PDYNSYM pDyn; + PHB_DYNS pDyn; - pDyn = (PDYNSYM) pMemvarSymb->pDynSym; + pDyn = (PHB_DYNS) pMemvarSymb->pDynSym; if( pDyn ) { @@ -367,9 +367,9 @@ void hb_MemvarSetValue( PHB_SYMB pMemvarSymb, HB_ITEM_PTR pItem ) void hb_MemvarGetValue( HB_ITEM_PTR pItem, PHB_SYMB pMemvarSymb ) { - PDYNSYM pDyn; + PHB_DYNS pDyn; - pDyn = (PDYNSYM) pMemvarSymb->pDynSym; + pDyn = (PHB_DYNS) pMemvarSymb->pDynSym; if( pDyn ) { @@ -395,9 +395,9 @@ void hb_MemvarGetValue( HB_ITEM_PTR pItem, PHB_SYMB pMemvarSymb ) void hb_MemvarGetRefer( HB_ITEM_PTR pItem, PHB_SYMB pMemvarSymb ) { - PDYNSYM pDyn; + PHB_DYNS pDyn; - pDyn = (PDYNSYM) pMemvarSymb->pDynSym; + pDyn = (PHB_DYNS) pMemvarSymb->pDynSym; if( pDyn ) { @@ -435,7 +435,7 @@ void hb_MemvarGetRefer( HB_ITEM_PTR pItem, PHB_SYMB pMemvarSymb ) */ static void hb_MemvarCreateFromItem( PHB_ITEM pMemvar, BYTE bScope, PHB_ITEM pValue ) { - PDYNSYM pDynVar; + PHB_DYNS pDynVar; /* find dynamic symbol or creeate one */ if( IS_SYMBOL( pMemvar ) ) @@ -449,7 +449,7 @@ static void hb_MemvarCreateFromItem( PHB_ITEM pMemvar, BYTE bScope, PHB_ITEM pVa hb_MemvarCreateFromDynSymbol( pDynVar, bScope, pValue ); } -static void hb_MemvarCreateFromDynSymbol( PDYNSYM pDynVar, BYTE bScope, PHB_ITEM pValue ) +static void hb_MemvarCreateFromDynSymbol( PHB_DYNS pDynVar, BYTE bScope, PHB_ITEM pValue ) { if( bScope & VS_PUBLIC ) { @@ -492,7 +492,7 @@ static void hb_MemvarCreateFromDynSymbol( PDYNSYM pDynVar, BYTE bScope, PHB_ITEM void hb_MemvarRelease( HB_ITEM_PTR pMemvar ) { ULONG ulBase = _privateStackCnt; - PDYNSYM pDynVar; + PHB_DYNS pDynVar; if( IS_STRING(pMemvar) ) { @@ -529,7 +529,7 @@ void hb_MemvarRelease( HB_ITEM_PTR pMemvar ) void hb_MemvarReleaseWithMask( char *szMask, BOOL bInclude ) { ULONG ulBase = _privateStackCnt; - PDYNSYM pDynVar; + PHB_DYNS pDynVar; while( ulBase > _privateStackBase ) { diff --git a/harbour/source/rtl/menuto.prg b/harbour/source/rtl/menuto.prg index 639c3d8f36..5df13983dc 100644 --- a/harbour/source/rtl/menuto.prg +++ b/harbour/source/rtl/menuto.prg @@ -10,9 +10,12 @@ Author: Phil Barnett Released to Public Domain + + Changes for higher Clipper compatibility by: + Victor Szel */ -/* NOTE: Recursive use is acceptable */ +/* NOTE: Recursive use is supported */ #include "setcurs.ch" #include "inkey.ch" @@ -21,17 +24,7 @@ static aLevel := {} static nPointer := 1 -procedure __AtPrompt( nCol, nRow, cPrompt, cMsg ) - - local nMsgLen := 0 - - // gather message data - if valtype( cMsg ) == 'C' .and. !empty( cMsg ) - if len( cMsg ) > maxcol() + 1 - cMsg := left( cMsg, maxcol() + 1 ) // message too long to display - endif - nMsgLen := max( nMsgLen, len( cMsg ) ) - endif +function __AtPrompt( nCol, nRow, cPrompt, cMsg ) if nPointer < 1 nPointer := 1 @@ -43,174 +36,205 @@ procedure __AtPrompt( nCol, nRow, cPrompt, cMsg ) enddo // add to the static array - aadd( aLevel[ nPointer ], { nCol, nRow, cPrompt, cMsg, len( cPrompt ), nMsgLen } ) + aadd( aLevel[ nPointer ], { nCol, nRow, cPrompt, cMsg } ) // put this prompt on the screen right now setpos( nCol, nRow ) dispout( cPrompt ) - return + return .f. function __MenuTo( bBlock, cVariable ) local nKey local y local q - local n := eval( bBlock ) - local nArrLen := len( aLevel[ nPointer ] ) - local nMsgRow := set( _SET_MESSAGE ) - local lSetMCenter := set( _SET_MCENTER ) - local nMaxCol := maxcol() + 1 - local lDoMessage := nMsgRow > 0 - local lGotMessage := .f. - local nMsgCol := int( ( nMaxCol - aLevel[ nPointer ] [ len( aLevel ) ] [ 6 ] ) / 2 ) - local nSaveCsr := setcursor( SC_NONE ) + local n + local lExit + local nArrLen + local xMsg + local nMsgCol + local nMsgRow + local lMsgCenter + local nSaveCursor + local cSaveReadVar - ColorSelect( CLR_STANDARD ) + local bOldError + local lBlockError - nPointer ++ + // Detect if a memver was passed - if len( aLevel[ nPointer - 1 ] ) == 0 +// TODO: Enable when implemented +// +// bOldError := errorblock( {|| break( NIL ), .F. } ) +// lBlockError := .T. +// begin sequence + n := eval( bBlock ) + lBlockError := .F. +// TODO: Enable when implemented +// +// end sequence +// errorblock( bOldError ) + + if lBlockError + __mvPUBLIC( cVariable ) + endif + + // if no prompts were defined, exit with 0 + + if nPointer < 1 .or. nPointer > len( aLevel ) n := 0 else + nPointer ++ + + nArrLen := len( aLevel[ nPointer - 1 ] ) + + // put choice in a valid range + if !( ValType( n ) == "N" ) .OR. n < 1 n := 1 - elseif n > len( aLevel[ nPointer - 1 ] ) - n := len( aLevel[ nPointer - 1 ] ) endif - for y := 1 to nArrLen - if valtype( aLevel[ nPointer - 1, y, 4 ] ) $ 'CB' - lGotMessage := .t. - exit - endif - next + if n > nArrLen + n := nArrLen + endif - do while .t. + // - // were there any messages? - if lGotMessage .and. lDoMessage + nSaveCursor := setcursor( iif( Set( _SET_INTENSITY ), SC_NONE, NIL ) ) + cSaveReadVar := ReadVar( upper( cVariable ) ) + xMsg := "" + nMsgCol := 0 + nMsgRow := set( _SET_MESSAGE ) + lMsgCenter := set( _SET_MCENTER ) + lExit := .F. - if valtype( aLevel[ nPointer - 1, n, 4 ] ) == 'B' - // Code Block messages ( yes, they are documented! ) + do while n <> 0 - eval( aLevel[ nPointer - 1, n, 4 ] ) - - elseif valtype( aLevel[ nPointer - 1, n, 4 ] ) == 'C' - // Character messages - - // set the display location - if lSetMCenter - - // erase the current message row - dispbox( nMsgRow, nMsgCol, ; - nMsgRow, nMsgCol + aLevel[ nPointer - 1, n, 6 ] ) - - setpos( nMsgRow, ( nMaxcol - len( aLevel[ nPointer - 1, n, 4 ] ) ) / 2 ) - - else - - // erase the current message row - dispbox( nMsgRow, 0, ; - nMsgRow, aLevel[ nPointer - 1, n, 6 ], ' ' ) - - setpos( nMsgRow, 0 ) - - endif - - if len( aLevel[ nPointer - 1, n, 4 ] ) > 0 - - // display the message - dispout( aLevel[ nPointer - 1, n, 4 ] ) - - endif + // should we display messages? + if nMsgRow > 0 + if ! Empty( xMsg ) + setpos( nMsgRow, nMsgCol ) + dispout( space( len( xMsg ) ) ) endif + xMsg := aLevel[ nPointer - 1, n, 4 ] + + // Code Block messages ( yes, they are documented! ) + if valtype( xMsg ) == 'B' + xMsg := eval( xMsg ) + endif + + if valtype( xMsg ) <> 'C' + xMsg := "" + endif + + if lMsgCenter + nMsgCol := int( ( maxcol() - len( xMsg ) ) / 2 ) + endif + + setpos( nMsgRow, nMsgCol ) + dispout( xMsg ) + endif // save the current row q := n - ColorSelect( CLR_ENHANCED ) + if Set( _SET_INTENSITY ) + ColorSelect( CLR_ENHANCED ) + endif // highlight the prompt setpos( aLevel[ nPointer - 1, n, 1 ], aLevel[ nPointer - 1, n, 2 ] ) dispout( aLevel[ nPointer - 1, n, 3 ] ) - ColorSelect( CLR_STANDARD ) + if Set( _SET_INTENSITY ) + ColorSelect( CLR_STANDARD ) + endif - setpos( aLevel[ nPointer - 1, n, 1 ], aLevel[ nPointer - 1, n, 2 ] ) + if lExit + exit + endif - // wait for a keystroke - nKey := inkey( 0 ) + nKey := 0 + do while nKey == 0 + + // wait for a keystroke + nKey := inkey( 0 ) + + if ( bAction := setkey( nKey ) ) <> NIL + + eval( bBlock, n ) + eval( bAction, procname( 1 ), procline( 1 ), upper( cVariable ) ) + n := eval( bBlock ) + + if n < 1 + n := 1 + elseif n > nArrLen + n := nArrLen + endif + + nKey := 0 + + endif + enddo // check for keystrokes do case - case ( bAction := setkey( nKey ) ) <> NIL - - eval( bAction, procname( 1 ), procline( 1 ), Upper( cVariable ) ) - if empty( nextkey() ) - keyboard chr( 255 ) - inkey() - nKey := 0 - endif - case nKey == K_DOWN .or. nKey == K_RIGHT - n ++ - if n > nArrLen - if set( _SET_WRAP ) - n := 1 - else - n := nArrLen - endif + if ++n > nArrLen + n := iif( Set( _SET_WRAP ), 1, nArrLen ) endif case nKey == K_UP .or. nKey == K_LEFT - n -- - if n < 1 - if set( _SET_WRAP ) - n := nArrLen - else - n := 1 - endif + if --n < 1 + n := iif( Set( _SET_WRAP ), nArrLen, 1 ) endif - case nKey == K_ENTER .or. nKey == K_PGUP .or. nKey == K_PGDN - exit - case nKey == K_ESC - n := 0 - exit case nKey == K_HOME n := 1 case nKey == K_END n := nArrLen + case nKey == K_ENTER .or. nKey == K_PGUP .or. nKey == K_PGDN + lExit := .T. + case nKey == K_ESC + n := 0 otherwise // did user hit a hot key? for y := 1 to nArrLen if upper( left( ltrim( aLevel[ nPointer - 1, y, 3 ] ), 1 ) ) == upper( chr( nKey ) ) n := y + lExit := .T. exit endif next endcase - // unhighlight the prompt - setpos( aLevel[ nPointer - 1, q, 1 ], aLevel[ nPointer - 1, q, 2 ] ) - dispout( aLevel[ nPointer - 1, q, 3 ] ) + if n <> 0 + setpos( aLevel[ nPointer - 1, q, 1 ], aLevel[ nPointer - 1, q, 2 ] ) + dispout( aLevel[ nPointer - 1, q, 3 ] ) + endif enddo + ReadVar( cSaveReadVar ) + SetCursor( nSaveCursor ) + + nPointer -- + asize( aLevel, nPointer - 1 ) + endif - nPointer -- - - asize( aLevel, nPointer - 1 ) - - setcursor( nSaveCsr ) - eval( bBlock, n ) + if lBlockError + release ( cVariable ) + endif + + SetPos( MaxRow() - 1, 0) + return n diff --git a/harbour/source/rtl/readvar.prg b/harbour/source/rtl/readvar.prg new file mode 100644 index 0000000000..0af301723b --- /dev/null +++ b/harbour/source/rtl/readvar.prg @@ -0,0 +1,45 @@ +/* + * $Id$ + */ + +/* + Harbour Project source code + + READVAR() + + Copyright (C) 1999 Victor Szel + www - http://www.harbour-project.org + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version, with one exception: + + The exception is that if you link the Harbour Runtime Library (HRL) + and/or the Harbour Virtual Machine (HVM) with other files to produce + an executable, this does not by itself cause the resulting executable + to be covered by the GNU General Public License. Your use of that + executable is in no way restricted on account of linking the HRL + and/or HVM code into it. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit + their web site at http://www.gnu.org/). +*/ + +FUNCTION ReadVar( cVarName ) + STATIC scVarName := "" + + LOCAL cOldVarName := scVarName + + IF ValType( cVarName ) == "C" + scVarName := cVarName + ENDIF + + RETURN cOldVarName diff --git a/harbour/source/runner/runner.c b/harbour/source/runner/runner.c index 1733d5031d..994f25e1c2 100644 --- a/harbour/source/runner/runner.c +++ b/harbour/source/runner/runner.c @@ -125,7 +125,7 @@ HARBOUR HB_HB_RUN( void ) PHB_SYMB pSymRead; /* Symbols read */ PDYNFUNC pDynFunc; /* Functions read */ - PDYNSYM pDynSym; + PHB_DYNS pDynSym; if( hb_pcount() == 0 ) printf( "\nPlease give HRB file name\n" ); diff --git a/harbour/source/vm/dynsym.c b/harbour/source/vm/dynsym.c index e52a8c0558..623eb760a7 100644 --- a/harbour/source/vm/dynsym.c +++ b/harbour/source/vm/dynsym.c @@ -30,6 +30,11 @@ #define SYM_ALLOCATED (-1) +typedef struct +{ + PHB_DYNS pDynSym; /* Pointer to dynamic symbol */ +} DYNHB_ITEM, * PDYNHB_ITEM, * DYNHB_ITEM_PTR; + static PDYNHB_ITEM pDynItems = 0; /* Pointer to dynamic items */ static WORD wDynSymbols = 0; /* Number of symbols present */ static WORD wClosestDynSym = 0; @@ -58,9 +63,9 @@ PHB_SYMB hb_NewSymbol( char * szName ) /* Create a new symbol */ return pSymbol; } -PDYNSYM hb_NewDynSym( PHB_SYMB pSymbol ) /* creates a new dynamic symbol */ +PHB_DYNS hb_NewDynSym( PHB_SYMB pSymbol ) /* creates a new dynamic symbol */ { - PDYNSYM pDynSym = hb_FindDynSym( pSymbol->szName ); /* Find position */ + PHB_DYNS pDynSym = hb_FindDynSym( pSymbol->szName ); /* Find position */ WORD w; if( pDynSym ) /* If name exists */ @@ -87,7 +92,7 @@ PDYNSYM hb_NewDynSym( PHB_SYMB pSymbol ) /* creates a new dynamic symbol */ memcpy( &pDynItems[ wDynSymbols - w ], &pDynItems[ wDynSymbols - w - 1 ], sizeof( DYNHB_ITEM ) ); } /* Insert element in array */ - pDynSym = ( PDYNSYM ) hb_xgrab( sizeof( DYNSYM ) ); + pDynSym = ( PHB_DYNS ) hb_xgrab( sizeof( HB_DYNS ) ); pDynItems[ wClosestDynSym ].pDynSym = pDynSym; /* Enter DynSym */ } @@ -106,9 +111,9 @@ PDYNSYM hb_NewDynSym( PHB_SYMB pSymbol ) /* creates a new dynamic symbol */ return pDynSym; } -PDYNSYM hb_GetDynSym( char * szName ) /* finds and creates a symbol if not found */ +PHB_DYNS hb_GetDynSym( char * szName ) /* finds and creates a symbol if not found */ { - PDYNSYM pDynSym; + PHB_DYNS pDynSym; char * szUprName = ( char * ) hb_xgrab( strlen( szName ) + 1 ); strcpy( szUprName, szName ); /* make a copy as we may get a const string */ @@ -126,14 +131,14 @@ PDYNSYM hb_GetDynSym( char * szName ) /* finds and creates a symbol if not foun return pDynSym; } -PDYNSYM hb_FindDynSym( char * szName ) +PHB_DYNS hb_FindDynSym( char * szName ) { WORD wFirst = 0, wLast = wDynSymbols, wMiddle = wLast / 2; if( ! pDynItems ) { pDynItems = ( PDYNHB_ITEM ) hb_xgrab( sizeof( DYNHB_ITEM ) ); /* Grab array */ - pDynItems->pDynSym = ( PDYNSYM ) hb_xgrab( sizeof( DYNSYM ) ); + pDynItems->pDynSym = ( PHB_DYNS ) hb_xgrab( sizeof( HB_DYNS ) ); /* Always grab a first symbol. Never an empty bucket. *<1>* */ pDynItems->pDynSym->hMemvar = 0; pDynItems->pDynSym->pSymbol = 0; diff --git a/harbour/source/vm/hvm.c b/harbour/source/vm/hvm.c index bee17bd0e8..e50c32562a 100644 --- a/harbour/source/vm/hvm.c +++ b/harbour/source/vm/hvm.c @@ -218,7 +218,7 @@ int main( int argc, char * argv[] ) #ifdef HARBOUR_START_PROCEDURE { - PDYNSYM pDynSym =hb_FindDynSym( HARBOUR_START_PROCEDURE ); + PHB_DYNS pDynSym =hb_FindDynSym( HARBOUR_START_PROCEDURE ); if( pDynSym ) pSymStart =pDynSym->pSymbol; else @@ -928,12 +928,6 @@ void Equal( BOOL bExact ) PushLogical( 0 ); } -static void ForceLink( void ) /* To force the link of some functions */ -{ - HB_ERRORSYS(); - HB_ERRORNEW(); -} - void ForTest( void ) /* Test to check the end point of the FOR */ { double dStep; @@ -2173,6 +2167,12 @@ void DoInitFunctions( int argc, char * argv[] ) } while( pLastSymbols ); } +static void ForceLink( void ) /* To force the link of some functions */ +{ + HB_ERRORSYS(); + HB_ERRORNEW(); +} + /* ----------------------------- */ /* TODO: Put these to /source/rtl/?.c */ @@ -2256,7 +2256,7 @@ HARBOUR HB_VALTYPE( void ) { PHB_ITEM pItem; - if( hb_pcount() ) + if( hb_pcount() == 1 ) { pItem = hb_param( 1, IT_ANY ); @@ -2298,7 +2298,10 @@ HARBOUR HB_VALTYPE( void ) } } else - hb_retc( "U" ); + { + /* QUESTION: Clipper catches this at compile time! */ + hb_errorRT_BASE(EG_ARGCOUNT, 3000, NULL, "VALTYPE"); + } } HARBOUR HB_ERRORBLOCK(void)