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

sortentstable.c

Go to the documentation of this file.
00001 
00052 #include "sortentstable.h"
00053 
00054 
00060 DxfSortentsTable *
00061 dxf_sortentstable_new ()
00062 {
00063 #if DEBUG
00064         DXF_DEBUG_BEGIN
00065 #endif
00066         DxfSortentsTable *sortentstable = NULL;
00067         size_t size;
00068 
00069         size = sizeof (DxfSortentsTable);
00070         /* avoid malloc of 0 bytes */
00071         if (size == 0) size = 1;
00072         if ((sortentstable = malloc (size)) == NULL)
00073         {
00074                 fprintf (stderr,
00075                   (_("Error in %s () could not allocate memory for a DxfSortentsTable struct.\n")),
00076                   __FUNCTION__);
00077                 sortentstable = NULL;
00078         }
00079         else
00080         {
00081                 memset (sortentstable, 0, size);
00082         }
00083 #if DEBUG
00084         DXF_DEBUG_END
00085 #endif
00086         return (sortentstable);
00087 }
00088 
00089 
00097 DxfSortentsTable *
00098 dxf_sortentstable_init
00099 (
00100         DxfSortentsTable *sortentstable
00102 )
00103 {
00104 #if DEBUG
00105         DXF_DEBUG_BEGIN
00106 #endif
00107         /* Do some basic checks. */
00108         if (sortentstable == NULL)
00109         {
00110                 fprintf (stderr,
00111                   (_("Warning in %s () a NULL pointer was passed.\n")),
00112                   __FUNCTION__);
00113                 sortentstable = dxf_sortentstable_new ();
00114         }
00115         if (sortentstable == NULL)
00116         {
00117                 fprintf (stderr,
00118                   (_("Error in %s () could not allocate memory for a DxfSortentsTable struct.\n")),
00119                   __FUNCTION__);
00120                 return (NULL);
00121         }
00122         sortentstable->id_code = 0;
00123         sortentstable->dictionary_owner_soft = strdup ("");
00124         sortentstable->dictionary_owner_hard = strdup ("");
00125         sortentstable->block_owner = strdup ("");
00126         sortentstable->entity_owner = dxf_char_init (sortentstable->entity_owner);
00127         sortentstable->sort_handle->value = 0;
00128         sortentstable->next = NULL;
00129 #if DEBUG
00130         DXF_DEBUG_END
00131 #endif
00132         return (sortentstable);
00133 }
00134 
00135 
00147 DxfSortentsTable *
00148 dxf_sortentstable_read
00149 (
00150         DxfFile *fp,
00152         DxfSortentsTable *sortentstable
00154 )
00155 {
00156 #if DEBUG
00157         DXF_DEBUG_BEGIN
00158 #endif
00159         char *temp_string = NULL;
00160         int i;
00161         int j;
00162         int k;
00163         DxfInt *iter_5 = NULL;
00164         DxfChar *iter_331 = NULL;
00165 
00166         /* Do some basic checks. */
00167         if (fp == NULL)
00168         {
00169                 fprintf (stderr,
00170                   (_("Error in %s () a NULL file pointer was passed.\n")),
00171                   __FUNCTION__);
00172                 /* Clean up. */
00173                 free (temp_string);
00174                 return (NULL);
00175         }
00176         if (fp->acad_version_number < AutoCAD_14)
00177         {
00178                 fprintf (stderr,
00179                   (_("Warning in %s () illegal DXF version for this entity.\n")),
00180                   __FUNCTION__);
00181         }
00182         if (sortentstable == NULL)
00183         {
00184                 fprintf (stderr,
00185                   (_("Warning in %s () a NULL pointer was passed.\n")),
00186                   __FUNCTION__);
00187                 sortentstable = dxf_sortentstable_new ();
00188                 sortentstable = dxf_sortentstable_init (sortentstable);
00189         }
00190         i = 0;
00191         j = 0;
00192         k = 0;
00193         iter_5 = (DxfInt *) sortentstable->sort_handle;
00194         iter_331 = (DxfChar *) sortentstable->entity_owner;
00195         (fp->line_number)++;
00196         fscanf (fp->fp, "%[^\n]", temp_string);
00197         while (strcmp (temp_string, "0") != 0)
00198         {
00199                 if (ferror (fp->fp))
00200                 {
00201                         fprintf (stderr,
00202                           (_("Error in %s () while reading from: %s in line: %d.\n")),
00203                           __FUNCTION__, fp->filename, fp->line_number);
00204                         /* Clean up. */
00205                         free (temp_string);
00206                         fclose (fp->fp);
00207                         return (NULL);
00208                 }
00209                 if ((strcmp (temp_string, "5") == 0)
00210                   && (k == 0))
00211                 {
00212                         /* Now follows a string containing a sequential
00213                          * id number. */
00214                         (fp->line_number)++;
00215                         fscanf (fp->fp, "%x\n", &sortentstable->id_code);
00216                 }
00217                 if ((strcmp (temp_string, "5") == 0)
00218                   && (i > 0))
00219                 {
00220                         /* Now follows a string containing a Sort handle
00221                          * (zero or more entries may exist). */
00222                         (fp->line_number)++;
00223                         fscanf (fp->fp, "%x\n", &iter_5->value);
00224                         iter_5->next = (struct DxfInt *) dxf_int_init ((DxfInt *) iter_5->next);
00225                         iter_5 = (DxfInt *) iter_5->next;
00226                 }
00227                 else if ((fp->acad_version_number >= AutoCAD_13)
00228                         && (strcmp (temp_string, "100") == 0))
00229                 {
00230                         /* Now follows a string containing the
00231                          * subclass marker value. */
00232                         (fp->line_number)++;
00233                         fscanf (fp->fp, "%s\n", temp_string);
00234                         if (strcmp (temp_string, "AcDbSortentsTable") != 0)
00235                         {
00236                                 fprintf (stderr,
00237                                   (_("Warning in %s () found a bad subclass marker in: %s in line: %d.\n")),
00238                                   __FUNCTION__, fp->filename, fp->line_number);
00239                         }
00240                 }
00241                 else if ((strcmp (temp_string, "330") == 0)
00242                   && (j == 0))
00243                 {
00244                         /* Now follows a string containing a soft-pointer
00245                          * ID/handle to owner dictionary. */
00246                         (fp->line_number)++;
00247                         fscanf (fp->fp, "%s\n", sortentstable->dictionary_owner_soft);
00248                         j++;
00249                 }
00250                 else if ((strcmp (temp_string, "330") == 0)
00251                   && (j > 0))
00252                 {
00253                         /* Now follows a string containing a soft pointer
00254                          * ID/handle to owner (currently only the
00255                          * *MODEL_SPACE or *PAPER_SPACE blocks). */
00256                         (fp->line_number)++;
00257                         fscanf (fp->fp, "%s\n", sortentstable->block_owner);
00258                         j++;
00260                 }
00261                 else if (strcmp (temp_string, "331") == 0)
00262                 {
00263                         /* Now follows a string containing a soft pointer
00264                          * ID/handle to an entity (zero or more entries
00265                          * may exist). */
00266                         (fp->line_number)++;
00267                         fscanf (fp->fp, "%s\n", iter_331->value);
00268                         iter_331->next = (struct DxfChar *) dxf_char_init ((DxfChar *) iter_331->next);
00269                         iter_331 = (DxfChar *) iter_331->next;
00270                 }
00271                 else if (strcmp (temp_string, "360") == 0)
00272                 {
00273                         /* Now follows a string containing Hard owner
00274                          * ID/handle to owner dictionary. */
00275                         (fp->line_number)++;
00276                         fscanf (fp->fp, "%s\n", sortentstable->dictionary_owner_hard);
00277                 }
00278                 else if (strcmp (temp_string, "999") == 0)
00279                 {
00280                         /* Now follows a string containing a comment. */
00281                         (fp->line_number)++;
00282                         fscanf (fp->fp, "%s\n", temp_string);
00283                         fprintf (stdout, (_("DXF comment: %s\n")), temp_string);
00284                 }
00285                 else
00286                 {
00287                         fprintf (stderr,
00288                           (_("Warning in %s () unknown string tag found while reading from: %s in line: %d.\n")),
00289                           __FUNCTION__, fp->filename, fp->line_number);
00290                 }
00291         }
00292         /* Clean up. */
00293         free (temp_string);
00294 #if DEBUG
00295         DXF_DEBUG_END
00296 #endif
00297         return (sortentstable);
00298 }
00299 
00300 
00307 int
00308 dxf_sortentstable_write
00309 (
00310         DxfFile *fp,
00312         DxfSortentsTable *sortentstable
00314 )
00315 {
00316 #if DEBUG
00317         DXF_DEBUG_BEGIN
00318 #endif
00319         char *dxf_entity_name = strdup ("SORTENTSTABLE");
00320         DxfInt *iter_5 = NULL;
00321         DxfChar *iter_331 = NULL;
00322 
00323         /* Do some basic checks. */
00324         if (fp == NULL)
00325         {
00326                 fprintf (stderr,
00327                   (_("Error in %s () a NULL file pointer was passed.\n")),
00328                   __FUNCTION__);
00329                 /* Clean up. */
00330                 free (dxf_entity_name);
00331                 return (EXIT_FAILURE);
00332         }
00333         if (sortentstable == NULL)
00334         {
00335                 fprintf (stderr,
00336                   (_("Error in %s () a NULL pointer was passed.\n")),
00337                   __FUNCTION__);
00338                 /* Clean up. */
00339                 free (dxf_entity_name);
00340                 return (EXIT_FAILURE);
00341         }
00342         if (fp->acad_version_number < AutoCAD_14)
00343         {
00344                 fprintf (stderr,
00345                   (_("Warning in %s () illegal DXF version for this %s entity with id-code: %x.\n")),
00346                   __FUNCTION__, dxf_entity_name, sortentstable->id_code);
00347         }
00348         /* Start writing output. */
00349         fprintf (fp->fp, "  0\n%s\n", dxf_entity_name);
00350         if (sortentstable->id_code != -1)
00351         {
00352                 fprintf (fp->fp, "  5\n%x\n", sortentstable->id_code);
00353         }
00364         if ((strcmp (sortentstable->dictionary_owner_soft, "") != 0)
00365           && (fp->acad_version_number >= AutoCAD_14))
00366         {
00367                 fprintf (fp->fp, "102\n{ACAD_REACTORS\n");
00368                 fprintf (fp->fp, "330\n%s\n", sortentstable->dictionary_owner_soft);
00369                 fprintf (fp->fp, "102\n}\n");
00370         }
00371         if ((strcmp (sortentstable->dictionary_owner_hard, "") != 0)
00372           && (fp->acad_version_number >= AutoCAD_14))
00373         {
00374                 fprintf (fp->fp, "102\n{ACAD_XDICTIONARY\n");
00375                 fprintf (fp->fp, "360\n%s\n", sortentstable->dictionary_owner_hard);
00376                 fprintf (fp->fp, "102\n}\n");
00377         }
00378         if (fp->acad_version_number >= AutoCAD_13)
00379         {
00380                 fprintf (fp->fp, "100\nAcDbSortentsTable\n");
00381         }
00382         fprintf (fp->fp, "330\n%s\n", sortentstable->block_owner);
00383         if (sortentstable->entity_owner != NULL)
00384         {
00385                 iter_331 = (DxfChar*) sortentstable->entity_owner;
00386                 while ((iter_331 != NULL) && (iter_331->value != NULL))
00387                 {
00388                         fprintf (fp->fp, "331\n%s\n", iter_331->value);
00389                         iter_331 = (DxfChar*) iter_331->next;
00390                 }
00391         }
00392         if (sortentstable->sort_handle != NULL)
00393         {
00394                 iter_5 = (DxfInt*) sortentstable->sort_handle;
00395                 while (iter_5 != NULL)
00396                 {
00397                         fprintf (fp->fp, "  5\n%x\n", iter_5->value);
00398                         iter_5 = (DxfInt*) iter_5->next;
00399                 }
00400         }
00401         /* Clean up. */
00402         free (dxf_entity_name);
00403 #if DEBUG
00404         DXF_DEBUG_END
00405 #endif
00406         return (EXIT_SUCCESS);
00407 }
00408 
00409 
00417 int
00418 dxf_sortentstable_free
00419 (
00420         DxfSortentsTable *sortentstable
00423 )
00424 {
00425 #if DEBUG
00426         DXF_DEBUG_BEGIN
00427 #endif
00428         /* Do some basic checks. */
00429         if (sortentstable == NULL)
00430         {
00431                 fprintf (stderr,
00432                   (_("Error in %s () a NULL pointer was passed.\n")),
00433                   __FUNCTION__);
00434                 return (EXIT_FAILURE);
00435         }
00436         if (sortentstable->next != NULL)
00437         {
00438                 fprintf (stderr,
00439                   (_("Error in %s () pointer to next was not NULL.\n")),
00440                   __FUNCTION__);
00441                 return (EXIT_FAILURE);
00442         }
00443         free (sortentstable->dictionary_owner_soft);
00444         free (sortentstable->dictionary_owner_hard);
00445         free (sortentstable->block_owner);
00446         dxf_char_free_chain (sortentstable->entity_owner);
00447         free (sortentstable);
00448         sortentstable = NULL;
00449 #if DEBUG
00450         DXF_DEBUG_END
00451 #endif
00452         return (EXIT_SUCCESS);
00453 }
00454 
00455 
00460 void
00461 dxf_sortentstable_free_chain
00462 (
00463         DxfSortentsTable *sortentstables
00466 )
00467 {
00468 #ifdef DEBUG
00469         DXF_DEBUG_BEGIN
00470 #endif
00471         if (sortentstables == NULL)
00472         {
00473                 fprintf (stderr,
00474                   (_("Warning in %s () a NULL pointer was passed.\n")),
00475                   __FUNCTION__);
00476         }
00477         while (sortentstables != NULL)
00478         {
00479                 struct DxfSortentsTable *iter = sortentstables->next;
00480                 dxf_sortentstable_free (sortentstables);
00481                 sortentstables = (DxfSortentsTable *) iter;
00482         }
00483 #if DEBUG
00484         DXF_DEBUG_END
00485 #endif
00486 }
00487 
00488 
00494 int
00495 dxf_sortentstable_get_id_code
00496 (
00497         DxfSortentsTable *sortentstable
00499 )
00500 {
00501 #if DEBUG
00502         DXF_DEBUG_BEGIN
00503 #endif
00504         /* Do some basic checks. */
00505         if (sortentstable == NULL)
00506         {
00507                 fprintf (stderr,
00508                   (_("Error in %s () a NULL pointer was passed.\n")),
00509                   __FUNCTION__);
00510                 return (EXIT_FAILURE);
00511         }
00512         if (sortentstable->id_code < 0)
00513         {
00514                 fprintf (stderr,
00515                   (_("Warning in %s () a negative value was found.\n")),
00516                   __FUNCTION__);
00517         }
00518 #if DEBUG
00519         DXF_DEBUG_END
00520 #endif
00521         return (sortentstable->id_code);
00522 }
00523 
00524 
00528 DxfSortentsTable *
00529 dxf_sortentstable_set_id_code
00530 (
00531         DxfSortentsTable *sortentstable,
00533         int id_code
00537 )
00538 {
00539 #if DEBUG
00540         DXF_DEBUG_BEGIN
00541 #endif
00542         /* Do some basic checks. */
00543         if (sortentstable == NULL)
00544         {
00545                 fprintf (stderr,
00546                   (_("Error in %s () a NULL pointer was passed.\n")),
00547                   __FUNCTION__);
00548                 return (NULL);
00549         }
00550         if (id_code < 0)
00551         {
00552                 fprintf (stderr,
00553                   (_("Warning in %s () a negative value was passed.\n")),
00554                   __FUNCTION__);
00555         }
00556         sortentstable->id_code = id_code;
00557 #if DEBUG
00558         DXF_DEBUG_END
00559 #endif
00560         return (sortentstable);
00561 }
00562 
00563 
00572 char *
00573 dxf_sortentstable_get_dictionary_owner_soft
00574 (
00575         DxfSortentsTable *sortentstable
00577 )
00578 {
00579 #if DEBUG
00580         DXF_DEBUG_BEGIN
00581 #endif
00582         /* Do some basic checks. */
00583         if (sortentstable == NULL)
00584         {
00585                 fprintf (stderr,
00586                   (_("Error in %s () a NULL pointer was passed.\n")),
00587                   __FUNCTION__);
00588                 return (NULL);
00589         }
00590         if (sortentstable->dictionary_owner_soft ==  NULL)
00591         {
00592                 fprintf (stderr,
00593                   (_("Error in %s () a NULL pointer was found.\n")),
00594                   __FUNCTION__);
00595                 return (NULL);
00596         }
00597 #if DEBUG
00598         DXF_DEBUG_END
00599 #endif
00600         return (strdup (sortentstable->dictionary_owner_soft));
00601 }
00602 
00603 
00608 DxfSortentsTable *
00609 dxf_sortentstable_set_dictionary_owner_soft
00610 (
00611         DxfSortentsTable *sortentstable,
00613         char *dictionary_owner_soft
00616 )
00617 {
00618 #if DEBUG
00619         DXF_DEBUG_BEGIN
00620 #endif
00621         /* Do some basic checks. */
00622         if (sortentstable == NULL)
00623         {
00624                 fprintf (stderr,
00625                   (_("Error in %s () a NULL pointer was passed.\n")),
00626                   __FUNCTION__);
00627                 return (NULL);
00628         }
00629         if (dictionary_owner_soft == NULL)
00630         {
00631                 fprintf (stderr,
00632                   (_("Error in %s () a NULL pointer was passed.\n")),
00633                   __FUNCTION__);
00634                 return (NULL);
00635         }
00636         sortentstable->dictionary_owner_soft = strdup (dictionary_owner_soft);
00637 #if DEBUG
00638         DXF_DEBUG_END
00639 #endif
00640         return (sortentstable);
00641 }
00642 
00643 
00652 char *
00653 dxf_sortentstable_get_dictionary_owner_hard
00654 (
00655         DxfSortentsTable *sortentstable
00657 )
00658 {
00659 #if DEBUG
00660         DXF_DEBUG_BEGIN
00661 #endif
00662         /* Do some basic checks. */
00663         if (sortentstable == NULL)
00664         {
00665                 fprintf (stderr,
00666                   (_("Error in %s () a NULL pointer was passed.\n")),
00667                   __FUNCTION__);
00668                 return (NULL);
00669         }
00670         if (sortentstable->dictionary_owner_hard ==  NULL)
00671         {
00672                 fprintf (stderr,
00673                   (_("Error in %s () a NULL pointer was found.\n")),
00674                   __FUNCTION__);
00675                 return (NULL);
00676         }
00677 #if DEBUG
00678         DXF_DEBUG_END
00679 #endif
00680         return (strdup (sortentstable->dictionary_owner_hard));
00681 }
00682 
00683 
00688 DxfSortentsTable *
00689 dxf_sortentstable_set_dictionary_owner_hard
00690 (
00691         DxfSortentsTable *sortentstable,
00693         char *dictionary_owner_hard
00696 )
00697 {
00698 #if DEBUG
00699         DXF_DEBUG_BEGIN
00700 #endif
00701         /* Do some basic checks. */
00702         if (sortentstable == NULL)
00703         {
00704                 fprintf (stderr,
00705                   (_("Error in %s () a NULL pointer was passed.\n")),
00706                   __FUNCTION__);
00707                 return (NULL);
00708         }
00709         if (dictionary_owner_hard == NULL)
00710         {
00711                 fprintf (stderr,
00712                   (_("Error in %s () a NULL pointer was passed.\n")),
00713                   __FUNCTION__);
00714                 return (NULL);
00715         }
00716         sortentstable->dictionary_owner_hard = strdup (dictionary_owner_hard);
00717 #if DEBUG
00718         DXF_DEBUG_END
00719 #endif
00720         return (sortentstable);
00721 }
00722 
00723 
00732 char *
00733 dxf_sortentstable_get_block_owner
00734 (
00735         DxfSortentsTable *sortentstable
00737 )
00738 {
00739 #if DEBUG
00740         DXF_DEBUG_BEGIN
00741 #endif
00742         /* Do some basic checks. */
00743         if (sortentstable == NULL)
00744         {
00745                 fprintf (stderr,
00746                   (_("Error in %s () a NULL pointer was passed.\n")),
00747                   __FUNCTION__);
00748                 return (NULL);
00749         }
00750         if (sortentstable->block_owner ==  NULL)
00751         {
00752                 fprintf (stderr,
00753                   (_("Error in %s () a NULL pointer was found.\n")),
00754                   __FUNCTION__);
00755                 return (NULL);
00756         }
00757 #if DEBUG
00758         DXF_DEBUG_END
00759 #endif
00760         return (strdup (sortentstable->block_owner));
00761 }
00762 
00763 
00768 DxfSortentsTable *
00769 dxf_sortentstable_set_block_owner
00770 (
00771         DxfSortentsTable *sortentstable,
00773         char *block_owner
00776 )
00777 {
00778 #if DEBUG
00779         DXF_DEBUG_BEGIN
00780 #endif
00781         /* Do some basic checks. */
00782         if (sortentstable == NULL)
00783         {
00784                 fprintf (stderr,
00785                   (_("Error in %s () a NULL pointer was passed.\n")),
00786                   __FUNCTION__);
00787                 return (NULL);
00788         }
00789         if (block_owner == NULL)
00790         {
00791                 fprintf (stderr,
00792                   (_("Error in %s () a NULL pointer was passed.\n")),
00793                   __FUNCTION__);
00794                 return (NULL);
00795         }
00796         sortentstable->block_owner = strdup (block_owner);
00797 #if DEBUG
00798         DXF_DEBUG_END
00799 #endif
00800         return (sortentstable);
00801 }
00802 
00803 
00812 DxfChar *
00813 dxf_sortentstable_get_entity_owner
00814 (
00815         DxfSortentsTable *sortentstable
00817 )
00818 {
00819 #if DEBUG
00820         DXF_DEBUG_BEGIN
00821 #endif
00822         /* Do some basic checks. */
00823         if (sortentstable == NULL)
00824         {
00825                 fprintf (stderr,
00826                   (_("Error in %s () a NULL pointer was passed.\n")),
00827                   __FUNCTION__);
00828                 return (NULL);
00829         }
00830         if (sortentstable->entity_owner ==  NULL)
00831         {
00832                 fprintf (stderr,
00833                   (_("Error in %s () a NULL pointer was found.\n")),
00834                   __FUNCTION__);
00835                 return (NULL);
00836         }
00837         if (sortentstable->entity_owner->value ==  NULL)
00838         {
00839                 fprintf (stderr,
00840                   (_("Warning in %s () a NULL pointer was found in a member.\n")),
00841                   __FUNCTION__);
00842         }
00843 #if DEBUG
00844         DXF_DEBUG_END
00845 #endif
00846         return (sortentstable->entity_owner);
00847 }
00848 
00849 
00854 DxfSortentsTable *
00855 dxf_sortentstable_set_entity_owner
00856 (
00857         DxfSortentsTable *sortentstable,
00859         DxfChar *entity_owner
00861 )
00862 {
00863 #if DEBUG
00864         DXF_DEBUG_BEGIN
00865 #endif
00866         /* Do some basic checks. */
00867         if (sortentstable == NULL)
00868         {
00869                 fprintf (stderr,
00870                   (_("Error in %s () a NULL pointer was passed.\n")),
00871                   __FUNCTION__);
00872                 return (NULL);
00873         }
00874         if (entity_owner == NULL)
00875         {
00876                 fprintf (stderr,
00877                   (_("Error in %s () a NULL pointer was passed.\n")),
00878                   __FUNCTION__);
00879                 return (NULL);
00880         }
00881         if (entity_owner->value == NULL)
00882         {
00883                 fprintf (stderr,
00884                   (_("warning in %s () a NULL pointer was found in a member.\n")),
00885                   __FUNCTION__);
00886         }
00887         sortentstable->entity_owner = entity_owner;
00888 #if DEBUG
00889         DXF_DEBUG_END
00890 #endif
00891         return (sortentstable);
00892 }
00893 
00894 
00903 DxfChar *
00904 dxf_sortentstable_get_last_entity_owner
00905 (
00906         DxfChar *entity_owner
00908 )
00909 {
00910 #if DEBUG
00911         DXF_DEBUG_BEGIN
00912 #endif
00913         /* Do some basic checks. */
00914         if (entity_owner == NULL)
00915         {
00916                 fprintf (stderr,
00917                   (_("Error in %s () a NULL pointer was passed.\n")),
00918                   __FUNCTION__);
00919                 return (NULL);
00920         }
00921         if (entity_owner->next == NULL)
00922         {
00923                 fprintf (stderr,
00924                   (_("Warning in %s () a NULL pointer was found.\n")),
00925                   __FUNCTION__);
00926                 return ((DxfChar *) entity_owner);
00927         }
00928         DxfChar *iter = (DxfChar *) entity_owner->next;
00929         while (iter->next != NULL)
00930         {
00931                 iter = (DxfChar *) iter->next;
00932         }
00933 #if DEBUG
00934         DXF_DEBUG_END
00935 #endif
00936         return ((DxfChar *) iter);
00937 }
00938 
00939 
00948 char *
00949 dxf_sortentstable_get_entity_owner_value
00950 (
00951         DxfChar *entity_owner
00954 )
00955 {
00956 #if DEBUG
00957         DXF_DEBUG_BEGIN
00958 #endif
00959         /* Do some basic checks. */
00960         if (entity_owner == NULL)
00961         {
00962                 fprintf (stderr,
00963                   (_("Error in %s () a NULL pointer was passed.\n")),
00964                   __FUNCTION__);
00965                 return (NULL);
00966         }
00967         if (entity_owner->value ==  NULL)
00968         {
00969                 fprintf (stderr,
00970                   (_("Error in %s () a NULL pointer was found in a member.\n")),
00971                   __FUNCTION__);
00972                 return (NULL);
00973         }
00974 #if DEBUG
00975         DXF_DEBUG_END
00976 #endif
00977         return (strdup (entity_owner->value));
00978 }
00979 
00980 
00985 DxfChar *
00986 dxf_sortentstable_set_entity_owner_value
00987 (
00988         DxfChar *entity_owner,
00991         char *value
00993 )
00994 {
00995 #if DEBUG
00996         DXF_DEBUG_BEGIN
00997 #endif
00998         /* Do some basic checks. */
00999         if (entity_owner == NULL)
01000         {
01001                 fprintf (stderr,
01002                   (_("Error in %s () a NULL pointer was passed.\n")),
01003                   __FUNCTION__);
01004                 return (NULL);
01005         }
01006         if (value == NULL)
01007         {
01008                 fprintf (stderr,
01009                   (_("Error in %s () a NULL pointer was passed.\n")),
01010                   __FUNCTION__);
01011                 return (NULL);
01012         }
01013         entity_owner->value = value;
01014 #if DEBUG
01015         DXF_DEBUG_END
01016 #endif
01017         return (entity_owner);
01018 }
01019 
01020 
01027 int
01028 dxf_sortentstable_get_entity_owner_length
01029 (
01030         DxfChar *entity_owner
01032 )
01033 {
01034 #if DEBUG
01035         DXF_DEBUG_BEGIN
01036 #endif
01037         /* Do some basic checks. */
01038         if (entity_owner == NULL)
01039         {
01040                 fprintf (stderr,
01041                   (_("Error in %s () a NULL pointer was passed.\n")),
01042                   __FUNCTION__);
01043                 return (EXIT_FAILURE);
01044         }
01045 #if DEBUG
01046         DXF_DEBUG_END
01047 #endif
01048         return (entity_owner->length);
01049 }
01050 
01051 
01056 DxfChar *
01057 dxf_sortentstable_set_entity_owner_length
01058 (
01059         DxfChar *entity_owner,
01062         int length
01064 )
01065 {
01066 #if DEBUG
01067         DXF_DEBUG_BEGIN
01068 #endif
01069         /* Do some basic checks. */
01070         if (entity_owner == NULL)
01071         {
01072                 fprintf (stderr,
01073                   (_("Error in %s () a NULL pointer was passed.\n")),
01074                   __FUNCTION__);
01075                 return (NULL);
01076         }
01077         entity_owner->length = length;
01078 #if DEBUG
01079         DXF_DEBUG_END
01080 #endif
01081         return (entity_owner);
01082 }
01083 
01084 
01093 DxfChar *
01094 dxf_sortentstable_get_next_entity_owner
01095 (
01096         DxfChar *entity_owner
01098 )
01099 {
01100 #if DEBUG
01101         DXF_DEBUG_BEGIN
01102 #endif
01103         /* Do some basic checks. */
01104         if (entity_owner == NULL)
01105         {
01106                 fprintf (stderr,
01107                   (_("Error in %s () a NULL pointer was passed.\n")),
01108                   __FUNCTION__);
01109                 return (NULL);
01110         }
01111         if (entity_owner->next == NULL)
01112         {
01113                 fprintf (stderr,
01114                   (_("Error in %s () a NULL pointer was found.\n")),
01115                   __FUNCTION__);
01116                 return (NULL);
01117         }
01118 #if DEBUG
01119         DXF_DEBUG_END
01120 #endif
01121         return ((DxfChar *) entity_owner->next);
01122 }
01123 
01124 
01129 DxfChar *
01130 dxf_sortentstable_set_next_entity_owner
01131 (
01132         DxfChar *entity_owner,
01134         DxfChar *next
01136 )
01137 {
01138 #if DEBUG
01139         DXF_DEBUG_BEGIN
01140 #endif
01141         /* Do some basic checks. */
01142         if (entity_owner == NULL)
01143         {
01144                 fprintf (stderr,
01145                   (_("Error in %s () a NULL pointer was passed.\n")),
01146                   __FUNCTION__);
01147                 return (NULL);
01148         }
01149         if (next == NULL)
01150         {
01151                 fprintf (stderr,
01152                   (_("Error in %s () a NULL pointer was passed.\n")),
01153                   __FUNCTION__);
01154                 return (NULL);
01155         }
01156         entity_owner->next = (struct DxfChar *) next;
01157 #if DEBUG
01158         DXF_DEBUG_END
01159 #endif
01160         return (entity_owner);
01161 }
01162 
01163 
01169 DxfInt *
01170 dxf_sortentstable_get_sort_handle
01171 (
01172         DxfSortentsTable *sortentstable
01174 )
01175 {
01176 #if DEBUG
01177         DXF_DEBUG_BEGIN
01178 #endif
01179         /* Do some basic checks. */
01180         if (sortentstable == NULL)
01181         {
01182                 fprintf (stderr,
01183                   (_("Error in %s () a NULL pointer was passed.\n")),
01184                   __FUNCTION__);
01185                 return (NULL);
01186         }
01187         if (sortentstable->sort_handle == NULL)
01188         {
01189                 fprintf (stderr,
01190                   (_("Warning in %s () a NULL pointer was found.\n")),
01191                   __FUNCTION__);
01192                 return (NULL);
01193         }
01194 #if DEBUG
01195         DXF_DEBUG_END
01196 #endif
01197         return (sortentstable->sort_handle);
01198 }
01199 
01200 
01204 DxfSortentsTable *
01205 dxf_sortentstable_set_sort_handle
01206 (
01207         DxfSortentsTable *sortentstable,
01209         DxfInt *sort_handle
01211 )
01212 {
01213 #if DEBUG
01214         DXF_DEBUG_BEGIN
01215 #endif
01216         /* Do some basic checks. */
01217         if (sortentstable == NULL)
01218         {
01219                 fprintf (stderr,
01220                   (_("Error in %s () a NULL pointer was passed.\n")),
01221                   __FUNCTION__);
01222                 return (NULL);
01223         }
01224         if (sort_handle == NULL)
01225         {
01226                 fprintf (stderr,
01227                   (_("Error in %s () a NULL pointer was passed.\n")),
01228                   __FUNCTION__);
01229                 return (NULL);
01230         }
01231         sortentstable->sort_handle = sort_handle;
01232 #if DEBUG
01233         DXF_DEBUG_END
01234 #endif
01235         return (sortentstable);
01236 }
01237 
01238 
01245 int
01246 dxf_sortentstable_get_sort_handle_value
01247 (
01248         DxfInt *sort_handle
01250 )
01251 {
01252 #if DEBUG
01253         DXF_DEBUG_BEGIN
01254 #endif
01255         /* Do some basic checks. */
01256         if (sort_handle == NULL)
01257         {
01258                 fprintf (stderr,
01259                   (_("Error in %s () a NULL pointer was passed.\n")),
01260                   __FUNCTION__);
01261                 return (EXIT_FAILURE);
01262         }
01263 #if DEBUG
01264         DXF_DEBUG_END
01265 #endif
01266         return (sort_handle->value);
01267 }
01268 
01269 
01274 DxfInt *
01275 dxf_sortentstable_set_sort_handle_value
01276 (
01277         DxfInt *sort_handle,
01279         int value
01281 )
01282 {
01283 #if DEBUG
01284         DXF_DEBUG_BEGIN
01285 #endif
01286         /* Do some basic checks. */
01287         if (sort_handle == NULL)
01288         {
01289                 fprintf (stderr,
01290                   (_("Error in %s () a NULL pointer was passed.\n")),
01291                   __FUNCTION__);
01292                 return (NULL);
01293         }
01294         sort_handle->value = value;
01295 #if DEBUG
01296         DXF_DEBUG_END
01297 #endif
01298         return (sort_handle);
01299 }
01300 
01301 
01310 DxfInt *
01311 dxf_sortentstable_get_next_sort_handle
01312 (
01313         DxfInt *sort_handle
01315 )
01316 {
01317 #if DEBUG
01318         DXF_DEBUG_BEGIN
01319 #endif
01320         /* Do some basic checks. */
01321         if (sort_handle == NULL)
01322         {
01323                 fprintf (stderr,
01324                   (_("Error in %s () a NULL pointer was passed.\n")),
01325                   __FUNCTION__);
01326                 return (NULL);
01327         }
01328         if (sort_handle->next == NULL)
01329         {
01330                 fprintf (stderr,
01331                   (_("Error in %s () a NULL pointer was found.\n")),
01332                   __FUNCTION__);
01333                 return (NULL);
01334         }
01335 #if DEBUG
01336         DXF_DEBUG_END
01337 #endif
01338         return ((DxfInt *) sort_handle->next);
01339 }
01340 
01341 
01346 DxfInt *
01347 dxf_sortentstable_set_next_sort_handle
01348 (
01349         DxfInt *sort_handle,
01351         DxfInt *next
01353 )
01354 {
01355 #if DEBUG
01356         DXF_DEBUG_BEGIN
01357 #endif
01358         /* Do some basic checks. */
01359         if (sort_handle == NULL)
01360         {
01361                 fprintf (stderr,
01362                   (_("Error in %s () a NULL pointer was passed.\n")),
01363                   __FUNCTION__);
01364                 return (NULL);
01365         }
01366         if (next == NULL)
01367         {
01368                 fprintf (stderr,
01369                   (_("Error in %s () a NULL pointer was passed.\n")),
01370                   __FUNCTION__);
01371                 return (NULL);
01372         }
01373         sort_handle->next = (struct DxfInt *) next;
01374 #if DEBUG
01375         DXF_DEBUG_END
01376 #endif
01377         return (sort_handle);
01378 }
01379 
01380 
01389 DxfInt *
01390 dxf_sortentstable_get_last_sort_handle
01391 (
01392         DxfInt *sort_handle
01394 )
01395 {
01396 #if DEBUG
01397         DXF_DEBUG_BEGIN
01398 #endif
01399         /* Do some basic checks. */
01400         if (sort_handle == NULL)
01401         {
01402                 fprintf (stderr,
01403                   (_("Error in %s () a NULL pointer was passed.\n")),
01404                   __FUNCTION__);
01405                 return (NULL);
01406         }
01407         if (sort_handle->next == NULL)
01408         {
01409                 fprintf (stderr,
01410                   (_("Warning in %s () a NULL pointer was found.\n")),
01411                   __FUNCTION__);
01412                 return ((DxfInt *) sort_handle);
01413         }
01414         DxfInt *iter = (DxfInt *) sort_handle->next;
01415         while (iter->next != NULL)
01416         {
01417                 iter = (DxfInt *) iter->next;
01418         }
01419 #if DEBUG
01420         DXF_DEBUG_END
01421 #endif
01422         return ((DxfInt *) iter);
01423 }
01424 
01425 
01434 DxfSortentsTable *
01435 dxf_sortentstable_get_next
01436 (
01437         DxfSortentsTable *sortentstable
01439 )
01440 {
01441 #if DEBUG
01442         DXF_DEBUG_BEGIN
01443 #endif
01444         /* Do some basic checks. */
01445         if (sortentstable == NULL)
01446         {
01447                 fprintf (stderr,
01448                   (_("Error in %s () a NULL pointer was passed.\n")),
01449                   __FUNCTION__);
01450                 return (NULL);
01451         }
01452         if (sortentstable->next == NULL)
01453         {
01454                 fprintf (stderr,
01455                   (_("Error in %s () a NULL pointer was found.\n")),
01456                   __FUNCTION__);
01457                 return (NULL);
01458         }
01459 #if DEBUG
01460         DXF_DEBUG_END
01461 #endif
01462         return ((DxfSortentsTable *) sortentstable->next);
01463 }
01464 
01465 
01470 DxfSortentsTable *
01471 dxf_sortentstable_set_next
01472 (
01473         DxfSortentsTable *sortentstable,
01475         DxfSortentsTable *next
01478 )
01479 {
01480 #if DEBUG
01481         DXF_DEBUG_BEGIN
01482 #endif
01483         /* Do some basic checks. */
01484         if (sortentstable == NULL)
01485         {
01486                 fprintf (stderr,
01487                   (_("Error in %s () a NULL pointer was passed.\n")),
01488                   __FUNCTION__);
01489                 return (NULL);
01490         }
01491         if (next == NULL)
01492         {
01493                 fprintf (stderr,
01494                   (_("Error in %s () a NULL pointer was passed.\n")),
01495                   __FUNCTION__);
01496                 return (NULL);
01497         }
01498         sortentstable->next = (struct DxfSortentsTable *) next;
01499 #if DEBUG
01500         DXF_DEBUG_END
01501 #endif
01502         return (sortentstable);
01503 }
01504 
01505 
01514 DxfSortentsTable *
01515 dxf_sortentstable_get_last
01516 (
01517         DxfSortentsTable *sortentstable
01519 )
01520 {
01521 #if DEBUG
01522         DXF_DEBUG_BEGIN
01523 #endif
01524         /* Do some basic checks. */
01525         if (sortentstable == NULL)
01526         {
01527                 fprintf (stderr,
01528                   (_("Error in %s () a NULL pointer was passed.\n")),
01529                   __FUNCTION__);
01530                 return (NULL);
01531         }
01532         if (sortentstable->next == NULL)
01533         {
01534                 fprintf (stderr,
01535                   (_("Warning in %s () a NULL pointer was found.\n")),
01536                   __FUNCTION__);
01537                 return ((DxfSortentsTable *) sortentstable);
01538         }
01539         DxfSortentsTable *iter = (DxfSortentsTable *) sortentstable->next;
01540         while (iter->next != NULL)
01541         {
01542                 iter = (DxfSortentsTable *) iter->next;
01543         }
01544 #if DEBUG
01545         DXF_DEBUG_END
01546 #endif
01547         return ((DxfSortentsTable *) iter);
01548 }
01549 
01550 
01551 /* EOF*/