Commit Graph

6855 Commits

Author SHA1 Message Date
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
Przemyslaw Czerpak
f63bc1dc8c 2006-09-19 18:40 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/include/hbexprb.c
  * harbour/source/vm/hvm.c
    + added support to compiler for sending messages with multi
      parameters resolved by macro operator: s:="1,2,3"; o:msg(&s)
      It works just like for functions and it also needs XBASE extension
      support enabled during compilation, -kx switch in compiler, it's
      enabled by default.

  * harbour/source/rdd/usrrdd/usrrdd.c
    ! added missing DBOI_* index in parameters passed to user ORDINFO()
      method.
2006-09-19 16:40:42 +00:00
Przemyslaw Czerpak
18f74581d1 2006-09-19 11:50 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/include/hbapi.h
  * harbour/include/hbapicls.h
  * harbour/include/hbpcode.h
  * harbour/include/hbxvm.h
  * harbour/source/compiler/genc.c
  * harbour/source/compiler/gencc.c
  * harbour/source/compiler/hbdead.c
  * harbour/source/compiler/hbfix.c
  * harbour/source/compiler/hblbl.c
  * harbour/source/compiler/hbpcode.c
  * harbour/source/compiler/hbstripl.c
  * harbour/source/vm/arrays.c
  * harbour/source/vm/classes.c
  * harbour/source/vm/codebloc.c
  * harbour/source/vm/hvm.c
  * harbour/source/vm/itemapi.c
   + added three new PCODEs:
      HB_P_MACROSEND    - to use for: s:=1,2,3"; o:=send(&s)
      HB_P_PUSHOVARREF  - to create references to object variables: @o:var
      HB_P_ARRAYPUSHREF - to create references to array items, it can be used
                          in some optimization, f.e.: a[ <exp1> ] += <exp2>
                          or directly by: func( @a[ <exp> ] )
                          if we add passing array elements by reference
     Implemented in HVM and PCODE generation, the compiler has to be
     modified yet to use them.
   * changed last parameter in hb_codeblockGetRef() - I'd like to have
     all variables in hb_struRefer structure in one place: hb_itemUnRefOnce()
     for easier modifications in the future.
   * replaced in hb_struRefer 'itemsbase' with 'array'.
   + added hb_arrayGetItemRef() to create references to array elements.
     Such reference updates array reference counters.
   * changed STATICs passed by reference to use new array item references.
   ! block destructor execution after classy releasing on HVM exit
2006-09-19 09:59:42 +00:00
Przemyslaw Czerpak
7e4609cff3 2006-09-18 03:12 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/include/hbclass.ch
    + added MESSAGE ... INLINE ... rule

  * harbour/tests/clsccast.prg
  * harbour/tests/clsicast.prg
  * harbour/tests/clsnv.prg
  * harbour/tests/clsscast.prg
  * harbour/tests/clsscope.prg
    - removed some unnecessary definitions
2006-09-18 01:13:18 +00:00
Przemyslaw Czerpak
dc9ebdf37c 2006-09-17 02:00 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/source/vm/classes.c
    + added hb_clsRealMethodName() function which I'm using in some
      test code

  * harbour/tests/clsscast.prg
    * updated to use __CLS_CNTSHRDATA() instead of __CLS_CNTCLSDATA()

  * harbour/utils/hbtest/rt_class.prg
    + added tests for class and shared class variables/allocating
2006-09-18 00:01:53 +00:00
Viktor Szakats
a09dc85fbe 2006-09-17 18:52 UTC+0100 Viktor Szakats (viktor.szakats syenar.hu)
* harbour/tests/testrpt.prg
     ! Fixed fatal typo.
2006-09-17 16:58:39 +00:00
Przemyslaw Czerpak
24159987a2 2006-09-17 18:45 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* xharbour/include/hbvm.h
  * xharbour/source/vm/hvm.c
    + added hb_vmPushDynSym( PHB_DYNS )
      It should allow most applications to not use [P]HB_SYMB at all.
      Removing PHB_SYMB from 3-rd party .c code may allow us to add
      freeing unused symbol tables from HVM in the future.

  * harbour/source/vm/classes.c
    * temporary restored hb_objGetpMethod()
    + added __ClsCntClasses()
    ! allocated real methods for OnError and Destructor to keep
      the same behavior in these methods as in any others, f.e.
      scoping checking or debugging.

  * harbour/common.mak
  * harbour/utils/hbtest/Makefile
  * harbour/utils/hbtest/hbtest.prg
  + harbour/utils/hbtest/rt_class.prg
    + added tests for our classy code. Now destructors and instance
      area allocating/casting. Some other in the future.
