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

dictionary.c File Reference

Functions for a DXF dictionary object (DICTIONARY). More...

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

Go to the source code of this file.

Functions

DxfDictionarydxf_dictionary_new ()
 Allocate memory for a DXF DICTIONARY object.
DxfDictionarydxf_dictionary_init (DxfDictionary *dictionary)
 Allocate memory and initialize data fields in a DICTIONARY object.
DxfDictionarydxf_dictionary_read (DxfFile *fp, DxfDictionary *dictionary)
 Read data from a DXF file into a DXF DICTIONARY object.
int dxf_dictionary_write (DxfFile *fp, DxfDictionary *dictionary)
 Write DXF output to a file for a DXF DICTIONARY object.
int dxf_dictionary_free (DxfDictionary *dictionary)
 Free the allocated memory for a DXF DICTIONARY and all it's data fields.
void dxf_dictionary_free_chain (DxfDictionary *dictionaries)
 Free the allocated memory for a chain of DXF DICTIONARY objects and all their data fields.
int dxf_dictionary_get_id_code (DxfDictionary *dictionary)
 Get the ID code from a DXF DICTIONARY object.
DxfDictionarydxf_dictionary_set_id_code (DxfDictionary *dictionary, int id_code)
 Set the ID code for a DXF DICTIONARY object.
char * dxf_dictionary_get_dictionary_owner_soft (DxfDictionary *dictionary)
 Get the soft pointer to the dictionary owner from a DXF DICTIONARY object.
DxfDictionarydxf_dictionary_set_dictionary_owner_soft (DxfDictionary *dictionary, char *dictionary_owner_soft)
 Set the pointer to the dictionary_owner_soft for a DXF DICTIONARY object.
char * dxf_dictionary_get_dictionary_owner_hard (DxfDictionary *dictionary)
 Get the hard pointer to the dictionary owner from a DXF DICTIONARY object.
DxfDictionarydxf_dictionary_set_dictionary_owner_hard (DxfDictionary *dictionary, char *dictionary_owner_hard)
 Set the pointer to the dictionary_owner_hard for a DXF DICTIONARY object.
char * dxf_dictionary_get_entry_name (DxfDictionary *dictionary)
 Get the entry name from a DXF DICTIONARY object.
DxfDictionarydxf_dictionary_set_entry_name (DxfDictionary *dictionary, char *entry_name)
 Set the entry name for a DXF DICTIONARY object.
char * dxf_dictionary_get_entry_object_handle (DxfDictionary *dictionary)
 Get the entry object handle from a DXF DICTIONARY object.
DxfDictionarydxf_dictionary_set_entry_object_handle (DxfDictionary *dictionary, char *entry_object_handle)
 Set the entry object handle for a DXF DICTIONARY object.
DxfDictionarydxf_dictionary_get_next (DxfDictionary *dictionary)
 Get the pointer to the next DICTIONARY object from a DXF DICTIONARY object.
DxfDictionarydxf_dictionary_set_next (DxfDictionary *dictionary, DxfDictionary *next)
 Set the pointer to the next DICTIONARY object for a DXF DICTIONARY object.
DxfDictionarydxf_dictionary_get_last (DxfDictionary *dictionary)
 Get the pointer to the last DICTIONARY object from a linked list of DXF DICTIONARY objects.

Detailed Description

Functions for a DXF dictionary object (DICTIONARY).

Author:
Copyright (C) 2015, 2016, 2017 by Bert Timmerman <bert.timmerman@xs4all.nl>.
Version:
The DICTIONARY object was introduced in DXF R13.
According to DXF R10 (backward compatibility).
According to DXF R11 (backward compatibility).
According to DXF R12 (backward compatibility).
According to DXF R13.
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 dictionary.c.


Function Documentation

DxfDictionary* dxf_dictionary_new ( )

Allocate memory for a DXF DICTIONARY object.

Fill the memory contents with zeros.

Definition at line 52 of file dictionary.c.

References _, DXF_DEBUG_BEGIN, and DXF_DEBUG_END.

Referenced by dxf_dictionary_init(), and dxf_dictionary_read().

DxfDictionary* dxf_dictionary_init ( DxfDictionary dictionary)

