libDXF 0.0.1
A library with DXF related functions written in C.
Data Structures | Typedefs | Functions

object_ptr.h File Reference

Header file for a DXF object_ptr object (OBJECT_PTR). More...

#include "global.h"
Include dependency graph for object_ptr.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  dxf_object_ptr_struct
 DXF definition of an AutoCAD object_ptr object (OBJECT_PTR). More...

Typedefs

typedef struct
dxf_object_ptr_struct 
DxfObjectPtr
 DXF definition of an AutoCAD object_ptr object (OBJECT_PTR).

Functions

DxfObjectPtrdxf_object_ptr_new ()
 Allocate memory for a DxfObjectPtr.
DxfObjectPtrdxf_object_ptr_init (DxfObjectPtr *object_ptr)
 Allocate memory and initialize data fields in a OBJECT_PTR object.
DxfObjectPtrdxf_object_ptr_read (DxfFile *fp, DxfObjectPtr *object_ptr)
 Read data from a DXF file into a DXF OBJECT_PTR object.
int dxf_object_ptr_write (DxfFile *fp, DxfObjectPtr *object_ptr)
 Write DXF output to a file for a DXF OBJECT_PTR object.
int dxf_object_ptr_free (DxfObjectPtr *object_ptr)
 Free the allocated memory for a DXF OBJECT_PTR and all it's data fields.
void dxf_object_ptr_free_chain (DxfObjectPtr *objectptrs)
 Free the allocated memory for a chain of DXF OBJECT_PTR objects and all their data fields.
int dxf_object_ptr_get_id_code (DxfObjectPtr *object_ptr)
 Get the id_code from a DXF OBJECT_PTR object.
DxfObjectPtrdxf_object_ptr_set_id_code (DxfObjectPtr *object_ptr, int id_code)
 Set the id_code for a DXF OBJECT_PTR object.
char * dxf_object_ptr_get_dictionary_owner_soft (DxfObjectPtr *object_ptr)
 Get the pointer to the dictionary_owner_soft from a DXF OBJECT_PTR object.
DxfObjectPtrdxf_object_ptr_set_dictionary_owner_soft (DxfObjectPtr *object_ptr, char *dictionary_owner_soft)
 Set the pointer to the dictionary_owner_soft for a DXF OBJECT_PTR object.
char * dxf_object_ptr_get_dictionary_owner_hard (DxfObjectPtr *object_ptr)
 Get the hard pointer to the dictionary owner from a DXF OBJECT_PTR object.
DxfObjectPtrdxf_object_ptr_set_dictionary_owner_hard (DxfObjectPtr *object_ptr, char *dictionary_owner_hard)
 Set the pointer to the dictionary_owner_hard for a DXF OBJECT_PTR object.
DxfObjectPtrdxf_object_ptr_get_next (DxfObjectPtr *object_ptr)
 Get the pointer to the next OBJECT_PTR object from a DXF OBJECT_PTR object.
DxfObjectPtrdxf_object_ptr_set_next (DxfObjectPtr *object_ptr, DxfObjectPtr *next)
 Set the pointer to the next OBJECT_PTR object for a DXF OBJECT_PTR object.
DxfObjectPtrdxf_object_ptr_get_last (DxfObjectPtr *object_ptr)
 Get the pointer to the last OBJECT_PTR object from a linked list of DXF OBJECT_PTR objects.

Detailed Description

Header file for a DXF object_ptr object (OBJECT_PTR).

Author:
Copyright (C) 2015, 2016, 2017 by Bert Timmerman <bert.timmerman@xs4all.nl>.
Since:
The OBJECT_PTR 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 object_ptr.h.


Typedef Documentation

DXF definition of an AutoCAD object_ptr object (OBJECT_PTR).


Function Documentation

DxfObjectPtr* dxf_object_ptr_new ( )

Allocate memory for a DxfObjectPtr.

Fill the memory contents with zeros.

Definition at line 52 of file object_ptr.c.

References _, DXF_DEBUG_BEGIN, and DXF_DEBUG_END.

Referenced by dxf_object_ptr_init(), and dxf_object_ptr_read().

DxfObjectPtr* dxf_object_ptr_init ( DxfObjectPtr object_ptr)

Allocate memory and initialize data fields in a OBJECT_PTR object.

Returns:
NULL when no memory was allocated, a pointer to the allocated memory when succesful.
Parameters:
object_ptra pointer to the DXF OBJECT_PTR object.

Definition at line 90 of file object_ptr.c.

References _, dxf_object_ptr_struct::dictionary_owner_hard, dxf_object_ptr_struct::dictionary_owner_soft, DXF_DEBUG_BEGIN, DXF_DEBUG_END, dxf_object_ptr_new(), dxf_object_ptr_struct::id_code, dxf_char_struct::length, dxf_object_ptr_struct::next, dxf_char_struct::next, dxf_char_struct::value, and dxf_object_ptr_struct::xdata.

Referenced by dxf_object_ptr_read().

Here is the call graph for this function:

DxfObjectPtr* dxf_object_ptr_read ( DxfFile fp,
DxfObjectPtr object_ptr 
)

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

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

Returns:
a pointer to object_ptr.

Todo:
Set pointer to xdata->next for following xdata object.

Parameters:
fpDXF file pointer to an input file (or device).
object_ptra pointer to the DXF OBJECT_PTR object.

