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

appid.c File Reference

Functions for a DXF application identity symbol table entry (APPID). More...

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

Go to the source code of this file.

Functions

DxfAppiddxf_appid_new ()
 Allocate memory for a DXF APPID symbol table entry.
DxfAppiddxf_appid_init (DxfAppid *appid)
 Allocate memory and initialize data fields in a DXF APPID symbol table entry.
DxfAppiddxf_appid_read (DxfFile *fp, DxfAppid *appid)
 Read data from a DXF file into a DXF APPID symbol table entry.
int dxf_appid_write (DxfFile *fp, DxfAppid *appid)
 Write DXF output to a file for a DXF APPID symbol table entry.
int dxf_appid_free (DxfAppid *appid)
 Free the allocated memory for a DXF APPID and all it's data fields.
void dxf_appid_free_chain (DxfAppid *appids)
 Free the allocated memory for a chain of DXF APPID symbol table entries and all their data fields.
int dxf_appid_get_id_code (DxfAppid *appid)
 Get the ID code from this DXF APPID symbol table entry.
DxfAppiddxf_appid_set_id_code (DxfAppid *appid, int id_code)
 Set the ID code for this DXF APPID symbol table entry.
char * dxf_appid_get_application_name (DxfAppid *appid)
 Get the application name from this DXF APPID symbol table entry.
DxfAppiddxf_appid_set_application_name (DxfAppid *appid, char *name)
 Set the application name for this DXF APPID symbol table entry.
int dxf_appid_get_flag (DxfAppid *appid)
 Get the flag value from this DXF APPID symbol table entry.
DxfAppiddxf_appid_set_flag (DxfAppid *appid, int flag)
 Set the flag for this DXF APPID symbol table entry.
int dxf_appid_is_no_save_xdata (DxfAppid *appid)
 Test if xdata associated with this DXF APPID is not to be written when SAVEASR12 is performed.
int dxf_appid_is_xreferenced (DxfAppid *appid)
 Test if this DXF APPID is externally dependent on an xref.
int dxf_appid_is_xresolved (DxfAppid *appid)
 Test if this DXF APPID is externally dependent on a xref and has been successfully resolved.
int dxf_appid_is_referenced (DxfAppid *appid)
 Test if this DXF APPID is internally referenced by an entity.
char * dxf_appid_get_dictionary_owner_soft (DxfAppid *appid)
 Get the soft pointer to the dictionary owner from this DXF APPID symbol table entry.
DxfAppiddxf_appid_set_dictionary_owner_soft (DxfAppid *appid, char *dictionary_owner_soft)
 Set the pointer to the dictionary_owner_soft for a DXF APPID entity.
char * dxf_appid_get_dictionary_owner_hard (DxfAppid *appid)
 Get the hard pointer to the dictionary owner from this DXF APPID symbol table entry.
DxfAppiddxf_appid_set_dictionary_owner_hard (DxfAppid *appid, char *dictionary_owner_hard)
 Set the pointer to the dictionary_owner_hard for a DXF APPID entity.
DxfAppiddxf_appid_get_next (DxfAppid *appid)
 Get the pointer to the next APPID entity from a DXF APPID entity.
DxfAppiddxf_appid_set_next (DxfAppid *appid, DxfAppid *next)
 Set the pointer to the next APPID for a DXF APPID entity.
DxfAppiddxf_appid_get_last (DxfAppid *appid)
 Get the pointer to the last APPID entity from a linked list of DXF APPID entities.

Detailed Description

Functions for a DXF application identity symbol table entry (APPID).

Author:
Copyright (C) 2009, 2011, 2012, 2014, 2015, 2016, 2017 by Bert Timmerman <bert.timmerman@xs4all.nl>.
Copyright (C) 2010 by Luis Matos <gass@otiliamatos.ath.cx>
Version:
The APPID table was introduced in DXF R12.