2006-09-17 16:54:04 +00:00
Przemyslaw Czerpak
ff658ccfec 2006-09-16 23:20 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/contrib/rdd_ads/ads1.c
    * synced with recent Brian fixes in xHarbour

  * harbour/include/hbapi.h
    + added 'method' member to hb_struBlock structure

  * harbour/source/vm/hvm.c
    * initialize 'method' member in hb_struBlock structure

  * harbour/source/vm/proc.c
    * changed the name of last parameter of hb_procname() from
      bSkipBlock to fMethodName and modified to use information
      about the class of executed codeblock from new hb_struBlock
      members

  * harbour/source/vm/classes.c
    * removed hb_objGetpMethod() - I hope it's not longer used
    * added real codeblock scoping.
      In Clipper there is no information where the codeblock where
      created and what priviladges/scopes it should has.
      Class(y) to resovle this problem when codeblock is executed scans
      the HVM stack for the nearest method call and takes scopes defined
      for this method. It's a workaround which allow to break standard
      access rights though seems reasonable when it's not possible to
      store information where the block is created. I've added to block
      item structure information about class and method where code block
      was created so we can use the exact method priviladges.
      Now Harbour classy code can work exactly like Class(y) when compiled
      with -DHB_CLASSY_BLOCK_SCOPE and with real code block scoping when
      compiled with -DHB_REAL_BLOCK_SCOPE. I set the second (real code
      block scopes) as default. If you think we should be strict Class(y)
      compatible here then please inform me and I'll change default setting.

  + tests/clsscope.prg
    + added demonstration/test code for class method scoping
2006-09-16 21:24:06 +00:00
Przemyslaw Czerpak
fe3786511e 2006-09-15 21:15 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/source/vm/arrays.c
  * harbour/source/vm/classes.c
    ! fixed multiple use of supercasted object I broke in last commit
    * removed some unused code and moved some scoping checking to
      class creation code
2006-09-15 19:14:32 +00:00
Przemyslaw Czerpak
f22f040335 2006-09-15 13:25 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/include/hbvm.h
  * harbour/source/vm/classes.c
  * harbour/source/vm/hvm.c
    + added hb_vmRequestReenter() and hb_vmRequestRestore()
    + added executing destructors when some exception is active
      I forgot about it in previous commit.

  + harbour/tests/destruct.prg
    + added example/test code for object destructors
2006-09-15 11:28:48 +00:00
Przemyslaw Czerpak
a35053003b 2006-09-15 04:55 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
+ harbour/doc/destruct.txt
    + added description for object destructors in Harbour

  * harbour/include/error.ch
    + added new error code EG_DESTRUCTOR

  * harbour/source/lang/msgpl852.c
  * harbour/source/lang/msgpliso.c
  * harbour/source/lang/msgplmaz.c
  * harbour/source/lang/msgplwin.c
  * harbour/source/rtl/langapi.c
    + added desription for new error code - other language modules
      have to be updated

  * harbour/include/hbapi.h
    + added hb_gcRefCheck() and cover some hb_gc* functions by
      _HB_API_INTERNAL_ macro

  * harbour/source/vm/itemapi.c
    ! fixed possible RT error generation when some exception is active

  * harbour/include/hbapicls.h
  * harbour/include/hbclass.ch
  * harbour/include/hboo.ch
  * harbour/source/rtl/tclass.prg
  * harbour/source/vm/arrays.c
  * harbour/source/vm/classes.c
    + added support for object destructors

  * harbour/source/vm/garbage.c
    + added support for object destructors
    + added logic to detect buggu .prg code which uses destructors
      see doc/destruct.txt for more info.
      It's also possible that this code will exploit some bugs
      in other code which uses GC allocated memory blocks.
2006-09-15 03:10:38 +00:00
Viktor Szakats
27ccee95a1 2006-09-14 15:23 UTC+0100 Viktor Szakats (viktor.szakats syenar.hu)
* harbour/tests/testlbl.prg
     ! use lower name in report name to work properly on case sensitive
       file systems
2006-09-14 13:24:26 +00:00
Przemyslaw Czerpak
c35391da65 2006-09-14 15:10 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/source/vm/garbage.c
    * minor cleanup

  * harbour/source/rtl/cdpapi.c
  * harbour/include/hbextern.ch
    + added HB_CDPLIST() - it returns array with all registered CODEPAGEs

  * harbour/source/rtl/set.c
    ! fixed typo in _SET_DEFEXTENSIONS

  * harbour/tests/testrpt.prg
    ! fixed syntax
    ! use lower name in report name to work properly on case sensitive
      file systems