Definition at line 140 of file object_ptr.c.

References _, dxf_file_struct::acad_version_number, AutoCAD_14, dxf_object_ptr_struct::dictionary_owner_hard, dxf_object_ptr_struct::dictionary_owner_soft, DXF_DEBUG_BEGIN, DXF_DEBUG_END, dxf_object_ptr_init(), dxf_object_ptr_new(), dxf_file_struct::filename, dxf_file_struct::fp, dxf_object_ptr_struct::id_code, dxf_char_struct::length, dxf_file_struct::line_number, dxf_char_struct::value, and dxf_object_ptr_struct::xdata.

Here is the call graph for this function:

int dxf_object_ptr_write ( DxfFile fp,
DxfObjectPtr object_ptr 
)

Write DXF output to a file for a DXF OBJECT_PTR 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.
Todo:
Write the complete linked list of char values.

Parameters:
fpDXF file pointer to an output file (or device).
object_ptra pointer to the DXF OBJECT_PTR object.

Definition at line 251 of file object_ptr.c.

References _, dxf_file_struct::acad_version_number, AutoCAD_14, dxf_object_ptr_struct::dictionary_owner_hard, dxf_object_ptr_struct::dictionary_owner_soft, DXF_DEBUG_BEGIN, DXF_DEBUG_END, dxf_file_struct::fp, dxf_object_ptr_struct::id_code, dxf_char_struct::value, and dxf_object_ptr_struct::xdata.

int dxf_object_ptr_free ( DxfObjectPtr object_ptr)

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

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

Definition at line 341 of file object_ptr.c.

References _, dxf_object_ptr_struct::dictionary_owner_hard, dxf_object_ptr_struct::dictionary_owner_soft, DXF_DEBUG_BEGIN, DXF_DEBUG_END, dxf_char_struct::next, dxf_object_ptr_struct::next, dxf_char_struct::value, and dxf_object_ptr_struct::xdata.

Referenced by dxf_object_ptr_free_chain().

void dxf_object_ptr_free_chain ( DxfObjectPtr objectptrs)

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

Parameters:
objectptrsa pointer to the chain of DXF OBJECT_PTR objects.

Definition at line 396 of file object_ptr.c.

References _, DXF_DEBUG_BEGIN, DXF_DEBUG_END, dxf_object_ptr_free(), and dxf_object_ptr_struct::next.

Here is the call graph for this function:

int dxf_object_ptr_get_id_code ( DxfObjectPtr object_ptr)

Get the id_code from a DXF OBJECT_PTR object.

Returns:
id_code.
Parameters:
object_ptra pointer to a DXF OBJECT_PTR object.

Definition at line 429 of file object_ptr.c.

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

DxfObjectPtr* dxf_object_ptr_set_id_code ( DxfObjectPtr object_ptr,
int  id_code 
)

Set the id_code for a DXF OBJECT_PTR object.

Parameters:
object_ptra pointer to a DXF OBJECT_PTR object.
id_codeIdentification number for the object.
This is to be an unique (sequential) number in the DXF file.

Definition at line 464 of file object_ptr.c.

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

char* dxf_object_ptr_get_dictionary_owner_soft ( DxfObjectPtr object_ptr)

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

Returns:
pointer to the dictionary_owner_soft.
Warning:
No checks are performed on the returned pointer (string).
Parameters:
object_ptra pointer to a DXF OBJECT_PTR object.

Definition at line 509 of file object_ptr.c.

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

DxfObjectPtr* dxf_object_ptr_set_dictionary_owner_soft ( DxfObjectPtr object_ptr,
char *  dictionary_owner_soft 
)

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

Parameters:
object_ptra pointer to a DXF OBJECT_PTR object.
dictionary_owner_softa string containing the pointer to the dictionary_owner_soft for the object.

Definition at line 545 of file object_ptr.c.

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

char* dxf_object_ptr_get_dictionary_owner_hard ( DxfObjectPtr object_ptr)

Get the hard pointer to the dictionary owner from a DXF OBJECT_PTR object.

Returns:
hard pointer to the dictionary owner.
Warning:
No checks are performed on the returned pointer (string).
Parameters:
object_ptra pointer to a DXF OBJECT_PTR object.

Definition at line 589 of file object_ptr.c.

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

DxfObjectPtr* dxf_object_ptr_set_dictionary_owner_hard ( DxfObjectPtr object_ptr,
char *  dictionary_owner_hard 
)

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

Parameters:
object_ptra pointer to a DXF OBJECT_PTR object.
dictionary_owner_harda string containing the pointer to the dictionary_owner_hard for the object.

Definition at line 625 of file object_ptr.c.

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

DxfObjectPtr* dxf_object_ptr_get_next ( DxfObjectPtr object_ptr)

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

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

Definition at line 669 of file object_ptr.c.

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

DxfObjectPtr* dxf_object_ptr_set_next ( DxfObjectPtr object_ptr,
DxfObjectPtr next 
)

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

Parameters:
object_ptra pointer to a DXF OBJECT_PTR object.
nexta pointer to the next OBJECT_PTR object for the object.

Definition at line 705 of file object_ptr.c.

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

DxfObjectPtr* dxf_object_ptr_get_last ( DxfObjectPtr object_ptr)

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

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

Definition at line 749 of file object_ptr.c.

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