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

body.c

Go to the documentation of this file.
00001 
00044 #include "body.h"
00045 
00046 
00052 DxfBody *
00053 dxf_body_new ()
00054 {
00055 #if DEBUG
00056         DXF_DEBUG_BEGIN
00057 #endif
00058         DxfBody *body = NULL;
00059         size_t size;
00060 
00061         size = sizeof (DxfBody);
00062         /* avoid malloc of 0 bytes */
00063         if (size == 0) size = 1;
00064         if ((body = malloc (size)) == NULL)
00065         {
00066                 fprintf (stderr,
00067                   (_("Error in %s () could not allocate memory for a DxfBody struct.\n")),
00068                   __FUNCTION__);
00069                 body = NULL;
00070         }
00071         else
00072         {
00073                 memset (body, 0, size);
00074         }
00075 #if DEBUG
00076         DXF_DEBUG_END
00077 #endif
00078         return (body);
00079 }
00080 
00081 
00089 DxfBody *
00090 dxf_body_init
00091 (
00092         DxfBody *body
00094 )
00095 {
00096 #if DEBUG
00097         DXF_DEBUG_BEGIN
00098 #endif
00099         /* Do some basic checks. */
00100         if (body == NULL)
00101         {
00102                 fprintf (stderr,
00103                   (_("Warning in %s () a NULL pointer was passed.\n")),
00104                   __FUNCTION__);
00105                 body = dxf_body_new ();
00106         }
00107         if (body == NULL)
00108         {
00109                 fprintf (stderr,
00110                   (_("Error in %s () could not allocate memory for a DxfBody struct.\n")),
00111                   __FUNCTION__);
00112                 return (NULL);
00113         }
00114         dxf_body_set_id_code (body, 0);
00115         dxf_body_set_linetype (body, strdup (DXF_DEFAULT_LINETYPE));
00116         dxf_body_set_layer (body, strdup (DXF_DEFAULT_LAYER));
00117         dxf_body_set_elevation (body, 0.0);
00118         dxf_body_set_thickness (body, 0.0);
00119         dxf_body_set_linetype_scale (body, DXF_DEFAULT_LINETYPE_SCALE);
00120         dxf_body_set_visibility (body, DXF_DEFAULT_VISIBILITY);
00121         dxf_body_set_color (body, DXF_COLOR_BYLAYER);
00122         dxf_body_set_paperspace (body, DXF_MODELSPACE);
00123         dxf_body_set_graphics_data_size (body, 0);
00124         dxf_body_set_shadow_mode (body, 0);
00125         dxf_body_set_binary_graphics_data (body, (DxfBinaryGraphicsData *) dxf_binary_graphics_data_init (body->binary_graphics_data));
00126         dxf_binary_graphics_data_init ((DxfBinaryGraphicsData *) dxf_body_get_binary_graphics_data (body));
00127         dxf_body_set_dictionary_owner_soft (body, strdup (""));
00128         dxf_body_set_material (body, strdup (""));
00129         dxf_body_set_dictionary_owner_hard (body, strdup (""));
00130         dxf_body_set_lineweight (body, 0);
00131         dxf_body_set_plot_style_name (body, strdup (""));
00132         dxf_body_set_color_value (body, 0);
00133         dxf_body_set_color_name (body, strdup (""));
00134         dxf_body_set_transparency (body, 0);
00135         dxf_body_set_proprietary_data (body, (DxfProprietaryData *) dxf_proprietary_data_init (body->proprietary_data));
00136         dxf_body_set_proprietary_data (body, (DxfProprietaryData *) dxf_proprietary_data_init (body->additional_proprietary_data));
00137         dxf_body_set_modeler_format_version_number (body, 1);
00138         dxf_body_set_next (body, NULL);
00139 #if DEBUG
00140         DXF_DEBUG_END
00141 #endif
00142         return (body);
00143 }
00144 
00145 
00157 DxfBody *
00158 dxf_body_read
00159 (
00160         DxfFile *fp,
00162         DxfBody *body
00164 )
00165 {
00166 #if DEBUG
00167         DXF_DEBUG_BEGIN
00168 #endif
00169         char *temp_string = NULL;
00170         int i;
00171 
00172         /* Do some basic checks. */
00173         if (fp == NULL)
00174         {
00175                 fprintf (stderr,
00176                   (_("Error in %s () a NULL file pointer was passed.\n")),
00177                   __FUNCTION__);
00178                 /* Clean up. */
00179                 free (temp_string);
00180                 return (NULL);
00181         }
00182         if (body == NULL)
00183         {
00184                 fprintf (stderr,
00185                   (_("Warning in %s () a NULL pointer was passed.\n")),
00186                   __FUNCTION__);
00187                 body = dxf_body_new ();
00188                 body = dxf_body_init (body);
00189         }
00190         if (fp->acad_version_number < AutoCAD_13)
00191         {
00192                 fprintf (stderr,
00193                   (_("Warning in %s () illegal DXF version for this entity.\n")),
00194                   __FUNCTION__);
00195         }
00196         i = 0;
00197         (fp->line_number)++;
00198         fscanf (fp->fp, "%[^\n]", temp_string);
00199         while (strcmp (temp_string, "0") != 0)
00200         {
00201                 if (ferror (fp->fp))
00202                 {
00203                         fprintf (stderr,
00204                           (_("Error in %s () while reading from: %s in line: %d.\n")),
00205                           __FUNCTION__, fp->filename, fp->line_number);
00206                         fclose (fp->fp);
00207                         /* Clean up. */
00208                         free (temp_string);
00209                         return (NULL);
00210                 }
00211                 else if (strcmp (temp_string, "  1") == 0)
00212                 {
00213                         /* Now follows a string containing proprietary
00214                          * data. */
00215                         (fp->line_number)++;
00216                         fscanf (fp->fp, "%s\n", body->proprietary_data->line);
00217                         body->proprietary_data->order = i;
00218                         i++;
00219                         dxf_proprietary_data_init ((DxfProprietaryData *) body->proprietary_data->next);
00220                         body->proprietary_data = (DxfProprietaryData *) body->proprietary_data->next;
00221                 }
00222                 else if (strcmp (temp_string, "  3") == 0)
00223                 {
00224                         /* Now follows a string containing additional
00225                          * proprietary data. */
00226                         (fp->line_number)++;
00227                         fscanf (fp->fp, "%s\n", body->additional_proprietary_data->line);
00228                         body->additional_proprietary_data->order = i;
00229                         i++;
00230                         dxf_proprietary_data_init ((DxfProprietaryData *) body->additional_proprietary_data->next);
00231                         body->additional_proprietary_data = (DxfProprietaryData *) body->additional_proprietary_data->next;
00232                 }
00233                 if (strcmp (temp_string, "5") == 0)
00234                 {
00235                         /* Now follows a string containing a sequential
00236                          * id number. */
00237                         (fp->line_number)++;
00238                         fscanf (fp->fp, "%x\n", &body->id_code);
00239                 }
00240                 else if (strcmp (temp_string, "6") == 0)
00241                 {
00242                         /* Now follows a string containing a linetype
00243                          * name. */
00244                         (fp->line_number)++;
00245                         fscanf (fp->fp, "%s\n", body->linetype);
00246                 }
00247                 else if (strcmp (temp_string, "8") == 0)
00248                 {
00249                         /* Now follows a string containing a layer name. */
00250                         (fp->line_number)++;
00251                         fscanf (fp->fp, "%s\n", body->layer);
00252                 }
00253                 else if ((fp->acad_version_number <= AutoCAD_11)
00254                   && DXF_FLATLAND
00255                   && (strcmp (temp_string, "38") == 0))
00256                 {
00257                         /* Now follows a string containing the
00258                          * elevation. */
00259                         (fp->line_number)++;
00260                         fscanf (fp->fp, "%lf\n", &body->elevation);
00261                 }
00262                 else if (strcmp (temp_string, "39") == 0)
00263                 {
00264                         /* Now follows a string containing the
00265                          * thickness. */
00266                         (fp->line_number)++;
00267                         fscanf (fp->fp, "%lf\n", &body->thickness);
00268                 }
00269                 else if (strcmp (temp_string, "62") == 0)
00270                 {
00271                         /* Now follows a string containing the
00272                          * color value. */
00273                         (fp->line_number)++;
00274                         fscanf (fp->fp, "%d\n", &body->color);
00275                 }
00276                 else if (strcmp (temp_string, "67") == 0)
00277                 {
00278                         /* Now follows a string containing the
00279                          * paperspace value. */
00280                         (fp->line_number)++;
00281                         fscanf (fp->fp, "%d\n", &body->paperspace);
00282                 }
00283                 else if ((fp->acad_version_number >= AutoCAD_13)
00284                         && (strcmp (temp_string, "70") == 0))
00285                 {
00286                         /* Now follows a string containing the modeler
00287                          * format version number. */
00288                         (fp->line_number)++;
00289                         fscanf (fp->fp, "%d\n", &body->modeler_format_version_number);
00290                 }
00291                 else if ((fp->acad_version_number >= AutoCAD_13)
00292                         && (strcmp (temp_string, "100") == 0))
00293                 {
00294                         /* Now follows a string containing the
00295                          * subclass marker value. */
00296                         (fp->line_number)++;
00297                         fscanf (fp->fp, "%s\n", temp_string);
00298                         if (strcmp (temp_string, "AcDbModelerGeometry") != 0)
00299                         {
00300                                 fprintf (stderr, "Warning in dxf_body_read () found a bad subclass marker in: %s in line: %d.\n",
00301                                         fp->filename, fp->line_number);
00302                         }
00303                 }
00304                 else if (strcmp (temp_string, "330") == 0)
00305                 {
00306                         /* Now follows a string containing Soft-pointer
00307                          * ID/handle to owner dictionary. */
00308                         (fp->line_number)++;
00309                         fscanf (fp->fp, "%s\n", body->dictionary_owner_soft);
00310                 }
00311                 else if (strcmp (temp_string, "360") == 0)
00312                 {
00313                         /* Now follows a string containing Hard owner
00314                          * ID/handle to owner dictionary. */
00315                         (fp->line_number)++;
00316                         fscanf (fp->fp, "%s\n", body->dictionary_owner_hard);
00317                 }
00318                 else if (strcmp (temp_string, "999") == 0)
00319                 {
00320                         /* Now follows a string containing a comment. */
00321                         (fp->line_number)++;
00322                         fscanf (fp->fp, "%s\n", temp_string);
00323                         fprintf (stdout, "DXF comment: %s\n", temp_string);
00324                 }
00325                 else
00326                 {
00327                         fprintf (stderr,
00328                           (_("Warning in %s () unknown string tag found while reading from: %s in line: %d.\n")),
00329                           __FUNCTION__, fp->filename, fp->line_number);
00330                 }
00331         }
00332         /* Handle omitted members and/or illegal values. */
00333         if (strcmp (body->linetype, "") == 0)
00334         {
00335                 body->linetype = strdup (DXF_DEFAULT_LINETYPE);
00336         }
00337         if (strcmp (body->layer, "") == 0)
00338         {
00339                 body->layer = strdup (DXF_DEFAULT_LAYER);
00340         }
00341         if (body->modeler_format_version_number == 0)
00342         {
00343                 fprintf (stderr,
00344                   (_("Warning: in %s () illegal modeler format version number found while reading from: %s in line: %d.\n")),
00345                   __FUNCTION__, fp->filename, fp->line_number);
00346                 fprintf (stderr,
00347                   (_("\tmodeler format version number is reset to 1.\n")));
00348                 body->modeler_format_version_number = 1;
00349         }
00350         /* Clean up. */
00351         free (temp_string);
00352 #if DEBUG
00353         DXF_DEBUG_END
00354 #endif
00355         return (body);
00356 }
00357 
00358 
00365 int
00366 dxf_body_write
00367 (
00368         DxfFile *fp,
00370         DxfBody *body
00372 )
00373 {
00374 #if DEBUG
00375         DXF_DEBUG_BEGIN
00376 #endif
00377         char *dxf_entity_name = strdup ("BODY");
00378         DxfProprietaryData *iter = NULL;
00379         DxfProprietaryData *additional_iter = NULL;
00380         int i;
00381 
00382         /* Do some basic checks. */
00383         if (fp == NULL)
00384         {
00385                 fprintf (stderr,
00386                   (_("Error in %s () a NULL file pointer was passed.\n")),
00387                   __FUNCTION__);
00388                 /* Clean up. */
00389                 free (dxf_entity_name);
00390                 return (EXIT_FAILURE);
00391         }
00392         if (body == NULL)
00393         {
00394                 fprintf (stderr,
00395                   (_("Error in %s () a NULL pointer was passed.\n")),
00396                   __FUNCTION__);
00397                 /* Clean up. */
00398                 free (dxf_entity_name);
00399                 return (EXIT_FAILURE);
00400         }
00401         if (fp->acad_version_number < AutoCAD_13)
00402         {
00403                 fprintf (stderr,
00404                   (_("Warning in %s () illegal DXF version for this %s entity with id-code: %x.\n")),
00405                   __FUNCTION__, dxf_entity_name, dxf_body_get_id_code (body));
00406         }
00407         if (strcmp (dxf_body_get_linetype (body), "") == 0)
00408         {
00409                 fprintf (stderr,
00410                   (_("Warning in %s () empty linetype string for the %s entity with id-code: %x\n")),
00411                   __FUNCTION__, dxf_entity_name, dxf_body_get_id_code (body));
00412                 fprintf (stderr,
00413                   (_("\t%s entity is reset to default linetype")),
00414                   dxf_entity_name);
00415                 dxf_body_set_linetype (body, strdup (DXF_DEFAULT_LAYER));
00416         }
00417         if (strcmp (dxf_body_get_layer (body), "") == 0)
00418         {
00419                 fprintf (stderr,
00420                   (_("Warning in %s () empty layer string for the %s entity with id-code: %x\n")),
00421                   __FUNCTION__, dxf_entity_name, dxf_body_get_id_code (body));
00422                 fprintf (stderr,
00423                   (_("\t%s entity is relocated to layer 0")),
00424                   dxf_entity_name);
00425                 dxf_body_set_layer (body, strdup (DXF_DEFAULT_LAYER));
00426         }
00427         /* Start writing output. */
00428         i = 1;
00429         fprintf (fp->fp, "  0\n%s\n", dxf_entity_name);
00430         if (dxf_body_get_id_code (body) != -1)
00431         {
00432                 fprintf (fp->fp, "  5\n%x\n", dxf_body_get_id_code (body));
00433         }
00444         if ((strcmp (dxf_body_get_dictionary_owner_soft (body), "") != 0)
00445           && (fp->acad_version_number >= AutoCAD_14))
00446         {
00447                 fprintf (fp->fp, "102\n{ACAD_REACTORS\n");
00448                 fprintf (fp->fp, "330\n%s\n", dxf_body_get_dictionary_owner_soft (body));
00449                 fprintf (fp->fp, "102\n}\n");
00450         }
00451         if ((strcmp (dxf_body_get_dictionary_owner_hard (body), "") != 0)
00452           && (fp->acad_version_number >= AutoCAD_14))
00453         {
00454                 fprintf (fp->fp, "102\n{ACAD_XDICTIONARY\n");
00455                 fprintf (fp->fp, "360\n%s\n", dxf_body_get_dictionary_owner_hard (body));
00456                 fprintf (fp->fp, "102\n}\n");
00457         }
00458         if (fp->acad_version_number >= AutoCAD_13)
00459         {
00460                 fprintf (fp->fp, "100\nAcDbEntity\n");
00461         }
00462         if (dxf_body_get_paperspace (body) == DXF_PAPERSPACE)
00463         {
00464                 fprintf (fp->fp, " 67\n%d\n", DXF_PAPERSPACE);
00465         }
00466         fprintf (fp->fp, "  8\n%s\n", dxf_body_get_layer (body));
00467         if (strcmp (dxf_body_get_linetype (body), DXF_DEFAULT_LINETYPE) != 0)
00468         {
00469                 fprintf (fp->fp, "  6\n%s\n", dxf_body_get_linetype (body));
00470         }
00471         if ((fp->acad_version_number <= AutoCAD_11)
00472           && DXF_FLATLAND
00473           && (dxf_body_get_elevation (body) != 0.0))
00474         {
00475                 fprintf (fp->fp, " 38\n%f\n", dxf_body_get_elevation (body));
00476         }
00477         if (dxf_body_get_thickness (body) != 0.0)
00478         {
00479                 fprintf (fp->fp, " 39\n%f\n", dxf_body_get_thickness (body));
00480         }
00481         if (dxf_body_get_linetype_scale (body) != 1.0)
00482         {
00483                 fprintf (fp->fp, " 48\n%f\n", dxf_body_get_linetype_scale (body));
00484         }
00485         if (dxf_body_get_visibility (body) != 0)
00486         {
00487                 fprintf (fp->fp, " 60\n%d\n", dxf_body_get_visibility (body));
00488         }
00489         if (dxf_body_get_color (body) != DXF_COLOR_BYLAYER)
00490         {
00491                 fprintf (fp->fp, " 62\n%d\n", dxf_body_get_color (body));
00492         }
00493         if (fp->acad_version_number >= AutoCAD_13)
00494         {
00495                 fprintf (fp->fp, "100\nAcDbModelerGeometry\n");
00496         }
00497         if (fp->acad_version_number >= AutoCAD_13)
00498         {
00499                 fprintf (fp->fp, " 70\n%d\n", dxf_body_get_modeler_format_version_number (body));
00500         }
00501         iter = (DxfProprietaryData *) dxf_body_get_proprietary_data (body);
00502         additional_iter = (DxfProprietaryData *) dxf_body_get_additional_proprietary_data (body);
00503         while ((iter != NULL) || (additional_iter != NULL))
00504         {
00505                 if (iter->order == i)
00506                 {
00507                         fprintf (fp->fp, "  1\n%s\n", dxf_proprietary_data_get_line (iter));
00508                         iter = (DxfProprietaryData *) dxf_proprietary_data_get_next (iter);
00509                         i++;
00510                 }
00511                 if (additional_iter->order == i)
00512                 {
00513                         fprintf (fp->fp, "  3\n%s\n", dxf_proprietary_data_get_line (additional_iter));
00514                         additional_iter = (DxfProprietaryData *) dxf_proprietary_data_get_next (additional_iter);
00515                         i++;
00516                 }
00517         }
00518         /* Clean up. */
00519         free (dxf_entity_name);
00520 #if DEBUG
00521         DXF_DEBUG_END
00522 #endif
00523         return (EXIT_SUCCESS);
00524 }
00525 
00526 
00534 int
00535 dxf_body_free
00536 (
00537         DxfBody *body
00540 )
00541 {
00542 #if DEBUG
00543         DXF_DEBUG_BEGIN
00544 #endif
00545         /* Do some basic checks. */
00546         if (body == NULL)
00547         {
00548                 fprintf (stderr,
00549                   (_("Error in %s () a NULL pointer was passed.\n")),
00550                   __FUNCTION__);
00551                 return (EXIT_FAILURE);
00552         }
00553         if (body->next != NULL)
00554         {
00555                 fprintf (stderr,
00556                   (_("Error in %s () pointer to next was not NULL.\n")),
00557                   __FUNCTION__);
00558                 return (EXIT_FAILURE);
00559         }
00560         free (body->linetype);
00561         free (body->layer);
00562         dxf_proprietary_data_free_chain (body->proprietary_data);
00563         dxf_proprietary_data_free_chain (body->additional_proprietary_data);
00564         free (body->dictionary_owner_soft);
00565         free (body->dictionary_owner_hard);
00566         free (body);
00567         body = NULL;
00568 #if DEBUG
00569         DXF_DEBUG_END
00570 #endif
00571         return (EXIT_SUCCESS);
00572 }
00573 
00574 
00579 void
00580 dxf_body_free_chain
00581 (
00582         DxfBody *bodies
00584 )
00585 {
00586 #ifdef DEBUG
00587         DXF_DEBUG_BEGIN
00588 #endif
00589         if (bodies == NULL)
00590         {
00591                 fprintf (stderr,
00592                   (_("Warning in %s () a NULL pointer was passed.\n")),
00593                   __FUNCTION__);
00594         }
00595         while (bodies != NULL)
00596         {
00597                 struct DxfBody *iter = bodies->next;
00598                 dxf_body_free (bodies);
00599                 bodies = (DxfBody *) iter;
00600         }
00601 #if DEBUG
00602         DXF_DEBUG_END
00603 #endif
00604 }
00605 
00606 
00612 int
00613 dxf_body_get_id_code
00614 (
00615         DxfBody *body
00617 )
00618 {
00619 #if DEBUG
00620         DXF_DEBUG_BEGIN
00621 #endif
00622         /* Do some basic checks. */
00623         if (body == NULL)
00624         {
00625                 fprintf (stderr,
00626                   (_("Error in %s () a NULL pointer was passed.\n")),
00627                   __FUNCTION__);
00628                 return (EXIT_FAILURE);
00629         }
00630         if (body->id_code < 0)
00631         {
00632                 fprintf (stderr,
00633                   (_("Error in %s () a negative value was found in the id-code member.\n")),
00634                   __FUNCTION__);
00635                 return (EXIT_FAILURE);
00636         }
00637 #if DEBUG
00638         DXF_DEBUG_END
00639 #endif
00640         return (body->id_code);
00641 }
00642 
00643 
00647 DxfBody *
00648 dxf_body_set_id_code
00649 (
00650         DxfBody *body,
00652         int id_code
00656 )
00657 {
00658 #if DEBUG
00659         DXF_DEBUG_BEGIN
00660 #endif
00661         /* Do some basic checks. */
00662         if (body == NULL)
00663         {
00664                 fprintf (stderr,
00665                   (_("Error in %s () a NULL pointer was passed.\n")),
00666                   __FUNCTION__);
00667                 return (NULL);
00668         }
00669         if (id_code < 0)
00670         {
00671                 fprintf (stderr,
00672                   (_("Error in %s () a negative id-code value was passed.\n")),
00673                   __FUNCTION__);
00674                 return (NULL);
00675         }
00676         body->id_code = id_code;
00677 #if DEBUG
00678         DXF_DEBUG_END
00679 #endif
00680         return (body);
00681 }
00682 
00683 
00689 char *
00690 dxf_body_get_linetype
00691 (
00692         DxfBody *body
00694 )
00695 {
00696 #if DEBUG
00697         DXF_DEBUG_BEGIN
00698 #endif
00699         /* Do some basic checks. */
00700         if (body == NULL)
00701         {
00702                 fprintf (stderr,
00703                   (_("Error in %s () a NULL pointer was passed.\n")),
00704                   __FUNCTION__);
00705                 return (NULL);
00706         }
00707         if (body->linetype ==  NULL)
00708         {
00709                 fprintf (stderr,
00710                   (_("Error in %s () a NULL pointer was found in the linetype member.\n")),
00711                   __FUNCTION__);
00712                 return (NULL);
00713         }
00714 #if DEBUG
00715         DXF_DEBUG_END
00716 #endif
00717         return (strdup (body->linetype));
00718 }
00719 
00720 
00724 DxfBody *
00725 dxf_body_set_linetype
00726 (
00727         DxfBody *body,
00729         char *linetype
00731 )
00732 {
00733 #if DEBUG
00734         DXF_DEBUG_BEGIN
00735 #endif
00736         /* Do some basic checks. */
00737         if (body == NULL)
00738         {
00739                 fprintf (stderr,
00740                   (_("Error in %s () a NULL pointer was passed.\n")),
00741                   __FUNCTION__);
00742                 return (NULL);
00743         }
00744         if (linetype == NULL)
00745         {
00746                 fprintf (stderr,
00747                   (_("Error in %s () a NULL pointer was passed.\n")),
00748                   __FUNCTION__);
00749                 return (NULL);
00750         }
00751         body->linetype = strdup (linetype);
00752 #if DEBUG
00753         DXF_DEBUG_END
00754 #endif
00755         return (body);
00756 }
00757 
00758 
00764 char *
00765 dxf_body_get_layer
00766 (
00767         DxfBody *body
00769 )
00770 {
00771 #if DEBUG
00772         DXF_DEBUG_BEGIN
00773 #endif
00774         /* Do some basic checks. */
00775         if (body == NULL)
00776         {
00777                 fprintf (stderr,
00778                   (_("Error in %s () a NULL pointer was passed.\n")),
00779                   __FUNCTION__);
00780                 return (NULL);
00781         }
00782         if (body->layer ==  NULL)
00783         {
00784                 fprintf (stderr,
00785                   (_("Error in %s () a NULL pointer was found in the layer member.\n")),
00786                   __FUNCTION__);
00787                 return (NULL);
00788         }
00789 #if DEBUG
00790         DXF_DEBUG_END
00791 #endif
00792         return (strdup (body->layer));
00793 }
00794 
00795 
00799 DxfBody *
00800 dxf_body_set_layer
00801 (
00802         DxfBody *body,
00804         char *layer
00806 )
00807 {
00808 #if DEBUG
00809         DXF_DEBUG_BEGIN
00810 #endif
00811         /* Do some basic checks. */
00812         if (body == NULL)
00813         {
00814                 fprintf (stderr,
00815                   (_("Error in %s () a NULL pointer was passed.\n")),
00816                   __FUNCTION__);
00817                 return (NULL);
00818         }
00819         if (layer == NULL)
00820         {
00821                 fprintf (stderr,
00822                   (_("Error in %s () a NULL pointer was passed.\n")),
00823                   __FUNCTION__);
00824                 return (NULL);
00825         }
00826         body->layer = strdup (layer);
00827 #if DEBUG
00828         DXF_DEBUG_END
00829 #endif
00830         return (body);
00831 }
00832 
00833 
00839 double
00840 dxf_body_get_elevation
00841 (
00842         DxfBody *body
00844 )
00845 {
00846 #if DEBUG
00847         DXF_DEBUG_BEGIN
00848 #endif
00849         /* Do some basic checks. */
00850         if (body == NULL)
00851         {
00852                 fprintf (stderr,
00853                   (_("Error in %s () a NULL pointer was passed.\n")),
00854                   __FUNCTION__);
00855                 return (EXIT_FAILURE);
00856         }
00857 #if DEBUG
00858         DXF_DEBUG_END
00859 #endif
00860         return (body->elevation);
00861 }
00862 
00863 
00867 DxfBody *
00868 dxf_body_set_elevation
00869 (
00870         DxfBody *body,
00872         double elevation
00874 )
00875 {
00876 #if DEBUG
00877         DXF_DEBUG_BEGIN
00878 #endif
00879         /* Do some basic checks. */
00880         if (body == NULL)
00881         {
00882                 fprintf (stderr,
00883                   (_("Error in %s () a NULL pointer was passed.\n")),
00884                   __FUNCTION__);
00885                 return (NULL);
00886         }
00887         body->elevation = elevation;
00888 #if DEBUG
00889         DXF_DEBUG_END
00890 #endif
00891         return (body);
00892 }
00893 
00894 
00900 double
00901 dxf_body_get_thickness
00902 (
00903         DxfBody *body
00905 )
00906 {
00907 #if DEBUG
00908         DXF_DEBUG_BEGIN
00909 #endif
00910         /* Do some basic checks. */
00911         if (body == NULL)
00912         {
00913                 fprintf (stderr,
00914                   (_("Error in %s () a NULL pointer was passed.\n")),
00915                   __FUNCTION__);
00916                 return (EXIT_FAILURE);
00917         }
00918         if (body->thickness < 0.0)
00919         {
00920                 fprintf (stderr,
00921                   (_("Error in %s () a negative value was found in the thickness member.\n")),
00922                   __FUNCTION__);
00923                 return (EXIT_FAILURE);
00924         }
00925 #if DEBUG
00926         DXF_DEBUG_END
00927 #endif
00928         return (body->thickness);
00929 }
00930 
00931 
00935 DxfBody *
00936 dxf_body_set_thickness
00937 (
00938         DxfBody *body,
00940         double thickness
00942 )
00943 {
00944 #if DEBUG
00945         DXF_DEBUG_BEGIN
00946 #endif
00947         /* Do some basic checks. */
00948         if (body == NULL)
00949         {
00950                 fprintf (stderr,
00951                   (_("Error in %s () a NULL pointer was passed.\n")),
00952                   __FUNCTION__);
00953                 return (NULL);
00954         }
00955         if (thickness < 0.0)
00956         {
00957                 fprintf (stderr,
00958                   (_("Error in %s () a negative thickness value was passed.\n")),
00959                   __FUNCTION__);
00960                 return (NULL);
00961         }
00962         body->thickness = thickness;
00963 #if DEBUG
00964         DXF_DEBUG_END
00965 #endif
00966         return (body);
00967 }
00968 
00969 
00975 double
00976 dxf_body_get_linetype_scale
00977 (
00978         DxfBody *body
00980 )
00981 {
00982 #if DEBUG
00983         DXF_DEBUG_BEGIN
00984 #endif
00985         /* Do some basic checks. */
00986         if (body == NULL)
00987         {
00988                 fprintf (stderr,
00989                   (_("Error in %s () a NULL pointer was passed.\n")),
00990                   __FUNCTION__);
00991                 return (EXIT_FAILURE);
00992         }
00993         if (body->linetype_scale < 0.0)
00994         {
00995                 fprintf (stderr,
00996                   (_("Error in %s () a negative value was found in the linetype scale member.\n")),
00997                   __FUNCTION__);
00998                 return (EXIT_FAILURE);
00999         }
01000 #if DEBUG
01001         DXF_DEBUG_END
01002 #endif
01003         return (body->linetype_scale);
01004 }
01005 
01006 
01010 DxfBody *
01011 dxf_body_set_linetype_scale
01012 (
01013         DxfBody *body,
01015         double linetype_scale
01017 )
01018 {
01019 #if DEBUG
01020         DXF_DEBUG_BEGIN
01021 #endif
01022         /* Do some basic checks. */
01023         if (body == NULL)
01024         {
01025                 fprintf (stderr,
01026                   (_("Error in %s () a NULL pointer was passed.\n")),
01027                   __FUNCTION__);
01028                 return (NULL);
01029         }
01030         if (linetype_scale < 0.0)
01031         {
01032                 fprintf (stderr,
01033                   (_("Error in %s () a negative linetype scale value was passed.\n")),
01034                   __FUNCTION__);
01035                 return (NULL);
01036         }
01037         body->linetype_scale = linetype_scale;
01038 #if DEBUG
01039         DXF_DEBUG_END
01040 #endif
01041         return (body);
01042 }
01043 
01044 
01050 int16_t
01051 dxf_body_get_visibility
01052 (
01053         DxfBody *body
01055 )
01056 {
01057 #if DEBUG
01058         DXF_DEBUG_BEGIN
01059 #endif
01060         /* Do some basic checks. */
01061         if (body == NULL)
01062         {
01063                 fprintf (stderr,
01064                   (_("Error in %s () a NULL pointer was passed.\n")),
01065                   __FUNCTION__);
01066                 return (EXIT_FAILURE);
01067         }
01068         if (body->visibility < 0)
01069         {
01070                 fprintf (stderr,
01071                   (_("Error in %s () a negative value was found in the visibility member.\n")),
01072                   __FUNCTION__);
01073                 return (EXIT_FAILURE);
01074         }
01075         if (body->visibility > 1)
01076         {
01077                 fprintf (stderr,
01078                   (_("Error in %s () an out of range value was found in the visibility member.\n")),
01079                   __FUNCTION__);
01080                 return (EXIT_FAILURE);
01081         }
01082 #if DEBUG
01083         DXF_DEBUG_END
01084 #endif
01085         return (body->visibility);
01086 }
01087 
01088 
01092 DxfBody *
01093 dxf_body_set_visibility
01094 (
01095         DxfBody *body,
01097         int16_t visibility
01099 )
01100 {
01101 #if DEBUG
01102         DXF_DEBUG_BEGIN
01103 #endif
01104         /* Do some basic checks. */
01105         if (body == NULL)
01106         {
01107                 fprintf (stderr,
01108                   (_("Error in %s () a NULL pointer was passed.\n")),
01109                   __FUNCTION__);
01110                 return (NULL);
01111         }
01112         if (visibility < 0)
01113         {
01114                 fprintf (stderr,
01115                   (_("Error in %s () a negative visibility value was passed.\n")),
01116                   __FUNCTION__);
01117                 return (NULL);
01118         }
01119         if (visibility > 1)
01120         {
01121                 fprintf (stderr,
01122                   (_("Error in %s () an out of range visibility value was passed.\n")),
01123                   __FUNCTION__);
01124                 return (NULL);
01125         }
01126         body->visibility = visibility;
01127 #if DEBUG
01128         DXF_DEBUG_END
01129 #endif
01130         return (body);
01131 }
01132 
01133 
01139 int
01140 dxf_body_get_color
01141 (
01142         DxfBody *body
01144 )
01145 {
01146 #if DEBUG
01147         DXF_DEBUG_BEGIN
01148 #endif
01149         /* Do some basic checks. */
01150         if (body == NULL)
01151         {
01152                 fprintf (stderr,
01153                   (_("Error in %s () a NULL pointer was passed.\n")),
01154                   __FUNCTION__);
01155                 return (EXIT_FAILURE);
01156         }
01157         if (body->color < 0)
01158         {
01159                 fprintf (stderr,
01160                   (_("Warning in %s () a negative value was found in the color member.\n")),
01161                   __FUNCTION__);
01162         }
01163 #if DEBUG
01164         DXF_DEBUG_END
01165 #endif
01166         return (body->color);
01167 }
01168 
01169 
01173 DxfBody *
01174 dxf_body_set_color
01175 (
01176         DxfBody *body,
01178         int color
01180 )
01181 {
01182 #if DEBUG
01183         DXF_DEBUG_BEGIN
01184 #endif
01185         /* Do some basic checks. */
01186         if (body == NULL)
01187         {
01188                 fprintf (stderr,
01189                   (_("Error in %s () a NULL pointer was passed.\n")),
01190                   __FUNCTION__);
01191                 return (NULL);
01192         }
01193         if (color < 0)
01194         {
01195                 fprintf (stderr,
01196                   (_("Warning in %s () a negative color value was passed.\n")),
01197                   __FUNCTION__);
01198                 fprintf (stderr,
01199                   (_("\teffectively turning this entity it's visibility off.\n")));
01200         }
01201         body->color = color;
01202 #if DEBUG
01203         DXF_DEBUG_END
01204 #endif
01205         return (body);
01206 }
01207 
01208 
01214 int
01215 dxf_body_get_paperspace
01216 (
01217         DxfBody *body
01219 )
01220 {
01221 #if DEBUG
01222         DXF_DEBUG_BEGIN
01223 #endif
01224         /* Do some basic checks. */
01225         if (body == NULL)
01226         {
01227                 fprintf (stderr,
01228                   (_("Error in %s () a NULL pointer was passed.\n")),
01229                   __FUNCTION__);
01230                 return (EXIT_FAILURE);
01231         }
01232         if (body->paperspace < 0)
01233         {
01234                 fprintf (stderr,
01235                   (_("Warning in %s () a negative value was found in the paperspace member.\n")),
01236                   __FUNCTION__);
01237         }
01238         if (body->paperspace > 1)
01239         {
01240                 fprintf (stderr,
01241                   (_("Warning in %s () an out of range value was found in the paperspace member.\n")),
01242                   __FUNCTION__);
01243         }
01244 #if DEBUG
01245         DXF_DEBUG_END
01246 #endif
01247         return (body->paperspace);
01248 }
01249 
01250 
01254 DxfBody *
01255 dxf_body_set_paperspace
01256 (
01257         DxfBody *body,
01259         int paperspace
01261 )
01262 {
01263 #if DEBUG
01264         DXF_DEBUG_BEGIN
01265 #endif
01266         /* Do some basic checks. */
01267         if (body == NULL)
01268         {
01269                 fprintf (stderr,
01270                   (_("Error in %s () a NULL pointer was passed.\n")),
01271                   __FUNCTION__);
01272                 return (NULL);
01273         }
01274         if (paperspace < 0)
01275         {
01276                 fprintf (stderr,
01277                   (_("Error in %s () a negative paperspace value was passed.\n")),
01278                   __FUNCTION__);
01279                 return (NULL);
01280         }
01281         if (paperspace > 1)
01282         {
01283                 fprintf (stderr,
01284                   (_("Error in %s () an out of range paperspace value was passed.\n")),
01285                   __FUNCTION__);
01286                 return (NULL);
01287         }
01288         body->paperspace = paperspace;
01289 #if DEBUG
01290         DXF_DEBUG_END
01291 #endif
01292         return (body);
01293 }
01294 
01295 
01302 int
01303 dxf_body_get_graphics_data_size
01304 (
01305         DxfBody *body
01307 )
01308 {
01309 #if DEBUG
01310         DXF_DEBUG_BEGIN
01311 #endif
01312         /* Do some basic checks. */
01313         if (body == NULL)
01314         {
01315                 fprintf (stderr,
01316                   (_("Error in %s () a NULL pointer was passed.\n")),
01317                   __FUNCTION__);
01318                 return (EXIT_FAILURE);
01319         }
01320         if (body->graphics_data_size < 0)
01321         {
01322                 fprintf (stderr,
01323                   (_("Warning in %s () a negative value was found in the graphics_data_size member.\n")),
01324                   __FUNCTION__);
01325         }
01326         if (body->graphics_data_size == 0)
01327         {
01328                 fprintf (stderr,
01329                   (_("Warning in %s () a zero value was found in the graphics_data_size member.\n")),
01330                   __FUNCTION__);
01331         }
01332 #if DEBUG
01333         DXF_DEBUG_END
01334 #endif
01335         return (body->graphics_data_size);
01336 }
01337 
01338 
01345 DxfBody *
01346 dxf_body_set_graphics_data_size
01347 (
01348         DxfBody *body,
01350         int graphics_data_size
01353 )
01354 {
01355 #if DEBUG
01356         DXF_DEBUG_BEGIN
01357 #endif
01358         /* Do some basic checks. */
01359         if (body == NULL)
01360         {
01361                 fprintf (stderr,
01362                   (_("Error in %s () a NULL pointer was passed.\n")),
01363                   __FUNCTION__);
01364                 return (NULL);
01365         }
01366         if (graphics_data_size < 0)
01367         {
01368                 fprintf (stderr,
01369                   (_("Error in %s () a negative graphics_data_size value was passed.\n")),
01370                   __FUNCTION__);
01371                 return (NULL);
01372         }
01373         if (graphics_data_size == 0)
01374         {
01375                 fprintf (stderr,
01376                   (_("Error in %s () a zero graphics_data_size value was passed.\n")),
01377                   __FUNCTION__);
01378                 return (NULL);
01379         }
01380         body->graphics_data_size = graphics_data_size;
01381 #if DEBUG
01382         DXF_DEBUG_END
01383 #endif
01384         return (body);
01385 }
01386 
01387 
01394 int16_t
01395 dxf_body_get_shadow_mode
01396 (
01397         DxfBody *body
01399 )
01400 {
01401 #if DEBUG
01402         DXF_DEBUG_BEGIN
01403 #endif
01404         /* Do some basic checks. */
01405         if (body == NULL)
01406         {
01407                 fprintf (stderr,
01408                   (_("Error in %s () a NULL pointer was passed.\n")),
01409                   __FUNCTION__);
01410                 return (EXIT_FAILURE);
01411         }
01412         if (body->shadow_mode < 0)
01413         {
01414                 fprintf (stderr,
01415                   (_("Error in %s () a negative value was found in the shadow_mode member.\n")),
01416                   __FUNCTION__);
01417                 return (EXIT_FAILURE);
01418         }
01419         if (body->shadow_mode > 3)
01420         {
01421                 fprintf (stderr,
01422                   (_("Error in %s () an out of range value was found in the shadow_mode member.\n")),
01423                   __FUNCTION__);
01424                 return (EXIT_FAILURE);
01425         }
01426 #if DEBUG
01427         DXF_DEBUG_END
01428 #endif
01429         return (body->shadow_mode);
01430 }
01431 
01432 
01439 DxfBody *
01440 dxf_body_set_shadow_mode
01441 (
01442         DxfBody *body,
01444         int16_t shadow_mode
01446 )
01447 {
01448 #if DEBUG
01449         DXF_DEBUG_BEGIN
01450 #endif
01451         /* Do some basic checks. */
01452         if (body == NULL)
01453         {
01454                 fprintf (stderr,
01455                   (_("Error in %s () a NULL pointer was passed.\n")),
01456                   __FUNCTION__);
01457                 return (NULL);
01458         }
01459         if (shadow_mode < 0)
01460         {
01461                 fprintf (stderr,
01462                   (_("Error in %s () a negative shadow_mode value was passed.\n")),
01463                   __FUNCTION__);
01464                 return (NULL);
01465         }
01466         if (shadow_mode > 3)
01467         {
01468                 fprintf (stderr,
01469                   (_("Error in %s () an out of range shadow_mode value was passed.\n")),
01470                   __FUNCTION__);
01471                 return (NULL);
01472         }
01473         body->shadow_mode = shadow_mode;
01474 #if DEBUG
01475         DXF_DEBUG_END
01476 #endif
01477         return (body);
01478 }
01479 
01480 
01489 DxfBinaryGraphicsData *
01490 dxf_body_get_binary_graphics_data
01491 (
01492         DxfBody *body
01494 )
01495 {
01496 #if DEBUG
01497         DXF_DEBUG_BEGIN
01498 #endif
01499         /* Do some basic checks. */
01500         if (body == NULL)
01501         {
01502                 fprintf (stderr,
01503                   (_("Error in %s () a NULL pointer was passed.\n")),
01504                   __FUNCTION__);
01505                 return (NULL);
01506         }
01507         if (body->binary_graphics_data ==  NULL)
01508         {
01509                 fprintf (stderr,
01510                   (_("Error in %s () a NULL pointer was found in the binary_graphics_data member.\n")),
01511                   __FUNCTION__);
01512                 return (NULL);
01513         }
01514 #if DEBUG
01515         DXF_DEBUG_END
01516 #endif
01517         return ((DxfBinaryGraphicsData *) body->binary_graphics_data);
01518 }
01519 
01520 
01528 DxfBody *
01529 dxf_body_set_binary_graphics_data
01530 (
01531         DxfBody *body,
01533         DxfBinaryGraphicsData *data
01536 )
01537 {
01538 #if DEBUG
01539         DXF_DEBUG_BEGIN
01540 #endif
01541         /* Do some basic checks. */
01542         if (body == NULL)
01543         {
01544                 fprintf (stderr,
01545                   (_("Error in %s () a NULL pointer was passed.\n")),
01546                   __FUNCTION__);
01547                 return (NULL);
01548         }
01549         if (data == NULL)
01550         {
01551                 fprintf (stderr,
01552                   (_("Error in %s () a NULL pointer was passed.\n")),
01553                   __FUNCTION__);
01554                 return (NULL);
01555         }
01556         body->binary_graphics_data = (DxfBinaryGraphicsData *) data;
01557 #if DEBUG
01558         DXF_DEBUG_END
01559 #endif
01560         return (body);
01561 }
01562 
01563 
01572 char *
01573 dxf_body_get_dictionary_owner_soft
01574 (
01575         DxfBody *body
01577 )
01578 {
01579 #if DEBUG
01580         DXF_DEBUG_BEGIN
01581 #endif
01582         /* Do some basic checks. */
01583         if (body == NULL)
01584         {
01585                 fprintf (stderr,
01586                   (_("Error in %s () a NULL pointer was passed.\n")),
01587                   __FUNCTION__);
01588                 return (NULL);
01589         }
01590         if (body->dictionary_owner_soft ==  NULL)
01591         {
01592                 fprintf (stderr,
01593                   (_("Error in %s () a NULL pointer was found in the dictionary_owner_soft member.\n")),
01594                   __FUNCTION__);
01595                 return (NULL);
01596         }
01597 #if DEBUG
01598         DXF_DEBUG_END
01599 #endif
01600         return (strdup (body->dictionary_owner_soft));
01601 }
01602 
01603 
01608 DxfBody *
01609 dxf_body_set_dictionary_owner_soft
01610 (
01611         DxfBody *body,
01613         char *dictionary_owner_soft
01616 )
01617 {
01618 #if DEBUG
01619         DXF_DEBUG_BEGIN
01620 #endif
01621         /* Do some basic checks. */
01622         if (body == NULL)
01623         {
01624                 fprintf (stderr,
01625                   (_("Error in %s () a NULL pointer was passed.\n")),
01626                   __FUNCTION__);
01627                 return (NULL);
01628         }
01629         if (dictionary_owner_soft == NULL)
01630         {
01631                 fprintf (stderr,
01632                   (_("Error in %s () a NULL pointer was passed.\n")),
01633                   __FUNCTION__);
01634                 return (NULL);
01635         }
01636         body->dictionary_owner_soft = strdup (dictionary_owner_soft);
01637 #if DEBUG
01638         DXF_DEBUG_END
01639 #endif
01640         return (body);
01641 }
01642 
01643 
01653 char *
01654 dxf_body_get_material
01655 (
01656         DxfBody *body
01658 )
01659 {
01660 #if DEBUG
01661         DXF_DEBUG_BEGIN
01662 #endif
01663         /* Do some basic checks. */
01664         if (body == NULL)
01665         {
01666                 fprintf (stderr,
01667                   (_("Error in %s () a NULL pointer was passed.\n")),
01668                   __FUNCTION__);
01669                 return (NULL);
01670         }
01671         if (body->material ==  NULL)
01672         {
01673                 fprintf (stderr,
01674                   (_("Error in %s () a NULL pointer was found in the material member.\n")),
01675                   __FUNCTION__);
01676                 return (NULL);
01677         }
01678 #if DEBUG
01679         DXF_DEBUG_END
01680 #endif
01681         return (strdup (body->material));
01682 }
01683 
01684 
01691 DxfBody *
01692 dxf_body_set_material
01693 (
01694         DxfBody *body,
01696         char *material
01699 )
01700 {
01701 #if DEBUG
01702         DXF_DEBUG_BEGIN
01703 #endif
01704         /* Do some basic checks. */
01705         if (body == NULL)
01706         {
01707                 fprintf (stderr,
01708                   (_("Error in %s () a NULL pointer was passed.\n")),
01709                   __FUNCTION__);
01710                 return (NULL);
01711         }
01712         if (material == NULL)
01713         {
01714                 fprintf (stderr,
01715                   (_("Error in %s () a NULL pointer was passed.\n")),
01716                   __FUNCTION__);
01717                 return (NULL);
01718         }
01719         body->material = strdup (material);
01720 #if DEBUG
01721         DXF_DEBUG_END
01722 #endif
01723         return (body);
01724 }
01725 
01726 
01735 char *
01736 dxf_body_get_dictionary_owner_hard
01737 (
01738         DxfBody *body
01740 )
01741 {
01742 #if DEBUG
01743         DXF_DEBUG_BEGIN
01744 #endif
01745         /* Do some basic checks. */
01746         if (body == NULL)
01747         {
01748                 fprintf (stderr,
01749                   (_("Error in %s () a NULL pointer was passed.\n")),
01750                   __FUNCTION__);
01751                 return (NULL);
01752         }
01753         if (body->dictionary_owner_hard ==  NULL)
01754         {
01755                 fprintf (stderr,
01756                   (_("Error in %s () a NULL pointer was found in the dictionary_owner_hard member.\n")),
01757                   __FUNCTION__);
01758                 return (NULL);
01759         }
01760 #if DEBUG
01761         DXF_DEBUG_END
01762 #endif
01763         return (strdup (body->dictionary_owner_hard));
01764 }
01765 
01766 
01771 DxfBody *
01772 dxf_body_set_dictionary_owner_hard
01773 (
01774         DxfBody *body,
01776         char *dictionary_owner_hard
01779 )
01780 {
01781 #if DEBUG
01782         DXF_DEBUG_BEGIN
01783 #endif
01784         /* Do some basic checks. */
01785         if (body == NULL)
01786         {
01787                 fprintf (stderr,
01788                   (_("Error in %s () a NULL pointer was passed.\n")),
01789                   __FUNCTION__);
01790                 return (NULL);
01791         }
01792         if (dictionary_owner_hard == NULL)
01793         {
01794                 fprintf (stderr,
01795                   (_("Error in %s () a NULL pointer was passed.\n")),
01796                   __FUNCTION__);
01797                 return (NULL);
01798         }
01799         body->dictionary_owner_hard = strdup (dictionary_owner_hard);
01800 #if DEBUG
01801         DXF_DEBUG_END
01802 #endif
01803         return (body);
01804 }
01805 
01806 
01813 int16_t
01814 dxf_body_get_lineweight
01815 (
01816         DxfBody *body
01818 )
01819 {
01820 #if DEBUG
01821         DXF_DEBUG_BEGIN
01822 #endif
01823         /* Do some basic checks. */
01824         if (body == NULL)
01825         {
01826                 fprintf (stderr,
01827                   (_("Error in %s () a NULL pointer was passed.\n")),
01828                   __FUNCTION__);
01829                 return (EXIT_FAILURE);
01830         }
01831 #if DEBUG
01832         DXF_DEBUG_END
01833 #endif
01834         return (body->lineweight);
01835 }
01836 
01837 
01844 DxfBody *
01845 dxf_body_set_lineweight
01846 (
01847         DxfBody *body,
01849         int16_t lineweight
01851 )
01852 {
01853 #if DEBUG
01854         DXF_DEBUG_BEGIN
01855 #endif
01856         /* Do some basic checks. */
01857         if (body == NULL)
01858         {
01859                 fprintf (stderr,
01860                   (_("Error in %s () a NULL pointer was passed.\n")),
01861                   __FUNCTION__);
01862                 return (NULL);
01863         }
01864         body->lineweight = lineweight;
01865 #if DEBUG
01866         DXF_DEBUG_END
01867 #endif
01868         return (body);
01869 }
01870 
01871 
01878 char *
01879 dxf_body_get_plot_style_name
01880 (
01881         DxfBody *body
01883 )
01884 {
01885 #if DEBUG
01886         DXF_DEBUG_BEGIN
01887 #endif
01888         /* Do some basic checks. */
01889         if (body == NULL)
01890         {
01891                 fprintf (stderr,
01892                   (_("Error in %s () a NULL pointer was passed.\n")),
01893                   __FUNCTION__);
01894                 return (NULL);
01895         }
01896         if (body->plot_style_name ==  NULL)
01897         {
01898                 fprintf (stderr,
01899                   (_("Error in %s () a NULL pointer was found in the plot_style_name member.\n")),
01900                   __FUNCTION__);
01901                 return (NULL);
01902         }
01903 #if DEBUG
01904         DXF_DEBUG_END
01905 #endif
01906         return (strdup (body->plot_style_name));
01907 }
01908 
01909 
01916 DxfBody *
01917 dxf_body_set_plot_style_name
01918 (
01919         DxfBody *body,
01921         char *plot_style_name
01924 )
01925 {
01926 #if DEBUG
01927         DXF_DEBUG_BEGIN
01928 #endif
01929         /* Do some basic checks. */
01930         if (body == NULL)
01931         {
01932                 fprintf (stderr,
01933                   (_("Error in %s () a NULL pointer was passed.\n")),
01934                   __FUNCTION__);
01935                 return (NULL);
01936         }
01937         if (plot_style_name == NULL)
01938         {
01939                 fprintf (stderr,
01940                   (_("Error in %s () a NULL pointer was passed.\n")),
01941                   __FUNCTION__);
01942                 return (NULL);
01943         }
01944         body->plot_style_name = strdup (plot_style_name);
01945 #if DEBUG
01946         DXF_DEBUG_END
01947 #endif
01948         return (body);
01949 }
01950 
01951 
01958 long
01959 dxf_body_get_color_value
01960 (
01961         DxfBody *body
01963 )
01964 {
01965 #if DEBUG
01966         DXF_DEBUG_BEGIN
01967 #endif
01968         /* Do some basic checks. */
01969         if (body == NULL)
01970         {
01971                 fprintf (stderr,
01972                   (_("Error in %s () a NULL pointer was passed.\n")),
01973                   __FUNCTION__);
01974                 return (EXIT_FAILURE);
01975         }
01976 #if DEBUG
01977         DXF_DEBUG_END
01978 #endif
01979         return (body->color_value);
01980 }
01981 
01982 
01989 DxfBody *
01990 dxf_body_set_color_value
01991 (
01992         DxfBody *body,
01994         long color_value
01996 )
01997 {
01998 #if DEBUG
01999         DXF_DEBUG_BEGIN
02000 #endif
02001         /* Do some basic checks. */
02002         if (body == NULL)
02003         {
02004                 fprintf (stderr,
02005                   (_("Error in %s () a NULL pointer was passed.\n")),
02006                   __FUNCTION__);
02007                 return (NULL);
02008         }
02009         body->color_value = color_value;
02010 #if DEBUG
02011         DXF_DEBUG_END
02012 #endif
02013         return (body);
02014 }
02015 
02016 
02023 char *
02024 dxf_body_get_color_name
02025 (
02026         DxfBody *body
02028 )
02029 {
02030 #if DEBUG
02031         DXF_DEBUG_BEGIN
02032 #endif
02033         /* Do some basic checks. */
02034         if (body == NULL)
02035         {
02036                 fprintf (stderr,
02037                   (_("Error in %s () a NULL pointer was passed.\n")),
02038                   __FUNCTION__);
02039                 return (NULL);
02040         }
02041         if (body->color_name ==  NULL)
02042         {
02043                 fprintf (stderr,
02044                   (_("Error in %s () a NULL pointer was found in the color_name member.\n")),
02045                   __FUNCTION__);
02046                 return (NULL);
02047         }
02048 #if DEBUG
02049         DXF_DEBUG_END
02050 #endif
02051         return (strdup (body->color_name));
02052 }
02053 
02054 
02061 DxfBody *
02062 dxf_body_set_color_name
02063 (
02064         DxfBody *body,
02066         char *color_name
02069 )
02070 {
02071 #if DEBUG
02072         DXF_DEBUG_BEGIN
02073 #endif
02074         /* Do some basic checks. */
02075         if (body == NULL)
02076         {
02077                 fprintf (stderr,
02078                   (_("Error in %s () a NULL pointer was passed.\n")),
02079                   __FUNCTION__);
02080                 return (NULL);
02081         }
02082         if (color_name == NULL)
02083         {
02084                 fprintf (stderr,
02085                   (_("Error in %s () a NULL pointer was passed.\n")),
02086                   __FUNCTION__);
02087                 return (NULL);
02088         }
02089         body->color_name = strdup (color_name);
02090 #if DEBUG
02091         DXF_DEBUG_END
02092 #endif
02093         return (body);
02094 }
02095 
02096 
02103 long
02104 dxf_body_get_transparency
02105 (
02106         DxfBody *body
02108 )
02109 {
02110 #if DEBUG
02111         DXF_DEBUG_BEGIN
02112 #endif
02113         /* Do some basic checks. */
02114         if (body == NULL)
02115         {
02116                 fprintf (stderr,
02117                   (_("Error in %s () a NULL pointer was passed.\n")),
02118                   __FUNCTION__);
02119                 return (EXIT_FAILURE);
02120         }
02121 #if DEBUG
02122         DXF_DEBUG_END
02123 #endif
02124         return (body->transparency);
02125 }
02126 
02127 
02134 DxfBody *
02135 dxf_body_set_transparency
02136 (
02137         DxfBody *body,
02139         long transparency
02141 )
02142 {
02143 #if DEBUG
02144         DXF_DEBUG_BEGIN
02145 #endif
02146         /* Do some basic checks. */
02147         if (body == NULL)
02148         {
02149                 fprintf (stderr,
02150                   (_("Error in %s () a NULL pointer was passed.\n")),
02151                   __FUNCTION__);
02152                 return (NULL);
02153         }
02154         body->transparency = transparency;
02155 #if DEBUG
02156         DXF_DEBUG_END
02157 #endif
02158         return (body);
02159 }
02160 
02161 
02170 DxfProprietaryData *
02171 dxf_body_get_proprietary_data
02172 (
02173         DxfBody *body
02175 )
02176 {
02177 #if DEBUG
02178         DXF_DEBUG_BEGIN
02179 #endif
02180         /* Do some basic checks. */
02181         if (body == NULL)
02182         {
02183                 fprintf (stderr,
02184                   (_("Error in %s () a NULL pointer was passed.\n")),
02185                   __FUNCTION__);
02186                 return (NULL);
02187         }
02188         if (body->proprietary_data ==  NULL)
02189         {
02190                 fprintf (stderr,
02191                   (_("Error in %s () a NULL pointer was found in the proprietary_data member.\n")),
02192                   __FUNCTION__);
02193                 return (NULL);
02194         }
02195 #if DEBUG
02196         DXF_DEBUG_END
02197 #endif
02198         return ((DxfProprietaryData *) body->proprietary_data);
02199 }
02200 
02201 
02205 DxfBody *
02206 dxf_body_set_proprietary_data
02207 (
02208         DxfBody *body,
02210         DxfProprietaryData *proprietary_data
02213 )
02214 {
02215 #if DEBUG
02216         DXF_DEBUG_BEGIN
02217 #endif
02218         /* Do some basic checks. */
02219         if (body == NULL)
02220         {
02221                 fprintf (stderr,
02222                   (_("Error in %s () a NULL pointer was passed.\n")),
02223                   __FUNCTION__);
02224                 return (NULL);
02225         }
02226         if (proprietary_data == NULL)
02227         {
02228                 fprintf (stderr,
02229                   (_("Error in %s () a NULL pointer was passed.\n")),
02230                   __FUNCTION__);
02231                 return (NULL);
02232         }
02233         body->proprietary_data = proprietary_data;
02234 #if DEBUG
02235         DXF_DEBUG_END
02236 #endif
02237         return (body);
02238 }
02239 
02240 
02248 DxfProprietaryData *
02249 dxf_body_get_additional_proprietary_data
02250 (
02251         DxfBody *body
02253 )
02254 {
02255 #if DEBUG
02256         DXF_DEBUG_BEGIN
02257 #endif
02258         /* Do some basic checks. */
02259         if (body == NULL)
02260         {
02261                 fprintf (stderr,
02262                   (_("Error in %s () a NULL pointer was passed.\n")),
02263                   __FUNCTION__);
02264                 return (NULL);
02265         }
02266         if (body->additional_proprietary_data ==  NULL)
02267         {
02268                 fprintf (stderr,
02269                   (_("Error in %s () a NULL pointer was found.\n")),
02270                   __FUNCTION__);
02271                 return (NULL);
02272         }
02273 #if DEBUG
02274         DXF_DEBUG_END
02275 #endif
02276         return ((DxfProprietaryData *) body->additional_proprietary_data);
02277 }
02278 
02279 
02284 DxfBody *
02285 dxf_body_set_additional_proprietary_data
02286 (
02287         DxfBody *body,
02289         DxfProprietaryData *additional_proprietary_data
02292 )
02293 {
02294 #if DEBUG
02295         DXF_DEBUG_BEGIN
02296 #endif
02297         /* Do some basic checks. */
02298         if (body == NULL)
02299         {
02300                 fprintf (stderr,
02301                   (_("Error in %s () a NULL pointer was passed.\n")),
02302                   __FUNCTION__);
02303                 return (NULL);
02304         }
02305         if (additional_proprietary_data ==  NULL)
02306         {
02307                 fprintf (stderr,
02308                   (_("Error in %s () a NULL pointer was passed.\n")),
02309                   __FUNCTION__);
02310                 return (NULL);
02311         }
02312         body->additional_proprietary_data = additional_proprietary_data;
02313 #if DEBUG
02314         DXF_DEBUG_END
02315 #endif
02316         return (body);
02317 }
02318 
02319 
02325 int
02326 dxf_body_get_modeler_format_version_number
02327 (
02328         DxfBody *body
02330 )
02331 {
02332 #if DEBUG
02333         DXF_DEBUG_BEGIN
02334 #endif
02335         /* Do some basic checks. */
02336         if (body == NULL)
02337         {
02338                 fprintf (stderr,
02339                   (_("Error in %s () a NULL pointer was passed.\n")),
02340                   __FUNCTION__);
02341                 return (EXIT_FAILURE);
02342         }
02343         if (body->modeler_format_version_number != 1)
02344         {
02345                 fprintf (stderr,
02346                   (_("Error in %s () an invalid value was found in the modeler_format_version_number member.\n")),
02347                   __FUNCTION__);
02348                 return (EXIT_FAILURE);
02349         }
02350 #if DEBUG
02351         DXF_DEBUG_END
02352 #endif
02353         return (body->modeler_format_version_number);
02354 }
02355 
02356 
02360 DxfBody *
02361 dxf_body_set_modeler_format_version_number
02362 (
02363         DxfBody *body,
02365         int modeler_format_version_number
02367 )
02368 {
02369 #if DEBUG
02370         DXF_DEBUG_BEGIN
02371 #endif
02372         /* Do some basic checks. */
02373         if (body == NULL)
02374         {
02375                 fprintf (stderr,
02376                   (_("Error in %s () a NULL pointer was passed.\n")),
02377                   __FUNCTION__);
02378                 return (NULL);
02379         }
02380         if (modeler_format_version_number != 1)
02381         {
02382                 fprintf (stderr,
02383                   (_("Error in %s () an invalid modeler format version number value was passed.\n")),
02384                   __FUNCTION__);
02385                 return (NULL);
02386         }
02387         body->modeler_format_version_number = modeler_format_version_number;
02388 #if DEBUG
02389         DXF_DEBUG_END
02390 #endif
02391         return (body);
02392 }
02393 
02394 
02403 DxfBody *
02404 dxf_body_get_next
02405 (
02406         DxfBody *body
02408 )
02409 {
02410 #if DEBUG
02411         DXF_DEBUG_BEGIN
02412 #endif
02413         /* Do some basic checks. */
02414         if (body == NULL)
02415         {
02416                 fprintf (stderr,
02417                   (_("Error in %s () a NULL pointer was passed.\n")),
02418                   __FUNCTION__);
02419                 return (NULL);
02420         }
02421         if (body->next == NULL)
02422         {
02423                 fprintf (stderr,
02424                   (_("Error in %s () a NULL pointer was found in the next member.\n")),
02425                   __FUNCTION__);
02426                 return (NULL);
02427         }
02428 #if DEBUG
02429         DXF_DEBUG_END
02430 #endif
02431         return ((DxfBody *) body->next);
02432 }
02433 
02434 
02439 DxfBody *
02440 dxf_body_set_next
02441 (
02442         DxfBody *body,
02444         DxfBody *next
02446 )
02447 {
02448 #if DEBUG
02449         DXF_DEBUG_BEGIN
02450 #endif
02451         /* Do some basic checks. */
02452         if (body == NULL)
02453         {
02454                 fprintf (stderr,
02455                   (_("Error in %s () a NULL pointer was passed.\n")),
02456                   __FUNCTION__);
02457                 return (NULL);
02458         }
02459         if (next == NULL)
02460         {
02461                 fprintf (stderr,
02462                   (_("Error in %s () a NULL pointer was passed.\n")),
02463                   __FUNCTION__);
02464                 return (NULL);
02465         }
02466         body->next = (struct DxfBody *) next;
02467 #if DEBUG
02468         DXF_DEBUG_END
02469 #endif
02470         return (body);
02471 }
02472 
02473 
02482 DxfBody *
02483 dxf_body_get_last
02484 (
02485         DxfBody *body
02487 )
02488 {
02489 #if DEBUG
02490         DXF_DEBUG_BEGIN
02491 #endif
02492         /* Do some basic checks. */
02493         if (body == NULL)
02494         {
02495                 fprintf (stderr,
02496                   (_("Error in %s () a NULL pointer was passed.\n")),
02497                   __FUNCTION__);
02498                 return (NULL);
02499         }
02500         if (body->next == NULL)
02501         {
02502                 fprintf (stderr,
02503                   (_("Warning in %s () a NULL pointer was found in the next member.\n")),
02504                   __FUNCTION__);
02505                 return ((DxfBody *) body);
02506         }
02507         DxfBody *iter = (DxfBody *) body->next;
02508         while (iter->next != NULL)
02509         {
02510                 iter = (DxfBody *) iter->next;
02511         }
02512 #if DEBUG
02513         DXF_DEBUG_END
02514 #endif
02515         return ((DxfBody *) iter);
02516 }
02517 
02518 
02519 /* EOF */