A DXF APPID entity contains data concerning the application registered with the drawing involved.
It is a table entry in the TABLES section of the DXF file.
These table entries maintain a set of names for all applications registered with a drawing.

Warning:
dxf_appid_new(), dxf_appid_init(), dxf_appid_read() and dxf_appid_free() are backward compatible with versions R10 and R11 to allow for reading DXF data generated with other CAD software.
When writing DXF data to file with versions before DXF R12 a warning message is given.
Version:
According to DXF R10 (backward compatibility).
According to DXF R11 (backward compatibility).
According to DXF R12.
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 appid.c.


Function Documentation

DxfAppid* dxf_appid_new ( )

Allocate memory for a DXF APPID symbol table entry.

Fill the memory contents with zeros.

Definition at line 68 of file appid.c.

References _, DXF_DEBUG_BEGIN, and DXF_DEBUG_END.

Referenced by dxf_appid_init(), and dxf_appid_read().

DxfAppid* dxf_appid_init ( DxfAppid appid)

Allocate memory and initialize data fields in a DXF APPID symbol table entry.

Returns:
NULL when no memory was allocated, a pointer to the allocated memory when succesful.
Parameters:
appida pointer to a DXF APPID symbol table entry.

Definition at line 106 of file appid.c.

References _, dxf_appid_new(), dxf_appid_set_application_name(), dxf_appid_set_dictionary_owner_hard(), dxf_appid_set_dictionary_owner_soft(), dxf_appid_set_flag(), dxf_appid_set_id_code(), dxf_appid_set_next(), DXF_DEBUG_BEGIN, and DXF_DEBUG_END.

Referenced by dxf_appid_read().

Here is the call graph for this function:

DxfAppid* dxf_appid_read ( DxfFile fp,
DxfAppid appid 
)

Read data from a DXF file into a DXF APPID symbol table entry.

The last line read from file contained the string "APPID".
Now follows some data for the APPID, to be terminated with a " 0" string announcing the following table record, or the end of the TABLE section marker ENDTAB.
While parsing the DXF file store data in appid.

Returns:
a pointer to appid.
Parameters:
fpa DXF file pointer to an input file (or device).
appida pointer to a DXF APPID symbol table entry.

Definition at line 156 of file appid.c.

References _, dxf_appid_struct::application_name, dxf_appid_struct::dictionary_owner_hard, dxf_appid_struct::dictionary_owner_soft, dxf_appid_init(), dxf_appid_new(), DXF_DEBUG_BEGIN, DXF_DEBUG_END, dxf_file_struct::filename, dxf_appid_struct::flag, dxf_file_struct::fp, dxf_appid_struct::id_code, and dxf_file_struct::line_number.

Here is the call graph for this function:

int dxf_appid_write ( DxfFile fp,
DxfAppid appid 
)

Write DXF output to a file for a DXF APPID symbol table entry.

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:
fpa DXF file pointer to an output file (or device).
appida pointer to a DXF APPID symbol table entry.

Definition at line 264 of file appid.c.

References _, dxf_file_struct::acad_version_number, AutoCAD_12, AutoCAD_13, AutoCAD_14, dxf_appid_get_application_name(), dxf_appid_get_dictionary_owner_hard(), dxf_appid_get_dictionary_owner_soft(), dxf_appid_get_flag(), dxf_appid_get_id_code(), DXF_DEBUG_BEGIN, DXF_DEBUG_END, and dxf_file_struct::fp.

Here is the call graph for this function:

int dxf_appid_free ( DxfAppid appid)

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

Returns:
EXIT_SUCCESS when done, or EXIT_FAILURE when an error occurred.
Parameters:
appida pointer to a DXF APPID symbol table entry.

Definition at line 369 of file appid.c.

References _, dxf_appid_struct::application_name, dxf_appid_struct::dictionary_owner_hard, dxf_appid_struct::dictionary_owner_soft, DXF_DEBUG_BEGIN, DXF_DEBUG_END, and dxf_appid_struct::next.

Referenced by dxf_appid_free_chain().

