Skip to content

Commit

Permalink
bitmap object did not generate code for height property correctly
Browse files Browse the repository at this point in the history
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
  • Loading branch information
dmcoles committed Jan 9, 2024
1 parent 2cd686d commit ee8c350
Show file tree
Hide file tree
Showing 8 changed files with 113 additions and 68 deletions.
2 changes: 1 addition & 1 deletion bitmapObject.e
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
76 changes: 53 additions & 23 deletions cSourceGen.e
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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('')
Expand Down Expand Up @@ -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

Expand Down
75 changes: 43 additions & 32 deletions eSourceGen.e
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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('')
Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion examples/find dialog.reb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ VIEWTMP=-1
ADDSETT=-1
LANGID=0
USEIDS=-1
FULLCODE=-
FULLCODE=-1
CODEFOLDER
#
TYPE: 2
Expand Down
2 changes: 1 addition & 1 deletion examples/log in.reb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ VIEWTMP=-1
ADDSETT=0
LANGID=0
USEIDS=-1
FULLCODE=0
FULLCODE=-1
CODEFOLDER=
#
TYPE: 2
Expand Down
6 changes: 6 additions & 0 deletions reactionObject.e
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
16 changes: 7 additions & 9 deletions rebuild.e
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand All @@ -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)
Expand Down Expand Up @@ -2729,7 +2728,6 @@ PROC main() HANDLE
AstrCopy(systemOptions.savePath,'')

loadIconPrefs()

createForm()
Sets(mainWindow,WINDOW_HINTINFO,hintInfo)
Sets(mainWindow,WINDOW_GADGETHELP, TRUE)
Expand Down
2 changes: 1 addition & 1 deletion sourceGen.e
Original file line number Diff line number Diff line change
Expand Up @@ -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:=''
Expand Down

0 comments on commit ee8c350

Please sign in to comment.