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

mlinestyle.c

Go to the documentation of this file.
00001 
00043 #include "mlinestyle.h"
00044 
00045 
00054 DxfMlinestyle *
00055 dxf_mlinestyle_new ()
00056 {
00057 #if DEBUG
00058         DXF_DEBUG_BEGIN
00059 #endif
00060         DxfMlinestyle *mlinestyle = NULL;
00061         size_t size;
00062 
00063         size = sizeof (DxfMlinestyle);
00064         /* avoid malloc of 0 bytes */
00065         if (size == 0) size = 1;
00066         if ((mlinestyle = malloc (size)) == NULL)
00067         {
00068                 fprintf (stderr,
00069                   (_("Error in %s () could not allocate memory for a DxfMlinestyle struct.\n")),
00070                   __FUNCTION__);
00071                 mlinestyle = NULL;
00072         }
00073         else
00074         {
00075                 memset (mlinestyle, 0, size);
00076         }
00077 #if DEBUG
00078         DXF_DEBUG_END
00079 #endif
00080         return (mlinestyle);
00081 }
00082 
00083 
00091 DxfMlinestyle *
00092 dxf_mlinestyle_init
00093 (
00094         DxfMlinestyle *mlinestyle
00096 )
00097 {
00098 #if DEBUG
00099         DXF_DEBUG_BEGIN
00100 #endif
00101         int i;
00102 
00103         /* Do some basic checks. */
00104         if (mlinestyle == NULL)
00105         {
00106                 fprintf (stderr,
00107                   (_("Warning in %s () a NULL pointer was passed.\n")),
00108                   __FUNCTION__);
00109                 mlinestyle = dxf_mlinestyle_new ();
00110         }
00111         if (mlinestyle == NULL)
00112         {
00113                 fprintf (stderr,
00114                   (_("Error in %s () could not allocate memory for a DxfMlinestyle struct.\n")),
00115                   __FUNCTION__);
00116                 return (NULL);
00117         }
00118         dxf_mlinestyle_set_name (mlinestyle, strdup (""));
00119         dxf_mlinestyle_set_description (mlinestyle, strdup (""));
00120         dxf_mlinestyle_set_id_code (mlinestyle, 0);
00121         dxf_mlinestyle_set_dictionary_owner_soft (mlinestyle, strdup (""));
00122         dxf_mlinestyle_set_dictionary_owner_hard (mlinestyle, strdup (""));
00123         dxf_mlinestyle_set_start_angle (mlinestyle, 0.0);
00124         dxf_mlinestyle_set_end_angle (mlinestyle, 0.0);
00125         dxf_mlinestyle_set_color (mlinestyle, DXF_COLOR_BYLAYER);
00126         dxf_mlinestyle_set_flags (mlinestyle, 0);
00127         dxf_mlinestyle_set_number_of_elements (mlinestyle, 0);
00128         for (i = 0; i < DXF_MAX_PARAM; i++)
00129         {
00130                 dxf_mlinestyle_set_ith_element_linetype (mlinestyle, strdup (""), i);
00131                 dxf_mlinestyle_set_ith_element_offset (mlinestyle, 0.0, i);
00132                 dxf_mlinestyle_set_ith_element_color (mlinestyle, 0, i);
00133         }
00134         dxf_mlinestyle_set_next (mlinestyle, NULL);
00135 #if DEBUG
00136         DXF_DEBUG_END
00137 #endif
00138         return (mlinestyle);
00139 }
00140 
00141 
00153 DxfMlinestyle *
00154 dxf_mlinestyle_read
00155 (
00156         DxfFile *fp,
00158         DxfMlinestyle *mlinestyle
00160 )
00161 {
00162 #if DEBUG
00163         DXF_DEBUG_BEGIN
00164 #endif
00165         char *temp_string = NULL;
00166         int i;
00167 
00168         /* Do some basic checks. */
00169         if (fp == NULL)
00170         {
00171                 fprintf (stderr,
00172                   (_("Error in %s () a NULL file pointer was passed.\n")),
00173                   __FUNCTION__);
00174                 /* Clean up. */
00175                 free (temp_string);
00176                 return (NULL);
00177         }
00178         if (fp->acad_version_number < AutoCAD_14)
00179         {
00180                 fprintf (stderr,
00181                   (_("Warning in %s () illegal DXF version for this entity.\n")),
00182                   __FUNCTION__);
00183         }
00184         if (mlinestyle == NULL)
00185         {
00186                 fprintf (stderr,
00187                   (_("Warning in %s () a NULL pointer was passed.\n")),
00188                   __FUNCTION__);
00189                 mlinestyle = dxf_mlinestyle_new ();
00190                 mlinestyle = dxf_mlinestyle_init (mlinestyle);
00191         }
00192         i = 0;
00193         (fp->line_number)++;
00194         fscanf (fp->fp, "%[^\n]", temp_string);
00195         while (strcmp (temp_string, "0") != 0)
00196         {
00197                 if (ferror (fp->fp))
00198                 {
00199                         fprintf (stderr,
00200                           (_("Error in %s () while reading from: %s in line: %d.\n")),
00201                           __FUNCTION__, fp->filename, fp->line_number);
00202                         /* Clean up. */
00203                         free (temp_string);
00204                         fclose (fp->fp);
00205                         return (NULL);
00206                 }
00207                 if (strcmp (temp_string, "2") == 0)
00208                 {
00209                         /* Now follows a string containing a mlinestyle
00210                          * name string. */
00211                         (fp->line_number)++;
00212                         fscanf (fp->fp, "%s\n", mlinestyle->name);
00213                 }
00214                 if (strcmp (temp_string, "3") == 0)
00215                 {
00216                         /* Now follows a string containing a description
00217                          * string. */
00218                         (fp->line_number)++;
00219                         fscanf (fp->fp, "%s\n", mlinestyle->description);
00220                 }
00221                 if (strcmp (temp_string, "5") == 0)
00222                 {
00223                         /* Now follows a string containing a sequential
00224                          * id number. */
00225                         (fp->line_number)++;
00226                         fscanf (fp->fp, "%x\n", &mlinestyle->id_code);
00227                 }
00228                 if (strcmp (temp_string, "6") == 0)
00229                 {
00230                         /* Now follows a string containing an element
00231                          * linetype. */
00232                         (fp->line_number)++;
00233                         fscanf (fp->fp, "%s\n", mlinestyle->element_linetype[i]);
00234                         i++;
00235                 }
00236                 if (strcmp (temp_string, "49") == 0)
00237                 {
00238                         /* Now follows a string containing an element
00239                          * offset value. */
00240                         (fp->line_number)++;
00241                         fscanf (fp->fp, "%lf\n", &mlinestyle->element_offset[i]);
00242                 }
00243                 if (strcmp (temp_string, "51") == 0)
00244                 {
00245                         /* Now follows a string containing a start angle
00246                          * value. */
00247                         (fp->line_number)++;
00248                         fscanf (fp->fp, "%lf\n", &mlinestyle->start_angle);
00249                 }
00250                 if (strcmp (temp_string, "52") == 0)
00251                 {
00252                         /* Now follows a string containing a end angle
00253                          * value. */
00254                         (fp->line_number)++;
00255                         fscanf (fp->fp, "%lf\n", &mlinestyle->end_angle);
00256                 }
00257                 if ((strcmp (temp_string, "62") == 0)
00258                   && (i == 0))
00259                 {
00260                         /* Now follows a string containing a fill color
00261                          * value. */
00262                         (fp->line_number)++;
00263                         fscanf (fp->fp, "%d\n", &mlinestyle->color);
00264                         i++;
00265                 }
00266                 if ((strcmp (temp_string, "62") == 0)
00267                   && (i > 0))
00268                 {
00269                         /* Now follows a string containing an element
00270                          * color value. */
00271                         (fp->line_number)++;
00272                         fscanf (fp->fp, "%d\n", &mlinestyle->element_color[i]);
00273                 }
00274                 if (strcmp (temp_string, "70") == 0)
00275                 {
00276                         /* Now follows a string containing a flags
00277                          * value. */
00278                         (fp->line_number)++;
00279                         fscanf (fp->fp, "%d\n", &mlinestyle->flags);
00280                 }
00281                 if (strcmp (temp_string, "71") == 0)
00282                 {
00283                         /* Now follows a string containing a number of
00284                          * elements value. */
00285                         (fp->line_number)++;
00286                         fscanf (fp->fp, "%d\n", &mlinestyle->number_of_elements);
00287                 }
00288                 else if ((fp->acad_version_number >= AutoCAD_13)
00289                         && (strcmp (temp_string, "100") == 0))
00290                 {
00291                         /* Now follows a string containing the
00292                          * subclass marker value. */
00293                         (fp->line_number)++;
00294                         fscanf (fp->fp, "%s\n", temp_string);
00295                         if (strcmp (temp_string, "AcDbMlineStyle") != 0)
00296                         {
00297                                 fprintf (stderr,
00298                                   (_("Warning in %s () found a bad subclass marker in: %s in line: %d.\n")),
00299                                   __FUNCTION__, fp->filename, fp->line_number);
00300                         }
00301                 }
00302                 else if (strcmp (temp_string, "330") == 0)
00303                 {
00304                         /* Now follows a string containing Soft-pointer
00305                          * ID/handle to owner dictionary. */
00306                         (fp->line_number)++;
00307                         fscanf (fp->fp, "%s\n", mlinestyle->dictionary_owner_soft);
00308                 }
00309                 else if (strcmp (temp_string, "360") == 0)
00310                 {
00311                         /* Now follows a string containing Hard owner
00312                          * ID/handle to owner dictionary. */
00313                         (fp->line_number)++;
00314                         fscanf (fp->fp, "%s\n", mlinestyle->dictionary_owner_hard);
00315                 }
00316                 else if (strcmp (temp_string, "999") == 0)
00317                 {
00318                         /* Now follows a string containing a comment. */
00319                         (fp->line_number)++;
00320                         fscanf (fp->fp, "%s\n", temp_string);
00321                         fprintf (stdout, (_("DXF comment: %s\n")), temp_string);
00322                 }
00323                 else
00324                 {
00325                         fprintf (stderr,
00326                           (_("Warning in %s () unknown string tag found while reading from: %s in line: %d.\n")),
00327                           __FUNCTION__, fp->filename, fp->line_number);
00328                 }
00329         }
00330         /* Clean up. */
00331         free (temp_string);
00332 #if DEBUG
00333         DXF_DEBUG_END
00334 #endif
00335         return (mlinestyle);
00336 }
00337 
00338 
00352 int
00353 dxf_mlinestyle_write
00354 (
00355         DxfFile *fp,
00357         DxfMlinestyle *mlinestyle
00359 )
00360 {
00361 #if DEBUG
00362         DXF_DEBUG_BEGIN
00363 #endif
00364         char *dxf_entity_name = strdup ("MLINESTYLE");
00365         int i;
00366 
00367         /* Do some basic checks. */
00368         if (fp == NULL)
00369         {
00370                 fprintf (stderr,
00371                   (_("Error in %s () a NULL file pointer was passed.\n")),
00372                   __FUNCTION__);
00373                 /* Clean up. */
00374                 free (dxf_entity_name);
00375                 return (EXIT_FAILURE);
00376         }
00377         if (mlinestyle == NULL)
00378         {
00379                 fprintf (stderr,
00380                   (_("Error in %s () a NULL pointer was passed.\n")),
00381                   __FUNCTION__);
00382                 /* Clean up. */
00383                 free (dxf_entity_name);
00384                 return (EXIT_FAILURE);
00385         }
00386         if ((fp->acad_version_number < AutoCAD_13)
00387           && (fp->follow_strict_version_rules))
00388         {
00389                 fprintf (stderr,
00390                   (_("Error in %s () illegal DXF version for this %s entity with id-code: %x.\n")),
00391                   __FUNCTION__, dxf_entity_name, dxf_mlinestyle_get_id_code (mlinestyle));
00392                 return (EXIT_FAILURE);
00393         }
00394         else
00395         {
00396                 fprintf (stderr,
00397                   (_("Warning in %s () illegal DXF version for this %s entity with id-code: %x.\n")),
00398                   __FUNCTION__, dxf_entity_name, dxf_mlinestyle_get_id_code (mlinestyle));
00399         }
00400         /* Start writing output. */
00401         fprintf (fp->fp, "  0\n%s\n", dxf_entity_name);
00402         if (dxf_mlinestyle_get_id_code (mlinestyle) != -1)
00403         {
00404                 fprintf (fp->fp, "  5\n%x\n", dxf_mlinestyle_get_id_code (mlinestyle));
00405         }
00416         if ((strcmp (dxf_mlinestyle_get_dictionary_owner_soft (mlinestyle), "") != 0)
00417           && (fp->acad_version_number >= AutoCAD_14))
00418         {
00419                 fprintf (fp->fp, "102\n{ACAD_REACTORS\n");
00420                 fprintf (fp->fp, "330\n%s\n", dxf_mlinestyle_get_dictionary_owner_soft (mlinestyle));
00421                 fprintf (fp->fp, "102\n}\n");
00422         }
00423         if ((strcmp (dxf_mlinestyle_get_dictionary_owner_hard (mlinestyle), "") != 0)
00424           && (fp->acad_version_number >= AutoCAD_14))
00425         {
00426                 fprintf (fp->fp, "102\n{ACAD_XDICTIONARY\n");
00427                 fprintf (fp->fp, "360\n%s\n", dxf_mlinestyle_get_dictionary_owner_hard (mlinestyle));
00428                 fprintf (fp->fp, "102\n}\n");
00429         }
00430         if (fp->acad_version_number >= AutoCAD_13)
00431         {
00432                 fprintf (fp->fp, "100\nAcDbMlineStyle\n");
00433         }
00434         fprintf (fp->fp, "  2\n%s\n", dxf_mlinestyle_get_name (mlinestyle));
00435         fprintf (fp->fp, " 70\n%d\n", dxf_mlinestyle_get_flags (mlinestyle));
00436         fprintf (fp->fp, "  3\n%s\n", dxf_mlinestyle_get_description (mlinestyle));
00437         fprintf (fp->fp, " 62\n%d\n", dxf_mlinestyle_get_color (mlinestyle));
00438         fprintf (fp->fp, " 51\n%lf\n", dxf_mlinestyle_get_start_angle (mlinestyle));
00439         fprintf (fp->fp, " 52\n%lf\n", dxf_mlinestyle_get_end_angle (mlinestyle));
00440         fprintf (fp->fp, " 71\n%d\n", dxf_mlinestyle_get_number_of_elements (mlinestyle));
00441         for (i = 1; i < DXF_MAX_PARAM; i++)
00442         {
00443                 fprintf (fp->fp, " 49\n%lf\n", dxf_mlinestyle_get_ith_element_offset (mlinestyle, i));
00444                 fprintf (fp->fp, " 62\n%d\n", dxf_mlinestyle_get_ith_element_color (mlinestyle, i));
00445                 fprintf (fp->fp, "  6\n%s\n", dxf_mlinestyle_get_ith_element_linetype (mlinestyle, i));
00446         }
00447         /* Clean up. */
00448         free (dxf_entity_name);
00449 #if DEBUG
00450         DXF_DEBUG_END
00451 #endif
00452         return (EXIT_SUCCESS);
00453 }
00454 
00455 
00463 int
00464 dxf_mlinestyle_free
00465 (
00466         DxfMlinestyle *mlinestyle
00469 )
00470 {
00471 #if DEBUG
00472         DXF_DEBUG_BEGIN
00473 #endif
00474         int i;
00475 
00476         /* Do some basic checks. */
00477         if (mlinestyle == NULL)
00478         {
00479                 fprintf (stderr,
00480                   (_("Error in %s () a NULL pointer was passed.\n")),
00481                   __FUNCTION__);
00482                 return (EXIT_FAILURE);
00483         }
00484         if (mlinestyle->next != NULL)
00485         {
00486                 fprintf (stderr,
00487                   (_("Error in %s () pointer to next was not NULL.\n")),
00488                   __FUNCTION__);
00489                 return (EXIT_FAILURE);
00490         }
00491         free (dxf_mlinestyle_get_dictionary_owner_soft (mlinestyle));
00492         free (dxf_mlinestyle_get_dictionary_owner_hard (mlinestyle));
00493         free (dxf_mlinestyle_get_name (mlinestyle));
00494         free (dxf_mlinestyle_get_description (mlinestyle));
00495         for (i = 0; i < DXF_MAX_PARAM; i++)
00496         {
00497                 free (dxf_mlinestyle_get_ith_element_linetype (mlinestyle, 1));
00498         }
00499         free (mlinestyle);
00500         mlinestyle = NULL;
00501 #if DEBUG
00502         DXF_DEBUG_END
00503 #endif
00504         return (EXIT_SUCCESS);
00505 }
00506 
00507 
00512 void
00513 dxf_mlinestyle_free_chain
00514 (
00515         DxfMlinestyle *mlinestyles
00517 )
00518 {
00519 #ifdef DEBUG
00520         DXF_DEBUG_BEGIN
00521 #endif
00522         if (mlinestyles == NULL)
00523         {
00524                 fprintf (stderr,
00525                   (_("Warning in %s () a NULL pointer was passed.\n")),
00526                   __FUNCTION__);
00527         }
00528         while (mlinestyles != NULL)
00529         {
00530                 struct DxfMlinestyle *iter = mlinestyles->next;
00531                 dxf_mlinestyle_free (mlinestyles);
00532                 mlinestyles = (DxfMlinestyle *) iter;
00533         }
00534 #if DEBUG
00535         DXF_DEBUG_END
00536 #endif
00537 }
00538 
00539 
00545 int
00546 dxf_mlinestyle_get_id_code
00547 (
00548         DxfMlinestyle *mlinestyle
00550 )
00551 {
00552 #if DEBUG
00553         DXF_DEBUG_BEGIN
00554 #endif
00555         /* Do some basic checks. */
00556         if (mlinestyle == NULL)
00557         {
00558                 fprintf (stderr,
00559                   (_("Error in %s () a NULL pointer was passed.\n")),
00560                   __FUNCTION__);
00561                 return (EXIT_FAILURE);
00562         }
00563         if (mlinestyle->id_code < 0)
00564         {
00565                 fprintf (stderr,
00566                   (_("Error in %s () a negative value was found.\n")),
00567                   __FUNCTION__);
00568                 return (EXIT_FAILURE);
00569         }
00570 #if DEBUG
00571         DXF_DEBUG_END
00572 #endif
00573         return (mlinestyle->id_code);
00574 }
00575 
00576 
00580 DxfMlinestyle *
00581 dxf_mlinestyle_set_id_code
00582 (
00583         DxfMlinestyle *mlinestyle,
00585         int id_code
00589 )
00590 {
00591 #if DEBUG
00592         DXF_DEBUG_BEGIN
00593 #endif
00594         /* Do some basic checks. */
00595         if (mlinestyle == NULL)
00596         {
00597                 fprintf (stderr,
00598                   (_("Error in %s () a NULL pointer was passed.\n")),
00599                   __FUNCTION__);
00600                 return (NULL);
00601         }
00602         if (id_code < 0)
00603         {
00604                 fprintf (stderr,
00605                   (_("Error in %s () a negative value was passed.\n")),
00606                   __FUNCTION__);
00607                 return (NULL);
00608         }
00609         mlinestyle->id_code = id_code;
00610 #if DEBUG
00611         DXF_DEBUG_END
00612 #endif
00613         return (mlinestyle);
00614 }
00615 
00616 
00625 char *
00626 dxf_mlinestyle_get_dictionary_owner_soft
00627 (
00628         DxfMlinestyle *mlinestyle
00630 )
00631 {
00632 #if DEBUG
00633         DXF_DEBUG_BEGIN
00634 #endif
00635         /* Do some basic checks. */
00636         if (mlinestyle == NULL)
00637         {
00638                 fprintf (stderr,
00639                   (_("Error in %s () a NULL pointer was passed.\n")),
00640                   __FUNCTION__);
00641                 return (NULL);
00642         }
00643         if (mlinestyle->dictionary_owner_soft ==  NULL)
00644         {
00645                 fprintf (stderr,
00646                   (_("Error in %s () a NULL pointer was found.\n")),
00647                   __FUNCTION__);
00648                 return (NULL);
00649         }
00650 #if DEBUG
00651         DXF_DEBUG_END
00652 #endif
00653         return (strdup (mlinestyle->dictionary_owner_soft));
00654 }
00655 
00656 
00661 DxfMlinestyle *
00662 dxf_mlinestyle_set_dictionary_owner_soft
00663 (
00664         DxfMlinestyle *mlinestyle,
00666         char *dictionary_owner_soft
00669 )
00670 {
00671 #if DEBUG
00672         DXF_DEBUG_BEGIN
00673 #endif
00674         /* Do some basic checks. */
00675         if (mlinestyle == NULL)
00676         {
00677                 fprintf (stderr,
00678                   (_("Error in %s () a NULL pointer was passed.\n")),
00679                   __FUNCTION__);
00680                 return (NULL);
00681         }
00682         if (dictionary_owner_soft == NULL)
00683         {
00684                 fprintf (stderr,
00685                   (_("Error in %s () a NULL pointer was passed.\n")),
00686                   __FUNCTION__);
00687                 return (NULL);
00688         }
00689         mlinestyle->dictionary_owner_soft = strdup (dictionary_owner_soft);
00690 #if DEBUG
00691         DXF_DEBUG_END
00692 #endif
00693         return (mlinestyle);
00694 }
00695 
00696 
00705 char *
00706 dxf_mlinestyle_get_dictionary_owner_hard
00707 (
00708         DxfMlinestyle *mlinestyle
00710 )
00711 {
00712 #if DEBUG
00713         DXF_DEBUG_BEGIN
00714 #endif
00715         /* Do some basic checks. */
00716         if (mlinestyle == NULL)
00717         {
00718                 fprintf (stderr,
00719                   (_("Error in %s () a NULL pointer was passed.\n")),
00720                   __FUNCTION__);
00721                 return (NULL);
00722         }
00723         if (mlinestyle->dictionary_owner_hard ==  NULL)
00724         {
00725                 fprintf (stderr,
00726                   (_("Error in %s () a NULL pointer was found.\n")),
00727                   __FUNCTION__);
00728                 return (NULL);
00729         }
00730 #if DEBUG
00731         DXF_DEBUG_END
00732 #endif
00733         return (strdup (mlinestyle->dictionary_owner_hard));
00734 }
00735 
00736 
00741 DxfMlinestyle *
00742 dxf_mlinestyle_set_dictionary_owner_hard
00743 (
00744         DxfMlinestyle *mlinestyle,
00746         char *dictionary_owner_hard
00749 )
00750 {
00751 #if DEBUG
00752         DXF_DEBUG_BEGIN
00753 #endif
00754         /* Do some basic checks. */
00755         if (mlinestyle == NULL)
00756         {
00757                 fprintf (stderr,
00758                   (_("Error in %s () a NULL pointer was passed.\n")),
00759                   __FUNCTION__);
00760                 return (NULL);
00761         }
00762         if (dictionary_owner_hard == NULL)
00763         {
00764                 fprintf (stderr,
00765                   (_("Error in %s () a NULL pointer was passed.\n")),
00766                   __FUNCTION__);
00767                 return (NULL);
00768         }
00769         mlinestyle->dictionary_owner_hard = strdup (dictionary_owner_hard);
00770 #if DEBUG
00771         DXF_DEBUG_END
00772 #endif
00773         return (mlinestyle);
00774 }
00775 
00776 
00784 char *
00785 dxf_mlinestyle_get_name
00786 (
00787         DxfMlinestyle *mlinestyle
00789 )
00790 {
00791 #if DEBUG
00792         DXF_DEBUG_BEGIN
00793 #endif
00794         /* Do some basic checks. */
00795         if (mlinestyle == NULL)
00796         {
00797                 fprintf (stderr,
00798                   (_("Error in %s () a NULL pointer was passed.\n")),
00799                   __FUNCTION__);
00800                 return (NULL);
00801         }
00802         if (mlinestyle->name ==  NULL)
00803         {
00804                 fprintf (stderr,
00805                   (_("Error in %s () a NULL pointer was found.\n")),
00806                   __FUNCTION__);
00807                 return (NULL);
00808         }
00809 #if DEBUG
00810         DXF_DEBUG_END
00811 #endif
00812         return (strdup (mlinestyle->name));
00813 }
00814 
00815 
00819 DxfMlinestyle *
00820 dxf_mlinestyle_set_name
00821 (
00822         DxfMlinestyle *mlinestyle,
00824         char *name
00826 )
00827 {
00828 #if DEBUG
00829         DXF_DEBUG_BEGIN
00830 #endif
00831         /* Do some basic checks. */
00832         if (mlinestyle == NULL)
00833         {
00834                 fprintf (stderr,
00835                   (_("Error in %s () a NULL pointer was passed.\n")),
00836                   __FUNCTION__);
00837                 return (NULL);
00838         }
00839         if (name == NULL)
00840         {
00841                 fprintf (stderr,
00842                   (_("Error in %s () a NULL pointer was passed.\n")),
00843                   __FUNCTION__);
00844                 return (NULL);
00845         }
00846         mlinestyle->name = strdup (name);
00847 #if DEBUG
00848         DXF_DEBUG_END
00849 #endif
00850         return (mlinestyle);
00851 }
00852 
00853 
00861 char *
00862 dxf_mlinestyle_get_description
00863 (
00864         DxfMlinestyle *mlinestyle
00866 )
00867 {
00868 #if DEBUG
00869         DXF_DEBUG_BEGIN
00870 #endif
00871         /* Do some basic checks. */
00872         if (mlinestyle == NULL)
00873         {
00874                 fprintf (stderr,
00875                   (_("Error in %s () a NULL pointer was passed.\n")),
00876                   __FUNCTION__);
00877                 return (NULL);
00878         }
00879         if (mlinestyle->description ==  NULL)
00880         {
00881                 fprintf (stderr,
00882                   (_("Error in %s () a NULL pointer was found.\n")),
00883                   __FUNCTION__);
00884                 return (NULL);
00885         }
00886 #if DEBUG
00887         DXF_DEBUG_END
00888 #endif
00889         return (strdup (mlinestyle->description));
00890 }
00891 
00892 
00896 DxfMlinestyle *
00897 dxf_mlinestyle_set_description
00898 (
00899         DxfMlinestyle *mlinestyle,
00901         char *description
00904 )
00905 {
00906 #if DEBUG
00907         DXF_DEBUG_BEGIN
00908 #endif
00909         /* Do some basic checks. */
00910         if (mlinestyle == NULL)
00911         {
00912                 fprintf (stderr,
00913                   (_("Error in %s () a NULL pointer was passed.\n")),
00914                   __FUNCTION__);
00915                 return (NULL);
00916         }
00917         if (description == NULL)
00918         {
00919                 fprintf (stderr,
00920                   (_("Error in %s () a NULL pointer was passed.\n")),
00921                   __FUNCTION__);
00922                 return (NULL);
00923         }
00924         mlinestyle->description = strdup (description);
00925 #if DEBUG
00926         DXF_DEBUG_END
00927 #endif
00928         return (mlinestyle);
00929 }
00930 
00931 
00939 char *
00940 dxf_mlinestyle_get_ith_element_linetype
00941 (
00942         DxfMlinestyle *mlinestyle,
00944         int i
00946 )
00947 {
00948 #if DEBUG
00949         DXF_DEBUG_BEGIN
00950 #endif
00951         /* Do some basic checks. */
00952         if (mlinestyle == NULL)
00953         {
00954                 fprintf (stderr,
00955                   (_("Error in %s () a NULL pointer was passed.\n")),
00956                   __FUNCTION__);
00957                 return (NULL);
00958         }
00959         if (i < 0)
00960         {
00961                 fprintf (stderr,
00962                   (_("Error in %s () a negative array index was passed.\n")),
00963                   __FUNCTION__);
00964                 return (NULL);
00965         }
00966         if (i > DXF_MAX_PARAM)
00967         {
00968                 fprintf (stderr,
00969                   (_("Error in %s () an out of range array index was passed.\n")),
00970                   __FUNCTION__);
00971                 return (NULL);
00972         }
00973         if (mlinestyle->element_linetype[i] ==  NULL)
00974         {
00975                 fprintf (stderr,
00976                   (_("Error in %s () a NULL pointer was found.\n")),
00977                   __FUNCTION__);
00978                 return (NULL);
00979         }
00980 #if DEBUG
00981         DXF_DEBUG_END
00982 #endif
00983         return (strdup (mlinestyle->element_linetype[i]));
00984 }
00985 
00986 
00990 DxfMlinestyle *
00991 dxf_mlinestyle_set_ith_element_linetype
00992 (
00993         DxfMlinestyle *mlinestyle,
00995         char *element_linetype,
00998         int i
01000 )
01001 {
01002 #if DEBUG
01003         DXF_DEBUG_BEGIN
01004 #endif
01005         /* Do some basic checks. */
01006         if (mlinestyle == NULL)
01007         {
01008                 fprintf (stderr,
01009                   (_("Error in %s () a NULL pointer was passed.\n")),
01010                   __FUNCTION__);
01011                 return (NULL);
01012         }
01013         if (element_linetype == NULL)
01014         {
01015                 fprintf (stderr,
01016                   (_("Error in %s () a NULL pointer was passed.\n")),
01017                   __FUNCTION__);
01018                 return (NULL);
01019         }
01020         if (i < 0)
01021         {
01022                 fprintf (stderr,
01023                   (_("Error in %s () a negative array index was passed.\n")),
01024                   __FUNCTION__);
01025                 return (NULL);
01026         }
01027         if (i > DXF_MAX_PARAM)
01028         {
01029                 fprintf (stderr,
01030                   (_("Error in %s () an out of range array index was passed.\n")),
01031                   __FUNCTION__);
01032                 return (NULL);
01033         }
01034         mlinestyle->element_linetype[i] = strdup (element_linetype);
01035 #if DEBUG
01036         DXF_DEBUG_END
01037 #endif
01038         return (mlinestyle);
01039 }
01040 
01041 
01047 double
01048 dxf_mlinestyle_get_element_offset
01049 (
01050         DxfMlinestyle *mlinestyle
01052 )
01053 {
01054 #ifdef DEBUG
01055         DXF_DEBUG_BEGIN
01056 #endif
01057 
01058         /* Do some basic checks. */
01059         if (mlinestyle == NULL)
01060         {
01061                 fprintf (stderr,
01062                   (_("Error in %s () a NULL pointer was passed.\n")),
01063                   __FUNCTION__);
01064                 return (EXIT_FAILURE);
01065         }
01066         if (mlinestyle->element_offset == NULL)
01067         {
01068                 fprintf (stderr,
01069                   (_("Error in %s () a NULL pointer was found.\n")),
01070                   __FUNCTION__);
01071                 return (EXIT_FAILURE);
01072         }
01073 #if DEBUG
01074         DXF_DEBUG_END
01075 #endif
01076         return (*(mlinestyle->element_offset));
01077 }
01078 
01079 
01087 DxfMlinestyle *
01088 dxf_mlinestyle_set_element_offset
01089 (
01090         DxfMlinestyle *mlinestyle,
01092         double *element_offset
01095 )
01096 {
01097 #ifdef DEBUG
01098         DXF_DEBUG_BEGIN
01099 #endif
01100         /* Do some basic checks. */
01101         if (mlinestyle == NULL)
01102         {
01103                 fprintf (stderr,
01104                   (_("Error in %s () a NULL pointer was passed.\n")),
01105                   __FUNCTION__);
01106                 return (NULL);
01107         }
01108         if (element_offset == NULL)
01109         {
01110                 fprintf (stderr,
01111                   (_("Error in %s () a NULL pointer was passed.\n")),
01112                   __FUNCTION__);
01113                 return (NULL);
01114         }
01115         *(mlinestyle->element_offset) = *element_offset;
01116 #if DEBUG
01117         DXF_DEBUG_END
01118 #endif
01119         return (mlinestyle);
01120 }
01121 
01122 
01128 double
01129 dxf_mlinestyle_get_ith_element_offset
01130 (
01131         DxfMlinestyle *mlinestyle,
01133         int i
01135 )
01136 {
01137 #if DEBUG
01138         DXF_DEBUG_BEGIN
01139 #endif
01140         /* Do some basic checks. */
01141         if (mlinestyle == NULL)
01142         {
01143                 fprintf (stderr,
01144                   (_("Error in %s () a NULL pointer was passed.\n")),
01145                   __FUNCTION__);
01146                 return (EXIT_FAILURE);
01147         }
01148         if (i < 0)
01149         {
01150                 fprintf (stderr,
01151                   (_("Error in %s () a negative array index was passed.\n")),
01152                   __FUNCTION__);
01153                 return (EXIT_FAILURE);
01154         }
01155         if (i > DXF_MAX_PARAM)
01156         {
01157                 fprintf (stderr,
01158                   (_("Error in %s () an out of range array index was passed.\n")),
01159                   __FUNCTION__);
01160                 return (EXIT_FAILURE);
01161         }
01162 #if DEBUG
01163         DXF_DEBUG_END
01164 #endif
01165         return (mlinestyle->element_offset[i]);
01166 }
01167 
01168 
01172 DxfMlinestyle *
01173 dxf_mlinestyle_set_ith_element_offset
01174 (
01175         DxfMlinestyle *mlinestyle,
01177         double element_offset,
01180         int i
01182 )
01183 {
01184 #if DEBUG
01185         DXF_DEBUG_BEGIN
01186 #endif
01187         /* Do some basic checks. */
01188         if (mlinestyle == NULL)
01189         {
01190                 fprintf (stderr,
01191                   (_("Error in %s () a NULL pointer was passed.\n")),
01192                   __FUNCTION__);
01193                 return (NULL);
01194         }
01195         if (i < 0)
01196         {
01197                 fprintf (stderr,
01198                   (_("Error in %s () a negative array index was passed.\n")),
01199                   __FUNCTION__);
01200                 return (NULL);
01201         }
01202         if (i > DXF_MAX_PARAM)
01203         {
01204                 fprintf (stderr,
01205                   (_("Error in %s () an out of range array index was passed.\n")),
01206                   __FUNCTION__);
01207                 return (NULL);
01208         }
01209         mlinestyle->element_offset[i] = element_offset;
01210 #if DEBUG
01211         DXF_DEBUG_END
01212 #endif
01213         return (mlinestyle);
01214 }
01215 
01216 
01222 double
01223 dxf_mlinestyle_get_start_angle
01224 (
01225         DxfMlinestyle *mlinestyle
01227 )
01228 {
01229 #if DEBUG
01230         DXF_DEBUG_BEGIN
01231 #endif
01232         /* Do some basic checks. */
01233         if (mlinestyle == NULL)
01234         {
01235                 fprintf (stderr,
01236                   (_("Error in %s () a NULL pointer was passed.\n")),
01237                   __FUNCTION__);
01238                 return (EXIT_FAILURE);
01239         }
01240 #if DEBUG
01241         DXF_DEBUG_END
01242 #endif
01243         return (mlinestyle->start_angle);
01244 }
01245 
01246 
01250 DxfMlinestyle *
01251 dxf_mlinestyle_set_start_angle
01252 (
01253         DxfMlinestyle *mlinestyle,
01255         double start_angle
01257 )
01258 {
01259 #if DEBUG
01260         DXF_DEBUG_BEGIN
01261 #endif
01262         /* Do some basic checks. */
01263         if (mlinestyle == NULL)
01264         {
01265                 fprintf (stderr,
01266                   (_("Error in %s () a NULL pointer was passed.\n")),
01267                   __FUNCTION__);
01268                 return (NULL);
01269         }
01270         mlinestyle->start_angle = start_angle;
01271 #if DEBUG
01272         DXF_DEBUG_END
01273 #endif
01274         return (mlinestyle);
01275 }
01276 
01277 
01283 double
01284 dxf_mlinestyle_get_end_angle
01285 (
01286         DxfMlinestyle *mlinestyle
01288 )
01289 {
01290 #if DEBUG
01291         DXF_DEBUG_BEGIN
01292 #endif
01293         /* Do some basic checks. */
01294         if (mlinestyle == NULL)
01295         {
01296                 fprintf (stderr,
01297                   (_("Error in %s () a NULL pointer was passed.\n")),
01298                   __FUNCTION__);
01299                 return (EXIT_FAILURE);
01300         }
01301 #if DEBUG
01302         DXF_DEBUG_END
01303 #endif
01304         return (mlinestyle->end_angle);
01305 }
01306 
01307 
01311 DxfMlinestyle *
01312 dxf_mlinestyle_set_end_angle
01313 (
01314         DxfMlinestyle *mlinestyle,
01316         double end_angle
01318 )
01319 {
01320 #if DEBUG
01321         DXF_DEBUG_BEGIN
01322 #endif
01323         /* Do some basic checks. */
01324         if (mlinestyle == NULL)
01325         {
01326                 fprintf (stderr,
01327                   (_("Error in %s () a NULL pointer was passed.\n")),
01328                   __FUNCTION__);
01329                 return (NULL);
01330         }
01331         mlinestyle->end_angle = end_angle;
01332 #if DEBUG
01333         DXF_DEBUG_END
01334 #endif
01335         return (mlinestyle);
01336 }
01337 
01338 
01344 int
01345 dxf_mlinestyle_get_color
01346 (
01347         DxfMlinestyle *mlinestyle
01349 )
01350 {
01351 #if DEBUG
01352         DXF_DEBUG_BEGIN
01353 #endif
01354         /* Do some basic checks. */
01355         if (mlinestyle == NULL)
01356         {
01357                 fprintf (stderr,
01358                   (_("Error in %s () a NULL pointer was passed.\n")),
01359                   __FUNCTION__);
01360                 return (EXIT_FAILURE);
01361         }
01362         if (mlinestyle->color < 0)
01363         {
01364                 fprintf (stderr,
01365                   (_("Warning in %s () a negative value was found.\n")),
01366                   __FUNCTION__);
01367         }
01368 #if DEBUG
01369         DXF_DEBUG_END
01370 #endif
01371         return (mlinestyle->color);
01372 }
01373 
01374 
01378 DxfMlinestyle *
01379 dxf_mlinestyle_set_color
01380 (
01381         DxfMlinestyle *mlinestyle,
01383         int color
01385 )
01386 {
01387 #if DEBUG
01388         DXF_DEBUG_BEGIN
01389 #endif
01390         /* Do some basic checks. */
01391         if (mlinestyle == NULL)
01392         {
01393                 fprintf (stderr,
01394                   (_("Error in %s () a NULL pointer was passed.\n")),
01395                   __FUNCTION__);
01396                 return (NULL);
01397         }
01398         if (color < 0)
01399         {
01400                 fprintf (stderr,
01401                   (_("Warning in %s () a negative value was passed.\n")),
01402                   __FUNCTION__);
01403         }
01404         mlinestyle->color = color;
01405 #if DEBUG
01406         DXF_DEBUG_END
01407 #endif
01408         return (mlinestyle);
01409 }
01410 
01411 
01417 int
01418 dxf_mlinestyle_get_ith_element_color
01419 (
01420         DxfMlinestyle *mlinestyle,
01422         int i
01424 )
01425 {
01426 #if DEBUG
01427         DXF_DEBUG_BEGIN
01428 #endif
01429         /* Do some basic checks. */
01430         if (mlinestyle == NULL)
01431         {
01432                 fprintf (stderr,
01433                   (_("Error in %s () a NULL pointer was passed.\n")),
01434                   __FUNCTION__);
01435                 return (EXIT_FAILURE);
01436         }
01437         if (i < 0)
01438         {
01439                 fprintf (stderr,
01440                   (_("Error in %s () a negative array index was passed.\n")),
01441                   __FUNCTION__);
01442                 return (EXIT_FAILURE);
01443         }
01444         if (i > DXF_MAX_PARAM)
01445         {
01446                 fprintf (stderr,
01447                   (_("Error in %s () an out of range array index was passed.\n")),
01448                   __FUNCTION__);
01449                 return (EXIT_FAILURE);
01450         }
01451 #if DEBUG
01452         DXF_DEBUG_END
01453 #endif
01454         return (mlinestyle->element_color[i]);
01455 }
01456 
01457 
01461 DxfMlinestyle *
01462 dxf_mlinestyle_set_ith_element_color
01463 (
01464         DxfMlinestyle *mlinestyle,
01466         int element_color,
01468         int i
01470 )
01471 {
01472 #if DEBUG
01473         DXF_DEBUG_BEGIN
01474 #endif
01475         /* Do some basic checks. */
01476         if (mlinestyle == NULL)
01477         {
01478                 fprintf (stderr,
01479                   (_("Error in %s () a NULL pointer was passed.\n")),
01480                   __FUNCTION__);
01481                 return (NULL);
01482         }
01483         if (element_color < 0)
01484         {
01485                 fprintf (stderr,
01486                   (_("Warning in %s () a negative value was passed.\n")),
01487                   __FUNCTION__);
01488         }
01489         if (i < 0)
01490         {
01491                 fprintf (stderr,
01492                   (_("Error in %s () a negative array index was passed.\n")),
01493                   __FUNCTION__);
01494                 return (NULL);
01495         }
01496         if (i > DXF_MAX_PARAM)
01497         {
01498                 fprintf (stderr,
01499                   (_("Error in %s () an out of range array index was passed.\n")),
01500                   __FUNCTION__);
01501                 return (NULL);
01502         }
01503         mlinestyle->element_color[i] = element_color;
01504 #if DEBUG
01505         DXF_DEBUG_END
01506 #endif
01507         return (mlinestyle);
01508 }
01509 
01510 
01516 int
01517 dxf_mlinestyle_get_flags
01518 (
01519         DxfMlinestyle *mlinestyle
01521 )
01522 {
01523 #if DEBUG
01524         DXF_DEBUG_BEGIN
01525 #endif
01526         /* Do some basic checks. */
01527         if (mlinestyle == NULL)
01528         {
01529                 fprintf (stderr,
01530                   (_("Error in %s () a NULL pointer was passed.\n")),
01531                   __FUNCTION__);
01532                 return (EXIT_FAILURE);
01533         }
01534         if (mlinestyle->flags < 0)
01535         {
01536                 fprintf (stderr,
01537                   (_("Error in %s () a negative value was found.\n")),
01538                   __FUNCTION__);
01539                 return (EXIT_FAILURE);
01540         }
01541         if (mlinestyle->flags > 2047)
01542         {
01543                 fprintf (stderr,
01544                   (_("Error in %s () an out of range value was found.\n")),
01545                   __FUNCTION__);
01546                 return (EXIT_FAILURE);
01547         }
01548 #if DEBUG
01549         DXF_DEBUG_END
01550 #endif
01551         return (mlinestyle->flags);
01552 }
01553 
01554 
01558 DxfMlinestyle *
01559 dxf_mlinestyle_set_flags
01560 (
01561         DxfMlinestyle *mlinestyle,
01563         int flags
01565 )
01566 {
01567 #if DEBUG
01568         DXF_DEBUG_BEGIN
01569 #endif
01570         /* Do some basic checks. */
01571         if (mlinestyle == NULL)
01572         {
01573                 fprintf (stderr,
01574                   (_("Error in %s () a NULL pointer was passed.\n")),
01575                   __FUNCTION__);
01576                 return (NULL);
01577         }
01578         if (flags < 0)
01579         {
01580                 fprintf (stderr,
01581                   (_("Error in %s () a negative value was passed.\n")),
01582                   __FUNCTION__);
01583                 return (NULL);
01584         }
01585         if (flags > 2047)
01586         {
01587                 fprintf (stderr,
01588                   (_("Error in %s () an out of range value was passed.\n")),
01589                   __FUNCTION__);
01590                 return (NULL);
01591         }
01592         mlinestyle->flags = flags;
01593 #if DEBUG
01594         DXF_DEBUG_END
01595 #endif
01596         return (mlinestyle);
01597 }
01598 
01599 
01606 int
01607 dxf_mlinestyle_flag_is_fill_on
01608 (
01609         DxfMlinestyle *mlinestyle
01611 )
01612 {
01613 #if DEBUG
01614         DXF_DEBUG_BEGIN
01615 #endif
01616         /* Do some basic checks. */
01617         if (mlinestyle == NULL)
01618         {
01619                 fprintf (stderr,
01620                   (_("Error in %s () a NULL pointer was passed.\n")),
01621                   __FUNCTION__);
01622                 return (EXIT_FAILURE);
01623         }
01624 #if DEBUG
01625         DXF_DEBUG_END
01626 #endif
01627         return (DXF_CHECK_BIT (mlinestyle->flags, 0));
01628 }
01629 
01630 
01638 int
01639 dxf_mlinestyle_flag_is_display_miters
01640 (
01641         DxfMlinestyle *mlinestyle
01643 )
01644 {
01645 #if DEBUG
01646         DXF_DEBUG_BEGIN
01647 #endif
01648         /* Do some basic checks. */
01649         if (mlinestyle == NULL)
01650         {
01651                 fprintf (stderr,
01652                   (_("Error in %s () a NULL pointer was passed.\n")),
01653                   __FUNCTION__);
01654                 return (EXIT_FAILURE);
01655         }
01656 #if DEBUG
01657         DXF_DEBUG_END
01658 #endif
01659         return (DXF_CHECK_BIT (mlinestyle->flags, 1));
01660 }
01661 
01662 
01670 int
01671 dxf_mlinestyle_flag_is_start_square_end_cap
01672 (
01673         DxfMlinestyle *mlinestyle
01675 )
01676 {
01677 #if DEBUG
01678         DXF_DEBUG_BEGIN
01679 #endif
01680         /* Do some basic checks. */
01681         if (mlinestyle == NULL)
01682         {
01683                 fprintf (stderr,
01684                   (_("Error in %s () a NULL pointer was passed.\n")),
01685                   __FUNCTION__);
01686                 return (EXIT_FAILURE);
01687         }
01688 #if DEBUG
01689         DXF_DEBUG_END
01690 #endif
01691         return (DXF_CHECK_BIT (mlinestyle->flags, 4));
01692 }
01693 
01694 
01702 int
01703 dxf_mlinestyle_flag_is_start_inner_arcs_cap
01704 (
01705         DxfMlinestyle *mlinestyle
01707 )
01708 {
01709 #if DEBUG
01710         DXF_DEBUG_BEGIN
01711 #endif
01712         /* Do some basic checks. */
01713         if (mlinestyle == NULL)
01714         {
01715                 fprintf (stderr,
01716                   (_("Error in %s () a NULL pointer was passed.\n")),
01717                   __FUNCTION__);
01718                 return (EXIT_FAILURE);
01719         }
01720 #if DEBUG
01721         DXF_DEBUG_END
01722 #endif
01723         return (DXF_CHECK_BIT (mlinestyle->flags, 5));
01724 }
01725 
01726 
01734 int
01735 dxf_mlinestyle_flag_is_start_round_outer_arcs_cap
01736 (
01737         DxfMlinestyle *mlinestyle
01739 )
01740 {
01741 #if DEBUG
01742         DXF_DEBUG_BEGIN
01743 #endif
01744         /* Do some basic checks. */
01745         if (mlinestyle == NULL)
01746         {
01747                 fprintf (stderr,
01748                   (_("Error in %s () a NULL pointer was passed.\n")),
01749                   __FUNCTION__);
01750                 return (EXIT_FAILURE);
01751         }
01752 #if DEBUG
01753         DXF_DEBUG_END
01754 #endif
01755         return (DXF_CHECK_BIT (mlinestyle->flags, 6));
01756 }
01757 
01758 
01766 int
01767 dxf_mlinestyle_flag_is_end_square_end_cap
01768 (
01769         DxfMlinestyle *mlinestyle
01771 )
01772 {
01773 #if DEBUG
01774         DXF_DEBUG_BEGIN
01775 #endif
01776         /* Do some basic checks. */
01777         if (mlinestyle == NULL)
01778         {
01779                 fprintf (stderr,
01780                   (_("Error in %s () a NULL pointer was passed.\n")),
01781                   __FUNCTION__);
01782                 return (EXIT_FAILURE);
01783         }
01784 #if DEBUG
01785         DXF_DEBUG_END
01786 #endif
01787         return (DXF_CHECK_BIT (mlinestyle->flags, 8));
01788 }
01789 
01790 
01798 int
01799 dxf_mlinestyle_flag_is_end_inner_arcs_cap
01800 (
01801         DxfMlinestyle *mlinestyle
01803 )
01804 {
01805 #if DEBUG
01806         DXF_DEBUG_BEGIN
01807 #endif
01808         /* Do some basic checks. */
01809         if (mlinestyle == NULL)
01810         {
01811                 fprintf (stderr,
01812                   (_("Error in %s () a NULL pointer was passed.\n")),
01813                   __FUNCTION__);
01814                 return (EXIT_FAILURE);
01815         }
01816 #if DEBUG
01817         DXF_DEBUG_END
01818 #endif
01819         return (DXF_CHECK_BIT (mlinestyle->flags, 9));
01820 }
01821 
01822 
01830 int
01831 dxf_mlinestyle_flag_is_end_round_outer_arcs_cap
01832 (
01833         DxfMlinestyle *mlinestyle
01835 )
01836 {
01837 #if DEBUG
01838         DXF_DEBUG_BEGIN
01839 #endif
01840         /* Do some basic checks. */
01841         if (mlinestyle == NULL)
01842         {
01843                 fprintf (stderr,
01844                   (_("Error in %s () a NULL pointer was passed.\n")),
01845                   __FUNCTION__);
01846                 return (EXIT_FAILURE);
01847         }
01848 #if DEBUG
01849         DXF_DEBUG_END
01850 #endif
01851         return (DXF_CHECK_BIT (mlinestyle->flags, 10));
01852 }
01853 
01854 
01860 int
01861 dxf_mlinestyle_get_number_of_elements
01862 (
01863         DxfMlinestyle *mlinestyle
01865 )
01866 {
01867 #if DEBUG
01868         DXF_DEBUG_BEGIN
01869 #endif
01870         /* Do some basic checks. */
01871         if (mlinestyle == NULL)
01872         {
01873                 fprintf (stderr,
01874                   (_("Error in %s () a NULL pointer was passed.\n")),
01875                   __FUNCTION__);
01876                 return (EXIT_FAILURE);
01877         }
01878         if (mlinestyle->number_of_elements < 0)
01879         {
01880                 fprintf (stderr,
01881                   (_("Error in %s () a negative value was found.\n")),
01882                   __FUNCTION__);
01883                 return (EXIT_FAILURE);
01884         }
01885 #if DEBUG
01886         DXF_DEBUG_END
01887 #endif
01888         return (mlinestyle->number_of_elements);
01889 }
01890 
01891 
01895 DxfMlinestyle *
01896 dxf_mlinestyle_set_number_of_elements
01897 (
01898         DxfMlinestyle *mlinestyle,
01900         int number_of_elements
01902 )
01903 {
01904 #if DEBUG
01905         DXF_DEBUG_BEGIN
01906 #endif
01907         /* Do some basic checks. */
01908         if (mlinestyle == NULL)
01909         {
01910                 fprintf (stderr,
01911                   (_("Error in %s () a NULL pointer was passed.\n")),
01912                   __FUNCTION__);
01913                 return (NULL);
01914         }
01915         if (number_of_elements < 0)
01916         {
01917                 fprintf (stderr,
01918                   (_("Error in %s () a negative value was passed.\n")),
01919                   __FUNCTION__);
01920                 return (NULL);
01921         }
01922         mlinestyle->number_of_elements = number_of_elements;
01923 #if DEBUG
01924         DXF_DEBUG_END
01925 #endif
01926         return (mlinestyle);
01927 }
01928 
01929 
01938 DxfMlinestyle *
01939 dxf_mlinestyle_get_next
01940 (
01941         DxfMlinestyle *mlinestyle
01943 )
01944 {
01945 #if DEBUG
01946         DXF_DEBUG_BEGIN
01947 #endif
01948         /* Do some basic checks. */
01949         if (mlinestyle == NULL)
01950         {
01951                 fprintf (stderr,
01952                   (_("Error in %s () a NULL pointer was passed.\n")),
01953                   __FUNCTION__);
01954                 return (NULL);
01955         }
01956         if (mlinestyle->next == NULL)
01957         {
01958                 fprintf (stderr,
01959                   (_("Error in %s () a NULL pointer was found.\n")),
01960                   __FUNCTION__);
01961                 return (NULL);
01962         }
01963 #if DEBUG
01964         DXF_DEBUG_END
01965 #endif
01966         return ((DxfMlinestyle *) mlinestyle->next);
01967 }
01968 
01969 
01974 DxfMlinestyle *
01975 dxf_mlinestyle_set_next
01976 (
01977         DxfMlinestyle *mlinestyle,
01979         DxfMlinestyle *next
01981 )
01982 {
01983 #if DEBUG
01984         DXF_DEBUG_BEGIN
01985 #endif
01986         /* Do some basic checks. */
01987         if (mlinestyle == NULL)
01988         {
01989                 fprintf (stderr,
01990                   (_("Error in %s () a NULL pointer was passed.\n")),
01991                   __FUNCTION__);
01992                 return (NULL);
01993         }
01994         if (next == NULL)
01995         {
01996                 fprintf (stderr,
01997                   (_("Error in %s () a NULL pointer was passed.\n")),
01998                   __FUNCTION__);
01999                 return (NULL);
02000         }
02001         mlinestyle->next = (struct DxfMlinestyle *) next;
02002 #if DEBUG
02003         DXF_DEBUG_END
02004 #endif
02005         return (mlinestyle);
02006 }
02007 
02008 
02017 DxfMlinestyle *
02018 dxf_mlinestyle_get_last
02019 (
02020         DxfMlinestyle *mlinestyle
02022 )
02023 {
02024 #if DEBUG
02025         DXF_DEBUG_BEGIN
02026 #endif
02027         /* Do some basic checks. */
02028         if (mlinestyle == NULL)
02029         {
02030                 fprintf (stderr,
02031                   (_("Error in %s () a NULL pointer was passed.\n")),
02032                   __FUNCTION__);
02033                 return (NULL);
02034         }
02035         if (mlinestyle->next == NULL)
02036         {
02037                 fprintf (stderr,
02038                   (_("Warning in %s () a NULL pointer was found.\n")),
02039                   __FUNCTION__);
02040                 return ((DxfMlinestyle *) mlinestyle);
02041         }
02042         DxfMlinestyle *iter = (DxfMlinestyle *) mlinestyle->next;
02043         while (iter->next != NULL)
02044         {
02045                 iter = (DxfMlinestyle *) iter->next;
02046         }
02047 #if DEBUG
02048         DXF_DEBUG_END
02049 #endif
02050         return ((DxfMlinestyle *) iter);
02051 }
02052 
02053 
02054 /* EOF */