void dxf_appid_free_chain ( DxfAppid appids)

Free the allocated memory for a chain of DXF APPID symbol table entries and all their data fields.

Parameters:
appidsa pointer to a chain of DXF APPID symbol table entries.

Definition at line 409 of file appid.c.

References _, dxf_appid_free(), DXF_DEBUG_BEGIN, DXF_DEBUG_END, and dxf_appid_struct::next.

Here is the call graph for this function:

int dxf_appid_get_id_code ( DxfAppid appid)

Get the ID code from this DXF APPID symbol table entry.

Returns:
ID code.
Parameters:
appida pointer to a DXF APPID symbol table entry.

Definition at line 443 of file appid.c.

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

Referenced by dxf_appid_write().

DxfAppid* dxf_appid_set_id_code ( DxfAppid appid,
int  id_code 
)

Set the ID code for this DXF APPID symbol table entry.

Parameters:
appida pointer to a DXF APPID symbol table entry.
id_codeIdentification number for the entity.
This is to be an unique (sequential) number in the DXF file.

Definition at line 471 of file appid.c.

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

Referenced by dxf_appid_init().

char* dxf_appid_get_application_name ( DxfAppid appid)

Get the application name from this DXF APPID symbol table entry.

Returns:
application name.
Parameters:
appida pointer to a DXF APPID symbol table entry.

Definition at line 507 of file appid.c.

References _, dxf_appid_struct::application_name, DXF_DEBUG_BEGIN, and DXF_DEBUG_END.

Referenced by dxf_appid_write().

DxfAppid* dxf_appid_set_application_name ( DxfAppid appid,
char *  name 
)

Set the application name for this DXF APPID symbol table entry.

Returns:
a pointer to the DXF APPID symbol table entry if successful, a NULL when an error occurred.
Warning:
No testing for the contents of the application_name member of the DxfAppid struct is performed.
The passed name variable is not freed by this function and needs to be freed by the caller.
Parameters:
appida pointer to a DXF APPID symbol table entry.
nameapplication name.

Definition at line 545 of file appid.c.

References _, dxf_appid_struct::application_name, DXF_DEBUG_BEGIN, and DXF_DEBUG_END.

Referenced by dxf_appid_init().

int dxf_appid_get_flag ( DxfAppid appid)

Get the flag value from this DXF APPID symbol table entry.

Returns:
flag value.
Parameters:
appida pointer to a DXF APPID symbol table entry.

Definition at line 585 of file appid.c.

References _, DXF_DEBUG_BEGIN, DXF_DEBUG_END, and dxf_appid_struct::flag.

Referenced by dxf_appid_write().

DxfAppid* dxf_appid_set_flag ( DxfAppid appid,
int  flag 
)

Set the flag for this DXF APPID symbol table entry.

Parameters:
appida pointer to a DXF APPID symbol table entry.
flagthe flag value to be set.

Definition at line 613 of file appid.c.

References _, DXF_DEBUG_BEGIN, DXF_DEBUG_END, and dxf_appid_struct::flag.

Referenced by dxf_appid_init().

int dxf_appid_is_no_save_xdata ( DxfAppid appid)

Test if xdata associated with this DXF APPID is not to be written when SAVEASR12 is performed.

Returns:
TRUE when not to be written, or FALSE when to be written.
Parameters:
appida pointer to a DXF APPID symbol table entry.

Definition at line 648 of file appid.c.

References _, DXF_CHECK_BIT, DXF_DEBUG_BEGIN, DXF_DEBUG_END, and dxf_appid_struct::flag.

int dxf_appid_is_xreferenced ( DxfAppid appid)

Test if this DXF APPID is externally dependent on an xref.

Returns:
TRUE when APPID is externally dependent on an xref, or FALSE when APPID is not externally dependent on an xref.
Parameters:
appida pointer to a DXF APPID symbol table entry.

Definition at line 679 of file appid.c.

