From ee8c350aae8bcdede0cb9b5b856400e2dd1356d4 Mon Sep 17 00:00:00 2001 From: dmcoles Date: Tue, 9 Jan 2024 10:45:27 +0000 Subject: [PATCH] bitmap object did not generate code for height property correctly add enums for ids as well as indexes in generated code use enums for ids and indexes in the in generated code object definitions enable full code setting in example files --- bitmapObject.e | 2 +- cSourceGen.e | 76 ++++++++++++++++++++++++++++------------ eSourceGen.e | 75 ++++++++++++++++++++++----------------- examples/find dialog.reb | 2 +- examples/log in.reb | 2 +- reactionObject.e | 6 ++++ rebuild.e | 16 ++++----- sourceGen.e | 2 +- 8 files changed, 113 insertions(+), 68 deletions(-) diff --git a/bitmapObject.e b/bitmapObject.e index cc45863..c173979 100644 --- a/bitmapObject.e +++ b/bitmapObject.e @@ -292,7 +292,7 @@ EXPORT PROC genCodeProperties(srcGen:PTR TO srcGen) OF bitmapObject srcGen.componentPropertyInt('IA_Left',self.leftEdge) srcGen.componentPropertyInt('IA_Top',self.topEdge) srcGen.componentPropertyInt('IA_Width',self.width) - srcGen.componentPropertyInt('IA_Height',self.topEdge) + srcGen.componentPropertyInt('IA_Height',self.height) srcGen.componentProperty('BITMAP_Screen','gScreen',FALSE) srcGen.componentProperty('BITMAP_SourceFile',self.sourceFile,TRUE) diff --git a/cSourceGen.e b/cSourceGen.e index 4bd9e99..e38ee67 100644 --- a/cSourceGen.e +++ b/cSourceGen.e @@ -20,13 +20,55 @@ PROC create(fser:PTR TO fileStreamer, libsused:PTR TO CHAR,definitionOnly,useIds self.indent:=0 ENDPROC +PROC createEnum(windowName:PTR TO CHAR, listObjects:PTR TO stdlist, ids) OF cSrcGen + DEF n=0, j + DEF listObject:PTR TO reactionObject + DEF tempStr[255]:STRING + + self.write('enum ') + IF ids + StringF(tempStr,'\s_id { ',windowName) + ELSE + StringF(tempStr,'\s_idx { ',windowName) + ENDIF + LowerStr(tempStr) + self.write(tempStr) + n:=0 + FOR j:=0 TO listObjects.count()-1 + IF j>0 + self.write(', ') + n:=n+2 + ENDIF + + IF n>60 + self.writeLine('') + self.write(' ') + n:=0 + ENDIF + listObject:=listObjects.item(j) + listObject.gadindex:=j + StrCopy(tempStr,listObject.ident) + LowerStr(tempStr) + self.write(tempStr) + n:=n+StrLen(tempStr) + + IF ids + StringF(tempStr,'_id = \d',listObject.id) + self.write(tempStr) + n:=n+StrLen(tempStr) + ENDIF + ENDFOR + + self.writeLine(' };') +ENDPROC + PROC genHeader(screenObject:PTR TO screenObject,rexxObject:PTR TO rexxObject, windowNames:PTR TO stringlist, windowLayouts:PTR TO stdlist, sharedPort) OF cSrcGen DEF tempStr[200]:STRING DEF menuItem:PTR TO menuItem DEF itemName[200]:STRING DEF commKey[10]:STRING DEF itemType - DEF hasarexx,i,j + DEF hasarexx,i,j,n DEF layoutObject:PTR TO reactionObject DEF listObjects:PTR TO stdlist DEF listObject:PTR TO reactionObject @@ -492,28 +534,13 @@ PROC genHeader(screenObject:PTR TO screenObject,rexxObject:PTR TO rexxObject, wi NEW listObjects.stdlist(20) self.writeLine('') FOR i:=0 TO windowNames.count()-1 - self.write('enum ') - StringF(tempStr,'\s_idx { ',windowNames.item(i)) - LowerStr(tempStr) - self.write(tempStr) layoutObject:=windowLayouts.item(i) listObjects.clear() layoutObject.findObjectsByType(listObjects,-1) - FOR j:=0 TO listObjects.count()-1 - IF j>0 THEN self.write(', ') - StrCopy(tempStr,windowNames.item(i)) - StrAdd(tempStr,'_') - listObject:=listObjects.item(j) - listObject.gadindex:=j - StrAdd(tempStr,listObject.getTypeName()) - LowerStr(tempStr) - StrAdd(tempStr,'_') - self.write(tempStr) - StringF(tempStr,'\d',listObject.id) - self.write(tempStr) - ENDFOR - - self.writeLine(' };') + StringF(tempStr,'//\s',windowNames.item(i)) + self.writeLine(tempStr) + self.createEnum(windowNames.item(i),listObjects,FALSE) + IF self.useIds THEN self.createEnum(windowNames.item(i),listObjects,TRUE) ENDFOR END listObjects self.writeLine('') @@ -1183,16 +1210,19 @@ PROC assignWindowVar() OF cSrcGen self.write('window_object = ') ENDPROC -PROC assignGadgetVar(index) OF cSrcGen +PROC assignGadgetVar(ident,index) OF cSrcGen DEF tempStr[100]:STRING - StringF(tempStr,'main_gadgets[\d] = ',index) + StrCopy(tempStr,ident) + LowerStr(tempStr) + StringF(tempStr,'main_gadgets[\s] = ',tempStr) self.write(tempStr) self.currentGadgetVar:=index ENDPROC PROC componentPropertyGadgetId(idval) OF cSrcGen DEF tempStr[100]:STRING - StringF(tempStr,'\d',idval) + StrCopy(tempStr,idval) + LowerStr(tempStr) self.componentProperty('GA_ID',tempStr,FALSE) ENDPROC diff --git a/eSourceGen.e b/eSourceGen.e index 780cacf..d87b308 100644 --- a/eSourceGen.e +++ b/eSourceGen.e @@ -21,12 +21,43 @@ PROC create(fser:PTR TO fileStreamer,libsused,definitionOnly,useIds) OF eSrcGen self.terminator:=0 ENDPROC +PROC createEnum(windowName:PTR TO CHAR, listObjects:PTR TO stdlist, ids) OF eSrcGen + DEF n=0, j + DEF listObject:PTR TO reactionObject + DEF tempStr[255]:STRING + + self.write('ENUM ') + FOR j:=0 TO listObjects.count()-1 + IF j>0 + self.write(', ') + n:=n+2 + ENDIF + + IF n>60 + self.writeLine('') + self.write(' ') + n:=0 + ENDIF + listObject:=listObjects.item(j) + listObject.gadindex:=j + StrCopy(tempStr,listObject.ident) + UpperStr(tempStr) + self.write(tempStr) + n:=n+StrLen(tempStr) + IF ids + StringF(tempStr,'_ID = \d',listObject.id) + n:=n+StrLen(tempStr) + self.write(tempStr) + ENDIF + ENDFOR + self.writeLine('') +ENDPROC + PROC genHeader(screenObject:PTR TO screenObject,rexxObject:PTR TO rexxObject, windowNames:PTR TO stringlist, windowLayouts:PTR TO stdlist, sharedPort) OF eSrcGen DEF tempStr[200]:STRING - DEF hasarexx,i,j,n + DEF hasarexx,i DEF layoutObject:PTR TO reactionObject DEF listObjects:PTR TO stdlist - DEF listObject:PTR TO reactionObject hasarexx:=(rexxObject.commands.count()>0) AND (StrLen(rexxObject.hostName)>0) @@ -103,36 +134,13 @@ PROC genHeader(screenObject:PTR TO screenObject,rexxObject:PTR TO rexxObject, wi NEW listObjects.stdlist(20) self.writeLine('') FOR i:=0 TO windowNames.count()-1 - self.write('ENUM ') layoutObject:=windowLayouts.item(i) listObjects.clear() layoutObject.findObjectsByType(listObjects,-1) - n:=0 - FOR j:=0 TO listObjects.count()-1 - IF j>0 - self.write(', ') - n:=n+2 - ENDIF - - IF n>60 - self.writeLine('') - self.write(' ') - n:=0 - ENDIF - StrCopy(tempStr,windowNames.item(i)) - StrAdd(tempStr,'_') - listObject:=listObjects.item(j) - listObject.gadindex:=j - StrAdd(tempStr,listObject.getTypeName()) - UpperStr(tempStr) - StrAdd(tempStr,'_') - self.write(tempStr) - n:=n+StrLen(tempStr) - StringF(tempStr,'\d',listObject.id) - n:=n+StrLen(tempStr) - self.write(tempStr) - ENDFOR - self.writeLine('') + StringF(tempStr,'->\s',windowNames.item(i)) + self.writeLine(tempStr) + self.createEnum(windowNames.item(i),listObjects,FALSE) + IF self.useIds THEN self.createEnum(windowNames.item(i),listObjects,TRUE) ENDFOR END listObjects self.writeLine('') @@ -953,16 +961,19 @@ PROC genScreenFree(screenObject:PTR TO screenObject) OF eSrcGen ENDIF ENDPROC -PROC assignGadgetVar(index) OF eSrcGen +PROC assignGadgetVar(ident,index) OF eSrcGen DEF tempStr[100]:STRING - StringF(tempStr,'mainGadgets[\d]:=',index) + StrCopy(tempStr,ident) + UpperStr(tempStr) + StringF(tempStr,'mainGadgets[\s]:=',tempStr) self.write(tempStr) self.currentGadgetVar:=index ENDPROC PROC componentPropertyGadgetId(idval) OF eSrcGen DEF tempStr[100]:STRING - StringF(tempStr,'\d',idval) + StrCopy(tempStr,idval) + UpperStr(tempStr) self.componentProperty('GA_ID',tempStr, FALSE) ENDPROC diff --git a/examples/find dialog.reb b/examples/find dialog.reb index 70e9f61..03c4dc8 100644 --- a/examples/find dialog.reb +++ b/examples/find dialog.reb @@ -5,7 +5,7 @@ VIEWTMP=-1 ADDSETT=-1 LANGID=0 USEIDS=-1 -FULLCODE=- +FULLCODE=-1 CODEFOLDER # TYPE: 2 diff --git a/examples/log in.reb b/examples/log in.reb index 61327ae..32eff05 100644 --- a/examples/log in.reb +++ b/examples/log in.reb @@ -5,7 +5,7 @@ VIEWTMP=-1 ADDSETT=0 LANGID=0 USEIDS=-1 -FULLCODE=0 +FULLCODE=-1 CODEFOLDER= # TYPE: 2 diff --git a/reactionObject.e b/reactionObject.e index f6f3766..67647ec 100644 --- a/reactionObject.e +++ b/reactionObject.e @@ -52,6 +52,7 @@ EXPORT DEF errorState EXPORT DEF imageData:PTR TO CHAR EXPORT OBJECT reactionObject + ident[80]:ARRAY OF CHAR name[80]:ARRAY OF CHAR parent:PTR TO reactionObject children:PTR TO stdlist @@ -358,6 +359,7 @@ EXPORT PROC create(parent) OF reactionObject objCount:=objCount+1 StringF(name,'\s_\d',self.getTypeName(),self.id) AstrCopy(self.name,name) + AstrCopy(self.ident,name) NEW stdlist.stdlist(20) self.children:=stdlist @@ -480,6 +482,8 @@ EXPORT PROC serialise(fser:PTR TO fileStreamer) OF reactionObject fser.writeLine(tempStr) StringF(tempStr,'NAME: \s',self.name) fser.writeLine(tempStr) + StringF(tempStr,'IDENT: \s',self.ident) + fser.writeLine(tempStr) StringF(tempStr,'MINWIDTH: \d',self.minWidth) fser.writeLine(tempStr) StringF(tempStr,'MINHEIGHT: \d',self.minHeight) @@ -578,6 +582,8 @@ PROC deserialise(fser:PTR TO fileStreamer) OF reactionObject ENDIF ELSEIF StrCmp('NAME: ',tempStr,STRLEN) AstrCopy(self.name,tempStr+STRLEN,80) + ELSEIF StrCmp('IDENT: ',tempStr,STRLEN) + AstrCopy(self.ident,tempStr+STRLEN,80) ELSEIF StrCmp('MINWIDTH: ',tempStr,STRLEN) self.minWidth:=Val(tempStr+STRLEN) ELSEIF StrCmp('MINHEIGHT: ',tempStr,STRLEN) diff --git a/rebuild.e b/rebuild.e index 53c1d5a..6135d33 100644 --- a/rebuild.e +++ b/rebuild.e @@ -1164,7 +1164,7 @@ PROC genComponentCode(comp:PTR TO reactionObject, srcGen:PTR TO srcGen) srcGen.componentAddChild(addTag) ENDIF - srcGen.assignGadgetVar(comp.gadindex) + srcGen.assignGadgetVar(comp.ident,comp.gadindex) IF (libtype:=comp.libTypeCreate()) srcGen.componentLibtypeCreate(libtype) ELSEIF (libname:=comp.libNameCreate()) @@ -1174,13 +1174,12 @@ PROC genComponentCode(comp:PTR TO reactionObject, srcGen:PTR TO srcGen) srcGen.componentCreate(tempStr) ENDIF - ->IF comp.type<>TYPE_LAYOUT - IF srcGen.useIds - srcGen.componentPropertyGadgetId(comp.id) - ELSE - srcGen.componentPropertyGadgetId(srcGen.currentGadgetVar) - ENDIF - ->ENDIF + IF srcGen.useIds + StringF(tempStr,'\s_id',comp.ident) + ELSE + StringF(tempStr,'\s',comp.ident) + ENDIF + srcGen.componentPropertyGadgetId(tempStr) comp.genCodeProperties(srcGen) IF comp.children.count()>0 comp.genChildObjectsHeader(srcGen) @@ -2729,7 +2728,6 @@ PROC main() HANDLE AstrCopy(systemOptions.savePath,'') loadIconPrefs() - createForm() Sets(mainWindow,WINDOW_HINTINFO,hintInfo) Sets(mainWindow,WINDOW_GADGETHELP, TRUE) diff --git a/sourceGen.e b/sourceGen.e index 300b0d3..dd0132b 100644 --- a/sourceGen.e +++ b/sourceGen.e @@ -205,7 +205,7 @@ PROC assignWindowVar() OF srcGen self.write(tempStr) ENDPROC -PROC assignGadgetVar(index) OF srcGen +PROC assignGadgetVar(ident,index) OF srcGen DEF tempStr[100]:STRING DEF padding IF self.extraPadding THEN padding:=' ' ELSE padding:=''