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

idbuffer.c File Reference

Functions for a DXF idbuffer object (IDBUFFER). More...

#include "idbuffer.h"
Include dependency graph for idbuffer.c:

Go to the source code of this file.

Functions

DxfIdbufferdxf_idbuffer_new ()
 Allocate memory for a DxfIdbuffer.
DxfIdbufferdxf_idbuffer_init (DxfIdbuffer *idbuffer)
 Allocate memory and initialize data fields in a IDBUFFER object.
DxfIdbufferdxf_idbuffer_read (DxfFile *fp, DxfIdbuffer *idbuffer)
 Read data from a DXF file into a DXF IDBUFFER object.
int dxf_idbuffer_write (DxfFile *fp, DxfIdbuffer *idbuffer)
 Write DXF output to a file for a DXF IDBUFFER object.
int dxf_idbuffer_free (DxfIdbuffer *idbuffer)
 Free the allocated memory for a DXF IDBUFFER object and all it's data fields.
void dxf_idbuffer_free_chain (DxfIdbuffer *id_buffers)
 Free the allocated memory for a chain of DXF IDBUFFER objects and all their data fields.
int dxf_idbuffer_get_id_code (DxfIdbuffer *idbuffer)
 Get the id_code from a DXF IDBUFFER object.
DxfIdbufferdxf_idbuffer_set_id_code (DxfIdbuffer *idbuffer, int id_code)
 Set the id_code for a DXF IDBUFFER object.
char * dxf_idbuffer_get_dictionary_owner_soft (DxfIdbuffer *idbuffer)
 Get the pointer to the dictionary_owner_soft from a DXF IDBUFFER object.
DxfIdbufferdxf_idbuffer_set_dictionary_owner_soft (DxfIdbuffer *idbuffer, char *dictionary_owner_soft)
 Set the pointer to the dictionary_owner_soft for a DXF IDBUFFER object.
char * dxf_idbuffer_get_dictionary_owner_hard (DxfIdbuffer *idbuffer)
 Get the pointer to the dictionary_owner_hard from a DXF IDBUFFER object.
DxfIdbufferdxf_idbuffer_set_dictionary_owner_hard (DxfIdbuffer *idbuffer, char *dictionary_owner_hard)
 Set the pointer to the dictionary_owner_hard for a DXF IDBUFFER object.
DxfIdbufferEntityPointerdxf_idbuffer_get_entity_pointer (DxfIdbuffer *idbuffer)
 Get the pointer to the first entity_pointer of a linked list of entity_pointer from a DXF IDBUFFER object.
DxfIdbufferdxf_idbuffer_set_entity_pointer (DxfIdbuffer *idbuffer, DxfIdbufferEntityPointer *entity_pointer)
 Set the pointer to the first entity_pointer of a linked list for a DXF IDBUFFER object.
DxfIdbufferdxf_idbuffer_get_next (DxfIdbuffer *idbuffer)
 Get the pointer to the next HELIX entity from a DXF IDBUFFER object.
DxfIdbufferdxf_idbuffer_set_next (DxfIdbuffer *idbuffer, DxfIdbuffer *next)
 Set the pointer to the next IDBUFFER for a DXF IDBUFFER object.
DxfIdbufferdxf_idbuffer_get_last (DxfIdbuffer *idbuffer)
 Get the pointer to the last IDBUFFER object from a linked list of DXF IDBUFFER objects.
DxfIdbufferEntityPointerdxf_idbuffer_entity_pointer_new ()
 Allocate memory for a DxfIdbufferEntityPointer.
DxfIdbufferEntityPointerdxf_idbuffer_entity_pointer_init (DxfIdbufferEntityPointer *entity_pointer)
 Allocate memory and initialize data fields in a DxfIdbufferEntityPointer struct.
int dxf_idbuffer_entity_pointer_free (DxfIdbufferEntityPointer *entity_pointer)
 Free the allocated memory for a DXF DxfIdbufferEntityPointer struct and all it's data fields.
void dxf_idbuffer_entity_pointer_free_chain (DxfIdbufferEntityPointer *entity_pointers)
 Free the allocated memory for a chain of DXF DxfIdbufferEntityPointer structs and all their data fields.
