Commit Graph

6879 Commits

Author SHA1 Message Date
Przemyslaw Czerpak
5e19a3c8fd 2006-11-17 22:55 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/source/pp/ppcore.c
    ! fixed casting - it resolves problem reported by Alexander with
      preprocessing chr(255) from static buffer (PP used by .prg code)

  * harbour/source/macro/macro.y
    + added some comments

  * harbour/source/macro/Makefile
    * commented out compilation of FLEX based lexer for macro compiler and
      added compilation of new small lexer written in pure .c

  * harbour/common.mak
    * replaced macrol.obj by macrolex.obj

  + harbour/source/macro/macrolex.c
    + new small lexer written in pure .c. The code is much smaller,
      MT safe and more friendly for grammar parser. I think it should
      be also faster but I haven't made any tests yet. When we update
      grammar parser to not free string representation of terminal
      symbols then we should expect some farther speed improvement,
      it will also resolve some set of memory leaks like in:
         type("user input")
      and will allow to make some parts of grammar parser common to
      compiler and macro compiler by removing #if[n]def HB_MACRO_SUPPORT
2006-11-17 22:06:54 +00:00
Przemyslaw Czerpak
f474925255 2006-11-17 14:55 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/source/common/hbstr.c
    ! fixed decoding strings without trailing ASCII NUL character in
      hb_strRemEscSeq()

  * harbour/source/pp/ppcore.c
    + added decoding C escaped strings (e"...") to PP so they can be
      preprocessed like a normal strings, it's not enabled when
      HB_C52_STRICT macro is set
2006-11-17 13:59:17 +00:00
Przemyslaw Czerpak
8d38c093b4 2006-11-17 13:30 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/include/hbapi.h
  * harbour/source/common/hbstr.c
  * harbour/source/compiler/harbour.l
  * harbour/source/macro/macro.l
  * harbour/source/macro/macro.slx
  * harbour/source/compiler/harbour.slx
    * changed parameters in function: hb_compStrToNum() now the string
      size is passed explicitly so it can work with strings which does
      not have trailing ASCII NUL character.

  * harbour/source/macro/macro.y
    * indenting

  * harbour/include/hbmacro.h
  * harbour/source/common/hbstr.c
  * harbour/source/macro/macro.l
  * harbour/source/macro/macro.y
    * added two new functions for macro compiler: hb_macroLexNew() and
      hb_macroLexDelete() to clearly separate lexer from grammar parser.

  * harbour/source/compiler/harbour.l
  * harbour/source/common/hbstr.c
  * harbour/source/pp/ppcore.c
    * added error generation for wrong e"..." strings and fixed \" quoting
    * removed \q quoting

  * harbour/source/pp/ppcore.c
  * harbour/source/pp/ppgen.c
    * added small description in headers

  * harbour/common.mak
  * harbour/source/pp/Makefile
  * harbour/source/pp/pplib.c
  + harbour/source/pp/pplib2.c
  * harbour/include/hbextern.ch
    + added auto destructor for allocated PP context, it's not longer
      necessary to execute __PP_FREE() so this function was moved from
      the standard .prg API to file with backward compatible functions
    * changed __PREPROCESS() to __PP_PROCESS()
    * moved setting std rules to separate file so now if user uses PP
      with only his own rules we are not forcing linking static tables
      which are quite huge (over 100kb)
      To include stdandard rules in static binaries user should add
      to his code:
         REQUEST __PP_STDRULES

  + harbour/source/pp/pplib3.c
    * old PP functions for backward compatibility:
         __PPADDRULE(), __PREPROCESS(), __PP_FREE()
      Please note that using this function is not MT safe. They should
      work like with old PP code. Using any of this function automatically
      forces linking __PP_STDRULES
2006-11-17 12:29:24 +00:00
Przemyslaw Czerpak
c448973306 2006-11-15 14:20 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/include/hbapi.h
    + added
         void * pLex;
      member to HB_MACRO structure - it will be necessary for MT safe
      macro parser

  * harbour/include/set.ch
  * harbour/include/hbexprb.c
  * harbour/source/macro/macro.l
  * harbour/source/macro/macro.y
    * indenting, formatting and converting tabs to spaces

  * harbour/include/hbpp.h
  * harbour/source/compiler/ppcomp.c
  * harbour/source/pp/ppcore.c
  * harbour/source/pp/ppgen.c
  * harbour/source/pp/pplib.c
    * make HB_PP_TOKEN structure public for other code and changed
      public PP API to not force including static rules by programs
      which does not need them.
    + added basic API for using PP as lexer
    * divided HB_PP_TOKEN_MACRO to HB_PP_TOKEN_MACROVAR and
      HB_PP_TOKEN_MACROTEXT and mark
         [<keyword>][&<keyword>[.[<nextidchars>]]]+
      as HB_PP_TOKEN_MACROTEXT not pair HB_PP_TOKEN_KEYWORD and
      HB_PP_TOKEN_MACRO
      It allows easier integration PP as (macro)compiler lexer and
      fixes preprocessing [<keyword>][&<keyword>[.[<nextidchars>]]]+
      in some patterns.

  * harbour/utils/hbtest/Makefile
    + added PP library to linked library list

  * harbour/source/macro/macro.y
    + added seaport to use PP as lexer. It's disabled by default and
      can be enabled using by defining HB_PP_MACROLEX. It eliminates
      using FLEX or SIMPLEX lexer in macro compiler. Now it emulates
      the behavior of FLEX lexer because I wanted to minimize the
      modification but in fact because parsed token are freed when
      macro compiler finish its job then we can resolve RT memory
      leaks which apear during parsing wrong expressions. It will be
      enough to drop allocating memory for new terminal symbols and
      using them as is like in compiler. It will also quite nice
      simplify include/hbexpr*.c code and will allow to move some
      functions to COMMON library. I want to make also pure compiler
      code MT safe so I will have to add passing pointer to a structure
      with compiler context just like in macro compiler. It means that
      if we define a structure which will be common to compiler and macro
      compiler with local (not common) data stored in other structure for
      which will will keep only a pointer then we will be able to move most
      of include/hbexpr*.c code to common library. But I do not want to
      make farther modification without consultation without Ryszard.
      Also to make PP default lexer some farther modifications should
      be done in core PP code and include/hbexpr*.c files to not reduce
      the speed. Now using HB_PP_MACROLEX for sure will have to cause
      speed reduction in macro compiler. But if we make necessary
      modifications then we should keep at least the same speed or
      probably reach noticeable better results.