References _, DXF_CHECK_BIT, DXF_DEBUG_BEGIN, DXF_DEBUG_END, and dxf_appid_struct::flag.

int dxf_appid_is_xresolved ( DxfAppid appid)

Test if this DXF APPID is externally dependent on a xref and has been successfully resolved.

Returns:
TRUE when APPID is externally dependent on a xref and has been successfully resolved, or FALSE when APPID is not externally dependent on a xref and has not been successfully resolved.
Parameters:
appida pointer to a DXF APPID symbol table entry.

Definition at line 712 of file appid.c.

References _, DXF_CHECK_BIT, DXF_DEBUG_BEGIN, DXF_DEBUG_END, and dxf_appid_struct::flag.

int dxf_appid_is_referenced ( DxfAppid appid)

Test if this DXF APPID is internally referenced by an entity.

Returns:
TRUE when APPID is internally referenced by an entity, or FALSE when APPID is not internally referenced by an entity.
Parameters:
appida pointer to a DXF APPID symbol table entry.

Definition at line 745 of file appid.c.

References _, DXF_CHECK_BIT, DXF_DEBUG_BEGIN, DXF_DEBUG_END, and dxf_appid_struct::flag.

char* dxf_appid_get_dictionary_owner_soft ( DxfAppid appid)

Get the soft pointer to the dictionary owner from this DXF APPID symbol table entry.

Returns:
soft pointer to the dictionary owner.
Warning:
No checks are performed on the returned pointer (string).
Parameters:
appida pointer to a DXF APPID symbol table entry.

Definition at line 778 of file appid.c.

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

Referenced by dxf_appid_write().

DxfAppid* dxf_appid_set_dictionary_owner_soft ( DxfAppid appid,
char *  dictionary_owner_soft 
)

Set the pointer to the dictionary_owner_soft for a DXF APPID entity.

Parameters:
appida pointer to a DXF APPID entity.
dictionary_owner_softa string containing the pointer to the dictionary_owner_soft for the entity.

Definition at line 814 of file appid.c.

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

Referenced by dxf_appid_init().

char* dxf_appid_get_dictionary_owner_hard ( DxfAppid appid)

Get the hard pointer to the dictionary owner from this DXF APPID symbol table entry.

Returns:
hard pointer to the dictionary owner.
Warning:
No checks are performed on the returned pointer (string).
Parameters:
appida pointer to a DXF APPID symbol table entry.

Definition at line 858 of file appid.c.

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

Referenced by dxf_appid_write().

DxfAppid* dxf_appid_set_dictionary_owner_hard ( DxfAppid appid,
char *  dictionary_owner_hard 
)

Set the pointer to the dictionary_owner_hard for a DXF APPID entity.

Parameters:
appida pointer to a DXF APPID entity.
dictionary_owner_harda string containing the pointer to the dictionary_owner_hard for the entity.

Definition at line 894 of file appid.c.

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

Referenced by dxf_appid_init().

DxfAppid* dxf_appid_get_next ( DxfAppid appid)

Get the pointer to the next APPID entity from a DXF APPID entity.

Returns:
pointer to the next APPID entity.
Warning:
No checks are performed on the returned pointer.
Parameters:
appida pointer to a DXF APPID entity.

Definition at line 938 of file appid.c.

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

DxfAppid* dxf_appid_set_next ( DxfAppid appid,
DxfAppid next 
)

Set the pointer to the next APPID for a DXF APPID entity.

Parameters:
appida pointer to a DXF APPID entity.
nexta pointer to the next APPID for the entity.

Definition at line 974 of file appid.c.

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

Referenced by dxf_appid_init().

DxfAppid* dxf_appid_get_last ( DxfAppid appid)

Get the pointer to the last APPID entity from a linked list of DXF APPID entities.

Returns:
pointer to the last APPID entity.
Warning:
No checks are performed on the returned pointer.
Parameters:
appida pointer to a DXF APPID entity.

Definition at line 1017 of file appid.c.

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