Examples for use:
You have a project in which you use some code from others. For example an ImageList:
Code: Select all
FileGlobal CurWidth.l
FileGlobal CurHeight.l
FileGlobal NewList Images.l()
Procedure IL_Add(id)
AddElement(Images())
Images()=id
CurWidth=ImageWidth(id)
CurHeight=ImageHeight(id)
EndProcedure
Procedure IL_Create(width,height)
AddElement(Images())
Images()=CreateImage(#PB_Any,width,height)
Curwidth=Width
CurHeight=Height
Procedure IL_GetHeight()
ProcedureReturn CurHeight
EndProcedure
Procedure IL_GetWidth()
ProcedureReturn CurWidth
EndProcedure
The Idea is, that variables defined with "FileGlobal" are known like Global variables but only in the file, they're defined in.
Why should that be usefull?
1.)To beware coders of creating bugs by unwanted changing of values, that are importend for the procedures in the Includefile.
It´s often to be seen, that programmers of Includefiles write something like "Global ID.l". But ID is , ah, let´s say not such a special name that you can be sure, that you'll never use it anywhere else.
2.)You don´t have to think about your own prefixes for variables, when creating an Includefile and you don´t have to change any variable in any IncludeFile, you use.
So, I hope, you understood anything of my "school-is-already-gone-for-2-years"-english.
Just feel free to discuss about it.
