Re: StandBySystem
Posted: Fri Apr 29, 2022 8:49 am
Let's focus to the polymorphism. It is accurate anymore.
Code: Select all
args : quantity of procedures
1 : x
2 : x * y
3 : x * y * z
4 : x * y * z * t
etc...Code: Select all
Structure Window
pName.S[6]
*p[6]
EndStructure
Procedure windowOpen0(T.s, f = #PB_Window_Borderless)
w = DesktopUnscaled(DesktopWidth(0) )
h = DesktopUnscaled(DesktopHeight(0) )
ProcedureReturn OpenWindow(#PB_Any, 0, 0, w, h, T, f ! #PB_Window_ScreenCentered)
EndProcedure
Procedure windowOpen1(Id, T.s, f = #PB_Window_Borderless)
w = DesktopUnscaled(DesktopWidth(0) )
h = DesktopUnscaled(DesktopHeight(0) )
ProcedureReturn OpenWindow(Id, 0, 0, w, h, T, f ! #PB_Window_ScreenCentered)
EndProcedure
Procedure windowOpen2(w, h, T.s, f = #PB_Window_Borderless)
ProcedureReturn OpenWindow(PB_Any, 0, 0, w, h, T, f ! #PB_Window_ScreenCentered)
EndProcedure
Procedure windowOpen3(Id, w, h, T.s, f = #PB_Window_Borderless)
ProcedureReturn OpenWindow(Id, 0, 0, w, h, T, f ! #PB_Window_ScreenCentered)
EndProcedure
Procedure windowOpen4(x, y, w, h, T.s, f = #PB_Window_Borderless)
ProcedureReturn OpenWindow(#PB_Any, x, y, w, h, T, f)
EndProcedure
Procedure windowOpen5(Id, x, y, w, h, T.s, f = #PB_Window_Borderless)
ProcedureReturn OpenWindow(Id, x, y, w, h, T, f)
EndProcedure
Macro windowNew(index =)
Define *win#index.Window = AllocateStructure(Window)
With *win#index
\p[0] = @openWindow0()
\p[1] = @openWindow1()
\p[2] = @openWindow2()
\p[3] = @openWindow3()
\p[4] = @openWindow4()
\p[5] = @openWindow5()
EndWith
EndMacro
Code: Select all
myProc(0.001) ; "real"
myProc(23) ; "integer"
myProc("hello") ; "string"Code: Select all
x = 4.Code: Select all
x = 4.0 ; terminal detail to allow polymorphismCode: Select all
What does I read ? (direct datas)
- string -> search string argument
- number -> does a dot exist ?
* yes -> search a "double" argument
* no -> search a quad argument
Replace the "polymorphic" call
with the specific call.