Browse Source

Isolates fpvectorial writeln and removes lazarus specific files

git-svn-id: trunk@13404 -
sekelsenmat 16 years ago
parent
commit
0704d007a4

+ 0 - 2
.gitattributes

@@ -1731,8 +1731,6 @@ packages/fpvectorial/src/avisocncgcodereader.pas svneol=native#text/plain
 packages/fpvectorial/src/avisocncgcodewriter.pas svneol=native#text/plain
 packages/fpvectorial/src/avisozlib.pas svneol=native#text/plain
 packages/fpvectorial/src/fpvectorial.pas svneol=native#text/plain
-packages/fpvectorial/src/fpvectorial_pkg.lpk svneol=native#text/plain
-packages/fpvectorial/src/fpvectorial_pkg.pas svneol=native#text/plain
 packages/fpvectorial/src/fpvtocanvas.pas svneol=native#text/plain
 packages/fpvectorial/src/pdfvectorialreader.pas svneol=native#text/plain
 packages/fpvectorial/src/pdfvrlexico.pas svneol=native#text/plain

+ 7 - 1
packages/fpvectorial/src/avisocncgcodereader.pas

@@ -97,7 +97,9 @@ var
   DestX, DestY, DestZ: Double;
   i: Integer;
 begin
+  {$ifdef FPVECTORIALDEBUG}
   WriteLn('TvAvisoCNCGCodeReader.ReadString ', AStr);
