From 08cb3e3a255bc77ae8bca27f6cfaef9a7e425fae Mon Sep 17 00:00:00 2001 From: "Alexander S.Kresin" Date: Mon, 17 Jan 2000 19:18:07 +0000 Subject: [PATCH] Updating preprocessor and RDD ADS files --- harbour/ChangeLog | 106 ++++++++++++++++-------------- harbour/contrib/rdd_ads/ads.ch | 8 ++- harbour/contrib/rdd_ads/ads1.c | 7 +- harbour/contrib/rdd_ads/adsfunc.c | 38 +++++++++++ harbour/contrib/rdd_ads/rddads.h | 35 ++++++++++ harbour/source/pp/hbpp.c | 8 ++- 6 files changed, 150 insertions(+), 52 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 542aae8c44..3b37ae34cc 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,31 +1,41 @@ +20000117-22:09 GMT+3 Alexander Kresin + * source/pp/hbpp.c + * Few bugs fixed, reported by Matteo Baccan + * contrib/rdd_ads/ads.ch + * contrib/rdd_ads/ads1.c + * contrib/rdd_ads/adsfunc.c + * contrib/rdd_ads/rddads.h + Bug fixed in SET INDEX TO ... implementation + New commands added + 20000117-16:05 GMT+1 Ryszard Glab *source/rdd/dbcmd.c - * fixed GPF in ORDBAGEXT() - + * fixed GPF in ORDBAGEXT() + 20000117-13:30 GMT+1 Ryszard Glab *source/rtl/type.c - * added hb_retc( "U" ) for initial implementation of TYPE() function - (due to a very popular demand :) + * added hb_retc( "U" ) for initial implementation of TYPE() function + (due to a very popular demand :) 20000117-12:25 GMT+1 Ryszard Glab *source/rtl/achoice.prg *source/rtl/input.prg - * macro related code are active now - + * macro related code are active now + *source/compiler/harbour.y - * function that initializes static variables is generated - properly when ANNOUNCE statement is used + * function that initializes static variables is generated + properly when ANNOUNCE statement is used 20000116-20:30 GMT+1 Ryszard Glab *source/rtl/harbinit.prg - * replaced ANNOUNCEd CLIPPER5xx with procedure definition - - + * replaced ANNOUNCEd CLIPPER5xx with procedure definition + + 20000116-15:35 GMT+1 Ryszard Glab *include/hberrors.h @@ -50,8 +60,8 @@ * removed fixed translation of ANNOUNCE statement *source/compiler/cmdcheck.c - * restored correct support for '-w' compiler switch - + * restored correct support for '-w' compiler switch + 20000115-20:3 GMT+3 Luiz Rafael Culik *source/rtl/arrays.c *source/rtl/type.c @@ -80,14 +90,14 @@ 20000115-19:35 GMT+1 Ryszard Glab *source/macro/macro.l - * corrected recognition of variable names which ends with numbers - e.g. X1, A123 + * corrected recognition of variable names which ends with numbers + e.g. X1, A123 20000115-15:45 GMT+1 Ryszard Glab *source/compiler/hbgenerr.c - * added missing comma separator in error messages list - + * added missing comma separator in error messages list + 20000115-15:15 GMT+1 Ryszard Glab *include/pcode.h @@ -98,7 +108,7 @@ HB_P_MPOPALIASEDVAR NOTE: All sources HAVE TO be recompiled!!! - + *include/macro.h * added new constant: HB_MACRO_GEN_PUSH 4 /* generate PUSH pcodes */ @@ -209,7 +219,7 @@ NOTE: All sources HAVE TO be recompiled!!! *include/hbexpr.c *source/compiler/expropt.c *source/compiler/harbour.y - * fixed STATIC var1[0], var2[3,4] initialization failure + * fixed STATIC var1[0], var2[3,4] initialization failure 2000-01-07 GMT +3 Luiz Rafael Culik * gt.b32 @@ -283,12 +293,12 @@ NOTE: All sources HAVE TO be recompiled!!! *source/compiler/harbour.y *source/compiler/harbour.l * added support for macro variables in PUBLIC and PRIVATE declarations - PRIVATE &var, &var.end - * optimization of PUBLIC/PRIVATE variables creation (there was a - single call __MVPUBLIC/__MVPRIVATE function for every variable, - there is a single call for a single statement now), for example: - PRIVATE var1, var2, var3 - // 3 calls previously - only one call now + PRIVATE &var, &var.end + * optimization of PUBLIC/PRIVATE variables creation (there was a + single call __MVPUBLIC/__MVPRIVATE function for every variable, + there is a single call for a single statement now), for example: + PRIVATE var1, var2, var3 + // 3 calls previously - only one call now *source/macro/macro.y * renamed: hb_compExprNewSymbol() -> hb_compExprNewFunName() @@ -297,12 +307,12 @@ NOTE: All sources HAVE TO be recompiled!!! *source/macro/macro.c * fixed handling of &var.text syntax * handling of text substitution is now Clipper compatible - - previously only substituted value was scanned for nested macro - operator - the whole text is rescanned now, for example: - PRIVATE a:='&', b:='b' - ? &a.b - will print a value of variable 'b' now instead of a generation - of a syntax error. + previously only substituted value was scanned for nested macro + operator - the whole text is rescanned now, for example: + PRIVATE a:='&', b:='b' + ? &a.b + will print a value of variable 'b' now instead of a generation + of a syntax error. *include/extend.h * added declaration for hb_macroTextSubst() @@ -424,20 +434,20 @@ Fixed the documentation to make the ng linker happy and added docs for the array 19991231-13:00 GMT+1 Ryszard Glab *source/rtl/memvars.c - * new function hb_memvarGetStrValuePtr() that return a value - of passed variable if this variable exists and if it contains - a string value (the function is called from macro text - substitution) + * new function hb_memvarGetStrValuePtr() that return a value + of passed variable if this variable exists and if it contains + a string value (the function is called from macro text + substitution) *include/extend.h - * added declaration for hb_memvarGetStrValuePtr() - * added declaration of hb_macroTextValue() + * added declaration for hb_memvarGetStrValuePtr() + * added declaration of hb_macroTextValue() *source/vm/hvm.c - * added code to handle macro text substitution "text ¯o" + * added code to handle macro text substitution "text ¯o" *source/macro/macro.c - * added code to handle macro text substitution + * added code to handle macro text substitution 19991231-06:15 GMT+1 Antonio Linares * source/rtl/gt/gtwin.c @@ -497,16 +507,16 @@ Fixed the documentation to make the ng linker happy and added docs for the array *include/hbexpr.c *source/compiler/expropt.c *source/compiler/harbour.y - * fixed compiler parse error on aliased macro expressions - M->&( expression ) + * fixed compiler parse error on aliased macro expressions + M->&( expression ) 19991222-18:20 GMT+1 Ryszard Glab *include/hbexpr.c *source/compiler/expropt.c - * fixed generation of pcodes for aliased expressions used in - a statement context (the previously selected workarea is popped - from the eval stack instead of swapping) + * fixed generation of pcodes for aliased expressions used in + a statement context (the previously selected workarea is popped + from the eval stack instead of swapping) 19991220-18:42 GMT+1 Chen Kedem * source/rtl/menuto.prg @@ -518,14 +528,14 @@ Fixed the documentation to make the ng linker happy and added docs for the array Mon Dec 20 13:49:01 1999 Gonzalo A. Diethelm - * source/rdd/dbcmd.c: - * source/rtl/classes.c: - Fixed two minor warnings. + * source/rdd/dbcmd.c: + * source/rtl/classes.c: + Fixed two minor warnings. 19991219-14:35 GMT+1 Ryszard Glab *source/compiler/harbour.l - * fixed recognition of 'DO &var WITH' syntax + * fixed recognition of 'DO &var WITH' syntax 19991219-15:55 GMT+3 Alexander Kresin * source/pp/hbpp.c diff --git a/harbour/contrib/rdd_ads/ads.ch b/harbour/contrib/rdd_ads/ads.ch index 0c304b0f38..7201e68287 100644 --- a/harbour/contrib/rdd_ads/ads.ch +++ b/harbour/contrib/rdd_ads/ads.ch @@ -43,4 +43,10 @@ if( upper( <(x)> ) == "CDX", 2, 3 ) ) ) #command SET SERVER LOCAL => AdsSetServerType ( 1 ) -#command SET SERVER REMOTE => AdsSetServerType ( 2 ) \ No newline at end of file +#command SET SERVER REMOTE => AdsSetServerType ( 2 ) + +#command SET AXS LOCKING ; + => AdsLocking( if( upper( <(x)> ) == "ON", .t., .f. ) ) + +#command SET CHARTYPE TO ; + => AdsSetCharType( if( upper( <(x)> ) == "OEM", 2, 1 ) ) diff --git a/harbour/contrib/rdd_ads/ads1.c b/harbour/contrib/rdd_ads/ads1.c index f92fbaad97..607ac59439 100644 --- a/harbour/contrib/rdd_ads/ads1.c +++ b/harbour/contrib/rdd_ads/ads1.c @@ -54,6 +54,9 @@ HARBOUR HB__ADS( void ); HARBOUR HB_ADS_GETFUNCTABLE( void ); extern int adsFileType; +extern int adsLockType; +extern int adsRights; +extern int adsCharType; HB_INIT_SYMBOLS_BEGIN( ads1__InitSymbols ) { "_ADS", FS_PUBLIC, HB__ADS, 0 }, @@ -649,7 +652,7 @@ static ERRCODE adsOpen( ADSAREAP pArea, LPDBOPENINFO pOpenInfo ) return FAILURE; ulRetVal = AdsOpenTable ( 0, pOpenInfo->abName, NULL, - adsFileType,ADS_ANSI, ADS_COMPATIBLE_LOCKING, ADS_CHECKRIGHTS, + adsFileType, adsCharType, adsLockType, adsRights, ( (pOpenInfo->fShared)? ADS_SHARED:ADS_EXCLUSIVE ) | ( (pOpenInfo->fReadonly)? ADS_READONLY:ADS_DEFAULT ), &hTable); @@ -714,7 +717,7 @@ static ERRCODE adsOrderListAdd( ADSAREAP pArea, LPDBORDERINFO pOrderInfo ) HB_TRACE(HB_TR_DEBUG, ("adsOrderListAdd(%p, %p)", pArea, pOrderInfo)); ulRetVal = AdsOpenIndex( pArea->hTable, - (UNSIGNED8*) hb_itemGetCPtr( pOrderInfo->itmOrder ), ahIndex, &pusArrayLen ); + (UNSIGNED8*) hb_itemGetCPtr( pOrderInfo->atomBagName ), ahIndex, &pusArrayLen ); if( ulRetVal != AE_SUCCESS ) return FAILURE; pArea->hOrdCurrent = ahIndex[0]; diff --git a/harbour/contrib/rdd_ads/adsfunc.c b/harbour/contrib/rdd_ads/adsfunc.c index 745393bbe2..fc9a7cb3c0 100644 --- a/harbour/contrib/rdd_ads/adsfunc.c +++ b/harbour/contrib/rdd_ads/adsfunc.c @@ -44,6 +44,9 @@ #include "rddads.h" int adsFileType = ADS_CDX; +int adsLockType = ADS_PROPRIETARY_LOCKING; +int adsRights = 1; +int adsCharType = ADS_ANSI; HARBOUR HB_ADSSETFILETYPE( void ) { @@ -69,4 +72,39 @@ HARBOUR HB_ADSSETSERVERTYPE( void ) } hb_ret(); return; +} + +HARBOUR HB_ADSLOCKING( void ) +{ + int lockType, oldType = adsLockType; + if( hb_pcount() > 0 ) + { + adsLockType = hb_parl( 1 ); + } + hb_retl( oldType ); + return; +} + +HARBOUR HB_ADSRIGHTSCHECK( void ) +{ + int lockType, oldType = (adsRights==1)? 1:0; + if( hb_pcount() > 0 ) + { + adsRights = ( hb_parl( 1 ) )? 1:2; + } + hb_retl( oldType ); + return; +} + +HARBOUR HB_ADSSETCHARTYPE( void ) +{ + int charType, oldType = adsCharType; + if( hb_pcount() > 0 ) + { + charType = hb_parni( 1 ); + if( charType>0 && charType<3 ) + adsCharType = charType; + } + hb_retni( oldType ); + return; } \ No newline at end of file diff --git a/harbour/contrib/rdd_ads/rddads.h b/harbour/contrib/rdd_ads/rddads.h index 9acbc87fbf..257080cf78 100644 --- a/harbour/contrib/rdd_ads/rddads.h +++ b/harbour/contrib/rdd_ads/rddads.h @@ -1,3 +1,38 @@ +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * Header file for Advantage Database Server RDD + * + * Copyright 1999 Alexander S.Kresin + * 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/). + * + */ + #include "rddapi.h" #include "ace.h" diff --git a/harbour/source/pp/hbpp.c b/harbour/source/pp/hbpp.c index 6ba6b59de4..6e09bec1b8 100644 --- a/harbour/source/pp/hbpp.c +++ b/harbour/source/pp/hbpp.c @@ -1796,6 +1796,10 @@ static int ReplacePattern( char patttype, char * expreal, int lenreal, char * pt } while( ifou > 0 ); } + else if( lenreal && *expreal == '{' ) + { + hb_pp_Stuff( expreal, ptro, lenreal, 4, lenres ); + } else { hb_pp_Stuff( "{||}", ptro, 4, 4, lenres ); @@ -1882,10 +1886,10 @@ int hb_pp_RdStr( FILE * handl_i, char * buffer, int maxlen, BOOL lDropSpaces, ch break; case STATE_QUOTE1: if(cha=='\'') s_ParseState = STATE_NORMAL; break; case STATE_QUOTE2: if(cha=='\"') s_ParseState = STATE_NORMAL; break; + case STATE_BRACKET: if(cha==']') s_ParseState = STATE_NORMAL; break; default: switch( cha ) { case '[': s_ParseState = STATE_BRACKET; break; - case ']': s_ParseState = STATE_NORMAL; break; case '\"': if( s_ParseState != STATE_BRACKET ) s_ParseState = STATE_QUOTE2; break; @@ -1916,6 +1920,8 @@ int hb_pp_RdStr( FILE * handl_i, char * buffer, int maxlen, BOOL lDropSpaces, ch } } while(--readed >= 0 && ( buffer[readed] == ' ' || buffer[readed] == '\t') ); + if( buffer[readed] != ';' && s_ParseState != STATE_COMMENT ) + s_ParseState = STATE_NORMAL; readed++; buffer[readed]='\0'; return readed;