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

rastervariables.c

Go to the documentation of this file.
00001 
00043 #include "rastervariables.h"
00044 
00045 
00051 DxfRasterVariables *
00052 dxf_rastervariables_new ()
00053 {
00054 #if DEBUG
00055         DXF_DEBUG_BEGIN
00056 #endif
00057         DxfRasterVariables *rastervariables = NULL;
00058         size_t size;
00059 
00060         size = sizeof (DxfRasterVariables);
00061         /* avoid malloc of 0 bytes */
00062         if (size == 0) size = 1;
00063         if ((rastervariables = malloc (size)) == NULL)
00064         {
00065                 fprintf (stderr,
00066                   (_("Error in %s () could not allocate memory for a DxfRasterVariables struct.\n")),
00067                   __FUNCTION__);
00068                 rastervariables = NULL;
00069         }
00070         else
00071         {
00072                 memset (rastervariables, 0, size);
00073         }
00074 #if DEBUG
00075         DXF_DEBUG_END
00076 #endif
00077         return (rastervariables);
00078 }
00079 
00080 
00088 DxfRasterVariables *
00089 dxf_rastervariables_init
00090 (
00091         DxfRasterVariables *rastervariables
00093 )
00094 {
00095 #if DEBUG
00096         DXF_DEBUG_BEGIN
00097 #endif
00098         /* Do some basic checks. */
00099         if (rastervariables == NULL)
00100         {
00101                 fprintf (stderr,
00102                   (_("Warning in %s () a NULL pointer was passed.\n")),
00103                   __FUNCTION__);
00104                 rastervariables = dxf_rastervariables_new ();
00105         }
00106         if (rastervariables == NULL)
00107         {
00108                 fprintf (stderr,
00109                   (_("Error in %s () could not allocate memory for a DxfRasterVariables struct.\n")),
00110                   __FUNCTION__);
00111                 return (NULL);
00112         }
00113         rastervariables->id_code = 0;
00114         rastervariables->dictionary_owner_soft = strdup ("");
00115         rastervariables->dictionary_owner_hard = strdup ("");
00116         rastervariables->display_image_frame = 0;
00117         rastervariables->display_quality = 0;
00118         rastervariables->units = 0;
00119         rastervariables->class_version = 0;
00120         rastervariables->next = NULL;
00121 #if DEBUG
00122         DXF_DEBUG_END
00123 #endif
00124         return (rastervariables);
00125 }
00126 
00127 
00139 DxfRasterVariables *
00140 dxf_rastervariables_read
00141 (
00142         DxfFile *fp,
00144         DxfRasterVariables *rastervariables
00146 )
00147 {
00148 #if DEBUG
00149         DXF_DEBUG_BEGIN
00150 #endif
00151         char *temp_string = NULL;
00152         int i;
00153 
00154         /* Do some basic checks. */
00155         if (fp == NULL)
00156         {
00157                 fprintf (stderr,
00158                   (_("Error in %s () a NULL file pointer was passed.\n")),
00159                   __FUNCTION__);
00160                 /* Clean up. */
00161                 free (temp_string);
00162                 return (NULL);
00163         }
00164         if (fp->acad_version_number < AutoCAD_14)
00165         {
00166                 fprintf (stderr,
00167                   (_("Warning in %s () illegal DXF version for this entity.\n")),
00168                   __FUNCTION__);
00169         }
00170         if (rastervariables == NULL)
00171         {
00172                 fprintf (stderr,
00173                   (_("Warning in %s () a NULL pointer was passed.\n")),
00174                   __FUNCTION__);
00175                 rastervariables = dxf_rastervariables_new ();
00176                 rastervariables = dxf_rastervariables_init (rastervariables);
00177         }
00178         i = 0;
00179         (fp->line_number)++;
00180         fscanf (fp->fp, "%[^\n]", temp_string);
00181         while (strcmp (temp_string, "0") != 0)
00182         {
00183                 if (ferror (fp->fp))
00184                 {
00185                         fprintf (stderr,
00186                           (_("Error in %s () while reading from: %s in line: %d.\n")),
00187                           __FUNCTION__, fp->filename, fp->line_number);
00188                         /* Clean up. */
00189                         free (temp_string);
00190                         fclose (fp->fp);
00191                         return (NULL);
00192                 }
00193                 if (strcmp (temp_string, "5") == 0)
00194                 {
00195                         /* Now follows a string containing a sequential
00196                          * id number. */
00197                         (fp->line_number)++;
00198                         fscanf (fp->fp, "%x\n", &rastervariables->id_code);
00199                 }
00200                 if (strcmp (temp_string, "70") == 0)
00201                 {
00202                         /* Now follows a string containing a display
00203                          * image frame flag value. */
00204                         (fp->line_number)++;
00205                         fscanf (fp->fp, "%d\n", &rastervariables->display_image_frame);
00206                 }
00207                 if (strcmp (temp_string, "71") == 0)
00208                 {
00209                         /* Now follows a string containing a display
00210                          * quality flag value. */
00211                         (fp->line_number)++;
00212                         fscanf (fp->fp, "%d\n", &rastervariables->display_quality);
00213                 }
00214                 if (strcmp (temp_string, "72") == 0)
00215                 {
00216                         /* Now follows a string containing a units
00217                          * value. */
00218                         (fp->line_number)++;
00219                         fscanf (fp->fp, "%d\n", &rastervariables->units);
00220                 }
00221                 else if (strcmp (temp_string, "90") == 0)
00222                 {
00223                         /* Now follows a string containing the
00224                          * value of class version. */
00225                         (fp->line_number)++;
00226                         fscanf (fp->fp, "%d\n", &rastervariables->class_version);
00227                 }
00228                 else if ((fp->acad_version_number >= AutoCAD_13)
00229                         && (strcmp (temp_string, "100") == 0))
00230                 {
00231                         /* Now follows a string containing the
00232                          * subclass marker value. */
00233                         (fp->line_number)++;
00234                         fscanf (fp->fp, "%s\n", temp_string);
00235                         if (strcmp (temp_string, "AcDbIdBuffer") != 0)
00236                         {
00237                                 fprintf (stderr,
00238                                   (_("Warning in %s () found a bad subclass marker in: %s in line: %d.\n")),
00239                                   __FUNCTION__, fp->filename, fp->line_number);
00240                         }
00241                 }
00242                 else if (strcmp (temp_string, "330") == 0)
00243                 {
00244                         /* Now follows a string containing Soft-pointer
00245                          * ID/handle to owner dictionary. */
00246                         (fp->line_number)++;
00247                         fscanf (fp->fp, "%s\n", rastervariables->dictionary_owner_soft);
00248                         i++;
00249                 }
00250                 else if (strcmp (temp_string, "360") == 0)
00251                 {
00252                         /* Now follows a string containing Hard owner
00253                          * ID/handle to owner dictionary. */
00254                         (fp->line_number)++;
00255                         fscanf (fp->fp, "%s\n", rastervariables->dictionary_owner_hard);
00256                 }
00257                 else if (strcmp (temp_string, "999") == 0)
00258                 {
00259                         /* Now follows a string containing a comment. */
00260                         (fp->line_number)++;
00261                         fscanf (fp->fp, "%s\n", temp_string);
00262                         fprintf (stdout, (_("DXF comment: %s\n")), temp_string);
00263                 }
00264                 else
00265                 {
00266                         fprintf (stderr,
00267                           (_("Warning in %s () unknown string tag found while reading from: %s in line: %d.\n")),
00268                           __FUNCTION__, fp->filename, fp->line_number);
00269                 }
00270         }
00271         /* Clean up. */
00272         free (temp_string);
00273 #if DEBUG
00274         DXF_DEBUG_END
00275 #endif
00276         return (rastervariables);
00277 }
00278 
00279 
00286 int
00287 dxf_rastervariables_write
00288 (
00289         DxfFile *fp,
00291         DxfRasterVariables *rastervariables
00293 )
00294 {
00295 #if DEBUG
00296         DXF_DEBUG_BEGIN
00297 #endif
00298         char *dxf_entity_name = strdup ("RASTERVARIABLES");
00299 
00300         /* Do some basic checks. */
00301         if (fp == NULL)
00302         {
00303                 fprintf (stderr,
00304                   (_("Error in %s () a NULL file pointer was passed.\n")),
00305                   __FUNCTION__);
00306                 /* Clean up. */
00307                 free (dxf_entity_name);
00308                 return (EXIT_FAILURE);
00309         }
00310         if (rastervariables == NULL)
00311         {
00312                 fprintf (stderr,
00313                   (_("Error in %s () a NULL pointer was passed.\n")),
00314                   __FUNCTION__);
00315                 /* Clean up. */
00316                 free (dxf_entity_name);
00317                 return (EXIT_FAILURE);
00318         }
00319         if (fp->acad_version_number < AutoCAD_14)
00320         {
00321                 fprintf (stderr,
00322                   (_("Warning in %s () illegal DXF version for this %s entity with id-code: %x.\n")),
00323                   __FUNCTION__, dxf_entity_name, rastervariables->id_code);
00324         }
00325         /* Start writing output. */
00326         fprintf (fp->fp, "  0\n%s\n", dxf_entity_name);
00327         if (rastervariables->id_code != -1)
00328         {
00329                 fprintf (fp->fp, "  5\n%x\n", rastervariables->id_code);
00330         }
00341         if ((strcmp (rastervariables->dictionary_owner_soft, "") != 0)
00342           && (fp->acad_version_number >= AutoCAD_14))
00343         {
00344                 fprintf (fp->fp, "102\n{ACAD_REACTORS\n");
00345                 fprintf (fp->fp, "330\n%s\n", rastervariables->dictionary_owner_soft);
00346                 fprintf (fp->fp, "102\n}\n");
00347         }
00348         if ((strcmp (rastervariables->dictionary_owner_hard, "") != 0)
00349           && (fp->acad_version_number >= AutoCAD_14))
00350         {
00351                 fprintf (fp->fp, "102\n{ACAD_XDICTIONARY\n");
00352                 fprintf (fp->fp, "360\n%s\n", rastervariables->dictionary_owner_hard);
00353                 fprintf (fp->fp, "102\n}\n");
00354         }
00355         if (fp->acad_version_number >= AutoCAD_13)
00356         {
00357                 fprintf (fp->fp, "100\nAcDbRasterVariables\n");
00358         }
00359         fprintf (fp->fp, " 90\n%d\n", rastervariables->class_version);
00360         fprintf (fp->fp, " 70\n%d\n", rastervariables->display_image_frame);
00361         fprintf (fp->fp, " 71\n%d\n", rastervariables->display_quality);
00362         fprintf (fp->fp, " 72\n%d\n", rastervariables->units);
00363         /* Clean up. */
00364         free (dxf_entity_name);
00365 #if DEBUG
00366         DXF_DEBUG_END
00367 #endif
00368         return (EXIT_SUCCESS);
00369 }
00370 
00371 
00379 int
00380 dxf_rastervariables_free
00381 (
00382         DxfRasterVariables *rastervariables
00385 )
00386 {
00387 #if DEBUG
00388         DXF_DEBUG_BEGIN
00389 #endif
00390         /* Do some basic checks. */
00391         if (rastervariables == NULL)
00392         {
00393                 fprintf (stderr,
00394                   (_("Error in %s () a NULL pointer was passed.\n")),
00395                   __FUNCTION__);
00396                 return (EXIT_FAILURE);
00397         }
00398         if (rastervariables->next != NULL)
00399         {
00400                 fprintf (stderr,
00401                   (_("Error in %s () pointer to next was not NULL.\n")),
00402                   __FUNCTION__);
00403                 return (EXIT_FAILURE);
00404         }
00405         free (rastervariables->dictionary_owner_soft);
00406         free (rastervariables->dictionary_owner_hard);
00407         free (rastervariables);
00408         rastervariables = NULL;
00409 #if DEBUG
00410         DXF_DEBUG_END
00411 #endif
00412         return (EXIT_SUCCESS);
00413 }
00414 
00415 
00420 void
00421 dxf_rastervariables_free_chain
00422 (
00423         DxfRasterVariables *rastervariables
00426 )
00427 {
00428 #ifdef DEBUG
00429         DXF_DEBUG_BEGIN
00430 #endif
00431         if (rastervariables == NULL)
00432         {
00433                 fprintf (stderr,
00434                   (_("Warning in %s () a NULL pointer was passed.\n")),
00435                   __FUNCTION__);
00436         }
00437         while (rastervariables != NULL)
00438         {
00439                 struct DxfRasterVariables *iter = rastervariables->next;
00440                 dxf_rastervariables_free (rastervariables);
00441                 rastervariables = (DxfRasterVariables *) iter;
00442         }
00443 #if DEBUG
00444         DXF_DEBUG_END
00445 #endif
00446 }
00447 
00448 
00454 int
00455 dxf_rastervariables_get_id_code
00456 (
00457         DxfRasterVariables *rastervariables
00459 )
00460 {
00461 #if DEBUG
00462         DXF_DEBUG_BEGIN
00463 #endif
00464         /* Do some basic checks. */
00465         if (rastervariables == NULL)
00466         {
00467                 fprintf (stderr,
00468                   (_("Error in %s () a NULL pointer was passed.\n")),
00469                   __FUNCTION__);
00470                 return (EXIT_FAILURE);
00471         }
00472         if (rastervariables->id_code < 0)
00473         {
00474                 fprintf (stderr,
00475                   (_("Warning in %s () a negative value was found.\n")),
00476                   __FUNCTION__);
00477         }
00478 #if DEBUG
00479         DXF_DEBUG_END
00480 #endif
00481         return (rastervariables->id_code);
00482 }
00483 
00484 
00488 DxfRasterVariables *
00489 dxf_rastervariables_set_id_code
00490 (
00491         DxfRasterVariables *rastervariables,
00493         int id_code
00497 )
00498 {
00499 #if DEBUG
00500         DXF_DEBUG_BEGIN
00501 #endif
00502         /* Do some basic checks. */
00503         if (rastervariables == NULL)
00504         {
00505                 fprintf (stderr,
00506                   (_("Error in %s () a NULL pointer was passed.\n")),
00507                   __FUNCTION__);
00508                 return (NULL);
00509         }
00510         if (id_code < 0)
00511         {
00512                 fprintf (stderr,
00513                   (_("Warning in %s () a negative value was passed.\n")),
00514                   __FUNCTION__);
00515         }
00516         rastervariables->id_code = id_code;
00517 #if DEBUG
00518         DXF_DEBUG_END
00519 #endif
00520         return (rastervariables);
00521 }
00522 
00523 
00532 char *
00533 dxf_rastervariables_get_dictionary_owner_soft
00534 (
00535         DxfRasterVariables *rastervariables
00537 )
00538 {
00539 #if DEBUG
00540         DXF_DEBUG_BEGIN
00541 #endif
00542         /* Do some basic checks. */
00543         if (rastervariables == NULL)
00544         {
00545                 fprintf (stderr,
00546                   (_("Error in %s () a NULL pointer was passed.\n")),
00547                   __FUNCTION__);
00548                 return (NULL);
00549         }
00550         if (rastervariables->dictionary_owner_soft ==  NULL)
00551         {
00552                 fprintf (stderr,
00553                   (_("Error in %s () a NULL pointer was found.\n")),
00554                   __FUNCTION__);
00555                 return (NULL);
00556         }
00557 #if DEBUG
00558         DXF_DEBUG_END
00559 #endif
00560         return (strdup (rastervariables->dictionary_owner_soft));
00561 }
00562 
00563 
00568 DxfRasterVariables *
00569 dxf_rastervariables_set_dictionary_owner_soft
00570 (
00571         DxfRasterVariables *rastervariables,
00573         char *dictionary_owner_soft
00576 )
00577 {
00578 #if DEBUG
00579         DXF_DEBUG_BEGIN
00580 #endif
00581         /* Do some basic checks. */
00582         if (rastervariables == NULL)
00583         {
00584                 fprintf (stderr,
00585                   (_("Error in %s () a NULL pointer was passed.\n")),
00586                   __FUNCTION__);
00587                 return (NULL);
00588         }
00589         if (dictionary_owner_soft == NULL)
00590         {
00591                 fprintf (stderr,
00592                   (_("Error in %s () a NULL pointer was passed.\n")),
00593                   __FUNCTION__);
00594                 return (NULL);
00595         }
00596         rastervariables->dictionary_owner_soft = strdup (dictionary_owner_soft);
00597 #if DEBUG
00598         DXF_DEBUG_END
00599 #endif
00600         return (rastervariables);
00601 }
00602 
00603 
00612 char *
00613 dxf_rastervariables_get_dictionary_owner_hard
00614 (
00615         DxfRasterVariables *rastervariables
00617 )
00618 {
00619 #if DEBUG
00620         DXF_DEBUG_BEGIN
00621 #endif
00622         /* Do some basic checks. */
00623         if (rastervariables == NULL)
00624         {
00625                 fprintf (stderr,
00626                   (_("Error in %s () a NULL pointer was passed.\n")),
00627                   __FUNCTION__);
00628                 return (NULL);
00629         }
00630         if (rastervariables->dictionary_owner_hard ==  NULL)
00631         {
00632                 fprintf (stderr,
00633                   (_("Error in %s () a NULL pointer was found.\n")),
00634                   __FUNCTION__);
00635                 return (NULL);
00636         }
00637 #if DEBUG
00638         DXF_DEBUG_END
00639 #endif
00640         return (strdup (rastervariables->dictionary_owner_hard));
00641 }
00642 
00643 
00648 DxfRasterVariables *
00649 dxf_rastervariables_set_dictionary_owner_hard
00650 (
00651         DxfRasterVariables *rastervariables,
00653         char *dictionary_owner_hard
00656 )
00657 {
00658 #if DEBUG
00659         DXF_DEBUG_BEGIN
00660 #endif
00661         /* Do some basic checks. */
00662         if (rastervariables == NULL)
00663         {
00664                 fprintf (stderr,
00665                   (_("Error in %s () a NULL pointer was passed.\n")),
00666                   __FUNCTION__);
00667                 return (NULL);
00668         }
00669         if (dictionary_owner_hard == NULL)
00670         {
00671                 fprintf (stderr,
00672                   (_("Error in %s () a NULL pointer was passed.\n")),
00673                   __FUNCTION__);
00674                 return (NULL);
00675         }
00676         rastervariables->dictionary_owner_hard = strdup (dictionary_owner_hard);
00677 #if DEBUG
00678         DXF_DEBUG_END
00679 #endif
00680         return (rastervariables);
00681 }
00682 
00683 
00689 int
00690 dxf_rastervariables_get_display_image_frame
00691 (
00692         DxfRasterVariables *rastervariables
00694 )
00695 {
00696 #if DEBUG
00697         DXF_DEBUG_BEGIN
00698 #endif
00699         /* Do some basic checks. */
00700         if (rastervariables == NULL)
00701         {
00702                 fprintf (stderr,
00703                   (_("Error in %s () a NULL pointer was passed.\n")),
00704                   __FUNCTION__);
00705                 return (EXIT_FAILURE);
00706         }
00707         if (rastervariables->display_image_frame < 0)
00708         {
00709                 fprintf (stderr,
00710                   (_("Warning in %s () a negative value was found.\n")),
00711                   __FUNCTION__);
00712         }
00713         if (rastervariables->display_image_frame > 1)
00714         {
00715                 fprintf (stderr,
00716                   (_("Warning in %s () an out of range value was found.\n")),
00717                   __FUNCTION__);
00718         }
00719 #if DEBUG
00720         DXF_DEBUG_END
00721 #endif
00722         return (rastervariables->display_image_frame);
00723 }
00724 
00725 
00730 DxfRasterVariables *
00731 dxf_rastervariables_set_display_image_frame
00732 (
00733         DxfRasterVariables *rastervariables,
00735         int display_image_frame
00738 )
00739 {
00740 #if DEBUG
00741         DXF_DEBUG_BEGIN
00742 #endif
00743         /* Do some basic checks. */
00744         if (rastervariables == NULL)
00745         {
00746                 fprintf (stderr,
00747                   (_("Error in %s () a NULL pointer was passed.\n")),
00748                   __FUNCTION__);
00749                 return (NULL);
00750         }
00751         if (display_image_frame < 0)
00752         {
00753                 fprintf (stderr,
00754                   (_("Warning in %s () a negative value was passed.\n")),
00755                   __FUNCTION__);
00756         }
00757         if (display_image_frame > 1)
00758         {
00759                 fprintf (stderr,
00760                   (_("Warning in %s () an out of range value was passed.\n")),
00761                   __FUNCTION__);
00762         }
00763         rastervariables->display_image_frame = display_image_frame;
00764 #if DEBUG
00765         DXF_DEBUG_END
00766 #endif
00767         return (rastervariables);
00768 }
00769 
00770 
00776 int
00777 dxf_rastervariables_get_display_quality
00778 (
00779         DxfRasterVariables *rastervariables
00781 )
00782 {
00783 #if DEBUG
00784         DXF_DEBUG_BEGIN
00785 #endif
00786         /* Do some basic checks. */
00787         if (rastervariables == NULL)
00788         {
00789                 fprintf (stderr,
00790                   (_("Error in %s () a NULL pointer was passed.\n")),
00791                   __FUNCTION__);
00792                 return (EXIT_FAILURE);
00793         }
00794         if (rastervariables->display_quality < 0)
00795         {
00796                 fprintf (stderr,
00797                   (_("Warning in %s () a negative value was found.\n")),
00798                   __FUNCTION__);
00799         }
00800         if (rastervariables->display_quality > 1)
00801         {
00802                 fprintf (stderr,
00803                   (_("Warning in %s () an out of range value was found.\n")),
00804                   __FUNCTION__);
00805         }
00806 #if DEBUG
00807         DXF_DEBUG_END
00808 #endif
00809         return (rastervariables->display_quality);
00810 }
00811 
00812 
00817 DxfRasterVariables *
00818 dxf_rastervariables_set_display_quality
00819 (
00820         DxfRasterVariables *rastervariables,
00822         int display_quality
00824 )
00825 {
00826 #if DEBUG
00827         DXF_DEBUG_BEGIN
00828 #endif
00829         /* Do some basic checks. */
00830         if (rastervariables == NULL)
00831         {
00832                 fprintf (stderr,
00833                   (_("Error in %s () a NULL pointer was passed.\n")),
00834                   __FUNCTION__);
00835                 return (NULL);
00836         }
00837         if (display_quality < 0)
00838         {
00839                 fprintf (stderr,
00840                   (_("Warning in %s () a negative value was passed.\n")),
00841                   __FUNCTION__);
00842         }
00843         if (display_quality > 1)
00844         {
00845                 fprintf (stderr,
00846                   (_("Warning in %s () an out of range value was passed.\n")),
00847                   __FUNCTION__);
00848         }
00849         rastervariables->display_quality = display_quality;
00850 #if DEBUG
00851         DXF_DEBUG_END
00852 #endif
00853         return (rastervariables);
00854 }
00855 
00856 
00862 int
00863 dxf_rastervariables_get_units
00864 (
00865         DxfRasterVariables *rastervariables
00867 )
00868 {
00869 #if DEBUG
00870         DXF_DEBUG_BEGIN
00871 #endif
00872         /* Do some basic checks. */
00873         if (rastervariables == NULL)
00874         {
00875                 fprintf (stderr,
00876                   (_("Error in %s () a NULL pointer was passed.\n")),
00877                   __FUNCTION__);
00878                 return (EXIT_FAILURE);
00879         }
00880         if (rastervariables->units < 0)
00881         {
00882                 fprintf (stderr,
00883                   (_("Warning in %s () a negative value was found.\n")),
00884                   __FUNCTION__);
00885         }
00886         if (rastervariables->units > 8)
00887         {
00888                 fprintf (stderr,
00889                   (_("Warning in %s () an out of range value was found.\n")),
00890                   __FUNCTION__);
00891         }
00892 #if DEBUG
00893         DXF_DEBUG_END
00894 #endif
00895         return (rastervariables->units);
00896 }
00897 
00898 
00902 DxfRasterVariables *
00903 dxf_rastervariables_set_units
00904 (
00905         DxfRasterVariables *rastervariables,
00907         int units
00909 )
00910 {
00911 #if DEBUG
00912         DXF_DEBUG_BEGIN
00913 #endif
00914         /* Do some basic checks. */
00915         if (rastervariables == NULL)
00916         {
00917                 fprintf (stderr,
00918                   (_("Error in %s () a NULL pointer was passed.\n")),
00919                   __FUNCTION__);
00920                 return (NULL);
00921         }
00922         if (units < 0)
00923         {
00924                 fprintf (stderr,
00925                   (_("Warning in %s () a negative value was passed.\n")),
00926                   __FUNCTION__);
00927         }
00928         if (units > 8)
00929         {
00930                 fprintf (stderr,
00931                   (_("Warning in %s () an out of range value was passed.\n")),
00932                   __FUNCTION__);
00933         }
00934         rastervariables->units = units;
00935 #if DEBUG
00936         DXF_DEBUG_END
00937 #endif
00938         return (rastervariables);
00939 }
00940 
00941 
00947 int32_t
00948 dxf_rastervariables_get_class_version
00949 (
00950         DxfRasterVariables *rastervariables
00952 )
00953 {
00954 #if DEBUG
00955         DXF_DEBUG_BEGIN
00956 #endif
00957         /* Do some basic checks. */
00958         if (rastervariables == NULL)
00959         {
00960                 fprintf (stderr,
00961                   (_("Error in %s () a NULL pointer was passed.\n")),
00962                   __FUNCTION__);
00963                 return (EXIT_FAILURE);
00964         }
00965         if (rastervariables->class_version < 0)
00966         {
00967                 fprintf (stderr,
00968                   (_("Warning in %s () a negative value was found.\n")),
00969                   __FUNCTION__);
00970         }
00971         if (rastervariables->class_version > 0)
00972         {
00973                 fprintf (stderr,
00974                   (_("Warning in %s () an out of range value was found.\n")),
00975                   __FUNCTION__);
00976         }
00977 #if DEBUG
00978         DXF_DEBUG_END
00979 #endif
00980         return (rastervariables->class_version);
00981 }
00982 
00983 
00987 DxfRasterVariables *
00988 dxf_rastervariables_set_class_version
00989 (
00990         DxfRasterVariables *rastervariables,
00992         int32_t class_version
00994 )
00995 {
00996 #if DEBUG
00997         DXF_DEBUG_BEGIN
00998 #endif
00999         /* Do some basic checks. */
01000         if (rastervariables == NULL)
01001         {
01002                 fprintf (stderr,
01003                   (_("Error in %s () a NULL pointer was passed.\n")),
01004                   __FUNCTION__);
01005                 return (NULL);
01006         }
01007         if (class_version < 0)
01008         {
01009                 fprintf (stderr,
01010                   (_("Warning in %s () a negative value was passed.\n")),
01011                   __FUNCTION__);
01012         }
01013         if (class_version > 0)
01014         {
01015                 fprintf (stderr,
01016                   (_("Warning in %s () an out of range value was passed.\n")),
01017                   __FUNCTION__);
01018         }
01019         rastervariables->class_version = class_version;
01020 #if DEBUG
01021         DXF_DEBUG_END
01022 #endif
01023         return (rastervariables);
01024 }
01025 
01026 
01035 DxfRasterVariables *
01036 dxf_rastervariables_get_next
01037 (
01038         DxfRasterVariables *rastervariables
01040 )
01041 {
01042 #if DEBUG
01043         DXF_DEBUG_BEGIN
01044 #endif
01045         /* Do some basic checks. */
01046         if (rastervariables == NULL)
01047         {
01048                 fprintf (stderr,
01049                   (_("Error in %s () a NULL pointer was passed.\n")),
01050                   __FUNCTION__);
01051                 return (NULL);
01052         }
01053         if (rastervariables->next == NULL)
01054         {
01055                 fprintf (stderr,
01056                   (_("Error in %s () a NULL pointer was found.\n")),
01057                   __FUNCTION__);
01058                 return (NULL);
01059         }
01060 #if DEBUG
01061         DXF_DEBUG_END
01062 #endif
01063         return ((DxfRasterVariables *) rastervariables->next);
01064 }
01065 
01066 
01071 DxfRasterVariables *
01072 dxf_rastervariables_set_next
01073 (
01074         DxfRasterVariables *rastervariables,
01076         DxfRasterVariables *next
01079 )
01080 {
01081 #if DEBUG
01082         DXF_DEBUG_BEGIN
01083 #endif
01084         /* Do some basic checks. */
01085         if (rastervariables == NULL)
01086         {
01087                 fprintf (stderr,
01088                   (_("Error in %s () a NULL pointer was passed.\n")),
01089                   __FUNCTION__);
01090                 return (NULL);
01091         }
01092         if (next == NULL)
01093         {
01094                 fprintf (stderr,
01095                   (_("Error in %s () a NULL pointer was passed.\n")),
01096                   __FUNCTION__);
01097                 return (NULL);
01098         }
01099         rastervariables->next = (struct DxfRasterVariables *) next;
01100 #if DEBUG
01101         DXF_DEBUG_END
01102 #endif
01103         return (rastervariables);
01104 }
01105 
01106 
01115 DxfRasterVariables *
01116 dxf_rastervariables_get_last
01117 (
01118         DxfRasterVariables *rastervariables
01120 )
01121 {
01122 #if DEBUG
01123         DXF_DEBUG_BEGIN
01124 #endif
01125         /* Do some basic checks. */
01126         if (rastervariables == NULL)
01127         {
01128                 fprintf (stderr,
01129                   (_("Error in %s () a NULL pointer was passed.\n")),
01130                   __FUNCTION__);
01131                 return (NULL);
01132         }
01133         if (rastervariables->next == NULL)
01134         {
01135                 fprintf (stderr,
01136                   (_("Warning in %s () a NULL pointer was found.\n")),
01137                   __FUNCTION__);
01138                 return ((DxfRasterVariables *) rastervariables);
01139         }
01140         DxfRasterVariables *iter = (DxfRasterVariables *) rastervariables->next;
01141         while (iter->next != NULL)
01142         {
01143                 iter = (DxfRasterVariables *) iter->next;
01144         }
01145 #if DEBUG
01146         DXF_DEBUG_END
01147 #endif
01148         return ((DxfRasterVariables *) iter);
01149 }
01150 
01151 
01152 /* EOF*/