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

dictionaryvar.c

Go to the documentation of this file.
00001 
00044 #include "dictionaryvar.h"
00045 
00046 
00052 DxfDictionaryVar *
00053 dxf_dictionaryvar_new ()
00054 {
00055 #ifdef DEBUG
00056         DXF_DEBUG_BEGIN
00057 #endif
00058         DxfDictionaryVar *dictionaryvar = NULL;
00059         size_t size;
00060 
00061         size = sizeof (DxfDictionaryVar);
00062         /* avoid malloc of 0 bytes */
00063         if (size == 0) size = 1;
00064         if ((dictionaryvar = malloc (size)) == NULL)
00065         {
00066                 fprintf (stderr,
00067                   (_("Error in %s () could not allocate memory for a DxfDictionaryVar struct.\n")),
00068                   __FUNCTION__);
00069                 dictionaryvar = NULL;
00070         }
00071         else
00072         {
00073                 memset (dictionaryvar, 0, size);
00074         }
00075 #ifdef DEBUG
00076         DXF_DEBUG_END
00077 #endif
00078         return (dictionaryvar);
00079 }
00080 
00081 
00089 DxfDictionaryVar *
00090 dxf_dictionaryvar_init
00091 (
00092         DxfDictionaryVar *dictionaryvar
00094 )
00095 {
00096 #if DEBUG
00097         DXF_DEBUG_BEGIN
00098 #endif
00099         /* Do some basic checks. */
00100         if (dictionaryvar == NULL)
00101         {
00102                 fprintf (stderr,
00103                   (_("Warning in %s () a NULL pointer was passed.\n")),
00104                   __FUNCTION__);
00105                 dictionaryvar = dxf_dictionaryvar_new ();
00106         }
00107         if (dictionaryvar == NULL)
00108         {
00109                 fprintf (stderr,
00110                   (_("Error in %s () could not allocate memory for a DxfDictionaryVar struct.\n")),
00111                   __FUNCTION__);
00112                 return (NULL);
00113         }
00114         dxf_dictionaryvar_set_id_code (dictionaryvar, 0);
00115         dxf_dictionaryvar_set_value (dictionaryvar, strdup (""));
00116         dxf_dictionaryvar_set_object_schema_number (dictionaryvar, strdup (""));
00117         dxf_dictionaryvar_set_dictionary_owner_soft (dictionaryvar, strdup (""));
00118         dxf_dictionaryvar_set_dictionary_owner_hard (dictionaryvar, strdup (""));
00119         dxf_dictionaryvar_set_next (dictionaryvar, NULL);
00120 #if DEBUG
00121         DXF_DEBUG_END
00122 #endif
00123         return (dictionaryvar);
00124 }
00125 
00126 
00137 DxfDictionaryVar *
00138 dxf_dictionaryvar_read
00139 (
00140         DxfFile *fp,
00142         DxfDictionaryVar *dictionaryvar
00144 )
00145 {
00146 #if DEBUG
00147         DXF_DEBUG_BEGIN
00148 #endif
00149         char *temp_string = NULL;
00150 
00151         /* Do some basic checks. */
00152         if (fp == NULL)
00153         {
00154                 fprintf (stderr,
00155                   (_("Error in %s () a NULL file pointer was passed.\n")),
00156                   __FUNCTION__);
00157                 /* Clean up. */
00158                 free (temp_string);
00159                 return (NULL);
00160         }
00161         if (fp->acad_version_number < AutoCAD_14)
00162         {
00163                 fprintf (stderr,
00164                   (_("Warning in %s () illegal DXF version for this entity.\n")),
00165                   __FUNCTION__);
00166         }
00167         if (dictionaryvar == NULL)
00168         {
00169                 fprintf (stderr,
00170                   (_("Warning in %s () a NULL pointer was passed.\n")),
00171                   __FUNCTION__);
00172                 dictionaryvar = dxf_dictionaryvar_new ();
00173                 dictionaryvar = dxf_dictionaryvar_init (dictionaryvar);
00174         }
00175         (fp->line_number)++;
00176         fscanf (fp->fp, "%[^\n]", temp_string);
00177         while (strcmp (temp_string, "0") != 0)
00178         {
00179                 if (ferror (fp->fp))
00180                 {
00181                         fprintf (stderr,
00182                           (_("Error in %s () while reading from: %s in line: %d.\n")),
00183                           __FUNCTION__, fp->filename, fp->line_number);
00184                         /* Clean up. */
00185                         free (temp_string);
00186                         fclose (fp->fp);
00187                         return (NULL);
00188                 }
00189                 else if (strcmp (temp_string, "1") == 0)
00190                 {
00191                         /* Now follows a string containing additional
00192                          * proprietary data. */
00193                         (fp->line_number)++;
00194                         fscanf (fp->fp, "%s\n", dictionaryvar->value);
00195                 }
00196                 if (strcmp (temp_string, "5") == 0)
00197                 {
00198                         /* Now follows a string containing a sequential
00199                          * id number. */
00200                         (fp->line_number)++;
00201                         fscanf (fp->fp, "%x\n", &dictionaryvar->id_code);
00202                 }
00203                 else if ((fp->acad_version_number >= AutoCAD_13)
00204                         && (strcmp (temp_string, "100") == 0))
00205                 {
00206                         /* Now follows a string containing the
00207                          * subclass marker value. */
00208                         (fp->line_number)++;
00209                         fscanf (fp->fp, "%s\n", temp_string);
00210                         if (strcmp (temp_string, "DictionaryVariables") != 0)
00211                         {
00212                                 fprintf (stderr,
00213                                   (_("Warning in %s () found a bad subclass marker in: %s in line: %d.\n")),
00214                                   __FUNCTION__, fp->filename, fp->line_number);
00215                         }
00216                 }
00217                 else if (strcmp (temp_string, "280") == 0)
00218                 {
00219                         /* Now follows a string containing a handle to ae
00220                          * entry object. */
00221                         (fp->line_number)++;
00222                         fscanf (fp->fp, "%s\n", dictionaryvar->object_schema_number);
00223                 }
00224                 else if (strcmp (temp_string, "330") == 0)
00225                 {
00226                         /* Now follows a string containing Soft-pointer
00227                          * ID/handle to owner dictionary. */
00228                         (fp->line_number)++;
00229                         fscanf (fp->fp, "%s\n", dictionaryvar->dictionary_owner_soft);
00230                 }
00231                 else if (strcmp (temp_string, "360") == 0)
00232                 {
00233                         /* Now follows a string containing Hard owner
00234                          * ID/handle to owner dictionary. */
00235                         (fp->line_number)++;
00236                         fscanf (fp->fp, "%s\n", dictionaryvar->dictionary_owner_hard);
00237                 }
00238                 else if (strcmp (temp_string, "999") == 0)
00239                 {
00240                         /* Now follows a string containing a comment. */
00241                         (fp->line_number)++;
00242                         fscanf (fp->fp, "%s\n", temp_string);
00243                         fprintf (stdout, (_("DXF comment: %s\n")), temp_string);
00244                 }
00245                 else
00246                 {
00247                         fprintf (stderr,
00248                           (_("Warning in %s () unknown string tag found while reading from: %s in line: %d.\n")),
00249                           __FUNCTION__, fp->filename, fp->line_number);
00250                 }
00251         }
00252         /* Clean up. */
00253         free (temp_string);
00254 #if DEBUG
00255         DXF_DEBUG_END
00256 #endif
00257         return (dictionaryvar);
00258 }
00259 
00260 
00267 int
00268 dxf_dictionaryvar_write
00269 (
00270         DxfFile *fp,
00272         DxfDictionaryVar *dictionaryvar
00274 )
00275 {
00276 #if DEBUG
00277         DXF_DEBUG_BEGIN
00278 #endif
00279         char *dxf_entity_name = strdup ("DICTIONARYVAR");
00280 
00281         /* Do some basic checks. */
00282         if (fp == NULL)
00283         {
00284                 fprintf (stderr,
00285                   (_("Error in %s () a NULL file pointer was passed.\n")),
00286                   __FUNCTION__);
00287                 /* Clean up. */
00288                 free (dxf_entity_name);
00289                 return (EXIT_FAILURE);
00290         }
00291         if (dictionaryvar == NULL)
00292         {
00293                 fprintf (stderr,
00294                   (_("Error in %s () a NULL pointer was passed.\n")),
00295                   __FUNCTION__);
00296                 /* Clean up. */
00297                 free (dxf_entity_name);
00298                 return (EXIT_FAILURE);
00299         }
00300         if (strcmp (dxf_dictionaryvar_get_value (dictionaryvar), "") == 0)
00301         {
00302                 fprintf (stderr,
00303                   (_("Warning in %s () empty value string for the %s entity with id-code: %x\n")),
00304                   __FUNCTION__, dxf_entity_name, dxf_dictionaryvar_get_id_code (dictionaryvar));
00305         }
00306         if (strcmp (dxf_dictionaryvar_get_object_schema_number (dictionaryvar), "0") == 0)
00307         {
00308                 fprintf (stderr,
00309                   (_("Warning in %s () empty object schema number string for the %s entity with id-code: %x\n")),
00310                   __FUNCTION__, dxf_entity_name, dxf_dictionaryvar_get_id_code (dictionaryvar));
00311         }
00312         if (fp->acad_version_number < AutoCAD_14)
00313         {
00314                 fprintf (stderr,
00315                   (_("Warning in %s () illegal DXF version for this %s entity with id-code: %x.\n")),
00316                   __FUNCTION__, dxf_entity_name, dxf_dictionaryvar_get_id_code (dictionaryvar));
00317         }
00318         /* Start writing output. */
00319         fprintf (fp->fp, "  0\n%s\n", dxf_entity_name);
00320         if (dxf_dictionaryvar_get_id_code (dictionaryvar) != -1)
00321         {
00322                 fprintf (fp->fp, "  5\n%x\n", dxf_dictionaryvar_get_id_code (dictionaryvar));
00323         }
00334         if ((strcmp (dxf_dictionaryvar_get_dictionary_owner_soft (dictionaryvar), "") != 0)
00335           && (fp->acad_version_number >= AutoCAD_14))
00336         {
00337                 fprintf (fp->fp, "102\n{ACAD_REACTORS\n");
00338                 fprintf (fp->fp, "330\n%s\n", dxf_dictionaryvar_get_dictionary_owner_soft (dictionaryvar));
00339                 fprintf (fp->fp, "102\n}\n");
00340         }
00341         if ((strcmp (dxf_dictionaryvar_get_dictionary_owner_hard (dictionaryvar), "") != 0)
00342           && (fp->acad_version_number >= AutoCAD_14))
00343         {
00344                 fprintf (fp->fp, "102\n{ACAD_XDICTIONARY\n");
00345                 fprintf (fp->fp, "360\n%s\n", dxf_dictionaryvar_get_dictionary_owner_hard (dictionaryvar));
00346                 fprintf (fp->fp, "102\n}\n");
00347         }
00348         if (fp->acad_version_number >= AutoCAD_13)
00349         {
00350                 fprintf (fp->fp, "100\nDictionaryVariables\n");
00351         }
00352         fprintf (fp->fp, "280\n%s\n", dxf_dictionaryvar_get_object_schema_number (dictionaryvar));
00353         fprintf (fp->fp, "  1\n%s\n", dxf_dictionaryvar_get_value (dictionaryvar));
00354         /* Clean up. */
00355         free (dxf_entity_name);
00356 #if DEBUG
00357         DXF_DEBUG_END
00358 #endif
00359         return (EXIT_SUCCESS);
00360 }
00361 
00362 
00370 int
00371 dxf_dictionaryvar_free
00372 (
00373         DxfDictionaryVar *dictionaryvar
00376 )
00377 {
00378 #if DEBUG
00379         DXF_DEBUG_BEGIN
00380 #endif
00381         /* Do some basic checks. */
00382         if (dictionaryvar == NULL)
00383         {
00384                 fprintf (stderr,
00385                   (_("Error in %s () a NULL pointer was passed.\n")),
00386                   __FUNCTION__);
00387                 return (EXIT_FAILURE);
00388         }
00389         if (dxf_dictionaryvar_get_next (dictionaryvar) != NULL)
00390         {
00391                 fprintf (stderr,
00392                   (_("Error in %s () pointer to next was not NULL.\n")),
00393                   __FUNCTION__);
00394                 return (EXIT_FAILURE);
00395         }
00396         free (dxf_dictionaryvar_get_dictionary_owner_soft (dictionaryvar));
00397         free (dxf_dictionaryvar_get_dictionary_owner_hard (dictionaryvar));
00398         free (dxf_dictionaryvar_get_value (dictionaryvar));
00399         free (dxf_dictionaryvar_get_object_schema_number (dictionaryvar));
00400         free (dictionaryvar);
00401         dictionaryvar = NULL;
00402 #if DEBUG
00403         DXF_DEBUG_END
00404 #endif
00405         return (EXIT_SUCCESS);
00406 }
00407 
00408 
00413 void
00414 dxf_dictionaryvar_free_chain
00415 (
00416         DxfDictionaryVar *dictionaryvars
00418 )
00419 {
00420 #ifdef DEBUG
00421         DXF_DEBUG_BEGIN
00422 #endif
00423         if (dictionaryvars == NULL)
00424         {
00425                 fprintf (stderr,
00426                   (_("Warning in %s () a NULL pointer was passed.\n")),
00427                   __FUNCTION__);
00428         }
00429         while (dictionaryvars != NULL)
00430         {
00431                 struct DxfDictionaryVar *iter = dictionaryvars->next;
00432                 dxf_dictionaryvar_free (dictionaryvars);
00433                 dictionaryvars = (DxfDictionaryVar *) iter;
00434         }
00435 #if DEBUG
00436         DXF_DEBUG_END
00437 #endif
00438 }
00439 
00440 
00446 int
00447 dxf_dictionaryvar_get_id_code
00448 (
00449         DxfDictionaryVar *dictionaryvar
00451 )
00452 {
00453 #if DEBUG
00454         DXF_DEBUG_BEGIN
00455 #endif
00456         /* Do some basic checks. */
00457         if (dictionaryvar == NULL)
00458         {
00459                 fprintf (stderr,
00460                   (_("Error in %s () a NULL pointer was passed.\n")),
00461                   __FUNCTION__);
00462                 return (EXIT_FAILURE);
00463         }
00464         if (dictionaryvar->id_code < 0)
00465         {
00466                 fprintf (stderr,
00467                   (_("Error in %s () a negative value was found in the id-code member.\n")),
00468                   __FUNCTION__);
00469                 return (EXIT_FAILURE);
00470         }
00471 #if DEBUG
00472         DXF_DEBUG_END
00473 #endif
00474         return (dictionaryvar->id_code);
00475 }
00476 
00477 
00481 DxfDictionaryVar *
00482 dxf_dictionaryvar_set_id_code
00483 (
00484         DxfDictionaryVar *dictionaryvar,
00486         int id_code
00490 )
00491 {
00492 #if DEBUG
00493         DXF_DEBUG_BEGIN
00494 #endif
00495         /* Do some basic checks. */
00496         if (dictionaryvar == NULL)
00497         {
00498                 fprintf (stderr,
00499                   (_("Error in %s () a NULL pointer was passed.\n")),
00500                   __FUNCTION__);
00501                 return (NULL);
00502         }
00503         if (id_code < 0)
00504         {
00505                 fprintf (stderr,
00506                   (_("Error in %s () a negative id-code value was passed.\n")),
00507                   __FUNCTION__);
00508                 return (NULL);
00509         }
00510         dictionaryvar->id_code = id_code;
00511 #if DEBUG
00512         DXF_DEBUG_END
00513 #endif
00514         return (dictionaryvar);
00515 }
00516 
00517 
00526 char *
00527 dxf_dictionaryvar_get_dictionary_owner_soft
00528 (
00529         DxfDictionaryVar *dictionaryvar
00531 )
00532 {
00533 #if DEBUG
00534         DXF_DEBUG_BEGIN
00535 #endif
00536         /* Do some basic checks. */
00537         if (dictionaryvar == NULL)
00538         {
00539                 fprintf (stderr,
00540                   (_("Error in %s () a NULL pointer was passed.\n")),
00541                   __FUNCTION__);
00542                 return (NULL);
00543         }
00544         if (dictionaryvar->dictionary_owner_soft ==  NULL)
00545         {
00546                 fprintf (stderr,
00547                   (_("Error in %s () a NULL pointer was found in the dictionary_owner_soft member.\n")),
00548                   __FUNCTION__);
00549                 return (NULL);
00550         }
00551 #if DEBUG
00552         DXF_DEBUG_END
00553 #endif
00554         return (strdup (dictionaryvar->dictionary_owner_soft));
00555 }
00556 
00557 
00562 DxfDictionaryVar *
00563 dxf_dictionaryvar_set_dictionary_owner_soft
00564 (
00565         DxfDictionaryVar *dictionaryvar,
00567         char *dictionary_owner_soft
00570 )
00571 {
00572 #if DEBUG
00573         DXF_DEBUG_BEGIN
00574 #endif
00575         /* Do some basic checks. */
00576         if (dictionaryvar == NULL)
00577         {
00578                 fprintf (stderr,
00579                   (_("Error in %s () a NULL pointer was passed.\n")),
00580                   __FUNCTION__);
00581                 return (NULL);
00582         }
00583         if (dictionary_owner_soft == NULL)
00584         {
00585                 fprintf (stderr,
00586                   (_("Error in %s () a NULL pointer was passed.\n")),
00587                   __FUNCTION__);
00588                 return (NULL);
00589         }
00590         dictionaryvar->dictionary_owner_soft = strdup (dictionary_owner_soft);
00591 #if DEBUG
00592         DXF_DEBUG_END
00593 #endif
00594         return (dictionaryvar);
00595 }
00596 
00597 
00606 char *
00607 dxf_dictionaryvar_get_dictionary_owner_hard
00608 (
00609         DxfDictionaryVar *dictionaryvar
00611 )
00612 {
00613 #if DEBUG
00614         DXF_DEBUG_BEGIN
00615 #endif
00616         /* Do some basic checks. */
00617         if (dictionaryvar == NULL)
00618         {
00619                 fprintf (stderr,
00620                   (_("Error in %s () a NULL pointer was passed.\n")),
00621                   __FUNCTION__);
00622                 return (NULL);
00623         }
00624         if (dictionaryvar->dictionary_owner_hard ==  NULL)
00625         {
00626                 fprintf (stderr,
00627                   (_("Error in %s () a NULL pointer was found in the dictionary_owner_hard member.\n")),
00628                   __FUNCTION__);
00629                 return (NULL);
00630         }
00631 #if DEBUG
00632         DXF_DEBUG_END
00633 #endif
00634         return (strdup (dictionaryvar->dictionary_owner_hard));
00635 }
00636 
00637 
00642 DxfDictionaryVar *
00643 dxf_dictionaryvar_set_dictionary_owner_hard
00644 (
00645         DxfDictionaryVar *dictionaryvar,
00647         char *dictionary_owner_hard
00650 )
00651 {
00652 #if DEBUG
00653         DXF_DEBUG_BEGIN
00654 #endif
00655         /* Do some basic checks. */
00656         if (dictionaryvar == NULL)
00657         {
00658                 fprintf (stderr,
00659                   (_("Error in %s () a NULL pointer was passed.\n")),
00660                   __FUNCTION__);
00661                 return (NULL);
00662         }
00663         if (dictionary_owner_hard == NULL)
00664         {
00665                 fprintf (stderr,
00666                   (_("Error in %s () a NULL pointer was passed.\n")),
00667                   __FUNCTION__);
00668                 return (NULL);
00669         }
00670         dictionaryvar->dictionary_owner_hard = strdup (dictionary_owner_hard);
00671 #if DEBUG
00672         DXF_DEBUG_END
00673 #endif
00674         return (dictionaryvar);
00675 }
00676 
00677 
00683 char *
00684 dxf_dictionaryvar_get_value
00685 (
00686         DxfDictionaryVar *dictionaryvar
00688 )
00689 {
00690 #if DEBUG
00691         DXF_DEBUG_BEGIN
00692 #endif
00693         /* Do some basic checks. */
00694         if (dictionaryvar == NULL)
00695         {
00696                 fprintf (stderr,
00697                   (_("Error in %s () a NULL pointer was passed.\n")),
00698                   __FUNCTION__);
00699                 return (NULL);
00700         }
00701         if (dictionaryvar->value ==  NULL)
00702         {
00703                 fprintf (stderr,
00704                   (_("Error in %s () a NULL pointer was found in the value member.\n")),
00705                   __FUNCTION__);
00706                 return (NULL);
00707         }
00708 #if DEBUG
00709         DXF_DEBUG_END
00710 #endif
00711         return (strdup (dictionaryvar->value));
00712 }
00713 
00714 
00718 DxfDictionaryVar *
00719 dxf_dictionaryvar_set_value
00720 (
00721         DxfDictionaryVar *dictionaryvar,
00723         char *value
00725 )
00726 {
00727 #if DEBUG
00728         DXF_DEBUG_BEGIN
00729 #endif
00730         /* Do some basic checks. */
00731         if (dictionaryvar == NULL)
00732         {
00733                 fprintf (stderr,
00734                   (_("Error in %s () a NULL pointer was passed.\n")),
00735                   __FUNCTION__);
00736                 return (NULL);
00737         }
00738         if (value == NULL)
00739         {
00740                 fprintf (stderr,
00741                   (_("Error in %s () a NULL pointer was passed.\n")),
00742                   __FUNCTION__);
00743                 return (NULL);
00744         }
00745         dictionaryvar->value = strdup (value);
00746 #if DEBUG
00747         DXF_DEBUG_END
00748 #endif
00749         return (dictionaryvar);
00750 }
00751 
00752 
00760 char *
00761 dxf_dictionaryvar_get_object_schema_number
00762 (
00763         DxfDictionaryVar *dictionaryvar
00765 )
00766 {
00767 #if DEBUG
00768         DXF_DEBUG_BEGIN
00769 #endif
00770         /* Do some basic checks. */
00771         if (dictionaryvar == NULL)
00772         {
00773                 fprintf (stderr,
00774                   (_("Error in %s () a NULL pointer was passed.\n")),
00775                   __FUNCTION__);
00776                 return (NULL);
00777         }
00778         if (dictionaryvar->object_schema_number ==  NULL)
00779         {
00780                 fprintf (stderr,
00781                   (_("Error in %s () a NULL pointer was found in the object_schema_number member.\n")),
00782                   __FUNCTION__);
00783                 return (NULL);
00784         }
00785 #if DEBUG
00786         DXF_DEBUG_END
00787 #endif
00788         return (strdup (dictionaryvar->object_schema_number));
00789 }
00790 
00791 
00795 DxfDictionaryVar *
00796 dxf_dictionaryvar_set_object_schema_number
00797 (
00798         DxfDictionaryVar *dictionaryvar,
00800         char *object_schema_number
00803 )
00804 {
00805 #if DEBUG
00806         DXF_DEBUG_BEGIN
00807 #endif
00808         /* Do some basic checks. */
00809         if (dictionaryvar == NULL)
00810         {
00811                 fprintf (stderr,
00812                   (_("Error in %s () a NULL pointer was passed.\n")),
00813                   __FUNCTION__);
00814                 return (NULL);
00815         }
00816         if (object_schema_number == NULL)
00817         {
00818                 fprintf (stderr,
00819                   (_("Error in %s () a NULL pointer was passed.\n")),
00820                   __FUNCTION__);
00821                 return (NULL);
00822         }
00823         dictionaryvar->object_schema_number = strdup (object_schema_number);
00824 #if DEBUG
00825         DXF_DEBUG_END
00826 #endif
00827         return (dictionaryvar);
00828 }
00829 
00830 
00839 DxfDictionaryVar *
00840 dxf_dictionaryvar_get_next
00841 (
00842         DxfDictionaryVar *dictionaryvar
00844 )
00845 {
00846 #if DEBUG
00847         DXF_DEBUG_BEGIN
00848 #endif
00849         /* Do some basic checks. */
00850         if (dictionaryvar == NULL)
00851         {
00852                 fprintf (stderr,
00853                   (_("Error in %s () a NULL pointer was passed.\n")),
00854                   __FUNCTION__);
00855                 return (NULL);
00856         }
00857         if (dictionaryvar->next == NULL)
00858         {
00859                 fprintf (stderr,
00860                   (_("Error in %s () a NULL pointer was found in the next member.\n")),
00861                   __FUNCTION__);
00862                 return (NULL);
00863         }
00864 #if DEBUG
00865         DXF_DEBUG_END
00866 #endif
00867         return ((DxfDictionaryVar *) dictionaryvar->next);
00868 }
00869 
00870 
00875 DxfDictionaryVar *
00876 dxf_dictionaryvar_set_next
00877 (
00878         DxfDictionaryVar *dictionaryvar,
00880         DxfDictionaryVar *next
00883 )
00884 {
00885 #if DEBUG
00886         DXF_DEBUG_BEGIN
00887 #endif
00888         /* Do some basic checks. */
00889         if (dictionaryvar == NULL)
00890         {
00891                 fprintf (stderr,
00892                   (_("Error in %s () a NULL pointer was passed.\n")),
00893                   __FUNCTION__);
00894                 return (NULL);
00895         }
00896         if (next == NULL)
00897         {
00898                 fprintf (stderr,
00899                   (_("Error in %s () a NULL pointer was passed.\n")),
00900                   __FUNCTION__);
00901                 return (NULL);
00902         }
00903         dictionaryvar->next = (struct DxfDictionaryVar *) next;
00904 #if DEBUG
00905         DXF_DEBUG_END
00906 #endif
00907         return (dictionaryvar);
00908 }
00909 
00910 
00919 DxfDictionaryVar *
00920 dxf_dictionaryvar_get_last
00921 (
00922         DxfDictionaryVar *dictionaryvar
00924 )
00925 {
00926 #if DEBUG
00927         DXF_DEBUG_BEGIN
00928 #endif
00929         /* Do some basic checks. */
00930         if (dictionaryvar == NULL)
00931         {
00932                 fprintf (stderr,
00933                   (_("Error in %s () a NULL pointer was passed.\n")),
00934                   __FUNCTION__);
00935                 return (NULL);
00936         }
00937         if (dictionaryvar->next == NULL)
00938         {
00939                 fprintf (stderr,
00940                   (_("Warning in %s () a NULL pointer was found in the next member.\n")),
00941                   __FUNCTION__);
00942                 return ((DxfDictionaryVar *) dictionaryvar);
00943         }
00944         DxfDictionaryVar *iter = (DxfDictionaryVar *) dictionaryvar->next;
00945         while (iter->next != NULL)
00946         {
00947                 iter = (DxfDictionaryVar *) iter->next;
00948         }
00949 #if DEBUG
00950         DXF_DEBUG_END
00951 #endif
00952         return ((DxfDictionaryVar *) iter);
00953 }
00954 
00955 
00956 /* EOF*/