libDXF 0.0.1
A library with DXF related functions written in C.
|
00001 00046 #include "imagedef_reactor.h" 00047 00048 00054 DxfImagedefReactor * 00055 dxf_imagedef_reactor_new () 00056 { 00057 #if DEBUG 00058 DXF_DEBUG_BEGIN 00059 #endif 00060 DxfImagedefReactor *imagedef_reactor = NULL; 00061 size_t size; 00062 00063 size = sizeof (DxfImagedefReactor); 00064 /* avoid malloc of 0 bytes */ 00065 if (size == 0) size = 1; 00066 if ((imagedef_reactor = malloc (size)) == NULL) 00067 { 00068 fprintf (stderr, 00069 (_("Error in %s () could not allocate memory for a DxfImagedefReactor struct.\n")), 00070 __FUNCTION__); 00071 imagedef_reactor = NULL; 00072 } 00073 else 00074 { 00075 memset (imagedef_reactor, 0, size); 00076 } 00077 #if DEBUG 00078 DXF_DEBUG_END 00079 #endif 00080 return (imagedef_reactor); 00081 } 00082 00083 00091 DxfImagedefReactor * 00092 dxf_imagedef_reactor_init 00093 ( 00094 DxfImagedefReactor *imagedef_reactor 00096 ) 00097 { 00098 #if DEBUG 00099 DXF_DEBUG_BEGIN 00100 #endif 00101 /* Do some basic checks. */ 00102 if (imagedef_reactor == NULL) 00103 { 00104 fprintf (stderr, 00105 (_("Warning in %s () a NULL pointer was passed.\n")), 00106 __FUNCTION__); 00107 imagedef_reactor = dxf_imagedef_reactor_new (); 00108 } 00109 if (imagedef_reactor == NULL) 00110 { 00111 fprintf (stderr, 00112 (_("Error in %s () could not allocate memory for a DxfImagedefReactor struct.\n")), 00113 __FUNCTION__); 00114 return (NULL); 00115 } 00116 dxf_imagedef_reactor_set_id_code (imagedef_reactor, 0); 00117 dxf_imagedef_reactor_set_dictionary_owner_soft (imagedef_reactor, strdup ("")); 00118 dxf_imagedef_reactor_set_dictionary_owner_hard (imagedef_reactor, strdup ("")); 00119 dxf_imagedef_reactor_set_class_version (imagedef_reactor, 2); 00120 dxf_imagedef_reactor_set_associated_image_object (imagedef_reactor, strdup ("")); 00121 dxf_imagedef_reactor_set_associated_image_object_length (imagedef_reactor, 0); 00122 dxf_imagedef_reactor_set_next (imagedef_reactor, NULL); 00123 #if DEBUG 00124 DXF_DEBUG_END 00125 #endif 00126 return (imagedef_reactor); 00127 } 00128 00129 00142 DxfImagedefReactor * 00143 dxf_imagedef_reactor_read 00144 ( 00145 DxfFile *fp, 00147 DxfImagedefReactor *imagedef_reactor 00149 ) 00150 { 00151 #if DEBUG 00152 DXF_DEBUG_BEGIN 00153 #endif 00154 char *temp_string = NULL; 00155 int i; 00156 00157 /* Do some basic checks. */ 00158 if (fp == NULL) 00159 { 00160 fprintf (stderr, 00161 (_("Error in %s () a NULL file pointer was passed.\n")), 00162 __FUNCTION__); 00163 /* Clean up. */ 00164 free (temp_string); 00165 return (NULL); 00166 } 00167 if (fp->acad_version_number < AutoCAD_14) 00168 { 00169 fprintf (stderr, 00170 (_("Warning in %s () illegal DXF version for this entity.\n")), 00171 __FUNCTION__); 00172 } 00173 if (imagedef_reactor == NULL) 00174 { 00175 fprintf (stderr, 00176 (_("Warning in %s () a NULL pointer was passed.\n")), 00177 __FUNCTION__); 00178 imagedef_reactor = dxf_imagedef_reactor_new (); 00179 imagedef_reactor = dxf_imagedef_reactor_init (imagedef_reactor); 00180 } 00181 i = 0; 00182 (fp->line_number)++; 00183 fscanf (fp->fp, "%[^\n]", temp_string); 00184 while (strcmp (temp_string, "0") != 0) 00185 { 00186 if (ferror (fp->fp)) 00187 { 00188 fprintf (stderr, 00189 (_("Error in %s () while reading from: %s in line: %d.\n")), 00190 __FUNCTION__, fp->filename, fp->line_number); 00191 /* Clean up. */ 00192 free (temp_string); 00193 fclose (fp->fp); 00194 return (NULL); 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", &imagedef_reactor->id_code); 00202 } 00203 else if (strcmp (temp_string, "90") == 0) 00204 { 00205 /* Now follows a string containing the 00206 * value of class version. */ 00207 (fp->line_number)++; 00208 fscanf (fp->fp, "%d\n", &imagedef_reactor->class_version); 00209 } 00210 else if ((fp->acad_version_number >= AutoCAD_13) 00211 && (strcmp (temp_string, "100") == 0)) 00212 { 00213 /* Now follows a string containing the 00214 * subclass marker value. */ 00215 (fp->line_number)++; 00216 fscanf (fp->fp, "%s\n", temp_string); 00217 if (strcmp (temp_string, "AcDbRasterImageDef") != 0) 00218 { 00219 fprintf (stderr, 00220 (_("Warning in %s () found a bad subclass marker in: %s in line: %d.\n")), 00221 __FUNCTION__, fp->filename, fp->line_number); 00222 } 00223 } 00224 else if ((strcmp (temp_string, "330") == 0) 00225 && (i == 0)) 00226 { 00227 /* Now follows a string containing Soft-pointer 00228 * ID/handle to owner dictionary. */ 00229 (fp->line_number)++; 00230 fscanf (fp->fp, "%s\n", imagedef_reactor->dictionary_owner_soft); 00231 i++; 00232 } 00233 else if ((strcmp (temp_string, "330") == 0) 00234 && (i == 1)) 00235 { 00236 /* Now follows a string containing object ID for 00237 * associated image object. */ 00238 (fp->line_number)++; 00239 fscanf (fp->fp, "%s\n", imagedef_reactor->associated_image_object); 00240 i++; 00241 } 00242 else if (strcmp (temp_string, "360") == 0) 00243 { 00244 /* Now follows a string containing Hard owner 00245 * ID/handle to owner dictionary. */ 00246 (fp->line_number)++; 00247 fscanf (fp->fp, "%s\n", imagedef_reactor->dictionary_owner_hard); 00248 } 00249 else if (strcmp (temp_string, "999") == 0) 00250 { 00251 /* Now follows a string containing a comment. */ 00252 (fp->line_number)++; 00253 fscanf (fp->fp, "%s\n", temp_string); 00254 fprintf (stdout, (_("DXF comment: %s\n")), temp_string); 00255 } 00256 else 00257 { 00258 fprintf (stderr, 00259 (_("Warning in %s () unknown string tag found while reading from: %s in line: %d.\n")), 00260 __FUNCTION__, fp->filename, fp->line_number); 00261 } 00262 } 00263 /* Clean up. */ 00264 free (temp_string); 00265 #if DEBUG 00266 DXF_DEBUG_END 00267 #endif 00268 return (imagedef_reactor); 00269 } 00270 00271 00279 int 00280 dxf_imagedef_reactor_write 00281 ( 00282 DxfFile *fp, 00284 DxfImagedefReactor *imagedef_reactor 00286 ) 00287 { 00288 #if DEBUG 00289 DXF_DEBUG_BEGIN 00290 #endif 00291 char *dxf_entity_name = strdup ("IMAGEDEF_REACTOR"); 00292 00293 /* Do some basic checks. */ 00294 if (fp == NULL) 00295 { 00296 fprintf (stderr, 00297 (_("Error in %s () a NULL file pointer was passed.\n")), 00298 __FUNCTION__); 00299 /* Clean up. */ 00300 free (dxf_entity_name); 00301 return (EXIT_FAILURE); 00302 } 00303 if (imagedef_reactor == NULL) 00304 { 00305 fprintf (stderr, 00306 (_("Error in %s () a NULL pointer was passed.\n")), 00307 __FUNCTION__); 00308 /* Clean up. */ 00309 free (dxf_entity_name); 00310 return (EXIT_FAILURE); 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_imagedef_reactor_get_id_code (imagedef_reactor)); 00317 } 00318 if (fp->acad_version_number == AutoCAD_14) 00319 { 00320 dxf_imagedef_reactor_set_class_version (imagedef_reactor, 2); 00321 } 00322 /* Start writing output. */ 00323 fprintf (fp->fp, " 0\n%s\n", dxf_entity_name); 00324 if (dxf_imagedef_reactor_get_id_code (imagedef_reactor) != -1) 00325 { 00326 fprintf (fp->fp, " 5\n%x\n", dxf_imagedef_reactor_get_id_code (imagedef_reactor)); 00327 } 00338 if ((strcmp (dxf_imagedef_reactor_get_dictionary_owner_soft (imagedef_reactor), "") != 0) 00339 && (fp->acad_version_number >= AutoCAD_14)) 00340 { 00341 fprintf (fp->fp, "102\n{ACAD_REACTORS\n"); 00342 fprintf (fp->fp, "330\n%s\n", dxf_imagedef_reactor_get_dictionary_owner_soft (imagedef_reactor)); 00343 fprintf (fp->fp, "102\n}\n"); 00344 } 00345 if ((strcmp (dxf_imagedef_reactor_get_dictionary_owner_hard (imagedef_reactor), "") != 0) 00346 && (fp->acad_version_number >= AutoCAD_14)) 00347 { 00348 fprintf (fp->fp, "102\n{ACAD_XDICTIONARY\n"); 00349 fprintf (fp->fp, "360\n%s\n", dxf_imagedef_reactor_get_dictionary_owner_hard (imagedef_reactor)); 00350 fprintf (fp->fp, "102\n}\n"); 00351 } 00352 if (fp->acad_version_number >= AutoCAD_13) 00353 { 00354 fprintf (fp->fp, "100\nAcDbRasterImageDefReactor\n"); 00355 } 00356 fprintf (fp->fp, " 90\n%d\n", dxf_imagedef_reactor_get_class_version (imagedef_reactor)); 00357 fprintf (fp->fp, "330\n%s\n", dxf_imagedef_reactor_get_associated_image_object (imagedef_reactor)); 00358 /* Clean up. */ 00359 free (dxf_entity_name); 00360 #if DEBUG 00361 DXF_DEBUG_END 00362 #endif 00363 return (EXIT_SUCCESS); 00364 } 00365 00366 00374 int 00375 dxf_imagedef_reactor_free 00376 ( 00377 DxfImagedefReactor *imagedef_reactor 00380 ) 00381 { 00382 #if DEBUG 00383 DXF_DEBUG_BEGIN 00384 #endif 00385 /* Do some basic checks. */ 00386 if (imagedef_reactor == NULL) 00387 { 00388 fprintf (stderr, 00389 (_("Error in %s () a NULL pointer was passed.\n")), 00390 __FUNCTION__); 00391 return (EXIT_FAILURE); 00392 } 00393 if (imagedef_reactor->next != NULL) 00394 { 00395 fprintf (stderr, 00396 (_("Error in %s () pointer to next was not NULL.\n")), 00397 __FUNCTION__); 00398 return (EXIT_FAILURE); 00399 } 00400 free (imagedef_reactor->dictionary_owner_soft); 00401 free (imagedef_reactor->dictionary_owner_hard); 00402 free (imagedef_reactor->associated_image_object); 00403 free (imagedef_reactor); 00404 imagedef_reactor = NULL; 00405 #if DEBUG 00406 DXF_DEBUG_END 00407 #endif 00408 return (EXIT_SUCCESS); 00409 } 00410 00411 00416 void 00417 dxf_imagedef_reactor_free_chain 00418 ( 00419 DxfImagedefReactor *imagedef_reactors 00422 ) 00423 { 00424 #ifdef DEBUG 00425 DXF_DEBUG_BEGIN 00426 #endif 00427 if (imagedef_reactors == NULL) 00428 { 00429 fprintf (stderr, 00430 (_("Warning in %s () a NULL pointer was passed.\n")), 00431 __FUNCTION__); 00432 } 00433 while (imagedef_reactors != NULL) 00434 { 00435 struct DxfImagedefReactor *iter = imagedef_reactors->next; 00436 dxf_imagedef_reactor_free (imagedef_reactors); 00437 imagedef_reactors = (DxfImagedefReactor *) iter; 00438 } 00439 #if DEBUG 00440 DXF_DEBUG_END 00441 #endif 00442 } 00443 00444 00451 int 00452 dxf_imagedef_reactor_get_id_code 00453 ( 00454 DxfImagedefReactor *imagedef_reactor 00456 ) 00457 { 00458 #if DEBUG 00459 DXF_DEBUG_BEGIN 00460 #endif 00461 /* Do some basic checks. */ 00462 if (imagedef_reactor == NULL) 00463 { 00464 fprintf (stderr, 00465 (_("Error in %s () a NULL pointer was passed.\n")), 00466 __FUNCTION__); 00467 return (EXIT_FAILURE); 00468 } 00469 if (imagedef_reactor->id_code < 0) 00470 { 00471 fprintf (stderr, 00472 (_("Error in %s () a negative value was found in the id_code member.\n")), 00473 __FUNCTION__); 00474 return (EXIT_FAILURE); 00475 } 00476 #if DEBUG 00477 DXF_DEBUG_END 00478 #endif 00479 return (imagedef_reactor->id_code); 00480 } 00481 00482 00489 DxfImagedefReactor * 00490 dxf_imagedef_reactor_set_id_code 00491 ( 00492 DxfImagedefReactor *imagedef_reactor, 00494 int id_code 00498 ) 00499 { 00500 #if DEBUG 00501 DXF_DEBUG_BEGIN 00502 #endif 00503 /* Do some basic checks. */ 00504 if (imagedef_reactor == NULL) 00505 { 00506 fprintf (stderr, 00507 (_("Error in %s () a NULL pointer was passed.\n")), 00508 __FUNCTION__); 00509 return (NULL); 00510 } 00511 if (id_code < 0) 00512 { 00513 fprintf (stderr, 00514 (_("Error in %s () a negative id-code value was passed.\n")), 00515 __FUNCTION__); 00516 return (NULL); 00517 } 00518 imagedef_reactor->id_code = id_code; 00519 #if DEBUG 00520 DXF_DEBUG_END 00521 #endif 00522 return (imagedef_reactor); 00523 } 00524 00525 00535 char * 00536 dxf_imagedef_reactor_get_dictionary_owner_soft 00537 ( 00538 DxfImagedefReactor *imagedef_reactor 00540 ) 00541 { 00542 #if DEBUG 00543 DXF_DEBUG_BEGIN 00544 #endif 00545 /* Do some basic checks. */ 00546 if (imagedef_reactor == NULL) 00547 { 00548 fprintf (stderr, 00549 (_("Error in %s () a NULL pointer was passed.\n")), 00550 __FUNCTION__); 00551 return (NULL); 00552 } 00553 if (imagedef_reactor->dictionary_owner_soft == NULL) 00554 { 00555 fprintf (stderr, 00556 (_("Error in %s () a NULL pointer was found in the dictionary_owner_soft member.\n")), 00557 __FUNCTION__); 00558 return (NULL); 00559 } 00560 #if DEBUG 00561 DXF_DEBUG_END 00562 #endif 00563 return (strdup (imagedef_reactor->dictionary_owner_soft)); 00564 } 00565 00566 00574 DxfImagedefReactor * 00575 dxf_imagedef_reactor_set_dictionary_owner_soft 00576 ( 00577 DxfImagedefReactor *imagedef_reactor, 00579 char *dictionary_owner_soft 00582 ) 00583 { 00584 #if DEBUG 00585 DXF_DEBUG_BEGIN 00586 #endif 00587 /* Do some basic checks. */ 00588 if (imagedef_reactor == NULL) 00589 { 00590 fprintf (stderr, 00591 (_("Error in %s () a NULL pointer was passed.\n")), 00592 __FUNCTION__); 00593 return (NULL); 00594 } 00595 if (dictionary_owner_soft == NULL) 00596 { 00597 fprintf (stderr, 00598 (_("Error in %s () a NULL pointer was passed.\n")), 00599 __FUNCTION__); 00600 return (NULL); 00601 } 00602 imagedef_reactor->dictionary_owner_soft = strdup (dictionary_owner_soft); 00603 #if DEBUG 00604 DXF_DEBUG_END 00605 #endif 00606 return (imagedef_reactor); 00607 } 00608 00609 00619 char * 00620 dxf_imagedef_reactor_get_dictionary_owner_hard 00621 ( 00622 DxfImagedefReactor *imagedef_reactor 00624 ) 00625 { 00626 #if DEBUG 00627 DXF_DEBUG_BEGIN 00628 #endif 00629 /* Do some basic checks. */ 00630 if (imagedef_reactor == NULL) 00631 { 00632 fprintf (stderr, 00633 (_("Error in %s () a NULL pointer was passed.\n")), 00634 __FUNCTION__); 00635 return (NULL); 00636 } 00637 if (imagedef_reactor->dictionary_owner_hard == NULL) 00638 { 00639 fprintf (stderr, 00640 (_("Error in %s () a NULL pointer was found in the dictionary_owner_hard member.\n")), 00641 __FUNCTION__); 00642 return (NULL); 00643 } 00644 #if DEBUG 00645 DXF_DEBUG_END 00646 #endif 00647 return (strdup (imagedef_reactor->dictionary_owner_hard)); 00648 } 00649 00650 00658 DxfImagedefReactor * 00659 dxf_imagedef_reactor_set_dictionary_owner_hard 00660 ( 00661 DxfImagedefReactor *imagedef_reactor, 00663 char *dictionary_owner_hard 00666 ) 00667 { 00668 #if DEBUG 00669 DXF_DEBUG_BEGIN 00670 #endif 00671 /* Do some basic checks. */ 00672 if (imagedef_reactor == NULL) 00673 { 00674 fprintf (stderr, 00675 (_("Error in %s () a NULL pointer was passed.\n")), 00676 __FUNCTION__); 00677 return (NULL); 00678 } 00679 if (dictionary_owner_hard == NULL) 00680 { 00681 fprintf (stderr, 00682 (_("Error in %s () a NULL pointer was passed.\n")), 00683 __FUNCTION__); 00684 return (NULL); 00685 } 00686 imagedef_reactor->dictionary_owner_hard = strdup (dictionary_owner_hard); 00687 #if DEBUG 00688 DXF_DEBUG_END 00689 #endif 00690 return (imagedef_reactor); 00691 } 00692 00693 00700 int32_t 00701 dxf_imagedef_reactor_get_class_version 00702 ( 00703 DxfImagedefReactor *imagedef_reactor 00705 ) 00706 { 00707 #if DEBUG 00708 DXF_DEBUG_BEGIN 00709 #endif 00710 /* Do some basic checks. */ 00711 if (imagedef_reactor == NULL) 00712 { 00713 fprintf (stderr, 00714 (_("Error in %s () a NULL pointer was passed.\n")), 00715 __FUNCTION__); 00716 return (EXIT_FAILURE); 00717 } 00718 if (imagedef_reactor->class_version < 0) 00719 { 00720 fprintf (stderr, 00721 (_("Error in %s () a negative value was found in the class_version member.\n")), 00722 __FUNCTION__); 00723 return (EXIT_FAILURE); 00724 } 00725 if (imagedef_reactor->class_version > 0) 00726 { 00727 fprintf (stderr, 00728 (_("Error in %s () an out of range value was found in the class_version member.\n")), 00729 __FUNCTION__); 00730 return (EXIT_FAILURE); 00731 } 00732 #if DEBUG 00733 DXF_DEBUG_END 00734 #endif 00735 return (imagedef_reactor->class_version); 00736 } 00737 00738 00745 DxfImagedefReactor * 00746 dxf_imagedef_reactor_set_class_version 00747 ( 00748 DxfImagedefReactor *imagedef_reactor, 00750 int32_t class_version 00752 ) 00753 { 00754 #if DEBUG 00755 DXF_DEBUG_BEGIN 00756 #endif 00757 /* Do some basic checks. */ 00758 if (imagedef_reactor == NULL) 00759 { 00760 fprintf (stderr, 00761 (_("Error in %s () a NULL pointer was passed.\n")), 00762 __FUNCTION__); 00763 return (NULL); 00764 } 00765 if (class_version < 0) 00766 { 00767 fprintf (stderr, 00768 (_("Error in %s () a negative class_version value was passed.\n")), 00769 __FUNCTION__); 00770 return (NULL); 00771 } 00772 if (class_version > 0) 00773 { 00774 fprintf (stderr, 00775 (_("Error in %s () an out of range class_version value was passed.\n")), 00776 __FUNCTION__); 00777 return (NULL); 00778 } 00779 imagedef_reactor->class_version = class_version; 00780 #if DEBUG 00781 DXF_DEBUG_END 00782 #endif 00783 return (imagedef_reactor); 00784 } 00785 00786 00796 char * 00797 dxf_imagedef_reactor_get_associated_image_object 00798 ( 00799 DxfImagedefReactor *imagedef_reactor 00801 ) 00802 { 00803 #if DEBUG 00804 DXF_DEBUG_BEGIN 00805 #endif 00806 /* Do some basic checks. */ 00807 if (imagedef_reactor == NULL) 00808 { 00809 fprintf (stderr, 00810 (_("Error in %s () a NULL pointer was passed.\n")), 00811 __FUNCTION__); 00812 return (NULL); 00813 } 00814 if (imagedef_reactor->associated_image_object == NULL) 00815 { 00816 fprintf (stderr, 00817 (_("Error in %s () a NULL pointer was found in the associated_image_object member.\n")), 00818 __FUNCTION__); 00819 return (NULL); 00820 } 00821 #if DEBUG 00822 DXF_DEBUG_END 00823 #endif 00824 return (strdup (imagedef_reactor->associated_image_object)); 00825 } 00826 00827 00835 DxfImagedefReactor * 00836 dxf_imagedef_reactor_set_associated_image_object 00837 ( 00838 DxfImagedefReactor *imagedef_reactor, 00840 char *associated_image_object 00843 ) 00844 { 00845 #if DEBUG 00846 DXF_DEBUG_BEGIN 00847 #endif 00848 /* Do some basic checks. */ 00849 if (imagedef_reactor == NULL) 00850 { 00851 fprintf (stderr, 00852 (_("Error in %s () a NULL pointer was passed.\n")), 00853 __FUNCTION__); 00854 return (NULL); 00855 } 00856 if (associated_image_object == NULL) 00857 { 00858 fprintf (stderr, 00859 (_("Error in %s () a NULL pointer was passed.\n")), 00860 __FUNCTION__); 00861 return (NULL); 00862 } 00863 imagedef_reactor->associated_image_object = strdup (associated_image_object); 00864 #if DEBUG 00865 DXF_DEBUG_END 00866 #endif 00867 return (imagedef_reactor); 00868 } 00869 00870 00878 int 00879 dxf_imagedef_reactor_get_associated_image_object_length 00880 ( 00881 DxfImagedefReactor *imagedef_reactor 00883 ) 00884 { 00885 #if DEBUG 00886 DXF_DEBUG_BEGIN 00887 #endif 00888 /* Do some basic checks. */ 00889 if (imagedef_reactor == NULL) 00890 { 00891 fprintf (stderr, 00892 (_("Error in %s () a NULL pointer was passed.\n")), 00893 __FUNCTION__); 00894 return (EXIT_FAILURE); 00895 } 00896 if (imagedef_reactor->associated_image_object_length < 0) 00897 { 00898 fprintf (stderr, 00899 (_("Error in %s () a negative value was found in the associated_image_object_length member.\n")), 00900 __FUNCTION__); 00901 return (EXIT_FAILURE); 00902 } 00903 #if DEBUG 00904 DXF_DEBUG_END 00905 #endif 00906 return (imagedef_reactor->associated_image_object_length); 00907 } 00908 00909 00916 DxfImagedefReactor * 00917 dxf_imagedef_reactor_set_associated_image_object_length 00918 ( 00919 DxfImagedefReactor *imagedef_reactor, 00921 int associated_image_object_length 00924 ) 00925 { 00926 #if DEBUG 00927 DXF_DEBUG_BEGIN 00928 #endif 00929 /* Do some basic checks. */ 00930 if (imagedef_reactor == NULL) 00931 { 00932 fprintf (stderr, 00933 (_("Error in %s () a NULL pointer was passed.\n")), 00934 __FUNCTION__); 00935 return (NULL); 00936 } 00937 if (associated_image_object_length < 0) 00938 { 00939 fprintf (stderr, 00940 (_("Error in %s () a negative associated_image_object_length value was passed.\n")), 00941 __FUNCTION__); 00942 return (NULL); 00943 } 00944 imagedef_reactor->associated_image_object_length = associated_image_object_length; 00945 #if DEBUG 00946 DXF_DEBUG_END 00947 #endif 00948 return (imagedef_reactor); 00949 } 00950 00951 00960 DxfImagedefReactor * 00961 dxf_imagedef_reactor_get_next 00962 ( 00963 DxfImagedefReactor *imagedef_reactor 00965 ) 00966 { 00967 #if DEBUG 00968 DXF_DEBUG_BEGIN 00969 #endif 00970 /* Do some basic checks. */ 00971 if (imagedef_reactor == NULL) 00972 { 00973 fprintf (stderr, 00974 (_("Error in %s () a NULL pointer was passed.\n")), 00975 __FUNCTION__); 00976 return (NULL); 00977 } 00978 if (imagedef_reactor->next == NULL) 00979 { 00980 fprintf (stderr, 00981 (_("Error in %s () a NULL pointer was found in the next member.\n")), 00982 __FUNCTION__); 00983 return (NULL); 00984 } 00985 #if DEBUG 00986 DXF_DEBUG_END 00987 #endif 00988 return ((DxfImagedefReactor *) imagedef_reactor->next); 00989 } 00990 00991 00996 DxfImagedefReactor * 00997 dxf_imagedef_reactor_set_next 00998 ( 00999 DxfImagedefReactor *imagedef_reactor, 01001 DxfImagedefReactor *next 01004 ) 01005 { 01006 #if DEBUG 01007 DXF_DEBUG_BEGIN 01008 #endif 01009 /* Do some basic checks. */ 01010 if (imagedef_reactor == NULL) 01011 { 01012 fprintf (stderr, 01013 (_("Error in %s () a NULL pointer was passed.\n")), 01014 __FUNCTION__); 01015 return (NULL); 01016 } 01017 if (next == NULL) 01018 { 01019 fprintf (stderr, 01020 (_("Error in %s () a NULL pointer was passed.\n")), 01021 __FUNCTION__); 01022 return (NULL); 01023 } 01024 imagedef_reactor->next = (struct DxfImagedefReactor *) next; 01025 #if DEBUG 01026 DXF_DEBUG_END 01027 #endif 01028 return (imagedef_reactor); 01029 } 01030 01031 01040 DxfImagedefReactor * 01041 dxf_imagedef_reactor_get_last 01042 ( 01043 DxfImagedefReactor *imagedef_reactor 01045 ) 01046 { 01047 #if DEBUG 01048 DXF_DEBUG_BEGIN 01049 #endif 01050 /* Do some basic checks. */ 01051 if (imagedef_reactor == NULL) 01052 { 01053 fprintf (stderr, 01054 (_("Error in %s () a NULL pointer was passed.\n")), 01055 __FUNCTION__); 01056 return (NULL); 01057 } 01058 if (imagedef_reactor->next == NULL) 01059 { 01060 fprintf (stderr, 01061 (_("Warning in %s () a NULL pointer was found in the next member.\n")), 01062 __FUNCTION__); 01063 return ((DxfImagedefReactor *) imagedef_reactor); 01064 } 01065 DxfImagedefReactor *iter = (DxfImagedefReactor *) imagedef_reactor->next; 01066 while (iter->next != NULL) 01067 { 01068 iter = (DxfImagedefReactor *) iter->next; 01069 } 01070 #if DEBUG 01071 DXF_DEBUG_END 01072 #endif 01073 return ((DxfImagedefReactor *) iter); 01074 } 01075 01076 01077 /* EOF*/