libDXF 0.0.1
A library with DXF related functions written in C.
|
00001 00042 #include "ltype.h" 00043 00044 00050 DxfLType * 00051 dxf_ltype_new () 00052 { 00053 #if DEBUG 00054 DXF_DEBUG_BEGIN 00055 #endif 00056 DxfLType *ltype = NULL; 00057 size_t size; 00058 00059 size = sizeof (DxfLType); 00060 /* avoid malloc of 0 bytes */ 00061 if (size == 0) size = 1; 00062 if ((ltype = malloc (size)) == NULL) 00063 { 00064 fprintf (stderr, 00065 (_("Error in %s () could not allocate memory for a DxfArc struct.\n")), 00066 __FUNCTION__); 00067 ltype = NULL; 00068 } 00069 else 00070 { 00071 memset (ltype, 0, size); 00072 } 00073 #if DEBUG 00074 DXF_DEBUG_END 00075 #endif 00076 return (ltype); 00077 } 00078 00079 00087 DxfLType * 00088 dxf_ltype_init 00089 ( 00090 DxfLType *ltype 00092 ) 00093 { 00094 #if DEBUG 00095 DXF_DEBUG_BEGIN 00096 #endif 00097 int i; 00098 00099 /* Do some basic checks. */ 00100 if (ltype == NULL) 00101 { 00102 fprintf (stderr, 00103 (_("Warning in %s () a NULL pointer was passed.\n")), 00104 __FUNCTION__); 00105 ltype = dxf_ltype_new (); 00106 } 00107 if (ltype == NULL) 00108 { 00109 fprintf (stderr, 00110 (_("Error in %s () could not allocate memory for a DxfLType struct.\n")), 00111 __FUNCTION__); 00112 return (NULL); 00113 } 00114 dxf_ltype_set_id_code (ltype, 0); 00115 dxf_ltype_set_linetype_name (ltype, strdup ("")); 00116 dxf_ltype_set_description (ltype, strdup ("")); 00117 dxf_ltype_set_total_pattern_length (ltype, 0.0); 00118 dxf_ltype_set_number_of_linetype_elements (ltype, 0); 00119 for ((i = 0); (i <= DXF_MAX_NUMBER_OF_DASH_LENGTH_ITEMS); i++) 00120 { 00121 dxf_ltype_set_complex_text_string (ltype, i, strdup ("")); 00122 dxf_ltype_set_complex_x_offset (ltype, i, 0.0); 00123 dxf_ltype_set_complex_y_offset (ltype, i, 0.0); 00124 dxf_ltype_set_complex_scale (ltype, i, 0.0); 00125 dxf_ltype_set_dash_length (ltype, i, 0.0); 00126 dxf_ltype_set_complex_rotation (ltype, i, 0.0); 00127 dxf_ltype_set_complex_element (ltype, i, 1); 00128 dxf_ltype_set_complex_shape_number (ltype, i, 0); 00129 dxf_ltype_set_complex_style_pointer (ltype, i, strdup ("")); 00130 } 00131 dxf_ltype_set_flag (ltype, 0); 00132 dxf_ltype_set_alignment (ltype, 65); 00133 dxf_ltype_set_dictionary_owner_soft (ltype, strdup ("")); 00134 dxf_ltype_set_dictionary_owner_hard (ltype, strdup ("")); 00135 #if DEBUG 00136 DXF_DEBUG_END 00137 #endif 00138 return (ltype); 00139 } 00140 00141 00153 DxfLType * 00154 dxf_ltype_read 00155 ( 00156 DxfFile *fp, 00158 DxfLType *ltype 00160 ) 00161 { 00162 #if DEBUG 00163 DXF_DEBUG_BEGIN 00164 #endif 00165 char *temp_string = NULL; 00166 int element; 00167 00168 /* Do some basic checks. */ 00169 if (fp == NULL) 00170 { 00171 fprintf (stderr, 00172 (_("Error in %s () a NULL file pointer was passed.\n")), 00173 __FUNCTION__); 00174 /* Clean up. */ 00175 free (temp_string); 00176 return (NULL); 00177 } 00178 if (ltype == NULL) 00179 { 00180 fprintf (stderr, 00181 (_("Warning in %s () a NULL pointer was passed.\n")), 00182 __FUNCTION__); 00183 ltype = dxf_ltype_new (); 00184 ltype = dxf_ltype_init (ltype); 00185 } 00186 element = 0; 00187 (fp->line_number)++; 00188 fscanf (fp->fp, "%[^\n]", temp_string); 00189 while (strcmp (temp_string, "0") != 0) 00190 { 00191 if (ferror (fp->fp)) 00192 { 00193 fprintf (stderr, 00194 (_("Error in %s () while reading from: %s in line: %d.\n")), 00195 __FUNCTION__, fp->filename, fp->line_number); 00196 fclose (fp->fp); 00197 /* Clean up. */ 00198 free (temp_string); 00199 return (NULL); 00200 } 00201 if (strcmp (temp_string, "5") == 0) 00202 { 00203 /* Now follows a string containing a sequential 00204 * id number. */ 00205 (fp->line_number)++; 00206 fscanf (fp->fp, "%x\n", <ype->id_code); 00207 } 00208 else if (strcmp (temp_string, "2") == 0) 00209 { 00210 /* Now follows a string containing a linetype 00211 * name. */ 00212 (fp->line_number)++; 00213 fscanf (fp->fp, "%s\n", ltype->linetype_name); 00214 } 00215 else if (strcmp (temp_string, "3") == 0) 00216 { 00217 /* Now follows a string containing a description. */ 00218 (fp->line_number)++; 00219 fscanf (fp->fp, "%s\n", ltype->description); 00220 } 00221 else if (strcmp (temp_string, "9") == 0) 00222 { 00223 /* Now follows a string containing a complex 00224 * text string (multiple entries possible). */ 00225 (fp->line_number)++; 00226 fscanf (fp->fp, "%s\n", ltype->complex_text_string[element]); 00227 } 00228 else if (strcmp (temp_string, "40") == 0) 00229 { 00230 /* Now follows a string containing the total 00231 * pattern length value. */ 00232 (fp->line_number)++; 00233 fscanf (fp->fp, "%lf\n", <ype->total_pattern_length); 00234 } 00235 else if (strcmp (temp_string, "44") == 0) 00236 { 00237 /* Now follows a string containing a complex 00238 * x offset value (multiple entries possible). */ 00239 (fp->line_number)++; 00240 fscanf (fp->fp, "%lf\n", <ype->complex_x_offset[element]); 00241 } 00242 else if (strcmp (temp_string, "45") == 0) 00243 { 00244 /* Now follows a string containing a complex 00245 * y offset value (multiple entries possible). */ 00246 (fp->line_number)++; 00247 fscanf (fp->fp, "%lf\n", <ype->complex_y_offset[element]); 00248 } 00249 else if (strcmp (temp_string, "46") == 0) 00250 { 00251 /* Now follows a string containing a complex 00252 * scale value (multiple entries possible). */ 00253 (fp->line_number)++; 00254 fscanf (fp->fp, "%lf\n", <ype->complex_scale[element]); 00255 } 00256 else if (strcmp (temp_string, "49") == 0) 00257 { 00258 /* Now follows a string containing a dash length 00259 * value (multiple entries possible). */ 00260 (fp->line_number)++; 00261 fscanf (fp->fp, "%lf\n", <ype->dash_length[element]); 00262 element++; 00270 } 00271 else if (strcmp (temp_string, "50") == 0) 00272 { 00273 /* Now follows a string containing a complex 00274 * rotation value (multiple entries possible). */ 00275 (fp->line_number)++; 00276 fscanf (fp->fp, "%lf\n", <ype->complex_rotation[element]); 00277 } 00278 else if (strcmp (temp_string, "70") == 0) 00279 { 00280 /* Now follows a string containing the 00281 * standard flag value. */ 00282 (fp->line_number)++; 00283 fscanf (fp->fp, "%d\n", <ype->flag); 00284 } 00285 else if (strcmp (temp_string, "72") == 0) 00286 { 00287 /* Now follows a string containing the 00288 * alignment value. */ 00289 (fp->line_number)++; 00290 fscanf (fp->fp, "%d\n", <ype->alignment); 00291 } 00292 else if (strcmp (temp_string, "73") == 0) 00293 { 00294 /* Now follows a string containing the number of 00295 * dash length items value. */ 00296 (fp->line_number)++; 00297 fscanf (fp->fp, "%d\n", <ype->number_of_linetype_elements); 00298 } 00299 else if (strcmp (temp_string, "74") == 0) 00300 { 00301 /* Now follows a string containing a complex 00302 * element value (multiple entries possible). */ 00303 (fp->line_number)++; 00304 fscanf (fp->fp, "%d\n", <ype->complex_element[element]); 00305 } 00306 else if (strcmp (temp_string, "75") == 0) 00307 { 00308 /* Now follows a string containing a complex 00309 * element value (multiple entries possible). */ 00310 (fp->line_number)++; 00311 fscanf (fp->fp, "%d\n", <ype->complex_shape_number[element]); 00312 } 00313 else if (strcmp (temp_string, "330") == 0) 00314 { 00315 /* Now follows a string containing Soft-pointer 00316 * ID/handle to owner dictionary. */ 00317 (fp->line_number)++; 00318 fscanf (fp->fp, "%s\n", ltype->dictionary_owner_soft); 00319 } 00320 else if (strcmp (temp_string, "340") == 0) 00321 { 00322 /* Now follows a string containing a complex 00323 * style pointer string (multiple entries possible). */ 00324 (fp->line_number)++; 00325 fscanf (fp->fp, "%s\n", ltype->complex_style_pointer[element]); 00326 } 00327 else if (strcmp (temp_string, "360") == 0) 00328 { 00329 /* Now follows a string containing Hard owner 00330 * ID/handle to owner dictionary. */ 00331 (fp->line_number)++; 00332 fscanf (fp->fp, "%s\n", ltype->dictionary_owner_hard); 00333 } 00334 else if (strcmp (temp_string, "999") == 0) 00335 { 00336 /* Now follows a string containing a comment. */ 00337 (fp->line_number)++; 00338 fscanf (fp->fp, "%s\n", temp_string); 00339 fprintf (stdout, "DXF comment: %s\n", temp_string); 00340 } 00341 else 00342 { 00343 fprintf (stderr, 00344 (_("Warning in %s () unknown string tag found while reading from: %s in line: %d.\n")), 00345 __FUNCTION__, fp->filename, fp->line_number); 00346 } 00347 } 00348 /* Handle omitted members and/or illegal values. */ 00349 if (strcmp (ltype->linetype_name, "") == 0) 00350 { 00351 fprintf (stderr, 00352 (_("Error in %s (): empty linetype name string for the entity with id-code: %x\n")), 00353 __FUNCTION__, ltype->id_code); 00354 fprintf (stderr, 00355 (_("\tentity is discarded from output.\n"))); 00356 return (NULL); 00357 } 00358 if (ltype->alignment != 65) 00359 { 00360 ltype->alignment = 65; 00361 } 00362 /* Clean up. */ 00363 free (temp_string); 00364 #if DEBUG 00365 DXF_DEBUG_END 00366 #endif 00367 return (ltype); 00368 } 00369 00370 00377 int 00378 dxf_ltype_write 00379 ( 00380 DxfFile *fp, 00382 DxfLType *ltype 00384 ) 00385 { 00386 #if DEBUG 00387 DXF_DEBUG_BEGIN 00388 #endif 00389 char *dxf_entity_name = strdup ("LTYPE"); 00390 int i; 00391 00392 /* Do some basic checks. */ 00393 if (fp == NULL) 00394 { 00395 fprintf (stderr, 00396 (_("Error in %s () a NULL file pointer was passed.\n")), 00397 __FUNCTION__); 00398 /* Clean up. */ 00399 free (dxf_entity_name); 00400 return (EXIT_FAILURE); 00401 } 00402 if (ltype == NULL) 00403 { 00404 fprintf (stderr, 00405 (_("Error in %s () a NULL pointer was passed.\n")), 00406 __FUNCTION__); 00407 /* Clean up. */ 00408 free (dxf_entity_name); 00409 return (EXIT_FAILURE); 00410 } 00411 if (strcmp (ltype->linetype_name, "") == 0) 00412 { 00413 fprintf (stderr, 00414 (_("Warning in %s (): empty linetype name string for the %s entity with id-code: %x\n")), 00415 __FUNCTION__, dxf_entity_name, dxf_ltype_get_id_code (ltype)); 00416 fprintf (stderr, 00417 (_("\t%s entity is discarded from output.\n")), 00418 dxf_entity_name); 00419 /* Clean up. */ 00420 free (dxf_entity_name); 00421 return (EXIT_FAILURE); 00422 } 00423 /* Start writing output. */ 00424 fprintf (fp->fp, " 0\n%s\n", dxf_entity_name); 00425 if (dxf_ltype_get_id_code (ltype) != -1) 00426 { 00427 fprintf (fp->fp, " 5\n%x\n", dxf_ltype_get_id_code (ltype)); 00428 } 00439 if ((strcmp (dxf_ltype_get_dictionary_owner_soft (ltype), "") != 0) 00440 && (fp->acad_version_number >= AutoCAD_14)) 00441 { 00442 fprintf (fp->fp, "102\n{ACAD_REACTORS\n"); 00443 fprintf (fp->fp, "330\n%s\n", dxf_ltype_get_dictionary_owner_soft (ltype)); 00444 fprintf (fp->fp, "102\n}\n"); 00445 } 00446 if ((strcmp (dxf_ltype_get_dictionary_owner_hard (ltype), "") != 0) 00447 && (fp->acad_version_number >= AutoCAD_14)) 00448 { 00449 fprintf (fp->fp, "102\n{ACAD_XDICTIONARY\n"); 00450 fprintf (fp->fp, "360\n%s\n", dxf_ltype_get_dictionary_owner_hard (ltype)); 00451 fprintf (fp->fp, "102\n}\n"); 00452 } 00453 if (fp->acad_version_number >= AutoCAD_14) 00454 { 00455 fprintf (fp->fp, "100\nAcDbSymbolTableRecord\n"); 00456 fprintf (fp->fp, "100\nAcDbLinetypeTableRecord\n"); 00457 } 00458 fprintf (fp->fp, " 2\n%s\n", dxf_ltype_get_linetype_name (ltype)); 00459 fprintf (fp->fp, " 70\n%d\n", dxf_ltype_get_flag (ltype)); 00460 if (ltype->description) 00461 { 00462 fprintf (fp->fp, " 3\n%s\n", dxf_ltype_get_description (ltype)); 00463 } 00464 else 00465 { 00466 fprintf (fp->fp, " 3\n\n"); 00467 } 00468 fprintf (fp->fp, " 72\n%d\n", dxf_ltype_get_alignment (ltype)); 00469 fprintf (fp->fp, " 73\n%d\n", dxf_ltype_get_number_of_linetype_elements (ltype)); 00470 fprintf (fp->fp, " 40\n%f\n", dxf_ltype_get_total_pattern_length (ltype)); 00471 for ((i = 0); (i < dxf_ltype_get_number_of_linetype_elements (ltype)); i++) 00472 { 00473 fprintf (fp->fp, " 49\n%f\n", dxf_ltype_get_dash_length (ltype, i)); 00474 fprintf (fp->fp, " 74\n%d\n", dxf_ltype_get_complex_element (ltype, i)); 00475 switch (dxf_ltype_get_complex_element (ltype, i)) 00476 { 00477 case 0: 00478 /* No embedded shape/text. */ 00479 fprintf (fp->fp, " 44\n%f\n", dxf_ltype_get_complex_x_offset (ltype, i)); 00480 fprintf (fp->fp, " 45\n%f\n", dxf_ltype_get_complex_y_offset (ltype, i)); 00481 fprintf (fp->fp, " 46\n%f\n", dxf_ltype_get_complex_scale (ltype, i)); 00482 fprintf (fp->fp, " 75\n0\n"); 00483 break; 00484 case 1: 00485 /* Specify an absolute rotation. */ 00486 fprintf (fp->fp, " 44\n%f\n", dxf_ltype_get_complex_x_offset (ltype, i)); 00487 fprintf (fp->fp, " 45\n%f\n", dxf_ltype_get_complex_y_offset (ltype, i)); 00488 fprintf (fp->fp, " 46\n%f\n", dxf_ltype_get_complex_scale (ltype, i)); 00489 fprintf (fp->fp, " 75\n0\n"); 00490 fprintf (fp->fp, "340\n%s\n", dxf_ltype_get_complex_style_pointer (ltype, i)); 00491 break; 00492 case 2: 00493 /* 00494 * The complex is a text string. 00495 * Use a relative rotation angle. 00496 */ 00497 fprintf (fp->fp, " 9\n%s\n", dxf_ltype_get_complex_text_string (ltype, i)); 00498 fprintf (fp->fp, " 44\n%f\n", dxf_ltype_get_complex_x_offset (ltype, i)); 00499 fprintf (fp->fp, " 45\n%f\n", dxf_ltype_get_complex_y_offset (ltype, i)); 00500 fprintf (fp->fp, " 46\n%f\n", dxf_ltype_get_complex_scale (ltype, i)); 00501 fprintf (fp->fp, " 50\n%f\n", dxf_ltype_get_complex_rotation (ltype, i)); 00502 fprintf (fp->fp, " 75\n0\n"); 00503 fprintf (fp->fp, "340\n%s\n", dxf_ltype_get_complex_style_pointer (ltype, i)); 00504 break; 00505 case 3: 00506 /* 00507 * The complex is a text string. 00508 * Use an absolute rotation angle. 00509 */ 00510 fprintf (fp->fp, " 9\n%s\n", dxf_ltype_get_complex_text_string (ltype, i)); 00511 fprintf (fp->fp, " 44\n%f\n", dxf_ltype_get_complex_x_offset (ltype, i)); 00512 fprintf (fp->fp, " 45\n%f\n", dxf_ltype_get_complex_y_offset (ltype, i)); 00513 fprintf (fp->fp, " 46\n%f\n", dxf_ltype_get_complex_scale (ltype, i)); 00514 fprintf (fp->fp, " 50\n%f\n", dxf_ltype_get_complex_rotation (ltype, i)); 00515 fprintf (fp->fp, " 75\n0\n"); 00516 fprintf (fp->fp, "340\n%s\n", dxf_ltype_get_complex_style_pointer (ltype, i)); 00517 break; 00518 case 4: 00519 /* 00520 * The complex is a shape. 00521 * Use a relative rotation angle. 00522 */ 00523 fprintf (fp->fp, " 44\n%f\n", dxf_ltype_get_complex_x_offset (ltype, i)); 00524 fprintf (fp->fp, " 45\n%f\n", dxf_ltype_get_complex_y_offset (ltype, i)); 00525 fprintf (fp->fp, " 46\n%f\n", dxf_ltype_get_complex_scale (ltype, i)); 00526 fprintf (fp->fp, " 50\n%f\n", dxf_ltype_get_complex_rotation (ltype, i)); 00527 fprintf (fp->fp, " 75\n%d\n", dxf_ltype_get_complex_shape_number (ltype, i)); 00528 fprintf (fp->fp, "340\n%s\n", dxf_ltype_get_complex_style_pointer (ltype, i)); 00529 break; 00530 case 5: 00531 /* 00532 * The complex is a shape. 00533 * Use an absolute rotation angle. 00534 */ 00535 fprintf (fp->fp, " 44\n%f\n", dxf_ltype_get_complex_x_offset (ltype, i)); 00536 fprintf (fp->fp, " 45\n%f\n", dxf_ltype_get_complex_y_offset (ltype, i)); 00537 fprintf (fp->fp, " 46\n%f\n", dxf_ltype_get_complex_scale (ltype, i)); 00538 fprintf (fp->fp, " 50\n%f\n", dxf_ltype_get_complex_rotation (ltype, i)); 00539 fprintf (fp->fp, " 75\n%d\n", dxf_ltype_get_complex_shape_number (ltype, i)); 00540 fprintf (fp->fp, "340\n%s\n", dxf_ltype_get_complex_style_pointer (ltype, i)); 00541 break; 00542 default: 00543 fprintf (stderr, 00544 (_("Warning in %s (): unknown complex element code for the %s entity with id-code: %x\n")), 00545 __FUNCTION__, dxf_entity_name, dxf_ltype_get_id_code (ltype)); 00546 break; 00547 } 00548 } 00549 /* Clean up. */ 00550 free (dxf_entity_name); 00551 #if DEBUG 00552 DXF_DEBUG_END 00553 #endif 00554 return (EXIT_SUCCESS); 00555 } 00556 00557 00565 int 00566 dxf_ltype_free 00567 ( 00568 DxfLType *ltype 00571 ) 00572 { 00573 #if DEBUG 00574 DXF_DEBUG_BEGIN 00575 #endif 00576 int i; 00577 00578 /* Do some basic checks. */ 00579 if (ltype == NULL) 00580 { 00581 fprintf (stderr, 00582 (_("Error in %s () a NULL pointer was passed.\n")), 00583 __FUNCTION__); 00584 return (EXIT_FAILURE); 00585 } 00586 if (ltype->next != NULL) 00587 { 00588 fprintf (stderr, 00589 (_("Error in %s () pointer to next was not NULL.\n")), 00590 __FUNCTION__); 00591 return (EXIT_FAILURE); 00592 } 00593 free (dxf_ltype_get_linetype_name (ltype)); 00594 free (dxf_ltype_get_description (ltype)); 00595 for ((i = 0); (i <= DXF_MAX_NUMBER_OF_DASH_LENGTH_ITEMS); i++) 00596 { 00597 free (dxf_ltype_get_complex_text_string (ltype, i)); 00598 free (dxf_ltype_get_complex_style_pointer (ltype, i)); 00599 } 00600 free (dxf_ltype_get_dictionary_owner_soft (ltype)); 00601 free (dxf_ltype_get_dictionary_owner_hard (ltype)); 00602 free (ltype); 00603 ltype = NULL; 00604 #if DEBUG 00605 DXF_DEBUG_END 00606 #endif 00607 return (EXIT_SUCCESS); 00608 } 00609 00610 00615 void 00616 dxf_ltype_free_chain 00617 ( 00618 DxfLType *ltypes 00621 ) 00622 { 00623 #ifdef DEBUG 00624 DXF_DEBUG_BEGIN 00625 #endif 00626 if (ltypes == NULL) 00627 { 00628 fprintf (stderr, 00629 (_("Warning in %s () a NULL pointer was passed.\n")), 00630 __FUNCTION__); 00631 } 00632 while (ltypes != NULL) 00633 { 00634 struct DxfLType *iter = ltypes->next; 00635 dxf_ltype_free (ltypes); 00636 ltypes = (DxfLType *) iter; 00637 } 00638 #if DEBUG 00639 DXF_DEBUG_END 00640 #endif 00641 } 00642 00643 00649 int 00650 dxf_ltype_get_id_code 00651 ( 00652 DxfLType *ltype 00654 ) 00655 { 00656 #if DEBUG 00657 DXF_DEBUG_BEGIN 00658 #endif 00659 /* Do some basic checks. */ 00660 if (ltype == NULL) 00661 { 00662 fprintf (stderr, 00663 (_("Error in %s () a NULL pointer was passed.\n")), 00664 __FUNCTION__); 00665 return (EXIT_FAILURE); 00666 } 00667 if (ltype->id_code < 0) 00668 { 00669 fprintf (stderr, 00670 (_("Error in %s () a negative value was found.\n")), 00671 __FUNCTION__); 00672 return (EXIT_FAILURE); 00673 } 00674 #if DEBUG 00675 DXF_DEBUG_END 00676 #endif 00677 return (ltype->id_code); 00678 } 00679 00680 00684 DxfLType * 00685 dxf_ltype_set_id_code 00686 ( 00687 DxfLType *ltype, 00689 int id_code 00693 ) 00694 { 00695 #if DEBUG 00696 DXF_DEBUG_BEGIN 00697 #endif 00698 /* Do some basic checks. */ 00699 if (ltype == NULL) 00700 { 00701 fprintf (stderr, 00702 (_("Error in %s () a NULL pointer was passed.\n")), 00703 __FUNCTION__); 00704 return (NULL); 00705 } 00706 if (id_code < 0) 00707 { 00708 fprintf (stderr, 00709 (_("Error in %s () a negative value was passed.\n")), 00710 __FUNCTION__); 00711 return (NULL); 00712 } 00713 ltype->id_code = id_code; 00714 #if DEBUG 00715 DXF_DEBUG_END 00716 #endif 00717 return (ltype); 00718 } 00719 00720 00727 char * 00728 dxf_ltype_get_linetype_name 00729 ( 00730 DxfLType *ltype 00732 ) 00733 { 00734 #if DEBUG 00735 DXF_DEBUG_BEGIN 00736 #endif 00737 /* Do some basic checks. */ 00738 if (ltype == NULL) 00739 { 00740 fprintf (stderr, 00741 (_("Error in %s () a NULL pointer was passed.\n")), 00742 __FUNCTION__); 00743 return (NULL); 00744 } 00745 if (ltype->linetype_name == NULL) 00746 { 00747 fprintf (stderr, 00748 (_("Error in %s () a NULL pointer was found.\n")), 00749 __FUNCTION__); 00750 return (NULL); 00751 } 00752 #if DEBUG 00753 DXF_DEBUG_END 00754 #endif 00755 return (strdup (ltype->linetype_name)); 00756 } 00757 00758 00762 DxfLType * 00763 dxf_ltype_set_linetype_name 00764 ( 00765 DxfLType *ltype, 00767 char *linetype_name 00770 ) 00771 { 00772 #if DEBUG 00773 DXF_DEBUG_BEGIN 00774 #endif 00775 /* Do some basic checks. */ 00776 if (ltype == NULL) 00777 { 00778 fprintf (stderr, 00779 (_("Error in %s () a NULL pointer was passed.\n")), 00780 __FUNCTION__); 00781 return (NULL); 00782 } 00783 if (linetype_name == NULL) 00784 { 00785 fprintf (stderr, 00786 (_("Error in %s () a NULL pointer was passed.\n")), 00787 __FUNCTION__); 00788 return (NULL); 00789 } 00790 ltype->linetype_name = strdup (linetype_name); 00791 #if DEBUG 00792 DXF_DEBUG_END 00793 #endif 00794 return (ltype); 00795 } 00796 00797 00804 char * 00805 dxf_ltype_get_description 00806 ( 00807 DxfLType *ltype 00809 ) 00810 { 00811 #if DEBUG 00812 DXF_DEBUG_BEGIN 00813 #endif 00814 /* Do some basic checks. */ 00815 if (ltype == NULL) 00816 { 00817 fprintf (stderr, 00818 (_("Error in %s () a NULL pointer was passed.\n")), 00819 __FUNCTION__); 00820 return (NULL); 00821 } 00822 if (ltype->description == NULL) 00823 { 00824 fprintf (stderr, 00825 (_("Error in %s () a NULL pointer was found.\n")), 00826 __FUNCTION__); 00827 return (NULL); 00828 } 00829 #if DEBUG 00830 DXF_DEBUG_END 00831 #endif 00832 return (strdup (ltype->description)); 00833 } 00834 00835 00839 DxfLType * 00840 dxf_ltype_set_description 00841 ( 00842 DxfLType *ltype, 00844 char *description 00847 ) 00848 { 00849 #if DEBUG 00850 DXF_DEBUG_BEGIN 00851 #endif 00852 /* Do some basic checks. */ 00853 if (ltype == NULL) 00854 { 00855 fprintf (stderr, 00856 (_("Error in %s () a NULL pointer was passed.\n")), 00857 __FUNCTION__); 00858 return (NULL); 00859 } 00860 if (description == NULL) 00861 { 00862 fprintf (stderr, 00863 (_("Error in %s () a NULL pointer was passed.\n")), 00864 __FUNCTION__); 00865 return (NULL); 00866 } 00867 ltype->description = strdup (description); 00868 #if DEBUG 00869 DXF_DEBUG_END 00870 #endif 00871 return (ltype); 00872 } 00873 00874 00882 char * 00883 dxf_ltype_get_complex_text_string 00884 ( 00885 DxfLType *ltype, 00887 int i 00889 ) 00890 { 00891 #if DEBUG 00892 DXF_DEBUG_BEGIN 00893 #endif 00894 /* Do some basic checks. */ 00895 if (ltype == NULL) 00896 { 00897 fprintf (stderr, 00898 (_("Error in %s () a NULL pointer was passed.\n")), 00899 __FUNCTION__); 00900 return (NULL); 00901 } 00902 if (i < 0) 00903 { 00904 fprintf (stderr, 00905 (_("Error in %s () a negative index was passed.\n")), 00906 __FUNCTION__); 00907 return (NULL); 00908 } 00909 if (i > DXF_MAX_NUMBER_OF_DASH_LENGTH_ITEMS) 00910 { 00911 fprintf (stderr, 00912 (_("Error in %s () an out of range index was passed.\n")), 00913 __FUNCTION__); 00914 return (NULL); 00915 } 00916 if (ltype->complex_text_string[i] == NULL) 00917 { 00918 fprintf (stderr, 00919 (_("Error in %s () a NULL pointer was found.\n")), 00920 __FUNCTION__); 00921 return (NULL); 00922 } 00923 #if DEBUG 00924 DXF_DEBUG_END 00925 #endif 00926 return (strdup (ltype->complex_text_string[i])); 00927 } 00928 00929 00934 DxfLType * 00935 dxf_ltype_set_complex_text_string 00936 ( 00937 DxfLType *ltype, 00939 int i, 00941 char *complex_text_string 00944 ) 00945 { 00946 #if DEBUG 00947 DXF_DEBUG_BEGIN 00948 #endif 00949 /* Do some basic checks. */ 00950 if (ltype == NULL) 00951 { 00952 fprintf (stderr, 00953 (_("Error in %s () a NULL pointer was passed.\n")), 00954 __FUNCTION__); 00955 return (NULL); 00956 } 00957 if (i < 0) 00958 { 00959 fprintf (stderr, 00960 (_("Error in %s () a negative index was passed.\n")), 00961 __FUNCTION__); 00962 return (NULL); 00963 } 00964 if (i > DXF_MAX_NUMBER_OF_DASH_LENGTH_ITEMS) 00965 { 00966 fprintf (stderr, 00967 (_("Error in %s () an out of range index was passed.\n")), 00968 __FUNCTION__); 00969 return (NULL); 00970 } 00971 if (complex_text_string == NULL) 00972 { 00973 fprintf (stderr, 00974 (_("Error in %s () a NULL pointer was passed.\n")), 00975 __FUNCTION__); 00976 return (NULL); 00977 } 00978 ltype->complex_text_string[i] = strdup (complex_text_string); 00979 #if DEBUG 00980 DXF_DEBUG_END 00981 #endif 00982 return (ltype); 00983 } 00984 00985 00991 double 00992 dxf_ltype_get_total_pattern_length 00993 ( 00994 DxfLType *ltype 00996 ) 00997 { 00998 #if DEBUG 00999 DXF_DEBUG_BEGIN 01000 #endif 01001 /* Do some basic checks. */ 01002 if (ltype == NULL) 01003 { 01004 fprintf (stderr, 01005 (_("Error in %s () a NULL pointer was passed.\n")), 01006 __FUNCTION__); 01007 return (EXIT_FAILURE); 01008 } 01009 #if DEBUG 01010 DXF_DEBUG_END 01011 #endif 01012 return (ltype->total_pattern_length); 01013 } 01014 01015 01019 DxfLType * 01020 dxf_ltype_set_total_pattern_length 01021 ( 01022 DxfLType *ltype, 01024 double total_pattern_length 01027 ) 01028 { 01029 #if DEBUG 01030 DXF_DEBUG_BEGIN 01031 #endif 01032 /* Do some basic checks. */ 01033 if (ltype == NULL) 01034 { 01035 fprintf (stderr, 01036 (_("Error in %s () a NULL pointer was passed.\n")), 01037 __FUNCTION__); 01038 return (NULL); 01039 } 01040 ltype->total_pattern_length = total_pattern_length; 01041 #if DEBUG 01042 DXF_DEBUG_END 01043 #endif 01044 return (ltype); 01045 } 01046 01047 01054 double 01055 dxf_ltype_get_complex_x_offset 01056 ( 01057 DxfLType *ltype, 01059 int i 01061 ) 01062 { 01063 #if DEBUG 01064 DXF_DEBUG_BEGIN 01065 #endif 01066 /* Do some basic checks. */ 01067 if (ltype == NULL) 01068 { 01069 fprintf (stderr, 01070 (_("Error in %s () a NULL pointer was passed.\n")), 01071 __FUNCTION__); 01072 return (EXIT_FAILURE); 01073 } 01074 if (i < 0) 01075 { 01076 fprintf (stderr, 01077 (_("Error in %s () a negative index was passed.\n")), 01078 __FUNCTION__); 01079 return (EXIT_FAILURE); 01080 } 01081 if (i > DXF_MAX_NUMBER_OF_DASH_LENGTH_ITEMS) 01082 { 01083 fprintf (stderr, 01084 (_("Error in %s () an out of range index was passed.\n")), 01085 __FUNCTION__); 01086 return (EXIT_FAILURE); 01087 } 01088 #if DEBUG 01089 DXF_DEBUG_END 01090 #endif 01091 return (ltype->complex_x_offset[i]); 01092 } 01093 01094 01099 DxfLType * 01100 dxf_ltype_set_complex_x_offset 01101 ( 01102 DxfLType *ltype, 01104 int i, 01106 double complex_x_offset 01109 ) 01110 { 01111 #if DEBUG 01112 DXF_DEBUG_BEGIN 01113 #endif 01114 /* Do some basic checks. */ 01115 if (ltype == NULL) 01116 { 01117 fprintf (stderr, 01118 (_("Error in %s () a NULL pointer was passed.\n")), 01119 __FUNCTION__); 01120 return (NULL); 01121 } 01122 if (i < 0) 01123 { 01124 fprintf (stderr, 01125 (_("Error in %s () a negative index was passed.\n")), 01126 __FUNCTION__); 01127 return (NULL); 01128 } 01129 if (i > DXF_MAX_NUMBER_OF_DASH_LENGTH_ITEMS) 01130 { 01131 fprintf (stderr, 01132 (_("Error in %s () an out of range index was passed.\n")), 01133 __FUNCTION__); 01134 return (NULL); 01135 } 01136 ltype->complex_x_offset[i] = complex_x_offset; 01137 #if DEBUG 01138 DXF_DEBUG_END 01139 #endif 01140 return (ltype); 01141 } 01142 01143 01150 double 01151 dxf_ltype_get_complex_y_offset 01152 ( 01153 DxfLType *ltype, 01155 int i 01157 ) 01158 { 01159 #if DEBUG 01160 DXF_DEBUG_BEGIN 01161 #endif 01162 /* Do some basic checks. */ 01163 if (ltype == NULL) 01164 { 01165 fprintf (stderr, 01166 (_("Error in %s () a NULL pointer was passed.\n")), 01167 __FUNCTION__); 01168 return (EXIT_FAILURE); 01169 } 01170 if (i < 0) 01171 { 01172 fprintf (stderr, 01173 (_("Error in %s () a negative index was passed.\n")), 01174 __FUNCTION__); 01175 return (EXIT_FAILURE); 01176 } 01177 if (i > DXF_MAX_NUMBER_OF_DASH_LENGTH_ITEMS) 01178 { 01179 fprintf (stderr, 01180 (_("Error in %s () an out of range index was passed.\n")), 01181 __FUNCTION__); 01182 return (EXIT_FAILURE); 01183 } 01184 #if DEBUG 01185 DXF_DEBUG_END 01186 #endif 01187 return (ltype->complex_y_offset[i]); 01188 } 01189 01190 01195 DxfLType * 01196 dxf_ltype_set_complex_y_offset 01197 ( 01198 DxfLType *ltype, 01200 int i, 01202 double complex_y_offset 01205 ) 01206 { 01207 #if DEBUG 01208 DXF_DEBUG_BEGIN 01209 #endif 01210 /* Do some basic checks. */ 01211 if (ltype == NULL) 01212 { 01213 fprintf (stderr, 01214 (_("Error in %s () a NULL pointer was passed.\n")), 01215 __FUNCTION__); 01216 return (NULL); 01217 } 01218 if (i < 0) 01219 { 01220 fprintf (stderr, 01221 (_("Error in %s () a negative index was passed.\n")), 01222 __FUNCTION__); 01223 return (NULL); 01224 } 01225 if (i > DXF_MAX_NUMBER_OF_DASH_LENGTH_ITEMS) 01226 { 01227 fprintf (stderr, 01228 (_("Error in %s () an out of range index was passed.\n")), 01229 __FUNCTION__); 01230 return (NULL); 01231 } 01232 ltype->complex_y_offset[i] = complex_y_offset; 01233 #if DEBUG 01234 DXF_DEBUG_END 01235 #endif 01236 return (ltype); 01237 } 01238 01239 01246 double 01247 dxf_ltype_get_complex_scale 01248 ( 01249 DxfLType *ltype, 01251 int i 01253 ) 01254 { 01255 #if DEBUG 01256 DXF_DEBUG_BEGIN 01257 #endif 01258 /* Do some basic checks. */ 01259 if (ltype == NULL) 01260 { 01261 fprintf (stderr, 01262 (_("Error in %s () a NULL pointer was passed.\n")), 01263 __FUNCTION__); 01264 return (EXIT_FAILURE); 01265 } 01266 if (i < 0) 01267 { 01268 fprintf (stderr, 01269 (_("Error in %s () a negative index was passed.\n")), 01270 __FUNCTION__); 01271 return (EXIT_FAILURE); 01272 } 01273 if (i > DXF_MAX_NUMBER_OF_DASH_LENGTH_ITEMS) 01274 { 01275 fprintf (stderr, 01276 (_("Error in %s () an out of range index was passed.\n")), 01277 __FUNCTION__); 01278 return (EXIT_FAILURE); 01279 } 01280 #if DEBUG 01281 DXF_DEBUG_END 01282 #endif 01283 return (ltype->complex_scale[i]); 01284 } 01285 01286 01291 DxfLType * 01292 dxf_ltype_set_complex_scale 01293 ( 01294 DxfLType *ltype, 01296 int i, 01298 double complex_scale 01301 ) 01302 { 01303 #if DEBUG 01304 DXF_DEBUG_BEGIN 01305 #endif 01306 /* Do some basic checks. */ 01307 if (ltype == NULL) 01308 { 01309 fprintf (stderr, 01310 (_("Error in %s () a NULL pointer was passed.\n")), 01311 __FUNCTION__); 01312 return (NULL); 01313 } 01314 if (i < 0) 01315 { 01316 fprintf (stderr, 01317 (_("Error in %s () a negative index was passed.\n")), 01318 __FUNCTION__); 01319 return (NULL); 01320 } 01321 if (i > DXF_MAX_NUMBER_OF_DASH_LENGTH_ITEMS) 01322 { 01323 fprintf (stderr, 01324 (_("Error in %s () an out of range index was passed.\n")), 01325 __FUNCTION__); 01326 return (NULL); 01327 } 01328 ltype->complex_scale[i] = complex_scale; 01329 #if DEBUG 01330 DXF_DEBUG_END 01331 #endif 01332 return (ltype); 01333 } 01334 01335 01342 double 01343 dxf_ltype_get_dash_length 01344 ( 01345 DxfLType *ltype, 01347 int i 01349 ) 01350 { 01351 #if DEBUG 01352 DXF_DEBUG_BEGIN 01353 #endif 01354 /* Do some basic checks. */ 01355 if (ltype == NULL) 01356 { 01357 fprintf (stderr, 01358 (_("Error in %s () a NULL pointer was passed.\n")), 01359 __FUNCTION__); 01360 return (EXIT_FAILURE); 01361 } 01362 if (i < 0) 01363 { 01364 fprintf (stderr, 01365 (_("Error in %s () a negative index was passed.\n")), 01366 __FUNCTION__); 01367 return (EXIT_FAILURE); 01368 } 01369 if (i > DXF_MAX_NUMBER_OF_DASH_LENGTH_ITEMS) 01370 { 01371 fprintf (stderr, 01372 (_("Error in %s () an out of range index was passed.\n")), 01373 __FUNCTION__); 01374 return (EXIT_FAILURE); 01375 } 01376 #if DEBUG 01377 DXF_DEBUG_END 01378 #endif 01379 return (ltype->dash_length[i]); 01380 } 01381 01382 01387 DxfLType * 01388 dxf_ltype_set_dash_length 01389 ( 01390 DxfLType *ltype, 01392 int i, 01394 double dash_length 01397 ) 01398 { 01399 #if DEBUG 01400 DXF_DEBUG_BEGIN 01401 #endif 01402 /* Do some basic checks. */ 01403 if (ltype == NULL) 01404 { 01405 fprintf (stderr, 01406 (_("Error in %s () a NULL pointer was passed.\n")), 01407 __FUNCTION__); 01408 return (NULL); 01409 } 01410 if (i < 0) 01411 { 01412 fprintf (stderr, 01413 (_("Error in %s () a negative index was passed.\n")), 01414 __FUNCTION__); 01415 return (NULL); 01416 } 01417 if (i > DXF_MAX_NUMBER_OF_DASH_LENGTH_ITEMS) 01418 { 01419 fprintf (stderr, 01420 (_("Error in %s () an out of range index was passed.\n")), 01421 __FUNCTION__); 01422 return (NULL); 01423 } 01424 ltype->dash_length[i] = dash_length; 01425 #if DEBUG 01426 DXF_DEBUG_END 01427 #endif 01428 return (ltype); 01429 } 01430 01431 01438 double 01439 dxf_ltype_get_complex_rotation 01440 ( 01441 DxfLType *ltype, 01443 int i 01445 ) 01446 { 01447 #if DEBUG 01448 DXF_DEBUG_BEGIN 01449 #endif 01450 /* Do some basic checks. */ 01451 if (ltype == NULL) 01452 { 01453 fprintf (stderr, 01454 (_("Error in %s () a NULL pointer was passed.\n")), 01455 __FUNCTION__); 01456 return (EXIT_FAILURE); 01457 } 01458 if (i < 0) 01459 { 01460 fprintf (stderr, 01461 (_("Error in %s () a negative index was passed.\n")), 01462 __FUNCTION__); 01463 return (EXIT_FAILURE); 01464 } 01465 if (i > DXF_MAX_NUMBER_OF_DASH_LENGTH_ITEMS) 01466 { 01467 fprintf (stderr, 01468 (_("Error in %s () an out of range index was passed.\n")), 01469 __FUNCTION__); 01470 return (EXIT_FAILURE); 01471 } 01472 #if DEBUG 01473 DXF_DEBUG_END 01474 #endif 01475 return (ltype->complex_rotation[i]); 01476 } 01477 01478 01483 DxfLType * 01484 dxf_ltype_set_complex_rotation 01485 ( 01486 DxfLType *ltype, 01488 int i, 01490 double complex_rotation 01493 ) 01494 { 01495 #if DEBUG 01496 DXF_DEBUG_BEGIN 01497 #endif 01498 /* Do some basic checks. */ 01499 if (ltype == NULL) 01500 { 01501 fprintf (stderr, 01502 (_("Error in %s () a NULL pointer was passed.\n")), 01503 __FUNCTION__); 01504 return (NULL); 01505 } 01506 if (i < 0) 01507 { 01508 fprintf (stderr, 01509 (_("Error in %s () a negative index was passed.\n")), 01510 __FUNCTION__); 01511 return (NULL); 01512 } 01513 if (i > DXF_MAX_NUMBER_OF_DASH_LENGTH_ITEMS) 01514 { 01515 fprintf (stderr, 01516 (_("Error in %s () an out of range index was passed.\n")), 01517 __FUNCTION__); 01518 return (NULL); 01519 } 01520 ltype->complex_rotation[i] = complex_rotation; 01521 #if DEBUG 01522 DXF_DEBUG_END 01523 #endif 01524 return (ltype); 01525 } 01526 01527 01533 int 01534 dxf_ltype_get_flag 01535 ( 01536 DxfLType *ltype 01538 ) 01539 { 01540 #if DEBUG 01541 DXF_DEBUG_BEGIN 01542 #endif 01543 /* Do some basic checks. */ 01544 if (ltype == NULL) 01545 { 01546 fprintf (stderr, 01547 (_("Error in %s () a NULL pointer was passed.\n")), 01548 __FUNCTION__); 01549 return (EXIT_FAILURE); 01550 } 01551 if (ltype->flag < 0) 01552 { 01553 fprintf (stderr, 01554 (_("Error in %s () a negative value was found.\n")), 01555 __FUNCTION__); 01556 return (EXIT_FAILURE); 01557 } 01558 #if DEBUG 01559 DXF_DEBUG_END 01560 #endif 01561 return (ltype->flag); 01562 } 01563 01564 01568 DxfLType * 01569 dxf_ltype_set_flag 01570 ( 01571 DxfLType *ltype, 01573 int flag 01575 ) 01576 { 01577 #if DEBUG 01578 DXF_DEBUG_BEGIN 01579 #endif 01580 /* Do some basic checks. */ 01581 if (ltype == NULL) 01582 { 01583 fprintf (stderr, 01584 (_("Error in %s () a NULL pointer was passed.\n")), 01585 __FUNCTION__); 01586 return (NULL); 01587 } 01588 if (flag < 0) 01589 { 01590 fprintf (stderr, 01591 (_("Error in %s () a negative value was passed.\n")), 01592 __FUNCTION__); 01593 return (NULL); 01594 } 01595 ltype->flag = flag; 01596 #if DEBUG 01597 DXF_DEBUG_END 01598 #endif 01599 return (ltype); 01600 } 01601 01602 01609 int 01610 dxf_ltype_is_xreferenced 01611 ( 01612 DxfLType *ltype 01614 ) 01615 { 01616 #if DEBUG 01617 DXF_DEBUG_BEGIN 01618 #endif 01619 /* Do some basic checks. */ 01620 if (ltype == NULL) 01621 { 01622 fprintf (stderr, 01623 (_("Error in %s () a NULL pointer was passed.\n")), 01624 __FUNCTION__); 01625 return (EXIT_FAILURE); 01626 } 01627 #if DEBUG 01628 DXF_DEBUG_END 01629 #endif 01630 return (DXF_CHECK_BIT (ltype->flag, 4)); 01631 } 01632 01633 01643 int 01644 dxf_ltype_is_xresolved 01645 ( 01646 DxfLType *ltype 01648 ) 01649 { 01650 #if DEBUG 01651 DXF_DEBUG_BEGIN 01652 #endif 01653 /* Do some basic checks. */ 01654 if (ltype == NULL) 01655 { 01656 fprintf (stderr, 01657 (_("Error in %s () a NULL pointer was passed.\n")), 01658 __FUNCTION__); 01659 return (EXIT_FAILURE); 01660 } 01661 #if DEBUG 01662 DXF_DEBUG_END 01663 #endif 01664 return ((DXF_CHECK_BIT (ltype->flag, 4)) 01665 && (DXF_CHECK_BIT (ltype->flag, 5))); 01666 } 01667 01668 01675 int 01676 dxf_ltype_is_referenced 01677 ( 01678 DxfLType *ltype 01680 ) 01681 { 01682 #if DEBUG 01683 DXF_DEBUG_BEGIN 01684 #endif 01685 /* Do some basic checks. */ 01686 if (ltype == NULL) 01687 { 01688 fprintf (stderr, 01689 (_("Error in %s () a NULL pointer was passed.\n")), 01690 __FUNCTION__); 01691 return (EXIT_FAILURE); 01692 } 01693 #if DEBUG 01694 DXF_DEBUG_END 01695 #endif 01696 return (DXF_CHECK_BIT (ltype->flag, 6)); 01697 } 01698 01699 01705 int 01706 dxf_ltype_get_alignment 01707 ( 01708 DxfLType *ltype 01710 ) 01711 { 01712 #if DEBUG 01713 DXF_DEBUG_BEGIN 01714 #endif 01715 /* Do some basic checks. */ 01716 if (ltype == NULL) 01717 { 01718 fprintf (stderr, 01719 (_("Error in %s () a NULL pointer was passed.\n")), 01720 __FUNCTION__); 01721 return (EXIT_FAILURE); 01722 } 01723 if (ltype->alignment != 65) 01724 { 01725 fprintf (stderr, 01726 (_("Error in %s () an invalid value was found.\n")), 01727 __FUNCTION__); 01728 return (EXIT_FAILURE); 01729 } 01730 #if DEBUG 01731 DXF_DEBUG_END 01732 #endif 01733 return (ltype->alignment); 01734 } 01735 01736 01740 DxfLType * 01741 dxf_ltype_set_alignment 01742 ( 01743 DxfLType *ltype, 01745 int alignment 01747 ) 01748 { 01749 #if DEBUG 01750 DXF_DEBUG_BEGIN 01751 #endif 01752 /* Do some basic checks. */ 01753 if (ltype == NULL) 01754 { 01755 fprintf (stderr, 01756 (_("Error in %s () a NULL pointer was passed.\n")), 01757 __FUNCTION__); 01758 return (NULL); 01759 } 01760 if (alignment != 65) 01761 { 01762 fprintf (stderr, 01763 (_("Error in %s () an invalid value was passed.\n")), 01764 __FUNCTION__); 01765 return (NULL); 01766 } 01767 ltype->alignment = alignment; 01768 #if DEBUG 01769 DXF_DEBUG_END 01770 #endif 01771 return (ltype); 01772 } 01773 01774 01780 int 01781 dxf_ltype_get_number_of_linetype_elements 01782 ( 01783 DxfLType *ltype 01785 ) 01786 { 01787 #if DEBUG 01788 DXF_DEBUG_BEGIN 01789 #endif 01790 /* Do some basic checks. */ 01791 if (ltype == NULL) 01792 { 01793 fprintf (stderr, 01794 (_("Error in %s () a NULL pointer was passed.\n")), 01795 __FUNCTION__); 01796 return (EXIT_FAILURE); 01797 } 01798 if (ltype->number_of_linetype_elements < 0) 01799 { 01800 fprintf (stderr, 01801 (_("Error in %s () a negative value was found.\n")), 01802 __FUNCTION__); 01803 return (EXIT_FAILURE); 01804 } 01805 #if DEBUG 01806 DXF_DEBUG_END 01807 #endif 01808 return (ltype->number_of_linetype_elements); 01809 } 01810 01811 01815 DxfLType * 01816 dxf_ltype_set_number_of_linetype_elements 01817 ( 01818 DxfLType *ltype, 01820 int number_of_linetype_elements 01823 ) 01824 { 01825 #if DEBUG 01826 DXF_DEBUG_BEGIN 01827 #endif 01828 /* Do some basic checks. */ 01829 if (ltype == NULL) 01830 { 01831 fprintf (stderr, 01832 (_("Error in %s () a NULL pointer was passed.\n")), 01833 __FUNCTION__); 01834 return (NULL); 01835 } 01836 if (number_of_linetype_elements < 0) 01837 { 01838 fprintf (stderr, 01839 (_("Error in %s () a negative value was passed.\n")), 01840 __FUNCTION__); 01841 return (NULL); 01842 } 01843 ltype->number_of_linetype_elements = number_of_linetype_elements; 01844 #if DEBUG 01845 DXF_DEBUG_END 01846 #endif 01847 return (ltype); 01848 } 01849 01850 01857 int 01858 dxf_ltype_get_complex_element 01859 ( 01860 DxfLType *ltype, 01862 int i 01864 ) 01865 { 01866 #if DEBUG 01867 DXF_DEBUG_BEGIN 01868 #endif 01869 /* Do some basic checks. */ 01870 if (ltype == NULL) 01871 { 01872 fprintf (stderr, 01873 (_("Error in %s () a NULL pointer was passed.\n")), 01874 __FUNCTION__); 01875 return (EXIT_FAILURE); 01876 } 01877 if (i < 0) 01878 { 01879 fprintf (stderr, 01880 (_("Error in %s () a negative index was passed.\n")), 01881 __FUNCTION__); 01882 return (EXIT_FAILURE); 01883 } 01884 if (i > DXF_MAX_NUMBER_OF_DASH_LENGTH_ITEMS) 01885 { 01886 fprintf (stderr, 01887 (_("Error in %s () an out of range index was passed.\n")), 01888 __FUNCTION__); 01889 return (EXIT_FAILURE); 01890 } 01891 #if DEBUG 01892 DXF_DEBUG_END 01893 #endif 01894 return (ltype->complex_element[i]); 01895 } 01896 01897 01902 DxfLType * 01903 dxf_ltype_set_complex_element 01904 ( 01905 DxfLType *ltype, 01907 int i, 01909 int complex_element 01912 ) 01913 { 01914 #if DEBUG 01915 DXF_DEBUG_BEGIN 01916 #endif 01917 /* Do some basic checks. */ 01918 if (ltype == NULL) 01919 { 01920 fprintf (stderr, 01921 (_("Error in %s () a NULL pointer was passed.\n")), 01922 __FUNCTION__); 01923 return (NULL); 01924 } 01925 if (i < 0) 01926 { 01927 fprintf (stderr, 01928 (_("Error in %s () a negative index was passed.\n")), 01929 __FUNCTION__); 01930 return (NULL); 01931 } 01932 if (i > DXF_MAX_NUMBER_OF_DASH_LENGTH_ITEMS) 01933 { 01934 fprintf (stderr, 01935 (_("Error in %s () an out of range index was passed.\n")), 01936 __FUNCTION__); 01937 return (NULL); 01938 } 01939 ltype->complex_element[i] = complex_element; 01940 #if DEBUG 01941 DXF_DEBUG_END 01942 #endif 01943 return (ltype); 01944 } 01945 01946 01953 int 01954 dxf_ltype_get_complex_shape_number 01955 ( 01956 DxfLType *ltype, 01958 int i 01960 ) 01961 { 01962 #if DEBUG 01963 DXF_DEBUG_BEGIN 01964 #endif 01965 /* Do some basic checks. */ 01966 if (ltype == NULL) 01967 { 01968 fprintf (stderr, 01969 (_("Error in %s () a NULL pointer was passed.\n")), 01970 __FUNCTION__); 01971 return (EXIT_FAILURE); 01972 } 01973 if (i < 0) 01974 { 01975 fprintf (stderr, 01976 (_("Error in %s () a negative index was passed.\n")), 01977 __FUNCTION__); 01978 return (EXIT_FAILURE); 01979 } 01980 if (i > DXF_MAX_NUMBER_OF_DASH_LENGTH_ITEMS) 01981 { 01982 fprintf (stderr, 01983 (_("Error in %s () an out of range index was passed.\n")), 01984 __FUNCTION__); 01985 return (EXIT_FAILURE); 01986 } 01987 #if DEBUG 01988 DXF_DEBUG_END 01989 #endif 01990 return (ltype->complex_shape_number[i]); 01991 } 01992 01993 01998 DxfLType * 01999 dxf_ltype_set_complex_shape_number 02000 ( 02001 DxfLType *ltype, 02003 int i, 02005 int complex_shape_number 02008 ) 02009 { 02010 #if DEBUG 02011 DXF_DEBUG_BEGIN 02012 #endif 02013 /* Do some basic checks. */ 02014 if (ltype == NULL) 02015 { 02016 fprintf (stderr, 02017 (_("Error in %s () a NULL pointer was passed.\n")), 02018 __FUNCTION__); 02019 return (NULL); 02020 } 02021 if (i < 0) 02022 { 02023 fprintf (stderr, 02024 (_("Error in %s () a negative index was passed.\n")), 02025 __FUNCTION__); 02026 return (NULL); 02027 } 02028 if (i > DXF_MAX_NUMBER_OF_DASH_LENGTH_ITEMS) 02029 { 02030 fprintf (stderr, 02031 (_("Error in %s () an out of range index was passed.\n")), 02032 __FUNCTION__); 02033 return (NULL); 02034 } 02035 ltype->complex_shape_number[i] = complex_shape_number; 02036 #if DEBUG 02037 DXF_DEBUG_END 02038 #endif 02039 return (ltype); 02040 } 02041 02042 02051 char * 02052 dxf_ltype_get_dictionary_owner_soft 02053 ( 02054 DxfLType *ltype 02056 ) 02057 { 02058 #if DEBUG 02059 DXF_DEBUG_BEGIN 02060 #endif 02061 /* Do some basic checks. */ 02062 if (ltype == NULL) 02063 { 02064 fprintf (stderr, 02065 (_("Error in %s () a NULL pointer was passed.\n")), 02066 __FUNCTION__); 02067 return (NULL); 02068 } 02069 if (ltype->dictionary_owner_soft == NULL) 02070 { 02071 fprintf (stderr, 02072 (_("Error in %s () a NULL pointer was found.\n")), 02073 __FUNCTION__); 02074 return (NULL); 02075 } 02076 #if DEBUG 02077 DXF_DEBUG_END 02078 #endif 02079 return (strdup (ltype->dictionary_owner_soft)); 02080 } 02081 02082 02087 DxfLType * 02088 dxf_ltype_set_dictionary_owner_soft 02089 ( 02090 DxfLType *ltype, 02092 char *dictionary_owner_soft 02095 ) 02096 { 02097 #if DEBUG 02098 DXF_DEBUG_BEGIN 02099 #endif 02100 /* Do some basic checks. */ 02101 if (ltype == NULL) 02102 { 02103 fprintf (stderr, 02104 (_("Error in %s () a NULL pointer was passed.\n")), 02105 __FUNCTION__); 02106 return (NULL); 02107 } 02108 if (dictionary_owner_soft == NULL) 02109 { 02110 fprintf (stderr, 02111 (_("Error in %s () a NULL pointer was passed.\n")), 02112 __FUNCTION__); 02113 return (NULL); 02114 } 02115 ltype->dictionary_owner_soft = strdup (dictionary_owner_soft); 02116 #if DEBUG 02117 DXF_DEBUG_END 02118 #endif 02119 return (ltype); 02120 } 02121 02122 02130 char * 02131 dxf_ltype_get_complex_style_pointer 02132 ( 02133 DxfLType *ltype, 02135 int i 02137 ) 02138 { 02139 #if DEBUG 02140 DXF_DEBUG_BEGIN 02141 #endif 02142 /* Do some basic checks. */ 02143 if (ltype == NULL) 02144 { 02145 fprintf (stderr, 02146 (_("Error in %s () a NULL pointer was passed.\n")), 02147 __FUNCTION__); 02148 return (NULL); 02149 } 02150 if (i < 0) 02151 { 02152 fprintf (stderr, 02153 (_("Error in %s () a negative index was passed.\n")), 02154 __FUNCTION__); 02155 return (NULL); 02156 } 02157 if (i > DXF_MAX_NUMBER_OF_DASH_LENGTH_ITEMS) 02158 { 02159 fprintf (stderr, 02160 (_("Error in %s () an out of range index was passed.\n")), 02161 __FUNCTION__); 02162 return (NULL); 02163 } 02164 if (ltype->complex_style_pointer[i] == NULL) 02165 { 02166 fprintf (stderr, 02167 (_("Error in %s () a NULL pointer was found.\n")), 02168 __FUNCTION__); 02169 return (NULL); 02170 } 02171 #if DEBUG 02172 DXF_DEBUG_END 02173 #endif 02174 return (strdup (ltype->complex_style_pointer[i])); 02175 } 02176 02177 02182 DxfLType * 02183 dxf_ltype_set_complex_style_pointer 02184 ( 02185 DxfLType *ltype, 02187 int i, 02189 char *complex_style_pointer 02192 ) 02193 { 02194 #if DEBUG 02195 DXF_DEBUG_BEGIN 02196 #endif 02197 /* Do some basic checks. */ 02198 if (ltype == NULL) 02199 { 02200 fprintf (stderr, 02201 (_("Error in %s () a NULL pointer was passed.\n")), 02202 __FUNCTION__); 02203 return (NULL); 02204 } 02205 if (i < 0) 02206 { 02207 fprintf (stderr, 02208 (_("Error in %s () a negative index was passed.\n")), 02209 __FUNCTION__); 02210 return (NULL); 02211 } 02212 if (i > DXF_MAX_NUMBER_OF_DASH_LENGTH_ITEMS) 02213 { 02214 fprintf (stderr, 02215 (_("Error in %s () an out of range index was passed.\n")), 02216 __FUNCTION__); 02217 return (NULL); 02218 } 02219 if (complex_style_pointer == NULL) 02220 { 02221 fprintf (stderr, 02222 (_("Error in %s () a NULL pointer was passed.\n")), 02223 __FUNCTION__); 02224 return (NULL); 02225 } 02226 ltype->complex_style_pointer[i] = strdup (complex_style_pointer); 02227 #if DEBUG 02228 DXF_DEBUG_END 02229 #endif 02230 return (ltype); 02231 } 02232 02233 02242 char * 02243 dxf_ltype_get_dictionary_owner_hard 02244 ( 02245 DxfLType *ltype 02247 ) 02248 { 02249 #if DEBUG 02250 DXF_DEBUG_BEGIN 02251 #endif 02252 /* Do some basic checks. */ 02253 if (ltype == NULL) 02254 { 02255 fprintf (stderr, 02256 (_("Error in %s () a NULL pointer was passed.\n")), 02257 __FUNCTION__); 02258 return (NULL); 02259 } 02260 if (ltype->dictionary_owner_hard == NULL) 02261 { 02262 fprintf (stderr, 02263 (_("Error in %s () a NULL pointer was found.\n")), 02264 __FUNCTION__); 02265 return (NULL); 02266 } 02267 #if DEBUG 02268 DXF_DEBUG_END 02269 #endif 02270 return (strdup (ltype->dictionary_owner_hard)); 02271 } 02272 02273 02278 DxfLType * 02279 dxf_ltype_set_dictionary_owner_hard 02280 ( 02281 DxfLType *ltype, 02283 char *dictionary_owner_hard 02286 ) 02287 { 02288 #if DEBUG 02289 DXF_DEBUG_BEGIN 02290 #endif 02291 /* Do some basic checks. */ 02292 if (ltype == NULL) 02293 { 02294 fprintf (stderr, 02295 (_("Error in %s () a NULL pointer was passed.\n")), 02296 __FUNCTION__); 02297 return (NULL); 02298 } 02299 if (dictionary_owner_hard == NULL) 02300 { 02301 fprintf (stderr, 02302 (_("Error in %s () a NULL pointer was passed.\n")), 02303 __FUNCTION__); 02304 return (NULL); 02305 } 02306 ltype->dictionary_owner_hard = strdup (dictionary_owner_hard); 02307 #if DEBUG 02308 DXF_DEBUG_END 02309 #endif 02310 return (ltype); 02311 } 02312 02313 02322 DxfLType * 02323 dxf_ltype_get_next 02324 ( 02325 DxfLType *ltype 02327 ) 02328 { 02329 #if DEBUG 02330 DXF_DEBUG_BEGIN 02331 #endif 02332 /* Do some basic checks. */ 02333 if (ltype == NULL) 02334 { 02335 fprintf (stderr, 02336 (_("Error in %s () a NULL pointer was passed.\n")), 02337 __FUNCTION__); 02338 return (NULL); 02339 } 02340 if (ltype->next == NULL) 02341 { 02342 fprintf (stderr, 02343 (_("Error in %s () a NULL pointer was found.\n")), 02344 __FUNCTION__); 02345 return (NULL); 02346 } 02347 #if DEBUG 02348 DXF_DEBUG_END 02349 #endif 02350 return ((DxfLType *) ltype->next); 02351 } 02352 02353 02358 DxfLType * 02359 dxf_ltype_set_next 02360 ( 02361 DxfLType *ltype, 02363 DxfLType *next 02365 ) 02366 { 02367 #if DEBUG 02368 DXF_DEBUG_BEGIN 02369 #endif 02370 /* Do some basic checks. */ 02371 if (ltype == NULL) 02372 { 02373 fprintf (stderr, 02374 (_("Error in %s () a NULL pointer was passed.\n")), 02375 __FUNCTION__); 02376 return (NULL); 02377 } 02378 if (next == NULL) 02379 { 02380 fprintf (stderr, 02381 (_("Error in %s () a NULL pointer was passed.\n")), 02382 __FUNCTION__); 02383 return (NULL); 02384 } 02385 ltype->next = (struct DxfLType *) next; 02386 #if DEBUG 02387 DXF_DEBUG_END 02388 #endif 02389 return (ltype); 02390 } 02391 02392 02401 DxfLType * 02402 dxf_ltype_get_last 02403 ( 02404 DxfLType *ltype 02406 ) 02407 { 02408 #if DEBUG 02409 DXF_DEBUG_BEGIN 02410 #endif 02411 /* Do some basic checks. */ 02412 if (ltype == NULL) 02413 { 02414 fprintf (stderr, 02415 (_("Error in %s () a NULL pointer was passed.\n")), 02416 __FUNCTION__); 02417 return (NULL); 02418 } 02419 if (ltype->next == NULL) 02420 { 02421 fprintf (stderr, 02422 (_("Warning in %s () a NULL pointer was found.\n")), 02423 __FUNCTION__); 02424 return ((DxfLType *) ltype); 02425 } 02426 DxfLType *iter = (DxfLType *) ltype->next; 02427 while (iter->next != NULL) 02428 { 02429 iter = (DxfLType *) iter->next; 02430 } 02431 #if DEBUG 02432 DXF_DEBUG_END 02433 #endif 02434 return ((DxfLType *) iter); 02435 } 02436 02437 02438 /* EOF */