2006-09-14 13:09:01 +00:00
Przemyslaw Czerpak
bb15806923 2006-09-13 20:35 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/include/hbvm.h
  * harbour/source/vm/hvm.c
  * harbour/source/vm/itemapi.c
    + added __enumStop() message for "FOR EACH" overloading
      It's guarantied that it will be sent to base item if it is an
      object with such message when FOR EACH ... NEXT will finish its job
      even if it will be interrupted by EXIT or RETURN to allow base object
      clear resources allocated for FOR EACH enumerator. The BREAK exception
      is not supported now. This is sth what I'd like to discuss soon when
      I'll add destructors. Please think now if we should allow to execute
      destructors and other cleanup user code when we are returning to
      nearest expection trap (BEGIN SEQUENCE / [ RECOVER /] END) cleaning
      the HVM stack.
2006-09-13 18:37:42 +00:00
Przemyslaw Czerpak
0e68f162e7 2006-09-13 14:00 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/source/compiler/genc.c
  * harbour/source/compiler/gencli.c
  * harbour/source/compiler/harbour.c
    ! fixed number of compiled functions shown in compilation status
    ! added workaround for GPF in empty #pragma begindump/enddump
      statement
2006-09-13 12:02:57 +00:00
Przemyslaw Czerpak
77d31074e8 2006-09-13 03:10 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/source/vm/classes.c
    * keep class shared data in separate array
    + added __CLS_CNTSHRDATA( hClass ) -> nSharedDatas
    % some minor optimizations

  * harbour/tests/clsscast.prg
    + added test code for shared class data allocating and casting

  * harbour/include/hbapicls.h
  * harbour/source/vm/hvm.c
  * harbour/source/vm/itemapi.c
    + added support for FOR EACH overloading - it's work in progress
      do not create any code which may use current solution - it may
      change in the nearest future
2006-09-13 01:12:18 +00:00
Alexander S.Kresin
509d14e639 2006-09-12 14:48 UTC+0300 Alexander Kresin <alex@belacy.belgorod.su> 2006-09-12 10:50:01 +00:00
Przemyslaw Czerpak
6b15fe3ba1 2006-09-12 12:37 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/source/vm/classes.c
    ! fixed typo in adding SHARED CLASS VAR ASSIGN messages
    * some minor cleanup
