From e5bfb628be53cd24395e218c4843b1f4f42abb20 Mon Sep 17 00:00:00 2001 From: marpon Date: Thu, 13 Sep 2018 10:02:51 +0200 Subject: [PATCH 01/11] Update symb-define.bas added __FB_GUI__ --- src/compiler/symb-define.bas | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/compiler/symb-define.bas b/src/compiler/symb-define.bas index 48119b5697..181e70072e 100644 --- a/src/compiler/symb-define.bas +++ b/src/compiler/symb-define.bas @@ -85,7 +85,11 @@ end function private function hDefOptGosub_cb ( ) as string function = str( env.opt.gosub = TRUE ) end function - + +private function hDefViewGui_cb ( ) as string '***** console/gui + function = str( env.clopt.modeview = FB_MODEVIEW_ISGUI ) +end function + private function hDefOutExe_cb ( ) as string function = str( env.clopt.outtype = FB_OUTTYPE_EXECUTABLE ) end function @@ -209,6 +213,7 @@ dim shared defTb(0 to ...) as SYMBDEF => _ (@"__FB_FPU__" , NULL , FB_DEFINE_FLAGS_STR, @hDefFpu_cb ), _ (@"__FB_FPMODE__" , NULL , FB_DEFINE_FLAGS_STR, @hDefFpmode_cb ), _ (@"__FB_GCC__" , NULL , 0 , @hDefGcc_cb ) _ + (@"__FB_GUI__" , NULL , 0 , @hDefViewGui_cb ) _ '***** console/gui } sub symbDefineInit _ From 95eac7e362637e602665fe3a4eb6ba0483c51b97 Mon Sep 17 00:00:00 2001 From: marpon Date: Thu, 13 Sep 2018 10:10:58 +0200 Subject: [PATCH 02/11] Update fbc.bas __FB_GUI__ --- src/compiler/fbc.bas | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/compiler/fbc.bas b/src/compiler/fbc.bas index 5fe5717aec..b19a1de395 100644 --- a/src/compiler/fbc.bas +++ b/src/compiler/fbc.bas @@ -1755,6 +1755,9 @@ private sub handleOpt(byval optid as integer, byref arg as string) case OPT_S fbc.subsystem = arg + select case( arg ) '***** console/gui + case "gui" : fbSetOption( FB_COMPOPT_MODEVIEW, FB_MODEVIEW_ISGUI ) '***** console/gui + end select case OPT_SHOWINCLUDES fbSetOption( FB_COMPOPT_SHOWINCLUDES, TRUE ) From 36f4c82ef33ece81980870b38845250e2c4ef322 Mon Sep 17 00:00:00 2001 From: marpon Date: Thu, 13 Sep 2018 10:21:26 +0200 Subject: [PATCH 03/11] Update fb.bi __FB_GUI__ --- src/compiler/fb.bi | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/compiler/fb.bi b/src/compiler/fb.bi index 37706cac45..50d4ee699f 100644 --- a/src/compiler/fb.bi +++ b/src/compiler/fb.bi @@ -92,10 +92,16 @@ enum FB_COMPOPT FB_COMPOPT_STACKSIZE '' integer FB_COMPOPT_OBJINFO '' boolean: write/read .fbctinf sections etc.? FB_COMPOPT_SHOWINCLUDES '' boolean: -showincludes - + FB_COMPOPT_MODEVIEW '' new for console gui '***** console/gui + FB_COMPOPTIONS end enum +enum FB_MODEVIEW '***** console/gui + FB_MODEVIEW_ISCONSOLE = 0 '***** console/gui + FB_MODEVIEW_ISGUI '***** console/gui +end enum '***** console/gui + '' pedantic checks enum FB_PDCHECK FB_PDCHECK_NONE = &h00000000 @@ -265,6 +271,7 @@ type FBCMMLINEOPT stacksize as integer objinfo as integer showincludes as integer + modeview as FB_MODEVIEW end type '' features allowed in the selected language From c27f435462d0d8f80dbdb78113b4a650d70c7c4d Mon Sep 17 00:00:00 2001 From: marpon Date: Thu, 13 Sep 2018 10:39:22 +0200 Subject: [PATCH 04/11] Update fb.bas __FB_GUI__ --- src/compiler/fb.bas | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/compiler/fb.bas b/src/compiler/fb.bas index fc23276d57..7c47aa277d 100644 --- a/src/compiler/fb.bas +++ b/src/compiler/fb.bas @@ -480,7 +480,8 @@ sub fbGlobalInit() env.clopt.stacksize = FB_DEFSTACKSIZE env.clopt.objinfo = TRUE env.clopt.showincludes = FALSE - + env.clopt.modeview = FB_DEFAULT_MODEVIEW + hUpdateLangOptions( ) hUpdateTargetOptions( ) end sub @@ -571,6 +572,8 @@ sub fbSetOption( byval opt as integer, byval value as integer ) env.clopt.objinfo = value case FB_COMPOPT_SHOWINCLUDES env.clopt.showincludes = value + case FB_COMPOPT_MODEVIEW '***** console/gui + env.clopt.modeview = value '***** console/gui end select end sub @@ -643,7 +646,9 @@ function fbGetOption( byval opt as integer ) as integer function = env.clopt.objinfo case FB_COMPOPT_SHOWINCLUDES function = env.clopt.showincludes - + case FB_COMPOPT_MODEVIEW '***** console/gui + function = env.clopt.modeview '***** console/gui + case else function = 0 end select From 613eff71450b88fa375b82a99c71865ac0cf169d Mon Sep 17 00:00:00 2001 From: marpon Date: Thu, 13 Sep 2018 10:43:46 +0200 Subject: [PATCH 05/11] __FB_GUI__ --- src/compiler/fb.bi | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/compiler/fb.bi b/src/compiler/fb.bi index 50d4ee699f..d4ccee11bb 100644 --- a/src/compiler/fb.bi +++ b/src/compiler/fb.bi @@ -102,6 +102,8 @@ enum FB_MODEVIEW '***** console/gui FB_MODEVIEW_ISGUI '***** console/gui end enum '***** console/gui +const FB_DEFAULT_MODEVIEW = FB_MODEVIEW_ISCONSOLE '***** console/gui + '' pedantic checks enum FB_PDCHECK FB_PDCHECK_NONE = &h00000000 From 870a99b6c4a5c8a8d476ede1ea3c0943a5f7db8e Mon Sep 17 00:00:00 2001 From: marpon Date: Thu, 13 Sep 2018 10:48:39 +0200 Subject: [PATCH 06/11] added __FB_GUI__ --- src/compiler/fb.bas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/fb.bas b/src/compiler/fb.bas index 7c47aa277d..ec0b8b0cd4 100644 --- a/src/compiler/fb.bas +++ b/src/compiler/fb.bas @@ -480,7 +480,7 @@ sub fbGlobalInit() env.clopt.stacksize = FB_DEFSTACKSIZE env.clopt.objinfo = TRUE env.clopt.showincludes = FALSE - env.clopt.modeview = FB_DEFAULT_MODEVIEW + env.clopt.modeview = FB_DEFAULT_MODEVIEW '***** console/gui hUpdateLangOptions( ) hUpdateTargetOptions( ) From 8b3fce0fd15db60cba96a014c6b3aeb9dfadf769 Mon Sep 17 00:00:00 2001 From: marpon Date: Thu, 13 Sep 2018 10:50:40 +0200 Subject: [PATCH 07/11] added __FB_GUI__ --- src/compiler/symb-define.bas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/symb-define.bas b/src/compiler/symb-define.bas index 181e70072e..aba42195b9 100644 --- a/src/compiler/symb-define.bas +++ b/src/compiler/symb-define.bas @@ -213,7 +213,7 @@ dim shared defTb(0 to ...) as SYMBDEF => _ (@"__FB_FPU__" , NULL , FB_DEFINE_FLAGS_STR, @hDefFpu_cb ), _ (@"__FB_FPMODE__" , NULL , FB_DEFINE_FLAGS_STR, @hDefFpmode_cb ), _ (@"__FB_GCC__" , NULL , 0 , @hDefGcc_cb ) _ - (@"__FB_GUI__" , NULL , 0 , @hDefViewGui_cb ) _ '***** console/gui + (@"__FB_GUI__" , NULL , 0 , @hDefViewGui_cb ) _ '***** console/gui } sub symbDefineInit _ From 41d9d5432909307d88c2f46c17fdda3ca9a86e26 Mon Sep 17 00:00:00 2001 From: marpon Date: Thu, 13 Sep 2018 10:52:35 +0200 Subject: [PATCH 08/11] added __FB_GUI__ --- src/compiler/fb.bi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/fb.bi b/src/compiler/fb.bi index d4ccee11bb..5b7a9b3531 100644 --- a/src/compiler/fb.bi +++ b/src/compiler/fb.bi @@ -92,7 +92,7 @@ enum FB_COMPOPT FB_COMPOPT_STACKSIZE '' integer FB_COMPOPT_OBJINFO '' boolean: write/read .fbctinf sections etc.? FB_COMPOPT_SHOWINCLUDES '' boolean: -showincludes - FB_COMPOPT_MODEVIEW '' new for console gui '***** console/gui + FB_COMPOPT_MODEVIEW '' new for console gui '***** console/gui FB_COMPOPTIONS end enum From 0d8d06766206365ea36e8eed0452830bdb7bbb7e Mon Sep 17 00:00:00 2001 From: marpon Date: Thu, 13 Sep 2018 10:59:11 +0200 Subject: [PATCH 09/11] added __FB_GUI__ --- src/compiler/fbc.bas | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/compiler/fbc.bas b/src/compiler/fbc.bas index b19a1de395..8bbb29bd0b 100644 --- a/src/compiler/fbc.bas +++ b/src/compiler/fbc.bas @@ -1755,8 +1755,8 @@ private sub handleOpt(byval optid as integer, byref arg as string) case OPT_S fbc.subsystem = arg - select case( arg ) '***** console/gui - case "gui" : fbSetOption( FB_COMPOPT_MODEVIEW, FB_MODEVIEW_ISGUI ) '***** console/gui + select case( arg ) '***** console/gui + case "gui" : fbSetOption( FB_COMPOPT_MODEVIEW, FB_MODEVIEW_ISGUI ) '***** console/gui end select case OPT_SHOWINCLUDES From 6ce4a74d90cf13330fef13114d839990548ea349 Mon Sep 17 00:00:00 2001 From: marpon Date: Thu, 13 Sep 2018 11:19:14 +0200 Subject: [PATCH 10/11] added __FB_GUI__ --- src/compiler/symb-define.bas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/symb-define.bas b/src/compiler/symb-define.bas index aba42195b9..bb5966727b 100644 --- a/src/compiler/symb-define.bas +++ b/src/compiler/symb-define.bas @@ -212,7 +212,7 @@ dim shared defTb(0 to ...) as SYMBDEF => _ (@"__FB_BACKEND__" , NULL , FB_DEFINE_FLAGS_STR, @hDefBackend_cb ), _ (@"__FB_FPU__" , NULL , FB_DEFINE_FLAGS_STR, @hDefFpu_cb ), _ (@"__FB_FPMODE__" , NULL , FB_DEFINE_FLAGS_STR, @hDefFpmode_cb ), _ - (@"__FB_GCC__" , NULL , 0 , @hDefGcc_cb ) _ + (@"__FB_GCC__" , NULL , 0 , @hDefGcc_cb ), _ (@"__FB_GUI__" , NULL , 0 , @hDefViewGui_cb ) _ '***** console/gui } From 85d80fe4413c1f12c85ff8fc91b909d64a4dfcfd Mon Sep 17 00:00:00 2001 From: marpon Date: Fri, 14 Sep 2018 11:32:17 +0200 Subject: [PATCH 11/11] __FB_GUI__ Cleaned My last cleaned version hope it works now only 1 define as console is default mode, compiled ok with 32 and 64 tested with #if FB_GUI #include "windows.bi" messagebox(0, "Gui mode", "info",0) #else print "Console mode" print : print "Any key to close" sleep #endif --- src/compiler/fb.bas | 14 +++++++------- src/compiler/fb.bi | 16 ++++++++-------- src/compiler/fbc.bas | 10 +++++----- src/compiler/symb-define.bas | 10 +++++----- 4 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/compiler/fb.bas b/src/compiler/fb.bas index ec0b8b0cd4..6f527b013f 100644 --- a/src/compiler/fb.bas +++ b/src/compiler/fb.bas @@ -480,8 +480,8 @@ sub fbGlobalInit() env.clopt.stacksize = FB_DEFSTACKSIZE env.clopt.objinfo = TRUE env.clopt.showincludes = FALSE - env.clopt.modeview = FB_DEFAULT_MODEVIEW '***** console/gui - + env.clopt.modeview = FB_DEFAULT_MODEVIEW + hUpdateLangOptions( ) hUpdateTargetOptions( ) end sub @@ -572,8 +572,8 @@ sub fbSetOption( byval opt as integer, byval value as integer ) env.clopt.objinfo = value case FB_COMPOPT_SHOWINCLUDES env.clopt.showincludes = value - case FB_COMPOPT_MODEVIEW '***** console/gui - env.clopt.modeview = value '***** console/gui + case FB_COMPOPT_MODEVIEW + env.clopt.modeview = value end select end sub @@ -646,9 +646,9 @@ function fbGetOption( byval opt as integer ) as integer function = env.clopt.objinfo case FB_COMPOPT_SHOWINCLUDES function = env.clopt.showincludes - case FB_COMPOPT_MODEVIEW '***** console/gui - function = env.clopt.modeview '***** console/gui - + case FB_COMPOPT_MODEVIEW + function = env.clopt.modeview + case else function = 0 end select diff --git a/src/compiler/fb.bi b/src/compiler/fb.bi index 5b7a9b3531..b3181462d0 100644 --- a/src/compiler/fb.bi +++ b/src/compiler/fb.bi @@ -92,17 +92,17 @@ enum FB_COMPOPT FB_COMPOPT_STACKSIZE '' integer FB_COMPOPT_OBJINFO '' boolean: write/read .fbctinf sections etc.? FB_COMPOPT_SHOWINCLUDES '' boolean: -showincludes - FB_COMPOPT_MODEVIEW '' new for console gui '***** console/gui - + FB_COMPOPT_MODEVIEW ''__FB_GUI__ + FB_COMPOPTIONS end enum -enum FB_MODEVIEW '***** console/gui - FB_MODEVIEW_ISCONSOLE = 0 '***** console/gui - FB_MODEVIEW_ISGUI '***** console/gui -end enum '***** console/gui +enum FB_MODEVIEW + FB_MODEVIEW_CONSOLE = 0 + FB_MODEVIEW_GUI +end enum -const FB_DEFAULT_MODEVIEW = FB_MODEVIEW_ISCONSOLE '***** console/gui +const FB_DEFAULT_MODEVIEW = FB_MODEVIEW_CONSOLE '' pedantic checks enum FB_PDCHECK @@ -273,7 +273,7 @@ type FBCMMLINEOPT stacksize as integer objinfo as integer showincludes as integer - modeview as FB_MODEVIEW + modeview as FB_MODEVIEW end type '' features allowed in the selected language diff --git a/src/compiler/fbc.bas b/src/compiler/fbc.bas index 8bbb29bd0b..87657a7d5e 100644 --- a/src/compiler/fbc.bas +++ b/src/compiler/fbc.bas @@ -924,7 +924,7 @@ private function hLinkFiles( ) as integer ldcline += hFindLib( "crtend.o" ) end select - + if( fbGetOption( FB_COMPOPT_TARGET ) = FB_COMPTARGET_DARWIN ) then ldcline += " -macosx_version_min 10.6" end if @@ -1755,9 +1755,9 @@ private sub handleOpt(byval optid as integer, byref arg as string) case OPT_S fbc.subsystem = arg - select case( arg ) '***** console/gui - case "gui" : fbSetOption( FB_COMPOPT_MODEVIEW, FB_MODEVIEW_ISGUI ) '***** console/gui - end select + select case( arg ) + case "gui" : fbSetOption( FB_COMPOPT_MODEVIEW, FB_MODEVIEW_GUI ) + end select case OPT_SHOWINCLUDES fbSetOption( FB_COMPOPT_SHOWINCLUDES, TRUE ) @@ -3206,7 +3206,7 @@ private sub hAddDefaultLibs( ) defined(__FB_NETBSD__) fbcAddDefLibPath( "/usr/X11R6/lib" ) #endif - + #if defined(__FB_DARWIN__) and defined(ENABLE_XQUARTZ) fbcAddDefLibPAth( "/opt/X11/lib" ) #endif diff --git a/src/compiler/symb-define.bas b/src/compiler/symb-define.bas index bb5966727b..e63286fec6 100644 --- a/src/compiler/symb-define.bas +++ b/src/compiler/symb-define.bas @@ -85,11 +85,11 @@ end function private function hDefOptGosub_cb ( ) as string function = str( env.opt.gosub = TRUE ) end function - -private function hDefViewGui_cb ( ) as string '***** console/gui - function = str( env.clopt.modeview = FB_MODEVIEW_ISGUI ) + +private function hDefGui_cb ( ) as string + function = str( env.clopt.modeview = FB_MODEVIEW_GUI ) end function - + private function hDefOutExe_cb ( ) as string function = str( env.clopt.outtype = FB_OUTTYPE_EXECUTABLE ) end function @@ -213,7 +213,7 @@ dim shared defTb(0 to ...) as SYMBDEF => _ (@"__FB_FPU__" , NULL , FB_DEFINE_FLAGS_STR, @hDefFpu_cb ), _ (@"__FB_FPMODE__" , NULL , FB_DEFINE_FLAGS_STR, @hDefFpmode_cb ), _ (@"__FB_GCC__" , NULL , 0 , @hDefGcc_cb ), _ - (@"__FB_GUI__" , NULL , 0 , @hDefViewGui_cb ) _ '***** console/gui + (@"__FB_GUI__" , NULL , 0 , @hDefGui_cb ) _ } sub symbDefineInit _