Browse Source

compiler: set apptype using new SetAppType routine, add 'CONSOLE' define for console apptype.

git-svn-id: trunk@23603 -
paul 12 năm trước cách đây
mục cha
commit
2a3618fb6c
4 tập tin đã thay đổi với 32 bổ sung21 xóa
  1. 15 13
      compiler/options.pas
  2. 7 7
      compiler/scandir.pas
  3. 9 0
      compiler/scanner.pas
  4. 1 1
      compiler/systems/t_nds.pas

+ 15 - 13
compiler/options.pas

@@ -1717,9 +1717,9 @@ begin
                         if target_info.system in systems_all_windows then
                           begin
                             if UnsetBool(More, j, opt, false) then
-                              apptype:=app_cui
+                              SetApptype(app_cui)
                             else
-                              apptype:=app_native;
+                              SetApptype(app_native);
                           end
                         else
                           IllegalPara(opt);
@@ -1729,9 +1729,9 @@ begin
                         if target_info.system in systems_darwin then
                           begin
                             if UnsetBool(More, j, opt, false) then
-                              apptype:=app_cui
+                              SetApptype(app_cui)
                             else
-                              apptype:=app_bundle
+                              SetApptype(app_bundle)
                           end
                         else
                           IllegalPara(opt);
@@ -1766,9 +1766,9 @@ begin
                         if target_info.system in systems_all_windows+systems_os2+systems_macos then
                           begin
                             if UnsetBool(More, j, opt, false) then
-                              apptype:=app_gui
+                              SetApptype(app_gui)
                             else
-                              apptype:=app_cui;
+                              SetApptype(app_cui);
                           end
                         else
                           IllegalPara(opt);
@@ -1799,9 +1799,9 @@ begin
                         if target_info.system in systems_os2 then
                           begin
                             if UnsetBool(More, j, opt, false) then
-                              apptype:=app_cui
+                              SetApptype(app_cui)
                             else
-                              apptype:=app_fs;
+                              SetApptype(app_fs);
                           end
                         else
                           IllegalPara(opt);
@@ -1811,9 +1811,9 @@ begin
                         if target_info.system in systems_all_windows+systems_os2+systems_macos then
                           begin
                             if UnsetBool(More, j, opt, false) then
-                              apptype:=app_cui
+                              SetApptype(app_cui)
                             else
-                              apptype:=app_gui;
+                              SetApptype(app_gui);
                           end
                         else
                           IllegalPara(opt);
@@ -1899,9 +1899,9 @@ begin
                         if target_info.system in systems_macos then
                           begin
                             if UnsetBool(More, j, opt, false) then
-                              apptype:=app_cui
+                              SetApptype(app_cui)
                             else
-                              apptype:=app_tool;
+                              SetApptype(app_tool);
                           end
                         else
                           IllegalPara(opt);
@@ -2766,7 +2766,9 @@ begin
 
 { target is set here, for wince the default app type is gui }
   if target_info.system in systems_wince then
-    apptype:=app_gui;
+    SetApptype(app_gui)
+  else
+    SetApptype(apptype);
 
 { default defines }
   def_system_macro(target_info.shortname);

+ 7 - 7
compiler/scandir.pas

@@ -252,20 +252,20 @@ unit scandir;
                  current_scanner.skipspace;
                  hs:=current_scanner.readid;
                  if hs='GUI' then
-                   apptype:=app_gui
+                   SetApptype(app_gui)
                  else if hs='CONSOLE' then
-                   apptype:=app_cui
+                   SetApptype(app_cui)
                  else if (hs='NATIVE') and (target_info.system in systems_windows + systems_nativent) then
-                   apptype:=app_native
+                   SetApptype(app_native)
                  else if (hs='FS') and (target_info.system in [system_i386_os2,
                                                              system_i386_emx]) then
-                   apptype:=app_fs
+                   SetApptype(app_fs)
                  else if (hs='TOOL') and (target_info.system in [system_powerpc_macos]) then
-                   apptype:=app_tool
+                   SetApptype(app_tool)
                  else if (hs='ARM9') and (target_info.system in [system_arm_nds]) then
-                   apptype:=app_arm9
+                   SetApptype(app_arm9)
                  else if (hs='ARM7') and (target_info.system in [system_arm_nds]) then
-                   apptype:=app_arm7
+                   SetApptype(app_arm7)
                  else
                    Message1(scan_w_unsupported_app_type,hs);
               end;

+ 9 - 0
compiler/scanner.pas

@@ -261,6 +261,7 @@ interface
     { To be called when the language mode is finally determined }
     Function SetCompileMode(const s:string; changeInit: boolean):boolean;
     Function SetCompileModeSwitch(s:string; changeInit: boolean):boolean;
+    procedure SetAppType(NewAppType:tapptype);
 
 
 implementation
@@ -624,6 +625,14 @@ implementation
             end;
       end;
 
+    procedure SetAppType(NewAppType:tapptype);
+      begin
+        if apptype=app_cui then
+          undef_system_macro('CONSOLE');
+        apptype:=NewAppType;
+        if apptype=app_cui then
+          def_system_macro('CONSOLE');
+      end;
 {*****************************************************************************
                            Conditional Directives
 *****************************************************************************}

+ 1 - 1
compiler/systems/t_nds.pas

@@ -58,7 +58,7 @@ begin
   StaticLibFiles.doubles:=true;
   // set arm9 as default apptype
   if (apptype <> app_arm9) or (apptype <> app_arm7) then
-    apptype := app_arm9;
+    apptype:=app_arm9;
 end;