Allocate memory and initialize data fields in a DICTIONARY object.

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

Definition at line 90 of file dictionary.c.

References _, DXF_DEBUG_BEGIN, DXF_DEBUG_END, dxf_dictionary_new(), dxf_dictionary_set_dictionary_owner_hard(), dxf_dictionary_set_dictionary_owner_soft(), dxf_dictionary_set_entry_name(), dxf_dictionary_set_entry_object_handle(), dxf_dictionary_set_id_code(), and dxf_dictionary_set_next().

Referenced by dxf_dictionary_read().

Here is the call graph for this function:

DxfDictionary* dxf_dictionary_read ( DxfFile fp,
DxfDictionary dictionary 
)

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

The last line read from file contained the string "DICTIONARY".
Now follows some data for the DICTIONARY object, to be terminated with a " 0" string announcing the following object.
While parsing the DXF file store data in dictionary.

Returns:
a pointer to dictionary.
Parameters:
fpDXF file pointer to an input file (or device).
dictionarya pointer to the DXF DICTIONARY object.

Definition at line 138 of file dictionary.c.

References _, dxf_file_struct::acad_version_number, AutoCAD_13, dxf_dictionary_struct::dictionary_owner_hard, dxf_dictionary_struct::dictionary_owner_soft, DXF_DEBUG_BEGIN, DXF_DEBUG_END, dxf_dictionary_init(), dxf_dictionary_new(), dxf_dictionary_struct::entry_name, dxf_dictionary_struct::entry_object_handle, dxf_file_struct::filename, dxf_file_struct::fp, dxf_dictionary_struct::id_code, and dxf_file_struct::line_number.

Here is the call graph for this function:

int dxf_dictionary_write ( DxfFile fp,
DxfDictionary dictionary 
)

Write DXF output to a file for a DXF DICTIONARY 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).
dictionarya pointer to the DXF DICTIONARY object.

Definition at line 268 of file dictionary.c.

References _, dxf_file_struct::acad_version_number, AutoCAD_13, AutoCAD_14, dxf_dictionary_struct::dictionary_owner_hard, DXF_DEBUG_BEGIN, DXF_DEBUG_END, dxf_dictionary_get_dictionary_owner_hard(), dxf_dictionary_get_dictionary_owner_soft(), dxf_dictionary_get_entry_name(), dxf_dictionary_get_entry_object_handle(), dxf_dictionary_get_id_code(), and dxf_file_struct::fp.

Here is the call graph for this function:

int dxf_dictionary_free ( DxfDictionary dictionary)

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

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

Definition at line 368 of file dictionary.c.

References _, DXF_DEBUG_BEGIN, DXF_DEBUG_END, dxf_dictionary_get_dictionary_owner_hard(), dxf_dictionary_get_dictionary_owner_soft(), dxf_dictionary_get_entry_name(), dxf_dictionary_get_entry_object_handle(), and dxf_dictionary_struct::next.

Referenced by dxf_dictionary_free_chain().

Here is the call graph for this function:

void dxf_dictionary_free_chain ( DxfDictionary dictionaries)

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

Parameters:
dictionariesa pointer to the chain of DXF DICTIONARY objects.

Definition at line 411 of file dictionary.c.

References _, DXF_DEBUG_BEGIN, DXF_DEBUG_END, dxf_dictionary_free(), and dxf_dictionary_struct::next.

Here is the call graph for this function:

int dxf_dictionary_get_id_code ( DxfDictionary dictionary)

Get the ID code from a DXF DICTIONARY object.

Returns:
ID code.
Parameters:
dictionarya pointer to a DXF DICTIONARY object.

Definition at line 444 of file dictionary.c.

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

Referenced by dxf_dictionary_write().

DxfDictionary* dxf_dictionary_set_id_code ( DxfDictionary dictionary,
int  id_code 
)

Set the ID code for a DXF DICTIONARY object.

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

Definition at line 479 of file dictionary.c.

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

Referenced by dxf_dictionary_init().

char* dxf_dictionary_get_dictionary_owner_soft ( DxfDictionary dictionary)

Get the soft pointer to the dictionary owner from a DXF DICTIONARY object.

