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

attrib.c

Go to the documentation of this file.
00001 
00042 #include "attrib.h"
00043 
00044 
00050 DxfAttrib *
00051 dxf_attrib_new ()
00052 {
00053 #if DEBUG
00054         DXF_DEBUG_BEGIN
00055 #endif
00056         DxfAttrib *attrib = NULL;
00057         size_t size;
00058 
00059         size = sizeof (DxfAttrib);
00060         /* avoid malloc of 0 bytes */
00061         if (size == 0) size = 1;
00062         if ((attrib = malloc (size)) == NULL)
00063         {
00064                 fprintf (stderr,
00065                   (_("Error in %s () could not allocate memory for a DxfAttrib struct.\n")),
00066                   __FUNCTION__);
00067                 attrib = NULL;
00068         }
00069         else
00070         {
00071                 memset (attrib, 0, size);
00072         }
00073 #if DEBUG
00074         DXF_DEBUG_END
00075 #endif
00076         return (attrib);
00077 }
00078 
00079 
00087 DxfAttrib *
00088 dxf_attrib_init
00089 (
00090         DxfAttrib *attrib
00092 )
00093 {
00094 #if DEBUG
00095         DXF_DEBUG_BEGIN
00096 #endif
00097         /* Do some basic checks. */
00098         if (attrib == NULL)
00099         {
00100                 fprintf (stderr,
00101                   (_("Warning in %s () a NULL pointer was passed.\n")),
00102                   __FUNCTION__);
00103                 attrib = dxf_attrib_new ();
00104         }
00105         if (attrib == NULL)
00106         {
00107                 fprintf (stderr,
00108                   (_("Error in %s () could not allocate memory for a DxfAttrib struct.\n")),
00109                   __FUNCTION__);
00110                 return (NULL);
00111         }
00112         dxf_attrib_set_id_code (attrib, 0);
00113         dxf_attrib_set_linetype (attrib, strdup (DXF_DEFAULT_LINETYPE));
00114         dxf_attrib_set_text_style (attrib, strdup (DXF_DEFAULT_TEXTSTYLE));
00115         dxf_attrib_set_layer (attrib, strdup (DXF_DEFAULT_LAYER));
00116         dxf_attrib_set_elevation (attrib, 0.0);
00117         dxf_attrib_set_thickness (attrib, 0.0);
00118         dxf_attrib_set_linetype_scale (attrib, DXF_DEFAULT_LINETYPE_SCALE);
00119         dxf_attrib_set_visibility (attrib, DXF_DEFAULT_VISIBILITY);
00120         dxf_attrib_set_color (attrib, DXF_COLOR_BYLAYER);
00121         dxf_attrib_set_paperspace (attrib, DXF_MODELSPACE);
00122         dxf_attrib_set_graphics_data_size (attrib, 0);
00123         dxf_attrib_set_shadow_mode (attrib, 0);
00124         dxf_attrib_set_binary_graphics_data (attrib, (DxfBinaryGraphicsData *) dxf_binary_graphics_data_new ());
00125         dxf_binary_graphics_data_init ((DxfBinaryGraphicsData *) dxf_attrib_get_binary_graphics_data (attrib));
00126         dxf_attrib_set_dictionary_owner_soft (attrib, strdup(""));
00127         dxf_attrib_set_material (attrib, strdup (""));
00128         dxf_attrib_set_dictionary_owner_hard (attrib, strdup(""));
00129         dxf_attrib_set_lineweight (attrib, 0);
00130         dxf_attrib_set_plot_style_name (attrib, strdup (""));
00131         dxf_attrib_set_color_value (attrib, 0);
00132         dxf_attrib_set_color_name (attrib, strdup (""));
00133         dxf_attrib_set_transparency (attrib, 0);
00134         dxf_attrib_set_default_value (attrib, strdup (""));
00135         dxf_attrib_set_tag_value (attrib, strdup (""));
00136         dxf_attrib_set_p0 (attrib, dxf_point_new ());
00137         dxf_point_init ((DxfPoint *) dxf_attrib_get_p0 (attrib));
00138         dxf_attrib_set_x0 (attrib, 0.0);
00139         dxf_attrib_set_y0 (attrib, 0.0);
00140         dxf_attrib_set_z0 (attrib, 0.0);
00141         dxf_attrib_set_p1 (attrib, dxf_point_new ());
00142         dxf_point_init ((DxfPoint *) dxf_attrib_get_p1 (attrib));
00143         dxf_attrib_set_x1 (attrib, 0.0);
00144         dxf_attrib_set_y1 (attrib, 0.0);
00145         dxf_attrib_set_z1 (attrib, 0.0);
00146         dxf_attrib_set_height (attrib, 0.0);
00147         dxf_attrib_set_rel_x_scale (attrib, 0.0);
00148         dxf_attrib_set_rot_angle (attrib, 0.0);
00149         dxf_attrib_set_obl_angle (attrib, 0.0);
00150         dxf_attrib_set_attr_flags (attrib, 0);
00151         dxf_attrib_set_text_flags (attrib, 0);
00152         dxf_attrib_set_hor_align (attrib, 0);
00153         dxf_attrib_set_field_length (attrib, 0);
00154         dxf_attrib_set_vert_align (attrib, 0);
00155         dxf_attrib_set_extr_x0 (attrib, 0.0);
00156         dxf_attrib_set_extr_y0 (attrib, 0.0);
00157         dxf_attrib_set_extr_z0 (attrib, 1.0);
00158         dxf_attrib_set_lineweight (attrib, 0);
00159         dxf_attrib_set_next (attrib, NULL);
00160 #if DEBUG
00161         DXF_DEBUG_END
00162 #endif
00163         return (attrib);
00164 }
00165 
00166 
00178 DxfAttrib *
00179 dxf_attrib_read
00180 (
00181         DxfFile *fp,
00183         DxfAttrib *attrib
00185 )
00186 {
00187 #if DEBUG
00188         DXF_DEBUG_BEGIN
00189 #endif
00190         char *temp_string = NULL;
00191 
00192         /* Do some basic checks. */
00193         if (fp == NULL)
00194         {
00195                 fprintf (stderr,
00196                   (_("Error in %s () a NULL file pointer was passed.\n")),
00197                   __FUNCTION__);
00198                 /* Clean up. */
00199                 free (temp_string);
00200                 return (NULL);
00201         }
00202         if (attrib == NULL)
00203         {
00204                 fprintf (stderr,
00205                   (_("Warning in %s () a NULL pointer was passed.\n")),
00206                   __FUNCTION__);
00207                 attrib = dxf_attrib_new ();
00208                 attrib = dxf_attrib_init (attrib);
00209         }
00210         (fp->line_number)++;
00211         fscanf (fp->fp, "%[^\n]", temp_string);
00212         while (strcmp (temp_string, "0") != 0)
00213         {
00214                 if (ferror (fp->fp))
00215                 {
00216                         fprintf (stderr,
00217                           (_("Error in %s () while reading from: %s in line: %d.\n")),
00218                           __FUNCTION__, fp->filename, fp->line_number);
00219                         fclose (fp->fp);
00220                         /* Clean up. */
00221                         free (temp_string);
00222                         return (NULL);
00223                 }
00224                 if (strcmp (temp_string, "1") == 0)
00225                 {
00226                         /* Now follows a string containing the attribute
00227                          * value. */
00228                         (fp->line_number)++;
00229                         fscanf (fp->fp, "%s\n", attrib->default_value);
00230                 }
00231                 else if (strcmp (temp_string, "2") == 0)
00232                 {
00233                         /* Now follows a string containing a tag value. */
00234                         (fp->line_number)++;
00235                         fscanf (fp->fp, "%s\n", attrib->tag_value);
00236                 }
00237                 else if (strcmp (temp_string, "5") == 0)
00238                 {
00239                         /* Now follows a string containing a sequential
00240                          * id number. */
00241                         (fp->line_number)++;
00242                         fscanf (fp->fp, "%x\n", &attrib->id_code);
00243                 }
00244                 else if (strcmp (temp_string, "6") == 0)
00245                 {
00246                         /* Now follows a string containing a linetype
00247                          * name. */
00248                         (fp->line_number)++;
00249                         fscanf (fp->fp, "%s\n", attrib->linetype);
00250                 }
00251                 else if (strcmp (temp_string, "7") == 0)
00252                 {
00253                         /* Now follows a string containing a text style. */
00254                         (fp->line_number)++;
00255                         fscanf (fp->fp, "%s\n", attrib->text_style);
00256                 }
00257                 else if (strcmp (temp_string, "8") == 0)
00258                 {
00259                         /* Now follows a string containing a layer name. */
00260                         (fp->line_number)++;
00261                         fscanf (fp->fp, "%s\n", attrib->layer);
00262                 }
00263                 else if (strcmp (temp_string, "10") == 0)
00264                 {
00265                         /* Now follows a string containing the
00266                          * X-coordinate of the start point. */
00267                         (fp->line_number)++;
00268                         fscanf (fp->fp, "%lf\n", &attrib->p0->x0);
00269                 }
00270                 else if (strcmp (temp_string, "20") == 0)
00271                 {
00272                         /* Now follows a string containing the
00273                          * Y-coordinate of the start point. */
00274                         (fp->line_number)++;
00275                         fscanf (fp->fp, "%lf\n", &attrib->p0->y0);
00276                 }
00277                 else if (strcmp (temp_string, "30") == 0)
00278                 {
00279                         /* Now follows a string containing the
00280                          * Z-coordinate of the start point. */
00281                         (fp->line_number)++;
00282                         fscanf (fp->fp, "%lf\n", &attrib->p0->z0);
00283                 }
00284                 else if (strcmp (temp_string, "11") == 0)
00285                 {
00286                         /* Now follows a string containing the
00287                          * X-coordinate of the align point. */
00288                         (fp->line_number)++;
00289                         fscanf (fp->fp, "%lf\n", &attrib->p1->x0);
00290                 }
00291                 else if (strcmp (temp_string, "21") == 0)
00292                 {
00293                         /* Now follows a string containing the
00294                          * Y-coordinate of the align point. */
00295                         (fp->line_number)++;
00296                         fscanf (fp->fp, "%lf\n", &attrib->p1->y0);
00297                 }
00298                 else if (strcmp (temp_string, "31") == 0)
00299                 {
00300                         /* Now follows a string containing the
00301                          * Z-coordinate of the align point. */
00302                         (fp->line_number)++;
00303                         fscanf (fp->fp, "%lf\n", &attrib->p1->z0);
00304                 }
00305                 else if ((fp->acad_version_number <= AutoCAD_11)
00306                         && (strcmp (temp_string, "38") == 0)
00307                         && (attrib->elevation = 0.0))
00308                 {
00309                         /* Elevation is a pre AutoCAD R11 variable
00310                          * so additional testing for the version should
00311                          * probably be added.
00312                          * Now follows a string containing the
00313                          * elevation. */
00314                         (fp->line_number)++;
00315                         fscanf (fp->fp, "%lf\n", &attrib->elevation);
00316                 }
00317                 else if (strcmp (temp_string, "39") == 0)
00318                 {
00319                         /* Now follows a string containing the
00320                          * thickness. */
00321                         (fp->line_number)++;
00322                         fscanf (fp->fp, "%lf\n", &attrib->thickness);
00323                 }
00324                 else if (strcmp (temp_string, "40") == 0)
00325                 {
00326                         /* Now follows a string containing the
00327                          * height. */
00328                         (fp->line_number)++;
00329                         fscanf (fp->fp, "%lf\n", &attrib->height);
00330                 }
00331                 else if (strcmp (temp_string, "41") == 0)
00332                 {
00333                         /* Now follows a string containing the
00334                          * relative X-scale. */
00335                         (fp->line_number)++;
00336                         fscanf (fp->fp, "%lf\n", &attrib->rel_x_scale);
00337                 }
00338                 else if (strcmp (temp_string, "48") == 0)
00339                 {
00340                         /* Now follows a string containing the linetype
00341                          * scale. */
00342                         (fp->line_number)++;
00343                         fscanf (fp->fp, "%lf\n", &attrib->linetype_scale);
00344                 }
00345                 else if (strcmp (temp_string, "50") == 0)
00346                 {
00347                         /* Now follows a string containing the
00348                          * rotation angle. */
00349                         (fp->line_number)++;
00350                         fscanf (fp->fp, "%lf\n", &attrib->rot_angle);
00351                 }
00352                 else if (strcmp (temp_string, "51") == 0)
00353                 {
00354                         /* Now follows a string containing the
00355                          * end angle. */
00356                         (fp->line_number)++;
00357                         fscanf (fp->fp, "%lf\n", &attrib->obl_angle);
00358                 }
00359                 else if (strcmp (temp_string, "60") == 0)
00360                 {
00361                         /* Now follows a string containing the
00362                          * visibility value. */
00363                         (fp->line_number)++;
00364                         fscanf (fp->fp, "%hd\n", &attrib->visibility);
00365                 }
00366                 else if (strcmp (temp_string, "62") == 0)
00367                 {
00368                         /* Now follows a string containing the
00369                          * color value. */
00370                         (fp->line_number)++;
00371                         fscanf (fp->fp, "%d\n", &attrib->color);
00372                 }
00373                 else if (strcmp (temp_string, "67") == 0)
00374                 {
00375                         /* Now follows a string containing the
00376                          * paperspace value. */
00377                         (fp->line_number)++;
00378                         fscanf (fp->fp, "%d\n", &attrib->paperspace);
00379                 }
00380                 else if (strcmp (temp_string, "70") == 0)
00381                 {
00382                         /* Now follows a string containing the
00383                          * attribute flags value. */
00384                         (fp->line_number)++;
00385                         fscanf (fp->fp, "%d\n", &attrib->attr_flags);
00386                 }
00387                 else if (strcmp (temp_string, "71") == 0)
00388                 {
00389                         /* Now follows a string containing the
00390                          * text flags value. */
00391                         (fp->line_number)++;
00392                         fscanf (fp->fp, "%d\n", &attrib->text_flags);
00393                 }
00394                 else if (strcmp (temp_string, "72") == 0)
00395                 {
00396                         /* Now follows a string containing the
00397                          * horizontal alignment value. */
00398                         (fp->line_number)++;
00399                         fscanf (fp->fp, "%d\n", &attrib->hor_align);
00400                 }
00401                 else if (strcmp (temp_string, "73") == 0)
00402                 {
00403                         /* Now follows a string containing the
00404                          * field length value. */
00405                         (fp->line_number)++;
00406                         fscanf (fp->fp, "%d\n", &attrib->field_length);
00407                 }
00408                 else if (strcmp (temp_string, "74") == 0)
00409                 {
00410                         /* Now follows a string containing the
00411                          * vertical alignment value. */
00412                         (fp->line_number)++;
00413                         fscanf (fp->fp, "%d\n", &attrib->vert_align);
00414                 }
00415                 else if ((fp->acad_version_number >= AutoCAD_12)
00416                         && (strcmp (temp_string, "100") == 0))
00417                 {
00418                         /* Subclass markers are post AutoCAD R12
00419                          * variable so additional testing for the
00420                          * version should probably be added here.
00421                          * Now follows a string containing the
00422                          * subclass marker value. */
00423                         (fp->line_number)++;
00424                         fscanf (fp->fp, "%s\n", temp_string);
00425                         if ((strcmp (temp_string, "AcDbEntity") != 0)
00426                         && (strcmp (temp_string, "AcDbText") != 0)
00427                         && (strcmp (temp_string, "AcDbAttribute") != 0))
00428                         {
00429                                 fprintf (stderr,
00430                                   (_("Warning in %s () found a bad subclass marker in: %s in line: %d.\n")),
00431                                   __FUNCTION__, fp->filename, fp->line_number);
00432                         }
00433                 }
00434                 else if (strcmp (temp_string, "210") == 0)
00435                 {
00436                         /* Now follows a string containing the
00437                          * X-value of the extrusion vector. */
00438                         (fp->line_number)++;
00439                         fscanf (fp->fp, "%lf\n", &attrib->extr_x0);
00440                 }
00441                 else if (strcmp (temp_string, "220") == 0)
00442                 {
00443                         /* Now follows a string containing the
00444                          * Y-value of the extrusion vector. */
00445                         (fp->line_number)++;
00446                         fscanf (fp->fp, "%lf\n", &attrib->extr_y0);
00447                 }
00448                 else if (strcmp (temp_string, "230") == 0)
00449                 {
00450                         /* Now follows a string containing the
00451                          * Z-value of the extrusion vector. */
00452                         (fp->line_number)++;
00453                         fscanf (fp->fp, "%lf\n", &attrib->extr_z0);
00454                 }
00455                 else if (strcmp (temp_string, "330") == 0)
00456                 {
00457                         /* Now follows a string containing Soft-pointer
00458                          * ID/handle to owner dictionary. */
00459                         (fp->line_number)++;
00460                         fscanf (fp->fp, "%s\n", attrib->dictionary_owner_soft);
00461                 }
00462                 else if (strcmp (temp_string, "360") == 0)
00463                 {
00464                         /* Now follows a string containing Hard owner
00465                          * ID/handle to owner dictionary. */
00466                         (fp->line_number)++;
00467                         fscanf (fp->fp, "%s\n", attrib->dictionary_owner_hard);
00468                 }
00469                 else if (strcmp (temp_string, "999") == 0)
00470                 {
00471                         /* Now follows a string containing a comment. */
00472                         (fp->line_number)++;
00473                         fscanf (fp->fp, "%s\n", temp_string);
00474                         fprintf (stdout, "DXF comment: %s\n", temp_string);
00475                 }
00476                 else
00477                 {
00478                         fprintf (stderr,
00479                           (_("Warning in %s () unknown string tag found while reading from: %s in line: %d.\n")),
00480                           __FUNCTION__, fp->filename, fp->line_number);
00481                 }
00482         }
00483         /* Handle omitted members and/or illegal values. */
00484         if (strcmp (dxf_attrib_get_linetype (attrib), "") == 0)
00485         {
00486                 dxf_attrib_set_linetype (attrib, strdup (DXF_DEFAULT_LINETYPE));
00487         }
00488         if (strcmp (dxf_attrib_get_layer (attrib), "") == 0)
00489         {
00490                 dxf_attrib_set_layer (attrib, strdup (DXF_DEFAULT_LAYER));
00491         }
00492         /* Clean up. */
00493         free (temp_string);
00494 #if DEBUG
00495         DXF_DEBUG_END
00496 #endif
00497         return (EXIT_SUCCESS);
00498 }
00499 
00500 
00504 int
00505 dxf_attrib_write
00506 (
00507         DxfFile *fp,
00509         DxfAttrib *attrib
00511 )
00512 {
00513 #if DEBUG
00514         DXF_DEBUG_BEGIN
00515 #endif
00516         char *dxf_entity_name = strdup ("ATTRIB");
00517 
00518         /* Do some basic checks. */
00519         if (fp == NULL)
00520         {
00521                 fprintf (stderr,
00522                   (_("Error in %s () a NULL file pointer was passed.\n")),
00523                   __FUNCTION__);
00524                 /* Clean up. */
00525                 free (dxf_entity_name);
00526                 return (EXIT_FAILURE);
00527         }
00528         if (attrib == NULL)
00529         {
00530                 fprintf (stderr,
00531                   (_("Error in %s () a NULL pointer was passed.\n")),
00532                   __FUNCTION__);
00533                 /* Clean up. */
00534                 free (dxf_entity_name);
00535                 return (EXIT_FAILURE);
00536         }
00537         if (strcmp (dxf_attrib_get_default_value (attrib), "") == 0)
00538         {
00539                 fprintf (stderr,
00540                   (_("Error in %s () default value string is empty for the %s entity with id-code: %x.\n")),
00541                   __FUNCTION__, dxf_entity_name, dxf_attrib_get_id_code (attrib));
00542                 /* Clean up. */
00543                 free (dxf_entity_name);
00544                 return (EXIT_FAILURE);
00545         }
00546         if (strcmp (dxf_attrib_get_tag_value (attrib), "") == 0)
00547         {
00548                 fprintf (stderr,
00549                   (_("Error in %s () tag value string is empty for the %s entity with id-code: %x.\n")),
00550                   __FUNCTION__, dxf_entity_name, dxf_attrib_get_id_code (attrib));
00551                 /* Clean up. */
00552                 free (dxf_entity_name);
00553                 return (EXIT_FAILURE);
00554         }
00555         if (strcmp (dxf_attrib_get_text_style (attrib), "") == 0)
00556         {
00557                 fprintf (stderr,
00558                   (_("Warning in %s () text style string is empty for the %s entity with id-code: %x.\n")),
00559                   __FUNCTION__, dxf_entity_name, dxf_attrib_get_id_code (attrib));
00560                 fprintf (stderr,
00561                   (_("\tdefault text style STANDARD applied to %s entity.\n")),
00562                   dxf_entity_name);
00563                 dxf_attrib_set_text_style (attrib, strdup (DXF_DEFAULT_TEXTSTYLE));
00564         }
00565         if (strcmp (dxf_attrib_get_linetype (attrib), "") == 0)
00566         {
00567                 fprintf (stderr,
00568                   (_("Warning in %s () empty linetype string for the %s entity with id-code: %x\n")),
00569                   __FUNCTION__, dxf_entity_name, dxf_attrib_get_id_code (attrib));
00570                 fprintf (stderr,
00571                   (_("\t%s entity is reset to default linetype")),
00572                   dxf_entity_name);
00573                 dxf_attrib_set_linetype (attrib, strdup (DXF_DEFAULT_LINETYPE));
00574         }
00575         if (strcmp (dxf_attrib_get_layer (attrib), "") == 0)
00576         {
00577                 fprintf (stderr,
00578                   (_("Warning in %s () empty layer string for the %s entity with id-code: %x.\n")),
00579                   __FUNCTION__, dxf_entity_name, dxf_attrib_get_id_code (attrib));
00580                 fprintf (stderr,
00581                   (_("\t%s entity is relocated to the default layer.\n")),
00582                   dxf_entity_name);
00583                 dxf_attrib_set_layer (attrib, strdup (DXF_DEFAULT_LAYER));
00584         }
00585         if (dxf_attrib_get_height (attrib) == 0.0)
00586         {
00587                 fprintf (stderr,
00588                   (_("Warning in %s () height has a value of 0.0 for the %s entity with id-code: %x.\n")),
00589                   __FUNCTION__, dxf_entity_name, dxf_attrib_get_id_code (attrib));
00590                 fprintf (stderr,
00591                   (_("\tdefault height of 1.0 applied to %s entity.\n")),
00592                   dxf_entity_name);
00593                 dxf_attrib_set_height (attrib, 1.0);
00594         }
00595         if (dxf_attrib_get_rel_x_scale (attrib) == 0.0)
00596         {
00597                 fprintf (stderr,
00598                   (_("Warning in %s () relative X-scale factor has a value of 0.0 for the %s entity with id-code: %x.\n")),
00599                   __FUNCTION__, dxf_entity_name, dxf_attrib_get_id_code (attrib));
00600                 fprintf (stderr,
00601                   (_("\tdefault relative X-scale of 1.0 applied to %s entity.\n")),
00602                   dxf_entity_name);
00603                 dxf_attrib_set_rel_x_scale (attrib, 1.0);
00604         }
00605         /* Start writing output. */
00606         fprintf (fp->fp, "  0\n%s\n", dxf_entity_name);
00607         if (dxf_attrib_get_id_code (attrib) != -1)
00608         {
00609                 fprintf (fp->fp, "  5\n%x\n", dxf_attrib_get_id_code (attrib));
00610         }
00621         if ((strcmp (dxf_attrib_get_dictionary_owner_soft (attrib), "") != 0)
00622           && (fp->acad_version_number >= AutoCAD_14))
00623         {
00624                 fprintf (fp->fp, "102\n{ACAD_REACTORS\n");
00625                 fprintf (fp->fp, "330\n%s\n", dxf_attrib_get_dictionary_owner_soft (attrib));
00626                 fprintf (fp->fp, "102\n}\n");
00627         }
00628         if ((strcmp (dxf_attrib_get_dictionary_owner_hard (attrib), "") != 0)
00629           && (fp->acad_version_number >= AutoCAD_14))
00630         {
00631                 fprintf (fp->fp, "102\n{ACAD_XDICTIONARY\n");
00632                 fprintf (fp->fp, "360\n%s\n", dxf_attrib_get_dictionary_owner_hard (attrib));
00633                 fprintf (fp->fp, "102\n}\n");
00634         }
00635         if (fp->acad_version_number >= AutoCAD_13)
00636         {
00637                 fprintf (fp->fp, "100\nAcDbEntity\n");
00638         }
00639         if (dxf_attrib_get_paperspace (attrib) == DXF_PAPERSPACE)
00640         {
00641                 fprintf (fp->fp, " 67\n%d\n", DXF_PAPERSPACE);
00642         }
00643         fprintf (fp->fp, "  8\n%s\n", dxf_attrib_get_layer (attrib));
00644         if (strcmp (dxf_attrib_get_linetype (attrib), DXF_DEFAULT_LINETYPE) != 0)
00645         {
00646                 fprintf (fp->fp, "  6\n%s\n", dxf_attrib_get_linetype (attrib));
00647         }
00648         if (dxf_attrib_get_color (attrib) != DXF_COLOR_BYLAYER)
00649         {
00650                 fprintf (fp->fp, " 62\n%d\n", dxf_attrib_get_color (attrib));
00651         }
00652         if (dxf_attrib_get_linetype_scale (attrib) != 1.0)
00653         {
00654                 fprintf (fp->fp, " 48\n%f\n", dxf_attrib_get_linetype_scale (attrib));
00655         }
00656         if (dxf_attrib_get_visibility (attrib) != 0)
00657         {
00658                 fprintf (fp->fp, " 60\n%d\n", dxf_attrib_get_visibility (attrib));
00659         }
00660         if (fp->acad_version_number >= AutoCAD_13)
00661         {
00662                 fprintf (fp->fp, "100\nAcDbText\n");
00663         }
00664         if ((fp->acad_version_number <= AutoCAD_11)
00665           && DXF_FLATLAND
00666           && (dxf_attrib_get_elevation (attrib) != 0.0))
00667         {
00668                 fprintf (fp->fp, " 38\n%f\n", dxf_attrib_get_elevation (attrib));
00669         }
00670         if (dxf_attrib_get_thickness (attrib) != 0.0)
00671         {
00672                 fprintf (fp->fp, " 39\n%f\n", dxf_attrib_get_thickness (attrib));
00673         }
00674         fprintf (fp->fp, " 10\n%f\n", dxf_attrib_get_x0 (attrib));
00675         fprintf (fp->fp, " 20\n%f\n", dxf_attrib_get_y0 (attrib));
00676         fprintf (fp->fp, " 30\n%f\n", dxf_attrib_get_z0 (attrib));
00677         fprintf (fp->fp, " 40\n%f\n", dxf_attrib_get_height (attrib));
00678         fprintf (fp->fp, "  1\n%s\n", dxf_attrib_get_default_value (attrib));
00679         if (fp->acad_version_number >= AutoCAD_13)
00680         {
00681                 fprintf (fp->fp, "100\nAcDbAttribute\n");
00682         }
00683         fprintf (fp->fp, "  2\n%s\n", dxf_attrib_get_tag_value (attrib));
00684         fprintf (fp->fp, " 70\n%d\n", dxf_attrib_get_attr_flags (attrib));
00685         if (dxf_attrib_get_field_length (attrib) != 0)
00686         {
00687                 fprintf (fp->fp, " 73\n%d\n", dxf_attrib_get_field_length (attrib));
00688         }
00689         if (dxf_attrib_get_rot_angle (attrib) != 0.0)
00690         {
00691                 fprintf (fp->fp, " 50\n%f\n", dxf_attrib_get_rot_angle (attrib));
00692         }
00693         if (dxf_attrib_get_rel_x_scale (attrib)!= 1.0)
00694         {
00695                 fprintf (fp->fp, " 41\n%f\n", dxf_attrib_get_rel_x_scale (attrib));
00696         }
00697         if (dxf_attrib_get_obl_angle (attrib) != 0.0)
00698         {
00699                 fprintf (fp->fp, " 51\n%f\n", dxf_attrib_get_obl_angle (attrib));
00700         }
00701         if (strcmp (dxf_attrib_get_text_style (attrib), "STANDARD") != 0)
00702         {
00703                 fprintf (fp->fp, "  7\n%s\n", dxf_attrib_get_text_style (attrib));
00704         }
00705         if (dxf_attrib_get_text_flags (attrib) != 0)
00706         {
00707                 fprintf (fp->fp, " 71\n%d\n", dxf_attrib_get_text_flags (attrib));
00708         }
00709         if (dxf_attrib_get_hor_align (attrib) != 0)
00710         {
00711                 fprintf (fp->fp, " 72\n%d\n", dxf_attrib_get_hor_align (attrib));
00712         }
00713         if (dxf_attrib_get_vert_align (attrib) != 0)
00714         {
00715                 fprintf (fp->fp, " 74\n%d\n", dxf_attrib_get_vert_align (attrib));
00716         }
00717         if ((dxf_attrib_get_hor_align (attrib) != 0) || (dxf_attrib_get_vert_align (attrib) != 0))
00718         {
00719                 if ((dxf_attrib_get_x0 (attrib) == dxf_attrib_get_x1 (attrib))
00720                         && (dxf_attrib_get_y0 (attrib) == dxf_attrib_get_y0 (attrib))
00721                         && (dxf_attrib_get_z0 (attrib) == dxf_attrib_get_z0 (attrib)))
00722                 {
00723                         fprintf (stderr,
00724                           (_("Warning in %s () insertion point and alignment point are identical for the %s entity with id-code: %x.\n")),
00725                           __FUNCTION__, dxf_entity_name, dxf_attrib_get_id_code (attrib));
00726                         fprintf (stderr,
00727                           (_("    default justification applied to %s entity\n")),
00728                           dxf_entity_name);
00729                         dxf_attrib_set_hor_align (attrib, 0);
00730                         dxf_attrib_set_vert_align (attrib, 0);
00731                 }
00732                 else
00733                 {
00734                         fprintf (fp->fp, " 11\n%f\n", dxf_attrib_get_x1 (attrib));
00735                         fprintf (fp->fp, " 21\n%f\n", dxf_attrib_get_y1 (attrib));
00736                         fprintf (fp->fp, " 31\n%f\n", dxf_attrib_get_z1 (attrib));
00737                 }
00738         }
00739         if ((fp->acad_version_number >= AutoCAD_12)
00740                 && (dxf_attrib_get_extr_x0 (attrib) != 0.0)
00741                 && (dxf_attrib_get_extr_y0 (attrib) != 0.0)
00742                 && (dxf_attrib_get_extr_z0 (attrib) != 1.0))
00743         {
00744                 fprintf (fp->fp, "210\n%f\n", dxf_attrib_get_extr_x0 (attrib));
00745                 fprintf (fp->fp, "220\n%f\n", dxf_attrib_get_extr_y0 (attrib));
00746                 fprintf (fp->fp, "230\n%f\n", dxf_attrib_get_extr_z0 (attrib));
00747         }
00748         /* Clean up. */
00749         free (dxf_entity_name);
00750 #if DEBUG
00751         DXF_DEBUG_END
00752 #endif
00753         return (EXIT_SUCCESS);
00754 }
00755 
00756 
00764 int
00765 dxf_attrib_free
00766 (
00767         DxfAttrib *attrib
00769 )
00770 {
00771 #if DEBUG
00772         DXF_DEBUG_BEGIN
00773 #endif
00774         if (attrib == NULL)
00775         {
00776                 fprintf (stderr,
00777                   (_("Error in %s () a NULL pointer was passed.\n")),
00778                   __FUNCTION__);
00779                 return (EXIT_FAILURE);
00780         }
00781         if (attrib->next != NULL)
00782         {
00783                 fprintf (stderr,
00784                   (_("Error in %s () pointer to next was not NULL.\n")),
00785                   __FUNCTION__);
00786                 return (EXIT_FAILURE);
00787         }
00788         free (attrib->linetype);
00789         free (attrib->layer);
00790         free (attrib->default_value);
00791         free (attrib->tag_value);
00792         free (attrib->text_style);
00793         dxf_binary_graphics_data_free_chain (attrib->binary_graphics_data);
00794         free (attrib->dictionary_owner_soft);
00795         free (attrib->material);
00796         free (attrib->dictionary_owner_hard);
00797         free (attrib->plot_style_name);
00798         free (attrib->color_name);
00799         dxf_point_free (attrib->p0);
00800         dxf_point_free (attrib->p1);
00801         free (attrib);
00802         attrib = NULL;
00803 #if DEBUG
00804         DXF_DEBUG_END
00805 #endif
00806         return (EXIT_SUCCESS);
00807 }
00808 
00809 
00814 void
00815 dxf_attrib_free_chain
00816 (
00817         DxfAttrib *attribs
00819 )
00820 {
00821 #ifdef DEBUG
00822         DXF_DEBUG_BEGIN
00823 #endif
00824         if (attribs == NULL)
00825         {
00826                 fprintf (stderr,
00827                   (_("Warning in %s () a NULL pointer was passed.\n")),
00828                   __FUNCTION__);
00829         }
00830         while (attribs != NULL)
00831         {
00832                 struct DxfAttrib *iter = attribs->next;
00833                 dxf_attrib_free (attribs);
00834                 attribs = (DxfAttrib *) iter;
00835         }
00836 #if DEBUG
00837         DXF_DEBUG_END
00838 #endif
00839 }
00840 
00841 
00847 int
00848 dxf_attrib_get_id_code
00849 (
00850         DxfAttrib *attrib
00852 )
00853 {
00854 #if DEBUG
00855         DXF_DEBUG_BEGIN
00856 #endif
00857         /* Do some basic checks. */
00858         if (attrib == NULL)
00859         {
00860                 fprintf (stderr,
00861                   (_("Error in %s () a NULL pointer was passed.\n")),
00862                   __FUNCTION__);
00863                 return (EXIT_FAILURE);
00864         }
00865         if (attrib->id_code < 0)
00866         {
00867                 fprintf (stderr,
00868                   (_("Error in %s () a negative value was found in the id-code member.\n")),
00869                   __FUNCTION__);
00870                 return (EXIT_FAILURE);
00871         }
00872 #if DEBUG
00873         DXF_DEBUG_END
00874 #endif
00875         return (attrib->id_code);
00876 }
00877 
00878 
00882 DxfAttrib *
00883 dxf_attrib_set_id_code
00884 (
00885         DxfAttrib *attrib,
00887         int id_code
00891 )
00892 {
00893 #if DEBUG
00894         DXF_DEBUG_BEGIN
00895 #endif
00896         /* Do some basic checks. */
00897         if (attrib == NULL)
00898         {
00899                 fprintf (stderr,
00900                   (_("Error in %s () a NULL pointer was passed.\n")),
00901                   __FUNCTION__);
00902                 return (NULL);
00903         }
00904         if (id_code < 0)
00905         {
00906                 fprintf (stderr,
00907                   (_("Error in %s () a negative id-code value was passed.\n")),
00908                   __FUNCTION__);
00909                 return (NULL);
00910         }
00911         attrib->id_code = id_code;
00912 #if DEBUG
00913         DXF_DEBUG_END
00914 #endif
00915         return (attrib);
00916 }
00917 
00918 
00924 char *
00925 dxf_attrib_get_linetype
00926 (
00927         DxfAttrib *attrib
00929 )
00930 {
00931 #if DEBUG
00932         DXF_DEBUG_BEGIN
00933 #endif
00934         /* Do some basic checks. */
00935         if (attrib == NULL)
00936         {
00937                 fprintf (stderr,
00938                   (_("Error in %s () a NULL pointer was passed.\n")),
00939                   __FUNCTION__);
00940                 return (NULL);
00941         }
00942         if (attrib->linetype ==  NULL)
00943         {
00944                 fprintf (stderr,
00945                   (_("Error in %s () a NULL pointer was found in the linetype member.\n")),
00946                   __FUNCTION__);
00947                 return (NULL);
00948         }
00949 #if DEBUG
00950         DXF_DEBUG_END
00951 #endif
00952         return (strdup (attrib->linetype));
00953 }
00954 
00955 
00959 DxfAttrib *
00960 dxf_attrib_set_linetype
00961 (
00962         DxfAttrib *attrib,
00964         char *linetype
00966 )
00967 {
00968 #if DEBUG
00969         DXF_DEBUG_BEGIN
00970 #endif
00971         /* Do some basic checks. */
00972         if (attrib == NULL)
00973         {
00974                 fprintf (stderr,
00975                   (_("Error in %s () a NULL pointer was passed.\n")),
00976                   __FUNCTION__);
00977                 return (NULL);
00978         }
00979         if (linetype == NULL)
00980         {
00981                 fprintf (stderr,
00982                   (_("Error in %s () a NULL pointer was passed.\n")),
00983                   __FUNCTION__);
00984                 return (NULL);
00985         }
00986         attrib->linetype = strdup (linetype);
00987 #if DEBUG
00988         DXF_DEBUG_END
00989 #endif
00990         return (attrib);
00991 }
00992 
00993 
00999 char *
01000 dxf_attrib_get_layer
01001 (
01002         DxfAttrib *attrib
01004 )
01005 {
01006 #if DEBUG
01007         DXF_DEBUG_BEGIN
01008 #endif
01009         /* Do some basic checks. */
01010         if (attrib == NULL)
01011         {
01012                 fprintf (stderr,
01013                   (_("Error in %s () a NULL pointer was passed.\n")),
01014                   __FUNCTION__);
01015                 return (NULL);
01016         }
01017         if (attrib->layer ==  NULL)
01018         {
01019                 fprintf (stderr,
01020                   (_("Error in %s () a NULL pointer was found in the layer member.\n")),
01021                   __FUNCTION__);
01022                 return (NULL);
01023         }
01024 #if DEBUG
01025         DXF_DEBUG_END
01026 #endif
01027         return (strdup (attrib->layer));
01028 }
01029 
01030 
01034 DxfAttrib *
01035 dxf_attrib_set_layer
01036 (
01037         DxfAttrib *attrib,
01039         char *layer
01041 )
01042 {
01043 #if DEBUG
01044         DXF_DEBUG_BEGIN
01045 #endif
01046         /* Do some basic checks. */
01047         if (attrib == NULL)
01048         {
01049                 fprintf (stderr,
01050                   (_("Error in %s () a NULL pointer was passed.\n")),
01051                   __FUNCTION__);
01052                 return (NULL);
01053         }
01054         if (layer == NULL)
01055         {
01056                 fprintf (stderr,
01057                   (_("Error in %s () a NULL pointer was passed.\n")),
01058                   __FUNCTION__);
01059                 return (NULL);
01060         }
01061         attrib->layer = strdup (layer);
01062 #if DEBUG
01063         DXF_DEBUG_END
01064 #endif
01065         return (attrib);
01066 }
01067 
01068 
01074 double
01075 dxf_attrib_get_elevation
01076 (
01077         DxfAttrib *attrib
01079 )
01080 {
01081 #if DEBUG
01082         DXF_DEBUG_BEGIN
01083 #endif
01084         /* Do some basic checks. */
01085         if (attrib == NULL)
01086         {
01087                 fprintf (stderr,
01088                   (_("Error in %s () a NULL pointer was passed.\n")),
01089                   __FUNCTION__);
01090                 return (EXIT_FAILURE);
01091         }
01092 #if DEBUG
01093         DXF_DEBUG_END
01094 #endif
01095         return (attrib->elevation);
01096 }
01097 
01098 
01102 DxfAttrib *
01103 dxf_attrib_set_elevation
01104 (
01105         DxfAttrib *attrib,
01107         double elevation
01109 )
01110 {
01111 #if DEBUG
01112         DXF_DEBUG_BEGIN
01113 #endif
01114         /* Do some basic checks. */
01115         if (attrib == NULL)
01116         {
01117                 fprintf (stderr,
01118                   (_("Error in %s () a NULL pointer was passed.\n")),
01119                   __FUNCTION__);
01120                 return (NULL);
01121         }
01122         attrib->elevation = elevation;
01123 #if DEBUG
01124         DXF_DEBUG_END
01125 #endif
01126         return (attrib);
01127 }
01128 
01129 
01135 double
01136 dxf_attrib_get_thickness
01137 (
01138         DxfAttrib *attrib
01140 )
01141 {
01142 #if DEBUG
01143         DXF_DEBUG_BEGIN
01144 #endif
01145         /* Do some basic checks. */
01146         if (attrib == NULL)
01147         {
01148                 fprintf (stderr,
01149                   (_("Error in %s () a NULL pointer was passed.\n")),
01150                   __FUNCTION__);
01151                 return (EXIT_FAILURE);
01152         }
01153         if (attrib->thickness < 0.0)
01154         {
01155                 fprintf (stderr,
01156                   (_("Error in %s () a negative value was found in the thickness member.\n")),
01157                   __FUNCTION__);
01158                 return (EXIT_FAILURE);
01159         }
01160 #if DEBUG
01161         DXF_DEBUG_END
01162 #endif
01163         return (attrib->thickness);
01164 }
01165 
01166 
01170 DxfAttrib *
01171 dxf_attrib_set_thickness
01172 (
01173         DxfAttrib *attrib,
01175         double thickness
01177 )
01178 {
01179 #if DEBUG
01180         DXF_DEBUG_BEGIN
01181 #endif
01182         /* Do some basic checks. */
01183         if (attrib == NULL)
01184         {
01185                 fprintf (stderr,
01186                   (_("Error in %s () a NULL pointer was passed.\n")),
01187                   __FUNCTION__);
01188                 return (NULL);
01189         }
01190         if (thickness < 0.0)
01191         {
01192                 fprintf (stderr,
01193                   (_("Error in %s () a negative thickness value was passed.\n")),
01194                   __FUNCTION__);
01195                 return (NULL);
01196         }
01197         attrib->thickness = thickness;
01198 #if DEBUG
01199         DXF_DEBUG_END
01200 #endif
01201         return (attrib);
01202 }
01203 
01204 
01210 double
01211 dxf_attrib_get_linetype_scale
01212 (
01213         DxfAttrib *attrib
01215 )
01216 {
01217 #if DEBUG
01218         DXF_DEBUG_BEGIN
01219 #endif
01220         /* Do some basic checks. */
01221         if (attrib == NULL)
01222         {
01223                 fprintf (stderr,
01224                   (_("Error in %s () a NULL pointer was passed.\n")),
01225                   __FUNCTION__);
01226                 return (EXIT_FAILURE);
01227         }
01228         if (attrib->linetype_scale < 0.0)
01229         {
01230                 fprintf (stderr,
01231                   (_("Error in %s () a negative value was found in the linetype scale member.\n")),
01232                   __FUNCTION__);
01233                 return (EXIT_FAILURE);
01234         }
01235 #if DEBUG
01236         DXF_DEBUG_END
01237 #endif
01238         return (attrib->linetype_scale);
01239 }
01240 
01241 
01245 DxfAttrib *
01246 dxf_attrib_set_linetype_scale
01247 (
01248         DxfAttrib *attrib,
01250         double linetype_scale
01252 )
01253 {
01254 #if DEBUG
01255         DXF_DEBUG_BEGIN
01256 #endif
01257         /* Do some basic checks. */
01258         if (attrib == NULL)
01259         {
01260                 fprintf (stderr,
01261                   (_("Error in %s () a NULL pointer was passed.\n")),
01262                   __FUNCTION__);
01263                 return (NULL);
01264         }
01265         if (linetype_scale < 0.0)
01266         {
01267                 fprintf (stderr,
01268                   (_("Error in %s () a negative linetype scale value was passed.\n")),
01269                   __FUNCTION__);
01270                 return (NULL);
01271         }
01272         attrib->linetype_scale = linetype_scale;
01273 #if DEBUG
01274         DXF_DEBUG_END
01275 #endif
01276         return (attrib);
01277 }
01278 
01279 
01285 int16_t
01286 dxf_attrib_get_visibility
01287 (
01288         DxfAttrib *attrib
01290 )
01291 {
01292 #if DEBUG
01293         DXF_DEBUG_BEGIN
01294 #endif
01295         /* Do some basic checks. */
01296         if (attrib == NULL)
01297         {
01298                 fprintf (stderr,
01299                   (_("Error in %s () a NULL pointer was passed.\n")),
01300                   __FUNCTION__);
01301                 return (EXIT_FAILURE);
01302         }
01303         if (attrib->visibility < 0)
01304         {
01305                 fprintf (stderr,
01306                   (_("Error in %s () a negative value was found in the visibility member.\n")),
01307                   __FUNCTION__);
01308                 return (EXIT_FAILURE);
01309         }
01310         if (attrib->visibility > 1)
01311         {
01312                 fprintf (stderr,
01313                   (_("Error in %s () an out of range value was found in the visibility member.\n")),
01314                   __FUNCTION__);
01315                 return (EXIT_FAILURE);
01316         }
01317 #if DEBUG
01318         DXF_DEBUG_END
01319 #endif
01320         return (attrib->visibility);
01321 }
01322 
01323 
01327 DxfAttrib *
01328 dxf_attrib_set_visibility
01329 (
01330         DxfAttrib *attrib,
01332         int16_t visibility
01334 )
01335 {
01336 #if DEBUG
01337         DXF_DEBUG_BEGIN
01338 #endif
01339         /* Do some basic checks. */
01340         if (attrib == NULL)
01341         {
01342                 fprintf (stderr,
01343                   (_("Error in %s () a NULL pointer was passed.\n")),
01344                   __FUNCTION__);
01345                 return (NULL);
01346         }
01347         if (visibility < 0)
01348         {
01349                 fprintf (stderr,
01350                   (_("Error in %s () a negative visibility value was passed.\n")),
01351                   __FUNCTION__);
01352                 return (NULL);
01353         }
01354         if (visibility > 1)
01355         {
01356                 fprintf (stderr,
01357                   (_("Error in %s () an out of range visibility value was passed.\n")),
01358                   __FUNCTION__);
01359                 return (NULL);
01360         }
01361         attrib->visibility = visibility;
01362 #if DEBUG
01363         DXF_DEBUG_END
01364 #endif
01365         return (attrib);
01366 }
01367 
01368 
01374 int
01375 dxf_attrib_get_color
01376 (
01377         DxfAttrib *attrib
01379 )
01380 {
01381 #if DEBUG
01382         DXF_DEBUG_BEGIN
01383 #endif
01384         /* Do some basic checks. */
01385         if (attrib == NULL)
01386         {
01387                 fprintf (stderr,
01388                   (_("Error in %s () a NULL pointer was passed.\n")),
01389                   __FUNCTION__);
01390                 return (EXIT_FAILURE);
01391         }
01392         if (attrib->color < 0)
01393         {
01394                 fprintf (stderr,
01395                   (_("Warning in %s () a negative value was found in the color member.\n")),
01396                   __FUNCTION__);
01397         }
01398 #if DEBUG
01399         DXF_DEBUG_END
01400 #endif
01401         return (attrib->color);
01402 }
01403 
01404 
01408 DxfAttrib *
01409 dxf_attrib_set_color
01410 (
01411         DxfAttrib *attrib,
01413         int color
01415 )
01416 {
01417 #if DEBUG
01418         DXF_DEBUG_BEGIN
01419 #endif
01420         /* Do some basic checks. */
01421         if (attrib == NULL)
01422         {
01423                 fprintf (stderr,
01424                   (_("Error in %s () a NULL pointer was passed.\n")),
01425                   __FUNCTION__);
01426                 return (NULL);
01427         }
01428         if (color < 0)
01429         {
01430                 fprintf (stderr,
01431                   (_("Warning in %s () a negative color value was passed.\n")),
01432                   __FUNCTION__);
01433                 fprintf (stderr,
01434                   (_("\teffectively turning this entity it's visibility off.\n")));
01435         }
01436         attrib->color = color;
01437 #if DEBUG
01438         DXF_DEBUG_END
01439 #endif
01440         return (attrib);
01441 }
01442 
01443 
01449 int
01450 dxf_attrib_get_paperspace
01451 (
01452         DxfAttrib *attrib
01454 )
01455 {
01456 #if DEBUG
01457         DXF_DEBUG_BEGIN
01458 #endif
01459         /* Do some basic checks. */
01460         if (attrib == NULL)
01461         {
01462                 fprintf (stderr,
01463                   (_("Error in %s () a NULL pointer was passed.\n")),
01464                   __FUNCTION__);
01465                 return (EXIT_FAILURE);
01466         }
01467         if (attrib->paperspace < 0)
01468         {
01469                 fprintf (stderr,
01470                   (_("Warning in %s () a negative value was found in the paperspace member.\n")),
01471                   __FUNCTION__);
01472         }
01473         if (attrib->paperspace > 1)
01474         {
01475                 fprintf (stderr,
01476                   (_("Warning in %s () an out of range value was found in the paperspace member.\n")),
01477                   __FUNCTION__);
01478         }
01479 #if DEBUG
01480         DXF_DEBUG_END
01481 #endif
01482         return (attrib->paperspace);
01483 }
01484 
01485 
01489 DxfAttrib *
01490 dxf_attrib_set_paperspace
01491 (
01492         DxfAttrib *attrib,
01494         int paperspace
01496 )
01497 {
01498 #if DEBUG
01499         DXF_DEBUG_BEGIN
01500 #endif
01501         /* Do some basic checks. */
01502         if (attrib == NULL)
01503         {
01504                 fprintf (stderr,
01505                   (_("Error in %s () a NULL pointer was passed.\n")),
01506                   __FUNCTION__);
01507                 return (NULL);
01508         }
01509         if (paperspace < 0)
01510         {
01511                 fprintf (stderr,
01512                   (_("Error in %s () a negative paperspace value was passed.\n")),
01513                   __FUNCTION__);
01514                 return (NULL);
01515         }
01516         if (paperspace > 1)
01517         {
01518                 fprintf (stderr,
01519                   (_("Error in %s () an out of range paperspace value was passed.\n")),
01520                   __FUNCTION__);
01521                 return (NULL);
01522         }
01523         attrib->paperspace = paperspace;
01524 #if DEBUG
01525         DXF_DEBUG_END
01526 #endif
01527         return (attrib);
01528 }
01529 
01530 
01538 int
01539 dxf_attrib_get_graphics_data_size
01540 (
01541         DxfAttrib *attrib
01543 )
01544 {
01545 #if DEBUG
01546         DXF_DEBUG_BEGIN
01547 #endif
01548         /* Do some basic checks. */
01549         if (attrib == NULL)
01550         {
01551                 fprintf (stderr,
01552                   (_("Error in %s () a NULL pointer was passed.\n")),
01553                   __FUNCTION__);
01554                 return (EXIT_FAILURE);
01555         }
01556         if (attrib->graphics_data_size < 0)
01557         {
01558                 fprintf (stderr,
01559                   (_("Warning in %s () a negative value was found in the graphics_data_size member.\n")),
01560                   __FUNCTION__);
01561         }
01562         if (attrib->graphics_data_size == 0)
01563         {
01564                 fprintf (stderr,
01565                   (_("Warning in %s () a zero value was found in the graphics_data_size member.\n")),
01566                   __FUNCTION__);
01567         }
01568 #if DEBUG
01569         DXF_DEBUG_END
01570 #endif
01571         return (attrib->graphics_data_size);
01572 }
01573 
01574 
01582 DxfAttrib *
01583 dxf_attrib_set_graphics_data_size
01584 (
01585         DxfAttrib *attrib,
01587         int graphics_data_size
01590 )
01591 {
01592 #if DEBUG
01593         DXF_DEBUG_BEGIN
01594 #endif
01595         /* Do some basic checks. */
01596         if (attrib == NULL)
01597         {
01598                 fprintf (stderr,
01599                   (_("Error in %s () a NULL pointer was passed.\n")),
01600                   __FUNCTION__);
01601                 return (NULL);
01602         }
01603         if (graphics_data_size < 0)
01604         {
01605                 fprintf (stderr,
01606                   (_("Error in %s () a negative graphics_data_size value was passed.\n")),
01607                   __FUNCTION__);
01608                 return (NULL);
01609         }
01610         if (graphics_data_size == 0)
01611         {
01612                 fprintf (stderr,
01613                   (_("Warning in %s () a zero graphics_data_size value was passed.\n")),
01614                   __FUNCTION__);
01615         }
01616         attrib->graphics_data_size = graphics_data_size;
01617 #if DEBUG
01618         DXF_DEBUG_END
01619 #endif
01620         return (attrib);
01621 }
01622 
01623 
01630 int16_t
01631 dxf_attrib_get_shadow_mode
01632 (
01633         DxfAttrib *attrib
01635 )
01636 {
01637 #if DEBUG
01638         DXF_DEBUG_BEGIN
01639 #endif
01640         /* Do some basic checks. */
01641         if (attrib == NULL)
01642         {
01643                 fprintf (stderr,
01644                   (_("Error in %s () a NULL pointer was passed.\n")),
01645                   __FUNCTION__);
01646                 return (EXIT_FAILURE);
01647         }
01648         if (attrib->shadow_mode < 0)
01649         {
01650                 fprintf (stderr,
01651                   (_("Error in %s () a negative value was found in the shadow_mode member.\n")),
01652                   __FUNCTION__);
01653                 return (EXIT_FAILURE);
01654         }
01655         if (attrib->shadow_mode > 3)
01656         {
01657                 fprintf (stderr,
01658                   (_("Error in %s () an out of range value was found in the shadow_mode member.\n")),
01659                   __FUNCTION__);
01660                 return (EXIT_FAILURE);
01661         }
01662 #if DEBUG
01663         DXF_DEBUG_END
01664 #endif
01665         return (attrib->shadow_mode);
01666 }
01667 
01668 
01675 DxfAttrib *
01676 dxf_attrib_set_shadow_mode
01677 (
01678         DxfAttrib *attrib,
01680         int16_t shadow_mode
01682 )
01683 {
01684 #if DEBUG
01685         DXF_DEBUG_BEGIN
01686 #endif
01687         /* Do some basic checks. */
01688         if (attrib == NULL)
01689         {
01690                 fprintf (stderr,
01691                   (_("Error in %s () a NULL pointer was passed.\n")),
01692                   __FUNCTION__);
01693                 return (NULL);
01694         }
01695         if (shadow_mode < 0)
01696         {
01697                 fprintf (stderr,
01698                   (_("Error in %s () a negative shadow_mode value was passed.\n")),
01699                   __FUNCTION__);
01700                 return (NULL);
01701         }
01702         if (shadow_mode > 3)
01703         {
01704                 fprintf (stderr,
01705                   (_("Error in %s () an out of range shadow_mode value was passed.\n")),
01706                   __FUNCTION__);
01707                 return (NULL);
01708         }
01709         attrib->shadow_mode = shadow_mode;
01710 #if DEBUG
01711         DXF_DEBUG_END
01712 #endif
01713         return (attrib);
01714 }
01715 
01716 
01725 DxfBinaryGraphicsData *
01726 dxf_attrib_get_binary_graphics_data
01727 (
01728         DxfAttrib *attrib
01730 )
01731 {
01732 #if DEBUG
01733         DXF_DEBUG_BEGIN
01734 #endif
01735         /* Do some basic checks. */
01736         if (attrib == NULL)
01737         {
01738                 fprintf (stderr,
01739                   (_("Error in %s () a NULL pointer was passed.\n")),
01740                   __FUNCTION__);
01741                 return (NULL);
01742         }
01743         if (attrib->binary_graphics_data ==  NULL)
01744         {
01745                 fprintf (stderr,
01746                   (_("Error in %s () a NULL pointer was found in the binary_graphics_data member.\n")),
01747                   __FUNCTION__);
01748                 return (NULL);
01749         }
01750 #if DEBUG
01751         DXF_DEBUG_END
01752 #endif
01753         return ((DxfBinaryGraphicsData *) attrib->binary_graphics_data);
01754 }
01755 
01756 
01761 DxfAttrib *
01762 dxf_attrib_set_binary_graphics_data
01763 (
01764         DxfAttrib *attrib,
01766         DxfBinaryGraphicsData *data
01769 )
01770 {
01771 #if DEBUG
01772         DXF_DEBUG_BEGIN
01773 #endif
01774         /* Do some basic checks. */
01775         if (attrib == NULL)
01776         {
01777                 fprintf (stderr,
01778                   (_("Error in %s () a NULL pointer was passed.\n")),
01779                   __FUNCTION__);
01780                 return (NULL);
01781         }
01782         if (data == NULL)
01783         {
01784                 fprintf (stderr,
01785                   (_("Error in %s () a NULL pointer was passed.\n")),
01786                   __FUNCTION__);
01787                 return (NULL);
01788         }
01789         attrib->binary_graphics_data = (DxfBinaryGraphicsData *) data;
01790 #if DEBUG
01791         DXF_DEBUG_END
01792 #endif
01793         return (attrib);
01794 }
01795 
01796 
01805 char *
01806 dxf_attrib_get_dictionary_owner_soft
01807 (
01808         DxfAttrib *attrib
01810 )
01811 {
01812 #if DEBUG
01813         DXF_DEBUG_BEGIN
01814 #endif
01815         /* Do some basic checks. */
01816         if (attrib == NULL)
01817         {
01818                 fprintf (stderr,
01819                   (_("Error in %s () a NULL pointer was passed.\n")),
01820                   __FUNCTION__);
01821                 return (NULL);
01822         }
01823         if (attrib->dictionary_owner_soft ==  NULL)
01824         {
01825                 fprintf (stderr,
01826                   (_("Error in %s () a NULL pointer was found in the dictionary_owner_soft member.\n")),
01827                   __FUNCTION__);
01828                 return (NULL);
01829         }
01830 #if DEBUG
01831         DXF_DEBUG_END
01832 #endif
01833         return (strdup (attrib->dictionary_owner_soft));
01834 }
01835 
01836 
01841 DxfAttrib *
01842 dxf_attrib_set_dictionary_owner_soft
01843 (
01844         DxfAttrib *attrib,
01846         char *dictionary_owner_soft
01849 )
01850 {
01851 #if DEBUG
01852         DXF_DEBUG_BEGIN
01853 #endif
01854         /* Do some basic checks. */
01855         if (attrib == NULL)
01856         {
01857                 fprintf (stderr,
01858                   (_("Error in %s () a NULL pointer was passed.\n")),
01859                   __FUNCTION__);
01860                 return (NULL);
01861         }
01862         if (dictionary_owner_soft == NULL)
01863         {
01864                 fprintf (stderr,
01865                   (_("Error in %s () a NULL pointer was passed.\n")),
01866                   __FUNCTION__);
01867                 return (NULL);
01868         }
01869         attrib->dictionary_owner_soft = strdup (dictionary_owner_soft);
01870 #if DEBUG
01871         DXF_DEBUG_END
01872 #endif
01873         return (attrib);
01874 }
01875 
01876 
01885 char *
01886 dxf_attrib_get_material
01887 (
01888         DxfAttrib *attrib
01890 )
01891 {
01892 #if DEBUG
01893         DXF_DEBUG_BEGIN
01894 #endif
01895         /* Do some basic checks. */
01896         if (attrib == NULL)
01897         {
01898                 fprintf (stderr,
01899                   (_("Error in %s () a NULL pointer was passed.\n")),
01900                   __FUNCTION__);
01901                 return (NULL);
01902         }
01903         if (attrib->material ==  NULL)
01904         {
01905                 fprintf (stderr,
01906                   (_("Error in %s () a NULL pointer was found in the material member.\n")),
01907                   __FUNCTION__);
01908                 return (NULL);
01909         }
01910 #if DEBUG
01911         DXF_DEBUG_END
01912 #endif
01913         return (strdup (attrib->material));
01914 }
01915 
01916 
01923 DxfAttrib *
01924 dxf_attrib_set_material
01925 (
01926         DxfAttrib *attrib,
01928         char *material
01931 )
01932 {
01933 #if DEBUG
01934         DXF_DEBUG_BEGIN
01935 #endif
01936         /* Do some basic checks. */
01937         if (attrib == NULL)
01938         {
01939                 fprintf (stderr,
01940                   (_("Error in %s () a NULL pointer was passed.\n")),
01941                   __FUNCTION__);
01942                 return (NULL);
01943         }
01944         if (material == NULL)
01945         {
01946                 fprintf (stderr,
01947                   (_("Error in %s () a NULL pointer was passed.\n")),
01948                   __FUNCTION__);
01949                 return (NULL);
01950         }
01951         attrib->material = strdup (material);
01952 #if DEBUG
01953         DXF_DEBUG_END
01954 #endif
01955         return (attrib);
01956 }
01957 
01958 
01967 char *
01968 dxf_attrib_get_dictionary_owner_hard
01969 (
01970         DxfAttrib *attrib
01972 )
01973 {
01974 #if DEBUG
01975         DXF_DEBUG_BEGIN
01976 #endif
01977         /* Do some basic checks. */
01978         if (attrib == NULL)
01979         {
01980                 fprintf (stderr,
01981                   (_("Error in %s () a NULL pointer was passed.\n")),
01982                   __FUNCTION__);
01983                 return (NULL);
01984         }
01985         if (attrib->dictionary_owner_hard ==  NULL)
01986         {
01987                 fprintf (stderr,
01988                   (_("Error in %s () a NULL pointer was found in the dictionary_owner_hard member.\n")),
01989                   __FUNCTION__);
01990                 return (NULL);
01991         }
01992 #if DEBUG
01993         DXF_DEBUG_END
01994 #endif
01995         return (strdup (attrib->dictionary_owner_hard));
01996 }
01997 
01998 
02003 DxfAttrib *
02004 dxf_attrib_set_dictionary_owner_hard
02005 (
02006         DxfAttrib *attrib,
02008         char *dictionary_owner_hard
02011 )
02012 {
02013 #if DEBUG
02014         DXF_DEBUG_BEGIN
02015 #endif
02016         /* Do some basic checks. */
02017         if (attrib == NULL)
02018         {
02019                 fprintf (stderr,
02020                   (_("Error in %s () a NULL pointer was passed.\n")),
02021                   __FUNCTION__);
02022                 return (NULL);
02023         }
02024         if (dictionary_owner_hard == NULL)
02025         {
02026                 fprintf (stderr,
02027                   (_("Error in %s () a NULL pointer was passed.\n")),
02028                   __FUNCTION__);
02029                 return (NULL);
02030         }
02031         attrib->dictionary_owner_hard = strdup (dictionary_owner_hard);
02032 #if DEBUG
02033         DXF_DEBUG_END
02034 #endif
02035         return (attrib);
02036 }
02037 
02038 
02045 int16_t
02046 dxf_attrib_get_lineweight
02047 (
02048         DxfAttrib *attrib
02050 )
02051 {
02052 #if DEBUG
02053         DXF_DEBUG_BEGIN
02054 #endif
02055         /* Do some basic checks. */
02056         if (attrib == NULL)
02057         {
02058                 fprintf (stderr,
02059                   (_("Error in %s () a NULL pointer was passed.\n")),
02060                   __FUNCTION__);
02061                 return (EXIT_FAILURE);
02062         }
02063 #if DEBUG
02064         DXF_DEBUG_END
02065 #endif
02066         return (attrib->lineweight);
02067 }
02068 
02069 
02076 DxfAttrib *
02077 dxf_attrib_set_lineweight
02078 (
02079         DxfAttrib *attrib,
02081         int16_t lineweight
02083 )
02084 {
02085 #if DEBUG
02086         DXF_DEBUG_BEGIN
02087 #endif
02088         /* Do some basic checks. */
02089         if (attrib == NULL)
02090         {
02091                 fprintf (stderr,
02092                   (_("Error in %s () a NULL pointer was passed.\n")),
02093                   __FUNCTION__);
02094                 return (NULL);
02095         }
02096         attrib->lineweight = lineweight;
02097 #if DEBUG
02098         DXF_DEBUG_END
02099 #endif
02100         return (attrib);
02101 }
02102 
02103 
02110 char *
02111 dxf_attrib_get_plot_style_name
02112 (
02113         DxfAttrib *attrib
02115 )
02116 {
02117 #if DEBUG
02118         DXF_DEBUG_BEGIN
02119 #endif
02120         /* Do some basic checks. */
02121         if (attrib == NULL)
02122         {
02123                 fprintf (stderr,
02124                   (_("Error in %s () a NULL pointer was passed.\n")),
02125                   __FUNCTION__);
02126                 return (NULL);
02127         }
02128         if (attrib->plot_style_name ==  NULL)
02129         {
02130                 fprintf (stderr,
02131                   (_("Error in %s () a NULL pointer was found in the plot_style_name member.\n")),
02132                   __FUNCTION__);
02133                 return (NULL);
02134         }
02135 #if DEBUG
02136         DXF_DEBUG_END
02137 #endif
02138         return (strdup (attrib->plot_style_name));
02139 }
02140 
02141 
02148 DxfAttrib *
02149 dxf_attrib_set_plot_style_name
02150 (
02151         DxfAttrib *attrib,
02153         char *plot_style_name
02156 )
02157 {
02158 #if DEBUG
02159         DXF_DEBUG_BEGIN
02160 #endif
02161         /* Do some basic checks. */
02162         if (attrib == NULL)
02163         {
02164                 fprintf (stderr,
02165                   (_("Error in %s () a NULL pointer was passed.\n")),
02166                   __FUNCTION__);
02167                 return (NULL);
02168         }
02169         if (plot_style_name == NULL)
02170         {
02171                 fprintf (stderr,
02172                   (_("Error in %s () a NULL pointer was passed.\n")),
02173                   __FUNCTION__);
02174                 return (NULL);
02175         }
02176         attrib->plot_style_name = strdup (plot_style_name);
02177 #if DEBUG
02178         DXF_DEBUG_END
02179 #endif
02180         return (attrib);
02181 }
02182 
02183 
02190 long
02191 dxf_attrib_get_color_value
02192 (
02193         DxfAttrib *attrib
02195 )
02196 {
02197 #if DEBUG
02198         DXF_DEBUG_BEGIN
02199 #endif
02200         /* Do some basic checks. */
02201         if (attrib == NULL)
02202         {
02203                 fprintf (stderr,
02204                   (_("Error in %s () a NULL pointer was passed.\n")),
02205                   __FUNCTION__);
02206                 return (EXIT_FAILURE);
02207         }
02208 #if DEBUG
02209         DXF_DEBUG_END
02210 #endif
02211         return (attrib->color_value);
02212 }
02213 
02214 
02221 DxfAttrib *
02222 dxf_attrib_set_color_value
02223 (
02224         DxfAttrib *attrib,
02226         long color_value
02228 )
02229 {
02230 #if DEBUG
02231         DXF_DEBUG_BEGIN
02232 #endif
02233         /* Do some basic checks. */
02234         if (attrib == NULL)
02235         {
02236                 fprintf (stderr,
02237                   (_("Error in %s () a NULL pointer was passed.\n")),
02238                   __FUNCTION__);
02239                 return (NULL);
02240         }
02241         attrib->color_value = color_value;
02242 #if DEBUG
02243         DXF_DEBUG_END
02244 #endif
02245         return (attrib);
02246 }
02247 
02248 
02255 char *
02256 dxf_attrib_get_color_name
02257 (
02258         DxfAttrib *attrib
02260 )
02261 {
02262 #if DEBUG
02263         DXF_DEBUG_BEGIN
02264 #endif
02265         /* Do some basic checks. */
02266         if (attrib == NULL)
02267         {
02268                 fprintf (stderr,
02269                   (_("Error in %s () a NULL pointer was passed.\n")),
02270                   __FUNCTION__);
02271                 return (NULL);
02272         }
02273         if (attrib->color_name ==  NULL)
02274         {
02275                 fprintf (stderr,
02276                   (_("Error in %s () a NULL pointer was found in the color_name member.\n")),
02277                   __FUNCTION__);
02278                 return (NULL);
02279         }
02280 #if DEBUG
02281         DXF_DEBUG_END
02282 #endif
02283         return (strdup (attrib->color_name));
02284 }
02285 
02286 
02293 DxfAttrib *
02294 dxf_attrib_set_color_name
02295 (
02296         DxfAttrib *attrib,
02298         char *color_name
02301 )
02302 {
02303 #if DEBUG
02304         DXF_DEBUG_BEGIN
02305 #endif
02306         /* Do some basic checks. */
02307         if (attrib == NULL)
02308         {
02309                 fprintf (stderr,
02310                   (_("Error in %s () a NULL pointer was passed.\n")),
02311                   __FUNCTION__);
02312                 return (NULL);
02313         }
02314         if (color_name == NULL)
02315         {
02316                 fprintf (stderr,
02317                   (_("Error in %s () a NULL pointer was passed.\n")),
02318                   __FUNCTION__);
02319                 return (NULL);
02320         }
02321         attrib->color_name = strdup (color_name);
02322 #if DEBUG
02323         DXF_DEBUG_END
02324 #endif
02325         return (attrib);
02326 }
02327 
02328 
02335 long
02336 dxf_attrib_get_transparency
02337 (
02338         DxfAttrib *attrib
02340 )
02341 {
02342 #if DEBUG
02343         DXF_DEBUG_BEGIN
02344 #endif
02345         /* Do some basic checks. */
02346         if (attrib == NULL)
02347         {
02348                 fprintf (stderr,
02349                   (_("Error in %s () a NULL pointer was passed.\n")),
02350                   __FUNCTION__);
02351                 return (EXIT_FAILURE);
02352         }
02353 #if DEBUG
02354         DXF_DEBUG_END
02355 #endif
02356         return (attrib->transparency);
02357 }
02358 
02359 
02366 DxfAttrib *
02367 dxf_attrib_set_transparency
02368 (
02369         DxfAttrib *attrib,
02371         long transparency
02373 )
02374 {
02375 #if DEBUG
02376         DXF_DEBUG_BEGIN
02377 #endif
02378         /* Do some basic checks. */
02379         if (attrib == NULL)
02380         {
02381                 fprintf (stderr,
02382                   (_("Error in %s () a NULL pointer was passed.\n")),
02383                   __FUNCTION__);
02384                 return (NULL);
02385         }
02386         attrib->transparency = transparency;
02387 #if DEBUG
02388         DXF_DEBUG_END
02389 #endif
02390         return (attrib);
02391 }
02392 
02393 
02401 char *
02402 dxf_attrib_get_default_value
02403 (
02404         DxfAttrib *attrib
02406 )
02407 {
02408 #if DEBUG
02409         DXF_DEBUG_BEGIN
02410 #endif
02411         /* Do some basic checks. */
02412         if (attrib == NULL)
02413         {
02414                 fprintf (stderr,
02415                   (_("Error in %s () a NULL pointer was passed.\n")),
02416                   __FUNCTION__);
02417                 return (NULL);
02418         }
02419         if (attrib->default_value ==  NULL)
02420         {
02421                 fprintf (stderr,
02422                   (_("Error in %s () a NULL pointer was found in the default_value member.\n")),
02423                   __FUNCTION__);
02424                 return (NULL);
02425         }
02426 #if DEBUG
02427         DXF_DEBUG_END
02428 #endif
02429         return (strdup (attrib->default_value));
02430 }
02431 
02432 
02436 DxfAttrib *
02437 dxf_attrib_set_default_value
02438 (
02439         DxfAttrib *attrib,
02441         char *default_value
02444 )
02445 {
02446 #if DEBUG
02447         DXF_DEBUG_BEGIN
02448 #endif
02449         /* Do some basic checks. */
02450         if (attrib == NULL)
02451         {
02452                 fprintf (stderr,
02453                   (_("Error in %s () a NULL pointer was passed.\n")),
02454                   __FUNCTION__);
02455                 return (NULL);
02456         }
02457         if (default_value == NULL)
02458         {
02459                 fprintf (stderr,
02460                   (_("Error in %s () a NULL pointer was passed.\n")),
02461                   __FUNCTION__);
02462                 return (NULL);
02463         }
02464         attrib->default_value = strdup (default_value);
02465 #if DEBUG
02466         DXF_DEBUG_END
02467 #endif
02468         return (attrib);
02469 }
02470 
02471 
02479 char *
02480 dxf_attrib_get_tag_value
02481 (
02482         DxfAttrib *attrib
02484 )
02485 {
02486 #if DEBUG
02487         DXF_DEBUG_BEGIN
02488 #endif
02489         /* Do some basic checks. */
02490         if (attrib == NULL)
02491         {
02492                 fprintf (stderr,
02493                   (_("Error in %s () a NULL pointer was passed.\n")),
02494                   __FUNCTION__);
02495                 return (NULL);
02496         }
02497         if (attrib->tag_value ==  NULL)
02498         {
02499                 fprintf (stderr,
02500                   (_("Error in %s () a NULL pointer was found in the tag_value member.\n")),
02501                   __FUNCTION__);
02502                 return (NULL);
02503         }
02504 #if DEBUG
02505         DXF_DEBUG_END
02506 #endif
02507         return (strdup (attrib->tag_value));
02508 }
02509 
02510 
02514 DxfAttrib *
02515 dxf_attrib_set_tag_value
02516 (
02517         DxfAttrib *attrib,
02519         char *tag_value
02522 )
02523 {
02524 #if DEBUG
02525         DXF_DEBUG_BEGIN
02526 #endif
02527         /* Do some basic checks. */
02528         if (attrib == NULL)
02529         {
02530                 fprintf (stderr,
02531                   (_("Error in %s () a NULL pointer was passed.\n")),
02532                   __FUNCTION__);
02533                 return (NULL);
02534         }
02535         if (tag_value == NULL)
02536         {
02537                 fprintf (stderr,
02538                   (_("Error in %s () a NULL pointer was passed.\n")),
02539                   __FUNCTION__);
02540                 return (NULL);
02541         }
02542         attrib->tag_value = strdup (tag_value);
02543 #if DEBUG
02544         DXF_DEBUG_END
02545 #endif
02546         return (attrib);
02547 }
02548 
02549 
02557 char *
02558 dxf_attrib_get_text_style
02559 (
02560         DxfAttrib *attrib
02562 )
02563 {
02564 #if DEBUG
02565         DXF_DEBUG_BEGIN
02566 #endif
02567         /* Do some basic checks. */
02568         if (attrib == NULL)
02569         {
02570                 fprintf (stderr,
02571                   (_("Error in %s () a NULL pointer was passed.\n")),
02572                   __FUNCTION__);
02573                 return (NULL);
02574         }
02575         if (attrib->text_style ==  NULL)
02576         {
02577                 fprintf (stderr,
02578                   (_("Error in %s () a NULL pointer was found in the tag_value member.\n")),
02579                   __FUNCTION__);
02580                 return (NULL);
02581         }
02582 #if DEBUG
02583         DXF_DEBUG_END
02584 #endif
02585         return (strdup (attrib->text_style));
02586 }
02587 
02588 
02592 DxfAttrib *
02593 dxf_attrib_set_text_style
02594 (
02595         DxfAttrib *attrib,
02597         char *text_style
02600 )
02601 {
02602 #if DEBUG
02603         DXF_DEBUG_BEGIN
02604 #endif
02605         /* Do some basic checks. */
02606         if (attrib == NULL)
02607         {
02608                 fprintf (stderr,
02609                   (_("Error in %s () a NULL pointer was passed.\n")),
02610                   __FUNCTION__);
02611                 return (NULL);
02612         }
02613         if (text_style == NULL)
02614         {
02615                 fprintf (stderr,
02616                   (_("Error in %s () a NULL pointer was passed.\n")),
02617                   __FUNCTION__);
02618                 return (NULL);
02619         }
02620         attrib->text_style = strdup (text_style);
02621 #if DEBUG
02622         DXF_DEBUG_END
02623 #endif
02624         return (attrib);
02625 }
02626 
02627 
02633 DxfPoint *
02634 dxf_attrib_get_p0
02635 (
02636         DxfAttrib *attrib
02638 )
02639 {
02640 #ifdef DEBUG
02641         DXF_DEBUG_BEGIN
02642 #endif
02643         /* Do some basic checks. */
02644         if (attrib == NULL)
02645         {
02646                 fprintf (stderr,
02647                   (_("Error in %s () a NULL pointer was passed.\n")),
02648                   __FUNCTION__);
02649                 return (NULL);
02650         }
02651         if (attrib->p0 == NULL)
02652         {
02653               fprintf (stderr,
02654                   (_("Error in %s () a NULL pointer was found.\n")),
02655                 __FUNCTION__);
02656               return (NULL);
02657         }
02658 #if DEBUG
02659         DXF_DEBUG_END
02660 #endif
02661         return (attrib->p0);
02662 }
02663 
02664 
02670 DxfAttrib *
02671 dxf_attrib_set_p0
02672 (
02673         DxfAttrib *attrib,
02675         DxfPoint *p0
02677 )
02678 {
02679 #ifdef DEBUG
02680         DXF_DEBUG_BEGIN
02681 #endif
02682         /* Do some basic checks. */
02683         if (attrib == NULL)
02684         {
02685                 fprintf (stderr,
02686                   (_("Error in %s () a NULL pointer was passed.\n")),
02687                   __FUNCTION__);
02688                 return (NULL);
02689         }
02690         if (p0 == NULL)
02691         {
02692                 fprintf (stderr,
02693                   (_("Error in %s () a NULL pointer was passed.\n")),
02694                   __FUNCTION__);
02695                 return (NULL);
02696         }
02697         attrib->p0 = p0;
02698 #if DEBUG
02699         DXF_DEBUG_END
02700 #endif
02701         return (attrib);
02702 }
02703 
02704 
02711 double
02712 dxf_attrib_get_x0
02713 (
02714         DxfAttrib *attrib
02716 )
02717 {
02718 #ifdef DEBUG
02719         DXF_DEBUG_BEGIN
02720 #endif
02721 
02722         /* Do some basic checks. */
02723         if (attrib == NULL)
02724         {
02725                 fprintf (stderr,
02726                   (_("Error in %s () a NULL pointer was passed.\n")),
02727                   __FUNCTION__);
02728                 return (EXIT_FAILURE);
02729         }
02730         if (attrib->p0 == NULL)
02731         {
02732                 fprintf (stderr,
02733                   (_("Error in %s () a NULL pointer was found.\n")),
02734                   __FUNCTION__);
02735                 return (EXIT_FAILURE);
02736         }
02737 #if DEBUG
02738         DXF_DEBUG_END
02739 #endif
02740         return (attrib->p0->x0);
02741 }
02742 
02743 
02751 DxfAttrib *
02752 dxf_attrib_set_x0
02753 (
02754         DxfAttrib *attrib,
02756         double x0
02759 )
02760 {
02761 #ifdef DEBUG
02762         DXF_DEBUG_BEGIN
02763 #endif
02764         /* Do some basic checks. */
02765         if (attrib == NULL)
02766         {
02767                 fprintf (stderr,
02768                   (_("Error in %s () a NULL pointer was passed.\n")),
02769                   __FUNCTION__);
02770                 return (NULL);
02771         }
02772         if (attrib->p0 == NULL)
02773         {
02774                 fprintf (stderr,
02775                   (_("Error in %s () a NULL pointer was found.\n")),
02776                   __FUNCTION__);
02777                 return (NULL);
02778         }
02779         attrib->p0->x0 = x0;
02780 #if DEBUG
02781         DXF_DEBUG_END
02782 #endif
02783         return (attrib);
02784 }
02785 
02786 
02793 double
02794 dxf_attrib_get_y0
02795 (
02796         DxfAttrib *attrib
02798 )
02799 {
02800 #ifdef DEBUG
02801         DXF_DEBUG_BEGIN
02802 #endif
02803 
02804         /* Do some basic checks. */
02805         if (attrib == NULL)
02806         {
02807                 fprintf (stderr,
02808                   (_("Error in %s () a NULL pointer was passed.\n")),
02809                   __FUNCTION__);
02810                 return (EXIT_FAILURE);
02811         }
02812         if (attrib->p0 == NULL)
02813         {
02814                 fprintf (stderr,
02815                   (_("Error in %s () a NULL pointer was found.\n")),
02816                   __FUNCTION__);
02817                 return (EXIT_FAILURE);
02818         }
02819 #if DEBUG
02820         DXF_DEBUG_END
02821 #endif
02822         return (attrib->p0->y0);
02823 }
02824 
02825 
02833 DxfAttrib *
02834 dxf_attrib_set_y0
02835 (
02836         DxfAttrib *attrib,
02838         double y0
02841 )
02842 {
02843 #ifdef DEBUG
02844         DXF_DEBUG_BEGIN
02845 #endif
02846         /* Do some basic checks. */
02847         if (attrib == NULL)
02848         {
02849                 fprintf (stderr,
02850                   (_("Error in %s () a NULL pointer was passed.\n")),
02851                   __FUNCTION__);
02852                 return (NULL);
02853         }
02854         if (attrib->p0 == NULL)
02855         {
02856                 fprintf (stderr,
02857                   (_("Error in %s () a NULL pointer was found.\n")),
02858                   __FUNCTION__);
02859                 return (NULL);
02860         }
02861         attrib->p0->y0 = y0;
02862 #if DEBUG
02863         DXF_DEBUG_END
02864 #endif
02865         return (attrib);
02866 }
02867 
02868 
02875 double
02876 dxf_attrib_get_z0
02877 (
02878         DxfAttrib *attrib
02880 )
02881 {
02882 #ifdef DEBUG
02883         DXF_DEBUG_BEGIN
02884 #endif
02885 
02886         /* Do some basic checks. */
02887         if (attrib == NULL)
02888         {
02889                 fprintf (stderr,
02890                   (_("Error in %s () a NULL pointer was passed.\n")),
02891                   __FUNCTION__);
02892                 return (EXIT_FAILURE);
02893         }
02894         if (attrib->p0 == NULL)
02895         {
02896                 fprintf (stderr,
02897                   (_("Error in %s () a NULL pointer was found.\n")),
02898                   __FUNCTION__);
02899                 return (EXIT_FAILURE);
02900         }
02901 #if DEBUG
02902         DXF_DEBUG_END
02903 #endif
02904         return (attrib->p0->z0);
02905 }
02906 
02907 
02915 DxfAttrib *
02916 dxf_attrib_set_z0
02917 (
02918         DxfAttrib *attrib,
02920         double z0
02923 )
02924 {
02925 #ifdef DEBUG
02926         DXF_DEBUG_BEGIN
02927 #endif
02928         /* Do some basic checks. */
02929         if (attrib == NULL)
02930         {
02931                 fprintf (stderr,
02932                   (_("Error in %s () a NULL pointer was passed.\n")),
02933                   __FUNCTION__);
02934                 return (NULL);
02935         }
02936         if (attrib->p0 == NULL)
02937         {
02938                 fprintf (stderr,
02939                   (_("Error in %s () a NULL pointer was found.\n")),
02940                   __FUNCTION__);
02941                 return (NULL);
02942         }
02943         attrib->p0->z0 = z0;
02944 #if DEBUG
02945         DXF_DEBUG_END
02946 #endif
02947         return (attrib);
02948 }
02949 
02950 
02956 DxfPoint *
02957 dxf_attrib_get_p1
02958 (
02959         DxfAttrib *attrib
02961 )
02962 {
02963 #ifdef DEBUG
02964         DXF_DEBUG_BEGIN
02965 #endif
02966         /* Do some basic checks. */
02967         if (attrib == NULL)
02968         {
02969                 fprintf (stderr,
02970                   (_("Error in %s () a NULL pointer was passed.\n")),
02971                   __FUNCTION__);
02972                 return (NULL);
02973         }
02974         if (attrib->p1 == NULL)
02975         {
02976               fprintf (stderr,
02977                   (_("Error in %s () a NULL pointer was found.\n")),
02978                 __FUNCTION__);
02979               return (NULL);
02980         }
02981 #if DEBUG
02982         DXF_DEBUG_END
02983 #endif
02984         return (attrib->p1);
02985 }
02986 
02987 
02993 DxfAttrib *
02994 dxf_attrib_set_p1
02995 (
02996         DxfAttrib *attrib,
02998         DxfPoint *p1
03000 )
03001 {
03002 #ifdef DEBUG
03003         DXF_DEBUG_BEGIN
03004 #endif
03005         /* Do some basic checks. */
03006         if (attrib == NULL)
03007         {
03008                 fprintf (stderr,
03009                   (_("Error in %s () a NULL pointer was passed.\n")),
03010                   __FUNCTION__);
03011                 return (NULL);
03012         }
03013         if (p1 == NULL)
03014         {
03015                 fprintf (stderr,
03016                   (_("Error in %s () a NULL pointer was passed.\n")),
03017                   __FUNCTION__);
03018                 return (NULL);
03019         }
03020         attrib->p1 = p1;
03021 #if DEBUG
03022         DXF_DEBUG_END
03023 #endif
03024         return (attrib);
03025 }
03026 
03027 
03034 double
03035 dxf_attrib_get_x1
03036 (
03037         DxfAttrib *attrib
03039 )
03040 {
03041 #ifdef DEBUG
03042         DXF_DEBUG_BEGIN
03043 #endif
03044 
03045         /* Do some basic checks. */
03046         if (attrib == NULL)
03047         {
03048                 fprintf (stderr,
03049                   (_("Error in %s () a NULL pointer was passed.\n")),
03050                   __FUNCTION__);
03051                 return (EXIT_FAILURE);
03052         }
03053         if (attrib->p1 == NULL)
03054         {
03055                 fprintf (stderr,
03056                   (_("Error in %s () a NULL pointer was found.\n")),
03057                   __FUNCTION__);
03058                 return (EXIT_FAILURE);
03059         }
03060 #if DEBUG
03061         DXF_DEBUG_END
03062 #endif
03063         return (attrib->p1->x0);
03064 }
03065 
03066 
03074 DxfAttrib *
03075 dxf_attrib_set_x1
03076 (
03077         DxfAttrib *attrib,
03079         double x1
03081 )
03082 {
03083 #ifdef DEBUG
03084         DXF_DEBUG_BEGIN
03085 #endif
03086         /* Do some basic checks. */
03087         if (attrib == NULL)
03088         {
03089                 fprintf (stderr,
03090                   (_("Error in %s () a NULL pointer was passed.\n")),
03091                   __FUNCTION__);
03092                 return (NULL);
03093         }
03094         if (attrib->p1 == NULL)
03095         {
03096                 fprintf (stderr,
03097                   (_("Error in %s () a NULL pointer was found.\n")),
03098                   __FUNCTION__);
03099                 return (NULL);
03100         }
03101         attrib->p1->x0 = x1;
03102 #if DEBUG
03103         DXF_DEBUG_END
03104 #endif
03105         return (attrib);
03106 }
03107 
03108 
03115 double
03116 dxf_attrib_get_y1
03117 (
03118         DxfAttrib *attrib
03120 )
03121 {
03122 #ifdef DEBUG
03123         DXF_DEBUG_BEGIN
03124 #endif
03125 
03126         /* Do some basic checks. */
03127         if (attrib == NULL)
03128         {
03129                 fprintf (stderr,
03130                   (_("Error in %s () a NULL pointer was passed.\n")),
03131                   __FUNCTION__);
03132                 return (EXIT_FAILURE);
03133         }
03134         if (attrib->p1 == NULL)
03135         {
03136                 fprintf (stderr,
03137                   (_("Error in %s () a NULL pointer was found.\n")),
03138                   __FUNCTION__);
03139                 return (EXIT_FAILURE);
03140         }
03141 #if DEBUG
03142         DXF_DEBUG_END
03143 #endif
03144         return (attrib->p1->y0);
03145 }
03146 
03147 
03155 DxfAttrib *
03156 dxf_attrib_set_y1
03157 (
03158         DxfAttrib *attrib,
03160         double y1
03162 )
03163 {
03164 #ifdef DEBUG
03165         DXF_DEBUG_BEGIN
03166 #endif
03167         /* Do some basic checks. */
03168         if (attrib == NULL)
03169         {
03170                 fprintf (stderr,
03171                   (_("Error in %s () a NULL pointer was passed.\n")),
03172                   __FUNCTION__);
03173                 return (NULL);
03174         }
03175         if (attrib->p1 == NULL)
03176         {
03177                 fprintf (stderr,
03178                   (_("Error in %s () a NULL pointer was found.\n")),
03179                   __FUNCTION__);
03180                 return (NULL);
03181         }
03182         attrib->p1->y0 = y1;
03183 #if DEBUG
03184         DXF_DEBUG_END
03185 #endif
03186         return (attrib);
03187 }
03188 
03189 
03196 double
03197 dxf_attrib_get_z1
03198 (
03199         DxfAttrib *attrib
03201 )
03202 {
03203 #ifdef DEBUG
03204         DXF_DEBUG_BEGIN
03205 #endif
03206 
03207         /* Do some basic checks. */
03208         if (attrib == NULL)
03209         {
03210                 fprintf (stderr,
03211                   (_("Error in %s () a NULL pointer was passed.\n")),
03212                   __FUNCTION__);
03213                 return (EXIT_FAILURE);
03214         }
03215         if (attrib->p1 == NULL)
03216         {
03217                 fprintf (stderr,
03218                   (_("Error in %s () a NULL pointer was found.\n")),
03219                   __FUNCTION__);
03220                 return (EXIT_FAILURE);
03221         }
03222 #if DEBUG
03223         DXF_DEBUG_END
03224 #endif
03225         return (attrib->p1->z0);
03226 }
03227 
03228 
03236 DxfAttrib *
03237 dxf_attrib_set_z1
03238 (
03239         DxfAttrib *attrib,
03241         double z1
03243 )
03244 {
03245 #ifdef DEBUG
03246         DXF_DEBUG_BEGIN
03247 #endif
03248         /* Do some basic checks. */
03249         if (attrib == NULL)
03250         {
03251                 fprintf (stderr,
03252                   (_("Error in %s () a NULL pointer was passed.\n")),
03253                   __FUNCTION__);
03254                 return (NULL);
03255         }
03256         if (attrib->p1 == NULL)
03257         {
03258                 fprintf (stderr,
03259                   (_("Error in %s () a NULL pointer was found.\n")),
03260                   __FUNCTION__);
03261                 return (NULL);
03262         }
03263         attrib->p1->z0 = z1;
03264 #if DEBUG
03265         DXF_DEBUG_END
03266 #endif
03267         return (attrib);
03268 }
03269 
03270 
03276 double
03277 dxf_attrib_get_height
03278 (
03279         DxfAttrib *attrib
03281 )
03282 {
03283 #if DEBUG
03284         DXF_DEBUG_BEGIN
03285 #endif
03286         /* Do some basic checks. */
03287         if (attrib == NULL)
03288         {
03289                 fprintf (stderr,
03290                   (_("Error in %s () a NULL pointer was passed.\n")),
03291                   __FUNCTION__);
03292                 return (EXIT_FAILURE);
03293         }
03294         if (attrib->height < 0.0)
03295         {
03296                 fprintf (stderr,
03297                   (_("Error in %s () a negative value was found in the height member.\n")),
03298                   __FUNCTION__);
03299                 return (EXIT_FAILURE);
03300         }
03301 #if DEBUG
03302         DXF_DEBUG_END
03303 #endif
03304         return (attrib->height);
03305 }
03306 
03307 
03311 DxfAttrib *
03312 dxf_attrib_set_height
03313 (
03314         DxfAttrib *attrib,
03316         double height
03318 )
03319 {
03320 #if DEBUG
03321         DXF_DEBUG_BEGIN
03322 #endif
03323         /* Do some basic checks. */
03324         if (attrib == NULL)
03325         {
03326                 fprintf (stderr,
03327                   (_("Error in %s () a NULL pointer was passed.\n")),
03328                   __FUNCTION__);
03329                 return (NULL);
03330         }
03331         if (height < 0.0)
03332         {
03333                 fprintf (stderr,
03334                   (_("Error in %s () a negative height value was passed.\n")),
03335                   __FUNCTION__);
03336                 return (NULL);
03337         }
03338         attrib->height = height;
03339 #if DEBUG
03340         DXF_DEBUG_END
03341 #endif
03342         return (attrib);
03343 }
03344 
03345 
03351 double
03352 dxf_attrib_get_rel_x_scale
03353 (
03354         DxfAttrib *attrib
03356 )
03357 {
03358 #if DEBUG
03359         DXF_DEBUG_BEGIN
03360 #endif
03361         /* Do some basic checks. */
03362         if (attrib == NULL)
03363         {
03364                 fprintf (stderr,
03365                   (_("Error in %s () a NULL pointer was passed.\n")),
03366                   __FUNCTION__);
03367                 return (EXIT_FAILURE);
03368         }
03369         if (attrib->height < 0.0)
03370         {
03371                 fprintf (stderr,
03372                   (_("Error in %s () a negative value was found in the rel_x_scale member.\n")),
03373                   __FUNCTION__);
03374                 return (EXIT_FAILURE);
03375         }
03376 #if DEBUG
03377         DXF_DEBUG_END
03378 #endif
03379         return (attrib->rel_x_scale);
03380 }
03381 
03382 
03386 DxfAttrib *
03387 dxf_attrib_set_rel_x_scale
03388 (
03389         DxfAttrib *attrib,
03391         double rel_x_scale
03393 )
03394 {
03395 #if DEBUG
03396         DXF_DEBUG_BEGIN
03397 #endif
03398         /* Do some basic checks. */
03399         if (attrib == NULL)
03400         {
03401                 fprintf (stderr,
03402                   (_("Error in %s () a NULL pointer was passed.\n")),
03403                   __FUNCTION__);
03404                 return (NULL);
03405         }
03406         attrib->rel_x_scale = rel_x_scale;
03407 #if DEBUG
03408         DXF_DEBUG_END
03409 #endif
03410         return (attrib);
03411 }
03412 
03413 
03419 double
03420 dxf_attrib_get_rot_angle
03421 (
03422         DxfAttrib *attrib
03424 )
03425 {
03426 #if DEBUG
03427         DXF_DEBUG_BEGIN
03428 #endif
03429         /* Do some basic checks. */
03430         if (attrib == NULL)
03431         {
03432                 fprintf (stderr,
03433                   (_("Error in %s () a NULL pointer was passed.\n")),
03434                   __FUNCTION__);
03435                 return (EXIT_FAILURE);
03436         }
03437 #if DEBUG
03438         DXF_DEBUG_END
03439 #endif
03440 
03441         return (attrib->rot_angle);
03442 }
03443 
03444 
03448 DxfAttrib *
03449 dxf_attrib_set_rot_angle
03450 (
03451         DxfAttrib *attrib,
03453         double rot_angle
03455 )
03456 {
03457 #if DEBUG
03458         DXF_DEBUG_BEGIN
03459 #endif
03460         /* Do some basic checks. */
03461         if (attrib == NULL)
03462         {
03463                 fprintf (stderr,
03464                   (_("Error in %s () a NULL pointer was passed.\n")),
03465                   __FUNCTION__);
03466                 return (NULL);
03467         }
03469         attrib->rot_angle = rot_angle;
03470 #if DEBUG
03471         DXF_DEBUG_END
03472 #endif
03473         return (attrib);
03474 }
03475 
03476 
03482 double
03483 dxf_attrib_get_obl_angle
03484 (
03485         DxfAttrib *attrib
03487 )
03488 {
03489 #if DEBUG
03490         DXF_DEBUG_BEGIN
03491 #endif
03492         /* Do some basic checks. */
03493         if (attrib == NULL)
03494         {
03495                 fprintf (stderr,
03496                   (_("Error in %s () a NULL pointer was passed.\n")),
03497                   __FUNCTION__);
03498                 return (EXIT_FAILURE);
03499         }
03500 #if DEBUG
03501         DXF_DEBUG_END
03502 #endif
03503 
03504         return (attrib->obl_angle);
03505 }
03506 
03507 
03511 DxfAttrib *
03512 dxf_attrib_set_obl_angle
03513 (
03514         DxfAttrib *attrib,
03516         double obl_angle
03518 )
03519 {
03520 #if DEBUG
03521         DXF_DEBUG_BEGIN
03522 #endif
03523         /* Do some basic checks. */
03524         if (attrib == NULL)
03525         {
03526                 fprintf (stderr,
03527                   (_("Error in %s () a NULL pointer was passed.\n")),
03528                   __FUNCTION__);
03529                 return (NULL);
03530         }
03532         attrib->obl_angle = obl_angle;
03533 #if DEBUG
03534         DXF_DEBUG_END
03535 #endif
03536         return (attrib);
03537 }
03538 
03539 
03545 int
03546 dxf_attrib_get_attr_flags
03547 (
03548         DxfAttrib *attrib
03550 )
03551 {
03552 #if DEBUG
03553         DXF_DEBUG_BEGIN
03554 #endif
03555         /* Do some basic checks. */
03556         if (attrib == NULL)
03557         {
03558                 fprintf (stderr,
03559                   (_("Error in %s () a NULL pointer was passed.\n")),
03560                   __FUNCTION__);
03561                 return (EXIT_FAILURE);
03562         }
03563         if (attrib->attr_flags < 0)
03564         {
03565                 fprintf (stderr,
03566                   (_("Error in %s () a negative value was found in the attr_flags member.\n")),
03567                   __FUNCTION__);
03568                 return (EXIT_FAILURE);
03569         }
03570         if (attrib->attr_flags > 8)
03571         {
03572                 fprintf (stderr,
03573                   (_("Error in %s () an invalid value was found in the attr_flags member.\n")),
03574                   __FUNCTION__);
03575                 return (EXIT_FAILURE);
03576         }
03577 #if DEBUG
03578         DXF_DEBUG_END
03579 #endif
03580         return (attrib->attr_flags);
03581 }
03582 
03583 
03587 DxfAttrib *
03588 dxf_attrib_set_attr_flags
03589 (
03590         DxfAttrib *attrib,
03592         int attr_flags
03594 )
03595 {
03596 #if DEBUG
03597         DXF_DEBUG_BEGIN
03598 #endif
03599         /* Do some basic checks. */
03600         if (attrib == NULL)
03601         {
03602                 fprintf (stderr,
03603                   (_("Error in %s () a NULL pointer was passed.\n")),
03604                   __FUNCTION__);
03605                 return (NULL);
03606         }
03607         if (attr_flags < 0)
03608         {
03609                 fprintf (stderr,
03610                   (_("Error in %s () a negative value in attribute flags was passed.\n")),
03611                   __FUNCTION__);
03612                 return (NULL);
03613         }
03614         if (attr_flags > 8)
03615         {
03616                 fprintf (stderr,
03617                   (_("Error in %s () a invalid value in attribute flags was passed.\n")),
03618                   __FUNCTION__);
03619                 return (NULL);
03620         }
03621         attrib->attr_flags = attr_flags;
03622 #if DEBUG
03623         DXF_DEBUG_END
03624 #endif
03625         return (attrib);
03626 }
03627 
03628 
03635 int
03636 dxf_attrib_is_invisible
03637 (
03638         DxfAttrib *attrib
03640 )
03641 {
03642 #if DEBUG
03643         DXF_DEBUG_BEGIN
03644 #endif
03645         /* Do some basic checks. */
03646         if (attrib == NULL)
03647         {
03648                 fprintf (stderr,
03649                   (_("Error in %s () a NULL pointer was passed.\n")),
03650                   __FUNCTION__);
03651                 return (EXIT_FAILURE);
03652         }
03653 #if DEBUG
03654         DXF_DEBUG_END
03655 #endif
03656         return (DXF_CHECK_BIT (attrib->attr_flags, 0));
03657 }
03658 
03659 
03666 int
03667 dxf_attrib_is_constant
03668 (
03669         DxfAttrib *attrib
03671 )
03672 {
03673 #if DEBUG
03674         DXF_DEBUG_BEGIN
03675 #endif
03676         /* Do some basic checks. */
03677         if (attrib == NULL)
03678         {
03679                 fprintf (stderr,
03680                   (_("Error in %s () a NULL pointer was passed.\n")),
03681                   __FUNCTION__);
03682                 return (EXIT_FAILURE);
03683         }
03684 #if DEBUG
03685         DXF_DEBUG_END
03686 #endif
03687         return (DXF_CHECK_BIT (attrib->attr_flags, 1));
03688 }
03689 
03690 
03697 int
03698 dxf_attrib_is_verification_required
03699 (
03700         DxfAttrib *attrib
03702 )
03703 {
03704 #if DEBUG
03705         DXF_DEBUG_BEGIN
03706 #endif
03707         /* Do some basic checks. */
03708         if (attrib == NULL)
03709         {
03710                 fprintf (stderr,
03711                   (_("Error in %s () a NULL pointer was passed.\n")),
03712                   __FUNCTION__);
03713                 return (EXIT_FAILURE);
03714         }
03715 #if DEBUG
03716         DXF_DEBUG_END
03717 #endif
03718         return (DXF_CHECK_BIT (attrib->attr_flags, 2));
03719 }
03720 
03721 
03728 int
03729 dxf_attrib_is_preset
03730 (
03731         DxfAttrib *attrib
03733 )
03734 {
03735 #if DEBUG
03736         DXF_DEBUG_BEGIN
03737 #endif
03738         /* Do some basic checks. */
03739         if (attrib == NULL)
03740         {
03741                 fprintf (stderr,
03742                   (_("Error in %s () a NULL pointer was passed.\n")),
03743                   __FUNCTION__);
03744                 return (EXIT_FAILURE);
03745         }
03746 #if DEBUG
03747         DXF_DEBUG_END
03748 #endif
03749         return (DXF_CHECK_BIT (attrib->attr_flags, 3));
03750 }
03751 
03752 
03758 int
03759 dxf_attrib_get_text_flags
03760 (
03761         DxfAttrib *attrib
03763 )
03764 {
03765 #if DEBUG
03766         DXF_DEBUG_BEGIN
03767 #endif
03768         /* Do some basic checks. */
03769         if (attrib == NULL)
03770         {
03771                 fprintf (stderr,
03772                   (_("Error in %s () a NULL pointer was passed.\n")),
03773                   __FUNCTION__);
03774                 return (EXIT_FAILURE);
03775         }
03776         if (attrib->text_flags < 0)
03777         {
03778                 fprintf (stderr,
03779                   (_("Error in %s () a negative value was found in the text flags member.\n")),
03780                   __FUNCTION__);
03781                 return (EXIT_FAILURE);
03782         }
03783         if (attrib->text_flags > 4)
03784         {
03785                 fprintf (stderr,
03786                   (_("Error in %s () an invalid value was found in the text flags member.\n")),
03787                   __FUNCTION__);
03788                 return (EXIT_FAILURE);
03789         }
03790 #if DEBUG
03791         DXF_DEBUG_END
03792 #endif
03793         return (attrib->text_flags);
03794 }
03795 
03796 
03800 DxfAttrib *
03801 dxf_attrib_set_text_flags
03802 (
03803         DxfAttrib *attrib,
03805         int text_flags
03807 )
03808 {
03809 #if DEBUG
03810         DXF_DEBUG_BEGIN
03811 #endif
03812         /* Do some basic checks. */
03813         if (attrib == NULL)
03814         {
03815                 fprintf (stderr,
03816                   (_("Error in %s () a NULL pointer was passed.\n")),
03817                   __FUNCTION__);
03818                 return (NULL);
03819         }
03820         if (text_flags < 0)
03821         {
03822                 fprintf (stderr,
03823                   (_("Error in %s () a negative value in text flags was passed.\n")),
03824                   __FUNCTION__);
03825                 return (NULL);
03826         }
03827         if (text_flags > 4)
03828         {
03829                 fprintf (stderr,
03830                   (_("Error in %s () a invalid value in text flags was passed.\n")),
03831                   __FUNCTION__);
03832                 return (NULL);
03833         }
03834         attrib->text_flags = text_flags;
03835 #if DEBUG
03836         DXF_DEBUG_END
03837 #endif
03838         return (attrib);
03839 }
03840 
03841 
03847 int
03848 dxf_attrib_get_hor_align
03849 (
03850         DxfAttrib *attrib
03852 )
03853 {
03854 #if DEBUG
03855         DXF_DEBUG_BEGIN
03856 #endif
03857         /* Do some basic checks. */
03858         if (attrib == NULL)
03859         {
03860                 fprintf (stderr,
03861                   (_("Error in %s () a NULL pointer was passed.\n")),
03862                   __FUNCTION__);
03863                 return (EXIT_FAILURE);
03864         }
03865         if (attrib->hor_align < 0)
03866         {
03867                 fprintf (stderr,
03868                   (_("Error in %s () a negative value was found in the hor_align member.\n")),
03869                   __FUNCTION__);
03870                 return (EXIT_FAILURE);
03871         }
03872         if (attrib->hor_align > 5)
03873         {
03874                 fprintf (stderr,
03875                   (_("Error in %s () an invalid value was found in the hor_align member.\n")),
03876                   __FUNCTION__);
03877                 return (EXIT_FAILURE);
03878         }
03879 #if DEBUG
03880         DXF_DEBUG_END
03881 #endif
03882         return (attrib->hor_align);
03883 }
03884 
03885 
03889 DxfAttrib *
03890 dxf_attrib_set_hor_align
03891 (
03892         DxfAttrib *attrib,
03894         int hor_align
03896 )
03897 {
03898 #if DEBUG
03899         DXF_DEBUG_BEGIN
03900 #endif
03901         /* Do some basic checks. */
03902         if (attrib == NULL)
03903         {
03904                 fprintf (stderr,
03905                   (_("Error in %s () a NULL pointer was passed.\n")),
03906                   __FUNCTION__);
03907                 return (NULL);
03908         }
03909         if (hor_align < 0)
03910         {
03911                 fprintf (stderr,
03912                   (_("Error in %s () a negative value in horizontal alignment was passed.\n")),
03913                   __FUNCTION__);
03914                 return (NULL);
03915         }
03916         if (hor_align > 5)
03917         {
03918                 fprintf (stderr,
03919                   (_("Error in %s () an invalid value in horizontal alignment was passed.\n")),
03920                   __FUNCTION__);
03921                 return (NULL);
03922         }
03923         attrib->hor_align = hor_align;
03924 #if DEBUG
03925         DXF_DEBUG_END
03926 #endif
03927         return (attrib);
03928 }
03929 
03930 
03938 int
03939 dxf_attrib_get_field_length
03940 (
03941         DxfAttrib *attrib
03943 )
03944 {
03945 #if DEBUG
03946         DXF_DEBUG_BEGIN
03947 #endif
03948         /* Do some basic checks. */
03949         if (attrib == NULL)
03950         {
03951                 fprintf (stderr,
03952                   (_("Error in %s () a NULL pointer was passed.\n")),
03953                   __FUNCTION__);
03954                 return (EXIT_FAILURE);
03955         }
03956         if (attrib->field_length < 0)
03957         {
03958                 fprintf (stderr,
03959                   (_("Error in %s () a negative value was found in the field_length member.\n")),
03960                   __FUNCTION__);
03961                 return (EXIT_FAILURE);
03962         }
03963 #if DEBUG
03964         DXF_DEBUG_END
03965 #endif
03966         return (attrib->field_length);
03967 }
03968 
03969 
03975 DxfAttrib *
03976 dxf_attrib_set_field_length
03977 (
03978         DxfAttrib *attrib,
03980         int field_length
03982 )
03983 {
03984 #if DEBUG
03985         DXF_DEBUG_BEGIN
03986 #endif
03987         /* Do some basic checks. */
03988         if (attrib == NULL)
03989         {
03990                 fprintf (stderr,
03991                   (_("Error in %s () a NULL pointer was passed.\n")),
03992                   __FUNCTION__);
03993                 return (NULL);
03994         }
03995         if (field_length < 0)
03996         {
03997                 fprintf (stderr,
03998                   (_("Error in %s () a negative value in field length was passed.\n")),
03999                   __FUNCTION__);
04000                 return (NULL);
04001         }
04002         attrib->field_length = field_length;
04003 #if DEBUG
04004         DXF_DEBUG_END
04005 #endif
04006         return (attrib);
04007 }
04008 
04009 
04015 int
04016 dxf_attrib_get_vert_align
04017 (
04018         DxfAttrib *attrib
04020 )
04021 {
04022 #if DEBUG
04023         DXF_DEBUG_BEGIN
04024 #endif
04025         /* Do some basic checks. */
04026         if (attrib == NULL)
04027         {
04028                 fprintf (stderr,
04029                   (_("Error in %s () a NULL pointer was passed.\n")),
04030                   __FUNCTION__);
04031                 return (EXIT_FAILURE);
04032         }
04033         if (attrib->vert_align < 0)
04034         {
04035                 fprintf (stderr,
04036                   (_("Error in %s () a negative value was found in the vert_align member.\n")),
04037                   __FUNCTION__);
04038                 return (EXIT_FAILURE);
04039         }
04040         if (attrib->vert_align > 3)
04041         {
04042                 fprintf (stderr,
04043                   (_("Error in %s () an invalid value was found in the vert_align member.\n")),
04044                   __FUNCTION__);
04045                 return (EXIT_FAILURE);
04046         }
04047 #if DEBUG
04048         DXF_DEBUG_END
04049 #endif
04050         return (attrib->vert_align);
04051 }
04052 
04053 
04057 DxfAttrib *
04058 dxf_attrib_set_vert_align
04059 (
04060         DxfAttrib *attrib,
04062         int vert_align
04064 )
04065 {
04066 #if DEBUG
04067         DXF_DEBUG_BEGIN
04068 #endif
04069         /* Do some basic checks. */
04070         if (attrib == NULL)
04071         {
04072                 fprintf (stderr,
04073                   (_("Error in %s () a NULL pointer was passed.\n")),
04074                   __FUNCTION__);
04075                 return (NULL);
04076         }
04077         if (vert_align < 0)
04078         {
04079                 fprintf (stderr,
04080                   (_("Error in %s () a negative value in vertical alignment was passed.\n")),
04081                   __FUNCTION__);
04082                 return (NULL);
04083         }
04084         if (vert_align > 3)
04085         {
04086                 fprintf (stderr,
04087                   (_("Error in %s () an invalid value in vertical alignment was passed.\n")),
04088                   __FUNCTION__);
04089                 return (NULL);
04090         }
04091         attrib->vert_align = vert_align;
04092 #if DEBUG
04093         DXF_DEBUG_END
04094 #endif
04095         return (attrib);
04096 }
04097 
04098 
04105 double
04106 dxf_attrib_get_extr_x0
04107 (
04108         DxfAttrib *attrib
04110 )
04111 {
04112 #ifdef DEBUG
04113         DXF_DEBUG_BEGIN
04114 #endif
04115 
04116         /* Do some basic checks. */
04117         if (attrib == NULL)
04118         {
04119                 fprintf (stderr,
04120                   (_("Error in %s () a NULL pointer was passed.\n")),
04121                   __FUNCTION__);
04122                 return (EXIT_FAILURE);
04123         }
04124 #if DEBUG
04125         DXF_DEBUG_END
04126 #endif
04127         return (attrib->extr_x0);
04128 }
04129 
04130 
04138 DxfAttrib *
04139 dxf_attrib_set_extr_x0
04140 (
04141         DxfAttrib *attrib,
04143         double extr_x0
04146 )
04147 {
04148 #ifdef DEBUG
04149         DXF_DEBUG_BEGIN
04150 #endif
04151         /* Do some basic checks. */
04152         if (attrib == NULL)
04153         {
04154                 fprintf (stderr,
04155                   (_("Error in %s () a NULL pointer was passed.\n")),
04156                   __FUNCTION__);
04157                 return (NULL);
04158         }
04159         attrib->extr_x0 = extr_x0;
04160 #if DEBUG
04161         DXF_DEBUG_END
04162 #endif
04163         return (attrib);
04164 }
04165 
04166 
04173 double
04174 dxf_attrib_get_extr_y0
04175 (
04176         DxfAttrib *attrib
04178 )
04179 {
04180 #ifdef DEBUG
04181         DXF_DEBUG_BEGIN
04182 #endif
04183 
04184         /* Do some basic checks. */
04185         if (attrib == NULL)
04186         {
04187                 fprintf (stderr,
04188                   (_("Error in %s () a NULL pointer was passed.\n")),
04189                   __FUNCTION__);
04190                 return (EXIT_FAILURE);
04191         }
04192 #if DEBUG
04193         DXF_DEBUG_END
04194 #endif
04195         return (attrib->extr_y0);
04196 }
04197 
04198 
04206 DxfAttrib *
04207 dxf_attrib_set_extr_y0
04208 (
04209         DxfAttrib *attrib,
04211         double extr_y0
04214 )
04215 {
04216 #ifdef DEBUG
04217         DXF_DEBUG_BEGIN
04218 #endif
04219         /* Do some basic checks. */
04220         if (attrib == NULL)
04221         {
04222                 fprintf (stderr,
04223                   (_("Error in %s () a NULL pointer was passed.\n")),
04224                   __FUNCTION__);
04225                 return (NULL);
04226         }
04227         attrib->extr_y0 = extr_y0;
04228 #if DEBUG
04229         DXF_DEBUG_END
04230 #endif
04231         return (attrib);
04232 }
04233 
04234 
04241 double
04242 dxf_attrib_get_extr_z0
04243 (
04244         DxfAttrib *attrib
04246 )
04247 {
04248 #ifdef DEBUG
04249         DXF_DEBUG_BEGIN
04250 #endif
04251 
04252         /* Do some basic checks. */
04253         if (attrib == NULL)
04254         {
04255                 fprintf (stderr,
04256                   (_("Error in %s () a NULL pointer was passed.\n")),
04257                   __FUNCTION__);
04258                 return (EXIT_FAILURE);
04259         }
04260 #if DEBUG
04261         DXF_DEBUG_END
04262 #endif
04263         return (attrib->extr_z0);
04264 }
04265 
04266 
04274 DxfAttrib *
04275 dxf_attrib_set_extr_z0
04276 (
04277         DxfAttrib *attrib,
04279         double extr_z0
04282 )
04283 {
04284 #ifdef DEBUG
04285         DXF_DEBUG_BEGIN
04286 #endif
04287         /* Do some basic checks. */
04288         if (attrib == NULL)
04289         {
04290                 fprintf (stderr,
04291                   (_("Error in %s () a NULL pointer was passed.\n")),
04292                   __FUNCTION__);
04293                 return (NULL);
04294         }
04295         attrib->extr_z0 = extr_z0;
04296 #if DEBUG
04297         DXF_DEBUG_END
04298 #endif
04299         return (attrib);
04300 }
04301 
04302 
04311 DxfPoint *
04312 dxf_attrib_get_extrusion_vector_as_point
04313 (
04314         DxfAttrib *attrib
04316 )
04317 {
04318 #ifdef DEBUG
04319         DXF_DEBUG_BEGIN
04320 #endif
04321         DxfPoint *point = NULL;
04322 
04323         /* Do some basic checks. */
04324         if (attrib == NULL)
04325         {
04326                 fprintf (stderr,
04327                   (_("Error in %s () a NULL pointer was passed.\n")),
04328                   __FUNCTION__);
04329                 return (NULL);
04330         }
04331         point = dxf_point_init (point);
04332         if (point == NULL)
04333         {
04334               fprintf (stderr,
04335                   (_("Error in %s () could not allocate memory for a DxfPoint struct.\n")),
04336                 __FUNCTION__);
04337               return (NULL);
04338         }
04339         point->x0 = attrib->extr_x0;
04340         point->y0 = attrib->extr_y0;
04341         point->z0 = attrib->extr_z0;
04342 #if DEBUG
04343         DXF_DEBUG_END
04344 #endif
04345         return (point);
04346 }
04347 
04348 
04353 DxfAttrib *
04354 dxf_attrib_set_extrusion_vector_from_point
04355 (
04356         DxfAttrib *attrib,
04358         DxfPoint *point
04360 )
04361 {
04362 #if DEBUG
04363         DXF_DEBUG_BEGIN
04364 #endif
04365         /* Do some basic checks. */
04366         if (attrib == NULL)
04367         {
04368                 fprintf (stderr,
04369                   (_("Error in %s () a NULL pointer was passed.\n")),
04370                   __FUNCTION__);
04371                 return (NULL);
04372         }
04373         if (point == NULL)
04374         {
04375                 fprintf (stderr,
04376                   (_("Error in %s () a NULL pointer was passed.\n")),
04377                   __FUNCTION__);
04378                 return (NULL);
04379         }
04380         attrib->extr_x0 = (double) point->x0;
04381         attrib->extr_y0 = (double) point->y0;
04382         attrib->extr_z0 = (double) point->z0;
04383 #if DEBUG
04384         DXF_DEBUG_END
04385 #endif
04386         return (attrib);
04387 }
04388 
04389 
04393 DxfAttrib *
04394 dxf_attrib_set_extrusion_vector
04395 (
04396         DxfAttrib *attrib,
04398         double extr_x0,
04400         double extr_y0,
04402         double extr_z0
04404 )
04405 {
04406 #if DEBUG
04407         DXF_DEBUG_BEGIN
04408 #endif
04409         /* Do some basic checks. */
04410         if (attrib == NULL)
04411         {
04412                 fprintf (stderr,
04413                   (_("Error in %s () a NULL pointer was passed.\n")),
04414                   __FUNCTION__);
04415                 return (NULL);
04416         }
04417         attrib->extr_x0 = extr_x0;
04418         attrib->extr_y0 = extr_y0;
04419         attrib->extr_z0 = extr_z0;
04420 #if DEBUG
04421         DXF_DEBUG_END
04422 #endif
04423         return (attrib);
04424 }
04425 
04426 
04435 DxfAttrib *
04436 dxf_attrib_get_next
04437 (
04438         DxfAttrib *attrib
04440 )
04441 {
04442 #if DEBUG
04443         DXF_DEBUG_BEGIN
04444 #endif
04445         /* Do some basic checks. */
04446         if (attrib == NULL)
04447         {
04448                 fprintf (stderr,
04449                   (_("Error in %s () a NULL pointer was passed.\n")),
04450                   __FUNCTION__);
04451                 return (NULL);
04452         }
04453         if (attrib->next == NULL)
04454         {
04455                 fprintf (stderr,
04456                   (_("Error in %s () a NULL pointer was found in the next member.\n")),
04457                   __FUNCTION__);
04458                 return (NULL);
04459         }
04460 #if DEBUG
04461         DXF_DEBUG_END
04462 #endif
04463         return ((DxfAttrib *) attrib->next);
04464 }
04465 
04466 
04471 DxfAttrib *
04472 dxf_attrib_set_next
04473 (
04474         DxfAttrib *attrib,
04476         DxfAttrib *next
04478 )
04479 {
04480 #if DEBUG
04481         DXF_DEBUG_BEGIN
04482 #endif
04483         /* Do some basic checks. */
04484         if (attrib == NULL)
04485         {
04486                 fprintf (stderr,
04487                   (_("Error in %s () a NULL pointer was passed.\n")),
04488                   __FUNCTION__);
04489                 return (NULL);
04490         }
04491         if (next == NULL)
04492         {
04493                 fprintf (stderr,
04494                   (_("Error in %s () a NULL pointer was passed.\n")),
04495                   __FUNCTION__);
04496                 return (NULL);
04497         }
04498         attrib->next = (struct DxfAttrib *) next;
04499 #if DEBUG
04500         DXF_DEBUG_END
04501 #endif
04502         return (attrib);
04503 }
04504 
04505 
04514 DxfAttrib *
04515 dxf_attrib_get_last
04516 (
04517         DxfAttrib *attrib
04519 )
04520 {
04521 #if DEBUG
04522         DXF_DEBUG_BEGIN
04523 #endif
04524         /* Do some basic checks. */
04525         if (attrib == NULL)
04526         {
04527                 fprintf (stderr,
04528                   (_("Error in %s () a NULL pointer was passed.\n")),
04529                   __FUNCTION__);
04530                 return (NULL);
04531         }
04532         if (attrib->next == NULL)
04533         {
04534                 fprintf (stderr,
04535                   (_("Warning in %s () a NULL pointer was found in the next member.\n")),
04536                   __FUNCTION__);
04537                 return ((DxfAttrib *) attrib);
04538         }
04539         DxfAttrib *iter = (DxfAttrib *) attrib->next;
04540         while (iter->next != NULL)
04541         {
04542                 iter = (DxfAttrib *) iter->next;
04543         }
04544 #if DEBUG
04545         DXF_DEBUG_END
04546 #endif
04547         return ((DxfAttrib *) iter);
04548 }
04549 
04550 
04551 /* EOF */