Browse Source

* patch by J. Peter Mugaas to resolve #7777 and #7778

git-svn-id: trunk@8800 -
florian 18 years ago
parent
commit
dab6eec7e2
3 changed files with 497 additions and 483 deletions
  1. 15 5
      utils/h2pas/options.pas
  2. 7 6
      utils/h2pas/scan.l
  3. 475 472
      utils/h2pas/scan.pas

+ 15 - 5
utils/h2pas/options.pas

@@ -92,6 +92,17 @@ begin
    MaybeExtension:=Hstr;
 end;
 
+function ExtractFileName(const AFilePath : String): String;
+var i : Integer;
+begin
+  i := Length(AFilePath);
+  while (i>0) and (AFilePath[i]<>DirectorySeparator) and
+    (AFilePath[i]<>DriveSeparator) do
+  begin
+    Dec(i);
+  end;
+  ExtractFileName := Copy(AFilePath,i+1,Length(AFilePath)); 
+end;
 
 {*****************************************************************************
                                 Options
@@ -232,11 +243,10 @@ begin
     Usage;
   if UnitName='' then
    begin
-     i:=pos('.',outputfilename)-1;
-     if i<=0 then
-      UnitName:=outputfilename
-     else
-      UnitName:=Copy(OutputFileName,1,i);
+     UnitName := ExtractFileName(outputfilename);
+     i:=pos('.',UnitName)-1;
+     if i>0 then
+      UnitName:=Copy(UnitName,1,i);
    end;
 end;
 

+ 7 - 6
utils/h2pas/scan.l

@@ -801,31 +801,31 @@ D [0-9]
                         end;
 "void"                  if NotInCPlusBlock then return(VOID) else skip_until_eol;
 "VOID"                  if NotInCPlusBlock then return(VOID) else skip_until_eol;
-"#ifdef __cplusplus"[ \t]*\n"extern \"C\" {"\n"#endif"
+"#ifdef"[ \t]*"__cplusplus"[ \t]*\n"extern \"C\" {"\n"#endif"
                         begin
                           if not stripinfo then
                             writeln(outfile,'{ C++ extern C conditionnal removed }');
                         end;
-"#ifdef cplusplus"[ \t]*\n"extern \"C\" {"\n"#endif"
+"#ifdef"[ \t]*"cplusplus"[ \t]*\n"extern \"C\" {"\n"#endif"
                         begin
                           if not stripinfo then
                             writeln(outfile,'{ C++ extern C conditionnal removed }');
                         end;
-"#ifdef __cplusplus"[ \t]*\n"}"\n"#endif"
+"#ifdef"[ \t]*"__cplusplus"[ \t]*\n"}"\n"#endif"
                         begin
                           if not stripinfo then
                             writeln(outfile,'{ C++ end of extern C conditionnal removed }');
                         end;
-"#ifdef cplusplus"[ \t]*\n"}"\n"#endif"
+"#ifdef"[ \t]*"cplusplus"[ \t]*\n"}"\n"#endif"
                         begin
                           if not stripinfo then
                             writeln(outfile,'{ C++ end of extern C conditionnal removed }');
                         end;
-"#ifdef cplusplus"[ \t]*
+"#ifdef"[ \t]*"cplusplus"[ \t]*
                         begin
                           Inc(cplusblocklevel);
                         end;
-"#ifdef __cplusplus"[ \t]*
+"#ifdef"[ \t]*"__cplusplus"[ \t]*
                         begin
                           Inc(cplusblocklevel);
                         end;
@@ -1081,3 +1081,4 @@ end.
 
 
 
+

File diff suppressed because it is too large
+ 475 - 472
utils/h2pas/scan.pas


Some files were not shown because too many files changed in this diff