char * dxf_idbuffer_entity_pointer_get_soft_pointer (DxfIdbufferEntityPointer *entity_pointer)
 Get the pointer to the soft_pointer from a DXF DxfIdbufferEntityPointer object.
DxfIdbufferEntityPointerdxf_idbuffer_entity_pointer_set_soft_pointer (DxfIdbufferEntityPointer *entity_pointer, char *soft_pointer)
 Set the pointer to the soft_pointer for a DXF DxfIdbufferEntityPointer object.
DxfIdbufferEntityPointerdxf_idbuffer_entity_pointer_get_next (DxfIdbufferEntityPointer *entity_pointer)
 Get the pointer to the next DxfIdbufferEntityPointer object from a DXF DxfIdbufferEntityPointer object.
DxfIdbufferEntityPointerdxf_idbuffer_entity_pointer_set_next (DxfIdbufferEntityPointer *entity_pointer, DxfIdbufferEntityPointer *next)
 Set the pointer to the next DxfIdbufferEntityPointer object for a DXF DxfIdbufferEntityPointer object.
DxfIdbufferEntityPointerdxf_idbuffer_entity_pointer_get_last (DxfIdbufferEntityPointer *entity_pointer)
 Get the pointer to the last DxfIdbufferEntityPointer object from a linked list of DXF DxfIdbufferEntityPointer objects.

Detailed Description

Functions for a DXF idbuffer object (IDBUFFER).

Author:
Copyright (C) 2015, 2016, 2017 by Bert Timmerman <bert.timmerman@xs4all.nl>.
Since:
The IDBUFFER object was introduced in DXF R14.
Version:
According to DXF R10 (backward compatibility).
According to DXF R11 (backward compatibility).
According to DXF R12 (backward compatibility).
According to DXF R13 (backward compatibility).
According to DXF R14.

Copyright Notices.


This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to:
Free Software Foundation, Inc.,
59 Temple Place,
Suite 330,
Boston,
MA 02111 USA.

Drawing eXchange Format (DXF) is a defacto industry standard for the exchange of drawing files between various Computer Aided Drafting programs.
DXF is an industry standard designed by Autodesk(TM).
For more details see http://www.autodesk.com.


Definition in file idbuffer.c.


Function Documentation

DxfIdbuffer* dxf_idbuffer_new ( )

Allocate memory for a DxfIdbuffer.

Fill the memory contents with zeros.

Definition at line 52 of file idbuffer.c.

References _, DXF_DEBUG_BEGIN, and DXF_DEBUG_END.

Referenced by dxf_idbuffer_init(), and dxf_idbuffer_read().

DxfIdbuffer* dxf_idbuffer_init ( DxfIdbuffer idbuffer)

Allocate memory and initialize data fields in a IDBUFFER object.

Returns:
NULL when no memory was allocated, a pointer to the allocated memory when succesful.
Parameters:
idbufferDXF IDBUFFER object.

Definition at line 90 of file idbuffer.c.

References _, dxf_idbuffer::dictionary_owner_hard, dxf_idbuffer::dictionary_owner_soft, DXF_DEBUG_BEGIN, DXF_DEBUG_END, dxf_idbuffer_entity_pointer_init(), dxf_idbuffer_new(), dxf_idbuffer::entity_pointer, dxf_idbuffer::id_code, and dxf_idbuffer::next.

Referenced by dxf_idbuffer_read().

Here is the call graph for this function:

DxfIdbuffer* dxf_idbuffer_read ( DxfFile fp,
DxfIdbuffer idbuffer 
)

Read data from a DXF file into a DXF IDBUFFER object.

The last line read from file contained the string "IDBUFFER".
Now follows some data for the IDBUFFER, to be terminated with a " 0" string announcing the following object, or the end of the OBJECTS section marker ENDSEC.
While parsing the DXF file store data in idbuffer.

Returns:
a pointer to idbuffer.
Parameters:
fpDXF file pointer to an input file (or device).
idbufferDXF IDBUFFER object.

Definition at line 138 of file idbuffer.c.