Returns:
soft pointer to the dictionary owner.
Warning:
No checks are performed on the returned pointer (string).
Parameters:
dictionarya pointer to a DXF DICTIONARY object.

Definition at line 524 of file dictionary.c.

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

Referenced by dxf_dictionary_free(), and dxf_dictionary_write().

DxfDictionary* dxf_dictionary_set_dictionary_owner_soft ( DxfDictionary dictionary,
char *  dictionary_owner_soft 
)

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

Parameters:
dictionarya pointer to a DXF DICTIONARY object.
dictionary_owner_softa string containing the pointer to the dictionary_owner_soft for the object.

Definition at line 560 of file dictionary.c.

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

Referenced by dxf_dictionary_init().

char* dxf_dictionary_get_dictionary_owner_hard ( DxfDictionary dictionary)

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

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

Definition at line 604 of file dictionary.c.

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

Referenced by dxf_dictionary_free(), and dxf_dictionary_write().

DxfDictionary* dxf_dictionary_set_dictionary_owner_hard ( DxfDictionary dictionary,
char *  dictionary_owner_hard 
)

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

Parameters:
dictionarya pointer to a DXF DICTIONARY object.
dictionary_owner_harda string containing the pointer to the dictionary_owner_hard for the entity.

Definition at line 640 of file dictionary.c.

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

Referenced by dxf_dictionary_init().

char* dxf_dictionary_get_entry_name ( DxfDictionary dictionary)

Get the entry name from a DXF DICTIONARY object.

Returns:
entry name when sucessful, NULL when an error occurred.
Parameters:
dictionarya pointer to a DXF DICTIONARY object.

Definition at line 681 of file dictionary.c.

References _, DXF_DEBUG_BEGIN, DXF_DEBUG_END, and dxf_dictionary_struct::entry_name.

Referenced by dxf_dictionary_free(), and dxf_dictionary_write().

DxfDictionary* dxf_dictionary_set_entry_name ( DxfDictionary dictionary,
char *  entry_name 
)

Set the entry name for a DXF DICTIONARY object.

Parameters:
dictionarya pointer to a DXF DICTIONARY object.
entry_namea string containing the entry name for the entity.

Definition at line 716 of file dictionary.c.

References _, DXF_DEBUG_BEGIN, DXF_DEBUG_END, and dxf_dictionary_struct::entry_name.

Referenced by dxf_dictionary_init().

char* dxf_dictionary_get_entry_object_handle ( DxfDictionary dictionary)

Get the entry object handle from a DXF DICTIONARY object.

Returns:
entry object handle when sucessful, NULL when an error occurred.
Parameters:
dictionarya pointer to a DXF DICTIONARY object.

Definition at line 756 of file dictionary.c.

References _, DXF_DEBUG_BEGIN, DXF_DEBUG_END, and dxf_dictionary_struct::entry_object_handle.

Referenced by dxf_dictionary_free(), and dxf_dictionary_write().

DxfDictionary* dxf_dictionary_set_entry_object_handle ( DxfDictionary dictionary,
char *  entry_object_handle 
)

Set the entry object handle for a DXF DICTIONARY object.

Parameters:
dictionarya pointer to a DXF DICTIONARY object.
entry_object_handlea string containing the entry object handle for the entity.

Definition at line 791 of file dictionary.c.

References _, DXF_DEBUG_BEGIN, DXF_DEBUG_END, and dxf_dictionary_struct::entry_object_handle.

Referenced by dxf_dictionary_init().

DxfDictionary* dxf_dictionary_get_next ( DxfDictionary dictionary)

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

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

Definition at line 835 of file dictionary.c.

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

DxfDictionary* dxf_dictionary_set_next ( DxfDictionary dictionary,
DxfDictionary next 
)

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

Parameters:
dictionarya pointer to a DXF DICTIONARY object.
nexta pointer to the next DICTIONARY object for the object.

Definition at line 871 of file dictionary.c.

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

Referenced by dxf_dictionary_init().

DxfDictionary* dxf_dictionary_get_last ( DxfDictionary dictionary)

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

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

Definition at line 915 of file dictionary.c.

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