libDXF 0.0.1
A library with DXF related functions written in C.

header.c

Go to the documentation of this file.
00001 
00039 #include "global.h"
00040 #include "file.h"
00041 #include "header.h"
00042 #include "section.h"
00043 #include "util.h"
00044 #include "point.h"
00045 
00046 
00058 DxfHeader *
00059 dxf_header_new ()
00060 {
00061 #if DEBUG
00062         DXF_DEBUG_BEGIN
00063 #endif
00064         DxfHeader *header = NULL;
00065         size_t size;
00066 
00067         size = sizeof (DxfHeader);
00068         /* avoid malloc of 0 bytes */
00069         if (size == 0) size = 1;
00070         if ((header = malloc (size)) == NULL)
00071         {
00072                 fprintf (stderr,
00073                   (_("Error in %s () could not allocate memory for a DxfHeader struct.\n")),
00074                   __FUNCTION__);
00075                 header = NULL;
00076         }
00077         else
00078         {
00079                 memset (header, 0, size);
00080         }
00081 #if DEBUG
00082         DXF_DEBUG_END
00083 #endif
00084         return (header);
00085 }
00086 
00092 char *
00093 dxf_header_acad_version_to_string
00094 (
00095         int version_number
00097 )
00098 {
00099 #if DEBUG
00100         DXF_DEBUG_BEGIN
00101 #endif
00102         switch (version_number)
00103         {
00104                 case AC1006: return "AC1006";
00105                 case AC1009: return "AC1009";
00106                 case AC1012: return "AC1012";
00107                 case AC1014: return "AC1014";
00108                 case AC1015: return "AC1015";
00109                 case AC1016: return "AC1016";
00110                 case AC1017: return "AC1017";
00111                 case AC1018: return "AC1018";
00112                 case AC1021: return "AC1021";
00113                 case AC1024: return "AC1024";
00114         }
00115 #if DEBUG
00116         DXF_DEBUG_END
00117 #endif
00118         return NULL;
00119 }
00120 
00127 int
00128 dxf_header_acad_version_from_string
00129 (
00130         const char * version_string
00132 )
00133 {
00134 #if DEBUG
00135         DXF_DEBUG_BEGIN
00136 #endif
00137         if (version_string == NULL)
00138         {
00139                 fprintf (stderr,
00140                   (_("Error in %s () a NULL file pointer was passed.\n")),
00141                   __FUNCTION__);
00142                 return (EXIT_FAILURE);
00143         }
00144         if (strcmp ("AC1006", version_string) == 0)
00145                 return AC1006;
00146         if (strcmp ("AC1009", version_string) == 0)
00147                 return AC1009;
00148         if (strcmp ("AC1012", version_string) == 0)
00149                 return AC1012;
00150         if (strcmp ("AC1014", version_string) == 0)
00151                 return AC1014;
00152         if (strcmp ("AC1015", version_string) == 0)
00153                 return AC1015;
00154         if (strcmp ("AC1016", version_string) == 0)
00155                 return AC1016;
00156         if (strcmp ("AC1017", version_string) == 0)
00157                 return AC1017;
00158         if (strcmp ("AC1018", version_string) == 0)
00159                 return AC1018;
00160         if (strcmp ("AC1019", version_string) == 0)
00161                 return AC1019;
00162         if (strcmp ("AC1020", version_string) == 0)
00163                 return AC1020;
00164         if (strcmp ("AC1021", version_string) == 0)
00165                 return AC1021;
00166         if (strcmp ("AC1022", version_string) == 0)
00167                 return AC1022;
00168         if (strcmp ("AC1023", version_string) == 0)
00169                 return AC1023;
00170         if (strcmp ("AC1024", version_string) == 0)
00171                 return AC1024;
00172         if (strcmp ("AC1025", version_string) == 0)
00173                 return AC1025;
00174         if (strcmp ("AC1026", version_string) == 0)
00175                 return AC1026;
00176         if (strcmp ("AC1027", version_string) == 0)
00177                 return AC1027;
00178         /* in the case that it is an invalid version */
00179 #if DEBUG
00180         DXF_DEBUG_END
00181 #endif
00182         return 0;
00183 }
00184 
00185 
00190 DxfHeader *
00191 dxf_header_init
00192 (
00193         DxfHeader *header,
00195         int acad_version_number
00197 )
00198 {
00199 #if DEBUG
00200         DXF_DEBUG_BEGIN
00201 #endif
00202         /* Do some basic checks. */
00203         if (header == NULL)
00204         {
00205                 fprintf (stderr,
00206                   (_("Warning in %s () a NULL pointer was passed.\n")),
00207                   __FUNCTION__);
00208                 header = dxf_header_new ();
00209         }
00210         if (header == NULL)
00211         {
00212                 fprintf (stderr,
00213                   (_("Error in %s () could not allocate memory for a DxfHeader struct.\n")),
00214                   __FUNCTION__);
00215                 return (NULL);
00216         }
00217         header->AcadVer = dxf_header_acad_version_to_string (acad_version_number);
00218         switch (acad_version_number)
00219         {
00220                 case AC1009: /* AutoCAD 12 */
00221                 {
00222                         header->DragMode = 2;
00223                         header->OSMode = 125;
00224                         header->BlipMode = 0;
00225                         header->Coords = 2;
00226                         header->AttDia = 0;
00227                         header->AttReq = 1;
00228                         header->Handling = 1;
00229                         header->HandSeed = strdup ("233");
00230 
00231                 }
00232                 case AC1012: /* AutoCAD 13 */
00233                 {
00234                         header->DWGCodePage = strdup ("ANSI_1252");
00235                         header->DragMode = 2;
00236                         header->OSMode = 125;
00237                         header->CELTScale = 1.0;
00238                         header->DispSilH = 0;
00239                         header->DelObj = 1;
00240                         header->DimJUST = 0;
00241                         header->DimSD1 = 0;
00242                         header->DimSD2 = 0;
00243                         header->DimTOLJ = 1;
00244                         header->DimTZIN = 0;
00245                         header->DimALTZ = 0;
00246                         header->DimALTTZ = 0;
00247                         header->DimFIT = 3;
00248                         header->DimUPT = 0;
00249                         header->DimUNIT = 2;
00250                         header->DimDEC = 4;
00251                         header->DimTDEC = 4;
00252                         header->DimALTU = 2;
00253                         header->DimALTTD = 2;
00254                         header->DimTXSTY = strdup ("STANDARD");
00255                         header->DimAUNIT = 0;
00256                         header->BlipMode = 0;
00257                         header->ChamferC = 10.0;
00258                         header->ChamferD = 10.0;
00259                         header->Coords = 2;
00260                         header->AttDia = 0;
00261                         header->AttReq = 1;
00262                         header->Handling = 1;
00263                         header->HandSeed = strdup ("233");
00264                         header->TreeDepth = 3020;
00265                         header->PickStyle = 1;
00266                         header->CMLStyle = strdup ("STANDARD");
00267                         header->CMLJust = 0;
00268                         header->CMLScale = 1.0;
00269                         header->SaveImages = 1;
00270                 }
00271                 case AC1014: /* AutoCAD 14 */
00272                 {
00273                         header->AcadMaintVer = 0;
00274                         header->DWGCodePage = strdup ("ANSI_1252");
00275                         header->DragMode = 2;
00276                         header->OSMode = 125;
00277                         header->CELTScale = 1.0;
00278                         header->DispSilH = 0;
00279                         header->DelObj = 1;
00280                         header->DimJUST = 0;
00281                         header->DimSD1 = 0;
00282                         header->DimSD2 = 0;
00283                         header->DimTOLJ = 1;
00284                         header->DimTZIN = 0;
00285                         header->DimALTZ = 0;
00286                         header->DimALTTZ = 0;
00287                         header->DimFIT = 3;
00288                         header->DimUPT = 0;
00289                         header->DimUNIT = 0;
00290                         header->DimDEC = 4;
00291                         header->DimTDEC = 4;
00292                         header->DimALTU = 2;
00293                         header->DimALTTD = 2;
00294                         header->DimTXSTY = strdup ("STANDARD");
00295                         header->DimAUNIT = 0;
00296                         header->BlipMode = 0;
00297                         header->ChamferC = 10.0;
00298                         header->ChamferD = 10.0;
00299                         header->Coords = 2;
00300                         header->AttDia = 0;
00301                         header->AttReq = 1;
00302                         header->Handling = 1;
00303                         header->HandSeed = strdup ("262");
00304                         header->TreeDepth = 3020;
00305                         header->PickStyle = 1;
00306                         header->CMLStyle = strdup ("STANDARD");
00307                         header->CMLJust = 0;
00308                         header->CMLScale = 1.0;
00309                         header->ProxyGraphics = 1;
00310                         header->Measurement = 0;
00311                 }
00312                 case AC1015: /* AutoCAD 2000 */
00313                 {
00314                         header->AcadMaintVer = 20;
00315                         header->DWGCodePage = strdup ("ANSI_1252");
00316                         header->CELTScale = 1.0;
00317                         header->DispSilH = 0;
00318                         header->DimJUST = 0;
00319                         header->DimSD1 = 0;
00320                         header->DimSD2 = 0;
00321                         header->DimTOLJ = 1;
00322                         header->DimTZIN = 0;
00323                         header->DimALTZ = 0;
00324                         header->DimALTTZ = 0;
00325                         header->DimUPT = 0;
00326                         header->DimDEC = 4;
00327                         header->DimTDEC = 4;
00328                         header->DimALTU = 2;
00329                         header->DimALTTD = 2;
00330                         header->DimTXSTY = strdup ("STANDARD");
00331                         header->DimAUNIT = 0;
00332                         header->DimADEC = 0;
00333                         header->DimALTRND = 0.0;
00334                         header->DimAZIN = 0;
00335                         header->DimDSEP = 46;
00336                         header->DimATFIT = 3;
00337                         header->DimFRAC = 0;
00338                         header->DimLDRBLK = strdup ("");
00339                         header->DimLUNIT = 2;
00340                         header->DimLWD = -2;
00341                         header->DimLWE = -2;
00342                         header->DimTMOVE = 0;
00343                         header->ChamferC = 10.0;
00344                         header->ChamferD = 10.0;
00345                         header->TDUCreate = 0.0;
00346                         header->TDUUpdate = 0.0;
00347                         header->HandSeed = strdup ("274");
00348                         header->UCSBase = strdup ("");
00349                         header->UCSOrthoRef = strdup ("");
00350                         header->UCSOrthoView = 0;
00351                         header->UCSOrgTop.x0 = 0.0;
00352                         header->UCSOrgTop.y0 = 0.0;
00353                         header->UCSOrgTop.z0 = 0.0;
00354                         header->UCSOrgBottom.x0 = 0.0;
00355                         header->UCSOrgBottom.y0 = 0.0;
00356                         header->UCSOrgBottom.z0 = 0.0;
00357                         header->UCSOrgLeft.x0 = 0.0;
00358                         header->UCSOrgLeft.y0 = 0.0;
00359                         header->UCSOrgLeft.z0 = 0.0;
00360                         header->UCSOrgRight.x0 = 0.0;
00361                         header->UCSOrgRight.y0 = 0.0;
00362                         header->UCSOrgRight.z0 = 0.0;
00363                         header->UCSOrgFront.x0 = 0.0;
00364                         header->UCSOrgFront.y0 = 0.0;
00365                         header->UCSOrgFront.z0 = 0.0;
00366                         header->UCSOrgBack.x0 = 0.0;
00367                         header->UCSOrgBack.y0 = 0.0;
00368                         header->UCSOrgBack.z0 = 0.0;
00369                         header->PUCSBase = strdup ("");
00370                         header->PUCSOrthoRef = strdup ("");
00371                         header->PUCSOrthoView = 0;
00372                         header->PUCSOrgTop.x0 = 0.0;
00373                         header->PUCSOrgTop.y0 = 0.0;
00374                         header->PUCSOrgTop.z0 = 0.0;
00375                         header->PUCSOrgBottom.x0 = 0.0;
00376                         header->PUCSOrgBottom.y0 = 0.0;
00377                         header->PUCSOrgBottom.z0 = 0.0;
00378                         header->PUCSOrgLeft.x0 = 0.0;
00379                         header->PUCSOrgLeft.y0 = 0.0;
00380                         header->PUCSOrgLeft.z0 = 0.0;
00381                         header->PUCSOrgRight.x0 = 0.0;
00382                         header->PUCSOrgRight.y0 = 0.0;
00383                         header->PUCSOrgRight.z0 = 0.0;
00384                         header->PUCSOrgFront.x0 = 0.0;
00385                         header->PUCSOrgFront.y0 = 0.0;
00386                         header->PUCSOrgFront.z0 = 0.0;
00387                         header->PUCSOrgBack.x0 = 0.0;
00388                         header->PUCSOrgBack.y0 = 0.0;
00389                         header->PUCSOrgBack.z0 = 0.0;
00390                         header->TreeDepth = 3020;
00391                         header->CMLStyle = strdup ("STANDARD");
00392                         header->CMLJust = 0;
00393                         header->CMLScale = 1.0;
00394                         header->ProxyGraphics = 1;
00395                         header->Measurement = 0;
00396                         header->CELWeight = -1;
00397                         header->EndCaps = 0;
00398                         header->JoinStyle = 0;
00399                         header->LWDisplay = 0;
00400                         header->InsUnits = 0;
00401                         header->HyperLinkBase = strdup ("");
00402                         header->StyleSheet = strdup ("");
00403                         header->XEdit = 1;
00404                         header->CEPSNType = 0;
00405                         header->PStyleMode = 1;
00406                         header->FingerPrintGUID = strdup ("");
00407                         header->VersionGUID = strdup ("");
00408                         header->ExtNames = 0;
00409                         header->PSVPScale = 0.0;
00410                         header->OLEStartUp = 0;
00411                 }
00412                 case AC1018: /* AutoCAD 2004 */
00413                 {
00414                         header->AcadMaintVer = 0;
00415                         header->DWGCodePage = strdup ("ANSI_1252");
00416                         header->CELTScale = 1.0;
00417                         header->DispSilH = 0;
00418                         header->DimJUST = 0;
00419                         header->DimSD1 = 0;
00420                         header->DimSD2 = 0;
00421                         header->DimTOLJ = 1;
00422                         header->DimTZIN = 0;
00423                         header->DimALTZ = 0;
00424                         header->DimALTTZ = 0;
00425                         header->DimUPT = 0;
00426                         header->DimDEC = 4;
00427                         header->DimTDEC = 4;
00428                         header->DimALTU = 2;
00429                         header->DimALTTD = 2;
00430                         header->DimTXSTY = strdup ("STANDARD");
00431                         header->DimAUNIT = 0;
00432                         header->DimADEC = 0;
00433                         header->DimALTRND = 0.0;
00434                         header->DimAZIN = 0;
00435                         header->DimDSEP = 46;
00436                         header->DimATFIT = 3;
00437                         header->DimFRAC = 0;
00438                         header->DimLDRBLK = strdup ("");
00439                         header->DimLUNIT = 2;
00440                         header->DimLWD = -2;
00441                         header->DimLWE = -2;
00442                         header->DimTMOVE = 0;
00443                         header->ChamferC = 10.0;
00444                         header->ChamferD = 10.0;
00445                         header->TDUCreate = 0.0;
00446                         header->TDUUpdate = 0.0;
00447                         header->HandSeed = strdup ("26A");
00448                         header->UCSBase = strdup ("");
00449                         header->UCSOrthoRef = strdup ("");
00450                         header->UCSOrthoView = 0;
00451                         header->UCSOrgTop.x0 = 0.0;
00452                         header->UCSOrgTop.y0 = 0.0;
00453                         header->UCSOrgTop.z0 = 0.0;
00454                         header->UCSOrgBottom.x0 = 0.0;
00455                         header->UCSOrgBottom.y0 = 0.0;
00456                         header->UCSOrgBottom.z0 = 0.0;
00457                         header->UCSOrgLeft.x0 = 0.0;
00458                         header->UCSOrgLeft.y0 = 0.0;
00459                         header->UCSOrgLeft.z0 = 0.0;
00460                         header->UCSOrgRight.x0 = 0.0;
00461                         header->UCSOrgRight.y0 = 0.0;
00462                         header->UCSOrgRight.z0 = 0.0;
00463                         header->UCSOrgFront.x0 = 0.0;
00464                         header->UCSOrgFront.y0 = 0.0;
00465                         header->UCSOrgFront.z0 = 0.0;
00466                         header->UCSOrgBack.x0 = 0.0;
00467                         header->UCSOrgBack.y0 = 0.0;
00468                         header->UCSOrgBack.z0 = 0.0;
00469                         header->PUCSBase = strdup ("");
00470                         header->PUCSOrthoRef = strdup ("");
00471                         header->PUCSOrthoView = 0;
00472                         header->PUCSOrgTop.x0 = 0.0;
00473                         header->PUCSOrgTop.y0 = 0.0;
00474                         header->PUCSOrgTop.z0 = 0.0;
00475                         header->PUCSOrgBottom.x0 = 0.0;
00476                         header->PUCSOrgBottom.y0 = 0.0;
00477                         header->PUCSOrgBottom.z0 = 0.0;
00478                         header->PUCSOrgLeft.x0 = 0.0;
00479                         header->PUCSOrgLeft.y0 = 0.0;
00480                         header->PUCSOrgLeft.z0 = 0.0;
00481                         header->PUCSOrgRight.x0 = 0.0;
00482                         header->PUCSOrgRight.y0 = 0.0;
00483                         header->PUCSOrgRight.z0 = 0.0;
00484                         header->PUCSOrgFront.x0 = 0.0;
00485                         header->PUCSOrgFront.y0 = 0.0;
00486                         header->PUCSOrgFront.z0 = 0.0;
00487                         header->PUCSOrgBack.x0 = 0.0;
00488                         header->PUCSOrgBack.y0 = 0.0;
00489                         header->PUCSOrgBack.z0 = 0.0;
00490                         header->TreeDepth = 3020;
00491                         header->CMLStyle = strdup ("STANDARD");
00492                         header->CMLJust = 0;
00493                         header->CMLScale = 1.0;
00494                         header->ProxyGraphics = 1;
00495                         header->Measurement = 0;
00496                         header->CELWeight = -1;
00497                         header->EndCaps = 0;
00498                         header->JoinStyle = 0;
00499                         header->LWDisplay = 0;
00500                         header->InsUnits = 0;
00501                         header->HyperLinkBase = strdup ("");
00502                         header->StyleSheet = strdup ("");
00503                         header->XEdit = 1;
00504                         header->CEPSNType = 0;
00505                         header->PStyleMode = 1;
00506                         header->FingerPrintGUID = strdup ("");
00507                         header->VersionGUID = strdup ("");
00508                         header->ExtNames = 0;
00509                         header->PSVPScale = 0.0;
00510                         header->OLEStartUp = 0;
00511                         header->SortEnts = 127;
00512                         header->IndexCtl = 0;
00513                         header->HideText = 0;
00514                         header->XClipFrame = 0;
00515                         header->HaloGap = 0;
00516                         header->ObsColor = 257;
00517                         header->ObsLType = 0;
00518                         header->InterSectionDisplay = 0;
00519                         header->InterSectionColor = 257;
00520                         header->DimASSOC = 1;
00521                         header->ProjectName = strdup ("");
00522                 }
00523         }
00524         header->AcadVer = strdup (dxf_header_acad_version_to_string (acad_version_number));
00525         header->InsBase.x0 = 0.0;
00526         header->InsBase.y0 = 0.0;
00527         header->InsBase.z0 = 0.0;
00528         header->ExtMin.x0 = 0.0;
00529         header->ExtMin.y0 = 0.0;
00530         header->ExtMin.z0 = 0.0;
00531         header->ExtMax.x0 = 0.0;
00532         header->ExtMax.y0 = 0.0;
00533         header->ExtMax.z0 = 0.0;
00534         header->LimMin.x0 = 0.0;
00535         header->LimMin.y0 = 0.0;
00536         header->LimMax.x0 = 0.0;
00537         header->LimMax.y0 = 0.0;
00538         header->OrthoMode = 0;
00539         header->RegenMode = 0;
00540         header->FillMode = 1;
00541         header->QTextMode = 0;
00542         header->MirrText = 1;
00543         header->LTScale = 1.0;
00544         header->AttMode = 1;
00545         header->TextSize = 2.5;
00546         header->TraceWid = 1.0;
00547         header->TextStyle = strdup ("STANDARD");
00548         header->CELType = strdup ("BYLAYER");
00549         header->CLayer = strdup ("0");
00550         header->CEColor = 256;
00551         header->DimSCALE = 1.0;
00552         header->DimASZ = 2.5;
00553         header->DimEXO = 0.625;
00554         header->DimDLI = 3.75;
00555         header->DimRND = 0.0;
00556         header->DimDLE = 0.0;
00557         header->DimEXE = 1.25;
00558         header->DimTP = 0.0;
00559         header->DimTM = 0.0;
00560         header->DimTXT = 2.5;
00561         header->DimCEN = 2.5;
00562         header->DimTSZ = 0.0;
00563         header->DimTOL = 0;
00564         header->DimLIM = 0;
00565         header->DimTIH = 0;
00566         header->DimTOH = 0;
00567         header->DimSE1 = 0;
00568         header->DimSE2 = 0;
00569         header->DimTAD = 1;
00570         header->DimZIN = 8;
00571         header->DimBLK = strdup ("");
00572         header->DimASO = 1;
00573         header->DimSHO = 1;
00574         header->DimPOST = strdup ("");
00575         header->DimAPOST = strdup ("");
00576         header->DimALT = 0;
00577         header->DimALTD = 4;
00578         header->DimALTF = 0.0394;
00579         header->DimLFAC = 1.0;
00580         header->DimTOFL = 1;
00581         header->DimTVP = 0.0;
00582         header->DimTIX = 0;
00583         header->DimSOXD = 0;
00584         header->DimSAH = 0;
00585         header->DimBLK1 = strdup ("");
00586         header->DimBLK2 = strdup ("");
00587         header->DimCLRD = 0;
00588         header->DimCLRE = 0;
00589         header->DimCLRT = 0;
00590         header->DimTFAC = 1.0;
00591         header->DimGAP = 0.625;
00592         header->LUnits = 2;
00593         header->LUPrec = 4;
00594         header->Sketchinc = 1.0;
00595         header->FilletRad = 1.0;
00596         header->AUnits = 0;
00597         header->AUPrec = 0;
00598         header->Menu = strdup (".");
00599         header->Elevation = 0.0;
00600         header->PElevation = 0.0;
00601         header->Thickness = 0.0;
00602         header->LimCheck = 0;
00603         header->ChamferA = 10.0;
00604         header->ChamferB = 10.0;
00605         header->SKPoly = 0;
00606         header->TDCreate = 0.0;
00607         header->TDUpdate = 0.0;
00608         header->TDInDWG = 0.0;
00609         header->TDUSRTimer = 0.0;
00610         header->USRTimer = 1;
00611         header->AngBase = 0.0;
00612         header->AngDir = 0;
00613         header->PDMode = 98;
00614         header->PDSize = 0.0;
00615         header->PLineWid = 0.0;
00616         header->SPLFrame = 0;
00617         header->SPLineType = 6;
00618         header->SPLineSegs = 8;
00619         header->SurfTab1 = 6;
00620         header->SurfTab2 = 6;
00621         header->SurfType = 6;
00622         header->SurfU = 6;
00623         header->SurfV = 6;
00624         header->UCSName = strdup ("");
00625         header->UCSOrg.x0 = 0.0;
00626         header->UCSOrg.y0 = 0.0;
00627         header->UCSOrg.z0 = 0.0;
00628         header->UCSXDir.x0 = 0.0;
00629         header->UCSXDir.y0 = 0.0;
00630         header->UCSXDir.z0 = 0.0;
00631         header->UCSYDir.x0 = 0.0;
00632         header->UCSYDir.y0 = 0.0;
00633         header->UCSYDir.z0 = 0.0;
00634         header->PUCSName = strdup ("");
00635         header->PUCSOrg.x0 = 0.0;
00636         header->PUCSOrg.y0 = 0.0;
00637         header->PUCSOrg.z0 = 0.0;
00638         header->PUCSXDir.x0 = 0.0;
00639         header->PUCSXDir.y0 = 0.0;
00640         header->PUCSXDir.z0 = 0.0;
00641         header->PUCSYDir.x0 = 0.0;
00642         header->PUCSYDir.y0 = 0.0;
00643         header->PUCSYDir.z0 = 0.0;
00644         header->UserI1 = 0;
00645         header->UserI2 = 0;
00646         header->UserI3 = 0;
00647         header->UserI4 = 0;
00648         header->UserI5 = 0;
00649         header->UserR1 = 0.0;
00650         header->UserR2 = 0.0;
00651         header->UserR3 = 0.0;
00652         header->UserR4 = 0.0;
00653         header->UserR5 = 0.0;
00654         header->WorldView = 0;
00655         header->ShadEdge = 3;
00656         header->ShadeDif = 70;
00657         header->TileMode = 1;
00658         header->MaxActVP = 48;
00659         header->PInsBase.x0 = 0.0;
00660         header->PInsBase.y0 = 0.0;
00661         header->PInsBase.z0 = 0.0;
00662         header->PLimCheck = 0;
00663         header->PExtMin.x0 = 0.0;
00664         header->PExtMin.y0 = 0.0;
00665         header->PExtMin.z0 = 0.0;
00666         header->PExtMax.x0 = 0.0;
00667         header->PExtMax.y0 = 0.0;
00668         header->PExtMax.z0 = 0.0;
00669         header->PLimMin.x0 = 0.0;
00670         header->PLimMin.y0 = 0.0;
00671         header->PLimMax.x0 = 0.0;
00672         header->PLimMax.y0 = 0.0;
00673         header->UnitMode = 0;
00674         header->VisRetain = 1;
00675         header->PLineGen = 0;
00676         header->PSLTScale = 1;
00677 #if DEBUG
00678         DXF_DEBUG_END
00679 #endif
00680         return (header);
00681 }
00682 
00683 
00709 int
00710 dxf_header_write_metric_new
00711 (
00712         DxfFile *fp
00714 )
00715 {
00716 #if DEBUG
00717         DXF_DEBUG_BEGIN
00718 #endif
00719         int JD;
00720         float fraction_day;
00721 
00722         /* Do some basic checks. */
00723         if (fp == NULL)
00724         {
00725                 fprintf (stderr,
00726                   (_("Error in %s () a NULL file pointer was passed.\n")),
00727                   __FUNCTION__);
00728                 return (EXIT_FAILURE);
00729         }
00730         fprintf (fp->fp, "  0\nSECTION\n");
00731         fprintf (fp->fp, "  2\nHEADER\n");
00732         fprintf (fp->fp, "  9\n$ACADVER\n  1\nAC1014\n");
00733         fprintf (fp->fp, "  9\n$ACADMAINTVER\n 70\n     0\n");
00734         fprintf (fp->fp, "  9\n$DWGCODEPAGE\n  3\nANSI_1252\n");
00735         fprintf (fp->fp, "  9\n$INSBASE\n 10\n0.0\n 20\n0.0\n 30\n0.0\n");
00736         fprintf (fp->fp, "  9\n$EXTMIN\n 10\n-0.012816\n 20\n-0.009063\n 30\n-0.001526\n");
00737         fprintf (fp->fp, "  9\n$EXTMAX\n 10\n88.01056\n 20\n35.022217\n 30\n0.0\n");
00738         fprintf (fp->fp, "  9\n$LIMMIN\n 10\n0.0\n 20\n0.0\n");
00739         fprintf (fp->fp, "  9\n$LIMMAX\n 10\n420.0\n 20\n297.0\n");
00740         fprintf (fp->fp, "  9\n$ORTHOMODE\n 70\n     0\n");
00741         fprintf (fp->fp, "  9\n$REGENMODE\n 70\n     1\n");
00742         fprintf (fp->fp, "  9\n$FILLMODE\n 70\n     1\n");
00743         fprintf (fp->fp, "  9\n$QTEXTMODE\n 70\n     0\n");
00744         fprintf (fp->fp, "  9\n$MIRRTEXT\n 70\n     1\n");
00745         fprintf (fp->fp, "  9\n$DRAGMODE\n 70\n     2\n");
00746         fprintf (fp->fp, "  9\n$LTSCALE\n 40\n1.0\n");
00747         fprintf (fp->fp, "  9\n$OSMODE\n 70\n   125\n");
00748         fprintf (fp->fp, "  9\n$ATTMODE\n 70\n     1\n");
00749         fprintf (fp->fp, "  9\n$TEXTSIZE\n 40\n2.5\n");
00750         fprintf (fp->fp, "  9\n$TRACEWID\n 40\n1.0\n");
00751         fprintf (fp->fp, "  9\n$TEXTSTYLE\n  7\nSTANDARD\n");
00752         fprintf (fp->fp, "  9\n$CLAYER\n  8\n0\n");
00753         fprintf (fp->fp, "  9\n$CELTYPE\n  6\nBYLAYER\n");
00754         fprintf (fp->fp, "  9\n$CECOLOR\n 62\n   256\n");
00755         fprintf (fp->fp, "  9\n$CELTSCALE\n 40\n1.0\n");
00756         fprintf (fp->fp, "  9\n$DELOBJ\n 70\n     1\n");
00757         fprintf (fp->fp, "  9\n$DISPSILH\n 70\n     0\n");
00758         fprintf (fp->fp, "  9\n$DIMSCALE\n 40\n1.0\n");
00759         fprintf (fp->fp, "  9\n$DIMASZ\n 40\n2.5\n");
00760         fprintf (fp->fp, "  9\n$DIMEXO\n 40\n0.625\n");
00761         fprintf (fp->fp, "  9\n$DIMDLI\n 40\n3.75\n");
00762         fprintf (fp->fp, "  9\n$DIMRND\n 40\n0.0\n");
00763         fprintf (fp->fp, "  9\n$DIMDLE\n 40\n0.0\n");
00764         fprintf (fp->fp, "  9\n$DIMEXE\n 40\n1.25\n");
00765         fprintf (fp->fp, "  9\n$DIMTP\n 40\n0.0\n");
00766         fprintf (fp->fp, "  9\n$DIMTM\n 40\n0.0\n");
00767         fprintf (fp->fp, "  9\n$DIMTXT\n 40\n2.5\n");
00768         fprintf (fp->fp, "  9\n$DIMCEN\n 40\n2.5\n");
00769         fprintf (fp->fp, "  9\n$DIMTSZ\n 40\n0.0\n");
00770         fprintf (fp->fp, "  9\n$DIMTOL\n 70\n     0\n");
00771         fprintf (fp->fp, "  9\n$DIMLIM\n 70\n     0\n");
00772         fprintf (fp->fp, "  9\n$DIMTIH\n 70\n     0\n");
00773         fprintf (fp->fp, "  9\n$DIMTOH\n 70\n     0\n");
00774         fprintf (fp->fp, "  9\n$DIMSE1\n 70\n     0\n");
00775         fprintf (fp->fp, "  9\n$DIMSE2\n 70\n     0\n");
00776         fprintf (fp->fp, "  9\n$DIMTAD\n 70\n     1\n");
00777         fprintf (fp->fp, "  9\n$DIMZIN\n 70\n     8\n");
00778         fprintf (fp->fp, "  9\n$DIMBLK\n  1\n\n");
00779         fprintf (fp->fp, "  9\n$DIMASO\n 70\n     1\n");
00780         fprintf (fp->fp, "  9\n$DIMSHO\n 70\n     1\n");
00781         fprintf (fp->fp, "  9\n$DIMPOST\n  1\n\n");
00782         fprintf (fp->fp, "  9\n$DIMAPOST\n  1\n\n");
00783         fprintf (fp->fp, "  9\n$DIMALT\n 70\n     0\n");
00784         fprintf (fp->fp, "  9\n$DIMALTD\n 70\n     4\n");
00785         fprintf (fp->fp, "  9\n$DIMALTF\n 40\n0.0394\n");
00786         fprintf (fp->fp, "  9\n$DIMLFAC\n 40\n1.0\n");
00787         fprintf (fp->fp, "  9\n$DIMTOFL\n 70\n     1\n");
00788         fprintf (fp->fp, "  9\n$DIMTVP\n 40\n0.0\n");
00789         fprintf (fp->fp, "  9\n$DIMTIX\n 70\n     0\n");
00790         fprintf (fp->fp, "  9\n$DIMSOXD\n 70\n     0\n");
00791         fprintf (fp->fp, "  9\n$DIMSAH\n 70\n     0\n");
00792         fprintf (fp->fp, "  9\n$DIMBLK1\n  1\n\n");
00793         fprintf (fp->fp, "  9\n$DIMBLK2\n  1\n\n");
00794         fprintf (fp->fp, "  9\n$DIMSTYLE\n  2\nSTANDARD\n");
00795         fprintf (fp->fp, "  9\n$DIMCLRD\n 70\n     0\n");
00796         fprintf (fp->fp, "  9\n$DIMCLRE\n 70\n     0\n");
00797         fprintf (fp->fp, "  9\n$DIMCLRT\n 70\n     0\n");
00798         fprintf (fp->fp, "  9\n$DIMTFAC\n 40\n1.0\n");
00799         fprintf (fp->fp, "  9\n$DIMGAP\n 40\n0.625\n");
00800         fprintf (fp->fp, "  9\n$DIMJUST\n 70\n     0\n");
00801         fprintf (fp->fp, "  9\n$DIMSD1\n 70\n     0\n");
00802         fprintf (fp->fp, "  9\n$DIMSD2\n 70\n     0\n");
00803         fprintf (fp->fp, "  9\n$DIMTOLJ\n 70\n     1\n");
00804         fprintf (fp->fp, "  9\n$DIMTZIN\n 70\n     0\n");
00805         fprintf (fp->fp, "  9\n$DIMALTZ\n 70\n     0\n");
00806         fprintf (fp->fp, "  9\n$DIMALTTZ\n 70\n     0\n");
00807         fprintf (fp->fp, "  9\n$DIMFIT\n 70\n     3\n");
00808         fprintf (fp->fp, "  9\n$DIMUPT\n 70\n     0\n");
00809         fprintf (fp->fp, "  9\n$DIMUNIT\n 70\n     2\n");
00810         fprintf (fp->fp, "  9\n$DIMDEC\n 70\n     4\n");
00811         fprintf (fp->fp, "  9\n$DIMTDEC\n 70\n     4\n");
00812         fprintf (fp->fp, "  9\n$DIMALTU\n 70\n     2\n");
00813         fprintf (fp->fp, "  9\n$DIMALTTD\n 70\n     2\n");
00814         fprintf (fp->fp, "  9\n$DIMTXSTY\n  7\nSTANDARD\n");
00815         fprintf (fp->fp, "  9\n$DIMAUNIT\n 70\n     0\n");
00816         fprintf (fp->fp, "  9\n$LUNITS\n 70\n     2\n");
00817         fprintf (fp->fp, "  9\n$LUPREC\n 70\n     4\n");
00818         fprintf (fp->fp, "  9\n$SKETCHINC\n 40\n1.0\n");
00819         fprintf (fp->fp, "  9\n$FILLETRAD\n 40\n1.0\n");
00820         fprintf (fp->fp, "  9\n$AUNITS\n 70\n     0\n");
00821         fprintf (fp->fp, "  9\n$AUPREC\n 70\n     0\n");
00822         fprintf (fp->fp, "  9\n$MENU\n  1\n.\n");
00823         fprintf (fp->fp, "  9\n$ELEVATION\n 40\n0.0\n");
00824         fprintf (fp->fp, "  9\n$PELEVATION\n 40\n0.0\n");
00825         fprintf (fp->fp, "  9\n$THICKNESS\n 40\n0.0\n");
00826         fprintf (fp->fp, "  9\n$LIMCHECK\n 70\n     0\n");
00827         fprintf (fp->fp, "  9\n$BLIPMODE\n 70\n     0\n");
00828         fprintf (fp->fp, "  9\n$CHAMFERA\n 40\n10.0\n");
00829         fprintf (fp->fp, "  9\n$CHAMFERB\n 40\n10.0\n");
00830         fprintf (fp->fp, "  9\n$CHAMFERC\n 40\n0.0\n");
00831         fprintf (fp->fp, "  9\n$CHAMFERD\n 40\n0.0\n");
00832         fprintf (fp->fp, "  9\n$SKPOLY\n 70\n     0\n");
00833         time_t now;
00834         if (time(&now) != (time_t)(-1))
00835         {
00836             struct tm *current_time = localtime(&now);
00837 
00838             JD=current_time->tm_mday-32075+1461*(current_time->tm_year+6700+(current_time->tm_mon-13)/12)/4+367*(current_time->tm_mon-1-(current_time->tm_mon-13)/12*12)/12-3*((current_time->tm_year+6800+(current_time->tm_mon-13)/12)/100)/4;
00839             /* Transforms the current local gregorian date in a julian date.*/
00840 
00841             fraction_day=(current_time->tm_hour+(current_time->tm_min/60.0)+(current_time->tm_sec/3600.0))/24.0;
00842             /* Transforms the current local clock time in fraction of day.*/
00843 
00844             fprintf (fp->fp, "  9\n$TDCREATE\n 40\n%7.9f\n", JD+fraction_day);
00845             fprintf (fp->fp, "  9\n$TDUPDATE\n 40\n%7.9f\n", JD+fraction_day);
00846         }
00847         fprintf (fp->fp, "  9\n$TDINDWG\n 40\n0.0000000000\n");
00848         fprintf (fp->fp, "  9\n$TDUSRTIMER\n 40\n0.0000000000\n");
00849         /* In a new DXF file, $TDINDWG and $TDUSERTIMER are always 0, can change the decimal precision in according to the DXF version.*/
00850         fprintf (fp->fp, "  9\n$USRTIMER\n 70\n     1\n");
00851         fprintf (fp->fp, "  9\n$ANGBASE\n 50\n0.0\n");
00852         fprintf (fp->fp, "  9\n$ANGDIR\n 70\n     0\n");
00853         fprintf (fp->fp, "  9\n$PDMODE\n 70\n    98\n");
00854         fprintf (fp->fp, "  9\n$PDSIZE\n 40\n0.0\n");
00855         fprintf (fp->fp, "  9\n$PLINEWID\n 40\n0.0\n");
00856         fprintf (fp->fp, "  9\n$COORDS\n 70\n     2\n");
00857         fprintf (fp->fp, "  9\n$SPLFRAME\n 70\n     0\n");
00858         fprintf (fp->fp, "  9\n$SPLINETYPE\n 70\n     6\n");
00859         fprintf (fp->fp, "  9\n$SPLINESEGS\n 70\n     8\n");
00860         fprintf (fp->fp, "  9\n$ATTDIA\n 70\n     0\n");
00861         fprintf (fp->fp, "  9\n$ATTREQ\n 70\n     1\n");
00862         fprintf (fp->fp, "  9\n$HANDLING\n 70\n     1\n");
00863         fprintf (fp->fp, "  9\n$HANDSEED\n  5\n262\n");
00864         fprintf (fp->fp, "  9\n$SURFTAB1\n 70\n     6\n");
00865         fprintf (fp->fp, "  9\n$SURFTAB2\n 70\n     6\n");
00866         fprintf (fp->fp, "  9\n$SURFTYPE\n 70\n     6\n");
00867         fprintf (fp->fp, "  9\n$SURFU\n 70\n     6\n");
00868         fprintf (fp->fp, "  9\n$SURFV\n 70\n     6\n");
00869         fprintf (fp->fp, "  9\n$UCSNAME\n  2\n\n");
00870         fprintf (fp->fp, "  9\n$UCSORG\n 10\n0.0\n 20\n0.0\n 30\n0.0\n");
00871         fprintf (fp->fp, "  9\n$UCSXDIR\n 10\n1.0\n 20\n0.0\n 30\n0.0\n");
00872         fprintf (fp->fp, "  9\n$UCSYDIR\n 10\n0.0\n 20\n1.0\n 30\n0.0\n");
00873         fprintf (fp->fp, "  9\n$PUCSNAME\n  2\n\n");
00874         fprintf (fp->fp, "  9\n$PUCSORG\n 10\n0.0\n 20\n0.0\n 30\n0.0\n");
00875         fprintf (fp->fp, "  9\n$PUCSXDIR\n 10\n1.0\n 20\n0.0\n 30\n0.0\n");
00876         fprintf (fp->fp, "  9\n$PUCSYDIR\n 10\n0.0\n 20\n1.0\n 30\n0.0\n");
00877         fprintf (fp->fp, "  9\n$USERI1\n 70\n     0\n");
00878         fprintf (fp->fp, "  9\n$USERI2\n 70\n     0\n");
00879         fprintf (fp->fp, "  9\n$USERI3\n 70\n     0\n");
00880         fprintf (fp->fp, "  9\n$USERI4\n 70\n     0\n");
00881         fprintf (fp->fp, "  9\n$USERI5\n 70\n     0\n");
00882         fprintf (fp->fp, "  9\n$USERR1\n 40\n0.0\n");
00883         fprintf (fp->fp, "  9\n$USERR2\n 40\n0.0\n");
00884         fprintf (fp->fp, "  9\n$USERR3\n 40\n0.0\n");
00885         fprintf (fp->fp, "  9\n$USERR4\n 40\n0.0\n");
00886         fprintf (fp->fp, "  9\n$USERR5\n 40\n0.0\n");
00887         fprintf (fp->fp, "  9\n$WORLDVIEW\n 70\n     1\n");
00888         fprintf (fp->fp, "  9\n$SHADEDGE\n 70\n     3\n");
00889         fprintf (fp->fp, "  9\n$SHADEDIF\n 70\n    70\n");
00890         fprintf (fp->fp, "  9\n$TILEMODE\n 70\n     1\n");
00891         fprintf (fp->fp, "  9\n$MAXACTVP\n 70\n    48\n");
00892         fprintf (fp->fp, "  9\n$PINSBASE\n 10\n0.0\n 20\n0.0\n 30\n0.0\n");
00893         fprintf (fp->fp, "  9\n$PLIMCHECK\n 70\n     0\n");
00894         fprintf (fp->fp, "  9\n$PEXTMIN\n 10\n1.000000E+20\n 20\n1.000000E+20\n 30\n1.000000E+20\n");
00895         fprintf (fp->fp, "  9\n$PEXTMAX\n 10\n-1.000000E+20\n 20\n-1.000000E+20\n 30\n-1.000000E+20\n");
00896         fprintf (fp->fp, "  9\n$PLIMMIN\n 10\n0.0\n 20\n0.0\n");
00897         fprintf (fp->fp, "  9\n$PLIMMAX\n 10\n420.0\n 20\n297.0");
00898         fprintf (fp->fp, "  9\n$UNITMODE\n 70\n     0\n");
00899         fprintf (fp->fp, "  9\n$VISRETAIN\n 70\n     1\n");
00900         fprintf (fp->fp, "  9\n$PLINEGEN\n 70\n     0\n");
00901         fprintf (fp->fp, "  9\n$PSLTSCALE\n 70\n     1\n");
00902         fprintf (fp->fp, "  9\n$TREEDEPTH\n 70\n  3020\n");
00903         fprintf (fp->fp, "  9\n$PICKSTYLE\n 70\n     1\n");
00904         fprintf (fp->fp, "  9\n$CMLSTYLE\n  2\nSTANDARD\n");
00905         fprintf (fp->fp, "  9\n$CMLJUST\n 70\n     0\n");
00906         fprintf (fp->fp, "  9\n$CMLSCALE\n 40\n1.0\n");
00907         fprintf (fp->fp, "  9\n$PROXYGRAPHICS\n 70\n     1\n");
00908         fprintf (fp->fp, "  9\n$MEASUREMENT\n 70\n     0\n");
00909         fprintf (fp->fp, "  0\nENDSEC\n");
00910 #if DEBUG
00911         DXF_DEBUG_END
00912 #endif
00913         return (EXIT_SUCCESS);
00914 }
00915 
00916 
00920 int
00921 dxf_header_write
00922 (
00923         DxfFile *fp,
00925         DxfHeader *header
00927 )
00928 {
00929 #if DEBUG
00930         DXF_DEBUG_BEGIN
00931 #endif
00932         char *dxf_entity_name = strdup ("HEADER");
00933 
00934         /* Do some basic checks. */
00935         if (fp == NULL)
00936         {
00937                 fprintf (stderr,
00938                   (_("Error in %s () a NULL file pointer was passed.\n")),
00939                   __FUNCTION__);
00940                 /* Clean up. */
00941                 free (dxf_entity_name);
00942                 return (EXIT_FAILURE);
00943         }
00944         if (header == NULL)
00945         {
00946                 fprintf (stderr,
00947                   (_("Error in %s () a NULL pointer was passed.\n")),
00948                   __FUNCTION__);
00949                 /* Clean up. */
00950                 free (dxf_entity_name);
00951                 return (EXIT_FAILURE);
00952         }
00953         dxf_section_write (fp, dxf_entity_name);
00954         fprintf (fp->fp, "  9\n$ACADVER\n  1\n%s\n", header->AcadVer);
00955         if (fp->acad_version_number >= AC1014) fprintf (fp->fp, "  9\n$ACADMAINTVER\n 70\n%i\n", header->AcadMaintVer);
00956         if (fp->acad_version_number >= AC1012) fprintf (fp->fp, "  9\n$DWGCODEPAGE\n  3\n%s\n", header->DWGCodePage);
00957         if (fp->acad_version_number >= AC1018) fprintf (fp->fp, "  9\n$LASTSAVEDBY\n  1\n%s\n", getenv("USER"));
00958         fprintf (fp->fp, "  9\n$INSBASE\n 10\n%f\n 20\n%f\n 30\n%f\n", header->InsBase.x0, header->InsBase.y0, header->InsBase.z0);
00959         fprintf (fp->fp, "  9\n$EXTMIN\n 10\n%f\n 20\n%f\n 30\n%f\n", header->ExtMin.x0, header->ExtMin.y0, header->ExtMin.z0);
00960         fprintf (fp->fp, "  9\n$EXTMAX\n 10\n%f\n 20\n%f\n 30\n%f\n", header->ExtMax.x0, header->ExtMax.y0, header->ExtMax.z0);
00961         fprintf (fp->fp, "  9\n$LIMMIN\n 10\n%f\n 20\n%f\n", header->LimMin.x0, header->LimMin.y0);
00962         fprintf (fp->fp, "  9\n$LIMMAX\n 10\n%f\n 20\n%f\n", header->LimMax.x0, header->LimMax.y0);
00963         fprintf (fp->fp, "  9\n$ORTHOMODE\n 70\n%i\n", header->OrthoMode);
00964         fprintf (fp->fp, "  9\n$REGENMODE\n 70\n%i\n", header->RegenMode);
00965         fprintf (fp->fp, "  9\n$FILLMODE\n 70\n%i\n", header->FillMode);
00966         fprintf (fp->fp, "  9\n$QTEXTMODE\n 70\n%i\n", header->QTextMode);
00967         fprintf (fp->fp, "  9\n$MIRRTEXT\n 70\n%i\n", header->MirrText);
00968         if (fp->acad_version_number <= AC1015) fprintf (fp->fp, "  9\n$DRAGMODE\n 70\n%i\n", header->DragMode);
00969         fprintf (fp->fp, "  9\n$LTSCALE\n 40\n%f\n", header->LTScale);
00970         if (fp->acad_version_number <= AC1014) fprintf (fp->fp, "  9\n$OSMODE\n 70\n%i\n", header->OSMode);
00971         fprintf (fp->fp, "  9\n$ATTMODE\n 70\n%i\n", header->AttMode);
00972         fprintf (fp->fp, "  9\n$TEXTSIZE\n 40\n%f\n", header->TextSize);
00973         fprintf (fp->fp, "  9\n$TRACEWID\n 40\n%f\n", header->TraceWid);
00974         fprintf (fp->fp, "  9\n$TEXTSTYLE\n  7\n%s\n", header->TextStyle);
00975         fprintf (fp->fp, "  9\n$CLAYER\n  8\n%s\n", header->CLayer);
00976         fprintf (fp->fp, "  9\n$CELTYPE\n  6\n%s\n", header->CELType);
00977         fprintf (fp->fp, "  9\n$CECOLOR\n 62\n%i\n", header->CEColor);
00978         if (fp->acad_version_number >= AC1012) fprintf (fp->fp, "  9\n$CELTSCALE\n 40\n%f\n", header->CELTScale);
00979         if ((fp->acad_version_number == AC1012)
00980           || (fp->acad_version_number == AC1014)) fprintf (fp->fp, "  9\n$DELOBJ\n 70\n%i\n", header->DelObj);
00981         if (fp->acad_version_number <= AC1012) fprintf (fp->fp, "  9\n$DISPSILH\n 70\n%i\n", header->DispSilH);
00982         fprintf (fp->fp, "  9\n$DIMSCALE\n 40\n%f\n", header->DimSCALE);
00983         fprintf (fp->fp, "  9\n$DIMASZ\n 40\n%f\n", header->DimASZ);
00984         fprintf (fp->fp, "  9\n$DIMEXO\n 40\n%f\n", header->DimEXO);
00985         fprintf (fp->fp, "  9\n$DIMDLI\n 40\n%f\n", header->DimDLI);
00986         fprintf (fp->fp, "  9\n$DIMRND\n 40\n%f\n", header->DimRND);
00987         fprintf (fp->fp, "  9\n$DIMDLE\n 40\n%f\n", header->DimDLE);
00988         fprintf (fp->fp, "  9\n$DIMEXE\n 40\n%f\n", header->DimEXE);
00989         fprintf (fp->fp, "  9\n$DIMTP\n 40\n%f\n", header->DimTP);
00990         fprintf (fp->fp, "  9\n$DIMTM\n 40\n%f\n", header->DimTM);
00991         fprintf (fp->fp, "  9\n$DIMTXT\n 40\n%f\n", header->DimTXT);
00992         fprintf (fp->fp, "  9\n$DIMCEN\n 40\n%f\n", header->DimCEN);
00993         fprintf (fp->fp, "  9\n$DIMTSZ\n 40\n%f\n", header->DimTSZ);
00994         fprintf (fp->fp, "  9\n$DIMTOL\n 70\n%i\n", header->DimTOL);
00995         fprintf (fp->fp, "  9\n$DIMLIM\n 70\n%i\n", header->DimLIM);
00996         fprintf (fp->fp, "  9\n$DIMTIH\n 70\n%i\n", header->DimTIH);
00997         fprintf (fp->fp, "  9\n$DIMTOH\n 70\n%i\n", header->DimTOH);
00998         fprintf (fp->fp, "  9\n$DIMSE1\n 70\n%i\n", header->DimSE1);
00999         fprintf (fp->fp, "  9\n$DIMSE2\n 70\n%i\n", header->DimSE2);
01000         fprintf (fp->fp, "  9\n$DIMTAD\n 70\n%i\n", header->DimTAD);
01001         fprintf (fp->fp, "  9\n$DIMZIN\n 70\n%i\n", header->DimZIN);
01002         fprintf (fp->fp, "  9\n$DIMBLK\n  1\n%s\n", header->DimBLK);
01003         fprintf (fp->fp, "  9\n$DIMASO\n 70\n%i\n", header->DimASO);
01004         fprintf (fp->fp, "  9\n$DIMSHO\n 70\n%i\n", header->DimSHO);
01005         fprintf (fp->fp, "  9\n$DIMPOST\n  1\n%s\n", header->DimPOST);
01006         fprintf (fp->fp, "  9\n$DIMAPOST\n  1\n%s\n", header->DimAPOST);
01007         fprintf (fp->fp, "  9\n$DIMALT\n 70\n%i\n", header->DimALT);
01008         fprintf (fp->fp, "  9\n$DIMALTD\n 70\n%i\n", header->DimALTD);
01009         fprintf (fp->fp, "  9\n$DIMALTF\n 40\n%f\n", header->DimALTF);
01010         fprintf (fp->fp, "  9\n$DIMLFAC\n 40\n%f\n", header->DimLFAC);
01011         fprintf (fp->fp, "  9\n$DIMTOFL\n 70\n%i\n", header->DimTOFL);
01012         fprintf (fp->fp, "  9\n$DIMTVP\n 40\n%f\n", header->DimTVP);
01013         fprintf (fp->fp, "  9\n$DIMTIX\n 70\n%i\n", header->DimTIX);
01014         fprintf (fp->fp, "  9\n$DIMSOXD\n 70\n%i\n", header->DimSOXD);
01015         fprintf (fp->fp, "  9\n$DIMSAH\n 70\n%i\n", header->DimSAH);
01016         fprintf (fp->fp, "  9\n$DIMBLK1\n  1\n%s\n", header->DimBLK1);
01017         fprintf (fp->fp, "  9\n$DIMBLK2\n  1\n%s\n", header->DimBLK2);
01018         fprintf (fp->fp, "  9\n$DIMSTYLE\n  2\n%s\n", header->DimSTYLE);
01019         fprintf (fp->fp, "  9\n$DIMCLRD\n 70\n%i\n", header->DimCLRD);
01020         fprintf (fp->fp, "  9\n$DIMCLRE\n 70\n%i\n", header->DimCLRE);
01021         fprintf (fp->fp, "  9\n$DIMCLRT\n 70\n%i\n", header->DimCLRT);
01022         fprintf (fp->fp, "  9\n$DIMTFAC\n 40\n%f\n", header->DimTFAC);
01023         fprintf (fp->fp, "  9\n$DIMGAP\n 40\n%f\n", header->DimGAP);
01024         if (fp->acad_version_number >= AC1012) fprintf (fp->fp, "  9\n$DIMJUST\n 70\n%i\n", header->DimJUST);
01025         if (fp->acad_version_number >= AC1012) fprintf (fp->fp, "  9\n$DIMSD1\n 70\n%i\n", header->DimSD1);
01026         if (fp->acad_version_number >= AC1012) fprintf (fp->fp, "  9\n$DIMSD2\n 70\n%i\n", header->DimSD2);
01027         if (fp->acad_version_number >= AC1012) fprintf (fp->fp, "  9\n$DIMTOLJ\n 70\n%i\n", header->DimTOLJ);
01028         if (fp->acad_version_number >= AC1012) fprintf (fp->fp, "  9\n$DIMTZIN\n 70\n%i\n", header->DimTZIN);
01029         if (fp->acad_version_number >= AC1012) fprintf (fp->fp, "  9\n$DIMALTZ\n 70\n%i\n", header->DimALTZ);
01030         if (fp->acad_version_number >= AC1012) fprintf (fp->fp, "  9\n$DIMALTTZ\n 70\n%i\n", header->DimALTTZ);
01031         if ((fp->acad_version_number == AC1012)
01032           || (fp->acad_version_number == AC1014)) fprintf (fp->fp, "  9\n$DIMFIT\n 70\n%i\n", header->DimFIT);
01033         if (fp->acad_version_number >= AC1012) fprintf (fp->fp, "  9\n$DIMUPT\n 70\n%i\n", header->DimUPT);
01034         if ((fp->acad_version_number == AC1012) ||
01035           (fp->acad_version_number == AC1014)) fprintf (fp->fp, "  9\n$DIMUNIT\n 70\n%i\n", header->DimUNIT);
01036         if (fp->acad_version_number >= AC1012) fprintf (fp->fp, "  9\n$DIMDEC\n 70\n%i\n", header->DimDEC);
01037         if (fp->acad_version_number >= AC1012) fprintf (fp->fp, "  9\n$DIMTDEC\n 70\n%i\n", header->DimTDEC);
01038         if (fp->acad_version_number >= AC1012) fprintf (fp->fp, "  9\n$DIMALTU\n 70\n%i\n", header->DimALTU);
01039         if (fp->acad_version_number >= AC1012) fprintf (fp->fp, "  9\n$DIMALTTD\n 70\n%i\n", header->DimALTTD);
01040         if (fp->acad_version_number >= AC1012) fprintf (fp->fp, "  9\n$DIMTXSTY\n  7\n%s\n", header->DimTXSTY);
01041         if (fp->acad_version_number >= AC1012) fprintf (fp->fp, "  9\n$DIMAUNIT\n 70\n%i\n", header->DimAUNIT);
01042         if (fp->acad_version_number >= AC1015) fprintf (fp->fp, "  9\n$DIMADEC\n 70\n%i\n", header->DimADEC);
01043         if (fp->acad_version_number >= AC1015) fprintf (fp->fp, "  9\n$DIMALTRND\n 40\n%f\n", header->DimALTRND);
01044         if (fp->acad_version_number >= AC1015) fprintf (fp->fp, "  9\n$DIMAZIN\n 70\n%i\n", header->DimAZIN);
01045         if (fp->acad_version_number >= AC1015) fprintf (fp->fp, "  9\n$DIMDSEP\n 70\n%i\n", header->DimDSEP);
01046         if (fp->acad_version_number >= AC1015) fprintf (fp->fp, "  9\n$DIMATFIT\n 70\n%i\n", header->DimATFIT);
01047         if (fp->acad_version_number >= AC1015) fprintf (fp->fp, "  9\n$DIMFRAC\n 70\n%i\n", header->DimFRAC);
01048         if (fp->acad_version_number >= AC1015) fprintf (fp->fp, "  9\n$DIMLDRBLK\n  1\n%s\n", header->DimLDRBLK);
01049         if (fp->acad_version_number >= AC1015) fprintf (fp->fp, "  9\n$DIMLUNIT\n 70\n%i\n", header->DimLUNIT);
01050         if (fp->acad_version_number >= AC1015) fprintf (fp->fp, "  9\n$DIMLWD\n 70\n%i\n", header->DimLWD);
01051         if (fp->acad_version_number >= AC1015) fprintf (fp->fp, "  9\n$DIMLWE\n 70\n%i\n", header->DimLWE);
01052         if (fp->acad_version_number >= AC1015) fprintf (fp->fp, "  9\n$DIMTMOVE\n 70\n%i\n", header->DimTMOVE);
01053         fprintf (fp->fp, "  9\n$LUNITS\n 70\n%i\n", header->LUnits);
01054         fprintf (fp->fp, "  9\n$LUPREC\n 70\n%i\n", header->LUPrec);
01055         fprintf (fp->fp, "  9\n$SKETCHINC\n 40\n%f\n", header->Sketchinc);
01056         fprintf (fp->fp, "  9\n$FILLETRAD\n 40\n%f\n", header->FilletRad);
01057         fprintf (fp->fp, "  9\n$AUNITS\n 70\n%i\n", header->AUnits);
01058         fprintf (fp->fp, "  9\n$AUPREC\n 70\n%i\n", header->AUPrec);
01059         fprintf (fp->fp, "  9\n$MENU\n  1\n%s\n", header->Menu);
01060         fprintf (fp->fp, "  9\n$ELEVATION\n 40\n%f\n", header->Elevation);
01061         fprintf (fp->fp, "  9\n$PELEVATION\n 40\n%f\n", header->PElevation);
01062         fprintf (fp->fp, "  9\n$THICKNESS\n 40\n%f\n", header->Thickness);
01063         fprintf (fp->fp, "  9\n$LIMCHECK\n 70\n%i\n", header->LimCheck);
01064         if (fp->acad_version_number <= AC1014) fprintf (fp->fp, "  9\n$BLIPMODE\n 70\n%i\n", header->BlipMode);
01065         fprintf (fp->fp, "  9\n$CHAMFERA\n 40\n%f\n", header->ChamferA);
01066         fprintf (fp->fp, "  9\n$CHAMFERB\n 40\n%f\n", header->ChamferB);
01067         if (fp->acad_version_number >= AC1012) fprintf (fp->fp, "  9\n$CHAMFERC\n 40\n%f\n", header->ChamferC);
01068         if (fp->acad_version_number >= AC1012) fprintf (fp->fp, "  9\n$CHAMFERD\n 40\n%f\n", header->ChamferD);
01069         fprintf (fp->fp, "  9\n$SKPOLY\n 70\n%i\n", header->SKPoly);
01070         fprintf (fp->fp, "  9\n$TDCREATE\n 40\n%f\n", header->TDCreate);
01071         if (fp->acad_version_number >= AC1015) fprintf (fp->fp, "  9\n$TDUCREATE\n 40\n%f\n", header->TDUCreate);
01072         fprintf (fp->fp, "  9\n$TDUPDATE\n 40\n%f\n", header->TDUpdate);
01073         if (fp->acad_version_number >= AC1015) fprintf (fp->fp, "  9\n$TDUUPDATE\n 40\n%f\n", header->TDUUpdate);
01074         fprintf (fp->fp, "  9\n$TDINDWG\n 40\n%f\n", header->TDInDWG);
01075         fprintf (fp->fp, "  9\n$TDUSRTIMER\n 40\n%f\n", header->TDUSRTimer);
01076         fprintf (fp->fp, "  9\n$USRTIMER\n 70\n%i\n", header->USRTimer);
01077         fprintf (fp->fp, "  9\n$ANGBASE\n 50\n%f\n", header->AngBase);
01078         fprintf (fp->fp, "  9\n$ANGDIR\n 70\n%i\n", header->AngDir);
01079         fprintf (fp->fp, "  9\n$PDMODE\n 70\n%i\n", header->PDMode);
01080         fprintf (fp->fp, "  9\n$PDSIZE\n 40\n%f\n", header->PDSize);
01081         fprintf (fp->fp, "  9\n$PLINEWID\n 40\n%f\n", header->PLineWid);
01082         if (fp->acad_version_number <= AC1014) fprintf (fp->fp, "  9\n$COORDS\n 70\n%i\n", header->Coords);
01083         fprintf (fp->fp, "  9\n$SPLFRAME\n 70\n%i\n", header->SPLFrame);
01084         fprintf (fp->fp, "  9\n$SPLINETYPE\n 70\n%i\n", header->SPLineType);
01085         if (fp->acad_version_number <= AC1014) fprintf (fp->fp, "  9\n$ATTDIA\n 70\n%i\n", header->AttDia);
01086         if (fp->acad_version_number <= AC1014) fprintf (fp->fp, "  9\n$ATTREQ\n 70\n%i\n", header->AttReq);
01087         if (fp->acad_version_number <= AC1014) fprintf (fp->fp, "  9\n$HANDLING\n 70\n%i\n", header->Handling);
01088         fprintf (fp->fp, "  9\n$SPLINESEGS\n 70\n%i\n", header->SPLineSegs);
01089         fprintf (fp->fp, "  9\n$HANDSEED\n  5\n%s\n", header->HandSeed);
01090         fprintf (fp->fp, "  9\n$SURFTAB1\n 70\n%i\n", header->SurfTab1);
01091         fprintf (fp->fp, "  9\n$SURFTAB2\n 70\n%i\n", header->SurfTab2);
01092         fprintf (fp->fp, "  9\n$SURFTYPE\n 70\n%i\n", header->SurfType);
01093         fprintf (fp->fp, "  9\n$SURFU\n 70\n%i\n", header->SurfU);
01094         fprintf (fp->fp, "  9\n$SURFV\n 70\n%i\n", header->SurfV);
01095         if (fp->acad_version_number >= AC1015) fprintf (fp->fp, "  9\n$UCSBASE\n  2\n%s\n", header->UCSBase);
01096         fprintf (fp->fp, "  9\n$UCSNAME\n  2\n%s\n", header->UCSName);
01097         fprintf (fp->fp, "  9\n$UCSORG\n 10\n%f\n 20\n%f\n 30\n%f\n", header->UCSOrg.x0, header->UCSOrg.y0, header->UCSOrg.z0);
01098         fprintf (fp->fp, "  9\n$UCSXDIR\n 10\n%f\n 20\n%f\n 30\n%f\n", header->UCSXDir.x0, header->UCSXDir.y0, header->UCSXDir.z0);
01099         fprintf (fp->fp, "  9\n$UCSYDIR\n 10\n%f\n 20\n%f\n 30\n%f\n", header->UCSYDir.x0, header->UCSYDir.y0, header->UCSYDir.z0);
01100         if (fp->acad_version_number >= AC1015) fprintf (fp->fp, "  9\n$UCSORTHOREF\n  2\n%s\n", header->UCSOrthoRef);
01101         if (fp->acad_version_number >= AC1015) fprintf (fp->fp, "  9\n$UCSORTHOVIEW\n 70\n%i\n", header->UCSOrthoView);
01102         if (fp->acad_version_number >= AC1015) fprintf (fp->fp, "  9\n$UCSORGTOP\n 10\n%f\n 20\n%f\n 30\n%f\n", header->UCSOrgTop.x0, header->UCSOrgTop.y0, header->UCSOrgTop.z0);
01103         if (fp->acad_version_number >= AC1015) fprintf (fp->fp, "  9\n$UCSORGBOTTOM\n 10\n%f\n 20\n%f\n 30\n%f\n", header->UCSOrgBottom.x0, header->UCSOrgBottom.y0, header->UCSOrgBottom.z0);
01104         if (fp->acad_version_number >= AC1015) fprintf (fp->fp, "  9\n$UCSORGLEFT\n 10\n%f\n 20\n%f\n 30\n%f\n", header->UCSOrgLeft.x0, header->UCSOrgLeft.y0, header->UCSOrgLeft.z0);
01105         if (fp->acad_version_number >= AC1015) fprintf (fp->fp, "  9\n$UCSORGRIGHT\n 10\n%f\n 20\n%f\n 30\n%f\n", header->UCSOrgRight.x0, header->UCSOrgRight.y0, header->UCSOrgRight.z0);
01106         if (fp->acad_version_number >= AC1015) fprintf (fp->fp, "  9\n$UCSORGFRONT\n 10\n%f\n 20\n%f\n 30\n%f\n", header->UCSOrgFront.x0, header->UCSOrgFront.y0, header->UCSOrgFront.z0);
01107         if (fp->acad_version_number >= AC1015) fprintf (fp->fp, "  9\n$UCSORGBACK\n 10\n%f\n 20\n%f\n 30\n%f\n", header->UCSOrgBack.x0, header->UCSOrgBack.y0, header->UCSOrgBack.z0);
01108         if (fp->acad_version_number >= AC1015) fprintf (fp->fp, "  9\n$PUCSBASE\n  2\n%s\n", header->PUCSBase);
01109         fprintf (fp->fp, "  9\n$PUCSNAME\n  2\n%s\n", header->PUCSName);
01110         fprintf (fp->fp, "  9\n$PUCSORG\n 10\n%f\n 20\n%f\n 30\n%f\n", header->PUCSOrg.x0, header->PUCSOrg.y0, header->PUCSOrg.z0);
01111         fprintf (fp->fp, "  9\n$PUCSXDIR\n 10\n%f\n 20\n%f\n 30\n%f\n", header->PUCSXDir.x0, header->PUCSXDir.y0, header->PUCSXDir.z0);
01112         fprintf (fp->fp, "  9\n$PUCSYDIR\n 10\n%f\n 20\n%f\n 30\n%f\n", header->PUCSYDir.x0, header->PUCSYDir.y0, header->PUCSYDir.z0);
01113         if (fp->acad_version_number >= AC1015) fprintf (fp->fp, "  9\n$PUCSORTHOREF\n  2\n%s\n", header->PUCSOrthoRef);
01114         if (fp->acad_version_number >= AC1015) fprintf (fp->fp, "  9\n$PUCSORTHOVIEW\n 70\n%i\n", header->PUCSOrthoView);
01115         if (fp->acad_version_number >= AC1015) fprintf (fp->fp, "  9\n$PUCSORGTOP\n 10\n%f\n 20\n%f\n 30\n%f\n", header->PUCSOrgTop.x0, header->PUCSOrgTop.y0, header->PUCSOrgTop.z0);
01116         if (fp->acad_version_number >= AC1015) fprintf (fp->fp, "  9\n$PUCSORGBOTTOM\n 10\n%f\n 20\n%f\n 30\n%f\n", header->PUCSOrgBottom.x0, header->PUCSOrgBottom.y0, header->PUCSOrgBottom.z0);
01117         if (fp->acad_version_number >= AC1015) fprintf (fp->fp, "  9\n$PUCSORGLEFT\n 10\n%f\n 20\n%f\n 30\n%f\n", header->PUCSOrgLeft.x0, header->PUCSOrgLeft.y0, header->PUCSOrgLeft.z0);
01118         if (fp->acad_version_number >= AC1015) fprintf (fp->fp, "  9\n$PUCSORGRIGHT\n 10\n%f\n 20\n%f\n 30\n%f\n", header->PUCSOrgRight.x0, header->PUCSOrgRight.y0, header->PUCSOrgRight.z0);
01119         if (fp->acad_version_number >= AC1015) fprintf (fp->fp, "  9\n$PUCSORGFRONT\n 10\n%f\n 20\n%f\n 30\n%f\n", header->PUCSOrgFront.x0, header->PUCSOrgFront.y0, header->PUCSOrgFront.z0);
01120         if (fp->acad_version_number >= AC1015) fprintf (fp->fp, "  9\n$PUCSORGBACK\n 10\n%f\n 20\n%f\n 30\n%f\n", header->PUCSOrgBack.x0, header->PUCSOrgBack.y0, header->PUCSOrgBack.z0);
01121         fprintf (fp->fp, "  9\n$USERI1\n 70\n%i\n", header->UserI1);
01122         fprintf (fp->fp, "  9\n$USERI2\n 70\n%i\n", header->UserI2);
01123         fprintf (fp->fp, "  9\n$USERI3\n 70\n%i\n", header->UserI3);
01124         fprintf (fp->fp, "  9\n$USERI4\n 70\n%i\n", header->UserI4);
01125         fprintf (fp->fp, "  9\n$USERI5\n 70\n%i\n", header->UserI5);
01126         fprintf (fp->fp, "  9\n$USERR1\n 40\n%f\n", header->UserR1);
01127         fprintf (fp->fp, "  9\n$USERR2\n 40\n%f\n", header->UserR2);
01128         fprintf (fp->fp, "  9\n$USERR3\n 40\n%f\n", header->UserR3);
01129         fprintf (fp->fp, "  9\n$USERR4\n 40\n%f\n", header->UserR4);
01130         fprintf (fp->fp, "  9\n$USERR5\n 40\n%f\n", header->UserR5);
01131         fprintf (fp->fp, "  9\n$WORLDVIEW\n 70\n%i\n", header->WorldView);
01132         fprintf (fp->fp, "  9\n$SHADEDGE\n 70\n%i\n", header->ShadEdge);
01133         fprintf (fp->fp, "  9\n$SHADEDIF\n 70\n%i\n", header->ShadeDif);
01134         fprintf (fp->fp, "  9\n$TILEMODE\n 70\n%i\n", header->TileMode);
01135         fprintf (fp->fp, "  9\n$MAXACTVP\n 70\n%i\n", header->MaxActVP);
01136         fprintf (fp->fp, "  9\n$PINSBASE\n 10\n%f\n 20\n%f\n 30\n%f\n", header->PInsBase.x0, header->PInsBase.y0, header->PInsBase.z0);
01137         fprintf (fp->fp, "  9\n$PLIMCHECK\n 70\n%i\n", header->PLimCheck);
01138         fprintf (fp->fp, "  9\n$PEXTMIN\n 10\n%f\n 20\n%f\n 30\n%f\n", header->PExtMin.x0, header->PExtMin.y0, header->PExtMin.z0);
01139         fprintf (fp->fp, "  9\n$PEXTMAX\n 10\n%f\n 20\n%f\n 30\n%f\n", header->PExtMax.x0, header->PExtMax.y0, header->PExtMax.z0);
01140         fprintf (fp->fp, "  9\n$PLIMMIN\n 10\n%f\n 20\n%f\n", header->PLimMin.x0, header->PLimMin.y0);
01141         fprintf (fp->fp, "  9\n$PLIMMAX\n 10\n%f\n 20\n%f\n", header->PLimMax.x0, header->PLimMax.y0);
01142         fprintf (fp->fp, "  9\n$UNITMODE\n 70\n%i\n", header->UnitMode);
01143         fprintf (fp->fp, "  9\n$VISRETAIN\n 70\n%i\n", header->VisRetain);
01144         fprintf (fp->fp, "  9\n$PLINEGEN\n 70\n%i\n", header->PLineGen);
01145         fprintf (fp->fp, "  9\n$PSLTSCALE\n 70\n%i\n", header->PSLTScale);
01146         if (fp->acad_version_number >= AC1012) fprintf (fp->fp, "  9\n$TREEDEPTH\n 70\n%i\n", header->TreeDepth);
01147         if ((fp->acad_version_number == AC1012)
01148           || (fp->acad_version_number == AC1014)) fprintf (fp->fp, "  9\n$PICKSTYLE\n 70\n%i\n", header->PickStyle);
01149         if (fp->acad_version_number >= AC1012) fprintf (fp->fp, "  9\n$CMLSTYLE\n  2\n%s\n", header->CMLStyle);
01150         if (fp->acad_version_number >= AC1012) fprintf (fp->fp, "  9\n$CMLJUST\n 70\n%i\n", header->CMLJust);
01151         if (fp->acad_version_number >= AC1012) fprintf (fp->fp, "  9\n$CMLSCALE\n 40\n%f\n", header->CMLScale);
01152         if (fp->acad_version_number >= AC1014) fprintf (fp->fp, "  9\n$PROXYGRAPHICS\n 70\n%i\n", header->ProxyGraphics);
01153         if (fp->acad_version_number >= AC1014) fprintf (fp->fp, "  9\n$MEASUREMENT\n 70\n%i\n", header->Measurement);
01154         if (fp->acad_version_number == AC1012) fprintf (fp->fp, "  9\n$SAVEIMAGES\n 70\n%i\n", header->SaveImages);
01155         if (fp->acad_version_number >= AC1015) fprintf (fp->fp, "  9\n$CELWEIGHT\n370\n%i\n", header->CELWeight);
01156         if (fp->acad_version_number >= AC1015) fprintf (fp->fp, "  9\n$ENDCAPS\n280\n%i\n", header->EndCaps);
01157         if (fp->acad_version_number >= AC1015) fprintf (fp->fp, "  9\n$JOINSTYLE\n280\n%i\n", header->JoinStyle);
01158         if (fp->acad_version_number >= AC1015) fprintf (fp->fp, "  9\n$LWDISPLAY\n290\n%i\n", header->LWDisplay);
01159         if (fp->acad_version_number >= AC1015) fprintf (fp->fp, "  9\n$INSUNITS\n 70\n%i\n", header->InsUnits);
01160         if (fp->acad_version_number >= AC1015) fprintf (fp->fp, "  9\n$HYPERLINKBASE\n  1\n%s\n", header->HyperLinkBase);
01161         if (fp->acad_version_number >= AC1015) fprintf (fp->fp, "  9\n$STYLESHEET\n  1\n%s\n", header->StyleSheet);
01162         if (fp->acad_version_number >= AC1015) fprintf (fp->fp, "  9\n$XEDIT\n290\n%i\n", header->XEdit);
01163         if (fp->acad_version_number >= AC1015) fprintf (fp->fp, "  9\n$CEPSNTYPE\n380\n%i\n", header->CEPSNType);
01164         if (fp->acad_version_number >= AC1015) fprintf (fp->fp, "  9\n$PSTYLEMODE\n290\n%i\n", header->PStyleMode);
01165         if (fp->acad_version_number >= AC1015) fprintf (fp->fp, "  9\n$FINGERPRINTGUID\n  2\n%s\n", header->FingerPrintGUID);
01166         if (fp->acad_version_number >= AC1015) fprintf (fp->fp, "  9\n$VERSIONGUID\n  2\n%s\n", header->VersionGUID);
01167         if (fp->acad_version_number >= AC1015) fprintf (fp->fp, "  9\n$EXTNAMES\n290\n%i\n", header->ExtNames);
01168         if (fp->acad_version_number >= AC1015) fprintf (fp->fp, "  9\n$PSVPSCALE\n 40\n%f\n", header->PSVPScale);
01169         if (fp->acad_version_number >= AC1015) fprintf (fp->fp, "  9\n$OLESTARTUP\n290\n%i\n", header->OLEStartUp);
01170         if (fp->acad_version_number >= AC1018) fprintf (fp->fp, "  9\n$SORTENTS\n280\n%i\n", header->SortEnts);
01171         if (fp->acad_version_number >= AC1018) fprintf (fp->fp, "  9\n$INDEXCTL\n280\n%i\n", header->IndexCtl);
01172         if (fp->acad_version_number >= AC1018) fprintf (fp->fp, "  9\n$HIDETEXT\n280\n%i\n", header->HideText);
01173         if (fp->acad_version_number >= AC1018) fprintf (fp->fp, "  9\n$XCLIPFRAME\n290\n%i\n", header->XClipFrame);
01174         if (fp->acad_version_number >= AC1018) fprintf (fp->fp, "  9\n$HALOGAP\n280\n%i\n", header->HaloGap);
01175         if (fp->acad_version_number >= AC1018) fprintf (fp->fp, "  9\n$OBSCOLOR\n 70\n%i\n", header->ObsColor);
01176         if (fp->acad_version_number >= AC1018) fprintf (fp->fp, "  9\n$OBSLTYPE\n280\n%i\n", header->ObsLType);
01177         if (fp->acad_version_number >= AC1018) fprintf (fp->fp, "  9\n$INTERSECTIONDISPLAY\n280\n%i\n", header->InterSectionDisplay);
01178         if (fp->acad_version_number >= AC1018) fprintf (fp->fp, "  9\n$INTERSECTIONCOLOR\n 70\n%i\n", header->InterSectionColor);
01179         if (fp->acad_version_number >= AC1018) fprintf (fp->fp, "  9\n$DIMASSOC\n280\n%i\n", header->DimASSOC);
01180         if (fp->acad_version_number >= AC1018) fprintf (fp->fp, "  9\n$PROJECTNAME\n  1\n%s\n", header->ProjectName);
01181         dxf_endsec_write (fp);
01182         /* Clean up. */
01183         free (dxf_entity_name);
01184 #if DEBUG
01185         DXF_DEBUG_END
01186 #endif
01187         return (EXIT_SUCCESS);
01188 }
01189 
01190 int
01191 dxf_header_read_parse_string
01192 (
01193         DxfFile *fp,
01195         const char *temp_string,
01196         const char *header_var,
01197         char **value_string,
01198         int version_expression
01199 )
01200 {
01201 #if DEBUG
01202         DXF_DEBUG_BEGIN
01203 #endif
01204         char tstring[255];
01205         int n, ret = SUCCESS;
01206         if (strcmp (temp_string, header_var) == 0 && version_expression)
01207         {
01208                 ret = FOUND;
01209                 dxf_read_scanf (fp, "%i\n%s\n", &n, tstring);
01210                 if (dxf_read_is_string(n))
01211                 {
01212                         *value_string = strdup(tstring);
01213                 }
01214                 else
01215                         ret = FAIL;
01216         }
01217         else
01218                 ret = SUCCESS;
01219                 
01220 #if DEBUG
01221         DXF_DEBUG_END
01222 #endif
01223         return ret;
01224 }
01225 
01226 int
01227 dxf_header_read_parse_int
01228 (
01229         DxfFile *fp,
01231         const char *temp_string,
01232         const char *header_var,
01233         int *value,
01234         int version_expression
01235 )
01236 {
01237 #if DEBUG
01238         DXF_DEBUG_BEGIN
01239 #endif
01240         int f, tvar, n, ret = SUCCESS;
01241 
01242         /* Do some basic checks. */
01243         if (fp == NULL)
01244         {
01245                 fprintf (stderr,
01246                   (_("Error in %s () a NULL file pointer was passed.\n")),
01247                   __FUNCTION__);
01248                 return (EXIT_FAILURE);
01249         }
01250         if (temp_string == NULL)
01251         {
01252                 fprintf (stderr,
01253                   (_("Error in %s () a NULL pointer to temp_string was passed.\n")),
01254                   __FUNCTION__);
01255                 return (EXIT_FAILURE);
01256         }
01257         if (header_var == NULL)
01258         {
01259                 fprintf (stderr,
01260                   (_("Error in %s () a NULL pointer to header_var was passed.\n")),
01261                   __FUNCTION__);
01262                 return (EXIT_FAILURE);
01263         }
01264         /* Test for header_var and version number.
01265          * -3 makes it version agnostic */
01266         if (strcmp (temp_string, header_var) == 0  && version_expression)
01267         {
01268                 f = dxf_read_scanf (fp, "%i\n%i\n", &n, &tvar);
01269                 if (f > 0 && dxf_read_is_int(n))
01270                 {
01271                         *value = tvar;
01272                         ret = FOUND;                                
01273                 }
01274                 else
01275                         ret = FAIL;
01276         }
01277         else
01278                 ret = SUCCESS;
01279 
01280 #if DEBUG
01281         DXF_DEBUG_END
01282 #endif
01283         return ret;
01284 }
01285 
01286 
01287 int
01288 dxf_header_read_parse_n_double
01289 (
01290         DxfFile *fp,
01292         const char *temp_string,
01293         const char *header_var,
01294         int version_expression,
01295         int quant,
01296         ...
01297 )
01298 {
01299 #if DEBUG
01300         DXF_DEBUG_BEGIN
01301 #endif
01302         int f, n, i, ret = SUCCESS;
01303         double *dvar;
01304         double tvar;
01305         va_list dlist;
01306 
01307         /* Do some basic checks. */
01308         if (fp == NULL)
01309         {
01310                 fprintf (stderr,
01311                   (_("Error in %s () a NULL file pointer was passed.\n")),
01312                   __FUNCTION__);
01313                 return (EXIT_FAILURE);
01314         }
01315         if (temp_string == NULL)
01316         {
01317                 fprintf (stderr,
01318                   (_("Error in %s () a NULL pointer to temp_string was passed.\n")),
01319                   __FUNCTION__);
01320                 return (EXIT_FAILURE);
01321         }
01322         if (header_var == NULL)
01323         {
01324                 fprintf (stderr,
01325                   (_("Error in %s () a NULL pointer to header_var was passed.\n")),
01326                   __FUNCTION__);
01327                 return (EXIT_FAILURE);
01328         }
01329         /* Test for header_var and version number.
01330          * -3 makes it version agnostic */
01331         if (strcmp (temp_string, header_var) == 0  && version_expression)
01332         {
01333                 ret = FOUND;
01334                 va_start (dlist, quant);
01335                 for (i = 1; i <= quant; i++)
01336                 {
01337                         dvar = va_arg(dlist, double *);
01338                         /* prepare the string to read all vars */
01339                         f = dxf_read_scanf (fp, "%d\n%'lf\n", &n, &tvar);
01340                         if (f > 0 && dxf_read_is_double (n))
01341                         {
01342                                 *dvar = tvar;
01343                         }
01344                         else
01345                         {
01346                                 ret = FALSE;
01347                                 break;
01348                         }
01349                 }
01350                 va_end(dlist);
01351         }
01352         else
01353                 ret = SUCCESS;
01354 
01355 #if DEBUG
01356         DXF_DEBUG_END
01357 #endif
01358         return ret;
01359 }
01360 
01361 
01365 int
01366 dxf_header_read_parser
01367 (
01368         DxfFile *fp,
01370         DxfHeader *header,
01372         char * temp_string,
01373         int acad_version_number
01374 )
01375 {
01376 #if DEBUG
01377         DXF_DEBUG_BEGIN
01378 #endif
01379         int ret;
01380 
01381         /* Do some basic checks. */
01382         if (fp == NULL)
01383         {
01384                 fprintf (stderr,
01385                   (_("Error in %s () a NULL file pointer was passed.\n")),
01386                   __FUNCTION__);
01387                 return (EXIT_FAILURE);
01388         }
01389         if (header == NULL)
01390         {
01391                 fprintf (stderr,
01392                   (_("Error in %s () a NULL pointer to header was passed.\n")),
01393                   __FUNCTION__);
01394                 return (EXIT_FAILURE);
01395         }
01396         if (temp_string == NULL)
01397         {
01398                 fprintf (stderr,
01399                   (_("Error in %s () a NULL pointer to temp_string was passed.\n")),
01400                   __FUNCTION__);
01401                 return (EXIT_FAILURE);
01402         }
01407         ret = dxf_header_read_parse_int (fp, temp_string, "$ACADMAINTVER",
01408                                          &header->AcadMaintVer,
01409                                          acad_version_number > AC1014);
01410         dxf_return(ret);
01411                 
01412         ret = dxf_header_read_parse_string (fp, temp_string, "$DWGCODEPAGE",
01413                                             &header->DWGCodePage,
01414                                             acad_version_number >= AC1012);
01415         dxf_return(ret);
01416         
01417         ret = dxf_header_read_parse_n_double (fp, temp_string, "$INSBASE",
01418                                               TRUE,
01419                                               3,
01420                                               &header->InsBase.x0,
01421                                               &header->InsBase.y0,
01422                                               &header->InsBase.z0);
01423         dxf_return(ret);
01424 
01425         ret = dxf_header_read_parse_n_double (fp, temp_string, "$EXTMIN",
01426                                               TRUE,
01427                                               3,
01428                                               &header->ExtMin.x0,
01429                                               &header->ExtMin.y0,
01430                                               &header->ExtMin.z0);
01431         dxf_return(ret);
01432 
01433         ret = dxf_header_read_parse_n_double (fp, temp_string, "$EXTMAX",
01434                                               TRUE,
01435                                               3,
01436                                               &header->ExtMax.x0,
01437                                               &header->ExtMax.y0,
01438                                               &header->ExtMax.z0);
01439         dxf_return(ret);
01440 
01441         ret = dxf_header_read_parse_n_double (fp, temp_string, "$LIMMIN",
01442                                               TRUE,
01443                                               2,
01444                                               &header->LimMin.x0,
01445                                               &header->LimMin.y0);
01446         dxf_return(ret);
01447 
01448         ret = dxf_header_read_parse_n_double (fp, temp_string, "$LIMMAX",
01449                                               TRUE,
01450                                               2,
01451                                               &header->LimMax.x0,
01452                                               &header->LimMax.y0);
01453         dxf_return(ret);
01454 
01455         ret = dxf_header_read_parse_int (fp, temp_string, "$ORTHOMODE",
01456                                          &header->OrthoMode,
01457                                          TRUE);
01458         dxf_return(ret);
01459 
01460         ret = dxf_header_read_parse_int (fp, temp_string, "$REGENMODE",
01461                                          &header->RegenMode,
01462                                          TRUE);
01463         dxf_return(ret);
01464 
01465         ret = dxf_header_read_parse_int (fp, temp_string, "$FILLMODE",
01466                                          &header->FillMode,
01467                                          TRUE);
01468         dxf_return(ret);
01469 
01470         ret = dxf_header_read_parse_int (fp, temp_string, "$QTEXTMODE",
01471                                          &header->QTextMode,
01472                                          TRUE);
01473         dxf_return(ret);
01474 
01475         ret = dxf_header_read_parse_int (fp, temp_string, "$MIRRTEXT",
01476                                          &header->MirrText,
01477                                          TRUE);
01478         dxf_return(ret);
01479 
01480         ret = dxf_header_read_parse_int (fp, temp_string, "$DRAGMODE",
01481                                          &header->MirrText,
01482                                          acad_version_number < AC1015);
01483         dxf_return(ret);
01484 
01485         ret = dxf_header_read_parse_n_double (fp, temp_string, "$LTSCALE",
01486                                               TRUE,
01487                                               1,
01488                                               &header->LTScale);
01489         dxf_return(ret);
01490 
01491         ret = dxf_header_read_parse_int (fp, temp_string, "$OSMODE",
01492                                          &header->OSMode,
01493                                          acad_version_number <= AC1014);
01494         dxf_return(ret);
01495 
01496         ret = dxf_header_read_parse_int (fp, temp_string, "$ATTMODE",
01497                                          &header->AttMode,
01498                                          TRUE);
01499         dxf_return(ret);
01500     
01501         ret = dxf_header_read_parse_n_double (fp, temp_string, "$TEXTSIZE",
01502                                               TRUE,
01503                                               1,
01504                                               &header->TextSize);
01505         dxf_return(ret);
01506 
01507         ret = dxf_header_read_parse_n_double (fp, temp_string, "$TRACEWID",
01508                                               TRUE,
01509                                               1,
01510                                               &header->TraceWid);
01511         dxf_return(ret);
01512 
01513         ret = dxf_header_read_parse_string (fp, temp_string, "$TEXTSTYLE",
01514                                             &header->TextStyle,
01515                                             TRUE);
01516         dxf_return(ret);
01517 
01518         ret = dxf_header_read_parse_string (fp, temp_string, "$CLAYER",
01519                                             &header->CLayer,
01520                                             TRUE);
01521         dxf_return(ret);
01522 
01523         ret = dxf_header_read_parse_string (fp, temp_string, "$CELTYPE",
01524                                             &header->CELType,
01525                                             TRUE);
01526         dxf_return(ret);
01527 
01528         ret = dxf_header_read_parse_int (fp, temp_string, "$CECOLOR",
01529                                          &header->CEColor,
01530                                          TRUE);
01531         dxf_return(ret);
01532 
01533         ret = dxf_header_read_parse_n_double (fp, temp_string, "$CELTSCALE",
01534                                               acad_version_number >= AC1012,
01535                                               1,
01536                                               &header->CELTScale);
01537         dxf_return(ret);
01538 
01539         ret = dxf_header_read_parse_int (fp, temp_string, "$DELOBJ",
01540                                          &header->DelObj,
01541                                          (acad_version_number == AC1012)
01542                                          || (acad_version_number == AC1014));
01543         dxf_return(ret);
01544 
01546         ret = dxf_header_read_parse_int (fp, temp_string, "$DISPSILH",
01547                                          &header->DispSilH,
01548                                          acad_version_number <= AC1015);
01549         dxf_return(ret);
01550 
01551         ret = dxf_header_read_parse_n_double (fp, temp_string, "$DIMSCALE",
01552                                               TRUE,
01553                                               1,
01554                                               &header->DimSCALE);
01555         dxf_return(ret);
01556 
01557         ret = dxf_header_read_parse_n_double (fp, temp_string, "$DIMASZ",
01558                                               TRUE,
01559                                               1,
01560                                               &header->DimASZ);
01561         dxf_return(ret);
01562 
01563         ret = dxf_header_read_parse_n_double (fp, temp_string, "$DIMEXO",
01564                                               TRUE,
01565                                               1,
01566                                               &header->DimEXO);
01567         dxf_return(ret);
01568 
01569         /*
01570         fprintf (fp, "  9\n$DIMDLI\n 40\n%f\n", header->DimDLI);
01571         fprintf (fp, "  9\n$DIMRND\n 40\n%f\n", header->DimRND);
01572         fprintf (fp, "  9\n$DIMDLE\n 40\n%f\n", header->DimDLE);
01573         */
01574         ret = dxf_header_read_parse_n_double (fp, temp_string, "$DIMEXE",
01575                                               TRUE,
01576                                               1,
01577                                               &header->DimEXE);
01578         dxf_return(ret);
01579         /*
01580         fprintf (fp, "  9\n$DIMTP\n 40\n%f\n", header->DimTP);
01581         fprintf (fp, "  9\n$DIMTM\n 40\n%f\n", header->DimTM);
01582         */
01583         ret = dxf_header_read_parse_n_double (fp, temp_string, "$DIMTXT",
01584                                               TRUE,
01585                                               1,
01586                                               &header->DimTXT);
01587         dxf_return(ret);
01588         /*
01589         fprintf (fp, "  9\n$DIMCEN\n 40\n%f\n", header->DimCEN);
01590         fprintf (fp, "  9\n$DIMTSZ\n 40\n%f\n", header->DimTSZ);
01591         fprintf (fp, "  9\n$DIMTOL\n 70\n%i\n", header->DimTOL);
01592         fprintf (fp, "  9\n$DIMLIM\n 70\n%i\n", header->DimLIM);
01593         fprintf (fp, "  9\n$DIMTIH\n 70\n%i\n", header->DimTIH);
01594         fprintf (fp, "  9\n$DIMTOH\n 70\n%i\n", header->DimTOH);
01595         fprintf (fp, "  9\n$DIMSE1\n 70\n%i\n", header->DimSE1);
01596         fprintf (fp, "  9\n$DIMSE2\n 70\n%i\n", header->DimSE2);
01597         fprintf (fp, "  9\n$DIMTAD\n 70\n%i\n", header->DimTAD);
01598         fprintf (fp, "  9\n$DIMZIN\n 70\n%i\n", header->DimZIN);
01599         fprintf (fp, "  9\n$DIMBLK\n  1\n%s\n", header->DimBLK);
01600         fprintf (fp, "  9\n$DIMASO\n 70\n%i\n", header->DimASO);
01601         fprintf (fp, "  9\n$DIMSHO\n 70\n%i\n", header->DimSHO);
01602         fprintf (fp, "  9\n$DIMPOST\n  1\n%s\n", header->DimPOST);
01603         fprintf (fp, "  9\n$DIMAPOST\n  1\n%s\n", header->DimAPOST);
01604         fprintf (fp, "  9\n$DIMALT\n 70\n%i\n", header->DimALT);
01605         fprintf (fp, "  9\n$DIMALTD\n 70\n%i\n", header->DimALTD);
01606         fprintf (fp, "  9\n$DIMALTF\n 40\n%f\n", header->DimALTF);
01607         fprintf (fp, "  9\n$DIMLFAC\n 40\n%f\n", header->DimLFAC);
01608         fprintf (fp, "  9\n$DIMTOFL\n 70\n%i\n", header->DimTOFL);
01609         fprintf (fp, "  9\n$DIMTVP\n 40\n%f\n", header->DimTVP);
01610         fprintf (fp, "  9\n$DIMTIX\n 70\n%i\n", header->DimTIX);
01611         fprintf (fp, "  9\n$DIMSOXD\n 70\n%i\n", header->DimSOXD);
01612         fprintf (fp, "  9\n$DIMSAH\n 70\n%i\n", header->DimSAH);
01613         fprintf (fp, "  9\n$DIMBLK1\n  1\n%s\n", header->DimBLK1);
01614         fprintf (fp, "  9\n$DIMBLK2\n  1\n%s\n", header->DimBLK2);
01615         */
01616         ret = dxf_header_read_parse_string (fp, temp_string, "$DIMSTYLE",
01617                                             &header->DimSTYLE,
01618                                             TRUE);
01619         dxf_return(ret);
01620         /*
01621         fprintf (fp, "  9\n$DIMCLRD\n 70\n%i\n", header->DimCLRD);
01622         fprintf (fp, "  9\n$DIMCLRE\n 70\n%i\n", header->DimCLRE);
01623         fprintf (fp, "  9\n$DIMCLRT\n 70\n%i\n", header->DimCLRT);
01624         fprintf (fp, "  9\n$DIMTFAC\n 40\n%f\n", header->DimTFAC);
01625         */
01626         ret = dxf_header_read_parse_n_double (fp, temp_string, "$DIMGAP",
01627                                               TRUE,
01628                                               1,
01629                                               &header->DimGAP);
01630         dxf_return(ret);
01631         /*
01632         if (acad_version_number >= AC1012) fprintf (fp, "  9\n$DIMJUST\n 70\n%i\n", header->DimJUST);
01633         if (acad_version_number >= AC1012) fprintf (fp, "  9\n$DIMSD1\n 70\n%i\n", header->DimSD1);
01634         if (acad_version_number >= AC1012) fprintf (fp, "  9\n$DIMSD2\n 70\n%i\n", header->DimSD2);
01635         if (acad_version_number >= AC1012) fprintf (fp, "  9\n$DIMTOLJ\n 70\n%i\n", header->DimTOLJ);
01636         if (acad_version_number >= AC1012) fprintf (fp, "  9\n$DIMTZIN\n 70\n%i\n", header->DimTZIN);
01637         if (acad_version_number >= AC1012) fprintf (fp, "  9\n$DIMALTZ\n 70\n%i\n", header->DimALTZ);
01638         if (acad_version_number >= AC1012) fprintf (fp, "  9\n$DIMALTTZ\n 70\n%i\n", header->DimALTTZ);
01639         if ((acad_version_number == AC1012) || (acad_version_number == AC1014)) fprintf (fp, "  9\n$DIMFIT\n 70\n%i\n", header->DimFIT);
01640         if (acad_version_number >= AC1012) fprintf (fp, "  9\n$DIMUPT\n 70\n%i\n", header->DimUPT);
01641         if ((acad_version_number == AC1012) || (acad_version_number == AC1014)) fprintf (fp, "  9\n$DIMUNIT\n 70\n%i\n", header->DimUNIT);
01642         if (acad_version_number >= AC1012) fprintf (fp, "  9\n$DIMDEC\n 70\n%i\n", header->DimDEC);
01643         if (acad_version_number >= AC1012) fprintf (fp, "  9\n$DIMTDEC\n 70\n%i\n", header->DimTDEC);
01644         if (acad_version_number >= AC1012) fprintf (fp, "  9\n$DIMALTU\n 70\n%i\n", header->DimALTU);
01645         if (acad_version_number >= AC1012) fprintf (fp, "  9\n$DIMALTTD\n 70\n%i\n", header->DimALTTD);
01646         if (acad_version_number >= AC1012) fprintf (fp, "  9\n$DIMTXSTY\n  7\n%s\n", header->DimTXSTY);
01647         */
01648         ret = dxf_header_read_parse_int (fp, temp_string, "$DIMAUNIT",
01649                                          &header->DimAUNIT,
01650                                          acad_version_number >= AC1012);
01651         dxf_return(ret);
01652     
01653         ret = dxf_header_read_parse_int (fp, temp_string, "$DIMADEC",
01654                                          &header->DimADEC,
01655                                          acad_version_number >= AC1015);
01656         dxf_return(ret);
01657         /*
01658         if (acad_version_number >= AC1015) fprintf (fp, "  9\n$DIMALTRND\n 40\n%f\n", header->DimALTRND);
01659         if (acad_version_number >= AC1015) fprintf (fp, "  9\n$DIMAZIN\n 70\n%i\n", header->DimAZIN);
01660         if (acad_version_number >= AC1015) fprintf (fp, "  9\n$DIMDSEP\n 70\n%i\n", header->DimDSEP);
01661         if (acad_version_number >= AC1015) fprintf (fp, "  9\n$DIMATFIT\n 70\n%i\n", header->DimATFIT);
01662         if (acad_version_number >= AC1015) fprintf (fp, "  9\n$DIMFRAC\n 70\n%i\n", header->DimFRAC);
01663         if (acad_version_number >= AC1015) fprintf (fp, "  9\n$DIMLDRBLK\n  1\n%s\n", header->DimLDRBLK);
01664         */
01665         ret = dxf_header_read_parse_int (fp, temp_string, "$DIMLUNIT",
01666                                          &header->DimLUNIT,
01667                                          acad_version_number >= AC1015);
01668         dxf_return(ret);
01669         /*
01670         if (acad_version_number >= AC1015) fprintf (fp, "  9\n$DIMLWD\n 70\n%i\n", header->DimLWD);
01671         if (acad_version_number >= AC1015) fprintf (fp, "  9\n$DIMLWE\n 70\n%i\n", header->DimLWE);
01672         if (acad_version_number >= AC1015) fprintf (fp, "  9\n$DIMTMOVE\n 70\n%i\n", header->DimTMOVE);
01673         */
01674         ret = dxf_header_read_parse_int (fp, temp_string, "$LUNITS",
01675                                          &header->LUnits,
01676                                          TRUE);
01677         dxf_return(ret);
01678         
01679         ret = dxf_header_read_parse_int (fp, temp_string, "$LUPREC",
01680                                          &header->LUPrec,
01681                                          TRUE);
01682         dxf_return(ret);
01683         /*
01684         fprintf (fp, "  9\n$SKETCHINC\n 40\n%f\n", header->Sketchinc);
01685         fprintf (fp, "  9\n$FILLETRAD\n 40\n%f\n", header->FilletRad);
01686         */
01687         ret = dxf_header_read_parse_int (fp, temp_string, "$AUNITS",
01688                                          &header->AUnits,
01689                                          TRUE);
01690         dxf_return(ret);
01691     
01692         ret = dxf_header_read_parse_int (fp, temp_string, "$AUPREC",
01693                                          &header->AUPrec,
01694                                          TRUE);
01695         dxf_return(ret);
01696         /*
01697         fprintf (fp, "  9\n$MENU\n  1\n%s\n", header->Menu);
01698         fprintf (fp, "  9\n$ELEVATION\n 40\n%f\n", header->Elevation);
01699         fprintf (fp, "  9\n$PELEVATION\n 40\n%f\n", header->PElevation);
01700         fprintf (fp, "  9\n$THICKNESS\n 40\n%f\n", header->Thickness);
01701         fprintf (fp, "  9\n$LIMCHECK\n 70\n%i\n", header->LimCheck);
01702         if (acad_version_number <= AC1014) fprintf (fp, "  9\n$BLIPMODE\n 70\n%i\n", header->BlipMode);
01703         fprintf (fp, "  9\n$CHAMFERA\n 40\n%f\n", header->ChamferA);
01704         fprintf (fp, "  9\n$CHAMFERB\n 40\n%f\n", header->ChamferB);
01705         if (acad_version_number >= AC1012) fprintf (fp, "  9\n$CHAMFERC\n 40\n%f\n", header->ChamferC);
01706         if (acad_version_number >= AC1012) fprintf (fp, "  9\n$CHAMFERD\n 40\n%f\n", header->ChamferD);
01707         fprintf (fp, "  9\n$SKPOLY\n 70\n%i\n", header->SKPoly);
01708         fprintf (fp, "  9\n$TDCREATE\n 40\n%f\n", header->TDCreate);
01709         if (acad_version_number >= AC1015) fprintf (fp, "  9\n$TDUCREATE\n 40\n%f\n", header->TDUCreate);
01710         fprintf (fp, "  9\n$TDUPDATE\n 40\n%f\n", header->TDUpdate);
01711         if (acad_version_number >= AC1015) fprintf (fp, "  9\n$TDUUPDATE\n 40\n%f\n", header->TDUUpdate);
01712         fprintf (fp, "  9\n$TDINDWG\n 40\n%f\n", header->TDInDWG);
01713         fprintf (fp, "  9\n$TDUSRTIMER\n 40\n%f\n", header->TDUSRTimer);
01714         fprintf (fp, "  9\n$USRTIMER\n 70\n%i\n", header->USRTimer);
01715         fprintf (fp, "  9\n$ANGBASE\n 50\n%f\n", header->AngBase);
01716         fprintf (fp, "  9\n$ANGDIR\n 70\n%i\n", header->AngDir);
01717         fprintf (fp, "  9\n$PDMODE\n 70\n%i\n", header->PDMode);
01718         fprintf (fp, "  9\n$PDSIZE\n 40\n%f\n", header->PDSize);
01719         fprintf (fp, "  9\n$PLINEWID\n 40\n%f\n", header->PLineWid);
01720         if (acad_version_number <= AC1014) fprintf (fp, "  9\n$COORDS\n 70\n%i\n", header->Coords);
01721         fprintf (fp, "  9\n$SPLFRAME\n 70\n%i\n", header->SPLFrame);
01722         fprintf (fp, "  9\n$SPLINETYPE\n 70\n%i\n", header->SPLineType);
01723         if (acad_version_number <= AC1014) fprintf (fp, "  9\n$ATTDIA\n 70\n%i\n", header->AttDia);
01724         if (acad_version_number <= AC1014) fprintf (fp, "  9\n$ATTREQ\n 70\n%i\n", header->AttReq);
01725         if (acad_version_number <= AC1014) fprintf (fp, "  9\n$HANDLING\n 70\n%i\n", header->Handling);
01726         */
01727         ret = dxf_header_read_parse_int (fp, temp_string, "$SPLINESEGS",
01728                                          &header->SPLineSegs,
01729                                          TRUE);
01730         dxf_return(ret);
01731         
01732         ret = dxf_header_read_parse_string (fp, temp_string, "$HANDSEED",
01733                                             &header->HandSeed,
01734                                             TRUE);
01735         dxf_return(ret);
01736     /*
01737         fprintf (fp, "  9\n$SURFTAB1\n 70\n%i\n", header->SurfTab1);
01738         fprintf (fp, "  9\n$SURFTAB2\n 70\n%i\n", header->SurfTab2);
01739         fprintf (fp, "  9\n$SURFTYPE\n 70\n%i\n", header->SurfType);
01740         fprintf (fp, "  9\n$SURFU\n 70\n%i\n", header->SurfU);
01741         fprintf (fp, "  9\n$SURFV\n 70\n%i\n", header->SurfV);
01742         if (acad_version_number >= AC1015) fprintf (fp, "  9\n$UCSBASE\n  2\n%s\n", header->UCSBase);
01743         fprintf (fp, "  9\n$UCSNAME\n  2\n%s\n", header->UCSName);
01744         fprintf (fp, "  9\n$UCSORG\n 10\n%f\n 20\n%f\n 30\n%f\n", header->UCSOrg.x0, header->UCSOrg.y0, header->UCSOrg.z0);
01745         fprintf (fp, "  9\n$UCSXDIR\n 10\n%f\n 20\n%f\n 30\n%f\n", header->UCSXDir.x0, header->UCSXDir.y0, header->UCSXDir.z0);
01746         fprintf (fp, "  9\n$UCSYDIR\n 10\n%f\n 20\n%f\n 30\n%f\n", header->UCSYDir.x0, header->UCSYDir.y0, header->UCSYDir.z0);
01747         if (acad_version_number >= AC1015) fprintf (fp, "  9\n$UCSORTHOREF\n  2\n%s\n", header->UCSOrthoRef);
01748         if (acad_version_number >= AC1015) fprintf (fp, "  9\n$UCSORTHOVIEW\n 70\n%i\n", header->UCSOrthoView);
01749         if (acad_version_number >= AC1015) fprintf (fp, "  9\n$UCSORGTOP\n 10\n%f\n 20\n%f\n 30\n%f\n", header->UCSOrgTop.x0, header->UCSOrgTop.y0, header->UCSOrgTop.z0);
01750         if (acad_version_number >= AC1015) fprintf (fp, "  9\n$UCSORGBOTTOM\n 10\n%f\n 20\n%f\n 30\n%f\n", header->UCSOrgBottom.x0, header->UCSOrgBottom.y0, header->UCSOrgBottom.z0);
01751         if (acad_version_number >= AC1015) fprintf (fp, "  9\n$UCSORGLEFT\n 10\n%f\n 20\n%f\n 30\n%f\n", header->UCSOrgLeft.x0, header->UCSOrgLeft.y0, header->UCSOrgLeft.z0);
01752         if (acad_version_number >= AC1015) fprintf (fp, "  9\n$UCSORGRIGHT\n 10\n%f\n 20\n%f\n 30\n%f\n", header->UCSOrgRight.x0, header->UCSOrgRight.y0, header->UCSOrgRight.z0);
01753         if (acad_version_number >= AC1015) fprintf (fp, "  9\n$UCSORGFRONT\n 10\n%f\n 20\n%f\n 30\n%f\n", header->UCSOrgFront.x0, header->UCSOrgFront.y0, header->UCSOrgFront.z0);
01754         if (acad_version_number >= AC1015) fprintf (fp, "  9\n$UCSORGBACK\n 10\n%f\n 20\n%f\n 30\n%f\n", header->UCSOrgBack.x0, header->UCSOrgBack.y0, header->UCSOrgBack.z0);
01755         if (acad_version_number >= AC1015) fprintf (fp, "  9\n$PUCSBASE\n  2\n%s\n", header->PUCSBase);
01756         fprintf (fp, "  9\n$PUCSNAME\n  2\n%s\n", header->PUCSName);
01757         fprintf (fp, "  9\n$PUCSORG\n 10\n%f\n 20\n%f\n 30\n%f\n", header->PUCSOrg.x0, header->PUCSOrg.y0, header->PUCSOrg.z0);
01758         fprintf (fp, "  9\n$PUCSXDIR\n 10\n%f\n 20\n%f\n 30\n%f\n", header->PUCSXDir.x0, header->PUCSXDir.y0, header->PUCSXDir.z0);
01759         fprintf (fp, "  9\n$PUCSYDIR\n 10\n%f\n 20\n%f\n 30\n%f\n", header->PUCSYDir.x0, header->PUCSYDir.y0, header->PUCSYDir.z0);
01760         if (acad_version_number >= AC1015) fprintf (fp, "  9\n$PUCSORTHOREF\n  2\n%s\n", header->PUCSOrthoRef);
01761         if (acad_version_number >= AC1015) fprintf (fp, "  9\n$PUCSORTHOVIEW\n 70\n%i\n", header->PUCSOrthoView);
01762         if (acad_version_number >= AC1015) fprintf (fp, "  9\n$PUCSORGTOP\n 10\n%f\n 20\n%f\n 30\n%f\n", header->PUCSOrgTop.x0, header->PUCSOrgTop.y0, header->PUCSOrgTop.z0);
01763         if (acad_version_number >= AC1015) fprintf (fp, "  9\n$PUCSORGBOTTOM\n 10\n%f\n 20\n%f\n 30\n%f\n", header->PUCSOrgBottom.x0, header->PUCSOrgBottom.y0, header->PUCSOrgBottom.z0);
01764         if (acad_version_number >= AC1015) fprintf (fp, "  9\n$PUCSORGLEFT\n 10\n%f\n 20\n%f\n 30\n%f\n", header->PUCSOrgLeft.x0, header->PUCSOrgLeft.y0, header->PUCSOrgLeft.z0);
01765         if (acad_version_number >= AC1015) fprintf (fp, "  9\n$PUCSORGRIGHT\n 10\n%f\n 20\n%f\n 30\n%f\n", header->PUCSOrgRight.x0, header->PUCSOrgRight.y0, header->PUCSOrgRight.z0);
01766         if (acad_version_number >= AC1015) fprintf (fp, "  9\n$PUCSORGFRONT\n 10\n%f\n 20\n%f\n 30\n%f\n", header->PUCSOrgFront.x0, header->PUCSOrgFront.y0, header->PUCSOrgFront.z0);
01767         if (acad_version_number >= AC1015) fprintf (fp, "  9\n$PUCSORGBACK\n 10\n%f\n 20\n%f\n 30\n%f\n", header->PUCSOrgBack.x0, header->PUCSOrgBack.y0, header->PUCSOrgBack.z0);
01768         fprintf (fp, "  9\n$USERI1\n 70\n%i\n", header->UserI1);
01769         fprintf (fp, "  9\n$USERI2\n 70\n%i\n", header->UserI2);
01770         fprintf (fp, "  9\n$USERI3\n 70\n%i\n", header->UserI3);
01771         fprintf (fp, "  9\n$USERI4\n 70\n%i\n", header->UserI4);
01772         fprintf (fp, "  9\n$USERI5\n 70\n%i\n", header->UserI5);
01773         fprintf (fp, "  9\n$USERR1\n 40\n%f\n", header->UserR1);
01774         fprintf (fp, "  9\n$USERR2\n 40\n%f\n", header->UserR2);
01775         fprintf (fp, "  9\n$USERR3\n 40\n%f\n", header->UserR3);
01776         fprintf (fp, "  9\n$USERR4\n 40\n%f\n", header->UserR4);
01777         fprintf (fp, "  9\n$USERR5\n 40\n%f\n", header->UserR5);
01778         fprintf (fp, "  9\n$WORLDVIEW\n 70\n%i\n", header->WorldView);
01779         fprintf (fp, "  9\n$SHADEDGE\n 70\n%i\n", header->ShadEdge);
01780         fprintf (fp, "  9\n$SHADEDIF\n 70\n%i\n", header->ShadeDif);
01781         fprintf (fp, "  9\n$TILEMODE\n 70\n%i\n", header->TileMode);
01782         fprintf (fp, "  9\n$MAXACTVP\n 70\n%i\n", header->MaxActVP);
01783         fprintf (fp, "  9\n$PINSBASE\n 10\n%f\n 20\n%f\n 30\n%f\n", header->PInsBase.x0, header->PInsBase.y0, header->PInsBase.z0);
01784         fprintf (fp, "  9\n$PLIMCHECK\n 70\n%i\n", header->PLimCheck);
01785         fprintf (fp, "  9\n$PEXTMIN\n 10\n%f\n 20\n%f\n 30\n%f\n", header->PExtMin.x0, header->PExtMin.y0, header->PExtMin.z0);
01786         fprintf (fp, "  9\n$PEXTMAX\n 10\n%f\n 20\n%f\n 30\n%f\n", header->PExtMax.x0, header->PExtMax.y0, header->PExtMax.z0);
01787         */
01788         ret = dxf_header_read_parse_n_double (fp, temp_string, "$PLIMMIN",
01789                                               TRUE,
01790                                               2,
01791                                               &header->PLimMin.x0,
01792                                               header->PLimMin.y0);
01793         dxf_return(ret);
01794     
01795         ret = dxf_header_read_parse_n_double (fp, temp_string, "$PLIMMAX",
01796                                               TRUE,
01797                                               2,
01798                                               &header->PLimMax.x0,
01799                                               header->PLimMax.y0);
01800         dxf_return(ret);
01801         /*
01802         fprintf (fp, "  9\n$UNITMODE\n 70\n%i\n", header->UnitMode);
01803         fprintf (fp, "  9\n$VISRETAIN\n 70\n%i\n", header->VisRetain);
01804         fprintf (fp, "  9\n$PLINEGEN\n 70\n%i\n", header->PLineGen);
01805         fprintf (fp, "  9\n$PSLTSCALE\n 70\n%i\n", header->PSLTScale);
01806         if (acad_version_number >= AC1012) fprintf (fp, "  9\n$TREEDEPTH\n 70\n%i\n", header->TreeDepth);
01807         if ((acad_version_number == AC1012) || (acad_version_number == AC1014)) fprintf (fp, "  9\n$PICKSTYLE\n 70\n%i\n", header->PickStyle);
01808         if (acad_version_number >= AC1012) fprintf (fp, "  9\n$CMLSTYLE\n  2\n%s\n", header->CMLStyle);
01809         if (acad_version_number >= AC1012) fprintf (fp, "  9\n$CMLJUST\n 70\n%i\n", header->CMLJust);
01810         if (acad_version_number >= AC1012) fprintf (fp, "  9\n$CMLSCALE\n 40\n%f\n", header->CMLScale);
01811         if (acad_version_number >= AC1014) fprintf (fp, "  9\n$PROXYGRAPHICS\n 70\n%i\n", header->ProxyGraphics);
01812         if (acad_version_number >= AC1014) fprintf (fp, "  9\n$MEASUREMENT\n 70\n%i\n", header->Measurement);
01813         if (acad_version_number == AC1012) fprintf (fp, "  9\n$SAVEIMAGES\n 70\n%i\n", header->SaveImages);
01814         if (acad_version_number >= AC1015) fprintf (fp, "  9\n$CELWEIGHT\n370\n%i\n", header->CELWeight);
01815         if (acad_version_number >= AC1015) fprintf (fp, "  9\n$ENDCAPS\n280\n%i\n", header->EndCaps);
01816         if (acad_version_number >= AC1015) fprintf (fp, "  9\n$JOINSTYLE\n280\n%i\n", header->JoinStyle);
01817         if (acad_version_number >= AC1015) fprintf (fp, "  9\n$LWDISPLAY\n290\n%i\n", header->LWDisplay);
01818         */
01819         ret = dxf_header_read_parse_int (fp, temp_string, "$INSUNITS",
01820                                          &header->InsUnits,
01821                                          acad_version_number >= AC1015);
01822         dxf_return(ret);
01823         /*
01824         if (acad_version_number >= AC1015) fprintf (fp, "  9\n$HYPERLINKBASE\n  1\n%s\n", header->HyperLinkBase);
01825         if (acad_version_number >= AC1015) fprintf (fp, "  9\n$STYLESHEET\n  1\n%s\n", header->StyleSheet);
01826         if (acad_version_number >= AC1015) fprintf (fp, "  9\n$XEDIT\n290\n%i\n", header->XEdit);
01827         if (acad_version_number >= AC1015) fprintf (fp, "  9\n$CEPSNTYPE\n380\n%i\n", header->CEPSNType);
01828         if (acad_version_number >= AC1015) fprintf (fp, "  9\n$PSTYLEMODE\n290\n%i\n", header->PStyleMode);
01829         if (acad_version_number >= AC1015) fprintf (fp, "  9\n$FINGERPRINTGUID\n  2\n%s\n", header->FingerPrintGUID);
01830         if (acad_version_number >= AC1015) fprintf (fp, "  9\n$VERSIONGUID\n  2\n%s\n", header->VersionGUID);
01831         if (acad_version_number >= AC1015) fprintf (fp, "  9\n$EXTNAMES\n290\n%i\n", header->ExtNames);
01832         if (acad_version_number >= AC1015) fprintf (fp, "  9\n$PSVPSCALE\n 40\n%f\n", header->PSVPScale);
01833         if (acad_version_number >= AC1015) fprintf (fp, "  9\n$OLESTARTUP\n290\n%i\n", header->OLEStartUp);
01834         if (acad_version_number >= AC1018) fprintf (fp, "  9\n$SORTENTS\n280\n%i\n", header->SortEnts);
01835         if (acad_version_number >= AC1018) fprintf (fp, "  9\n$INDEXCTL\n280\n%i\n", header->IndexCtl);
01836         if (acad_version_number >= AC1018) fprintf (fp, "  9\n$HIDETEXT\n280\n%i\n", header->HideText);
01837         if (acad_version_number >= AC1018) fprintf (fp, "  9\n$XCLIPFRAME\n290\n%i\n", header->XClipFrame);
01838         if (acad_version_number >= AC1018) fprintf (fp, "  9\n$HALOGAP\n280\n%i\n", header->HaloGap);
01839         if (acad_version_number >= AC1018) fprintf (fp, "  9\n$OBSCOLOR\n 70\n%i\n", header->ObsColor);
01840         if (acad_version_number >= AC1018) fprintf (fp, "  9\n$OBSLTYPE\n280\n%i\n", header->ObsLType);
01841         if (acad_version_number >= AC1018) fprintf (fp, "  9\n$INTERSECTIONDISPLAY\n280\n%i\n", header->InterSectionDisplay);
01842         if (acad_version_number >= AC1018) fprintf (fp, "  9\n$INTERSECTIONCOLOR\n 70\n%i\n", header->InterSectionColor);
01843         if (acad_version_number >= AC1018) fprintf (fp, "  9\n$DIMASSOC\n280\n%i\n", header->DimASSOC);
01844         if (acad_version_number >= AC1018) fprintf (fp, "  9\n$PROJECTNAME\n  1\n%s\n", header->ProjectName);        
01845 */
01846         ret = dxf_header_read_parse_n_double (fp, temp_string, "$GRIDUNIT",
01847                                               acad_version_number >= AC1009,
01848                                               2,
01849                                               &header->GridUnit.x0,
01850                                               &header->GridUnit.y0);
01851         dxf_return(ret);
01852 
01853         ret = dxf_header_read_parse_int (fp, temp_string, "$GRIDMODE",
01854                                          &header->GridMode,
01855                                          acad_version_number >= AC1009);
01856         dxf_return(ret);
01857 #if DEBUG
01858         DXF_DEBUG_END
01859 #endif
01860        return FALSE;
01861 }
01862 
01866 DxfHeader *
01867 dxf_header_read
01868 (
01869         DxfFile *fp,
01871         DxfHeader *header
01873 )
01874 {
01875 #if DEBUG
01876         DXF_DEBUG_BEGIN
01877 #endif
01878         char temp_string[255];
01879         int n, acad_version_number, ret;
01880 
01881         /* Do some basic checks. */
01882         if (fp == NULL)
01883         {
01884                 fprintf (stderr,
01885                   (_("Error in %s () a NULL file pointer was passed.\n")),
01886                   __FUNCTION__);
01887                 return (NULL);
01888         }
01889         if (header == NULL)
01890         {
01891                 fprintf (stderr,
01892                   (_("Warning in %s () a NULL pointer was passed.\n")),
01893                   __FUNCTION__);
01894                 header = dxf_header_new ();
01895 //                header = dxf_header_init (header, acad_version_number);
01896         }
01897         if (header == NULL)
01898         {
01899                 fprintf (stderr,
01900                   (_("Error in %s () could not allocate memory for a DxfHeader struct.\n")),
01901                   __FUNCTION__);
01902                 return (NULL);
01903         }
01904         /* first of all we MUST read the version number */
01905         dxf_read_scanf (fp, "%i\n%s\n", &n, temp_string);
01906         ret = dxf_header_read_parse_string (fp, temp_string,
01907           "$ACADVER", &header->AcadVer, TRUE);
01908         dxf_return_val_if_fail (ret, FALSE);
01909         /* turn the acad_version into an integer */
01910         acad_version_number = dxf_header_acad_version_from_string (header->AcadVer);
01911     
01913         header->_AcadVer = acad_version_number;
01914     
01915         /* a loop to read all the header with no particulary order */
01916         while (!feof (fp->fp))
01917         {
01918                 /* reads the next header content */
01919                 dxf_read_scanf (fp, "%i\n%s\n", &n, temp_string);
01920                 /* if it is a valid line */
01921                 if (n == 9)
01922                 {
01923                         /* parses the header content and extract info to the header struct */
01924                         ret = dxf_header_read_parser (fp, header,
01925                           temp_string, acad_version_number);
01926                         dxf_return_val_if_fail (ret, FALSE);
01927                         if (ret != FOUND)
01928                                 return FALSE;
01929                 }
01930                 /* or it can be the end of the section */
01931                 else if (n == 0 && strcmp (temp_string, "ENDSEC") == 0)
01932                 {
01933 #if DEBUG
01934                         fprintf (stderr,
01935                           (_("[File: %s: line: %d] read_header :: Section Ended.\n")),
01936                           __FILE__, __LINE__);
01937 #endif
01938                 }        
01939         }
01940 #if DEBUG
01941         DXF_DEBUG_END
01942 #endif
01943         return (header);
01944 }
01945 
01946 
01959 DxfHeader *
01960 dxf_header_free
01961 (
01962         DxfHeader *header
01965 )
01966 {
01967 #ifdef DEBUG
01968         DXF_DEBUG_BEGIN
01969 #endif
01970         /* Do some basic checks. */
01971         if (header == NULL)
01972         {
01973                 fprintf (stderr,
01974                   (_("Error in %s () a NULL pointer was passed.\n")),
01975                   __FUNCTION__);
01976                 return (header);
01977         }
01978         free (header->AcadVer);
01979         free (header->DWGCodePage);
01980 //        dxf_point_free ((struct DxfPoint) header->InsBase);
01981 //        dxf_point_free ((struct DxfPoint) header->ExtMin);
01982 //        dxf_point_free ((struct DxfPoint) header->ExtMax);
01983 //        dxf_point_free ((struct DxfPoint) header->LimMin);
01984 //        dxf_point_free ((struct DxfPoint) header->LimMax);
01985         free (header->TextStyle);
01986         free (header->CLayer);
01987         free (header->CELType);
01988         free (header->DimBLK);
01989         free (header->DimPOST);
01990         free (header->DimAPOST);
01991         free (header->DimBLK1);
01992         free (header->DimBLK2);
01993         free (header->DimSTYLE);
01994         free (header->DimTXSTY);
01995         free (header->DimLDRBLK);
01996         free (header->Menu);
01997         free (header->HandSeed);
01998         free (header->UCSBase);
01999         free (header->UCSName);
02000 //        dxf_point_free ((struct DxfPoint) header->UCSOrg);
02001 //        dxf_point_free ((struct DxfPoint) header->UCSXDir);
02002 //        dxf_point_free ((struct DxfPoint) header->UCSYDir);
02003         free (header->UCSOrthoRef);
02004 //        dxf_point_free ((struct DxfPoint) header->UCSOrgTop);
02005 //        dxf_point_free ((struct DxfPoint) header->UCSOrgBottom);
02006 //        dxf_point_free ((struct DxfPoint) header->UCSOrgLeft);
02007 //        dxf_point_free ((struct DxfPoint) header->UCSOrgRight);
02008 //        dxf_point_free ((struct DxfPoint) header->UCSOrgFront);
02009 //        dxf_point_free ((struct DxfPoint) header->UCSOrgBack);
02010 //        dxf_point_free ((struct DxfPoint) header->PUCSOrg);
02011 //        dxf_point_free ((struct DxfPoint) header->PUCSXDir);
02012 //        dxf_point_free ((struct DxfPoint) header->PUCSYDir);
02013         free (header->PUCSOrthoRef);
02014 //        dxf_point_free ((struct DxfPoint) header->PUCSOrgTop);
02015 //        dxf_point_free ((struct DxfPoint) header->PUCSOrgBottom);
02016 //        dxf_point_free ((struct DxfPoint) header->PUCSOrgLeft);
02017 //        dxf_point_free ((struct DxfPoint) header->PUCSOrgRight);
02018 //        dxf_point_free ((struct DxfPoint) header->PUCSOrgFront);
02019 //        dxf_point_free ((struct DxfPoint) header->PUCSOrgBack);
02020 //        dxf_point_free ((struct DxfPoint) header->PInsBase);
02021 //        dxf_point_free ((struct DxfPoint) header->PExtMin);
02022 //        dxf_point_free ((struct DxfPoint) header->PExtMax);
02023 //        dxf_point_free ((struct DxfPoint) header->PLimMin);
02024 //        dxf_point_free ((struct DxfPoint) header->PLimMax);
02025         free (header->CMLStyle);
02026         free (header->HyperLinkBase);
02027         free (header->StyleSheet);
02028         free (header->FingerPrintGUID);
02029         free (header->VersionGUID);
02030         free (header->ProjectName);
02031         free (header);
02032         header = NULL;
02033 #ifdef DEBUG
02034         DXF_DEBUG_END
02035 #endif
02036         return (header);
02037 }
02038 
02039 
02040 /* EOF */