References _, dxf_file_struct::acad_version_number, AutoCAD_14, dxf_idbuffer::dictionary_owner_hard, dxf_idbuffer::dictionary_owner_soft, DXF_DEBUG_BEGIN, DXF_DEBUG_END, dxf_idbuffer_entity_pointer_init(), dxf_idbuffer_init(), dxf_idbuffer_new(), dxf_file_struct::filename, dxf_file_struct::fp, dxf_idbuffer::id_code, dxf_file_struct::line_number, dxf_idbuffer_entity_pointer_struct::next, and dxf_idbuffer_entity_pointer_struct::soft_pointer.

Here is the call graph for this function:

int dxf_idbuffer_write ( DxfFile fp,
DxfIdbuffer idbuffer 
)

Write DXF output to a file for a DXF IDBUFFER object.

Returns:
EXIT_SUCCESS when done, or EXIT_FAILURE when an error occurred.

Todo:
for version R14.
Implementing the start of application-defined group "{application_name", with Group code 102.
For example: "{ACAD_REACTORS" indicates the start of the AutoCAD persistent reactors group.

application-defined codes: Group codes and values within the 102 groups are application defined (optional).

End of group, "}" (optional), with Group code 102.

Parameters:
fpDXF file pointer to an output file (or device).
idbufferDXF IDBUFFER object.

Definition at line 269 of file idbuffer.c.

References _, dxf_file_struct::acad_version_number, AutoCAD_13, AutoCAD_14, dxf_idbuffer::dictionary_owner_hard, dxf_idbuffer::dictionary_owner_soft, DXF_DEBUG_BEGIN, DXF_DEBUG_END, dxf_idbuffer_entity_pointer_get_next(), dxf_idbuffer_entity_pointer_get_soft_pointer(), dxf_idbuffer_get_dictionary_owner_hard(), dxf_idbuffer_get_dictionary_owner_soft(), dxf_idbuffer_get_entity_pointer(), dxf_idbuffer_get_id_code(), dxf_idbuffer::entity_pointer, and dxf_file_struct::fp.

Here is the call graph for this function:

int dxf_idbuffer_free ( DxfIdbuffer idbuffer)

Free the allocated memory for a DXF IDBUFFER object and all it's data fields.

Returns:
EXIT_SUCCESS when done, or EXIT_FAILURE when an error occurred.
Parameters:
idbufferPointer to the memory occupied by the DXF IDBUFFER object.

Definition at line 365 of file idbuffer.c.

References _, DXF_DEBUG_BEGIN, DXF_DEBUG_END, dxf_idbuffer_entity_pointer_free_chain(), dxf_idbuffer_get_dictionary_owner_hard(), dxf_idbuffer_get_dictionary_owner_soft(), dxf_idbuffer_get_entity_pointer(), and dxf_idbuffer::next.

Referenced by dxf_idbuffer_free_chain().

Here is the call graph for this function:

void dxf_idbuffer_free_chain ( DxfIdbuffer id_buffers)

Free the allocated memory for a chain of DXF IDBUFFER objects and all their data fields.

Parameters:
id_bufferspointer to the chain of DXF IDBUFFER objects.

Definition at line 407 of file idbuffer.c.

References _, DXF_DEBUG_BEGIN, DXF_DEBUG_END, dxf_idbuffer_free(), and dxf_idbuffer_get_next().

Here is the call graph for this function:

int dxf_idbuffer_get_id_code ( DxfIdbuffer idbuffer)

Get the id_code from a DXF IDBUFFER object.

Returns:
id_code when successful, or EXIT_FAILURE when an error occurred.
Parameters:
idbuffera pointer to a DXF IDBUFFER.

Definition at line 441 of file idbuffer.c.

References _, DXF_DEBUG_BEGIN, DXF_DEBUG_END, and dxf_idbuffer::id_code.

Referenced by dxf_idbuffer_write().

DxfIdbuffer* dxf_idbuffer_set_id_code ( DxfIdbuffer idbuffer,
int  id_code 
)

Set the id_code for a DXF IDBUFFER object.