+  {$endif}
   AParams := SeparateString(AStr, ' ');
 
   {
@@ -209,14 +211,18 @@ procedure TvAvisoCNCGCodeReader.ReadFromStrings(AStrings: TStrings;
 var
   i: Integer;
 begin
+  {$ifdef FPVECTORIALDEBUG}
   WriteLn('TvAvisoCNCGCodeReader.ReadFromStrings AStrings = ', PtrInt(AStrings), ' AData = ', PtrInt(AData));
-
+  {$endif}
+  
   AData.StartPath(0, 0);
 
   for i := 0 to AStrings.Count - 1 do
     ReadString(AStrings.Strings[i], AData);
 
+  {$ifdef FPVECTORIALDEBUG}
   WriteLn('AData.EndPath');
+  {$endif}
   AData.EndPath();
 end;
 

+ 4 - 4
packages/fpvectorial/src/fpvectorial.pas

@@ -281,13 +281,13 @@ var
   Len: Integer;
 begin
   Len := SizeOf(TPath);
-  WriteLn(':>TvVectorialDocument.AddPath 1 Len = ', Len);
+  //WriteLn(':>TvVectorialDocument.AddPath 1 Len = ', Len);
   Path := GetMem(Len);
-  WriteLn(':>TvVectorialDocument.AddPath 2');
+  //WriteLn(':>TvVectorialDocument.AddPath 2');
   Move(APath, Path^, Len);
-  WriteLn(':>TvVectorialDocument.AddPath 3');
+  //WriteLn(':>TvVectorialDocument.AddPath 3');
   FPaths.Add(Path);
-  WriteLn(':>TvVectorialDocument.AddPath 4');
+  //WriteLn(':>TvVectorialDocument.AddPath 4');
 end;
 
 {@@

+ 0 - 69
packages/fpvectorial/src/fpvectorial_pkg.lpk

@@ -1,69 +0,0 @@
-<?xml version="1.0"?>
-<CONFIG>
-  <Package Version="3">
-    <PathDelim Value="\"/>
-    <Name Value="fpvectorial_pkg"/>
-    <CompilerOptions>
-      <Version Value="8"/>
-      <PathDelim Value="\"/>
-      <SearchPaths>
-        <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
-      </SearchPaths>
-      <Other>
-        <CompilerPath Value="$(CompPath)"/>
-      </Other>
-    </CompilerOptions>
-    <Files Count="9">
-      <Item1>
-        <Filename Value="fpvectorial.pas"/>
-        <UnitName Value="fpvectorial"/>
-      </Item1>
-      <Item2>
-        <Filename Value="pdfvectorialreader.pas"/>
-        <UnitName Value="pdfvectorialreader"/>
-      </Item2>
-      <Item3>
-        <Filename Value="pdfvrlexico.pas"/>
-        <UnitName Value="pdfvrlexico"/>
-      </Item3>
-      <Item4>
-        <Filename Value="pdfvrsemantico.pas"/>
-        <UnitName Value="pdfvrsemantico"/>
-      </Item4>
-      <Item5>
-        <Filename Value="pdfvrsintatico.pas"/>
-        <UnitName Value="pdfvrsintatico"/>
-      </Item5>
-      <Item6>
-        <Filename Value="avisozlib.pas"/>
-        <UnitName Value="avisozlib"/>
-      </Item6>
-      <Item7>
-        <Filename Value="avisocncgcodewriter.pas"/>
-        <UnitName Value="avisocncgcodewriter"/>
-      </Item7>
-      <Item8>
-        <Filename Value="avisocncgcodereader.pas"/>
-        <UnitName Value="avisocncgcodereader"/>
-      </Item8>
-      <Item9>
-        <Filename Value="fpvtocanvas.pas"/>
-        <UnitName Value="fpvtocanvas"/>
-      </Item9>
-    </Files>
-    <Type Value="RunAndDesignTime"/>
-    <RequiredPkgs Count="1">
-      <Item1>
-        <PackageName Value="FCL"/>
-        <MinVersion Major="1" Valid="True"/>
-      </Item1>
-    </RequiredPkgs>
-    <UsageOptions>
-      <UnitPath Value="$(PkgOutDir)"/>
-    </UsageOptions>
-    <PublishOptions>
-      <Version Value="2"/>
-      <IgnoreBinaries Value="False"/>
-    </PublishOptions>
-  </Package>
-</CONFIG>

+ 0 - 22
packages/fpvectorial/src/fpvectorial_pkg.pas

@@ -1,22 +0,0 @@
-{ This file was automatically created by Lazarus. do not edit!
-  This source is only used to compile and install the package.
- }
-
-unit fpvectorial_pkg; 
-
-interface
-
-uses
-    fpvectorial, pdfvectorialreader, pdfvrlexico, pdfvrsemantico, 
-  pdfvrsintatico, avisozlib, avisocncgcodewriter, avisocncgcodereader, 
-  fpvtocanvas, LazarusPackageIntf;
-
-implementation
-
-procedure Register; 
-begin
-end; 
-
-initialization
-  RegisterPackage('fpvectorial_pkg', @Register); 
-end.

+ 4 - 0
packages/fpvectorial/src/fpvtocanvas.pas

@@ -25,7 +25,9 @@ var
   CurveLength: Integer;
   t: Double;
 begin
+  {$ifdef FPVECTORIALDEBUG}
   WriteLn(':>DrawFPVectorialToCanvas');
+  {$endif}
 
   PosX := 0;
   PosY := 0;
@@ -74,7 +76,9 @@ begin
     end;
   end;
 
+  {$ifdef FPVECTORIALDEBUG}
   WriteLn(':<DrawFPVectorialToCanvas');
+  {$endif}
 end;
 
 end.

+ 15 - 1
packages/fpvectorial/src/pdfvectorialreader.pas

@@ -60,7 +60,9 @@ var
   myAnSintaticoContents: AnSintaticoPageContents;
   AInput2: TStream;
 begin
+  {$ifdef FPVECTORIALDEBUG}
   WriteLn(':> TvPDFVectorialReader.getFirstPage');
+  {$endif}
   AInput2 := TMemoryStream.Create;
   AInput2.Size := AInput.Size;
   AInput2.CopyFrom(AInput, AInput.Size);
@@ -122,7 +124,9 @@ begin
 
   Result:=myAnSintaticoContents.h;
 
+  {$ifdef FPVECTORIALDEBUG}
   WriteLn(':< TvPDFVectorialReader.getFirstPage');
+  {$endif}
 
 //  AInput2.Free;
 end;
@@ -134,8 +138,10 @@ var
   myDecode: decode;
   BufStr: string;
 begin
+  {$ifdef FPVECTORIALDEBUG}
   WriteLn(':> TvPDFVectorialReader.unzipPage');
-
+  {$endif}
+  
   myDecode := Decode.Create;
 
   comprLen := 10000 * SizeOf(Integer); // don't overflow
@@ -162,7 +168,9 @@ begin
   FreeMem(compr, comprLen);
   FreeMem(uncompr, uncomprLen);
 
+  {$ifdef FPVECTORIALDEBUG}
   WriteLn(':< TvPDFVectorialReader.unzipPage');
+  {$endif}
 end;
 
 procedure TvPDFVectorialReader.translatePage(AInput: TStream;
@@ -174,7 +182,9 @@ var
   mytoken: Token;
   c: Command;
 begin
+  {$ifdef FPVECTORIALDEBUG}
   WriteLn(':> TvPDFVectorialReader.translatePage');
+  {$endif}
 
   // initialize data main
   myAnLexico := AnLexico.Create;
@@ -204,7 +214,9 @@ var
   APageHeader: PageHeader;
   APageStream, AUnzipStream: TStream;
 begin
+  {$ifdef FPVECTORIALDEBUG}
   WriteLn(':> TvPDFVectorialReader.ReadFromStream');
+  {$endif}
 
   APageStream := TMemoryStream.Create;
   AUnzipStream := TMemoryStream.Create;
@@ -233,8 +245,10 @@ begin
   AUnzipStream.Free;
 
   //ShowMessage('Sucesso!');
+  {$ifdef FPVECTORIALDEBUG}
   WriteLn(':< TvPDFVectorialReader.ReadFromStream');
   WriteLn('Sucesso!');
+  {$endif}
 end;
 
 {*******************************************************************

+ 28 - 2
packages/fpvectorial/src/pdfvrsemantico.pas

@@ -26,7 +26,9 @@ function AnSemantico.generate(c: Command; AData: TvVectorialDocument): String;
 var
   enter_line : String;
 begin
+  {$ifdef FPVECTORIALDEBUG}
   WriteLn(':> AnSemantico.generate');
+  {$endif}
   enter_line:= LineEnding; //chr(13) + chr(10); // CR and LF
 
   if ((c.code = cc_H_CLOSE_PATH) or (c.code = cc_hS_CLOSE_AND_END_PATH)) then // command h or s
@@ -39,13 +41,13 @@ begin
   begin
      if ((c.code = cc_m_START_PATH) or (c.code = cc_l_ADD_LINE_TO_PATH)) then
      begin
-       WriteLn(':: anSemantico.generate convert code ', Integer(c.code));
+       //WriteLn(':: anSemantico.generate convert code ', Integer(c.code));
        c.cord_x := convert(c.cord_x,c.cord_y,'x');
        c.cord_y := convert(c.cord_x,c.cord_y,'y');
      end;
      if ((c.code = cc_c_BEZIER_TO_X_Y_USING_X2_Y2_AND_X3_Y3)) then
      begin
-       WriteLn(':: anSemantico.generate convert code ', Integer(c.code));
+       //WriteLn(':: anSemantico.generate convert code ', Integer(c.code));
        c.cord_x := convert(c.cord_x,c.cord_y,'x');
        c.cord_y := convert(c.cord_x,c.cord_y,'y');
        c.cord_x2 := convert(c.cord_x2,c.cord_y2,'x');
@@ -58,7 +60,9 @@ begin
   case c.code of
   cc_m_START_PATH: // command m
   begin
+    {$ifdef FPVECTORIALDEBUG}
     WriteLn(':> AnSemantico.generate Estado 1 EndPath StartPath');
+    {$endif}
     // Result:='G01' + ' ' + 'X' + c.cord_x + ' ' + 'Y' + c.cord_y + enter_line +
     //            'G01 Z50 // Abaixa a cabeça de gravação';
 
@@ -72,27 +76,35 @@ begin
   end;
   cc_l_ADD_LINE_TO_PATH: // command l
   begin
+    {$ifdef FPVECTORIALDEBUG}
     WriteLn(':> AnSemantico.generate Estado 2 AddPointToPath');
+    {$endif}
     // Result:='G01' + ' ' + 'X' + c.cord_x + ' ' +  'Y' + c.cord_y;
 
     AData.AddLineToPath(StrToFloat(c.cord_x), StrToFloat(c.cord_y));
   end;
   cc_h_CLOSE_PATH: // command h
   begin
+    {$ifdef FPVECTORIALDEBUG}
     WriteLn(':> AnSemantico.generate Estado 3 AddPointToPath');
+    {$endif}
     //Result:='G01' + ' ' + 'X' + c.cord_x + ' ' +  'Y' + c.cord_y;
 
     AData.AddLineToPath(StrToFloat(c.cord_x), StrToFloat(c.cord_y));
   end;
   cc_S_END_PATH: // command S
   begin
+    {$ifdef FPVECTORIALDEBUG}
     WriteLn(':> AnSemantico.generate Estado 4 EndPath');
+    {$endif}
     // Result:='G01 Z0 // Sobe a cabeça de gravação' + enter_line;
     AData.EndPath();
   end;
   cc_hS_CLOSE_AND_END_PATH: // command s
   begin
+    {$ifdef FPVECTORIALDEBUG}
     WriteLn(':> AnSemantico.generate Estado 5 AddPoint EndPath');
+    {$endif}
     //Result:='G01' + ' ' + 'X' + c.cord_x + ' ' +  'Y' + c.cord_y + enter_line
     //       +'G01 Z0 // Sobe a cabeça de gravação' + enter_line;
 
@@ -101,7 +113,9 @@ begin
   end;
   cc_c_BEZIER_TO_X_Y_USING_X2_Y2_AND_X3_Y3: // command c
   begin
+    {$ifdef FPVECTORIALDEBUG}
     WriteLn(':> AnSemantico.generate Estado 6 Bezier');
+    {$endif}
     //Result:='G01' + ' ' + 'X' + c.cord_x + ' ' +  'Y' + c.cord_y + enter_line
     //       +'G01 Z0 // Sobe a cabeça de gravação' + enter_line;
 
@@ -113,7 +127,9 @@ begin
   end;
   cc_CONCATENATE_MATRIX: // command cm
   begin
+    {$ifdef FPVECTORIALDEBUG}
     WriteLn(':> AnSemantico.cc_CONCATENATE_MATRIX');
+    {$endif}
 
     cm_a := StrToFloat(c.cord_x3);
     cm_b := StrToFloat(c.cord_y3);
@@ -124,7 +140,9 @@ begin
   end;
   cc_RESTORE_MATRIX: // command Q
   begin
+    {$ifdef FPVECTORIALDEBUG}
     WriteLn(':> AnSemantico.cc_RESTORE_MATRIX');
+    {$endif}
 
     cm_a:=1;
     cm_b:=0;
@@ -134,14 +152,18 @@ begin
     cm_f:=0;
   end;
   else
+    {$ifdef FPVECTORIALDEBUG}
     WriteLn(':> AnSemantico.generate Estado ELSE');
+    {$endif}
     Result:=c.my_operator;
   end;
 end;
 
 function AnSemantico.convert(x: String; y: String; Axis: Char): String;
 begin
+  {$ifdef FPVECTORIALDEBUG}
   WriteLn(':> AnSemantico.convert');
+  {$endif}
   // convert from 1/72 inch to milimeters and change axis if necessary
 
   if (Axis = 'y') then
@@ -161,7 +183,9 @@ function AnSemantico.startMachine(): String;
 var
   enter_line : String;
 begin
+  {$ifdef FPVECTORIALDEBUG}
   WriteLn(':> AnSemantico.startMachine');
+  {$endif}
   enter_line:=chr(13) + chr(10); // CR and LF
 
   Result:='M216 // Ligar monitor de carga' + enter_line +
@@ -173,7 +197,9 @@ function AnSemantico.endMachine(): String;
 var
   enter_line : String;
 begin
+  {$ifdef FPVECTORIALDEBUG}
   WriteLn(':> AnSemantico.endMachine');
+  {$endif}
   enter_line:=chr(13) + chr(10); // CR and LF
 
   Result:='M30 // Parar o programa e retornar para posição inicial' + enter_line +

+ 56 - 0
packages/fpvectorial/src/pdfvrsintatico.pas

@@ -54,7 +54,9 @@ begin
   case Estado of
   1:
   begin
+    {$ifdef FPVECTORIALDEBUG}
     WriteLn(':> AnSintaticoPage.automata Estado 1');
+    {$endif}
              if(t.token_string = 'Type') then
                    begin
                        Estado := 2;
@@ -66,7 +68,9 @@ begin
   end;
   2:
   begin
+    {$ifdef FPVECTORIALDEBUG}
     WriteLn(':> AnSintaticoPage.automata Estado 2');
+    {$endif}
              if(t.token_string = 'Page') then
                    begin
                         Estado := 3;
@@ -78,7 +82,9 @@ begin
   end;
   3:
   begin
+    {$ifdef FPVECTORIALDEBUG}
     WriteLn(':> AnSintaticoPage.automata Estado 3');
+    {$endif}
              if(t.token_string = 'Contents') then
                    begin
                         Estado := 4;
@@ -90,7 +96,9 @@ begin
   end;
   4:
   begin
+    {$ifdef FPVECTORIALDEBUG}
     WriteLn(':> AnSintaticoPage.automata Estado 4');
+    {$endif}
              if(t.tipo = 1) then // numbers 1
                    begin
                         obj1:=t.token_string;
@@ -104,7 +112,9 @@ begin
   end;
   5:
   begin
+    {$ifdef FPVECTORIALDEBUG}
     WriteLn(':> AnSintaticoPage.automata Estado 5');
+    {$endif}
              if(t.tipo = 1) then // numbers 2
                    begin
                         obj2:=t.token_string;
@@ -118,7 +128,9 @@ begin
                    end;
   end;
   else
+    {$ifdef FPVECTORIALDEBUG}
     WriteLn(':> AnSintaticoPage.automata Estado ELSE');
+    {$endif}
     Estado := 1;
   end;
 end;
@@ -132,7 +144,9 @@ begin
   case Estado of
   1:
   begin
+    {$ifdef FPVECTORIALDEBUG}
     WriteLn(':> AnSintaticoPageContents.automata Estado 1');
+    {$endif}
              if(t.token_string = obj1) then
                    begin
                         Estado := 2;
@@ -144,7 +158,9 @@ begin
   end;
   2:
   begin
+    {$ifdef FPVECTORIALDEBUG}
     WriteLn(':> AnSintaticoPageContents.automata Estado 2');
+    {$endif}
              if(t.token_string = obj2) then
                    begin
                         Estado := 3;
@@ -156,7 +172,9 @@ begin
   end;
   3:
   begin
+    {$ifdef FPVECTORIALDEBUG}
     WriteLn(':> AnSintaticoPageContents.automata Estado 3');
+    {$endif}
              if(t.token_string = 'obj') then
                    begin
                         Estado := 4;
@@ -168,7 +186,9 @@ begin
   end;
   4:
   begin
+    {$ifdef FPVECTORIALDEBUG}
     WriteLn(':> AnSintaticoPageContents.automata Estado 4');
+    {$endif}
              if(t.token_string = 'Length') then
                    begin
                         Estado := 5;
@@ -184,7 +204,9 @@ begin
   end;
   5:
   begin
+    {$ifdef FPVECTORIALDEBUG}
     WriteLn(':> AnSintaticoPageContents.automata Estado 5');
+    {$endif}
              if(t.tipo = 1) then
                    begin
                         h.page_length := StrToInt(t.token_string);
@@ -199,7 +221,9 @@ begin
   end;
   6:
   begin
+    {$ifdef FPVECTORIALDEBUG}
     WriteLn(':> AnSintaticoPageContents.automata Estado 6');
+    {$endif}
              if(t.token_string = 'Filter') then
                    begin
                         Estado := 7;
@@ -244,7 +268,9 @@ begin
   end;
   7:
   begin
+    {$ifdef FPVECTORIALDEBUG}
     WriteLn(':> AnSintaticoPageContents.automata Estado 7');
+    {$endif}
              if(t.token_string = 'FlateDecode') then
                    begin
                         h.flate_decode := true;
@@ -258,7 +284,9 @@ begin
   end;
   8:
   begin
+    {$ifdef FPVECTORIALDEBUG}
     WriteLn(':> AnSintaticoPageContents.automata Estado 8');
+    {$endif}
              if(t.token_string = 'stream') then
                    begin
                         contentsFound := true;
@@ -274,7 +302,9 @@ begin
                    end;
   end;
   else
+    {$ifdef FPVECTORIALDEBUG}
     WriteLn(':> AnSintaticoPageContents.automata Estado ELSE');
+    {$endif}
     Estado := 1;
   end;
 end;
@@ -284,7 +314,9 @@ begin
   case Estado of
   1:
   begin
+    {$ifdef FPVECTORIALDEBUG}
     WriteLn(':> AnSintaticoLength.automata Estado 1');
+    {$endif}
              if(t.token_string = len_obj1) then
                    begin
                         Estado := 2;
@@ -296,7 +328,9 @@ begin
   end;
   2:
   begin
+    {$ifdef FPVECTORIALDEBUG}
     WriteLn(':> AnSintaticoLength.automata Estado 2');
+    {$endif}
              if(t.token_string = len_obj2) then
                    begin
                         Estado := 3;
@@ -308,7 +342,9 @@ begin
   end;
   3:
   begin
+    {$ifdef FPVECTORIALDEBUG}
     WriteLn(':> AnSintaticoLength.automata Estado 3');
+    {$endif}
              if(t.token_string = 'obj') then
                    begin
                         Estado := 4;
@@ -320,7 +356,9 @@ begin
   end;
   4:
   begin
+    {$ifdef FPVECTORIALDEBUG}
     WriteLn(':> AnSintaticoLength.automata Estado 4 Length: ', StrToInt(t.token_string));
+    {$endif}
              if(t.tipo = 1) then
                    begin
                         page_length:=StrToInt(t.token_string);
@@ -334,7 +372,9 @@ begin
                    end;
   end;
   else
+    {$ifdef FPVECTORIALDEBUG}
     WriteLn(':> AnSintaticoLength.automata Estado ELSE');
+    {$endif}
     Estado := 1;
   end;
 end;
@@ -355,7 +395,9 @@ begin
   case Estado of
   1:
   begin
+    {$ifdef FPVECTORIALDEBUG}
     WriteLn(':> AnSintaticoCommand.automata Estado 1');
+    {$endif}
              if(t.tipo = 1) then // numbers 1
                    begin
                        Estado := 2;
@@ -418,7 +460,9 @@ begin
   end;
   2:
   begin
+    {$ifdef FPVECTORIALDEBUG}
     WriteLn(':> AnSintaticoCommand.automata Estado 2');
+    {$endif}
              if(t.tipo = 1) then // numbers 2
                    begin
                         Estado := 3;
@@ -430,7 +474,9 @@ begin
   end;
   3:
   begin
+    {$ifdef FPVECTORIALDEBUG}
     WriteLn(':> AnSintaticoCommand.automata Estado 3');
+    {$endif}
              if(t.tipo = 1) then // numbers 3
                   begin
                        Estado := 5;
@@ -458,7 +504,9 @@ begin
   end;
   5:
   begin
+    {$ifdef FPVECTORIALDEBUG}
     WriteLn(':> AnSintaticoCommand.automata Estado 5');
+    {$endif}
              if(t.tipo = 1) then // numbers 4
                    begin
                        Estado := 6;
@@ -470,7 +518,9 @@ begin
   end;
   6:
   begin
+    {$ifdef FPVECTORIALDEBUG}
     WriteLn(':> AnSintaticoCommand.automata Estado 6');
+    {$endif}
              if(t.tipo = 1) then // numbers 5
                    begin
                        Estado := 7;
@@ -500,7 +550,9 @@ begin
   end;
   7:
   begin
+    {$ifdef FPVECTORIALDEBUG}
     WriteLn(':> AnSintaticoCommand.automata Estado 7');
+    {$endif}
              if(t.tipo = 1) then // numbers 6
                    begin
                        Estado := 8;
@@ -512,7 +564,9 @@ begin
   end;
   8:
   begin
+    {$ifdef FPVECTORIALDEBUG}
     WriteLn(':> AnSintaticoCommand.automata Estado 8');
+    {$endif}
              if(t.token_string = 'c') then // commmand c
                    begin
                        Estado := 19; // symbolic state
@@ -535,7 +589,9 @@ begin
                    end;
   end;
   else
+    {$ifdef FPVECTORIALDEBUG}
     WriteLn(':> AnSintaticoCommand.automata Estado ELSE');
+    {$endif}
     Estado := 1;
   end;
 end;