2006-09-12 10:38:17 +00:00
Przemyslaw Czerpak
7463296f9e 2006-09-11 20:10 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/include/hbapicls.ch
    * added HB_EXPORT to public functions and some internal covered by
      _HB_API_INTERNAL_ macro

  * harbour/include/hboo.ch
    + added HB_OO_CLSTP_NONVIRTUAL and HB_OO_CLSTP_OVERLOADED

  * harbour/source/rtl/tclass.prg
    ! do not add supercast class messages - now it's done automatically
      by __clsNew() function with proper instance area offset updating
    ! enumerate instance class datas in __clsAddMsg() from 1 - inherited
      instance variables are managed internally by classy code with
      proper instance area offset updating
    ! use __CLS_CNTCLSDATA() as start offset for class data. Do not
      try to calculate it yourself - some of super classes can be ignored
      when they are appear in the inheritance tree more then once so it's
      not possible to calculate class data or instance data start offset
      using simple sum of class or instance variables in super classes.

  * harbour/source/vm/classes.c
    ! fixed instance area casting
    ! fixed class variables casting
    ! fixed multi-inheritance when the same class can apear more then
      once in super classes tree.
    ! Do not add unnecessary instance variables for the same class when
      it's inherited more then once.
    ! Do not add unnecessary class variables for the same class when
      it's inherited more then once.
    ! Do not add unnecessary initialization class and instance variables
    + added support for non virtual messages
    + added support for static and casted scoping
    + super cast messages added automatically. They are used to dynamic
      recalculation of instance are offsets and to avoid multiple inheritance
      of the same class so please do not overload them or you will have as
      result something what we have before recent modifications in the
      instance and class data area. Just simply run tests/clsccast.prg
      and tests/clsicast.prg compiled with current CVS code and last
      release code or with xHarbour and compare the results.
      Also Class(y) does not pass these tests and I do not know if any
      other dynamic OOP model in xbase languages can properly address it.
      BTW maybe I should add RT error when .prg code will try to delete
      or overwrite class cast message. For me it seems to be reasonable
      and what's your opinion?
    * make hidden class members non virtual by default. It can be disabled
      by compiling classes.c with -DHB_VIRTUAL_HIDDEN but IMHO keeping
      HIDDEN members as virtual causes that they are not really HIDDEN
      because subclasses can simply overwrite them. It also means that
      it's not possible to create class with some private data and
      methods which will never interact with any subclass code created
      by other programmers where name conflict can appear. So one of
      the most important OOP features is missing in such case.
      See tests/clsnv.prg as an example for non virtual hidden members.

  + tests/clsicast.prg
    + added test code for proper instance area allocating and casting

  + tests/clsccast.prg
    + added test code for proper class data allocating and casting

  + tests/clsnv.prg
    + added test code for non virtual hidden class members

   Now we should be able to create and class model even replicate the
   static one like in C++ using current class engine which still fully
   supports dynamic bindings. It consumes less memory and due to much
   more efficient hashing it should be faster then it was though some
   other minor optimization can be add and I'll plan to make them in
   some spare time.
   The item type verification in assignment is still missing. I'll add
   it when I'll collect some statistic informantion I'd like to ask
   [x]Harbour users. I need these information to tune some internal
   structures where I can balance between speed and memory allocation
   to statistically optimal form.

   Marek asked me to add passing object datas by reference and I'll do
   that but I'd like to ask Ryszard to add support for:
      @<oVar>:<message>
   to compiler. I'll implement all other HVM modifications. If you can
   please also add support for:
      <oVar>:&<cMsgName>[(...)]
   For this we do not need any HVM modifications or new PCODEs.
   We are supporting xBase++ macro list compilation in:
      cList:="1,2,3"
      x := aVar[ &cList ]
      aVar:={ &cList }
      func( &cList )
   But we do not support:
      <oVar>:<message>( &cList )
   IMHO it looks ugly. If we have this syntax for function call then we
   should also support it in message sending.
   Ryszard can you make necessary compiler modifications?
   I'm also thinking about adding support for variable parameters
      func myfunc(...)
      [...]
      return xVar
   In few cases it will help to encode some function much more efficient
   then now.

   I'll add Class(y) compatible functions used in class(y) header files
   so it will be possible to use original class(y) .ch files in Harbour
   though it will not be the most efficient because we have @func() operator
   which gives better performance then using codeblocks. Anyhow classy
   create separate meta class for each class with CLASS members and
   <clasName>() function always return such meta class object so for full
   Class(y) compatibility we need to generate differ .prg code.
   But all such modifications now can be done on preprocessor and
   .prg level and they will not need .c code modification.
   We should make them to give user interface for our new OOP features.

   Now I'm waiting for reports about any problems with current classy
   code.
2006-09-11 18:14:41 +00:00
Alexander S.Kresin
e10df29fdd 2006-09-11 20:30 UTC+0300 Alexander Kresin <alex@belacy.belgorod.su> 2006-09-11 16:31:10 +00:00
Alexander S.Kresin
eee1c71e5e 2006-09-05 16:40 UTC+0300 Alexander Kresin <alex@belacy.belgorod.su> 2006-09-11 12:42:06 +00:00
Przemyslaw Czerpak
45033c962e 2006-09-10 14:28 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/source/vm/classes.c
    * cleaned BCC warning
2006-09-10 12:29:25 +00:00
Przemyslaw Czerpak
8d11bf8235 2006-09-10 14:02 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/ChangeLog
    ! added missing changelog entry about __MVPUT() fix

  * harbour/source/vm/itemapi.c
    * removed redundant pItem->type = HB_IT_NIL (thanks for Manu Exposito)