Returns:
a pointer to idbuffer when successful, or NULL when an error occurred.
Parameters:
idbuffera pointer to a DXF IDBUFFER.
id_codeIdentification number for the entity.
This is to be an unique (sequential) number in the DXF file.

Definition at line 479 of file idbuffer.c.

References _, DXF_DEBUG_BEGIN, DXF_DEBUG_END, dxf_helix_struct::id_code, and dxf_idbuffer::id_code.

char* dxf_idbuffer_get_dictionary_owner_soft ( DxfIdbuffer idbuffer)

Get the pointer to the dictionary_owner_soft from a DXF IDBUFFER object.

Returns:
a pointer to dictionary_owner_soft when successful, or NULL when an error occurred.
Warning:
No checks are performed on the returned pointer.
Parameters:
idbuffera pointer to a DXF IDBUFFER object.

Definition at line 525 of file idbuffer.c.

References _, dxf_idbuffer::dictionary_owner_soft, DXF_DEBUG_BEGIN, and DXF_DEBUG_END.

Referenced by dxf_idbuffer_free(), and dxf_idbuffer_write().

DxfIdbuffer* dxf_idbuffer_set_dictionary_owner_soft ( DxfIdbuffer idbuffer,
char *  dictionary_owner_soft 
)

Set the pointer to the dictionary_owner_soft for a DXF IDBUFFER object.

Returns:
a pointer to idbuffer when successful, or NULL when an error occurred.
Parameters:
idbuffera pointer to a DXF IDBUFFER object.
dictionary_owner_softa string containing the pointer to the dictionary_owner_soft for the entity.

Definition at line 564 of file idbuffer.c.

References _, dxf_idbuffer::dictionary_owner_soft, DXF_DEBUG_BEGIN, and DXF_DEBUG_END.

char* dxf_idbuffer_get_dictionary_owner_hard ( DxfIdbuffer idbuffer)

Get the pointer to the dictionary_owner_hard from a DXF IDBUFFER object.

Returns:
a pointer to dictionary_owner_hard when successful, or NULL when an error occurred.
Warning:
No checks are performed on the returned pointer.
Parameters:
idbuffera pointer to a DXF IDBUFFER object.

Definition at line 609 of file idbuffer.c.

References _, dxf_idbuffer::dictionary_owner_hard, dxf_idbuffer::dictionary_owner_soft, DXF_DEBUG_BEGIN, and DXF_DEBUG_END.

Referenced by dxf_idbuffer_free(), and dxf_idbuffer_write().

DxfIdbuffer* dxf_idbuffer_set_dictionary_owner_hard ( DxfIdbuffer idbuffer,
char *  dictionary_owner_hard 
)

Set the pointer to the dictionary_owner_hard for a DXF IDBUFFER object.

Returns:
a pointer to idbuffer when successful, or NULL when an error occurred.
Parameters:
idbuffera pointer to a DXF IDBUFFER object.
dictionary_owner_harda string containing the pointer to the dictionary_owner_hard for the entity.

Definition at line 648 of file idbuffer.c.

References _, dxf_idbuffer::dictionary_owner_hard, DXF_DEBUG_BEGIN, and DXF_DEBUG_END.

DxfIdbufferEntityPointer* dxf_idbuffer_get_entity_pointer ( DxfIdbuffer idbuffer)

Get the pointer to the first entity_pointer of a linked list of entity_pointer from a DXF IDBUFFER object.

Returns:
pointer to the first entity_pointer of a linked list.
Warning:
No checks are performed on the returned pointer.
Parameters:
idbuffera pointer to a DXF IDBUFFER object.

Definition at line 692 of file idbuffer.c.

References _, DXF_DEBUG_BEGIN, DXF_DEBUG_END, and dxf_idbuffer::entity_pointer.

Referenced by dxf_idbuffer_free(), and dxf_idbuffer_write().

DxfIdbuffer* dxf_idbuffer_set_entity_pointer ( DxfIdbuffer idbuffer,
DxfIdbufferEntityPointer entity_pointer 
)

Set the pointer to the first entity_pointer of a linked list for a DXF IDBUFFER object.

