Automatic seq# generation for new DATA

This commit is contained in:
Eddie Runia
1999-05-12 22:49:17 +00:00
parent 547dcd5b03
commit faeda9b48a
2 changed files with 30 additions and 5 deletions

View File

@@ -1,5 +1,5 @@
--- \source\tcpp\cvstest\harbour\source\rtl\classes.c Tue May 11 20:23:38 1999
+++ \source\tcpp\harb21-2\source\rtl\classes.c Wed May 12 22:40:40 1999
+++ \source\tcpp\harb21-2\source\rtl\classes.c Wed May 12 23:21:24 1999
@@ -136,12 +136,22 @@
static HARBOUR GetData( void )
@@ -25,3 +25,16 @@
}
static HARBOUR GetClassData( void )
@@ -505,4 +515,12 @@
}
}
+HARBOUR __WDATAINC() /* <nSeq> = __wDataInc( <hClass> )*/
+{
+ WORD wClass = _parnl( 1 );
+
+ if( wClass )
+ _retni( ++pClasses[ wClass - 1 ].wDatas ); /* Return and increase */
+} /* number of DATAs */
+

View File

@@ -19,6 +19,7 @@
function Main()
local oForm := TForm():New()
local nSeq
QOut( "What methods are in the class :" )
HBDebug( aoMethod( oForm ) )
@@ -46,15 +47,23 @@ function Main()
QOut( "Smile please " )
oForm:Smile()
/* The next code can _not_ be used in the offical classes.c */
QOut( "The next code can _not_ be used in the offical classes.c" )
Pause()
QOut( "Data items before" )
HBDebug( oForm )
QOut( "Let's add an additional data item" )
ClassAdd( oForm:ClassH, "cHelp" , 6, MET_DATA ) // 6th item !
ClassAdd( oForm:ClassH, "_cHelp", 6, MET_DATA )
HBDebug( aoData( oForm ) )
nSeq := __wDataInc( oForm:ClassH ) // Allocate new Seq#
QOut( "New Seq# ", nSeq )
ClassAdd( oForm:ClassH, "cHelp" , nSeq, MET_DATA )
ClassAdd( oForm:ClassH, "_cHelp", nSeq, MET_DATA )
oForm:cHelp := "This is a real tricky test"
QOut( "Data items after" )
HBDebug( oForm )
return nil
@@ -106,4 +115,7 @@ static function Smile()
return self
function Pause()
__Accept( "Pause :" )
return nil