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

attdef.c

Go to the documentation of this file.
00001 
00042 #include "attdef.h"
00043 
00044 
00050 DxfAttdef *
00051 dxf_attdef_new ()
00052 {
00053 #if DEBUG
00054         DXF_DEBUG_BEGIN
00055 #endif
00056         DxfAttdef *attdef = NULL;
00057         size_t size;
00058 
00059         size = sizeof (DxfAttdef);
00060         /* avoid malloc of 0 bytes */
00061         if (size == 0) size = 1;
00062         if ((attdef = malloc (size)) == NULL)
00063         {
00064                 fprintf (stderr,
00065                   (_("Error in %s () could not allocate memory.\n")),
00066                   __FUNCTION__);
00067                 attdef = NULL;
00068         }
00069         else
00070         {
00071                 memset (attdef, 0, size);
00072         }
00073 #if DEBUG
00074         DXF_DEBUG_END
00075 #endif
00076         return (attdef);
00077 }
00078 
00079 
00086 DxfAttdef *
00087 dxf_attdef_init
00088 (
00089         DxfAttdef *attdef
00091 )
00092 {
00093 #if DEBUG
00094         DXF_DEBUG_BEGIN
00095 #endif
00096         /* Do some basic checks. */
00097         if (attdef == NULL)
00098         {
00099                 fprintf (stderr,
00100                   (_("Warning in %s () a NULL pointer was passed.\n")),
00101                   __FUNCTION__);
00102                 attdef = dxf_attdef_new ();
00103         }
00104         if (attdef == NULL)
00105         {
00106               fprintf (stderr,
00107                 (_("Error in %s () could not allocate memory.\n")),
00108                 __FUNCTION__);
00109               return (NULL);
00110         }
00111         dxf_attdef_set_id_code (attdef, 0);
00112         dxf_attdef_set_linetype (attdef, strdup (DXF_DEFAULT_LINETYPE));
00113         dxf_attdef_set_layer (attdef, strdup (DXF_DEFAULT_LAYER));
00114         dxf_attdef_set_elevation (attdef, 0.0);
00115         dxf_attdef_set_thickness (attdef, 0.0);
00116         dxf_attdef_set_linetype_scale (attdef, DXF_DEFAULT_LINETYPE_SCALE);
00117         dxf_attdef_set_visibility (attdef, DXF_DEFAULT_VISIBILITY);
00118         dxf_attdef_set_color (attdef, DXF_COLOR_BYLAYER);
00119         dxf_attdef_set_paperspace (attdef, DXF_MODELSPACE);
00120         dxf_attdef_set_graphics_data_size (attdef, 0);
00121         dxf_attdef_set_shadow_mode (attdef, 0);
00122         dxf_attdef_set_binary_graphics_data (attdef, (DxfBinaryGraphicsData *) dxf_binary_graphics_data_new ());
00123         dxf_binary_graphics_data_init ((DxfBinaryGraphicsData *) dxf_attdef_get_binary_graphics_data (attdef));
00124         dxf_attdef_set_dictionary_owner_soft (attdef, strdup (""));
00125         dxf_attdef_set_material (attdef, strdup (""));
00126         dxf_attdef_set_dictionary_owner_hard (attdef, strdup (""));
00127         dxf_attdef_set_lineweight (attdef, 0);
00128         dxf_attdef_set_plot_style_name (attdef, strdup (""));
00129         dxf_attdef_set_color_value (attdef, 0);
00130         dxf_attdef_set_color_name (attdef, strdup (""));
00131         dxf_attdef_set_transparency (attdef, 0);
00132         dxf_attdef_set_default_value (attdef, strdup (""));
00133         dxf_attdef_set_tag_value (attdef, strdup (""));
00134         dxf_attdef_set_prompt_value (attdef, strdup (""));
00135         dxf_attdef_set_text_style (attdef, strdup (DXF_DEFAULT_TEXTSTYLE));
00136         dxf_attdef_set_p0 (attdef, dxf_point_new ());
00137         dxf_point_init ((DxfPoint *) dxf_attdef_get_p0 (attdef));
00138         dxf_attdef_set_x0 (attdef, 0.0);
00139         dxf_attdef_set_y0 (attdef, 0.0);
00140         dxf_attdef_set_z0 (attdef, 0.0);
00141         dxf_attdef_set_p1 (attdef, dxf_point_new ());
00142         dxf_point_init ((DxfPoint *) dxf_attdef_get_p1 (attdef));
00143         dxf_attdef_set_x1 (attdef, 0.0);
00144         dxf_attdef_set_y1 (attdef, 0.0);
00145         dxf_attdef_set_z1 (attdef, 0.0);
00146         dxf_attdef_set_height (attdef, 0.0);
00147         dxf_attdef_set_rel_x_scale (attdef, 0.0);
00148         dxf_attdef_set_rot_angle (attdef, 0.0);
00149         dxf_attdef_set_obl_angle (attdef, 0.0);
00150         dxf_attdef_set_attr_flags (attdef, 0);
00151         dxf_attdef_set_text_flags (attdef, 0);
00152         dxf_attdef_set_hor_align (attdef, 0);
00153         dxf_attdef_set_field_length (attdef, 0);
00154         dxf_attdef_set_vert_align (attdef, 0);
00155         dxf_attdef_set_extr_x0 (attdef, 0.0);
00156         dxf_attdef_set_extr_y0 (attdef, 0.0);
00157         dxf_attdef_set_extr_z0 (attdef, 1.0);
00158         dxf_attdef_set_next (attdef, NULL);
00159 #if DEBUG
00160         DXF_DEBUG_END
00161 #endif
00162         return (attdef);
00163 }
00164 
00165 
00177 DxfAttdef *
00178 dxf_attdef_read
00179 (
00180         DxfFile *fp,
00182         DxfAttdef *attdef
00184 )
00185 {
00186 #if DEBUG
00187         DXF_DEBUG_BEGIN
00188 #endif
00189         char *temp_string = NULL;
00190 
00191         /* Do some basic checks. */
00192         if (fp == NULL)
00193         {
00194                 fprintf (stderr,
00195                   (_("Error in %s () a NULL file pointer was passed.\n")),
00196                   __FUNCTION__);
00197                 /* Clean up. */
00198                 free (temp_string);
00199                 return (NULL);
00200         }
00201         if (attdef == NULL)
00202         {
00203                 fprintf (stderr,
00204                   (_("Warning in %s () a NULL pointer was passed.\n")),
00205                   __FUNCTION__);
00206                 attdef = dxf_attdef_new ();
00207                 attdef = dxf_attdef_init (attdef);
00208         }
00209         (fp->line_number)++;
00210         fscanf (fp->fp, "%[^\n]", temp_string);
00211         while (strcmp (temp_string, "0") != 0)
00212         {
00213                 if (ferror (fp->fp))
00214                 {
00215                         fprintf (stderr,
00216                           (_("Error in %s () while reading from: %s in line: %d.\n")),
00217                           __FUNCTION__, fp->filename, fp->line_number);
00218                         fclose (fp->fp);
00219                         /* Clean up. */
00220                         free (temp_string);
00221                         return (NULL);
00222                 }
00223                 if (strcmp (temp_string, "1") == 0)
00224                 {
00225                         /* Now follows a string containing the attribute
00226                          * default value. */
00227                         (fp->line_number)++;
00228                         fscanf (fp->fp, "%s\n", attdef->default_value);
00229                 }
00230                 else if (strcmp (temp_string, "2") == 0)
00231                 {
00232                         /* Now follows a string containing a tag value. */
00233                         (fp->line_number)++;
00234                         fscanf (fp->fp, "%s\n", attdef->tag_value);
00235                 }
00236                 else if (strcmp (temp_string, "3") == 0)
00237                 {
00238                         /* Now follows a string containing a prompt
00239                          * value. */
00240                         (fp->line_number)++;
00241                         fscanf (fp->fp, "%s\n", attdef->prompt_value);
00242                 }
00243                 else if (strcmp (temp_string, "5") == 0)
00244                 {
00245                         /* Now follows a string containing a sequential
00246                          * id number. */
00247                         (fp->line_number)++;
00248                         fscanf (fp->fp, "%x\n", &attdef->id_code);
00249                 }
00250                 else if (strcmp (temp_string, "6") == 0)
00251                 {
00252                         /* Now follows a string containing a linetype
00253                          * name. */
00254                         (fp->line_number)++;
00255                         fscanf (fp->fp, "%s\n", attdef->linetype);
00256                 }
00257                 else if (strcmp (temp_string, "7") == 0)
00258                 {
00259                         /* Now follows a string containing a text style. */
00260                         (fp->line_number)++;
00261                         fscanf (fp->fp, "%s\n", attdef->text_style);
00262                 }
00263                 else if (strcmp (temp_string, "8") == 0)
00264                 {
00265                         /* Now follows a string containing a layer name. */
00266                         (fp->line_number)++;
00267                         fscanf (fp->fp, "%s\n", attdef->layer);
00268                 }
00269                 else if (strcmp (temp_string, "10") == 0)
00270                 {
00271                         /* Now follows a string containing the
00272                          * X-coordinate of the center point. */
00273                         (fp->line_number)++;
00274                         fscanf (fp->fp, "%lf\n", &attdef->p0->x0);
00275                 }
00276                 else if (strcmp (temp_string, "20") == 0)
00277                 {
00278                         /* Now follows a string containing the
00279                          * Y-coordinate of the center point. */
00280                         (fp->line_number)++;
00281                         fscanf (fp->fp, "%lf\n", &attdef->p0->y0);
00282                 }
00283                 else if (strcmp (temp_string, "30") == 0)
00284                 {
00285                         /* Now follows a string containing the
00286                          * Z-coordinate of the center point. */
00287                         (fp->line_number)++;
00288                         fscanf (fp->fp, "%lf\n", &attdef->p0->z0);
00289                 }
00290                 else if (strcmp (temp_string, "11") == 0)
00291                 {
00292                         /* Now follows a string containing the
00293                          * X-coordinate of the align point. */
00294                         (fp->line_number)++;
00295                         fscanf (fp->fp, "%lf\n", &attdef->p1->x0);
00296                 }
00297                 else if (strcmp (temp_string, "21") == 0)
00298                 {
00299                         /* Now follows a string containing the
00300                          * Y-coordinate of the align point. */
00301                         (fp->line_number)++;
00302                         fscanf (fp->fp, "%lf\n", &attdef->p1->y0);
00303                 }
00304                 else if (strcmp (temp_string, "31") == 0)
00305                 {
00306                         /* Now follows a string containing the
00307                          * Z-coordinate of the align point. */
00308                         (fp->line_number)++;
00309                         fscanf (fp->fp, "%lf\n", &attdef->p1->z0);
00310                 }
00311                 else if ((fp->acad_version_number <= AutoCAD_11)
00312                         && (strcmp (temp_string, "38") == 0)
00313                         && (attdef->elevation = 0.0))
00314                 {
00315                         /* Elevation is a pre AutoCAD R11 variable
00316                          * so additional testing for the version should
00317                          * probably be added.
00318                          * Now follows a string containing the
00319                          * elevation. */
00320                         (fp->line_number)++;
00321                         fscanf (fp->fp, "%lf\n", &attdef->elevation);
00322                 }
00323                 else if (strcmp (temp_string, "39") == 0)
00324                 {
00325                         /* Now follows a string containing the
00326                          * thickness. */
00327                         (fp->line_number)++;
00328                         fscanf (fp->fp, "%lf\n", &attdef->thickness);
00329                 }
00330                 else if (strcmp (temp_string, "40") == 0)
00331                 {
00332                         /* Now follows a string containing the
00333                          * height. */
00334                         (fp->line_number)++;
00335                         fscanf (fp->fp, "%lf\n", &attdef->height);
00336                 }
00337                 else if (strcmp (temp_string, "41") == 0)
00338                 {
00339                         /* Now follows a string containing the
00340                          * relative X-scale. */
00341                         (fp->line_number)++;
00342                         fscanf (fp->fp, "%lf\n", &attdef->rel_x_scale);
00343                 }
00344                 else if (strcmp (temp_string, "48") == 0)
00345                 {
00346                         /* Now follows a string containing the linetype
00347                          * scale. */
00348                         (fp->line_number)++;
00349                         fscanf (fp->fp, "%lf\n", &attdef->linetype_scale);
00350                 }
00351                 else if (strcmp (temp_string, "50") == 0)
00352                 {
00353                         /* Now follows a string containing the
00354                          * rotation angle. */
00355                         (fp->line_number)++;
00356                         fscanf (fp->fp, "%lf\n", &attdef->rot_angle);
00357                 }
00358                 else if (strcmp (temp_string, "51") == 0)
00359                 {
00360                         /* Now follows a string containing the
00361                          * end angle. */
00362                         (fp->line_number)++;
00363                         fscanf (fp->fp, "%lf\n", &attdef->obl_angle);
00364                 }
00365                 else if (strcmp (temp_string, "60") == 0)
00366                 {
00367                         /* Now follows a string containing the
00368                          * visibility value. */
00369                         (fp->line_number)++;
00370                         fscanf (fp->fp, "%hd\n", &attdef->visibility);
00371                 }
00372                 else if (strcmp (temp_string, "62") == 0)
00373                 {
00374                         /* Now follows a string containing the
00375                          * color value. */
00376                         (fp->line_number)++;
00377                         fscanf (fp->fp, "%d\n", &attdef->color);
00378                 }
00379                 else if (strcmp (temp_string, "67") == 0)
00380                 {
00381                         /* Now follows a string containing the
00382                          * paperspace value. */
00383                         (fp->line_number)++;
00384                         fscanf (fp->fp, "%d\n", &attdef->paperspace);
00385                 }
00386                 else if (strcmp (temp_string, "70") == 0)
00387                 {
00388                         /* Now follows a string containing the
00389                          * attribute flags value. */
00390                         (fp->line_number)++;
00391                         fscanf (fp->fp, "%d\n", &attdef->attr_flags);
00392                 }
00393                 else if (strcmp (temp_string, "71") == 0)
00394                 {
00395                         /* Now follows a string containing the
00396                          * text flags value. */
00397                         (fp->line_number)++;
00398                         fscanf (fp->fp, "%d\n", &attdef->text_flags);
00399                 }
00400                 else if (strcmp (temp_string, "72") == 0)
00401                 {
00402                         /* Now follows a string containing the
00403                          * horizontal alignment value. */
00404                         (fp->line_number)++;
00405                         fscanf (fp->fp, "%d\n", &attdef->hor_align);
00406                 }
00407                 else if (strcmp (temp_string, "73") == 0)
00408                 {
00409                         /* Now follows a string containing the
00410                          * field length value. */
00411                         (fp->line_number)++;
00412                         fscanf (fp->fp, "%d\n", &attdef->field_length);
00413                 }
00414                 else if (strcmp (temp_string, "74") == 0)
00415                 {
00416                         /* Now follows a string containing the
00417                          * vertical alignment value. */
00418                         (fp->line_number)++;
00419                         fscanf (fp->fp, "%d\n", &attdef->vert_align);
00420                 }
00421                 else if ((fp->acad_version_number >= AutoCAD_13)
00422                         && (strcmp (temp_string, "100") == 0))
00423                 {
00424                         /* Subclass markers are post AutoCAD R12
00425                          * variable so additional testing for the
00426                          * version should probably be added here.
00427                          * Now follows a string containing the
00428                          * subclass marker value. */
00429                         (fp->line_number)++;
00430                         fscanf (fp->fp, "%s\n", temp_string);
00431                         if ((strcmp (temp_string, "AcDbEntity") != 0)
00432                         && (strcmp (temp_string, "AcDbText") != 0)
00433                         && (strcmp (temp_string, "AcDbAttributeDefinition") != 0))
00434                         {
00435                                 fprintf (stderr,
00436                                   (_("Warning in %s () found a bad subclass marker in: %s in line: %d.\n")),
00437                                   __FUNCTION__, fp->filename, fp->line_number);
00438                         }
00439                 }
00440                 else if (strcmp (temp_string, "210") == 0)
00441                 {
00442                         /* Now follows a string containing the
00443                          * X-value of the extrusion vector. */
00444                         (fp->line_number)++;
00445                         fscanf (fp->fp, "%lf\n", &attdef->extr_x0);
00446                 }
00447                 else if (strcmp (temp_string, "220") == 0)
00448                 {
00449                         /* Now follows a string containing the
00450                          * Y-value of the extrusion vector. */
00451                         (fp->line_number)++;
00452                         fscanf (fp->fp, "%lf\n", &attdef->extr_y0);
00453                 }
00454                 else if (strcmp (temp_string, "230") == 0)
00455                 {
00456                         /* Now follows a string containing the
00457                          * Z-value of the extrusion vector. */
00458                         (fp->line_number)++;
00459                         fscanf (fp->fp, "%lf\n", &attdef->extr_z0);
00460                 }
00461                 else if (strcmp (temp_string, "330") == 0)
00462                 {
00463                         /* Now follows a string containing Soft-pointer
00464                          * ID/handle to owner dictionary. */
00465                         (fp->line_number)++;
00466                         fscanf (fp->fp, "%s\n", attdef->dictionary_owner_soft);
00467                 }
00468                 else if (strcmp (temp_string, "360") == 0)
00469                 {
00470                         /* Now follows a string containing Hard owner
00471                          * ID/handle to owner dictionary. */
00472                         (fp->line_number)++;
00473                         fscanf (fp->fp, "%s\n", attdef->dictionary_owner_hard);
00474                 }
00475                 else if (strcmp (temp_string, "999") == 0)
00476                 {
00477                         /* Now follows a string containing a comment. */
00478                         (fp->line_number)++;
00479                         fscanf (fp->fp, "%s\n", temp_string);
00480                         fprintf (stdout, "DXF comment: %s\n", temp_string);
00481                 }
00482                 else
00483                 {
00484                         fprintf (stderr,
00485                           (_("Warning in %s () unknown string tag found while reading from: %s in line: %d.\n")),
00486                           __FUNCTION__, fp->filename, fp->line_number);
00487                 }
00488         }
00489         /* Handle omitted members and/or illegal values. */
00490         if (strcmp (dxf_attdef_get_linetype (attdef), "") == 0)
00491         {
00492                 dxf_attdef_set_linetype (attdef, strdup (DXF_DEFAULT_LINETYPE));
00493         }
00494         if (strcmp (dxf_attdef_get_layer (attdef), "") == 0)
00495         {
00496                 dxf_attdef_set_layer (attdef, strdup (DXF_DEFAULT_LAYER));
00497         }
00498         /* Clean up. */
00499         free (temp_string);
00500 #if DEBUG
00501         DXF_DEBUG_END
00502 #endif
00503         return (attdef);
00504 }
00505 
00506 
00510 int
00511 dxf_attdef_write
00512 (
00513         DxfFile *fp,
00515         DxfAttdef *attdef
00517 )
00518 {
00519 #if DEBUG
00520         DXF_DEBUG_BEGIN
00521 #endif
00522         char *dxf_entity_name = strdup ("ATTDEF");
00523 
00524         /* Do some basic checks. */
00525         if (fp == NULL)
00526         {
00527                 fprintf (stderr,
00528                   (_("Error in %s () a NULL file pointer was passed.\n")),
00529                   __FUNCTION__);
00530                 /* Clean up. */
00531                 free (dxf_entity_name);
00532                 return (EXIT_FAILURE);
00533         }
00534         if (attdef == NULL)
00535         {
00536                 fprintf (stderr,
00537                   (_("Error in %s () a NULL pointer was passed.\n")),
00538                   __FUNCTION__);
00539                 /* Clean up. */
00540                 free (dxf_entity_name);
00541                 return (EXIT_FAILURE);
00542         }
00543         if (strcmp (dxf_attdef_get_tag_value (attdef), "") == 0)
00544         {
00545                 fprintf (stderr,
00546                   (_("Error in %s () default tag value string is empty for the %s entity with id-code: %x.\n")),
00547                   __FUNCTION__, dxf_entity_name, dxf_attdef_get_id_code (attdef));
00548                 /* Clean up. */
00549                 free (dxf_entity_name);
00550                 return (EXIT_FAILURE);
00551         }
00552         if (strcmp (dxf_attdef_get_text_style (attdef), "") == 0)
00553         {
00554                 fprintf (stderr,
00555                   (_("Warning in %s () text style string is empty for the %s entity with id-code: %x.\n")),
00556                   __FUNCTION__, dxf_entity_name, dxf_attdef_get_id_code (attdef));
00557                 fprintf (stderr,
00558                   (_("\tdefault text style STANDARD applied to %s entity.\n")),
00559                   dxf_entity_name);
00560                 dxf_attdef_set_text_style (attdef, strdup (DXF_DEFAULT_TEXTSTYLE));
00561         }
00562         if (strcmp (dxf_attdef_get_linetype (attdef), "") == 0)
00563         {
00564                 fprintf (stderr,
00565                   (_("Warning in %s () empty linetype string for the %s entity with id-code: %x\n")),
00566                   __FUNCTION__, dxf_entity_name, dxf_attdef_get_id_code (attdef));
00567                 fprintf (stderr,
00568                   (_("\t%s entity is reset to default linetype")),
00569                   dxf_entity_name);
00570                 dxf_attdef_set_linetype (attdef, strdup (DXF_DEFAULT_LINETYPE));
00571         }
00572         if (strcmp (dxf_attdef_get_layer (attdef), "") == 0)
00573         {
00574                 fprintf (stderr,
00575                   (_("Warning in %s () empty layer string for the %s entity with id-code: %x\n")),
00576                   __FUNCTION__, dxf_entity_name, dxf_attdef_get_id_code (attdef));
00577                 fprintf (stderr,
00578                   (_("\t%s entity is relocated to layer 0")),
00579                   dxf_entity_name);
00580                 dxf_attdef_set_layer (attdef, strdup (DXF_DEFAULT_LAYER));
00581         }
00582         if (dxf_attdef_get_height (attdef) == 0.0)
00583         {
00584                 fprintf (stderr,
00585                   (_("Warning in %s () height has a value of 0.0 for the %s entity with id-code: %x.\n")),
00586                   __FUNCTION__, dxf_entity_name, dxf_attdef_get_id_code (attdef));
00587                 fprintf (stderr,
00588                   (_("\tdefault height of 1.0 applied to %s entity.\n")),
00589                   dxf_entity_name);
00590                 dxf_attdef_set_height (attdef, 1.0);
00591         }
00592         if (dxf_attdef_get_rel_x_scale (attdef) == 0.0)
00593         {
00594                 fprintf (stderr,
00595                   (_("Warning in %s () relative X-scale factor has a value of 0.0 for the %s entity with id-code: %x.\n")),
00596                   __FUNCTION__, dxf_entity_name, dxf_attdef_get_id_code (attdef));
00597                 fprintf (stderr,
00598                   (_("\tdefault relative X-scale of 1.0 applied to %s entity.\n")),
00599                   dxf_entity_name);
00600                 dxf_attdef_set_rel_x_scale (attdef, 1.0);
00601         }
00602         /* Start writing output. */
00603         fprintf (fp->fp, "  0\n%s\n", dxf_entity_name);
00604         if (dxf_attdef_get_id_code (attdef) != -1)
00605         {
00606                 fprintf (fp->fp, "  5\n%x\n", dxf_attdef_get_id_code (attdef));
00607         }
00618         if ((strcmp (dxf_attdef_get_dictionary_owner_soft (attdef), "") != 0)
00619           && (fp->acad_version_number >= AutoCAD_14))
00620         {
00621                 fprintf (fp->fp, "102\n{ACAD_REACTORS\n");
00622                 fprintf (fp->fp, "330\n%s\n", dxf_attdef_get_dictionary_owner_soft (attdef));
00623                 fprintf (fp->fp, "102\n}\n");
00624         }
00625         if ((strcmp (dxf_attdef_get_dictionary_owner_hard (attdef), "") != 0)
00626           && (fp->acad_version_number >= AutoCAD_14))
00627         {
00628                 fprintf (fp->fp, "102\n{ACAD_XDICTIONARY\n");
00629                 fprintf (fp->fp, "360\n%s\n", dxf_attdef_get_dictionary_owner_hard (attdef));
00630                 fprintf (fp->fp, "102\n}\n");
00631         }
00632         if (fp->acad_version_number >= AutoCAD_13)
00633         {
00634                 fprintf (fp->fp, "100\nAcDbEntity\n");
00635         }
00636         if (attdef->paperspace == DXF_PAPERSPACE)
00637         {
00638                 fprintf (fp->fp, " 67\n%d\n", DXF_PAPERSPACE);
00639         }
00640         fprintf (fp->fp, "  8\n%s\n", dxf_attdef_get_layer (attdef));
00641         if (strcmp (dxf_attdef_get_linetype (attdef), DXF_DEFAULT_LINETYPE) != 0)
00642         {
00643                 fprintf (fp->fp, "  6\n%s\n", dxf_attdef_get_linetype (attdef));
00644         }
00645         if (dxf_attdef_get_color (attdef) != DXF_COLOR_BYLAYER)
00646         {
00647                 fprintf (fp->fp, " 62\n%d\n", dxf_attdef_get_color (attdef));
00648         }
00649         if (dxf_attdef_get_linetype_scale (attdef) != 1.0)
00650         {
00651                 fprintf (fp->fp, " 48\n%f\n", dxf_attdef_get_linetype_scale (attdef));
00652         }
00653         if (dxf_attdef_get_visibility (attdef) != 0)
00654         {
00655                 fprintf (fp->fp, " 60\n%d\n", dxf_attdef_get_visibility (attdef));
00656         }
00657         if (fp->acad_version_number >= AutoCAD_13)
00658         {
00659                 fprintf (fp->fp, "100\nAcDbText\n");
00660         }
00661         if (dxf_attdef_get_thickness (attdef) != 0.0)
00662         {
00663                 fprintf (fp->fp, " 39\n%f\n", dxf_attdef_get_thickness (attdef));
00664         }
00665         fprintf (fp->fp, " 10\n%f\n", dxf_attdef_get_x0 (attdef));
00666         fprintf (fp->fp, " 20\n%f\n", dxf_attdef_get_y0 (attdef));
00667         fprintf (fp->fp, " 30\n%f\n", dxf_attdef_get_z0 (attdef));
00668         fprintf (fp->fp, " 40\n%f\n", dxf_attdef_get_height (attdef));
00669         fprintf (fp->fp, "  1\n%s\n", dxf_attdef_get_default_value (attdef));
00670         if (fp->acad_version_number >= AutoCAD_13)
00671         {
00672                 fprintf (fp->fp, "100\nAcDbAttributeDefinition\n");
00673         }
00674         fprintf (fp->fp, "  3\n%s\n", dxf_attdef_get_prompt_value (attdef));
00675         fprintf (fp->fp, "  2\n%s\n", dxf_attdef_get_tag_value (attdef));
00676         fprintf (fp->fp, " 70\n%d\n", dxf_attdef_get_attr_flags (attdef));
00677         if (dxf_attdef_get_field_length (attdef) != 0)
00678         {
00679                 fprintf (fp->fp, " 73\n%d\n", dxf_attdef_get_field_length (attdef));
00680         }
00681         if (dxf_attdef_get_rot_angle (attdef) != 0.0)
00682         {
00683                 fprintf (fp->fp, " 50\n%f\n", dxf_attdef_get_rot_angle (attdef));
00684         }
00685         if (dxf_attdef_get_rel_x_scale (attdef) != 1.0)
00686         {
00687                 fprintf (fp->fp, " 41\n%f\n", dxf_attdef_get_rel_x_scale (attdef));
00688         }
00689         if (dxf_attdef_get_obl_angle (attdef) != 0.0)
00690         {
00691                 fprintf (fp->fp, " 51\n%f\n", dxf_attdef_get_obl_angle (attdef));
00692         }
00693         if (strcmp (dxf_attdef_get_text_style (attdef), "STANDARD") != 0)
00694         {
00695                 fprintf (fp->fp, "  7\n%s\n", dxf_attdef_get_text_style (attdef));
00696         }
00697         if (dxf_attdef_get_text_flags (attdef) != 0)
00698         {
00699                 fprintf (fp->fp, " 71\n%d\n", dxf_attdef_get_text_flags (attdef));
00700         }
00701         if (dxf_attdef_get_hor_align (attdef) != 0)
00702         {
00703                 fprintf (fp->fp, " 72\n%d\n", dxf_attdef_get_hor_align (attdef));
00704         }
00705         if (dxf_attdef_get_vert_align (attdef) != 0)
00706         {
00707                 fprintf (fp->fp, " 74\n%d\n", dxf_attdef_get_vert_align (attdef));
00708         }
00709         if ((dxf_attdef_get_hor_align (attdef) != 0) || (dxf_attdef_get_vert_align (attdef) != 0))
00710         {
00711                 if ((dxf_attdef_get_x0 (attdef) == dxf_attdef_get_x1 (attdef))
00712                         && (dxf_attdef_get_y0 (attdef) == dxf_attdef_get_y1 (attdef))
00713                         && (dxf_attdef_get_z0 (attdef) == dxf_attdef_get_z1 (attdef)))
00714                 {
00715                         fprintf (stderr,
00716                           (_("Warning in %s () insertion point and alignment point are identical for the %s entity with id-code: %x.\n")),
00717                           __FUNCTION__, dxf_entity_name, dxf_attdef_get_id_code (attdef));
00718                         fprintf (stderr,
00719                           (_("\tdefault justification applied to %s entity.\n")),
00720                           dxf_entity_name);
00721                         dxf_attdef_set_hor_align (attdef, 0);
00722                         dxf_attdef_set_vert_align (attdef, 0);
00723                 }
00724                 else
00725                 {
00726                         fprintf (fp->fp, " 11\n%f\n", dxf_attdef_get_x1 (attdef));
00727                         fprintf (fp->fp, " 21\n%f\n", dxf_attdef_get_y1 (attdef));
00728                         fprintf (fp->fp, " 31\n%f\n", dxf_attdef_get_z1 (attdef));
00729                 }
00730         }
00731         if (fp->acad_version_number >= AutoCAD_12)
00732         {
00733                 fprintf (fp->fp, "210\n%f\n", dxf_attdef_get_extr_x0 (attdef));
00734                 fprintf (fp->fp, "220\n%f\n", dxf_attdef_get_extr_y0 (attdef));
00735                 fprintf (fp->fp, "230\n%f\n", dxf_attdef_get_extr_z0 (attdef));
00736         }
00737         /* Clean up. */
00738         free (dxf_entity_name);
00739 #if DEBUG
00740         DXF_DEBUG_END
00741 #endif
00742         return (EXIT_SUCCESS);
00743 }
00744 
00745 
00753 int
00754 dxf_attdef_free
00755 (
00756         DxfAttdef *attdef
00758 )
00759 {
00760 #if DEBUG
00761         DXF_DEBUG_BEGIN
00762 #endif
00763         if (attdef == NULL)
00764         {
00765                 fprintf (stderr,
00766                   (_("Error in %s () a NULL pointer was passed.\n")),
00767                   __FUNCTION__);
00768                 return (EXIT_FAILURE);
00769         }
00770         if (attdef->next != NULL)
00771         {
00772               fprintf (stderr,
00773                 (_("Error in %s () pointer to next was not NULL.\n")),
00774                 __FUNCTION__);
00775               return (EXIT_FAILURE);
00776         }
00777         free (attdef->linetype);
00778         free (attdef->layer);
00779         free (attdef->default_value);
00780         free (attdef->tag_value);
00781         free (attdef->prompt_value);
00782         free (attdef->text_style);
00783         free (attdef->dictionary_owner_soft);
00784         free (attdef->dictionary_owner_hard);
00785         free (attdef);
00786         attdef = NULL;
00787 #if DEBUG
00788         DXF_DEBUG_END
00789 #endif
00790         return (EXIT_SUCCESS);
00791 }
00792 
00793 
00798 void
00799 dxf_attdef_free_chain
00800 (
00801         DxfAttdef *attdefs
00803 )
00804 {
00805 #ifdef DEBUG
00806         DXF_DEBUG_BEGIN
00807 #endif
00808         if (attdefs == NULL)
00809         {
00810                 fprintf (stderr,
00811                   (_("Warning in %s () a NULL pointer was passed.\n")),
00812                   __FUNCTION__);
00813         }
00814         while (attdefs != NULL)
00815         {
00816                 struct DxfAttdef *iter = attdefs->next;
00817                 dxf_attdef_free (attdefs);
00818                 attdefs = (DxfAttdef *) iter;
00819         }
00820 #if DEBUG
00821         DXF_DEBUG_END
00822 #endif
00823 }
00824 
00825 
00831 int
00832 dxf_attdef_get_id_code
00833 (
00834         DxfAttdef *attdef
00836 )
00837 {
00838 #if DEBUG
00839         DXF_DEBUG_BEGIN
00840 #endif
00841         /* Do some basic checks. */
00842         if (attdef == NULL)
00843         {
00844                 fprintf (stderr,
00845                   (_("Error in %s () a NULL pointer was passed.\n")),
00846                   __FUNCTION__);
00847                 return (EXIT_FAILURE);
00848         }
00849         if (attdef->id_code < 0)
00850         {
00851                 fprintf (stderr,
00852                   (_("Error in %s () a negative value was found.\n")),
00853                   __FUNCTION__);
00854                 return (EXIT_FAILURE);
00855         }
00856 #if DEBUG
00857         DXF_DEBUG_END
00858 #endif
00859         return (attdef->id_code);
00860 }
00861 
00862 
00866 DxfAttdef *
00867 dxf_attdef_set_id_code
00868 (
00869         DxfAttdef *attdef,
00871         int id_code
00875 )
00876 {
00877 #if DEBUG
00878         DXF_DEBUG_BEGIN
00879 #endif
00880         /* Do some basic checks. */
00881         if (attdef == NULL)
00882         {
00883                 fprintf (stderr,
00884                   (_("Error in %s () a NULL pointer was passed.\n")),
00885                   __FUNCTION__);
00886                 return (NULL);
00887         }
00888         if (id_code < 0)
00889         {
00890                 fprintf (stderr,
00891                   (_("Error in %s () a negative value was passed.\n")),
00892                   __FUNCTION__);
00893                 return (NULL);
00894         }
00895         attdef->id_code = id_code;
00896 #if DEBUG
00897         DXF_DEBUG_END
00898 #endif
00899         return (attdef);
00900 }
00901 
00902 
00908 char *
00909 dxf_attdef_get_linetype
00910 (
00911         DxfAttdef *attdef
00913 )
00914 {
00915 #if DEBUG
00916         DXF_DEBUG_BEGIN
00917 #endif
00918         /* Do some basic checks. */
00919         if (attdef == NULL)
00920         {
00921                 fprintf (stderr,
00922                   (_("Error in %s () a NULL pointer was passed.\n")),
00923                   __FUNCTION__);
00924                 return (NULL);
00925         }
00926         if (attdef->linetype ==  NULL)
00927         {
00928                 fprintf (stderr,
00929                   (_("Error in %s () a NULL pointer was found.\n")),
00930                   __FUNCTION__);
00931                 return (NULL);
00932         }
00933 #if DEBUG
00934         DXF_DEBUG_END
00935 #endif
00936         return (strdup (attdef->linetype));
00937 }
00938 
00939 
00943 DxfAttdef *
00944 dxf_attdef_set_linetype
00945 (
00946         DxfAttdef *attdef,
00948         char *linetype
00950 )
00951 {
00952 #if DEBUG
00953         DXF_DEBUG_BEGIN
00954 #endif
00955         /* Do some basic checks. */
00956         if (attdef == NULL)
00957         {
00958                 fprintf (stderr,
00959                   (_("Error in %s () a NULL pointer was passed.\n")),
00960                   __FUNCTION__);
00961                 return (NULL);
00962         }
00963         if (linetype == NULL)
00964         {
00965                 fprintf (stderr,
00966                   (_("Error in %s () a NULL pointer was passed.\n")),
00967                   __FUNCTION__);
00968                 return (NULL);
00969         }
00970         attdef->linetype = strdup (linetype);
00971 #if DEBUG
00972         DXF_DEBUG_END
00973 #endif
00974         return (attdef);
00975 }
00976 
00977 
00983 char *
00984 dxf_attdef_get_layer
00985 (
00986         DxfAttdef *attdef
00988 )
00989 {
00990 #if DEBUG
00991         DXF_DEBUG_BEGIN
00992 #endif
00993         /* Do some basic checks. */
00994         if (attdef == NULL)
00995         {
00996                 fprintf (stderr,
00997                   (_("Error in %s () a NULL pointer was passed.\n")),
00998                   __FUNCTION__);
00999                 return (NULL);
01000         }
01001         if (attdef->layer ==  NULL)
01002         {
01003                 fprintf (stderr,
01004                   (_("Error in %s () a NULL pointer was found.\n")),
01005                   __FUNCTION__);
01006                 return (NULL);
01007         }
01008 #if DEBUG
01009         DXF_DEBUG_END
01010 #endif
01011         return (strdup (attdef->layer));
01012 }
01013 
01014 
01018 DxfAttdef *
01019 dxf_attdef_set_layer
01020 (
01021         DxfAttdef *attdef,
01023         char *layer
01025 )
01026 {
01027 #if DEBUG
01028         DXF_DEBUG_BEGIN
01029 #endif
01030         /* Do some basic checks. */
01031         if (attdef == NULL)
01032         {
01033                 fprintf (stderr,
01034                   (_("Error in %s () a NULL pointer was passed.\n")),
01035                   __FUNCTION__);
01036                 return (NULL);
01037         }
01038         if (layer == NULL)
01039         {
01040                 fprintf (stderr,
01041                   (_("Error in %s () a NULL pointer was passed.\n")),
01042                   __FUNCTION__);
01043                 return (NULL);
01044         }
01045         attdef->layer = strdup (layer);
01046 #if DEBUG
01047         DXF_DEBUG_END
01048 #endif
01049         return (attdef);
01050 }
01051 
01052 
01058 double
01059 dxf_attdef_get_elevation
01060 (
01061         DxfAttdef *attdef
01063 )
01064 {
01065 #if DEBUG
01066         DXF_DEBUG_BEGIN
01067 #endif
01068         /* Do some basic checks. */
01069         if (attdef == NULL)
01070         {
01071                 fprintf (stderr,
01072                   (_("Error in %s () a NULL pointer was passed.\n")),
01073                   __FUNCTION__);
01074                 return (EXIT_FAILURE);
01075         }
01076 #if DEBUG
01077         DXF_DEBUG_END
01078 #endif
01079         return (attdef->elevation);
01080 }
01081 
01082 
01086 DxfAttdef *
01087 dxf_attdef_set_elevation
01088 (
01089         DxfAttdef *attdef,
01091         double elevation
01093 )
01094 {
01095 #if DEBUG
01096         DXF_DEBUG_BEGIN
01097 #endif
01098         /* Do some basic checks. */
01099         if (attdef == NULL)
01100         {
01101                 fprintf (stderr,
01102                   (_("Error in %s () a NULL pointer was passed.\n")),
01103                   __FUNCTION__);
01104                 return (NULL);
01105         }
01106         attdef->elevation = elevation;
01107 #if DEBUG
01108         DXF_DEBUG_END
01109 #endif
01110         return (attdef);
01111 }
01112 
01113 
01119 double
01120 dxf_attdef_get_thickness
01121 (
01122         DxfAttdef *attdef
01124 )
01125 {
01126 #if DEBUG
01127         DXF_DEBUG_BEGIN
01128 #endif
01129         /* Do some basic checks. */
01130         if (attdef == NULL)
01131         {
01132                 fprintf (stderr,
01133                   (_("Error in %s () a NULL pointer was passed.\n")),
01134                   __FUNCTION__);
01135                 return (EXIT_FAILURE);
01136         }
01137         if (attdef->thickness < 0.0)
01138         {
01139                 fprintf (stderr,
01140                   (_("Error in %s () a negative value was found.\n")),
01141                   __FUNCTION__);
01142                 return (EXIT_FAILURE);
01143         }
01144 #if DEBUG
01145         DXF_DEBUG_END
01146 #endif
01147         return (attdef->thickness);
01148 }
01149 
01150 
01154 DxfAttdef *
01155 dxf_attdef_set_thickness
01156 (
01157         DxfAttdef *attdef,
01159         double thickness
01161 )
01162 {
01163 #if DEBUG
01164         DXF_DEBUG_BEGIN
01165 #endif
01166         /* Do some basic checks. */
01167         if (attdef == NULL)
01168         {
01169                 fprintf (stderr,
01170                   (_("Error in %s () a NULL pointer was passed.\n")),
01171                   __FUNCTION__);
01172                 return (NULL);
01173         }
01174         if (thickness < 0.0)
01175         {
01176                 fprintf (stderr,
01177                   (_("Error in %s () a negative value was passed.\n")),
01178                   __FUNCTION__);
01179                 return (NULL);
01180         }
01181         attdef->thickness = thickness;
01182 #if DEBUG
01183         DXF_DEBUG_END
01184 #endif
01185         return (attdef);
01186 }
01187 
01188 
01194 double
01195 dxf_attdef_get_linetype_scale
01196 (
01197         DxfAttdef *attdef
01199 )
01200 {
01201 #if DEBUG
01202         DXF_DEBUG_BEGIN
01203 #endif
01204         /* Do some basic checks. */
01205         if (attdef == NULL)
01206         {
01207                 fprintf (stderr,
01208                   (_("Error in %s () a NULL pointer was passed.\n")),
01209                   __FUNCTION__);
01210                 return (EXIT_FAILURE);
01211         }
01212         if (attdef->linetype_scale < 0.0)
01213         {
01214                 fprintf (stderr,
01215                   (_("Error in %s () a negative value was found.\n")),
01216                   __FUNCTION__);
01217                 return (EXIT_FAILURE);
01218         }
01219 #if DEBUG
01220         DXF_DEBUG_END
01221 #endif
01222         return (attdef->linetype_scale);
01223 }
01224 
01225 
01229 DxfAttdef *
01230 dxf_attdef_set_linetype_scale
01231 (
01232         DxfAttdef *attdef,
01234         double linetype_scale
01236 )
01237 {
01238 #if DEBUG
01239         DXF_DEBUG_BEGIN
01240 #endif
01241         /* Do some basic checks. */
01242         if (attdef == NULL)
01243         {
01244                 fprintf (stderr,
01245                   (_("Error in %s () a NULL pointer was passed.\n")),
01246                   __FUNCTION__);
01247                 return (NULL);
01248         }
01249         if (linetype_scale < 0.0)
01250         {
01251                 fprintf (stderr,
01252                   (_("Error in %s () a negative value was passed.\n")),
01253                   __FUNCTION__);
01254                 return (NULL);
01255         }
01256         attdef->linetype_scale = linetype_scale;
01257 #if DEBUG
01258         DXF_DEBUG_END
01259 #endif
01260         return (attdef);
01261 }
01262 
01263 
01269 int16_t
01270 dxf_attdef_get_visibility
01271 (
01272         DxfAttdef *attdef
01274 )
01275 {
01276 #if DEBUG
01277         DXF_DEBUG_BEGIN
01278 #endif
01279         /* Do some basic checks. */
01280         if (attdef == NULL)
01281         {
01282                 fprintf (stderr,
01283                   (_("Error in %s () a NULL pointer was passed.\n")),
01284                   __FUNCTION__);
01285                 return (EXIT_FAILURE);
01286         }
01287         if (attdef->visibility < 0)
01288         {
01289                 fprintf (stderr,
01290                   (_("Error in %s () a negative value was found.\n")),
01291                   __FUNCTION__);
01292                 return (EXIT_FAILURE);
01293         }
01294         if (attdef->visibility > 1)
01295         {
01296                 fprintf (stderr,
01297                   (_("Error in %s () an out of range value was found.\n")),
01298                   __FUNCTION__);
01299                 return (EXIT_FAILURE);
01300         }
01301 #if DEBUG
01302         DXF_DEBUG_END
01303 #endif
01304         return (attdef->visibility);
01305 }
01306 
01307 
01311 DxfAttdef *
01312 dxf_attdef_set_visibility
01313 (
01314         DxfAttdef *attdef,
01316         int16_t visibility
01318 )
01319 {
01320 #if DEBUG
01321         DXF_DEBUG_BEGIN
01322 #endif
01323         /* Do some basic checks. */
01324         if (attdef == NULL)
01325         {
01326                 fprintf (stderr,
01327                   (_("Error in %s () a NULL pointer was passed.\n")),
01328                   __FUNCTION__);
01329                 return (NULL);
01330         }
01331         if (visibility < 0)
01332         {
01333                 fprintf (stderr,
01334                   (_("Error in %s () a negative value was passed.\n")),
01335                   __FUNCTION__);
01336                 return (NULL);
01337         }
01338         if (visibility > 1)
01339         {
01340                 fprintf (stderr,
01341                   (_("Error in %s () an out of range value was passed.\n")),
01342                   __FUNCTION__);
01343                 return (NULL);
01344         }
01345         attdef->visibility = visibility;
01346 #if DEBUG
01347         DXF_DEBUG_END
01348 #endif
01349         return (attdef);
01350 }
01351 
01352 
01358 int
01359 dxf_attdef_get_color
01360 (
01361         DxfAttdef *attdef
01363 )
01364 {
01365 #if DEBUG
01366         DXF_DEBUG_BEGIN
01367 #endif
01368         /* Do some basic checks. */
01369         if (attdef == NULL)
01370         {
01371                 fprintf (stderr,
01372                   (_("Error in %s () a NULL pointer was passed.\n")),
01373                   __FUNCTION__);
01374                 return (EXIT_FAILURE);
01375         }
01376         if (attdef->color < 0)
01377         {
01378                 fprintf (stderr,
01379                   (_("Warning in %s () a negative value was found.\n")),
01380                   __FUNCTION__);
01381         }
01382 #if DEBUG
01383         DXF_DEBUG_END
01384 #endif
01385         return (attdef->color);
01386 }
01387 
01388 
01392 DxfAttdef *
01393 dxf_attdef_set_color
01394 (
01395         DxfAttdef *attdef,
01397         int color
01399 )
01400 {
01401 #if DEBUG
01402         DXF_DEBUG_BEGIN
01403 #endif
01404         /* Do some basic checks. */
01405         if (attdef == NULL)
01406         {
01407                 fprintf (stderr,
01408                   (_("Error in %s () a NULL pointer was passed.\n")),
01409                   __FUNCTION__);
01410                 return (NULL);
01411         }
01412         if (color < 0)
01413         {
01414                 fprintf (stderr,
01415                   (_("Warning in %s () a negative value was passed.\n")),
01416                   __FUNCTION__);
01417         }
01418         attdef->color = color;
01419 #if DEBUG
01420         DXF_DEBUG_END
01421 #endif
01422         return (attdef);
01423 }
01424 
01425 
01431 int
01432 dxf_attdef_get_paperspace
01433 (
01434         DxfAttdef *attdef
01436 )
01437 {
01438 #if DEBUG
01439         DXF_DEBUG_BEGIN
01440 #endif
01441         /* Do some basic checks. */
01442         if (attdef == NULL)
01443         {
01444                 fprintf (stderr,
01445                   (_("Error in %s () a NULL pointer was passed.\n")),
01446                   __FUNCTION__);
01447                 return (EXIT_FAILURE);
01448         }
01449         if (attdef->paperspace < 0)
01450         {
01451                 fprintf (stderr,
01452                   (_("Warning in %s () a negative value was found.\n")),
01453                   __FUNCTION__);
01454         }
01455         if (attdef->paperspace > 1)
01456         {
01457                 fprintf (stderr,
01458                   (_("Warning in %s () an out of range value was found.\n")),
01459                   __FUNCTION__);
01460         }
01461 #if DEBUG
01462         DXF_DEBUG_END
01463 #endif
01464         return (attdef->paperspace);
01465 }
01466 
01467 
01471 DxfAttdef *
01472 dxf_attdef_set_paperspace
01473 (
01474         DxfAttdef *attdef,
01476         int paperspace
01478 )
01479 {
01480 #if DEBUG
01481         DXF_DEBUG_BEGIN
01482 #endif
01483         /* Do some basic checks. */
01484         if (attdef == NULL)
01485         {
01486                 fprintf (stderr,
01487                   (_("Error in %s () a NULL pointer was passed.\n")),
01488                   __FUNCTION__);
01489                 return (NULL);
01490         }
01491         if (paperspace < 0)
01492         {
01493                 fprintf (stderr,
01494                   (_("Error in %s () a negative value was passed.\n")),
01495                   __FUNCTION__);
01496                 return (NULL);
01497         }
01498         if (paperspace > 1)
01499         {
01500                 fprintf (stderr,
01501                   (_("Error in %s () an out of range value was passed.\n")),
01502                   __FUNCTION__);
01503                 return (NULL);
01504         }
01505         attdef->paperspace = paperspace;
01506 #if DEBUG
01507         DXF_DEBUG_END
01508 #endif
01509         return (attdef);
01510 }
01511 
01512 
01520 int
01521 dxf_attdef_get_graphics_data_size
01522 (
01523         DxfAttdef *attdef
01525 )
01526 {
01527 #if DEBUG
01528         DXF_DEBUG_BEGIN
01529 #endif
01530         /* Do some basic checks. */
01531         if (attdef == NULL)
01532         {
01533                 fprintf (stderr,
01534                   (_("Error in %s () a NULL pointer was passed.\n")),
01535                   __FUNCTION__);
01536                 return (EXIT_FAILURE);
01537         }
01538         if (attdef->graphics_data_size < 0)
01539         {
01540                 fprintf (stderr,
01541                   (_("Warning in %s () a negative value was found.\n")),
01542                   __FUNCTION__);
01543         }
01544         if (attdef->graphics_data_size == 0)
01545         {
01546                 fprintf (stderr,
01547                   (_("Warning in %s () a zero value was found.\n")),
01548                   __FUNCTION__);
01549         }
01550 #if DEBUG
01551         DXF_DEBUG_END
01552 #endif
01553         return (attdef->graphics_data_size);
01554 }
01555 
01556 
01564 DxfAttdef *
01565 dxf_attdef_set_graphics_data_size
01566 (
01567         DxfAttdef *attdef,
01569         int graphics_data_size
01572 )
01573 {
01574 #if DEBUG
01575         DXF_DEBUG_BEGIN
01576 #endif
01577         /* Do some basic checks. */
01578         if (attdef == NULL)
01579         {
01580                 fprintf (stderr,
01581                   (_("Error in %s () a NULL pointer was passed.\n")),
01582                   __FUNCTION__);
01583                 return (NULL);
01584         }
01585         if (graphics_data_size < 0)
01586         {
01587                 fprintf (stderr,
01588                   (_("Error in %s () a negative value was passed.\n")),
01589                   __FUNCTION__);
01590                 return (NULL);
01591         }
01592         if (graphics_data_size == 0)
01593         {
01594                 fprintf (stderr,
01595                   (_("Warning in %s () a value was passed.\n")),
01596                   __FUNCTION__);
01597         }
01598         attdef->graphics_data_size = graphics_data_size;
01599 #if DEBUG
01600         DXF_DEBUG_END
01601 #endif
01602         return (attdef);
01603 }
01604 
01605 
01612 int16_t
01613 dxf_attdef_get_shadow_mode
01614 (
01615         DxfAttdef *attdef
01617 )
01618 {
01619 #if DEBUG
01620         DXF_DEBUG_BEGIN
01621 #endif
01622         /* Do some basic checks. */
01623         if (attdef == NULL)
01624         {
01625                 fprintf (stderr,
01626                   (_("Error in %s () a NULL pointer was passed.\n")),
01627                   __FUNCTION__);
01628                 return (EXIT_FAILURE);
01629         }
01630         if (attdef->shadow_mode < 0)
01631         {
01632                 fprintf (stderr,
01633                   (_("Error in %s () a negative value was found.\n")),
01634                   __FUNCTION__);
01635                 return (EXIT_FAILURE);
01636         }
01637         if (attdef->shadow_mode > 3)
01638         {
01639                 fprintf (stderr,
01640                   (_("Error in %s () an out of range value was found.\n")),
01641                   __FUNCTION__);
01642                 return (EXIT_FAILURE);
01643         }
01644 #if DEBUG
01645         DXF_DEBUG_END
01646 #endif
01647         return (attdef->shadow_mode);
01648 }
01649 
01650 
01657 DxfAttdef *
01658 dxf_attdef_set_shadow_mode
01659 (
01660         DxfAttdef *attdef,
01662         int16_t shadow_mode
01664 )
01665 {
01666 #if DEBUG
01667         DXF_DEBUG_BEGIN
01668 #endif
01669         /* Do some basic checks. */
01670         if (attdef == NULL)
01671         {
01672                 fprintf (stderr,
01673                   (_("Error in %s () a NULL pointer was passed.\n")),
01674                   __FUNCTION__);
01675                 return (NULL);
01676         }
01677         if (shadow_mode < 0)
01678         {
01679                 fprintf (stderr,
01680                   (_("Error in %s () a negative value was passed.\n")),
01681                   __FUNCTION__);
01682                 return (NULL);
01683         }
01684         if (shadow_mode > 3)
01685         {
01686                 fprintf (stderr,
01687                   (_("Error in %s () an out of range value was passed.\n")),
01688                   __FUNCTION__);
01689                 return (NULL);
01690         }
01691         attdef->shadow_mode = shadow_mode;
01692 #if DEBUG
01693         DXF_DEBUG_END
01694 #endif
01695         return (attdef);
01696 }
01697 
01698 
01707 DxfBinaryGraphicsData *
01708 dxf_attdef_get_binary_graphics_data
01709 (
01710         DxfAttdef *attdef
01712 )
01713 {
01714 #if DEBUG
01715         DXF_DEBUG_BEGIN
01716 #endif
01717         /* Do some basic checks. */
01718         if (attdef == NULL)
01719         {
01720                 fprintf (stderr,
01721                   (_("Error in %s () a NULL pointer was passed.\n")),
01722                   __FUNCTION__);
01723                 return (NULL);
01724         }
01725         if (attdef->binary_graphics_data ==  NULL)
01726         {
01727                 fprintf (stderr,
01728                   (_("Error in %s () a NULL pointer was found.\n")),
01729                   __FUNCTION__);
01730                 return (NULL);
01731         }
01732 #if DEBUG
01733         DXF_DEBUG_END
01734 #endif
01735         return ((DxfBinaryGraphicsData *) attdef->binary_graphics_data);
01736 }
01737 
01738 
01743 DxfAttdef *
01744 dxf_attdef_set_binary_graphics_data
01745 (
01746         DxfAttdef *attdef,
01748         DxfBinaryGraphicsData *data
01751 )
01752 {
01753 #if DEBUG
01754         DXF_DEBUG_BEGIN
01755 #endif
01756         /* Do some basic checks. */
01757         if (attdef == NULL)
01758         {
01759                 fprintf (stderr,
01760                   (_("Error in %s () a NULL pointer was passed.\n")),
01761                   __FUNCTION__);
01762                 return (NULL);
01763         }
01764         if (data == NULL)
01765         {
01766                 fprintf (stderr,
01767                   (_("Error in %s () a NULL pointer was passed.\n")),
01768                   __FUNCTION__);
01769                 return (NULL);
01770         }
01771         attdef->binary_graphics_data = (DxfBinaryGraphicsData *) data;
01772 #if DEBUG
01773         DXF_DEBUG_END
01774 #endif
01775         return (attdef);
01776 }
01777 
01778 
01787 char *
01788 dxf_attdef_get_dictionary_owner_soft
01789 (
01790         DxfAttdef *attdef
01792 )
01793 {
01794 #if DEBUG
01795         DXF_DEBUG_BEGIN
01796 #endif
01797         /* Do some basic checks. */
01798         if (attdef == NULL)
01799         {
01800                 fprintf (stderr,
01801                   (_("Error in %s () a NULL pointer was passed.\n")),
01802                   __FUNCTION__);
01803                 return (NULL);
01804         }
01805         if (attdef->dictionary_owner_soft ==  NULL)
01806         {
01807                 fprintf (stderr,
01808                   (_("Error in %s () a NULL pointer was found.\n")),
01809                   __FUNCTION__);
01810                 return (NULL);
01811         }
01812 #if DEBUG
01813         DXF_DEBUG_END
01814 #endif
01815         return (strdup (attdef->dictionary_owner_soft));
01816 }
01817 
01818 
01823 DxfAttdef *
01824 dxf_attdef_set_dictionary_owner_soft
01825 (
01826         DxfAttdef *attdef,
01828         char *dictionary_owner_soft
01831 )
01832 {
01833 #if DEBUG
01834         DXF_DEBUG_BEGIN
01835 #endif
01836         /* Do some basic checks. */
01837         if (attdef == NULL)
01838         {
01839                 fprintf (stderr,
01840                   (_("Error in %s () a NULL pointer was passed.\n")),
01841                   __FUNCTION__);
01842                 return (NULL);
01843         }
01844         if (dictionary_owner_soft == NULL)
01845         {
01846                 fprintf (stderr,
01847                   (_("Error in %s () a NULL pointer was passed.\n")),
01848                   __FUNCTION__);
01849                 return (NULL);
01850         }
01851         attdef->dictionary_owner_soft = strdup (dictionary_owner_soft);
01852 #if DEBUG
01853         DXF_DEBUG_END
01854 #endif
01855         return (attdef);
01856 }
01857 
01858 
01867 char *
01868 dxf_attdef_get_material
01869 (
01870         DxfAttdef *attdef
01872 )
01873 {
01874 #if DEBUG
01875         DXF_DEBUG_BEGIN
01876 #endif
01877         /* Do some basic checks. */
01878         if (attdef == NULL)
01879         {
01880                 fprintf (stderr,
01881                   (_("Error in %s () a NULL pointer was passed.\n")),
01882                   __FUNCTION__);
01883                 return (NULL);
01884         }
01885         if (attdef->material ==  NULL)
01886         {
01887                 fprintf (stderr,
01888                   (_("Error in %s () a NULL pointer was found.\n")),
01889                   __FUNCTION__);
01890                 return (NULL);
01891         }
01892 #if DEBUG
01893         DXF_DEBUG_END
01894 #endif
01895         return (strdup (attdef->material));
01896 }
01897 
01898 
01905 DxfAttdef *
01906 dxf_attdef_set_material
01907 (
01908         DxfAttdef *attdef,
01910         char *material
01913 )
01914 {
01915 #if DEBUG
01916         DXF_DEBUG_BEGIN
01917 #endif
01918         /* Do some basic checks. */
01919         if (attdef == NULL)
01920         {
01921                 fprintf (stderr,
01922                   (_("Error in %s () a NULL pointer was passed.\n")),
01923                   __FUNCTION__);
01924                 return (NULL);
01925         }
01926         if (material == NULL)
01927         {
01928                 fprintf (stderr,
01929                   (_("Error in %s () a NULL pointer was passed.\n")),
01930                   __FUNCTION__);
01931                 return (NULL);
01932         }
01933         attdef->material = strdup (material);
01934 #if DEBUG
01935         DXF_DEBUG_END
01936 #endif
01937         return (attdef);
01938 }
01939 
01940 
01949 char *
01950 dxf_attdef_get_dictionary_owner_hard
01951 (
01952         DxfAttdef *attdef
01954 )
01955 {
01956 #if DEBUG
01957         DXF_DEBUG_BEGIN
01958 #endif
01959         /* Do some basic checks. */
01960         if (attdef == NULL)
01961         {
01962                 fprintf (stderr,
01963                   (_("Error in %s () a NULL pointer was passed.\n")),
01964                   __FUNCTION__);
01965                 return (NULL);
01966         }
01967         if (attdef->dictionary_owner_hard ==  NULL)
01968         {
01969                 fprintf (stderr,
01970                   (_("Error in %s () a NULL pointer was found.\n")),
01971                   __FUNCTION__);
01972                 return (NULL);
01973         }
01974 #if DEBUG
01975         DXF_DEBUG_END
01976 #endif
01977         return (strdup (attdef->dictionary_owner_hard));
01978 }
01979 
01980 
01985 DxfAttdef *
01986 dxf_attdef_set_dictionary_owner_hard
01987 (
01988         DxfAttdef *attdef,
01990         char *dictionary_owner_hard
01993 )
01994 {
01995 #if DEBUG
01996         DXF_DEBUG_BEGIN
01997 #endif
01998         /* Do some basic checks. */
01999         if (attdef == NULL)
02000         {
02001                 fprintf (stderr,
02002                   (_("Error in %s () a NULL pointer was passed.\n")),
02003                   __FUNCTION__);
02004                 return (NULL);
02005         }
02006         if (dictionary_owner_hard == NULL)
02007         {
02008                 fprintf (stderr,
02009                   (_("Error in %s () a NULL pointer was passed.\n")),
02010                   __FUNCTION__);
02011                 return (NULL);
02012         }
02013         attdef->dictionary_owner_hard = strdup (dictionary_owner_hard);
02014 #if DEBUG
02015         DXF_DEBUG_END
02016 #endif
02017         return (attdef);
02018 }
02019 
02020 
02027 int16_t
02028 dxf_attdef_get_lineweight
02029 (
02030         DxfAttdef *attdef
02032 )
02033 {
02034 #if DEBUG
02035         DXF_DEBUG_BEGIN
02036 #endif
02037         /* Do some basic checks. */
02038         if (attdef == NULL)
02039         {
02040                 fprintf (stderr,
02041                   (_("Error in %s () a NULL pointer was passed.\n")),
02042                   __FUNCTION__);
02043                 return (EXIT_FAILURE);
02044         }
02045 #if DEBUG
02046         DXF_DEBUG_END
02047 #endif
02048         return (attdef->lineweight);
02049 }
02050 
02051 
02058 DxfAttdef *
02059 dxf_attdef_set_lineweight
02060 (
02061         DxfAttdef *attdef,
02063         int16_t lineweight
02065 )
02066 {
02067 #if DEBUG
02068         DXF_DEBUG_BEGIN
02069 #endif
02070         /* Do some basic checks. */
02071         if (attdef == NULL)
02072         {
02073                 fprintf (stderr,
02074                   (_("Error in %s () a NULL pointer was passed.\n")),
02075                   __FUNCTION__);
02076                 return (NULL);
02077         }
02078         attdef->lineweight = lineweight;
02079 #if DEBUG
02080         DXF_DEBUG_END
02081 #endif
02082         return (attdef);
02083 }
02084 
02085 
02092 char *
02093 dxf_attdef_get_plot_style_name
02094 (
02095         DxfAttdef *attdef
02097 )
02098 {
02099 #if DEBUG
02100         DXF_DEBUG_BEGIN
02101 #endif
02102         /* Do some basic checks. */
02103         if (attdef == NULL)
02104         {
02105                 fprintf (stderr,
02106                   (_("Error in %s () a NULL pointer was passed.\n")),
02107                   __FUNCTION__);
02108                 return (NULL);
02109         }
02110         if (attdef->plot_style_name ==  NULL)
02111         {
02112                 fprintf (stderr,
02113                   (_("Error in %s () a NULL pointer was found.\n")),
02114                   __FUNCTION__);
02115                 return (NULL);
02116         }
02117 #if DEBUG
02118         DXF_DEBUG_END
02119 #endif
02120         return (strdup (attdef->plot_style_name));
02121 }
02122 
02123 
02130 DxfAttdef *
02131 dxf_attdef_set_plot_style_name
02132 (
02133         DxfAttdef *attdef,
02135         char *plot_style_name
02138 )
02139 {
02140 #if DEBUG
02141         DXF_DEBUG_BEGIN
02142 #endif
02143         /* Do some basic checks. */
02144         if (attdef == NULL)
02145         {
02146                 fprintf (stderr,
02147                   (_("Error in %s () a NULL pointer was passed.\n")),
02148                   __FUNCTION__);
02149                 return (NULL);
02150         }
02151         if (plot_style_name == NULL)
02152         {
02153                 fprintf (stderr,
02154                   (_("Error in %s () a NULL pointer was passed.\n")),
02155                   __FUNCTION__);
02156                 return (NULL);
02157         }
02158         attdef->plot_style_name = strdup (plot_style_name);
02159 #if DEBUG
02160         DXF_DEBUG_END
02161 #endif
02162         return (attdef);
02163 }
02164 
02165 
02172 long
02173 dxf_attdef_get_color_value
02174 (
02175         DxfAttdef *attdef
02177 )
02178 {
02179 #if DEBUG
02180         DXF_DEBUG_BEGIN
02181 #endif
02182         /* Do some basic checks. */
02183         if (attdef == NULL)
02184         {
02185                 fprintf (stderr,
02186                   (_("Error in %s () a NULL pointer was passed.\n")),
02187                   __FUNCTION__);
02188                 return (EXIT_FAILURE);
02189         }
02190 #if DEBUG
02191         DXF_DEBUG_END
02192 #endif
02193         return (attdef->color_value);
02194 }
02195 
02196 
02203 DxfAttdef *
02204 dxf_attdef_set_color_value
02205 (
02206         DxfAttdef *attdef,
02208         long color_value
02210 )
02211 {
02212 #if DEBUG
02213         DXF_DEBUG_BEGIN
02214 #endif
02215         /* Do some basic checks. */
02216         if (attdef == NULL)
02217         {
02218                 fprintf (stderr,
02219                   (_("Error in %s () a NULL pointer was passed.\n")),
02220                   __FUNCTION__);
02221                 return (NULL);
02222         }
02223         attdef->color_value = color_value;
02224 #if DEBUG
02225         DXF_DEBUG_END
02226 #endif
02227         return (attdef);
02228 }
02229 
02230 
02237 char *
02238 dxf_attdef_get_color_name
02239 (
02240         DxfAttdef *attdef
02242 )
02243 {
02244 #if DEBUG
02245         DXF_DEBUG_BEGIN
02246 #endif
02247         /* Do some basic checks. */
02248         if (attdef == NULL)
02249         {
02250                 fprintf (stderr,
02251                   (_("Error in %s () a NULL pointer was passed.\n")),
02252                   __FUNCTION__);
02253                 return (NULL);
02254         }
02255         if (attdef->color_name ==  NULL)
02256         {
02257                 fprintf (stderr,
02258                   (_("Error in %s () a NULL pointer was found.\n")),
02259                   __FUNCTION__);
02260                 return (NULL);
02261         }
02262 #if DEBUG
02263         DXF_DEBUG_END
02264 #endif
02265         return (strdup (attdef->color_name));
02266 }
02267 
02268 
02275 DxfAttdef *
02276 dxf_attdef_set_color_name
02277 (
02278         DxfAttdef *attdef,
02280         char *color_name
02283 )
02284 {
02285 #if DEBUG
02286         DXF_DEBUG_BEGIN
02287 #endif
02288         /* Do some basic checks. */
02289         if (attdef == NULL)
02290         {
02291                 fprintf (stderr,
02292                   (_("Error in %s () a NULL pointer was passed.\n")),
02293                   __FUNCTION__);
02294                 return (NULL);
02295         }
02296         if (color_name == NULL)
02297         {
02298                 fprintf (stderr,
02299                   (_("Error in %s () a NULL pointer was passed.\n")),
02300                   __FUNCTION__);
02301                 return (NULL);
02302         }
02303         attdef->color_name = strdup (color_name);
02304 #if DEBUG
02305         DXF_DEBUG_END
02306 #endif
02307         return (attdef);
02308 }
02309 
02310 
02317 long
02318 dxf_attdef_get_transparency
02319 (
02320         DxfAttdef *attdef
02322 )
02323 {
02324 #if DEBUG
02325         DXF_DEBUG_BEGIN
02326 #endif
02327         /* Do some basic checks. */
02328         if (attdef == NULL)
02329         {
02330                 fprintf (stderr,
02331                   (_("Error in %s () a NULL pointer was passed.\n")),
02332                   __FUNCTION__);
02333                 return (EXIT_FAILURE);
02334         }
02335 #if DEBUG
02336         DXF_DEBUG_END
02337 #endif
02338         return (attdef->transparency);
02339 }
02340 
02341 
02348 DxfAttdef *
02349 dxf_attdef_set_transparency
02350 (
02351         DxfAttdef *attdef,
02353         long transparency
02355 )
02356 {
02357 #if DEBUG
02358         DXF_DEBUG_BEGIN
02359 #endif
02360         /* Do some basic checks. */
02361         if (attdef == NULL)
02362         {
02363                 fprintf (stderr,
02364                   (_("Error in %s () a NULL pointer was passed.\n")),
02365                   __FUNCTION__);
02366                 return (NULL);
02367         }
02368         attdef->transparency = transparency;
02369 #if DEBUG
02370         DXF_DEBUG_END
02371 #endif
02372         return (attdef);
02373 }
02374 
02375 
02383 char *
02384 dxf_attdef_get_default_value
02385 (
02386         DxfAttdef *attdef
02388 )
02389 {
02390 #if DEBUG
02391         DXF_DEBUG_BEGIN
02392 #endif
02393         /* Do some basic checks. */
02394         if (attdef == NULL)
02395         {
02396                 fprintf (stderr,
02397                   (_("Error in %s () a NULL pointer was passed.\n")),
02398                   __FUNCTION__);
02399                 return (NULL);
02400         }
02401         if (attdef->default_value ==  NULL)
02402         {
02403                 fprintf (stderr,
02404                   (_("Error in %s () a NULL pointer was found.\n")),
02405                   __FUNCTION__);
02406                 return (NULL);
02407         }
02408 #if DEBUG
02409         DXF_DEBUG_END
02410 #endif
02411         return (strdup (attdef->default_value));
02412 }
02413 
02414 
02418 DxfAttdef *
02419 dxf_attdef_set_default_value
02420 (
02421         DxfAttdef *attdef,
02423         char *default_value
02426 )
02427 {
02428 #if DEBUG
02429         DXF_DEBUG_BEGIN
02430 #endif
02431         /* Do some basic checks. */
02432         if (attdef == NULL)
02433         {
02434                 fprintf (stderr,
02435                   (_("Error in %s () a NULL pointer was passed.\n")),
02436                   __FUNCTION__);
02437                 return (NULL);
02438         }
02439         if (default_value == NULL)
02440         {
02441                 fprintf (stderr,
02442                   (_("Error in %s () a NULL pointer was passed.\n")),
02443                   __FUNCTION__);
02444                 return (NULL);
02445         }
02446         attdef->default_value = strdup (default_value);
02447 #if DEBUG
02448         DXF_DEBUG_END
02449 #endif
02450         return (attdef);
02451 }
02452 
02453 
02461 char *
02462 dxf_attdef_get_tag_value
02463 (
02464         DxfAttdef *attdef
02466 )
02467 {
02468 #if DEBUG
02469         DXF_DEBUG_BEGIN
02470 #endif
02471         /* Do some basic checks. */
02472         if (attdef == NULL)
02473         {
02474                 fprintf (stderr,
02475                   (_("Error in %s () a NULL pointer was passed.\n")),
02476                   __FUNCTION__);
02477                 return (NULL);
02478         }
02479         if (attdef->tag_value ==  NULL)
02480         {
02481                 fprintf (stderr,
02482                   (_("Error in %s () a NULL pointer was found.\n")),
02483                   __FUNCTION__);
02484                 return (NULL);
02485         }
02486 #if DEBUG
02487         DXF_DEBUG_END
02488 #endif
02489         return (strdup (attdef->tag_value));
02490 }
02491 
02492 
02496 DxfAttdef *
02497 dxf_attdef_set_tag_value
02498 (
02499         DxfAttdef *attdef,
02501         char *tag_value
02504 )
02505 {
02506 #if DEBUG
02507         DXF_DEBUG_BEGIN
02508 #endif
02509         /* Do some basic checks. */
02510         if (attdef == NULL)
02511         {
02512                 fprintf (stderr,
02513                   (_("Error in %s () a NULL pointer was passed.\n")),
02514                   __FUNCTION__);
02515                 return (NULL);
02516         }
02517         if (tag_value == NULL)
02518         {
02519                 fprintf (stderr,
02520                   (_("Error in %s () a NULL pointer was passed.\n")),
02521                   __FUNCTION__);
02522                 return (NULL);
02523         }
02524         attdef->tag_value = strdup (tag_value);
02525 #if DEBUG
02526         DXF_DEBUG_END
02527 #endif
02528         return (attdef);
02529 }
02530 
02531 
02539 char *
02540 dxf_attdef_get_prompt_value
02541 (
02542         DxfAttdef *attdef
02544 )
02545 {
02546 #if DEBUG
02547         DXF_DEBUG_BEGIN
02548 #endif
02549         /* Do some basic checks. */
02550         if (attdef == NULL)
02551         {
02552                 fprintf (stderr,
02553                   (_("Error in %s () a NULL pointer was passed.\n")),
02554                   __FUNCTION__);
02555                 return (NULL);
02556         }
02557         if (attdef->prompt_value ==  NULL)
02558         {
02559                 fprintf (stderr,
02560                   (_("Error in %s () a NULL pointer was found.\n")),
02561                   __FUNCTION__);
02562                 return (NULL);
02563         }
02564 #if DEBUG
02565         DXF_DEBUG_END
02566 #endif
02567         return (strdup (attdef->prompt_value));
02568 }
02569 
02570 
02574 DxfAttdef *
02575 dxf_attdef_set_prompt_value
02576 (
02577         DxfAttdef *attdef,
02579         char *prompt_value
02582 )
02583 {
02584 #if DEBUG
02585         DXF_DEBUG_BEGIN
02586 #endif
02587         /* Do some basic checks. */
02588         if (attdef == NULL)
02589         {
02590                 fprintf (stderr,
02591                   (_("Error in %s () a NULL pointer was passed.\n")),
02592                   __FUNCTION__);
02593                 return (NULL);
02594         }
02595         if (prompt_value == NULL)
02596         {
02597                 fprintf (stderr,
02598                   (_("Error in %s () a NULL pointer was passed.\n")),
02599                   __FUNCTION__);
02600                 return (NULL);
02601         }
02602         attdef->prompt_value = strdup (prompt_value);
02603 #if DEBUG
02604         DXF_DEBUG_END
02605 #endif
02606         return (attdef);
02607 }
02608 
02609 
02617 char *
02618 dxf_attdef_get_text_style
02619 (
02620         DxfAttdef *attdef
02622 )
02623 {
02624 #if DEBUG
02625         DXF_DEBUG_BEGIN
02626 #endif
02627         /* Do some basic checks. */
02628         if (attdef == NULL)
02629         {
02630                 fprintf (stderr,
02631                   (_("Error in %s () a NULL pointer was passed.\n")),
02632                   __FUNCTION__);
02633                 return (NULL);
02634         }
02635         if (attdef->text_style ==  NULL)
02636         {
02637                 fprintf (stderr,
02638                   (_("Error in %s () a NULL pointer was found.\n")),
02639                   __FUNCTION__);
02640                 return (NULL);
02641         }
02642 #if DEBUG
02643         DXF_DEBUG_END
02644 #endif
02645         return (strdup (attdef->text_style));
02646 }
02647 
02648 
02652 DxfAttdef *
02653 dxf_attdef_set_text_style
02654 (
02655         DxfAttdef *attdef,
02657         char *text_style
02660 )
02661 {
02662 #if DEBUG
02663         DXF_DEBUG_BEGIN
02664 #endif
02665         /* Do some basic checks. */
02666         if (attdef == NULL)
02667         {
02668                 fprintf (stderr,
02669                   (_("Error in %s () a NULL pointer was passed.\n")),
02670                   __FUNCTION__);
02671                 return (NULL);
02672         }
02673         if (text_style == NULL)
02674         {
02675                 fprintf (stderr,
02676                   (_("Error in %s () a NULL pointer was passed.\n")),
02677                   __FUNCTION__);
02678                 return (NULL);
02679         }
02680         attdef->text_style = strdup (text_style);
02681 #if DEBUG
02682         DXF_DEBUG_END
02683 #endif
02684         return (attdef);
02685 }
02686 
02687 
02693 DxfPoint *
02694 dxf_attdef_get_p0
02695 (
02696         DxfAttdef *attdef
02698 )
02699 {
02700 #ifdef DEBUG
02701         DXF_DEBUG_BEGIN
02702 #endif
02703         /* Do some basic checks. */
02704         if (attdef == NULL)
02705         {
02706                 fprintf (stderr,
02707                   (_("Error in %s () a NULL pointer was passed.\n")),
02708                   __FUNCTION__);
02709                 return (NULL);
02710         }
02711         if (attdef->p0 == NULL)
02712         {
02713                 fprintf (stderr,
02714                   (_("Error in %s () a NULL pointer was found.\n")),
02715                   __FUNCTION__);
02716                 return (NULL);
02717         }
02718 #if DEBUG
02719         DXF_DEBUG_END
02720 #endif
02721         return (attdef->p0);
02722 }
02723 
02724 
02731 DxfAttdef *
02732 dxf_attdef_set_p0
02733 (
02734         DxfAttdef *attdef,
02736         DxfPoint *p0
02738 )
02739 {
02740 #ifdef DEBUG
02741         DXF_DEBUG_BEGIN
02742 #endif
02743         /* Do some basic checks. */
02744         if (attdef == NULL)
02745         {
02746                 fprintf (stderr,
02747                   (_("Error in %s () a NULL pointer was passed.\n")),
02748                   __FUNCTION__);
02749                 return (NULL);
02750         }
02751         if (p0 == NULL)
02752         {
02753                 fprintf (stderr,
02754                   (_("Error in %s () a NULL pointer was passed.\n")),
02755                   __FUNCTION__);
02756                 return (NULL);
02757         }
02758         attdef->p0 = p0;
02759 #if DEBUG
02760         DXF_DEBUG_END
02761 #endif
02762         return (attdef);
02763 }
02764 
02765 
02772 double
02773 dxf_attdef_get_x0
02774 (
02775         DxfAttdef *attdef
02777 )
02778 {
02779 #ifdef DEBUG
02780         DXF_DEBUG_BEGIN
02781 #endif
02782 
02783         /* Do some basic checks. */
02784         if (attdef == NULL)
02785         {
02786                 fprintf (stderr,
02787                   (_("Error in %s () a NULL pointer was passed.\n")),
02788                   __FUNCTION__);
02789                 return (EXIT_FAILURE);
02790         }
02791         if (attdef->p0 == NULL)
02792         {
02793                 fprintf (stderr,
02794                   (_("Error in %s () a NULL pointer was found.\n")),
02795                   __FUNCTION__);
02796                 return (EXIT_FAILURE);
02797         }
02798 #if DEBUG
02799         DXF_DEBUG_END
02800 #endif
02801         return (attdef->p0->x0);
02802 }
02803 
02804 
02812 DxfAttdef *
02813 dxf_attdef_set_x0
02814 (
02815         DxfAttdef *attdef,
02817         double x0
02820 )
02821 {
02822 #ifdef DEBUG
02823         DXF_DEBUG_BEGIN
02824 #endif
02825         /* Do some basic checks. */
02826         if (attdef == NULL)
02827         {
02828                 fprintf (stderr,
02829                   (_("Error in %s () a NULL pointer was passed.\n")),
02830                   __FUNCTION__);
02831                 return (NULL);
02832         }
02833         if (attdef->p0 == NULL)
02834         {
02835                 fprintf (stderr,
02836                   (_("Error in %s () a NULL pointer was found.\n")),
02837                   __FUNCTION__);
02838                 return (NULL);
02839         }
02840         attdef->p0->x0 = x0;
02841 #if DEBUG
02842         DXF_DEBUG_END
02843 #endif
02844         return (attdef);
02845 }
02846 
02847 
02854 double
02855 dxf_attdef_get_y0
02856 (
02857         DxfAttdef *attdef
02859 )
02860 {
02861 #ifdef DEBUG
02862         DXF_DEBUG_BEGIN
02863 #endif
02864 
02865         /* Do some basic checks. */
02866         if (attdef == NULL)
02867         {
02868                 fprintf (stderr,
02869                   (_("Error in %s () a NULL pointer was passed.\n")),
02870                   __FUNCTION__);
02871                 return (EXIT_FAILURE);
02872         }
02873         if (attdef->p0 == NULL)
02874         {
02875                 fprintf (stderr,
02876                   (_("Error in %s () a NULL pointer was found.\n")),
02877                   __FUNCTION__);
02878                 return (EXIT_FAILURE);
02879         }
02880 #if DEBUG
02881         DXF_DEBUG_END
02882 #endif
02883         return (attdef->p0->y0);
02884 }
02885 
02886 
02894 DxfAttdef *
02895 dxf_attdef_set_y0
02896 (
02897         DxfAttdef *attdef,
02899         double y0
02902 )
02903 {
02904 #ifdef DEBUG
02905         DXF_DEBUG_BEGIN
02906 #endif
02907         /* Do some basic checks. */
02908         if (attdef == NULL)
02909         {
02910                 fprintf (stderr,
02911                   (_("Error in %s () a NULL pointer was passed.\n")),
02912                   __FUNCTION__);
02913                 return (NULL);
02914         }
02915         if (attdef->p0 == NULL)
02916         {
02917                 fprintf (stderr,
02918                   (_("Error in %s () a NULL pointer was found.\n")),
02919                   __FUNCTION__);
02920                 return (NULL);
02921         }
02922         attdef->p0->y0 = y0;
02923 #if DEBUG
02924         DXF_DEBUG_END
02925 #endif
02926         return (attdef);
02927 }
02928 
02929 
02936 double
02937 dxf_attdef_get_z0
02938 (
02939         DxfAttdef *attdef
02941 )
02942 {
02943 #ifdef DEBUG
02944         DXF_DEBUG_BEGIN
02945 #endif
02946 
02947         /* Do some basic checks. */
02948         if (attdef == NULL)
02949         {
02950                 fprintf (stderr,
02951                   (_("Error in %s () a NULL pointer was passed.\n")),
02952                   __FUNCTION__);
02953                 return (EXIT_FAILURE);
02954         }
02955         if (attdef->p0 == NULL)
02956         {
02957                 fprintf (stderr,
02958                   (_("Error in %s () a NULL pointer was found.\n")),
02959                   __FUNCTION__);
02960                 return (EXIT_FAILURE);
02961         }
02962 #if DEBUG
02963         DXF_DEBUG_END
02964 #endif
02965         return (attdef->p0->z0);
02966 }
02967 
02968 
02976 DxfAttdef *
02977 dxf_attdef_set_z0
02978 (
02979         DxfAttdef *attdef,
02981         double z0
02984 )
02985 {
02986 #ifdef DEBUG
02987         DXF_DEBUG_BEGIN
02988 #endif
02989         /* Do some basic checks. */
02990         if (attdef == NULL)
02991         {
02992                 fprintf (stderr,
02993                   (_("Error in %s () a NULL pointer was passed.\n")),
02994                   __FUNCTION__);
02995                 return (NULL);
02996         }
02997         if (attdef->p0 == NULL)
02998         {
02999                 fprintf (stderr,
03000                   (_("Error in %s () a NULL pointer was found.\n")),
03001                   __FUNCTION__);
03002                 return (NULL);
03003         }
03004         attdef->p0->z0 = z0;
03005 #if DEBUG
03006         DXF_DEBUG_END
03007 #endif
03008         return (attdef);
03009 }
03010 
03011 
03017 DxfPoint *
03018 dxf_attdef_get_p1
03019 (
03020         DxfAttdef *attdef
03022 )
03023 {
03024 #ifdef DEBUG
03025         DXF_DEBUG_BEGIN
03026 #endif
03027         /* Do some basic checks. */
03028         if (attdef == NULL)
03029         {
03030                 fprintf (stderr,
03031                   (_("Error in %s () a NULL pointer was passed.\n")),
03032                   __FUNCTION__);
03033                 return (NULL);
03034         }
03035         if (attdef->p1 == NULL)
03036         {
03037                 fprintf (stderr,
03038                   (_("Error in %s () a NULL pointer was found.\n")),
03039                   __FUNCTION__);
03040                 return (NULL);
03041         }
03042 #if DEBUG
03043         DXF_DEBUG_END
03044 #endif
03045         return (attdef->p1);
03046 }
03047 
03048 
03055 DxfAttdef *
03056 dxf_attdef_set_p1
03057 (
03058         DxfAttdef *attdef,
03060         DxfPoint *p1
03062 )
03063 {
03064 #ifdef DEBUG
03065         DXF_DEBUG_BEGIN
03066 #endif
03067         /* Do some basic checks. */
03068         if (attdef == NULL)
03069         {
03070                 fprintf (stderr,
03071                   (_("Error in %s () a NULL pointer was passed.\n")),
03072                   __FUNCTION__);
03073                 return (NULL);
03074         }
03075         if (p1 == NULL)
03076         {
03077                 fprintf (stderr,
03078                   (_("Error in %s () a NULL pointer was passed.\n")),
03079                   __FUNCTION__);
03080                 return (NULL);
03081         }
03082         attdef->p1 = p1;
03083 #if DEBUG
03084         DXF_DEBUG_END
03085 #endif
03086         return (attdef);
03087 }
03088 
03089 
03096 double
03097 dxf_attdef_get_x1
03098 (
03099         DxfAttdef *attdef
03101 )
03102 {
03103 #ifdef DEBUG
03104         DXF_DEBUG_BEGIN
03105 #endif
03106 
03107         /* Do some basic checks. */
03108         if (attdef == NULL)
03109         {
03110                 fprintf (stderr,
03111                   (_("Error in %s () a NULL pointer was passed.\n")),
03112                   __FUNCTION__);
03113                 return (EXIT_FAILURE);
03114         }
03115         if (attdef->p1 == NULL)
03116         {
03117                 fprintf (stderr,
03118                   (_("Error in %s () a NULL pointer was found.\n")),
03119                   __FUNCTION__);
03120                 return (EXIT_FAILURE);
03121         }
03122 #if DEBUG
03123         DXF_DEBUG_END
03124 #endif
03125         return (attdef->p1->x0);
03126 }
03127 
03128 
03136 DxfAttdef *
03137 dxf_attdef_set_x1
03138 (
03139         DxfAttdef *attdef,
03141         double x1
03144 )
03145 {
03146 #ifdef DEBUG
03147         DXF_DEBUG_BEGIN
03148 #endif
03149         /* Do some basic checks. */
03150         if (attdef == NULL)
03151         {
03152                 fprintf (stderr,
03153                   (_("Error in %s () a NULL pointer was passed.\n")),
03154                   __FUNCTION__);
03155                 return (NULL);
03156         }
03157         if (attdef->p1 == NULL)
03158         {
03159                 fprintf (stderr,
03160                   (_("Error in %s () a NULL pointer was found.\n")),
03161                   __FUNCTION__);
03162                 return (NULL);
03163         }
03164         attdef->p1->x0 = x1;
03165 #if DEBUG
03166         DXF_DEBUG_END
03167 #endif
03168         return (attdef);
03169 }
03170 
03171 
03178 double
03179 dxf_attdef_get_y1
03180 (
03181         DxfAttdef *attdef
03183 )
03184 {
03185 #ifdef DEBUG
03186         DXF_DEBUG_BEGIN
03187 #endif
03188 
03189         /* Do some basic checks. */
03190         if (attdef == NULL)
03191         {
03192                 fprintf (stderr,
03193                   (_("Error in %s () a NULL pointer was passed.\n")),
03194                   __FUNCTION__);
03195                 return (EXIT_FAILURE);
03196         }
03197         if (attdef->p1 == NULL)
03198         {
03199                 fprintf (stderr,
03200                   (_("Error in %s () a NULL pointer was found.\n")),
03201                   __FUNCTION__);
03202                 return (EXIT_FAILURE);
03203         }
03204 #if DEBUG
03205         DXF_DEBUG_END
03206 #endif
03207         return (attdef->p1->y0);
03208 }
03209 
03210 
03218 DxfAttdef *
03219 dxf_attdef_set_y1
03220 (
03221         DxfAttdef *attdef,
03223         double y1
03226 )
03227 {
03228 #ifdef DEBUG
03229         DXF_DEBUG_BEGIN
03230 #endif
03231         /* Do some basic checks. */
03232         if (attdef == NULL)
03233         {
03234                 fprintf (stderr,
03235                   (_("Error in %s () a NULL pointer was passed.\n")),
03236                   __FUNCTION__);
03237                 return (NULL);
03238         }
03239         if (attdef->p1 == NULL)
03240         {
03241                 fprintf (stderr,
03242                   (_("Error in %s () a NULL pointer was found.\n")),
03243                   __FUNCTION__);
03244                 return (NULL);
03245         }
03246         attdef->p1->y0 = y1;
03247 #if DEBUG
03248         DXF_DEBUG_END
03249 #endif
03250         return (attdef);
03251 }
03252 
03253 
03260 double
03261 dxf_attdef_get_z1
03262 (
03263         DxfAttdef *attdef
03265 )
03266 {
03267 #ifdef DEBUG
03268         DXF_DEBUG_BEGIN
03269 #endif
03270 
03271         /* Do some basic checks. */
03272         if (attdef == NULL)
03273         {
03274                 fprintf (stderr,
03275                   (_("Error in %s () a NULL pointer was passed.\n")),
03276                   __FUNCTION__);
03277                 return (EXIT_FAILURE);
03278         }
03279         if (attdef->p1 == NULL)
03280         {
03281                 fprintf (stderr,
03282                   (_("Error in %s () a NULL pointer was found.\n")),
03283                   __FUNCTION__);
03284                 return (EXIT_FAILURE);
03285         }
03286 #if DEBUG
03287         DXF_DEBUG_END
03288 #endif
03289         return (attdef->p1->z0);
03290 }
03291 
03292 
03300 DxfAttdef *
03301 dxf_attdef_set_z1
03302 (
03303         DxfAttdef *attdef,
03305         double z1
03308 )
03309 {
03310 #ifdef DEBUG
03311         DXF_DEBUG_BEGIN
03312 #endif
03313         /* Do some basic checks. */
03314         if (attdef == NULL)
03315         {
03316                 fprintf (stderr,
03317                   (_("Error in %s () a NULL pointer was passed.\n")),
03318                   __FUNCTION__);
03319                 return (NULL);
03320         }
03321         if (attdef->p1 == NULL)
03322         {
03323                 fprintf (stderr,
03324                   (_("Error in %s () a NULL pointer was found.\n")),
03325                   __FUNCTION__);
03326                 return (NULL);
03327         }
03328         attdef->p1->z0 = z1;
03329 #if DEBUG
03330         DXF_DEBUG_END
03331 #endif
03332         return (attdef);
03333 }
03334 
03335 
03341 double
03342 dxf_attdef_get_height
03343 (
03344         DxfAttdef *attdef
03346 )
03347 {
03348 #if DEBUG
03349         DXF_DEBUG_BEGIN
03350 #endif
03351         /* Do some basic checks. */
03352         if (attdef == NULL)
03353         {
03354                 fprintf (stderr,
03355                   (_("Error in %s () a NULL pointer was passed.\n")),
03356                   __FUNCTION__);
03357                 return (EXIT_FAILURE);
03358         }
03359         if (attdef->height < 0.0)
03360         {
03361                 fprintf (stderr,
03362                   (_("Error in %s () a negative value was found.\n")),
03363                   __FUNCTION__);
03364                 return (EXIT_FAILURE);
03365         }
03366 #if DEBUG
03367         DXF_DEBUG_END
03368 #endif
03369         return (attdef->height);
03370 }
03371 
03372 
03376 DxfAttdef *
03377 dxf_attdef_set_height
03378 (
03379         DxfAttdef *attdef,
03381         double height
03383 )
03384 {
03385 #if DEBUG
03386         DXF_DEBUG_BEGIN
03387 #endif
03388         /* Do some basic checks. */
03389         if (attdef == NULL)
03390         {
03391                 fprintf (stderr,
03392                   (_("Error in %s () a NULL pointer was passed.\n")),
03393                   __FUNCTION__);
03394                 return (NULL);
03395         }
03396         if (height < 0.0)
03397         {
03398                 fprintf (stderr,
03399                   (_("Error in %s () a negative value was passed.\n")),
03400                   __FUNCTION__);
03401                 return (NULL);
03402         }
03403         attdef->height = height;
03404 #if DEBUG
03405         DXF_DEBUG_END
03406 #endif
03407         return (attdef);
03408 }
03409 
03410 
03416 double
03417 dxf_attdef_get_rel_x_scale
03418 (
03419         DxfAttdef *attdef
03421 )
03422 {
03423 #if DEBUG
03424         DXF_DEBUG_BEGIN
03425 #endif
03426         /* Do some basic checks. */
03427         if (attdef == NULL)
03428         {
03429                 fprintf (stderr,
03430                   (_("Error in %s () a NULL pointer was passed.\n")),
03431                   __FUNCTION__);
03432                 return (EXIT_FAILURE);
03433         }
03434         if (attdef->height < 0.0)
03435         {
03436                 fprintf (stderr,
03437                   (_("Error in %s () a negative value was found.\n")),
03438                   __FUNCTION__);
03439                 return (EXIT_FAILURE);
03440         }
03441 #if DEBUG
03442         DXF_DEBUG_END
03443 #endif
03444         return (attdef->rel_x_scale);
03445 }
03446 
03447 
03451 DxfAttdef *
03452 dxf_attdef_set_rel_x_scale
03453 (
03454         DxfAttdef *attdef,
03456         double rel_x_scale
03458 )
03459 {
03460 #if DEBUG
03461         DXF_DEBUG_BEGIN
03462 #endif
03463         /* Do some basic checks. */
03464         if (attdef == NULL)
03465         {
03466                 fprintf (stderr,
03467                   (_("Error in %s () a NULL pointer was passed.\n")),
03468                   __FUNCTION__);
03469                 return (NULL);
03470         }
03471         attdef->rel_x_scale = rel_x_scale;
03472 #if DEBUG
03473         DXF_DEBUG_END
03474 #endif
03475         return (attdef);
03476 }
03477 
03478 
03484 double
03485 dxf_attdef_get_rot_angle
03486 (
03487         DxfAttdef *attdef
03489 )
03490 {
03491 #if DEBUG
03492         DXF_DEBUG_BEGIN
03493 #endif
03494         /* Do some basic checks. */
03495         if (attdef == NULL)
03496         {
03497                 fprintf (stderr,
03498                   (_("Error in %s () a NULL pointer was passed.\n")),
03499                   __FUNCTION__);
03500                 return (EXIT_FAILURE);
03501         }
03502 #if DEBUG
03503         DXF_DEBUG_END
03504 #endif
03505 
03506         return (attdef->rot_angle);
03507 }
03508 
03509 
03513 DxfAttdef *
03514 dxf_attdef_set_rot_angle
03515 (
03516         DxfAttdef *attdef,
03518         double rot_angle
03520 )
03521 {
03522 #if DEBUG
03523         DXF_DEBUG_BEGIN
03524 #endif
03525         /* Do some basic checks. */
03526         if (attdef == NULL)
03527         {
03528                 fprintf (stderr,
03529                   (_("Error in %s () a NULL pointer was passed.\n")),
03530                   __FUNCTION__);
03531                 return (NULL);
03532         }
03534         attdef->rot_angle = rot_angle;
03535 #if DEBUG
03536         DXF_DEBUG_END
03537 #endif
03538         return (attdef);
03539 }
03540 
03541 
03547 double
03548 dxf_attdef_get_obl_angle
03549 (
03550         DxfAttdef *attdef
03552 )
03553 {
03554 #if DEBUG
03555         DXF_DEBUG_BEGIN
03556 #endif
03557         /* Do some basic checks. */
03558         if (attdef == NULL)
03559         {
03560                 fprintf (stderr,
03561                   (_("Error in %s () a NULL pointer was passed.\n")),
03562                   __FUNCTION__);
03563                 return (EXIT_FAILURE);
03564         }
03565 #if DEBUG
03566         DXF_DEBUG_END
03567 #endif
03568 
03569         return (attdef->obl_angle);
03570 }
03571 
03572 
03576 DxfAttdef *
03577 dxf_attdef_set_obl_angle
03578 (
03579         DxfAttdef *attdef,
03581         double obl_angle
03583 )
03584 {
03585 #if DEBUG
03586         DXF_DEBUG_BEGIN
03587 #endif
03588         /* Do some basic checks. */
03589         if (attdef == NULL)
03590         {
03591                 fprintf (stderr,
03592                   (_("Error in %s () a NULL pointer was passed.\n")),
03593                   __FUNCTION__);
03594                 return (NULL);
03595         }
03597         attdef->obl_angle = obl_angle;
03598 #if DEBUG
03599         DXF_DEBUG_END
03600 #endif
03601         return (attdef);
03602 }
03603 
03604 
03610 int
03611 dxf_attdef_get_attr_flags
03612 (
03613         DxfAttdef *attdef
03615 )
03616 {
03617 #if DEBUG
03618         DXF_DEBUG_BEGIN
03619 #endif
03620         /* Do some basic checks. */
03621         if (attdef == NULL)
03622         {
03623                 fprintf (stderr,
03624                   (_("Error in %s () a NULL pointer was passed.\n")),
03625                   __FUNCTION__);
03626                 return (EXIT_FAILURE);
03627         }
03628         if (attdef->attr_flags < 0)
03629         {
03630                 fprintf (stderr,
03631                   (_("Error in %s () a negative value was found.\n")),
03632                   __FUNCTION__);
03633                 return (EXIT_FAILURE);
03634         }
03635         if (attdef->attr_flags > 8)
03636         {
03637                 fprintf (stderr,
03638                   (_("Error in %s () an out of range value was found.\n")),
03639                   __FUNCTION__);
03640                 return (EXIT_FAILURE);
03641         }
03642 #if DEBUG
03643         DXF_DEBUG_END
03644 #endif
03645         return (attdef->attr_flags);
03646 }
03647 
03648 
03652 DxfAttdef *
03653 dxf_attdef_set_attr_flags
03654 (
03655         DxfAttdef *attdef,
03657         int attr_flags
03659 )
03660 {
03661 #if DEBUG
03662         DXF_DEBUG_BEGIN
03663 #endif
03664         /* Do some basic checks. */
03665         if (attdef == NULL)
03666         {
03667                 fprintf (stderr,
03668                   (_("Error in %s () a NULL pointer was passed.\n")),
03669                   __FUNCTION__);
03670                 return (NULL);
03671         }
03672         if (attr_flags < 0)
03673         {
03674                 fprintf (stderr,
03675                   (_("Error in %s () a negative value was passed.\n")),
03676                   __FUNCTION__);
03677                 return (NULL);
03678         }
03679         if (attr_flags > 8)
03680         {
03681                 fprintf (stderr,
03682                   (_("Error in %s () an out of range value was passed.\n")),
03683                   __FUNCTION__);
03684                 return (NULL);
03685         }
03686         attdef->attr_flags = attr_flags;
03687 #if DEBUG
03688         DXF_DEBUG_END
03689 #endif
03690         return (attdef);
03691 }
03692 
03693 
03700 int
03701 dxf_attdef_is_invisible
03702 (
03703         DxfAttdef *attdef
03705 )
03706 {
03707 #if DEBUG
03708         DXF_DEBUG_BEGIN
03709 #endif
03710         /* Do some basic checks. */
03711         if (attdef == NULL)
03712         {
03713                 fprintf (stderr,
03714                   (_("Error in %s () a NULL pointer was passed.\n")),
03715                   __FUNCTION__);
03716                 return (EXIT_FAILURE);
03717         }
03718 #if DEBUG
03719         DXF_DEBUG_END
03720 #endif
03721         return (DXF_CHECK_BIT (attdef->attr_flags, 0));
03722 }
03723 
03724 
03731 int
03732 dxf_attdef_is_constant
03733 (
03734         DxfAttdef *attdef
03736 )
03737 {
03738 #if DEBUG
03739         DXF_DEBUG_BEGIN
03740 #endif
03741         /* Do some basic checks. */
03742         if (attdef == NULL)
03743         {
03744                 fprintf (stderr,
03745                   (_("Error in %s () a NULL pointer was passed.\n")),
03746                   __FUNCTION__);
03747                 return (EXIT_FAILURE);
03748         }
03749 #if DEBUG
03750         DXF_DEBUG_END
03751 #endif
03752         return (DXF_CHECK_BIT (attdef->attr_flags, 1));
03753 }
03754 
03755 
03762 int
03763 dxf_attdef_is_verification_required
03764 (
03765         DxfAttdef *attdef
03767 )
03768 {
03769 #if DEBUG
03770         DXF_DEBUG_BEGIN
03771 #endif
03772         /* Do some basic checks. */
03773         if (attdef == NULL)
03774         {
03775                 fprintf (stderr,
03776                   (_("Error in %s () a NULL pointer was passed.\n")),
03777                   __FUNCTION__);
03778                 return (EXIT_FAILURE);
03779         }
03780 #if DEBUG
03781         DXF_DEBUG_END
03782 #endif
03783         return (DXF_CHECK_BIT (attdef->attr_flags, 2));
03784 }
03785 
03786 
03794 int
03795 dxf_attdef_is_preset
03796 (
03797         DxfAttdef *attdef
03799 )
03800 {
03801 #if DEBUG
03802         DXF_DEBUG_BEGIN
03803 #endif
03804         /* Do some basic checks. */
03805         if (attdef == NULL)
03806         {
03807                 fprintf (stderr,
03808                   (_("Error in %s () a NULL pointer was passed.\n")),
03809                   __FUNCTION__);
03810                 return (EXIT_FAILURE);
03811         }
03812 #if DEBUG
03813         DXF_DEBUG_END
03814 #endif
03815         return (DXF_CHECK_BIT (attdef->attr_flags, 3));
03816 }
03817 
03818 
03824 int
03825 dxf_attdef_get_text_flags
03826 (
03827         DxfAttdef *attdef
03829 )
03830 {
03831 #if DEBUG
03832         DXF_DEBUG_BEGIN
03833 #endif
03834         /* Do some basic checks. */
03835         if (attdef == NULL)
03836         {
03837                 fprintf (stderr,
03838                   (_("Error in %s () a NULL pointer was passed.\n")),
03839                   __FUNCTION__);
03840                 return (EXIT_FAILURE);
03841         }
03842         if (attdef->text_flags < 0)
03843         {
03844                 fprintf (stderr,
03845                   (_("Error in %s () a negative value was found.\n")),
03846                   __FUNCTION__);
03847                 return (EXIT_FAILURE);
03848         }
03849         if (attdef->text_flags > 4)
03850         {
03851                 fprintf (stderr,
03852                   (_("Error in %s () an out of range value was found.\n")),
03853                   __FUNCTION__);
03854                 return (EXIT_FAILURE);
03855         }
03856 #if DEBUG
03857         DXF_DEBUG_END
03858 #endif
03859         return (attdef->text_flags);
03860 }
03861 
03862 
03866 DxfAttdef *
03867 dxf_attdef_set_text_flags
03868 (
03869         DxfAttdef *attdef,
03871         int text_flags
03873 )
03874 {
03875 #if DEBUG
03876         DXF_DEBUG_BEGIN
03877 #endif
03878         /* Do some basic checks. */
03879         if (attdef == NULL)
03880         {
03881                 fprintf (stderr,
03882                   (_("Error in %s () a NULL pointer was passed.\n")),
03883                   __FUNCTION__);
03884                 return (NULL);
03885         }
03886         if (text_flags < 0)
03887         {
03888                 fprintf (stderr,
03889                   (_("Error in %s () a negative value was passed.\n")),
03890                   __FUNCTION__);
03891                 return (NULL);
03892         }
03893         if (text_flags > 4)
03894         {
03895                 fprintf (stderr,
03896                   (_("Error in %s () an out of range value was passed.\n")),
03897                   __FUNCTION__);
03898                 return (NULL);
03899         }
03900         attdef->text_flags = text_flags;
03901 #if DEBUG
03902         DXF_DEBUG_END
03903 #endif
03904         return (attdef);
03905 }
03906 
03907 
03913 int
03914 dxf_attdef_get_hor_align
03915 (
03916         DxfAttdef *attdef
03918 )
03919 {
03920 #if DEBUG
03921         DXF_DEBUG_BEGIN
03922 #endif
03923         /* Do some basic checks. */
03924         if (attdef == NULL)
03925         {
03926                 fprintf (stderr,
03927                   (_("Error in %s () a NULL pointer was passed.\n")),
03928                   __FUNCTION__);
03929                 return (EXIT_FAILURE);
03930         }
03931         if (attdef->hor_align < 0)
03932         {
03933                 fprintf (stderr,
03934                   (_("Error in %s () a negative value was found.\n")),
03935                   __FUNCTION__);
03936                 return (EXIT_FAILURE);
03937         }
03938         if (attdef->hor_align > 5)
03939         {
03940                 fprintf (stderr,
03941                   (_("Error in %s () an invalid value was found.\n")),
03942                   __FUNCTION__);
03943                 return (EXIT_FAILURE);
03944         }
03945 #if DEBUG
03946         DXF_DEBUG_END
03947 #endif
03948         return (attdef->hor_align);
03949 }
03950 
03951 
03955 DxfAttdef *
03956 dxf_attdef_set_hor_align
03957 (
03958         DxfAttdef *attdef,
03960         int hor_align
03962 )
03963 {
03964 #if DEBUG
03965         DXF_DEBUG_BEGIN
03966 #endif
03967         /* Do some basic checks. */
03968         if (attdef == NULL)
03969         {
03970                 fprintf (stderr,
03971                   (_("Error in %s () a NULL pointer was passed.\n")),
03972                   __FUNCTION__);
03973                 return (NULL);
03974         }
03975         if (hor_align < 0)
03976         {
03977                 fprintf (stderr,
03978                   (_("Error in %s () a negative value was passed.\n")),
03979                   __FUNCTION__);
03980                 return (NULL);
03981         }
03982         if (hor_align > 5)
03983         {
03984                 fprintf (stderr,
03985                   (_("Error in %s () an out of range value was passed.\n")),
03986                   __FUNCTION__);
03987                 return (NULL);
03988         }
03989         attdef->hor_align = hor_align;
03990 #if DEBUG
03991         DXF_DEBUG_END
03992 #endif
03993         return (attdef);
03994 }
03995 
03996 
04004 int
04005 dxf_attdef_get_field_length
04006 (
04007         DxfAttdef *attdef
04009 )
04010 {
04011 #if DEBUG
04012         DXF_DEBUG_BEGIN
04013 #endif
04014         /* Do some basic checks. */
04015         if (attdef == NULL)
04016         {
04017                 fprintf (stderr,
04018                   (_("Error in %s () a NULL pointer was passed.\n")),
04019                   __FUNCTION__);
04020                 return (EXIT_FAILURE);
04021         }
04022         if (attdef->field_length < 0)
04023         {
04024                 fprintf (stderr,
04025                   (_("Error in %s () a negative value was found.\n")),
04026                   __FUNCTION__);
04027                 return (EXIT_FAILURE);
04028         }
04029 #if DEBUG
04030         DXF_DEBUG_END
04031 #endif
04032         return (attdef->field_length);
04033 }
04034 
04035 
04041 DxfAttdef *
04042 dxf_attdef_set_field_length
04043 (
04044         DxfAttdef *attdef,
04046         int field_length
04048 )
04049 {
04050 #if DEBUG
04051         DXF_DEBUG_BEGIN
04052 #endif
04053         /* Do some basic checks. */
04054         if (attdef == NULL)
04055         {
04056                 fprintf (stderr,
04057                   (_("Error in %s () a NULL pointer was passed.\n")),
04058                   __FUNCTION__);
04059                 return (NULL);
04060         }
04061         if (field_length < 0)
04062         {
04063                 fprintf (stderr,
04064                   (_("Error in %s () a negative value was passed.\n")),
04065                   __FUNCTION__);
04066                 return (NULL);
04067         }
04068         attdef->field_length = field_length;
04069 #if DEBUG
04070         DXF_DEBUG_END
04071 #endif
04072         return (attdef);
04073 }
04074 
04075 
04081 int
04082 dxf_attdef_get_vert_align
04083 (
04084         DxfAttdef *attdef
04086 )
04087 {
04088 #if DEBUG
04089         DXF_DEBUG_BEGIN
04090 #endif
04091         /* Do some basic checks. */
04092         if (attdef == NULL)
04093         {
04094                 fprintf (stderr,
04095                   (_("Error in %s () a NULL pointer was passed.\n")),
04096                   __FUNCTION__);
04097                 return (EXIT_FAILURE);
04098         }
04099         if (attdef->vert_align < 0)
04100         {
04101                 fprintf (stderr,
04102                   (_("Error in %s () a negative value was found.\n")),
04103                   __FUNCTION__);
04104                 return (EXIT_FAILURE);
04105         }
04106         if (attdef->vert_align > 3)
04107         {
04108                 fprintf (stderr,
04109                   (_("Error in %s () an out of range value was found.\n")),
04110                   __FUNCTION__);
04111                 return (EXIT_FAILURE);
04112         }
04113 #if DEBUG
04114         DXF_DEBUG_END
04115 #endif
04116         return (attdef->vert_align);
04117 }
04118 
04119 
04123 DxfAttdef *
04124 dxf_attdef_set_vert_align
04125 (
04126         DxfAttdef *attdef,
04128         int vert_align
04130 )
04131 {
04132 #if DEBUG
04133         DXF_DEBUG_BEGIN
04134 #endif
04135         /* Do some basic checks. */
04136         if (attdef == NULL)
04137         {
04138                 fprintf (stderr,
04139                   (_("Error in %s () a NULL pointer was passed.\n")),
04140                   __FUNCTION__);
04141                 return (NULL);
04142         }
04143         if (vert_align < 0)
04144         {
04145                 fprintf (stderr,
04146                   (_("Error in %s () a negative value was passed.\n")),
04147                   __FUNCTION__);
04148                 return (NULL);
04149         }
04150         if (vert_align > 3)
04151         {
04152                 fprintf (stderr,
04153                   (_("Error in %s () an out of range value was passed.\n")),
04154                   __FUNCTION__);
04155                 return (NULL);
04156         }
04157         attdef->vert_align = vert_align;
04158 #if DEBUG
04159         DXF_DEBUG_END
04160 #endif
04161         return (attdef);
04162 }
04163 
04164 
04171 double
04172 dxf_attdef_get_extr_x0
04173 (
04174         DxfAttdef *attdef
04176 )
04177 {
04178 #ifdef DEBUG
04179         DXF_DEBUG_BEGIN
04180 #endif
04181 
04182         /* Do some basic checks. */
04183         if (attdef == NULL)
04184         {
04185                 fprintf (stderr,
04186                   (_("Error in %s () a NULL pointer was passed.\n")),
04187                   __FUNCTION__);
04188                 return (EXIT_FAILURE);
04189         }
04190 #if DEBUG
04191         DXF_DEBUG_END
04192 #endif
04193         return (attdef->extr_x0);
04194 }
04195 
04196 
04204 DxfAttdef *
04205 dxf_attdef_set_extr_x0
04206 (
04207         DxfAttdef *attdef,
04209         double extr_x0
04211 )
04212 {
04213 #ifdef DEBUG
04214         DXF_DEBUG_BEGIN
04215 #endif
04216         /* Do some basic checks. */
04217         if (attdef == NULL)
04218         {
04219                 fprintf (stderr,
04220                   (_("Error in %s () a NULL pointer was passed.\n")),
04221                   __FUNCTION__);
04222                 return (NULL);
04223         }
04224         attdef->extr_x0 = extr_x0;
04225 #if DEBUG
04226         DXF_DEBUG_END
04227 #endif
04228         return (attdef);
04229 }
04230 
04231 
04238 double
04239 dxf_attdef_get_extr_y0
04240 (
04241         DxfAttdef *attdef
04243 )
04244 {
04245 #ifdef DEBUG
04246         DXF_DEBUG_BEGIN
04247 #endif
04248 
04249         /* Do some basic checks. */
04250         if (attdef == NULL)
04251         {
04252                 fprintf (stderr,
04253                   (_("Error in %s () a NULL pointer was passed.\n")),
04254                   __FUNCTION__);
04255                 return (EXIT_FAILURE);
04256         }
04257 #if DEBUG
04258         DXF_DEBUG_END
04259 #endif
04260         return (attdef->extr_y0);
04261 }
04262 
04263 
04271 DxfAttdef *
04272 dxf_attdef_set_extr_y0
04273 (
04274         DxfAttdef *attdef,
04276         double extr_y0
04279 )
04280 {
04281 #ifdef DEBUG
04282         DXF_DEBUG_BEGIN
04283 #endif
04284         /* Do some basic checks. */
04285         if (attdef == NULL)
04286         {
04287                 fprintf (stderr,
04288                   (_("Error in %s () a NULL pointer was passed.\n")),
04289                   __FUNCTION__);
04290                 return (NULL);
04291         }
04292         attdef->extr_y0 = extr_y0;
04293 #if DEBUG
04294         DXF_DEBUG_END
04295 #endif
04296         return (attdef);
04297 }
04298 
04299 
04306 double
04307 dxf_attdef_get_extr_z0
04308 (
04309         DxfAttdef *attdef
04311 )
04312 {
04313 #ifdef DEBUG
04314         DXF_DEBUG_BEGIN
04315 #endif
04316 
04317         /* Do some basic checks. */
04318         if (attdef == NULL)
04319         {
04320                 fprintf (stderr,
04321                   (_("Error in %s () a NULL pointer was passed.\n")),
04322                   __FUNCTION__);
04323                 return (EXIT_FAILURE);
04324         }
04325 #if DEBUG
04326         DXF_DEBUG_END
04327 #endif
04328         return (attdef->extr_z0);
04329 }
04330 
04331 
04339 DxfAttdef *
04340 dxf_attdef_set_extr_z0
04341 (
04342         DxfAttdef *attdef,
04344         double extr_z0
04347 )
04348 {
04349 #ifdef DEBUG
04350         DXF_DEBUG_BEGIN
04351 #endif
04352         /* Do some basic checks. */
04353         if (attdef == NULL)
04354         {
04355                 fprintf (stderr,
04356                   (_("Error in %s () a NULL pointer was passed.\n")),
04357                   __FUNCTION__);
04358                 return (NULL);
04359         }
04360         attdef->extr_z0 = extr_z0;
04361 #if DEBUG
04362         DXF_DEBUG_END
04363 #endif
04364         return (attdef);
04365 }
04366 
04367 
04376 DxfPoint *
04377 dxf_attdef_get_extrusion_vector_as_point
04378 (
04379         DxfAttdef *attdef
04381 )
04382 {
04383 #ifdef DEBUG
04384         DXF_DEBUG_BEGIN
04385 #endif
04386         DxfPoint *point = NULL;
04387 
04388         /* Do some basic checks. */
04389         if (attdef == NULL)
04390         {
04391                 fprintf (stderr,
04392                   (_("Error in %s () a NULL pointer was passed.\n")),
04393                   __FUNCTION__);
04394                 return (NULL);
04395         }
04396         point = dxf_point_init (point);
04397         if (point == NULL)
04398         {
04399               fprintf (stderr,
04400                   (_("Error in %s () could not allocate memory.\n")),
04401                 __FUNCTION__);
04402               return (NULL);
04403         }
04404         point->x0 = attdef->extr_x0;
04405         point->y0 = attdef->extr_y0;
04406         point->z0 = attdef->extr_z0;
04407 #if DEBUG
04408         DXF_DEBUG_END
04409 #endif
04410         return (point);
04411 }
04412 
04413 
04418 DxfAttdef *
04419 dxf_attdef_set_extrusion_vector_from_point
04420 (
04421         DxfAttdef *attdef,
04423         DxfPoint *point
04425 )
04426 {
04427 #if DEBUG
04428         DXF_DEBUG_BEGIN
04429 #endif
04430         /* Do some basic checks. */
04431         if (attdef == NULL)
04432         {
04433                 fprintf (stderr,
04434                   (_("Error in %s () a NULL pointer was passed.\n")),
04435                   __FUNCTION__);
04436                 return (NULL);
04437         }
04438         if (point == NULL)
04439         {
04440                 fprintf (stderr,
04441                   (_("Error in %s () a NULL pointer was passed.\n")),
04442                   __FUNCTION__);
04443                 return (NULL);
04444         }
04445         attdef->extr_x0 = (double) point->x0;
04446         attdef->extr_y0 = (double) point->y0;
04447         attdef->extr_z0 = (double) point->z0;
04448 #if DEBUG
04449         DXF_DEBUG_END
04450 #endif
04451         return (attdef);
04452 }
04453 
04454 
04458 DxfAttdef *
04459 dxf_attdef_set_extrusion_vector
04460 (
04461         DxfAttdef *attdef,
04463         double extr_x0,
04465         double extr_y0,
04467         double extr_z0
04469 )
04470 {
04471 #if DEBUG
04472         DXF_DEBUG_BEGIN
04473 #endif
04474         /* Do some basic checks. */
04475         if (attdef == NULL)
04476         {
04477                 fprintf (stderr,
04478                   (_("Error in %s () a NULL pointer was passed.\n")),
04479                   __FUNCTION__);
04480                 return (NULL);
04481         }
04482         attdef->extr_x0 = extr_x0;
04483         attdef->extr_y0 = extr_y0;
04484         attdef->extr_z0 = extr_z0;
04485 #if DEBUG
04486         DXF_DEBUG_END
04487 #endif
04488         return (attdef);
04489 }
04490 
04491 
04500 DxfAttdef *
04501 dxf_attdef_get_next
04502 (
04503         DxfAttdef *attdef
04505 )
04506 {
04507 #if DEBUG
04508         DXF_DEBUG_BEGIN
04509 #endif
04510         /* Do some basic checks. */
04511         if (attdef == NULL)
04512         {
04513                 fprintf (stderr,
04514                   (_("Error in %s () a NULL pointer was passed.\n")),
04515                   __FUNCTION__);
04516                 return (NULL);
04517         }
04518         if (attdef->next == NULL)
04519         {
04520                 fprintf (stderr,
04521                   (_("Error in %s () a NULL pointer was found.\n")),
04522                   __FUNCTION__);
04523                 return (NULL);
04524         }
04525 #if DEBUG
04526         DXF_DEBUG_END
04527 #endif
04528         return ((DxfAttdef *) attdef->next);
04529 }
04530 
04531 
04536 DxfAttdef *
04537 dxf_attdef_set_next
04538 (
04539         DxfAttdef *attdef,
04541         DxfAttdef *next
04543 )
04544 {
04545 #if DEBUG
04546         DXF_DEBUG_BEGIN
04547 #endif
04548         /* Do some basic checks. */
04549         if (attdef == NULL)
04550         {
04551                 fprintf (stderr,
04552                   (_("Error in %s () a NULL pointer was passed.\n")),
04553                   __FUNCTION__);
04554                 return (NULL);
04555         }
04556         if (next == NULL)
04557         {
04558                 fprintf (stderr,
04559                   (_("Error in %s () a NULL pointer was passed.\n")),
04560                   __FUNCTION__);
04561                 return (NULL);
04562         }
04563         attdef->next = (struct DxfAttdef *) next;
04564 #if DEBUG
04565         DXF_DEBUG_END
04566 #endif
04567         return (attdef);
04568 }
04569 
04570 
04579 DxfAttdef *
04580 dxf_attdef_get_last
04581 (
04582         DxfAttdef *attdef
04584 )
04585 {
04586 #if DEBUG
04587         DXF_DEBUG_BEGIN
04588 #endif
04589         /* Do some basic checks. */
04590         if (attdef == NULL)
04591         {
04592                 fprintf (stderr,
04593                   (_("Error in %s () a NULL pointer was passed.\n")),
04594                   __FUNCTION__);
04595                 return (NULL);
04596         }
04597         if (attdef->next == NULL)
04598         {
04599                 fprintf (stderr,
04600                   (_("Error in %s () a NULL pointer was found.\n")),
04601                   __FUNCTION__);
04602                 return ((DxfAttdef *) attdef);
04603         }
04604         DxfAttdef *iter = (DxfAttdef *) attdef->next;
04605         while (iter->next != NULL)
04606         {
04607                 iter = (DxfAttdef *) iter->next;
04608         }
04609 #if DEBUG
04610         DXF_DEBUG_END
04611 #endif
04612         return ((DxfAttdef *) iter);
04613 }
04614 
04615 
04616 /* EOF */