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

donut.c

Go to the documentation of this file.
00001 
00042 #include "donut.h"
00043 
00044 
00053 DxfDonut *
00054 dxf_donut_new ()
00055 {
00056 #if DEBUG
00057         DXF_DEBUG_BEGIN
00058 #endif
00059         DxfDonut *donut = NULL;
00060         size_t size;
00061 
00062         size = sizeof (DxfDonut);
00063         /* avoid malloc of 0 bytes */
00064         if (size == 0) size = 1;
00065         if ((donut = malloc (size)) == NULL)
00066         {
00067                 fprintf (stderr,
00068                   (_("Error in %s () could not allocate memory for a DxfDonut struct.\n")),
00069                   __FUNCTION__);
00070                 donut = NULL;
00071         }
00072         else
00073         {
00074                 memset (donut, 0, size);
00075         }
00076 #if DEBUG
00077         DXF_DEBUG_END
00078 #endif
00079         return (donut);
00080 }
00081 
00082 
00090 DxfDonut *
00091 dxf_donut_init
00092 (
00093         DxfDonut *donut
00095 )
00096 {
00097 #if DEBUG
00098         DXF_DEBUG_BEGIN
00099 #endif
00100         /* Do some basic checks. */
00101         if (donut == NULL)
00102         {
00103                 fprintf (stderr,
00104                   (_("Warning in %s () a NULL pointer was passed.\n")),
00105                   __FUNCTION__);
00106                 donut = dxf_donut_new ();
00107         }
00108         if (donut == NULL)
00109         {
00110                 fprintf (stderr,
00111                   (_("Error in %s () could not allocate memory for a DxfDonut struct.\n")),
00112                   __FUNCTION__);
00113                 return (NULL);
00114         }
00115         /* Members common for all DXF drawable entities. */
00116         dxf_donut_set_id_code (donut, 0);
00117         dxf_donut_set_linetype (donut, strdup (DXF_DEFAULT_LINETYPE));
00118         dxf_donut_set_layer (donut, strdup (DXF_DEFAULT_LAYER));
00119         dxf_donut_set_elevation (donut, 0.0);
00120         dxf_donut_set_thickness (donut, 0.0);
00121         dxf_donut_set_linetype_scale (donut, DXF_DEFAULT_LINETYPE_SCALE);
00122         dxf_donut_set_visibility (donut, DXF_DEFAULT_VISIBILITY);
00123         dxf_donut_set_color (donut, DXF_COLOR_BYLAYER);
00124         dxf_donut_set_paperspace (donut, DXF_MODELSPACE);
00125         dxf_donut_set_graphics_data_size (donut, 0);
00126         dxf_donut_set_shadow_mode (donut, 0);
00127         dxf_donut_set_binary_graphics_data (donut, (DxfBinaryGraphicsData *) dxf_binary_graphics_data_new ());
00128         dxf_donut_set_dictionary_owner_soft (donut, strdup (""));
00129         dxf_donut_set_material (donut, strdup (""));
00130         dxf_donut_set_dictionary_owner_hard (donut, strdup (""));
00131         dxf_donut_set_lineweight (donut, 0);
00132         dxf_donut_set_plot_style_name (donut, strdup (""));
00133         dxf_donut_set_color_value (donut, 0);
00134         dxf_donut_set_color_name (donut, strdup (""));
00135         dxf_donut_set_transparency (donut, 0);
00136         /* Specific members for a libDXF donut. */
00137         dxf_donut_set_x0 (donut, 0.0);
00138         dxf_donut_set_y0 (donut, 0.0);
00139         dxf_donut_set_z0 (donut, 0.0);
00140         dxf_donut_set_outside_diameter (donut, 0.0);
00141         dxf_donut_set_inside_diameter (donut, 0.0);
00142         dxf_donut_set_next (donut, NULL);
00143 #if DEBUG
00144         DXF_DEBUG_END
00145 #endif
00146         return (donut);
00147 }
00148 
00149 
00159 int
00160 dxf_donut_write
00161 (
00162         DxfFile *fp,
00164         DxfDonut *donut
00166 )
00167 {
00168 #if DEBUG
00169         DXF_DEBUG_BEGIN
00170 #endif
00171         DxfPolyline *polyline = NULL;
00172         DxfVertex *vertex_1 = NULL;
00173         DxfVertex *vertex_2 = NULL;
00174         DxfSeqend *seqend = NULL;
00175         char *dxf_entity_name = strdup ("POLYLINE");
00176         double start_width;
00177         double end_width;
00178         int id_code = -1;
00179 
00180         /* Do some basic checks. */
00181         if (fp == NULL)
00182         {
00183                 fprintf (stderr,
00184                   (_("Error in %s () a NULL file pointer was passed.\n")),
00185                   __FUNCTION__);
00186                 /* Clean up. */
00187                 free (dxf_entity_name);
00188                 return (EXIT_FAILURE);
00189         }
00190         if (donut == NULL)
00191         {
00192                 fprintf (stderr,
00193                   (_("Error in %s () a NULL pointer was passed.\n")),
00194                   __FUNCTION__);
00195                 /* Clean up. */
00196                 free (dxf_entity_name);
00197                 return (EXIT_FAILURE);
00198         }
00199         if (dxf_donut_get_outside_diameter (donut) > dxf_donut_get_inside_diameter (donut))
00200         {
00201                 fprintf (stderr,
00202                   (_("Error in %s () outside diameter is smaller than the inside diameter for the %s entity with id-code: %x\n")),
00203                   __FUNCTION__, dxf_entity_name, id_code);
00204                 /* Clean up. */
00205                 free (dxf_entity_name);
00206                 return (EXIT_FAILURE);
00207         }
00208         start_width = 0.5 * (dxf_donut_get_outside_diameter (donut) - dxf_donut_get_inside_diameter (donut));
00209         end_width = 0.5 * (dxf_donut_get_outside_diameter (donut) - dxf_donut_get_inside_diameter (donut));
00210         if (strcmp (dxf_donut_get_linetype (donut), "") == 0)
00211         {
00212                 fprintf (stderr,
00213                   (_("Warning in %s () empty linetype string for the %s entity with id-code: %x\n")),
00214                   __FUNCTION__, dxf_entity_name, dxf_donut_get_id_code (donut));
00215                 fprintf (stderr,
00216                   (_("\t%s entity is reset to default linetype")),
00217                   dxf_entity_name);
00218                 dxf_donut_set_linetype (donut, strdup (DXF_DEFAULT_LINETYPE));
00219         }
00220         if (strcmp (dxf_donut_get_layer (donut), "") == 0)
00221         {
00222                 fprintf (stderr,
00223                   (_("Warning in %s () empty layer string for the %s entity with id-code: %x\n")),
00224                   __FUNCTION__, dxf_entity_name, id_code);
00225                 fprintf (stderr,
00226                   (_("\t%s entity is relocated to layer 0\n")),
00227                   dxf_entity_name);
00228                 dxf_donut_set_layer (donut, strdup (DXF_DEFAULT_LAYER));
00229         }
00230         /* Create and write a polyline primitive. */
00231         dxf_polyline_new (polyline);
00232         polyline = dxf_polyline_init (polyline);
00233         id_code = fp->last_id_code;
00234         id_code++;
00235         polyline->id_code = id_code;
00236         polyline->linetype = dxf_donut_get_linetype (donut);
00237         polyline->layer = dxf_donut_get_layer (donut);
00238         polyline->p0->x0 = dxf_donut_get_x0 (donut);
00239         polyline->p0->y0 = dxf_donut_get_y0 (donut);
00240         polyline->p0->z0 = dxf_donut_get_z0 (donut);
00241         polyline->thickness = dxf_donut_get_thickness (donut);
00242         polyline->start_width = 0.5 * start_width;
00243         polyline->end_width = 0.5 * end_width;
00244         polyline->color = dxf_donut_get_color (donut);
00245         polyline->vertices_follow = 1;
00246         polyline->paperspace = dxf_donut_get_paperspace (donut);
00247         polyline->flag = 1;
00248         polyline->polygon_mesh_M_vertex_count = 0;
00249         polyline->polygon_mesh_N_vertex_count = 0;
00250         polyline->smooth_M_surface_density = 0;
00251         polyline->smooth_N_surface_density = 0;
00252         polyline->surface_type = 0;
00253         dxf_polyline_write (fp, polyline);
00255         /* Create and write the first vertex. */
00256         vertex_1 = dxf_vertex_new ();
00257         vertex_1 = dxf_vertex_init (vertex_1);
00258         id_code = fp->last_id_code;
00259         id_code++;
00260         vertex_1->id_code = id_code;
00261         vertex_1->layer = dxf_donut_get_layer (donut);
00262         vertex_1->linetype = dxf_donut_get_linetype (donut);
00263         vertex_1->x0 = dxf_donut_get_x0 (donut) - (0.25 * (dxf_donut_get_outside_diameter (donut) + dxf_donut_get_inside_diameter (donut)));
00264         vertex_1->y0 = dxf_donut_get_y0 (donut);
00265         vertex_1->z0 = dxf_donut_get_z0 (donut);
00266         vertex_1->thickness = dxf_donut_get_thickness (donut);
00267         vertex_1->start_width = 0.5 * start_width;
00268         vertex_1->end_width = 0.5 * end_width;
00269         vertex_1->bulge = 1;
00270         vertex_1->curve_fit_tangent_direction = 0.0;
00271         vertex_1->color = dxf_donut_get_color (donut);
00272         vertex_1->paperspace = dxf_donut_get_paperspace (donut);
00273         vertex_1->flag = 0;
00274         dxf_vertex_write (fp, vertex_1);
00276         /* Create and write the second vertex. */
00277         vertex_2 = dxf_vertex_new ();
00278         vertex_2 = dxf_vertex_init (vertex_2);
00279         id_code = fp->last_id_code;
00280         id_code++;
00281         vertex_2->id_code = id_code;
00282         vertex_2->layer = dxf_donut_get_layer (donut);
00283         vertex_2->linetype = dxf_donut_get_linetype (donut);
00284         vertex_2->x0 = dxf_donut_get_x0 (donut) + (0.25 * (dxf_donut_get_outside_diameter (donut) + dxf_donut_get_inside_diameter (donut)));
00285         vertex_2->y0 = dxf_donut_get_y0 (donut);
00286         vertex_2->z0 = dxf_donut_get_z0 (donut);
00287         vertex_2->thickness = dxf_donut_get_thickness (donut);
00288         vertex_2->start_width = 0.5 * start_width;
00289         vertex_2->end_width = 0.5 * end_width;
00290         vertex_2->bulge = 1;
00291         vertex_2->curve_fit_tangent_direction = 0.0;
00292         vertex_2->color = dxf_donut_get_color (donut);
00293         vertex_2->paperspace = dxf_donut_get_paperspace (donut);
00294         vertex_2->flag = 0;
00295         dxf_vertex_write (fp, vertex_2);
00297         /* Create and write the end of sequence marker. */
00298         dxf_seqend_new (seqend);
00299         seqend = dxf_seqend_init (seqend);
00300         id_code = fp->last_id_code;
00301         id_code++;
00302         seqend->id_code = id_code;
00303         seqend->layer = dxf_donut_get_layer (donut);
00304         seqend->linetype = dxf_donut_get_linetype (donut);
00305         dxf_seqend_write (fp, seqend);
00307         /* Clean up. */
00308         free (dxf_entity_name);
00309 #if DEBUG
00310         DXF_DEBUG_END
00311 #endif
00312         return (EXIT_SUCCESS);
00313 }
00314 
00315 
00323 int
00324 dxf_donut_free
00325 (
00326         DxfDonut *donut
00329 )
00330 {
00331 #if DEBUG
00332         DXF_DEBUG_BEGIN
00333 #endif
00334         /* Do some basic checks. */
00335         if (donut == NULL)
00336         {
00337                 fprintf (stderr,
00338                   (_("Error in %s () a NULL pointer was passed.\n")),
00339                   __FUNCTION__);
00340                 return (EXIT_FAILURE);
00341         }
00342         if (donut->next != NULL)
00343         {
00344                 fprintf (stderr,
00345                   (_("Error in %s () pointer to next was not NULL.\n")),
00346                   __FUNCTION__);
00347                 return (EXIT_FAILURE);
00348         }
00349         free (donut->linetype);
00350         free (donut->layer);
00351         free (donut->dictionary_owner_soft);
00352         free (donut->dictionary_owner_hard);
00353         free (donut);
00354         donut = NULL;
00355 #if DEBUG
00356         DXF_DEBUG_END
00357 #endif
00358         return (EXIT_SUCCESS);
00359 }
00360 
00361 
00372 void
00373 dxf_donut_free_chain
00374 (
00375         DxfDonut *donuts
00377 )
00378 {
00379 #ifdef DEBUG
00380         DXF_DEBUG_BEGIN
00381 #endif
00382         if (donuts == NULL)
00383         {
00384                 fprintf (stderr,
00385                   (_("Warning in %s () a NULL pointer was passed.\n")),
00386                   __FUNCTION__);
00387         }
00388         while (donuts != NULL)
00389         {
00390                 struct DxfDonut *iter = donuts->next;
00391                 dxf_donut_free (donuts);
00392                 donuts = (DxfDonut *) iter;
00393         }
00394 #if DEBUG
00395         DXF_DEBUG_END
00396 #endif
00397 }
00398 
00399 
00405 int
00406 dxf_donut_get_id_code
00407 (
00408         DxfDonut *donut
00410 )
00411 {
00412 #if DEBUG
00413         DXF_DEBUG_BEGIN
00414 #endif
00415         /* Do some basic checks. */
00416         if (donut == NULL)
00417         {
00418                 fprintf (stderr,
00419                   (_("Error in %s () a NULL pointer was passed.\n")),
00420                   __FUNCTION__);
00421                 return (EXIT_FAILURE);
00422         }
00423         if (donut->id_code < 0)
00424         {
00425                 fprintf (stderr,
00426                   (_("Warning in %s () a negative value was found in the id-code member.\n")),
00427                   __FUNCTION__);
00428         }
00429 #if DEBUG
00430         DXF_DEBUG_END
00431 #endif
00432         return (donut->id_code);
00433 }
00434 
00435 
00442 DxfDonut *
00443 dxf_donut_set_id_code
00444 (
00445         DxfDonut *donut,
00447         int id_code
00451 )
00452 {
00453 #if DEBUG
00454         DXF_DEBUG_BEGIN
00455 #endif
00456         /* Do some basic checks. */
00457         if (donut == NULL)
00458         {
00459                 fprintf (stderr,
00460                   (_("Error in %s () a NULL pointer was passed.\n")),
00461                   __FUNCTION__);
00462                 return (NULL);
00463         }
00464         if (id_code < 0)
00465         {
00466                 fprintf (stderr,
00467                   (_("Warning in %s () a negative id-code value was passed.\n")),
00468                   __FUNCTION__);
00469         }
00470         donut->id_code = id_code;
00471 #if DEBUG
00472         DXF_DEBUG_END
00473 #endif
00474         return (donut);
00475 }
00476 
00477 
00484 char *
00485 dxf_donut_get_linetype
00486 (
00487         DxfDonut *donut
00489 )
00490 {
00491 #if DEBUG
00492         DXF_DEBUG_BEGIN
00493 #endif
00494         /* Do some basic checks. */
00495         if (donut == NULL)
00496         {
00497                 fprintf (stderr,
00498                   (_("Error in %s () a NULL pointer was passed.\n")),
00499                   __FUNCTION__);
00500                 return (NULL);
00501         }
00502         if (donut->linetype ==  NULL)
00503         {
00504                 fprintf (stderr,
00505                   (_("Error in %s () a NULL pointer was found in the linetype member.\n")),
00506                   __FUNCTION__);
00507                 return (NULL);
00508         }
00509 #if DEBUG
00510         DXF_DEBUG_END
00511 #endif
00512         return (strdup (donut->linetype));
00513 }
00514 
00515 
00525 DxfDonut *
00526 dxf_donut_set_linetype
00527 (
00528         DxfDonut *donut,
00530         char *linetype
00532 )
00533 {
00534 #if DEBUG
00535         DXF_DEBUG_BEGIN
00536 #endif
00537         /* Do some basic checks. */
00538         if (donut == NULL)
00539         {
00540                 fprintf (stderr,
00541                   (_("Error in %s () a NULL pointer was passed.\n")),
00542                   __FUNCTION__);
00543                 return (NULL);
00544         }
00545         if (linetype == NULL)
00546         {
00547                 fprintf (stderr,
00548                   (_("Error in %s () a NULL pointer was passed.\n")),
00549                   __FUNCTION__);
00550                 return (NULL);
00551         }
00552         donut->linetype = strdup (linetype);
00553 #if DEBUG
00554         DXF_DEBUG_END
00555 #endif
00556         return (donut);
00557 }
00558 
00559 
00566 char *
00567 dxf_donut_get_layer
00568 (
00569         DxfDonut *donut
00571 )
00572 {
00573 #if DEBUG
00574         DXF_DEBUG_BEGIN
00575 #endif
00576         /* Do some basic checks. */
00577         if (donut == NULL)
00578         {
00579                 fprintf (stderr,
00580                   (_("Error in %s () a NULL pointer was passed.\n")),
00581                   __FUNCTION__);
00582                 return (NULL);
00583         }
00584         if (donut->layer ==  NULL)
00585         {
00586                 fprintf (stderr,
00587                   (_("Error in %s () a NULL pointer was found in the layer member.\n")),
00588                   __FUNCTION__);
00589                 return (NULL);
00590         }
00591 #if DEBUG
00592         DXF_DEBUG_END
00593 #endif
00594         return (strdup (donut->layer));
00595 }
00596 
00597 
00606 DxfDonut *
00607 dxf_donut_set_layer
00608 (
00609         DxfDonut *donut,
00611         char *layer
00613 )
00614 {
00615 #if DEBUG
00616         DXF_DEBUG_BEGIN
00617 #endif
00618         /* Do some basic checks. */
00619         if (donut == NULL)
00620         {
00621                 fprintf (stderr,
00622                   (_("Error in %s () a NULL pointer was passed.\n")),
00623                   __FUNCTION__);
00624                 return (NULL);
00625         }
00626         if (layer == NULL)
00627         {
00628                 fprintf (stderr,
00629                   (_("Error in %s () a NULL pointer was passed.\n")),
00630                   __FUNCTION__);
00631                 return (NULL);
00632         }
00633         donut->layer = strdup (layer);
00634 #if DEBUG
00635         DXF_DEBUG_END
00636 #endif
00637         return (donut);
00638 }
00639 
00640 
00646 double
00647 dxf_donut_get_elevation
00648 (
00649         DxfDonut *donut
00651 )
00652 {
00653 #if DEBUG
00654         DXF_DEBUG_BEGIN
00655 #endif
00656         /* Do some basic checks. */
00657         if (donut == NULL)
00658         {
00659                 fprintf (stderr,
00660                   (_("Error in %s () a NULL pointer was passed.\n")),
00661                   __FUNCTION__);
00662                 return (EXIT_FAILURE);
00663         }
00664 #if DEBUG
00665         DXF_DEBUG_END
00666 #endif
00667         return (donut->elevation);
00668 }
00669 
00670 
00677 DxfDonut *
00678 dxf_donut_set_elevation
00679 (
00680         DxfDonut *donut,
00682         double elevation
00684 )
00685 {
00686 #if DEBUG
00687         DXF_DEBUG_BEGIN
00688 #endif
00689         /* Do some basic checks. */
00690         if (donut == NULL)
00691         {
00692                 fprintf (stderr,
00693                   (_("Error in %s () a NULL pointer was passed.\n")),
00694                   __FUNCTION__);
00695                 return (NULL);
00696         }
00697         donut->elevation = elevation;
00698 #if DEBUG
00699         DXF_DEBUG_END
00700 #endif
00701         return (donut);
00702 }
00703 
00704 
00710 double
00711 dxf_donut_get_thickness
00712 (
00713         DxfDonut *donut
00715 )
00716 {
00717 #if DEBUG
00718         DXF_DEBUG_BEGIN
00719 #endif
00720         /* Do some basic checks. */
00721         if (donut == NULL)
00722         {
00723                 fprintf (stderr,
00724                   (_("Error in %s () a NULL pointer was passed.\n")),
00725                   __FUNCTION__);
00726                 return (EXIT_FAILURE);
00727         }
00728         if (donut->thickness < 0.0)
00729         {
00730                 fprintf (stderr,
00731                   (_("Warning in %s () a negative value was found in the thickness member.\n")),
00732                   __FUNCTION__);
00733         }
00734 #if DEBUG
00735         DXF_DEBUG_END
00736 #endif
00737         return (donut->thickness);
00738 }
00739 
00740 
00747 DxfDonut *
00748 dxf_donut_set_thickness
00749 (
00750         DxfDonut *donut,
00752         double thickness
00754 )
00755 {
00756 #if DEBUG
00757         DXF_DEBUG_BEGIN
00758 #endif
00759         /* Do some basic checks. */
00760         if (donut == NULL)
00761         {
00762                 fprintf (stderr,
00763                   (_("Error in %s () a NULL pointer was passed.\n")),
00764                   __FUNCTION__);
00765                 return (NULL);
00766         }
00767         if (thickness < 0.0)
00768         {
00769                 fprintf (stderr,
00770                   (_("Warning in %s () a negative thickness value was passed.\n")),
00771                   __FUNCTION__);
00772         }
00773         donut->thickness = thickness;
00774 #if DEBUG
00775         DXF_DEBUG_END
00776 #endif
00777         return (donut);
00778 }
00779 
00780 
00786 double
00787 dxf_donut_get_linetype_scale
00788 (
00789         DxfDonut *donut
00791 )
00792 {
00793 #if DEBUG
00794         DXF_DEBUG_BEGIN
00795 #endif
00796         /* Do some basic checks. */
00797         if (donut == NULL)
00798         {
00799                 fprintf (stderr,
00800                   (_("Error in %s () a NULL pointer was passed.\n")),
00801                   __FUNCTION__);
00802                 return (EXIT_FAILURE);
00803         }
00804         if (donut->linetype_scale < 0.0)
00805         {
00806                 fprintf (stderr,
00807                   (_("Warning in %s () a negative value was found in the linetype_scale member.\n")),
00808                   __FUNCTION__);
00809         }
00810 #if DEBUG
00811         DXF_DEBUG_END
00812 #endif
00813         return (donut->linetype_scale);
00814 }
00815 
00816 
00823 DxfDonut *
00824 dxf_donut_set_linetype_scale
00825 (
00826         DxfDonut *donut,
00828         double linetype_scale
00830 )
00831 {
00832 #if DEBUG
00833         DXF_DEBUG_BEGIN
00834 #endif
00835         /* Do some basic checks. */
00836         if (donut == NULL)
00837         {
00838                 fprintf (stderr,
00839                   (_("Error in %s () a NULL pointer was passed.\n")),
00840                   __FUNCTION__);
00841                 return (NULL);
00842         }
00843         if (linetype_scale < 0.0)
00844         {
00845                 fprintf (stderr,
00846                   (_("Warning in %s () a negative linetype_scale value was passed.\n")),
00847                   __FUNCTION__);
00848         }
00849         donut->linetype_scale = linetype_scale;
00850 #if DEBUG
00851         DXF_DEBUG_END
00852 #endif
00853         return (donut);
00854 }
00855 
00856 
00862 int16_t
00863 dxf_donut_get_visibility
00864 (
00865         DxfDonut *donut
00867 )
00868 {
00869 #if DEBUG
00870         DXF_DEBUG_BEGIN
00871 #endif
00872         /* Do some basic checks. */
00873         if (donut == NULL)
00874         {
00875                 fprintf (stderr,
00876                   (_("Error in %s () a NULL pointer was passed.\n")),
00877                   __FUNCTION__);
00878                 return (EXIT_FAILURE);
00879         }
00880         if (donut->visibility < 0)
00881         {
00882                 fprintf (stderr,
00883                   (_("Error in %s () a negative value was found in the visibility member.\n")),
00884                   __FUNCTION__);
00885                 return (EXIT_FAILURE);
00886         }
00887         if (donut->visibility > 1)
00888         {
00889                 fprintf (stderr,
00890                   (_("Error in %s () an out of range value was found in the visibility member.\n")),
00891                   __FUNCTION__);
00892                 return (EXIT_FAILURE);
00893         }
00894 #if DEBUG
00895         DXF_DEBUG_END
00896 #endif
00897         return (donut->visibility);
00898 }
00899 
00900 
00907 DxfDonut *
00908 dxf_donut_set_visibility
00909 (
00910         DxfDonut *donut,
00912         int16_t visibility
00914 )
00915 {
00916 #if DEBUG
00917         DXF_DEBUG_BEGIN
00918 #endif
00919         /* Do some basic checks. */
00920         if (donut == NULL)
00921         {
00922                 fprintf (stderr,
00923                   (_("Error in %s () a NULL pointer was passed.\n")),
00924                   __FUNCTION__);
00925                 return (NULL);
00926         }
00927         if (visibility < 0)
00928         {
00929                 fprintf (stderr,
00930                   (_("Error in %s () a negative visibility value was passed.\n")),
00931                   __FUNCTION__);
00932                 return (NULL);
00933         }
00934         if (visibility > 1)
00935         {
00936                 fprintf (stderr,
00937                   (_("Error in %s () an out of range visibility value was passed.\n")),
00938                   __FUNCTION__);
00939                 return (NULL);
00940         }
00941         donut->visibility = visibility;
00942 #if DEBUG
00943         DXF_DEBUG_END
00944 #endif
00945         return (donut);
00946 }
00947 
00948 
00954 int
00955 dxf_donut_get_color
00956 (
00957         DxfDonut *donut
00959 )
00960 {
00961 #if DEBUG
00962         DXF_DEBUG_BEGIN
00963 #endif
00964         /* Do some basic checks. */
00965         if (donut == NULL)
00966         {
00967                 fprintf (stderr,
00968                   (_("Error in %s () a NULL pointer was passed.\n")),
00969                   __FUNCTION__);
00970                 return (EXIT_FAILURE);
00971         }
00972         if (donut->color < 0)
00973         {
00974                 fprintf (stderr,
00975                   (_("Warning in %s () a negative value was found in the color member.\n")),
00976                   __FUNCTION__);
00977         }
00978 #if DEBUG
00979         DXF_DEBUG_END
00980 #endif
00981         return (donut->color);
00982 }
00983 
00984 
00991 DxfDonut *
00992 dxf_donut_set_color
00993 (
00994         DxfDonut *donut,
00996         int color
00998 )
00999 {
01000 #if DEBUG
01001         DXF_DEBUG_BEGIN
01002 #endif
01003         /* Do some basic checks. */
01004         if (donut == NULL)
01005         {
01006                 fprintf (stderr,
01007                   (_("Error in %s () a NULL pointer was passed.\n")),
01008                   __FUNCTION__);
01009                 return (NULL);
01010         }
01011         if (color < 0)
01012         {
01013                 fprintf (stderr,
01014                   (_("Warning in %s () a negative color value was passed.\n")),
01015                   __FUNCTION__);
01016                 fprintf (stderr,
01017                   (_("\teffectively turning this entity it's visibility off.\n")));
01018         }
01019         donut->color = color;
01020 #if DEBUG
01021         DXF_DEBUG_END
01022 #endif
01023         return (donut);
01024 }
01025 
01026 
01033 int
01034 dxf_donut_get_paperspace
01035 (
01036         DxfDonut *donut
01038 )
01039 {
01040 #if DEBUG
01041         DXF_DEBUG_BEGIN
01042 #endif
01043         /* Do some basic checks. */
01044         if (donut == NULL)
01045         {
01046                 fprintf (stderr,
01047                   (_("Error in %s () a NULL pointer was passed.\n")),
01048                   __FUNCTION__);
01049                 return (EXIT_FAILURE);
01050         }
01051         if (donut->paperspace < 0)
01052         {
01053                 fprintf (stderr,
01054                   (_("Warning in %s () a negative value was found in the paperspace member.\n")),
01055                   __FUNCTION__);
01056         }
01057         if (donut->paperspace > 1)
01058         {
01059                 fprintf (stderr,
01060                   (_("Warning in %s () an out of range value was found in the paperspace member.\n")),
01061                   __FUNCTION__);
01062         }
01063 #if DEBUG
01064         DXF_DEBUG_END
01065 #endif
01066         return (donut->paperspace);
01067 }
01068 
01069 
01076 DxfDonut *
01077 dxf_donut_set_paperspace
01078 (
01079         DxfDonut *donut,
01081         int paperspace
01083 )
01084 {
01085 #if DEBUG
01086         DXF_DEBUG_BEGIN
01087 #endif
01088         /* Do some basic checks. */
01089         if (donut == NULL)
01090         {
01091                 fprintf (stderr,
01092                   (_("Error in %s () a NULL pointer was passed.\n")),
01093                   __FUNCTION__);
01094                 return (NULL);
01095         }
01096         if (paperspace < 0)
01097         {
01098                 fprintf (stderr,
01099                   (_("Error in %s () a negative paperspace value was passed.\n")),
01100                   __FUNCTION__);
01101                 return (NULL);
01102         }
01103         if (paperspace > 1)
01104         {
01105                 fprintf (stderr,
01106                   (_("Error in %s () an out of range paperspace value was passed.\n")),
01107                   __FUNCTION__);
01108                 return (NULL);
01109         }
01110         donut->paperspace = paperspace;
01111 #if DEBUG
01112         DXF_DEBUG_END
01113 #endif
01114         return (donut);
01115 }
01116 
01117 
01125 int
01126 dxf_donut_get_graphics_data_size
01127 (
01128         DxfDonut *donut
01130 )
01131 {
01132 #if DEBUG
01133         DXF_DEBUG_BEGIN
01134 #endif
01135         /* Do some basic checks. */
01136         if (donut == NULL)
01137         {
01138                 fprintf (stderr,
01139                   (_("Error in %s () a NULL pointer was passed.\n")),
01140                   __FUNCTION__);
01141                 return (EXIT_FAILURE);
01142         }
01143         if (donut->graphics_data_size < 0)
01144         {
01145                 fprintf (stderr,
01146                   (_("Warning in %s () a negative value was found in the graphics_data_size member.\n")),
01147                   __FUNCTION__);
01148         }
01149         if (donut->graphics_data_size == 0)
01150         {
01151                 fprintf (stderr,
01152                   (_("Warning in %s () a zero value was found in the graphics_data_size member.\n")),
01153                   __FUNCTION__);
01154         }
01155 #if DEBUG
01156         DXF_DEBUG_END
01157 #endif
01158         return (donut->graphics_data_size);
01159 }
01160 
01161 
01168 DxfDonut *
01169 dxf_donut_set_graphics_data_size
01170 (
01171         DxfDonut *donut,
01173         int graphics_data_size
01176 )
01177 {
01178 #if DEBUG
01179         DXF_DEBUG_BEGIN
01180 #endif
01181         /* Do some basic checks. */
01182         if (donut == NULL)
01183         {
01184                 fprintf (stderr,
01185                   (_("Error in %s () a NULL pointer was passed.\n")),
01186                   __FUNCTION__);
01187                 return (NULL);
01188         }
01189         if (graphics_data_size < 0)
01190         {
01191                 fprintf (stderr,
01192                   (_("Error in %s () a negative graphics_data_size value was passed.\n")),
01193                   __FUNCTION__);
01194                 return (NULL);
01195         }
01196         if (graphics_data_size == 0)
01197         {
01198                 fprintf (stderr,
01199                   (_("Warning in %s () a zero graphics_data_size value was passed.\n")),
01200                   __FUNCTION__);
01201         }
01202         donut->graphics_data_size = graphics_data_size;
01203 #if DEBUG
01204         DXF_DEBUG_END
01205 #endif
01206         return (donut);
01207 }
01208 
01209 
01216 int16_t
01217 dxf_donut_get_shadow_mode
01218 (
01219         DxfDonut *donut
01221 )
01222 {
01223 #if DEBUG
01224         DXF_DEBUG_BEGIN
01225 #endif
01226         /* Do some basic checks. */
01227         if (donut == NULL)
01228         {
01229                 fprintf (stderr,
01230                   (_("Error in %s () a NULL pointer was passed.\n")),
01231                   __FUNCTION__);
01232                 return (EXIT_FAILURE);
01233         }
01234         if (donut->shadow_mode < 0)
01235         {
01236                 fprintf (stderr,
01237                   (_("Error in %s () a negative value was found in the shadow_mode member.\n")),
01238                   __FUNCTION__);
01239                 return (EXIT_FAILURE);
01240         }
01241         if (donut->shadow_mode > 3)
01242         {
01243                 fprintf (stderr,
01244                   (_("Error in %s () an out of range value was found in the shadow_mode member.\n")),
01245                   __FUNCTION__);
01246                 return (EXIT_FAILURE);
01247         }
01248 #if DEBUG
01249         DXF_DEBUG_END
01250 #endif
01251         return (donut->shadow_mode);
01252 }
01253 
01254 
01261 DxfDonut *
01262 dxf_donut_set_shadow_mode
01263 (
01264         DxfDonut *donut,
01266         int16_t shadow_mode
01268 )
01269 {
01270 #if DEBUG
01271         DXF_DEBUG_BEGIN
01272 #endif
01273         /* Do some basic checks. */
01274         if (donut == NULL)
01275         {
01276                 fprintf (stderr,
01277                   (_("Error in %s () a NULL pointer was passed.\n")),
01278                   __FUNCTION__);
01279                 return (NULL);
01280         }
01281         if (shadow_mode < 0)
01282         {
01283                 fprintf (stderr,
01284                   (_("Error in %s () a negative shadow_mode value was passed.\n")),
01285                   __FUNCTION__);
01286                 return (NULL);
01287         }
01288         if (shadow_mode > 3)
01289         {
01290                 fprintf (stderr,
01291                   (_("Error in %s () an out of range shadow_mode value was passed.\n")),
01292                   __FUNCTION__);
01293                 return (NULL);
01294         }
01295         donut->shadow_mode = shadow_mode;
01296 #if DEBUG
01297         DXF_DEBUG_END
01298 #endif
01299         return (donut);
01300 }
01301 
01302 
01311 DxfBinaryGraphicsData *
01312 dxf_donut_get_binary_graphics_data
01313 (
01314         DxfDonut *donut
01316 )
01317 {
01318 #if DEBUG
01319         DXF_DEBUG_BEGIN
01320 #endif
01321         /* Do some basic checks. */
01322         if (donut == NULL)
01323         {
01324                 fprintf (stderr,
01325                   (_("Error in %s () a NULL pointer was passed.\n")),
01326                   __FUNCTION__);
01327                 return (NULL);
01328         }
01329         if (donut->binary_graphics_data ==  NULL)
01330         {
01331                 fprintf (stderr,
01332                   (_("Error in %s () a NULL pointer was found in the binary_graphics_data member.\n")),
01333                   __FUNCTION__);
01334                 return (NULL);
01335         }
01336 #if DEBUG
01337         DXF_DEBUG_END
01338 #endif
01339         return ((DxfBinaryGraphicsData *) donut->binary_graphics_data);
01340 }
01341 
01342 
01347 DxfDonut *
01348 dxf_donut_set_binary_graphics_data
01349 (
01350         DxfDonut *donut,
01352         DxfBinaryGraphicsData *data
01355 )
01356 {
01357 #if DEBUG
01358         DXF_DEBUG_BEGIN
01359 #endif
01360         /* Do some basic checks. */
01361         if (donut == NULL)
01362         {
01363                 fprintf (stderr,
01364                   (_("Error in %s () a NULL pointer was passed.\n")),
01365                   __FUNCTION__);
01366                 return (NULL);
01367         }
01368         if (data == NULL)
01369         {
01370                 fprintf (stderr,
01371                   (_("Error in %s () a NULL pointer was passed.\n")),
01372                   __FUNCTION__);
01373                 return (NULL);
01374         }
01375         donut->binary_graphics_data = (DxfBinaryGraphicsData *) data;
01376 #if DEBUG
01377         DXF_DEBUG_END
01378 #endif
01379         return (donut);
01380 }
01381 
01382 
01391 char *
01392 dxf_donut_get_dictionary_owner_soft
01393 (
01394         DxfDonut *donut
01396 )
01397 {
01398 #if DEBUG
01399         DXF_DEBUG_BEGIN
01400 #endif
01401         /* Do some basic checks. */
01402         if (donut == NULL)
01403         {
01404                 fprintf (stderr,
01405                   (_("Error in %s () a NULL pointer was passed.\n")),
01406                   __FUNCTION__);
01407                 return (NULL);
01408         }
01409         if (donut->dictionary_owner_soft ==  NULL)
01410         {
01411                 fprintf (stderr,
01412                   (_("Error in %s () a NULL pointer was found in the dictionary_owner_soft member.\n")),
01413                   __FUNCTION__);
01414                 return (NULL);
01415         }
01416 #if DEBUG
01417         DXF_DEBUG_END
01418 #endif
01419         return (strdup (donut->dictionary_owner_soft));
01420 }
01421 
01422 
01427 DxfDonut *
01428 dxf_donut_set_dictionary_owner_soft
01429 (
01430         DxfDonut *donut,
01432         char *dictionary_owner_soft
01435 )
01436 {
01437 #if DEBUG
01438         DXF_DEBUG_BEGIN
01439 #endif
01440         /* Do some basic checks. */
01441         if (donut == NULL)
01442         {
01443                 fprintf (stderr,
01444                   (_("Error in %s () a NULL pointer was passed.\n")),
01445                   __FUNCTION__);
01446                 return (NULL);
01447         }
01448         if (dictionary_owner_soft == NULL)
01449         {
01450                 fprintf (stderr,
01451                   (_("Error in %s () a NULL pointer was passed.\n")),
01452                   __FUNCTION__);
01453                 return (NULL);
01454         }
01455         donut->dictionary_owner_soft = strdup (dictionary_owner_soft);
01456 #if DEBUG
01457         DXF_DEBUG_END
01458 #endif
01459         return (donut);
01460 }
01461 
01462 
01472 char *
01473 dxf_donut_get_material
01474 (
01475         DxfDonut *donut
01477 )
01478 {
01479 #if DEBUG
01480         DXF_DEBUG_BEGIN
01481 #endif
01482         /* Do some basic checks. */
01483         if (donut == NULL)
01484         {
01485                 fprintf (stderr,
01486                   (_("Error in %s () a NULL pointer was passed.\n")),
01487                   __FUNCTION__);
01488                 return (NULL);
01489         }
01490         if (donut->material ==  NULL)
01491         {
01492                 fprintf (stderr,
01493                   (_("Error in %s () a NULL pointer was found in the material member.\n")),
01494                   __FUNCTION__);
01495                 return (NULL);
01496         }
01497 #if DEBUG
01498         DXF_DEBUG_END
01499 #endif
01500         return (strdup (donut->material));
01501 }
01502 
01503 
01511 DxfDonut *
01512 dxf_donut_set_material
01513 (
01514         DxfDonut *donut,
01516         char *material
01519 )
01520 {
01521 #if DEBUG
01522         DXF_DEBUG_BEGIN
01523 #endif
01524         /* Do some basic checks. */
01525         if (donut == NULL)
01526         {
01527                 fprintf (stderr,
01528                   (_("Error in %s () a NULL pointer was passed.\n")),
01529                   __FUNCTION__);
01530                 return (NULL);
01531         }
01532         if (material == NULL)
01533         {
01534                 fprintf (stderr,
01535                   (_("Error in %s () a NULL pointer was passed.\n")),
01536                   __FUNCTION__);
01537                 return (NULL);
01538         }
01539         donut->material = strdup (material);
01540 #if DEBUG
01541         DXF_DEBUG_END
01542 #endif
01543         return (donut);
01544 }
01545 
01546 
01555 char *
01556 dxf_donut_get_dictionary_owner_hard
01557 (
01558         DxfDonut *donut
01560 )
01561 {
01562 #if DEBUG
01563         DXF_DEBUG_BEGIN
01564 #endif
01565         /* Do some basic checks. */
01566         if (donut == NULL)
01567         {
01568                 fprintf (stderr,
01569                   (_("Error in %s () a NULL pointer was passed.\n")),
01570                   __FUNCTION__);
01571                 return (NULL);
01572         }
01573         if (donut->dictionary_owner_hard ==  NULL)
01574         {
01575                 fprintf (stderr,
01576                   (_("Error in %s () a NULL pointer was found in the dictionary_owner_hard member.\n")),
01577                   __FUNCTION__);
01578                 return (NULL);
01579         }
01580 #if DEBUG
01581         DXF_DEBUG_END
01582 #endif
01583         return (strdup (donut->dictionary_owner_hard));
01584 }
01585 
01586 
01594 DxfDonut *
01595 dxf_donut_set_dictionary_owner_hard
01596 (
01597         DxfDonut *donut,
01599         char *dictionary_owner_hard
01602 )
01603 {
01604 #if DEBUG
01605         DXF_DEBUG_BEGIN
01606 #endif
01607         /* Do some basic checks. */
01608         if (donut == NULL)
01609         {
01610                 fprintf (stderr,
01611                   (_("Error in %s () a NULL pointer was passed.\n")),
01612                   __FUNCTION__);
01613                 return (NULL);
01614         }
01615         if (dictionary_owner_hard == NULL)
01616         {
01617                 fprintf (stderr,
01618                   (_("Error in %s () a NULL pointer was passed.\n")),
01619                   __FUNCTION__);
01620                 return (NULL);
01621         }
01622         donut->dictionary_owner_hard = strdup (dictionary_owner_hard);
01623 #if DEBUG
01624         DXF_DEBUG_END
01625 #endif
01626         return (donut);
01627 }
01628 
01629 
01636 int16_t
01637 dxf_donut_get_lineweight
01638 (
01639         DxfDonut *donut
01641 )
01642 {
01643 #if DEBUG
01644         DXF_DEBUG_BEGIN
01645 #endif
01646         /* Do some basic checks. */
01647         if (donut == NULL)
01648         {
01649                 fprintf (stderr,
01650                   (_("Error in %s () a NULL pointer was passed.\n")),
01651                   __FUNCTION__);
01652                 return (EXIT_FAILURE);
01653         }
01654 #if DEBUG
01655         DXF_DEBUG_END
01656 #endif
01657         return (donut->lineweight);
01658 }
01659 
01660 
01667 DxfDonut *
01668 dxf_donut_set_lineweight
01669 (
01670         DxfDonut *donut,
01672         int16_t lineweight
01674 )
01675 {
01676 #if DEBUG
01677         DXF_DEBUG_BEGIN
01678 #endif
01679         /* Do some basic checks. */
01680         if (donut == NULL)
01681         {
01682                 fprintf (stderr,
01683                   (_("Error in %s () a NULL pointer was passed.\n")),
01684                   __FUNCTION__);
01685                 return (NULL);
01686         }
01687         donut->lineweight = lineweight;
01688 #if DEBUG
01689         DXF_DEBUG_END
01690 #endif
01691         return (donut);
01692 }
01693 
01694 
01701 char *
01702 dxf_donut_get_plot_style_name
01703 (
01704         DxfDonut *donut
01706 )
01707 {
01708 #if DEBUG
01709         DXF_DEBUG_BEGIN
01710 #endif
01711         /* Do some basic checks. */
01712         if (donut == NULL)
01713         {
01714                 fprintf (stderr,
01715                   (_("Error in %s () a NULL pointer was passed.\n")),
01716                   __FUNCTION__);
01717                 return (NULL);
01718         }
01719         if (donut->plot_style_name ==  NULL)
01720         {
01721                 fprintf (stderr,
01722                   (_("Error in %s () a NULL pointer was found in the plot_style_name member.\n")),
01723                   __FUNCTION__);
01724                 return (NULL);
01725         }
01726 #if DEBUG
01727         DXF_DEBUG_END
01728 #endif
01729         return (strdup (donut->plot_style_name));
01730 }
01731 
01732 
01739 DxfDonut *
01740 dxf_donut_set_plot_style_name
01741 (
01742         DxfDonut *donut,
01744         char *plot_style_name
01747 )
01748 {
01749 #if DEBUG
01750         DXF_DEBUG_BEGIN
01751 #endif
01752         /* Do some basic checks. */
01753         if (donut == NULL)
01754         {
01755                 fprintf (stderr,
01756                   (_("Error in %s () a NULL pointer was passed.\n")),
01757                   __FUNCTION__);
01758                 return (NULL);
01759         }
01760         if (plot_style_name == NULL)
01761         {
01762                 fprintf (stderr,
01763                   (_("Error in %s () a NULL pointer was passed.\n")),
01764                   __FUNCTION__);
01765                 return (NULL);
01766         }
01767         donut->plot_style_name = strdup (plot_style_name);
01768 #if DEBUG
01769         DXF_DEBUG_END
01770 #endif
01771         return (donut);
01772 }
01773 
01774 
01781 long
01782 dxf_donut_get_color_value
01783 (
01784         DxfDonut *donut
01786 )
01787 {
01788 #if DEBUG
01789         DXF_DEBUG_BEGIN
01790 #endif
01791         /* Do some basic checks. */
01792         if (donut == NULL)
01793         {
01794                 fprintf (stderr,
01795                   (_("Error in %s () a NULL pointer was passed.\n")),
01796                   __FUNCTION__);
01797                 return (EXIT_FAILURE);
01798         }
01799 #if DEBUG
01800         DXF_DEBUG_END
01801 #endif
01802         return (donut->color_value);
01803 }
01804 
01805 
01812 DxfDonut *
01813 dxf_donut_set_color_value
01814 (
01815         DxfDonut *donut,
01817         long color_value
01819 )
01820 {
01821 #if DEBUG
01822         DXF_DEBUG_BEGIN
01823 #endif
01824         /* Do some basic checks. */
01825         if (donut == NULL)
01826         {
01827                 fprintf (stderr,
01828                   (_("Error in %s () a NULL pointer was passed.\n")),
01829                   __FUNCTION__);
01830                 return (NULL);
01831         }
01832         donut->color_value = color_value;
01833 #if DEBUG
01834         DXF_DEBUG_END
01835 #endif
01836         return (donut);
01837 }
01838 
01839 
01846 char *
01847 dxf_donut_get_color_name
01848 (
01849         DxfDonut *donut
01851 )
01852 {
01853 #if DEBUG
01854         DXF_DEBUG_BEGIN
01855 #endif
01856         /* Do some basic checks. */
01857         if (donut == NULL)
01858         {
01859                 fprintf (stderr,
01860                   (_("Error in %s () a NULL pointer was passed.\n")),
01861                   __FUNCTION__);
01862                 return (NULL);
01863         }
01864         if (donut->color_name ==  NULL)
01865         {
01866                 fprintf (stderr,
01867                   (_("Error in %s () a NULL pointer was found in the color_name member.\n")),
01868                   __FUNCTION__);
01869                 return (NULL);
01870         }
01871 #if DEBUG
01872         DXF_DEBUG_END
01873 #endif
01874         return (strdup (donut->color_name));
01875 }
01876 
01877 
01884 DxfDonut *
01885 dxf_donut_set_color_name
01886 (
01887         DxfDonut *donut,
01889         char *color_name
01892 )
01893 {
01894 #if DEBUG
01895         DXF_DEBUG_BEGIN
01896 #endif
01897         /* Do some basic checks. */
01898         if (donut == NULL)
01899         {
01900                 fprintf (stderr,
01901                   (_("Error in %s () a NULL pointer was passed.\n")),
01902                   __FUNCTION__);
01903                 return (NULL);
01904         }
01905         if (color_name == NULL)
01906         {
01907                 fprintf (stderr,
01908                   (_("Error in %s () a NULL pointer was passed.\n")),
01909                   __FUNCTION__);
01910                 return (NULL);
01911         }
01912         donut->color_name = strdup (color_name);
01913 #if DEBUG
01914         DXF_DEBUG_END
01915 #endif
01916         return (donut);
01917 }
01918 
01919 
01926 long
01927 dxf_donut_get_transparency
01928 (
01929         DxfDonut *donut
01931 )
01932 {
01933 #if DEBUG
01934         DXF_DEBUG_BEGIN
01935 #endif
01936         /* Do some basic checks. */
01937         if (donut == NULL)
01938         {
01939                 fprintf (stderr,
01940                   (_("Error in %s () a NULL pointer was passed.\n")),
01941                   __FUNCTION__);
01942                 return (EXIT_FAILURE);
01943         }
01944 #if DEBUG
01945         DXF_DEBUG_END
01946 #endif
01947         return (donut->transparency);
01948 }
01949 
01950 
01957 DxfDonut *
01958 dxf_donut_set_transparency
01959 (
01960         DxfDonut *donut,
01962         long transparency
01964 )
01965 {
01966 #if DEBUG
01967         DXF_DEBUG_BEGIN
01968 #endif
01969         /* Do some basic checks. */
01970         if (donut == NULL)
01971         {
01972                 fprintf (stderr,
01973                   (_("Error in %s () a NULL pointer was passed.\n")),
01974                   __FUNCTION__);
01975                 return (NULL);
01976         }
01977         donut->transparency = transparency;
01978 #if DEBUG
01979         DXF_DEBUG_END
01980 #endif
01981         return (donut);
01982 }
01983 
01984 
01990 DxfPoint *
01991 dxf_donut_get_p0
01992 (
01993         DxfDonut *donut
01995 )
01996 {
01997 #ifdef DEBUG
01998         DXF_DEBUG_BEGIN
01999 #endif
02000         /* Do some basic checks. */
02001         if (donut == NULL)
02002         {
02003                 fprintf (stderr,
02004                   (_("Error in %s () a NULL pointer was passed.\n")),
02005                   __FUNCTION__);
02006                 return (NULL);
02007         }
02008         if (donut->p0 == NULL)
02009         {
02010                 fprintf (stderr,
02011                   (_("Error in %s () a NULL pointer was passed.\n")),
02012                   __FUNCTION__);
02013                 return (NULL);
02014         }
02015 #if DEBUG
02016         DXF_DEBUG_END
02017 #endif
02018         return (donut->p0);
02019 }
02020 
02021 
02028 DxfDonut *
02029 dxf_donut_set_p0
02030 (
02031         DxfDonut *donut,
02033         DxfPoint *p0
02035 )
02036 {
02037 #ifdef DEBUG
02038         DXF_DEBUG_BEGIN
02039 #endif
02040         /* Do some basic checks. */
02041         if (donut == NULL)
02042         {
02043                 fprintf (stderr,
02044                   (_("Error in %s () a NULL pointer was passed.\n")),
02045                   __FUNCTION__);
02046                 return (NULL);
02047         }
02048         if (p0 == NULL)
02049         {
02050                 fprintf (stderr,
02051                   (_("Error in %s () a NULL pointer was passed.\n")),
02052                   __FUNCTION__);
02053                 return (NULL);
02054         }
02055         donut->p0 = (DxfPoint *) p0;
02056 #if DEBUG
02057         DXF_DEBUG_END
02058 #endif
02059         return (donut);
02060 }
02061 
02062 
02069 double
02070 dxf_donut_get_x0
02071 (
02072         DxfDonut *donut
02074 )
02075 {
02076 #ifdef DEBUG
02077         DXF_DEBUG_BEGIN
02078 #endif
02079 
02080         /* Do some basic checks. */
02081         if (donut == NULL)
02082         {
02083                 fprintf (stderr,
02084                   (_("Error in %s () a NULL pointer was passed.\n")),
02085                   __FUNCTION__);
02086                 return (EXIT_FAILURE);
02087         }
02088         if (donut->p0 == NULL)
02089         {
02090                 fprintf (stderr,
02091                   (_("Error in %s () a NULL pointer was passed.\n")),
02092                   __FUNCTION__);
02093                 return (EXIT_FAILURE);
02094         }
02095 #if DEBUG
02096         DXF_DEBUG_END
02097 #endif
02098         return (donut->p0->x0);
02099 }
02100 
02101 
02109 DxfDonut *
02110 dxf_donut_set_x0
02111 (
02112         DxfDonut *donut,
02114         double x0
02117 )
02118 {
02119 #ifdef DEBUG
02120         DXF_DEBUG_BEGIN
02121 #endif
02122         /* Do some basic checks. */
02123         if (donut == NULL)
02124         {
02125                 fprintf (stderr,
02126                   (_("Error in %s () a NULL pointer was passed.\n")),
02127                   __FUNCTION__);
02128                 return (NULL);
02129         }
02130         if (donut->p0 == NULL)
02131         {
02132                 fprintf (stderr,
02133                   (_("Error in %s () a NULL pointer was passed.\n")),
02134                   __FUNCTION__);
02135                 return (NULL);
02136         }
02137         donut->p0->x0 = x0;
02138 #if DEBUG
02139         DXF_DEBUG_END
02140 #endif
02141         return (donut);
02142 }
02143 
02144 
02151 double
02152 dxf_donut_get_y0
02153 (
02154         DxfDonut *donut
02156 )
02157 {
02158 #ifdef DEBUG
02159         DXF_DEBUG_BEGIN
02160 #endif
02161 
02162         /* Do some basic checks. */
02163         if (donut == NULL)
02164         {
02165                 fprintf (stderr,
02166                   (_("Error in %s () a NULL pointer was passed.\n")),
02167                   __FUNCTION__);
02168                 return (EXIT_FAILURE);
02169         }
02170         if (donut->p0 == NULL)
02171         {
02172                 fprintf (stderr,
02173                   (_("Error in %s () a NULL pointer was passed.\n")),
02174                   __FUNCTION__);
02175                 return (EXIT_FAILURE);
02176         }
02177 #if DEBUG
02178         DXF_DEBUG_END
02179 #endif
02180         return (donut->p0->y0);
02181 }
02182 
02183 
02191 DxfDonut *
02192 dxf_donut_set_y0
02193 (
02194         DxfDonut *donut,
02196         double y0
02199 )
02200 {
02201 #ifdef DEBUG
02202         DXF_DEBUG_BEGIN
02203 #endif
02204         /* Do some basic checks. */
02205         if (donut == NULL)
02206         {
02207                 fprintf (stderr,
02208                   (_("Error in %s () a NULL pointer was passed.\n")),
02209                   __FUNCTION__);
02210                 return (NULL);
02211         }
02212         if (donut->p0 == NULL)
02213         {
02214                 fprintf (stderr,
02215                   (_("Error in %s () a NULL pointer was passed.\n")),
02216                   __FUNCTION__);
02217                 return (NULL);
02218         }
02219         donut->p0->y0 = y0;
02220 #if DEBUG
02221         DXF_DEBUG_END
02222 #endif
02223         return (donut);
02224 }
02225 
02226 
02233 double
02234 dxf_donut_get_z0
02235 (
02236         DxfDonut *donut
02238 )
02239 {
02240 #ifdef DEBUG
02241         DXF_DEBUG_BEGIN
02242 #endif
02243 
02244         /* Do some basic checks. */
02245         if (donut == NULL)
02246         {
02247                 fprintf (stderr,
02248                   (_("Error in %s () a NULL pointer was passed.\n")),
02249                   __FUNCTION__);
02250                 return (EXIT_FAILURE);
02251         }
02252         if (donut->p0 == NULL)
02253         {
02254                 fprintf (stderr,
02255                   (_("Error in %s () a NULL pointer was passed.\n")),
02256                   __FUNCTION__);
02257                 return (EXIT_FAILURE);
02258         }
02259 #if DEBUG
02260         DXF_DEBUG_END
02261 #endif
02262         return (donut->p0->z0);
02263 }
02264 
02265 
02273 DxfDonut *
02274 dxf_donut_set_z0
02275 (
02276         DxfDonut *donut,
02278         double z0
02281 )
02282 {
02283 #ifdef DEBUG
02284         DXF_DEBUG_BEGIN
02285 #endif
02286         /* Do some basic checks. */
02287         if (donut == NULL)
02288         {
02289                 fprintf (stderr,
02290                   (_("Error in %s () a NULL pointer was passed.\n")),
02291                   __FUNCTION__);
02292                 return (NULL);
02293         }
02294         if (donut->p0 == NULL)
02295         {
02296                 fprintf (stderr,
02297                   (_("Error in %s () a NULL pointer was passed.\n")),
02298                   __FUNCTION__);
02299                 return (NULL);
02300         }
02301         donut->p0->z0 = z0;
02302 #if DEBUG
02303         DXF_DEBUG_END
02304 #endif
02305         return (donut);
02306 }
02307 
02308 
02314 double
02315 dxf_donut_get_outside_diameter
02316 (
02317         DxfDonut *donut
02319 )
02320 {
02321 #ifdef DEBUG
02322         DXF_DEBUG_BEGIN
02323 #endif
02324 
02325         /* Do some basic checks. */
02326         if (donut == NULL)
02327         {
02328                 fprintf (stderr,
02329                   (_("Error in %s () a NULL pointer was passed.\n")),
02330                   __FUNCTION__);
02331                 return (EXIT_FAILURE);
02332         }
02333 #if DEBUG
02334         DXF_DEBUG_END
02335 #endif
02336         return (donut->outside_diameter);
02337 }
02338 
02339 
02346 DxfDonut *
02347 dxf_donut_set_outside_diameter
02348 (
02349         DxfDonut *donut,
02351         double outside_diameter
02354 )
02355 {
02356 #ifdef DEBUG
02357         DXF_DEBUG_BEGIN
02358 #endif
02359         /* Do some basic checks. */
02360         if (donut == NULL)
02361         {
02362                 fprintf (stderr,
02363                   (_("Error in %s () a NULL pointer was passed.\n")),
02364                   __FUNCTION__);
02365                 return (NULL);
02366         }
02367         donut->outside_diameter = outside_diameter;
02368 #if DEBUG
02369         DXF_DEBUG_END
02370 #endif
02371         return (donut);
02372 }
02373 
02374 
02380 double
02381 dxf_donut_get_inside_diameter
02382 (
02383         DxfDonut *donut
02385 )
02386 {
02387 #ifdef DEBUG
02388         DXF_DEBUG_BEGIN
02389 #endif
02390 
02391         /* Do some basic checks. */
02392         if (donut == NULL)
02393         {
02394                 fprintf (stderr,
02395                   (_("Error in %s () a NULL pointer was passed.\n")),
02396                   __FUNCTION__);
02397                 return (EXIT_FAILURE);
02398         }
02399 #if DEBUG
02400         DXF_DEBUG_END
02401 #endif
02402         return (donut->inside_diameter);
02403 }
02404 
02405 
02412 DxfDonut *
02413 dxf_donut_set_inside_diameter
02414 (
02415         DxfDonut *donut,
02417         double inside_diameter
02420 )
02421 {
02422 #ifdef DEBUG
02423         DXF_DEBUG_BEGIN
02424 #endif
02425         /* Do some basic checks. */
02426         if (donut == NULL)
02427         {
02428                 fprintf (stderr,
02429                   (_("Error in %s () a NULL pointer was passed.\n")),
02430                   __FUNCTION__);
02431                 return (NULL);
02432         }
02433         donut->inside_diameter = inside_diameter;
02434 #if DEBUG
02435         DXF_DEBUG_END
02436 #endif
02437         return (donut);
02438 }
02439 
02440 
02449 DxfDonut *
02450 dxf_donut_get_next
02451 (
02452         DxfDonut *donut
02454 )
02455 {
02456 #if DEBUG
02457         DXF_DEBUG_BEGIN
02458 #endif
02459         /* Do some basic checks. */
02460         if (donut == NULL)
02461         {
02462                 fprintf (stderr,
02463                   (_("Error in %s () a NULL pointer was passed.\n")),
02464                   __FUNCTION__);
02465                 return (NULL);
02466         }
02467         if (donut->next == NULL)
02468         {
02469                 fprintf (stderr,
02470                   (_("Error in %s () a NULL pointer was found in the next member.\n")),
02471                   __FUNCTION__);
02472                 return (NULL);
02473         }
02474 #if DEBUG
02475         DXF_DEBUG_END
02476 #endif
02477         return ((DxfDonut *) donut->next);
02478 }
02479 
02480 
02488 DxfDonut *
02489 dxf_donut_set_next
02490 (
02491         DxfDonut *donut,
02493         DxfDonut *next
02495 )
02496 {
02497 #if DEBUG
02498         DXF_DEBUG_BEGIN
02499 #endif
02500         /* Do some basic checks. */
02501         if (donut == NULL)
02502         {
02503                 fprintf (stderr,
02504                   (_("Error in %s () a NULL pointer was passed.\n")),
02505                   __FUNCTION__);
02506                 return (NULL);
02507         }
02508         if (next == NULL)
02509         {
02510                 fprintf (stderr,
02511                   (_("Error in %s () a NULL pointer was passed.\n")),
02512                   __FUNCTION__);
02513                 return (NULL);
02514         }
02515         donut->next = (struct DxfDonut *) next;
02516 #if DEBUG
02517         DXF_DEBUG_END
02518 #endif
02519         return (donut);
02520 }
02521 
02522 
02531 DxfDonut *
02532 dxf_donut_get_last
02533 (
02534         DxfDonut *donut
02536 )
02537 {
02538 #if DEBUG
02539         DXF_DEBUG_BEGIN
02540 #endif
02541         /* Do some basic checks. */
02542         if (donut == NULL)
02543         {
02544                 fprintf (stderr,
02545                   (_("Error in %s () a NULL pointer was passed.\n")),
02546                   __FUNCTION__);
02547                 return (NULL);
02548         }
02549         if (donut->next == NULL)
02550         {
02551                 fprintf (stderr,
02552                   (_("Warning in %s () a NULL pointer was found in the next member.\n")),
02553                   __FUNCTION__);
02554                 return ((DxfDonut *) donut);
02555         }
02556         DxfDonut *iter = (DxfDonut *) donut->next;
02557         while (iter->next != NULL)
02558         {
02559                 iter = (DxfDonut *) iter->next;
02560         }
02561 #if DEBUG
02562         DXF_DEBUG_END
02563 #endif
02564         return ((DxfDonut *) iter);
02565 }
02566 
02567 
02568 /* EOF */