Procházet zdrojové kódy

* use apptype to indicate that the target is a DOS .COM file, instead of introducing a new field in tsettings (as suggested by Sven)

git-svn-id: trunk@25544 -
nickysn před 12 roky
rodič
revize
52a5ffc386

+ 0 - 2
compiler/globals.pas

@@ -156,7 +156,6 @@ interface
 
 {$if defined(i8086)}
          x86memorymodel  : tx86memorymodel;
-         msdostargetformat : tmsdostargetformat;
 {$endif defined(i8086)}
 
 {$if defined(ARM)}
@@ -488,7 +487,6 @@ interface
         disabledircache : false;
 {$if defined(i8086)}
         x86memorymodel : mm_small;
-        msdostargetformat : msdos_exe;
 {$endif defined(i8086)}
 {$if defined(ARM)}
         instructionset : is_arm;

+ 2 - 2
compiler/globtype.pas

@@ -400,7 +400,8 @@ interface
          app_tool,      { tool application, (MPW tool for MacOS, MacOS only) }
          app_arm7,      { for Nintendo DS target }
          app_arm9,      { for Nintendo DS target }
-         app_bundle     { dynamically loadable bundle, Darwin only }
+         app_bundle,    { dynamically loadable bundle, Darwin only }
+         app_com        { DOS .COM file }
        );
 
        { interface types }
@@ -682,7 +683,6 @@ interface
 
     type
       tx86memorymodel = (mm_tiny,mm_small,mm_medium,mm_compact,mm_large,mm_huge);
-      tmsdostargetformat = (msdos_exe, msdos_com);
 
   { hide Sysutils.ExecuteProcess in units using this one after SysUtils}
   const

+ 2 - 12
compiler/options.pas

@@ -1956,18 +1956,8 @@ begin
                         if (target_info.system in [system_i8086_msdos]) then
                           begin
                             case Upper(Copy(More,j+1,255)) of
-                              'EXE':
-                                begin
-                                  init_settings.msdostargetformat:=msdos_exe;
-                                  targetinfos[system_i8086_msdos]^.exeext:='.exe';
-                                  target_info.exeext:='.exe';
-                                end;
-                              'COM':
-                                begin
-                                  init_settings.msdostargetformat:=msdos_com;
-                                  targetinfos[system_i8086_msdos]^.exeext:='.com';
-                                  target_info.exeext:='.com';
-                                end;
+                              'EXE': SetAppType(app_cui);
+                              'COM': SetAppType(app_com);
                               else
                                 IllegalPara(opt);
                             end;

+ 17 - 2
compiler/scanner.pas

@@ -633,10 +633,25 @@ implementation
 
     procedure SetAppType(NewAppType:tapptype);
       begin
-        if apptype=app_cui then
+{$ifdef i8086}
+        if (target_info.system=system_i8086_msdos) and (apptype<>NewAppType) then
+          begin
+            if NewAppType=app_com then
+              begin
+                targetinfos[system_i8086_msdos]^.exeext:='.com';
+                target_info.exeext:='.com';
+              end
+            else
+              begin
+                targetinfos[system_i8086_msdos]^.exeext:='.exe';
+                target_info.exeext:='.exe';
+              end;
+          end;
+{$endif i8086}
+        if apptype in [app_cui,app_com] then
           undef_system_macro('CONSOLE');
         apptype:=NewAppType;
-        if apptype=app_cui then
+        if apptype in [app_cui,app_com] then
           def_system_macro('CONSOLE');
       end;
 {*****************************************************************************

+ 4 - 6
compiler/systems/t_msdos.pas

@@ -268,12 +268,10 @@ begin
     if s<>'' then
       LinkRes.Add('library '+MaybeQuoted(s));
   end;
-  case current_settings.msdostargetformat of
-    msdos_exe: LinkRes.Add('format dos');
-    msdos_com: LinkRes.Add('format dos com');
-    else
-      InternalError(2013092101);
-  end;
+  if apptype=app_com then
+    LinkRes.Add('format dos com')
+  else
+    LinkRes.Add('format dos');
   LinkRes.Add('option dosseg');
   LinkRes.Add('name ' + maybequoted(current_module.exefilename));