2006-09-10 12:04:22 +00:00
Przemyslaw Czerpak
43d20b8eb6 2006-09-10 13:05 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/include/hbapi.h
  * harbour/source/vm/hvm.c
  * harbour/source/vm/codebloc.c
  * harbour/source/vm/arrays.c
    * moved static base offset from hb_struBlock structure
      to HB_CODEBLOCK structure
    + added hclass member to hb_struBlock - it will be used in
      the future for checking codeblock scope in classy so we will
      real scope checking also for messages sent from codeblocks.
    - removed supercast and superoffset members from hb_struArray
      structure.

  * harbour/include/hbclass.ch
    * added class(y) like
         @:<MessageName>([<MsgParams,...>])
      send operator. It's not exactly the same as in class(y) where
      this operator is hardcoded to executing function directly,
      needs method name instead of message name and is linked statically.
      In Harbour this operator uses message name so can be used also for
      instance variables and make dynamic casting to the class from which
      current method is inherited. In short words sending messages to @:
      instead of :: causes that they work like non-virtual messages in
      C++ mode.
      If you do not use the same method body in different classes
      then you can also use explicitly self casting:
         ::<myclass>:<msgname>[(...)]
      and it will be a little bit faster

  * harbour/include/hboo.ch
    + added: HB_OO_MSG_ASSIGN, HB_OO_MSG_ACCESS,
             HB_OO_MSG_CLSASSIGN, HB_OO_MSG_CLSACCESS
      They should be used insted of HB_OO_MSG_DATA and HB_OO_MSG_CLSDATA
      This resolves problems with name conflicts when we were detecting
      type of message (ACCESS/ASSIGN) by checking the first character
      in message name. F.e. now it's possible to create exported instance
      variable called __WithObject and it will be used in all WITH OBJECT
      statement instead of the base object value. It's simple and effective
      WITH OBJECT overloading.
      I kept backward compatibility for HB_OO_MSG_DATA and HB_OO_MSG_CLSDATA
      but I strongly suggest to update code to use new constants.
    + added HB_OO_MSG_REALCLASS

  * harbour/source/rtl/objfunc.prg
  * harbour/source/rtl/tobject.prg
  * harbour/source/rtl/tclass.prg
    * use HB_OO_MSG_[CLS]{ASSIGN,ACCESS} instead of HB_OO_MSG_[CLS]DATA

  * harbour/source/rtl/tclass.prg
    + added REALCLASS message to creted classes - it's used for @: operator

  * harbour/source/vm/classes.c
    * updated for above modifications
    * calculate instance area offset in supercasting dynamically - it
      will allow to eliminate multiple instance area allocating when
      in the inheritance tree the same class exists more then once and
      also quite easy add support for non-virtual messages.
    ! fixed GPF in __CLSINSTSUPER() class function generate HVM exception
    % do not inherit unaccessible inline blocks
    * some other minor optimization, fixes and code cleanups

  * harbour/source/rdd/usrrdd/usrrdd.c
    ! fixed HB_TRACE message

  * harbour/source/rtl/errorapi.c
    ! generate internal error if ErrorNew() function does not return an object
2006-09-10 11:16:43 +00:00
Viktor Szakats
076082265a 2006-09-05 15:51 UTC+0100 Viktor Szakats (viktor.szakats syenar.hu)
* harbour/include/hbset.h
   * harbour/include/set.ch
   * harbour/source/pp/pptable.c
   * harbour/source/rtl/set.c
     + Added Set( _SET_DEFEXTENSIONS, <logical: .T./.F.> )
       Default value is .T. (CA-Cl*pper compatible). If set to .F.,
       Harbour runtime/RDD code will never attempt to add a
       default extension to the filename arguments. Commands/functions
       where this setting makes a difference are:
       - SET ALTERNATE TO / Set( _SET_ALTFILE_, ... )
       - SET PRINTER TO / Set( _SET_PRINTFILE_, ... )
       - Set( _SET_EXTRAFILE, ... )
       - SAVE TO / __mvSave()
       - RESTORE FROM / __mvRestore()
       - LABEL FORM
       - REPORT FORM
       - COPY TO ... DELIMITED
       - COPY TO ... SDF
       - LIST / __dbList()
       - USE / dbUseArea()
       - dbCreate()
       - SET INDEX TO / ordListAdd() (not yet implemented)
       - __HRBLOAD(), __HRBRUN()
     ; Notes:
       - From now on, it possible to create/load files using the
         above functions/commands which have no extension. This
         might be desirable in a few platform and/or situations.
         For example on Win32, it's possible to directly print
         to a shared Windows printer queue, using these commands:
             lOldValue := Set( _SET_DEFEXTENSIONS, .F. )
             SET PRINTER TO \\myserver\myprinter
             Set( _SET_DEFEXTENSIONS, lOldValue )
         Or, it is possible to open a dbf file which has no extension:
             dbUseArea(.T., NIL, "dbf_filename_with_no_extension", "w_DATA", .F., .F.)
       - Compiler is (of course) not affected by this setting.
       - Preprocessor (PP) lib flavour is not affected by this setting.
       - Support is not full in the RDD code yet.

   * harbour/source/rdd/dbf1.c
   * harbour/source/rdd/dblist.prg
   * harbour/source/rdd/delim1.c
   * harbour/source/rdd/sdf1.c
   * harbour/source/rtl/tlabel.prg
   * harbour/source/rtl/treport.prg
   * harbour/source/rtl/set.c
   * harbour/source/vm/memvars.c
   * harbour/source/vm/runner.c
     + Honoring _SET_DEFEXTENSIONS setting all over the code.
2006-09-08 12:47:27 +00:00