Returns:
a pointer to idbuffer when successful, or NULL when an error occurred.
Parameters:
idbuffera pointer to a DXF IDBUFFER object.
entity_pointera pointer to the first entity_pointer of a linked list for the object.

Definition at line 731 of file idbuffer.c.

References _, DXF_DEBUG_BEGIN, DXF_DEBUG_END, and dxf_idbuffer::entity_pointer.

DxfIdbuffer* dxf_idbuffer_get_next ( DxfIdbuffer idbuffer)

Get the pointer to the next HELIX entity from a DXF IDBUFFER object.

Returns:
pointer to the next IDBUFFER object.
Warning:
No checks are performed on the returned pointer.
Parameters:
idbuffera pointer to a DXF IDBUFFER object.

Definition at line 775 of file idbuffer.c.

References _, DXF_DEBUG_BEGIN, DXF_DEBUG_END, and dxf_idbuffer::next.

Referenced by dxf_idbuffer_free_chain().

DxfIdbuffer* dxf_idbuffer_set_next ( DxfIdbuffer idbuffer,
DxfIdbuffer next 
)

Set the pointer to the next IDBUFFER for a DXF IDBUFFER object.

Returns:
a pointer to idbuffer when successful, or NULL when an error occurred.
Parameters:
idbuffera pointer to a DXF IDBUFFER object.
nexta pointer to the next IDBUFFER for the object.

Definition at line 814 of file idbuffer.c.

References _, DXF_DEBUG_BEGIN, DXF_DEBUG_END, and dxf_idbuffer::next.

DxfIdbuffer* dxf_idbuffer_get_last ( DxfIdbuffer idbuffer)

Get the pointer to the last IDBUFFER object from a linked list of DXF IDBUFFER objects.

Returns:
pointer to the last IDBUFFER object.
Warning:
No checks are performed on the returned pointer.
Parameters:
idbuffera pointer to a DXF IDBUFFER object.

Definition at line 857 of file idbuffer.c.

References _, DXF_DEBUG_BEGIN, DXF_DEBUG_END, and dxf_idbuffer::next.

DxfIdbufferEntityPointer* dxf_idbuffer_entity_pointer_new ( )

Allocate memory for a DxfIdbufferEntityPointer.

Fill the memory contents with zeros.

Definition at line 898 of file idbuffer.c.

References _, DXF_DEBUG_BEGIN, and DXF_DEBUG_END.

Referenced by dxf_idbuffer_entity_pointer_init().

DxfIdbufferEntityPointer* dxf_idbuffer_entity_pointer_init ( DxfIdbufferEntityPointer entity_pointer)

Allocate memory and initialize data fields in a DxfIdbufferEntityPointer struct.

Returns:
NULL when no memory was allocated, a pointer to the allocated memory when succesful.
Parameters:
entity_pointerDXF DxfIdbufferEntityPointer struct.

Definition at line 936 of file idbuffer.c.

References _, DXF_DEBUG_BEGIN, DXF_DEBUG_END, dxf_idbuffer_entity_pointer_new(), dxf_idbuffer_entity_pointer_struct::next, and dxf_idbuffer_entity_pointer_struct::soft_pointer.

Referenced by dxf_idbuffer_init(), and dxf_idbuffer_read().

Here is the call graph for this function:

int dxf_idbuffer_entity_pointer_free ( DxfIdbufferEntityPointer entity_pointer)

Free the allocated memory for a DXF DxfIdbufferEntityPointer struct and all it's data fields.

Returns:
EXIT_SUCCESS when done, or EXIT_FAILURE when an error occurred.
Parameters:
entity_pointerPointer to the memory occupied by the DXF DxfIdbufferEntityPointer struct.

Definition at line 977 of file idbuffer.c.

References _, DXF_DEBUG_BEGIN, DXF_DEBUG_END, dxf_idbuffer_entity_pointer_struct::next, and dxf_idbuffer_entity_pointer_struct::soft_pointer.

Referenced by dxf_idbuffer_entity_pointer_free_chain().

void dxf_idbuffer_entity_pointer_free_chain ( DxfIdbufferEntityPointer entity_pointers)