2006-11-15 13:21:20 +00:00
Alexander S.Kresin
6fc5b585ec 2006-11-14 16:35 UTC+0300 Alexander Kresin <alex@belacy.belgorod.su> 2006-11-14 13:34:35 +00:00
Przemyslaw Czerpak
b560fd5a77 2006-11-14 13:50 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/TODO
    * removed to resolved problems from TODO/TOFIX list

  * harbour/include/hbexprb.c
    * indenting and tab to spaces conversion

  * harbour/source/compiler/ppcomp.c
    ! fixed typo which cased that dump buffer was not ended
      with \0 character
2006-11-14 12:51:34 +00:00
Przemyslaw Czerpak
87538f21cd 2006-11-13 20:50 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/include/hbpp.h
  * harbour/source/pp/ppcore.c
    ! fixed the problem reported by Enrico in code like:
         IF ["] $ var
      Unfortuantelly this fix also breaks some valid expressions like:
         x := a[ f("]") ] $ "test"
         x := a[ f( "'" ) ] $ "test"
      what is also Clipper compatible anyhow I think that in the future
      we may want to break Clipper compatibility and allow compilation
      of such code.

  * harbour/doc/pp.txt
    * updated documentation for the above modification
2006-11-13 19:49:57 +00:00
Chen Kedem
df8f9efb57 2006-11-13 11:22 UTC+0200 Chen Kedem <niki@actcom.co.il> 2006-11-13 09:22:43 +00:00
Przemyslaw Czerpak
d99b93ad14 2006-11-13 03:40 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/bin/hb-func.sh
    + pass GTK paths to GCC in hb* scripts when -xbgtk switch is used

  * harbour/contrib/rdd_ads/rddads.h
  * harbour/contrib/rdd_ads/adsfunc.c
    * indenting and casting

  * harbour/source/rdd/dbfcdx/dbfcdx1.c
    * cleaned typos in comments

  + harbour/tests/speedtst.prg
    + added speed test

  * harbour/include/hbpp.h
  * harbour/source/pp/ppcore.c
    + added HB_PP_TOKEN_ISNEUTRAL() macro to make code a little bit more
      readable

  * harbour/include/std.ch
    + added some missing old PP commands

  * harbour/source/Makefile
    * minor modification in order of compiled libraries

  * harbour/source/pp/pplib.c
    * changed the PP interface for .prg code.
      Now following functions are supported:

         __PP_INIT( [<cIncludePath>] [, <cStdChFile> ] ) -> <pPP>
            initialize new PP context and return pointer to it.
            when <cStdChFile> is empty string ("") then no default rules are
            used  only the dynamically created #defines like __HARBOUR__,
            __DATE__, __TIME__, __PLATFORM__*

         __PP_FREE( <pPP> )
            free PP context.

         __PP_PATH( <pPP>, <cPath> [, <lClearPrev>] )
            add new (or replace previous) include paths.

         __PP_RESET( <pPP> )
            reset the PP context (remove all rules added by user or
            preprocessed code)

         __PP_ADDRULE( <pPP>, <cDirective> )
            preprocess and execute new preprocessor directive

         __PREPROCESS( <pPP>, <cCode> ) -> <cPreprocessedCode>
            preprocess given code and return result

      User can create more then one PP context and then use each of them
      separately. Any modification in one context have no effect in other.
2006-11-13 02:40:33 +00:00
Marek Paliwoda
16f0722343 2006-11-12 09:30 UTC+0100 Marek Paliwoda (mpaliwoda at interia pl)
* harbour/makefile.bc
   * harbour/makefile.vc
     * Fixed pptable.c dependencies
2006-11-12 08:29:27 +00:00
Przemyslaw Czerpak
a6415eebc4 2006-11-10 17:40 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/contrib/rdd_ads/rddads.h
    + added #define WIN32 when HB_OS_WIN_32 is set to not force -DWIN32
      compiler switch

  * harbour/source/pp/ppcore.c
    * cleaned BCC warnings

  * harbour/source/rdd/dbfcdx/dbfcdx1.c
    ! fixed ordKeyGoto() positioning when active filter is set and no
      controlling order
2006-11-10 16:40:40 +00:00
Przemyslaw Czerpak
b76e59a5fe 2006-11-10 12:00 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/bin/hb-mkslib.sh
    + added ${L_USR} to gcc parameters

  * harbour/source/pp/ppgen.c
    ! fixed minor typo in printf() format
2006-11-10 11:06:29 +00:00
Przemyslaw Czerpak
c2b4a94705 2006-11-10 02:05 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/include/hbcomp.h
  * harbour/include/hbpp.h
  * harbour/source/compiler/cmdcheck.c
  * harbour/source/compiler/hbusage.c
  * harbour/source/compiler/ppcomp.c
  * harbour/source/pp/ppcore.c
  * harbour/source/pp/ppgen.c
  * harbour/source/pp/pplib.c
    * restored support for old hb_inLine() syntax
    + added support for hb_inLine() to new PP. It can be enabled by
      -kI compiler switch. It's disabled by default.
      The new hb_inLine{} syntax is:
         [ <exp> ] hb_inLine [ ( [<params,...>] ) ] { [ <c_code> ] } [ <exp> ]
      <c_code> can contain new line characters.
      Nested hb_inLine{} in <params,...> is not supported. If you think
      it's important I can add it in few lines.
      This version does not break any valid Clipper syntax, hb_inLine is
      not reserved word and hb_inLine can be repeated many times in the
      same line. F.e. this code can be properly preprocessed and compied if
      you disable in compiler old hb_inLine() syntax and enable the new one
      by -kcI Harbour compiler switch:

         proc main()
         local hb_inLine := " (var) "
         ? hb_inLine{ hb_retc("inLine"); } + hb_inLine(" parameter ") {
              hb_retc( hb_parc( 1 ) );
              } + "!" + hb_inLine + hb_inLine() { hb_retc( ":-)" ); } + ;
           hb_inLine() + "{}"
         return
         function hb_inLine()
         return " func() "

      So from user point of view this version have real "inline" syntax.
      To be clear: I'm not a fun of any C inline extensions. They works
      only when we use .c code as compiler backend so the code which uses
      them cannot be used in .hrb files and any other format we will add
      in the future which do not support later C code compilation. F.e it
      will not work in compiler integrated with HVM or with .NET
      Anyhow if someone finds it useful then I think that it should be
      properly implemented. This is the reason I added the new version.
      The old one I left only for backward compatibility. It breaks any
      code which uses hb_inLine keyword can be used only once in a line
      and it does not have "inline" so IMHO it should not be enabled by
      default.
      I would like to hear your opinion about default compiler switches:
         1. should we disable both: hb_inLine() and hb_inLine {}
         2. should we disable hb_inLine() and enable hb_inLine {}
         3. should we disable hb_inLine {} and enable hb_inLine()
         4. should we enable both: hb_inLine() and hb_inLine {}

  + harbour/tests/hbinline.prg
    + added test code for new hb_inLine{} syntax

  * harbour/tests/inline_c.prg
    ! replaced direct access to HB_ITEM body by API function calls
2006-11-10 01:12:49 +00:00
Marek Paliwoda
89e25d1371 2006-11-09 22:00 UTC+0100 Marek Paliwoda (mpaliwoda at interia pl)
* harbour/include/hbstack.h
     * Added HB_EXPORT to hb_stackReturnItem()
2006-11-09 20:59:33 +00:00
Marek Paliwoda
39791e2096 2006-11-09 14:00 UTC+0100 Marek Paliwoda (mpaliwoda at interia pl)
- harbour/utils/hbpp/hbpptable.c
   + harbour/utils/hbpp/hbpptbl.c
   * harbour/utils/hbpp/Makefile
   * harbour/common.mak
     * Renamed hbpptable.c->hbpptbl.c to follow 8.3 naming convention
2006-11-09 12:54:57 +00:00
Marek Paliwoda
aba0cbd9e4 2006-11-09 09:45 UTC+0100 Marek Paliwoda (mpaliwoda at interia pl)
* harbour/ChaneLog
      * Fixed last ChangeLog entry
2006-11-09 08:46:42 +00:00
Marek Paliwoda
66695f622d 2006-11-09 09:45 UTC+0100 Marek Paliwoda (mpaliwoda at interia pl)
* harbour/makefile.bc
     * Adapted to the new Preprocessor utility ppgen.exe
     * Cleaned hbpp.exe dependecies due to recent changes
   * harbour/makefile.vc
   * harbour/common.mak
     * Cleaned hbpp.exe dependecies due to recent changes
   * harbour/include/hbapi.h
     * Added HB_EXPORT to hb_gcAlloc()
   * harbour/include/hbstack.h
     * Added HB_EXPORT to hb_stackSelfItem()
   * harbour/source/vm/fm.c
     * Added dipslaying contents of unreleased blocks at
     program exit, together with logging unreleased memory
     blocks report to fm.log file. Borrowed from xharbour.
2006-11-09 08:38:54 +00:00
Jean-Francois Lefebvre
d1a37718b0 2006-11-08 00:39 UTC+0200 JF Lefebvre (jflefebv at mafact com) 2006-11-08 23:43:24 +00:00
Przemyslaw Czerpak
ef48cb6d96 2006-11-08 17:20 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/source/vm/classes.c
    ! fixed type checking for "string" type. It should be translate
      to character not symbol item type.
2006-11-08 16:19:59 +00:00
Przemyslaw Czerpak
421371a395 2006-11-08 13:40 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/source/pp/ppcore.c
    * cleaned two warnings generated by old GCC versions
2006-11-08 12:39:15 +00:00
Przemyslaw Czerpak
437b04a8ea 2006-11-08 12:55 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/bin/hb-func.sh
    + added linker parametrs to hbcc

  * harbour/include/hbapi.h
    + added hb_retclenAdoptRaw()

  * harbour/include/hbapifs.h
  * harbour/source/common/hbfsapi.c
    * changed first parameters of hb_fsAddSearchPath() to const char *

  * harbour/include/hbclass.ch
    * update for new PP. I think that now we can try to create final
      version of our OOP rules.

  * harbour/include/hbdefs.h
    + added UCHAR and SCHAR typedefs

  * harbour/include/hbrddcdx.h
    * indenting

  * harbour/source/rdd/workarea.c
    ! fixed minor typo

  * harbour/source/common/hbdate.c
  * harbour/source/rtl/dates.c
    * moved hb_dateToday() and hb_dateTimeStr() from RTL to COMMON library

  - harbour/include/hbpp.h
  - harbour/source/pp/ppcomp.c
  - harbour/source/pp/ppcore.c
  - harbour/source/pp/pplib.c
  - harbour/source/pp/pptable.c
  - harbour/source/pp/pragma.c
  * harbour/utils/hbpp/Makefile
  * harbour/utils/hbpp/hbpp.c
  + harbour/utils/hbpp/hbpp.h
  + harbour/utils/hbpp/ppcomp.c
  + harbour/utils/hbpp/ppcore.c
  + harbour/utils/hbpp/pplib.c
  + harbour/utils/hbpp/pptable.c
  + harbour/utils/hbpp/pragma.c
    * moved all PP code to harbour/utils/hbpp
      It's interesting and working preprocessor and the code can be
      usable for some other things so I do not want to remove it.
      Probablly we should move it to contrib/hbpptext

  * harbour/include/hbcomp.h
  * harbour/include/hberrors.h
  * harbour/include/hbsetup.ch
  + harbour/include/hbpp.h
  + harbour/include/hbstdgen.ch
  * harbour/source/common/hbstr.c
  * harbour/source/compiler/Makefile
  * harbour/source/compiler/cmdcheck.c
  * harbour/source/compiler/harbour.c
  * harbour/source/compiler/harbour.l
  * harbour/source/compiler/hbgenerr.c
  + harbour/source/compiler/ppcomp.c
  * harbour/source/pp/Makefile
  + harbour/source/pp/ppcore.c
  + harbour/source/pp/pplib.c
  + harbour/source/pp/ppgen.c
    + New PP code written from scratch. It works in similar way to
      Clipper PP even the error codes are replicated. The code is MT
      safe does not have any limitation on size of preprocessed code,
      line, etc. It's also Clipper compatible lexer. It means that
      we do not longer need FLEX or SIMPLEX which can be replaced
      by new PP after some small modifications. Anyhow I haven't
      decided to make it myself. I would like to agree with with the
      rest of developers. I will be very happy if such modifications
      will be done by someone else, Ryszard?
      Meanwhile I current PP join on output the line tokens and give
      the string line to FLEX/SIMPLEX. It does not have any sense and
      all FLEX/SIMPLEX limitations are still existing. Ryszard, even
      if we keep it then I hope you can remove at least FLEX line buffer
      and use the one returned from PP.
      Because string tokens in parsed line are converted to text which is
      later once again decoded to tokens by FLEX I had to introduce new
      string format which supports embedded string delimiters. I chose
      modified version of xHarbour extension with escaped strings e"<sting>"
      so now FLEX understand such strings and decode them like C escaped
      strings. It means that you can use them also in the .prg code f.e.:
         outstd( e"Hello\n\rWorld" )
      The new PP is also noticeable faster. You should see the difference
      compiling long files. The build in PP rules are generated automatically
      by ppgen program created from source/pp/ppgen.c
      I had to add to GNU source/pp/Makefile these two lines:
         pptable.c : ppgen$(EXE_EXT)
         	./ppgen$(EXE_EXT) $(TOP)$(ROOT)include/hbstdgen.ch -opptable.c -q
      Sth like that will have to be done also in non GNU make system.
      Now Harbour can be compiled only using GNU make.
      Marek can you update non GNU make files? I would like to leave this
      modification to you or other developers who can test it.
      It was quite big modification and I do not believe that I haven't
      make any mistakes but I hope that in few weeks I'll fix any reported
      bugs and it will resolve any PP problems.
      TODO:
         * error messages
           create one common list of errors and warnings and keep it
           in common library. PP and compiler can still generate different
           errors with the same number. It can be confusing for the users
           and hard to document and add i18n translations.
           If possible we should also try to keep Clipper error numbers.
           In new PP code I added Clipper error numbers but I cannot use
           them until compiler code is not updated.
           We should aslo remove the ctype passed to error functions and
           hack with first character in warning messages and use only
           error number. The codes from 1000 to 1999 should be warnings
           where range 1000:1099 is activated by -w, 1100:1199 by -w1,
           1200:1299 by -w2, etc. 2000:2999 are errors and 3000:3999
           fatal errors. All compiler functions which generate an error
           should expect that error function will not stop the compiler
           but return and cleanly finished their job. It's necessary for
           MT support in compiler and making compiler part of some other
           programs which may still work and compile different source code.
         * FLEX/SIMPLEX
           remove them at all and add some final pass to PP to create
           more precise tokens for grammar parser or at least add better
           integration to remove some redundant code and existing limits.
         * hb_inLine() support - it's broken in new PP but as I can see
           it was never working correctly. I can add a hack to PP to support
           hb_inLine() but I'm not sure it's worth to do. Maybe in few days.

  + harbour/include/std.ch
    + added new std.ch. It was created without using Clipper's std.ch.
      It's quite possible that some rules are wrong and should be fixed
      so please help. Anyhow I created a set of programs based on new PP
      code generating all possible combinations of different commands I
      collected from different source code, documentation and match patterns
      of rules I was adding to new std.ch and then I was comparing .ppo
      files generated by Clipper and Harbour so I do not expect any bigger
      problems then some minor typos. I had to introduce some modifications
      in spacing as workaround for FLEX/SIMPLEX which cannot properly decode
      text preprocessed by Clipper after stringify.

  * harbour/utils/hbpptest/pretest.prg
    * updated for new PP
      It reports 16 wrong translations but some of them are valid
      and some others are caused by escaped string e"..." (one of hack
      for FLEX/SIMPLEX support)
      I also had to remove all spaces in comparison the results
      because they were not Clipper ocmpatible at all. Ryszard please
      look at it.
2006-11-08 12:06:17 +00:00
Jean-Francois Lefebvre
e3f43ed1aa 2006-11-07 21:23 UTC+0200 JF Lefebvre (jflefebv at mafact com) 2006-11-07 20:32:42 +00:00
Jean-Francois Lefebvre
ff87204f1d 2006-11-07 20:36 UTC+0200 JF Lefebvre (jflefebv at mafact com) 2006-11-07 19:47:17 +00:00
Marek Paliwoda
0f410dc77b 2006-11-03 22:00 UTC+0100 Marek Paliwoda (mpaliwoda at interia pl)
* harbour/makefile.bc
     * Updated comment section about environment variables used by makefile
   * harbour/makefile.vc
     * Updated comment section about environment variables used by makefile
     * Cleaned compilation under Visual C++ 8.0 (VS2005 compiler), including
       64 bit platforms. To properly compile under Visual C++ 8.0 you have
       set a new environment variable HB_VISUALC_VER to 80 before running
       make_vc.bat.
2006-11-03 21:01:47 +00:00
Przemyslaw Czerpak
0fae2fdd2c 2006-10-07 04:25 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/include/hbclass.ch
    + added validation for class data names. As additional preprocessor
      rule to not use <!marker!>

  * harbour/include/hboo.ch
  * harbour/source/rtl/tclass.prg
  * harbour/source/vm/classes.c
    + added delegate messages

  * harbour/include/hbstack.h
  * harbour/source/vm/arrays.c
  * harbour/source/vm/estack.c
  * harbour/source/vm/hvm.c
  * harbour/source/vm/proc.c
    + added startup symbol to hb_stack. It gives very good stop
      condition for all procedures which trace stack calls and
      resolves the problem with hb_stack.pBase which was never
      pointing to valid function/procedure symbol when no symbol
      was put on HVM stack. Now after hb_stackInit() the first
      item is allocated for "hb_stackInit()" symbol so hb_stack.pBase
      is always a pointer to valid function/procedure symbol.
    * changed the guard condition for buggy code in hb_stackPop()
      and similar code from:
         hb_stack.pPos < hb_stack.pItems
      to:
         hb_stack.pPos <= hb_stack.pBase
      The old condition was generating usable error message only in the
      startup function. In deeply called functions it was only waste of
      CPU time on one of the most often call functions. Before it was
      activated internal stack structures were corrupted.
      If we were leaving for many years without really working stack
      underflow protection then maybe we should think about disabling
      it at when HB_STACK_MACROS are used and keep it only in real
      stack functions for HVM developers. Single protection in
      hb_stackOldFrame() I've just added is enough for basic C code
      validation.
      I created the second version of stack macros without it in
      hbstack.h but I would like to hear other developers opinion.
2006-10-07 02:35:52 +00:00
Przemyslaw Czerpak
57b1473404 2006-10-05 01:40 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/include/hbexprc.c
    * Temporary disabled optimization with references to object variables
      until we will not have extended reference items in our HVM.
      It can be enabled by compiling with HB_USE_OBJMSG_REF

  * harbour/include/hbclass.h
    * restored previous CLASSDATA behavior which ignores SHARED clause
      and always create shared class variables
2006-10-04 23:39:52 +00:00
Przemyslaw Czerpak
654374653c 2006-10-04 15:20 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/include/hbexprc.c
    * translate HB_P_INC / HB_P_DEC in (pre|post)(inc|dec)rementation
      to HB_P_[PLUS|MINUS]EQ

  * harbour/source/vm/hvm.c
    - removed not necessary now hb_itemUnRef() in hb_vmInc()/hb_vmDec()
2006-10-04 13:27:04 +00:00
Antonio Linares
d854c9f5e0 2006-10-04 09:02 UTC+0100 2006-10-04 07:10:04 +00:00
Antonio Linares
101385e3c5 main.c has to be used instead of mainstd.c or mainwin.c 2006-10-04 06:59:32 +00:00
Przemyslaw Czerpak
e47d291938 2006-10-04 02:30 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/include/hbclass.ch
    * most of the rules rewritten
    ! fixed some wrong rules and general cleanup
    + added additional code validation
    ! fixed compilation of more then one class in single file.
      Now it's even possible to declare all classes at beginning of
      single file and then implementing their methods in any order
    ! fixed using static classes and classes
    ! fixed compilation without <ClassName>_ prefix in method names
    + added support for HB_CLS_NO_DECORATION macro which disable
      adding <ClassName>_ prefix to method names - this macro is
      set by default when HB_SHORTNAMES is set.
    + added support for declared parameters validation - it can be
      disabled with HB_CLS_NO_PARAMS_ERR and I had to disable it
      by default due to problems with our preprocessor.
      Ryszard seems that our PP has serious problems with decoding
      directives when there is no space between symbol and some other
      non symbol character. I had to add some workarounds and even
      introduce buggy rules to make it working. Please look at it.
      You can remove #define HB_CLS_NO_PARAMS_ERR from hbclass.ch
      and try to rebuild Harbour core code to see the problem.

  * harbour/include/hboo.ch
  * harbour/source/vm/classes.c
    + added support for new primitive message: HB_OO_MSG_PERFORM

  * harbour/source/rtl/tclass.prg
    - removed <lPersistent> parameter from HBClass messages and
      internals data. Persistent is supported as scope bit and
      separate variable was redundant.
    - removed stripping of () from message names. Here is not a place
      to fix wrong preprocessor rules.

  * harbour/utils/hbtest/rt_class.prg
    * use: METHOD PROCEDURE ... CALSS ...
      instead of: PROCEDURE ... CALSS ...
      The first version is preferable syntax.

  * harbour/source/debug/dbgtmenu.prg
  * harbour/source/rtl/checkbox.prg
    ! fixed some parameters in method declaration - global cleanup
      will have to wait for preprocessor fixes

   Hi all,
   Please make test with current hbclass.ch code.
   I hope that I haven't broken too much things ;-) but I rewrite
   from scratch most rules and it's possible that I missed sth or
   made some stupid typos. Current version is much shorter and should
   be easier to updated. For sure I've intentionally changed one thing.
   CLASSDATA was ignoring SHARED attribute and always created shared
   class variables. Seems that it was long existing typo but the fix
   may interact with already existing code which needs SHARED class
   variables but does not use SHARED clause in CLASSDATA declaration.
   In such case please update it and add missing SHARED.
   Also in the end of CLASS declaration we have:
      [ ; #translate Super( <SuperClassN> ): => ::<SuperClassN>: ] ;
      [ ; #translate Super( <SuperClass1> ): => ::<SuperClass1>: ] ;
      [ ; #translate Super(): => ::<SuperClass1>: ] ;
      [ ; #translate Super: => ::<SuperClass1>: ] ;
      [ ; #translate ::Super : => ::<SuperClass1>: ]
   These rules introduce very serious bug - they are breaking supercasting
   in code which makes sth like:
      ::super:super:super:msg
   or in any other code which sends SUPER message to some other class
   objects. I will have to remove them. At least the last three ones.
   There were some other things I wanted to write about but it's too late
   and I'm to tired - sorry. If you will have any question please ask. if
   you will notice some problems with current rules please inform me.
2006-10-04 00:33:00 +00:00
Przemyslaw Czerpak
bb8804e7ac 2006-09-29 22:50 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/source/vm/classes.c
    * allow to access object variables using assign messages without
      parameter. I do not want to add symmetric behavior for access messages
      though it's technically possible but such things should be controlled
      by programmer because access messages can have less restricted scoping
      then assign ones (READONLY) so I'll add new rule for it in hbclass.ch

  * harbour/source/vm/hvm.c
    * fixed warning message when object variable reference is
      generated using macro compiler without '_' as prefix.
2006-09-29 20:51:46 +00:00
Przemyslaw Czerpak
73900f8855 2006-09-29 21:05 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/contrib/rdd_ads/ads1.c
  * harbour/contrib/rdd_ads/adsfunc.c
    * synced with Brian fixes in xHarbour

  * harbour/source/rdd/workarea.c
    * minor modification

  * harbour/source/rdd/dbfcdx/dbfcdx1.c
    * minor Clipper compatibility update
2006-09-29 19:03:39 +00:00
Ryszard Glab
b0b8b008b1 2006-09-29 11:20 UTC+0100 Ryszard Glab <rglab//imid.med.pl>
* tests/Makefile
      + added omacro.prg and varparam.prg
   * ChangeLog
      * fixed date in previous commit
2006-09-29 09:47:07 +00:00
Ryszard Glab
64509ea871 + added support for passing methods as macro
eg:
         o:&send()
         o:&send.end()
         o:&(expr)()
         o:&var++
         o:&var := 0
         o:&(expr)++
         WITH OBJECT obj
            ++:&var
            :&var += :&(var2+"oo")
         END

   NOTICE:
   For simple assigments (=,:=), compound assignments (+=,-=,*=,/=)
   and for pre/post increment operators( ++,--) the macro should
   evaluate to a symbol that starts with underscore '_'.
     To access a variable the macro should evaluate to a symbol
   with no '_' char.
2006-09-29 08:59:17 +00:00
Przemyslaw Czerpak
e0e9dc2808 2006-09-28 23:55 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/include/common.ch
    - removed ISSYMBOL()
  * harbour/source/rtl/tclass.prg
    * use valtype() instead of IS*()
    * some minor modifications

  * harbour/source/vm/hvm.c
    * minor modification
2006-09-28 21:59:09 +00:00
Przemyslaw Czerpak
a9c4bf5568 2006-09-28 14:40 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/include/hbclass.ch
    * updated some not enabled by default rules to use function pointers
      instead of function names which I forgot to update in previous
      commit
2006-09-28 12:42:47 +00:00
Przemyslaw Czerpak
8deba76fc3 2006-09-28 14:30 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/include/common.ch
    + added ISSYMBOL()

  * harbour/include/hbextern.ch
    - removed __CLS_PARAM()

  * harbour/include/hbclass.ch
  * harbour/source/rtl/tclass.prg
  * harbour/source/vm/classes.c
    * replaced __CLS_PAR00() and __CLS_PARAM() functions by preprocessor
      rules. These functions are not longer necessary though I left them
      in classes.c for backward binary compatibility. Probably they will
      be removed in the future.
    ! use function pointers (@<funcname>()) instead of function names
      with REQUEST for super classes ID. It fixes using STATIC class
      functions.
2006-09-28 12:29:24 +00:00
Przemyslaw Czerpak
9aaaadbc6f 2006-09-28 00:40 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/make_rpm.sh
    * check for rpmbuild also when BUGGY_RPM is set

  * harbour/make_tgz.sh
    * removed rebuild hbpptest with shared libraries

  * harbour/include/hbapicls.h
    + added definitions for hb_clsCreate(), hb_clsAdd(), hb_clsAssociate()

  * harbour/include/hbapierr.h
  * harbour/source/rtl/errorapi.c
    + added hb_errFuncName - pseudo function name which can be used as
      operation description in new error object. It should help to simplify
      some code and fix function names when RT error is generated from C
      function which can be executed from different .prg functions.

  * harbour/include/hbclass.ch
    + added some missing Classy(y) compatible object variable type
      descriptions: Int, Integer, Block

  * harbour/source/rdd/dbfcdx/dbfcdx1.c
    ! disabled early retrieving from the cache key position and key count

  * harbour/include/hbvm.h
  * harbour/source/vm/hvm.c
    + added: void hb_vmPushEvalSym( void ) for the code which do not
      want to access any [P]HB_SYMB structures
    * changed symbol name in hb_symEval from __EVAL to EVAL and modified
      hb_symEval registration method to not register hb_vmDoBlock as global
      function. Having PHB_DYNS address for "EVAL" in hb_symEval.pDynSym
      allows to eliminate some strcmp() when we are looking for EVAL public
      symbol.
    ! fixed symbol table updating in PCODE functions for future multi module
      .hrb files

  * harbour/source/vm/proc.c
    * use hb_symEval.pDynSym instead of strcmp()

  * harbour/source/vm/arrays.c
  * harbour/source/vm/debug.c
    * minor code cleanup

  * harbour/source/rtl/tclass.prg
  * harbour/source/vm/classes.c
    % separate message hash table from methods table - it will cause farther
      reduction of allocated memory - many thanks to all people who send
      me statistics about number of used classes and symbols from their code.
    % use hb_symEval.pDynSym
    + added support for object variable type scope checking like in Class(y).
    ! fixed typo in pushing object class variables by reference
    % s_pClasses is now indexed directly by class handle
    % some other optimiztions
    ! make hidden and non virtual invisible in child classes if it overloaded
      some other non hidden method. In such case the overloaded method is used
      and can be accessed.
    ! make friend functions real method class oriented not (super)object for
      hidden messages
2006-09-27 22:39:06 +00:00
Ryszard Glab
5ba81a153a 2006-09-26 17:00 UTC+0100 Ryszard Glab <rglab//imid.med.pl>
* include/hbexprb.c
   * source/compiler/exproptb.c
   * source/compiler/harbour.y
      *added support for passing the reference to object's variable
      e.g.
      foo( @obj:var )
2006-09-26 14:43:20 +00:00
Alexander S.Kresin
c15e65ac09 2006-09-24 21:10 UTC+0300 Alexander Kresin <alex@belacy.belgorod.su> 2006-09-24 17:10:32 +00:00
Alexander S.Kresin
7a82502e50 2006-09-23 19:58 UTC+0300 Alexander Kresin <alex@belacy.belgorod.su> 2006-09-23 15:58:51 +00:00
Przemyslaw Czerpak
8ef38acb75 2006-09-23 14:35 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/source/vm/itemapi.c
    * minor modification in function order to group together the ones
      which can operate on reference counters
    + added additional stop condition in hb_itemUnRef() - we will have
      to make some modifications for the code which execute hb_itemUnRef()
      to resolve some possible conflicts with operators overloading and
      compiler optimizations

  * harbour/source/vm/classes.c
    * do not inherit friends - seems that our classes code was too
      friendly ;-)
      It also effectively resolves logical problem with accessing
      overloaded non virtual methods from friends.
    + added __clsLock( <hClass> ) - it locks any farther class
      modifications and can be used if programmer wants to be sure
      that no one will try to hack his class definition. It's very
      important when programmers work in a team on bigger project.
      Please do not add to CVS any __clsUnLock() functions - if someone
      needs it then he can create his own custom HVM build.
    * code cleanup

  * harbour/source/vm/eval.c
    + added hb_execFromArray() - idea and syntax borrowed from xHarbour's
      HB_ExecFromArray() by Giancarlo Niccolai though it's independent
      implementation. Now when we have support for functions with variable
      number of parameters then we need sth like this function to fully
      benefit from new feature. The following syntax is supported:
         hb_execFromArray( <cFuncName> [, <aParams> ] )
         hb_execFromArray( @<funcName>() [, <aParams> ] )
         hb_execFromArray( <bCodeBlock> [, <aParams> ] )
         hb_execFromArray( <oObject> , <cMethodName> [, <aParams> ] )
         hb_execFromArray( <oObject> , @<msgName>() [, <aParams> ] )
      or:
         hb_execFromArray( <aExecArray> )
      where <aExecArray> is in one of the following format:
         { <cFuncName> [, <params,...>] }
         { @<funcName>() [, <params,...>] }
         { <bCodeBlock> [, <params,...>] }
         { <oObject> , <cMethodName> [, <params,...>] }
         { <oObject> , @<msgName>() [, <params,...>] }

  * harbour/source/rtl/symbol.prg
    * removed C code inside #pragma BEGINDUMP/ENDDUMP
      now it's only .prg code which uses variable parameters function
      and hb_execFromArray()
2006-09-23 12:39:22 +00:00
Przemyslaw Czerpak
1202be4471 2006-09-22 23:00 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/include/hbclass.ch
  * harbour/include/hbvm.h
  * harbour/source/rtl/tclass.prg
  * harbour/source/vm/classes.c
  * harbour/source/vm/hvm.c
    ! fixed bug in real codeblock scoping which was exploited by
      dictionary resizing
    * changed ACCESS messages to ASSIGN ones when object item
      reference is created for proper READONLY scope checking.
      The reference to object variable can be created only when
      caller has sufficient ASSIGN privileges.
    + added FRIEND CLASS and FRIEND FUNCTION support.
      It's enough to add class definition:
         FRIEND CLASS <classFunc1> [, <classFuncN> ]
      and/or:
         FRIEND FUNCTION <FuncName1> [, <FuncNameN> ]
      and all methods of given class or given function will be able
      to access private variables.
      Warning!!! Friends cannot access overloaded non virtual methods.
                 This feature is available _ONLY_ for real class members.
    + added MODULE FRIENDLY to class definition. It causes that all other
      functions and classes defined in the same .prg module will have
      friend privileges. In such way works xHarbour and there is now way
      to disable this "feature" what is IMHO bug. In Harbour programmer
      has to explicitly enable it (until he will not change / add new
      preprocessor rule and set it as default ;-)). Syntax:
         CREATE CLASS .... MODULE FRIENDLY
            ...
         END CLASS

  * harbour/source/vm/proc.c
  * harbour/source/vm/runner.c
    * updated function symbols processing

  * harbour/source/compiler/harbour.c
    * added note in hb_compOptimizeFrames() about exceeding maximum number
      of local variables (255). We should add new pcode(s) HB_P_LARGE[V]FRAME
      or generate compile time error.

  * harbour/source/vm/macro.c
    % minor optimizations
2006-09-22 21:02:17 +00:00
Przemyslaw Czerpak
4661d6885a 2006-09-21 12:05 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/source/vm/itemapi.c
    % minor optimization in hb_itemParam()
    ! fixed enumerator variable clearing in hb_itemCopy()
2006-09-21 10:09:34 +00:00
Viktor Szakats
efacf25481 2006-09-21 09:52 UTC+0100 Viktor Szakats (viktor.szakats syenar.hu)
* harbour/source/common/expropt2.c
     ! Fixed leak introduced in previous commit.
2006-09-21 07:56:44 +00:00
Viktor Szakats
3ef6c5f724 2006-09-20 23:17 UTC+0100 Viktor Szakats (viktor.szakats syenar.hu)
* harbour/include/hbexprb.c
   * harbour/include/hbexprop.h
   * harbour/source/common/expropt2.c
     % Compile-time optimization added for expressions below:
       SToD(""), SToD(), HB_SToD(<cDate>), HB_SToD(""), HB_SToD()
     ! Tabs converted to spaces.

   * harbour/source/common/hbdate.c
   * harbour/source/rtl/dates.c
     * Copyright cosmetic cleanup.
2006-09-20 21:26:13 +00:00
Przemyslaw Czerpak
1646bac081 2006-09-20 21:02 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/source/vm/codebloc.c
    ! fixed detaching locals in variable parameters functions
2006-09-20 19:03:06 +00:00
Przemyslaw Czerpak
b3fe893ee1 2006-09-20 20:22 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/contrib/rdd_ads/ads1.c
    ! fixed casting for C++ compilation

  * harbour/source/compiler/harbour.c
    ! fixed removing locals frame - bSkipFrame was not initialized

  * harbour/include/hbapi.h
  * harbour/source/vm/estack.c
  * harbour/source/vm/hvm.c
  * harbour/source/vm/itemapi.c
  * harbour/source/vm/proc.c
    * moved current line number information from hb_struSymbol
      to current stack state to keep 16 bytes size for HB_ITEM
      on 32bit systems with 4 bytes alignment
2006-09-20 18:24:33 +00:00
Przemyslaw Czerpak
b6bed767c0 2006-09-20 18:40 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/contrib/rdd_ads/ads1.c
    * synced with recent xHarbour fixes

  * harbour/include/hbdefs.h
    * indenting

  * harbour/include/hbexprb.c
  * harbour/include/hbexprop.h
  * harbour/source/common/expropt2.c
    + added compile time optimization for STOD(cConstDateString)
      covered by -kh compiler extension (default)
      It allows to keep the same source code for Clipper and
      Harbour and benefits from data constants without using
      0dYYYYMMDD values

  * harbour/source/vm/classes.c
    * restored the original 3-rd parameter in  hb_clsAdd to void(void) -
      PHB_FUNC - and added translation for PHB_SYMB to not force using
      [P]HB_SYMB in 3-rd party code

  * harbour/source/vm/estack.c
    * added protection against possible GPF after executing
      hb_stackBaseProcOffset() when first item on the stack
      was not HB_IT_SYMBOL - it can happen in some seldom
      cases. Probably some more general solution like leaving
      first dummy item on HVM stack for breaking stack scan
      loops will be better. I'll think about it.

  * harbour/source/vm/itemapi.c
    ! fixed clearing enumerators
2006-09-20 16:42:12 +00:00
Ryszard Glab
4aeac1e509 2006-09-20 14:15 UTC+0100 Ryszard Glab <rglab//imid.med.pl>
* include/hbpcode.h
      + added new pcode HB_P_VFRAME

   * include/hbapi.h
      + added USHORT paramdeclcnt to asSymbol structure

   * include/hbstack.h
   * source/vm/estack.c
      + added hb_stackLocalVariable() to acces local variables

   * source/compiler/genc.c
   * source/compiler/gencc.c
   * source/compiler/harbour.c
   * source/compiler/harbour.l
   * source/compiler/harbour.y
   * source/compiler/hbdead.c
   * source/compiler/hbfix.c
   * source/compiler/hblbl.c
   * source/compiler/hbpcode.c
   * source/compiler/hbstripl.c
   * source/vm/hvm.c
      + added support for variable number of parameters in
      functions/procedures

   + tests/varparam.prg
      * example usage of new syntax for variable number of
      parameters

   * source/vm/arrayshb.c
      * changed HB_APARAMS() to use current stack frame if no
      arguments are passed ( HB_APARAMS() == HB_APARAMS(0) )

  SYNTAX for variable number of parameters
   1) [FUNCTION|PROCEDURE] name( ... )
   or
   2) [FUNCTION|PROCEDURE] name( var1, var2, varN, ... )

   To access passed parameters use the following:
   PCOUNT() - returns number of passed parameters
   HB_PVALUE( iParamNum ) - returns <iParamNum> parameter
   HB_APARAMS() - returns array with all passed parameters
   or usual name of parameter variable in case of syntax 2)
2006-09-20 12:28:58 +00:00