Przeglądaj źródła

pas2js: marker for checking writeln statements

git-svn-id: trunk@38139 -
Mattias Gaertner 7 lat temu
rodzic
commit
fc805c4bd2
3 zmienionych plików z 38 dodań i 26 usunięć
  1. 2 0
      utils/pas2js/dirwatch.pp
  2. 34 26
      utils/pas2js/httpcompiler.pp
  3. 2 0
      utils/pas2js/pas2js.pp

+ 2 - 0
utils/pas2js/dirwatch.pp

@@ -432,9 +432,11 @@ begin
         setlength(fn,fnl);
         if (fnl>0) then
           move(e^.name,fn[1],fnl);
+        {$ifdef VerboseDirWatch}
         Writeln('Change ',e^.mask,' (',
 //                InotifyEventsToString(e^.mask),
                 ') detected for file "',fn,'"');
+        {$endif}
         ptrint(e):=ptrint(e)+sizeof(inotify_event)+e^.len-1;
         end;
       end;

+ 34 - 26
utils/pas2js/httpcompiler.pp

@@ -208,12 +208,12 @@ end;
 
 constructor TDirWatcher.Create(App: THTTPCompilerApplication; ADir: String);
 begin
- Inherited create(APP);
- FApp:=App;
- FDW:=TDirwatch.Create(Self);
- FDW.AddWatch(ADir,allEvents);
- FDW.OnChange:=@DoChange;
- TThread.ExecuteInThread(@FDW.StartWatch);
+  Inherited create(APP);
+  FApp:=App;
+  FDW:=TDirwatch.Create(Self);
+  FDW.AddWatch(ADir,allEvents);
+  FDW.OnChange:=@DoChange;
+  TThread.ExecuteInThread(@FDW.StartWatch);
 end;
 
 destructor TDirWatcher.Destroy;
@@ -228,31 +228,35 @@ end;
 
 procedure THTTPCompilerApplication.DoLog(EventType: TEventType; const Msg: String);
 begin
- if Quiet then
-   exit;
- if IsConsole then
-   Writeln(FormatDateTime('yyyy-mm-dd hh:nn:ss.zzz',Now),' [',EventType,'] ',Msg)
- else
-   inherited DoLog(EventType, Msg);
+  {AllowWriteln}
+  if Quiet then
+    exit;
+  if IsConsole then
+    Writeln(FormatDateTime('yyyy-mm-dd hh:nn:ss.zzz',Now),' [',EventType,'] ',Msg)
+  else
+    inherited DoLog(EventType, Msg);
+  {AllowWriteln-}
 end;
 
 procedure THTTPCompilerApplication.Usage(Msg : String);
 
 begin
- if (Msg<>'') then
-   Writeln('Error: ',Msg);
- Writeln('Usage ',ExtractFileName(ParamStr(0)),' [options] ');
- Writeln('Where options is one or more of : ');
- Writeln('-d --directory=dir  Base directory from which to serve files.');
- Writeln('                    Default is current working directory: ',GetCurrentDir);
- Writeln('-h --help           This help text');
- Writeln('-i --indexpage=name Directory index page to use (default: index.html)');
- Writeln('-n --noindexpage    Do not allow index page.');
- Writeln('-p --port=NNNN      TCP/IP port to listen on (default is 3000)');
- Writeln('-q --quiet          Do not write diagnostic messages');
- Writeln('-w --watch          Watch directory for changes');
- Writeln('-c --compile[=proj] Recompile project if pascal files change. Default project is app.lpr');
- Halt(Ord(Msg<>''));
+  {AllowWriteln}
+  if (Msg<>'') then
+    Writeln('Error: ',Msg);
+  Writeln('Usage ',ExtractFileName(ParamStr(0)),' [options] ');
+  Writeln('Where options is one or more of : ');
+  Writeln('-d --directory=dir  Base directory from which to serve files.');
+  Writeln('                    Default is current working directory: ',GetCurrentDir);
+  Writeln('-h --help           This help text');
+  Writeln('-i --indexpage=name Directory index page to use (default: index.html)');
+  Writeln('-n --noindexpage    Do not allow index page.');
+  Writeln('-p --port=NNNN      TCP/IP port to listen on (default is 3000)');
+  Writeln('-q --quiet          Do not write diagnostic messages');
+  Writeln('-w --watch          Watch directory for changes');
+  Writeln('-c --compile[=proj] Recompile project if pascal files change. Default project is app.lpr');
+  Halt(Ord(Msg<>''));
+  {AllowWriteln-}
 end;
 
 constructor THTTPCompilerApplication.Create(AOWner: TComponent);
@@ -312,7 +316,9 @@ procedure THTTPCompilerApplication.AddToStatus(O : TJSONObject);
 begin
   FStatusLock.Enter;
   try
+    {$ifdef VerboseHTTPCompiler}
     Writeln('Adding to status ',Assigned(O),' : ',O.ClassName);
+    {$endif}
     FStatusList.Add(O);
   finally
     FStatusLock.Leave;
@@ -356,7 +362,9 @@ begin
         R:=TJSONObject.Create(['ping',True])
       else
         begin
+        {$ifdef VerboseHTTPCompiler}
         Writeln(FStatusList[0].ClassName);
+        {$endif}
         O:=FStatusList[0] as TJSONObject;
         FStatusList.Delete(0);
         if O.Get('action','')<>'file' then

+ 2 - 0
utils/pas2js/pas2js.pp

@@ -46,7 +46,9 @@ begin
       on E: ECompilerTerminate do ;
       on E: Exception do
       begin
+        {AllowWriteln}
         writeln(E.Message);
+        {AllowWriteln-}
         if ExitCode=0 then
           ExitCode:=ExitCodeErrorInternal;
       end;