Free the allocated memory for a chain of DXF DxfIdbufferEntityPointer structs and all their data fields.

Parameters:
entity_pointerspointer to the chain of DXF DxfIdbufferEntityPointer structs.

Definition at line 1017 of file idbuffer.c.

References _, DXF_DEBUG_BEGIN, DXF_DEBUG_END, dxf_idbuffer_entity_pointer_free(), and dxf_idbuffer_entity_pointer_struct::next.

Referenced by dxf_idbuffer_free().

Here is the call graph for this function:

char* dxf_idbuffer_entity_pointer_get_soft_pointer ( DxfIdbufferEntityPointer entity_pointer)

Get the pointer to the soft_pointer from a DXF DxfIdbufferEntityPointer object.

Returns:
a pointer to soft_pointer when successful, or NULL when an error occurred.
Warning:
No checks are performed on the returned pointer.
Parameters:
entity_pointera pointer to a DXF IDBUFFER object.

Definition at line 1055 of file idbuffer.c.

References _, DXF_DEBUG_BEGIN, DXF_DEBUG_END, and dxf_idbuffer_entity_pointer_struct::soft_pointer.

Referenced by dxf_idbuffer_write().

DxfIdbufferEntityPointer* dxf_idbuffer_entity_pointer_set_soft_pointer ( DxfIdbufferEntityPointer entity_pointer,
char *  soft_pointer 
)

Set the pointer to the soft_pointer for a DXF DxfIdbufferEntityPointer object.

Returns:
a pointer to entity_pointer when successful, or NULL when an error occurred.
Parameters:
entity_pointera pointer to a DXF DxfIdbufferEntityPointer object.
soft_pointera string containing the pointer to the soft_pointer for the entity.

Definition at line 1094 of file idbuffer.c.

References _, DXF_DEBUG_BEGIN, DXF_DEBUG_END, and dxf_idbuffer_entity_pointer_struct::soft_pointer.

DxfIdbufferEntityPointer* dxf_idbuffer_entity_pointer_get_next ( DxfIdbufferEntityPointer entity_pointer)

Get the pointer to the next DxfIdbufferEntityPointer object from a DXF DxfIdbufferEntityPointer object.

Returns:
pointer to the next DxfIdbufferEntityPointer object.
Warning:
No checks are performed on the returned pointer.
Parameters:
entity_pointera pointer to a DXF DxfIdbufferEntityPointer object.

Definition at line 1138 of file idbuffer.c.

References _, DXF_DEBUG_BEGIN, DXF_DEBUG_END, and dxf_idbuffer_entity_pointer_struct::next.

Referenced by dxf_idbuffer_write().

DxfIdbufferEntityPointer* dxf_idbuffer_entity_pointer_set_next ( DxfIdbufferEntityPointer entity_pointer,
DxfIdbufferEntityPointer next 
)

Set the pointer to the next DxfIdbufferEntityPointer object for a DXF DxfIdbufferEntityPointer object.

Returns:
a pointer to entity_pointer when successful, or NULL when an error occurred.
Parameters:
entity_pointera pointer to a DXF DxfIdbufferEntityPointer object.
nexta pointer to the next DxfIdbufferEntityPointer object for the DxfIdbufferEntityPointer object.

Definition at line 1177 of file idbuffer.c.

References _, DXF_DEBUG_BEGIN, DXF_DEBUG_END, and dxf_idbuffer_entity_pointer_struct::next.

DxfIdbufferEntityPointer* dxf_idbuffer_entity_pointer_get_last ( DxfIdbufferEntityPointer entity_pointer)

Get the pointer to the last DxfIdbufferEntityPointer object from a linked list of DXF DxfIdbufferEntityPointer objects.

Returns:
pointer to the last DxfIdbufferEntityPointer object.
Warning:
No checks are performed on the returned pointer.
Parameters:
entity_pointera pointer to a DXF DxfIdbufferEntityPointer object.

Definition at line 1222 of file idbuffer.c.

References _, DXF_DEBUG_BEGIN, DXF_DEBUG_END, and dxf_idbuffer_entity_pointer_struct::next.