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

block_record.c File Reference

Functions for a DXF block record symbol table entry (BLOCK_RECORD). More...

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

Go to the source code of this file.

Functions

DxfBlockRecorddxf_block_record_new ()
 Allocate memory for a DXF BLOCK_RECORD symbol table entry.
DxfBlockRecorddxf_block_record_init (DxfBlockRecord *block_record)
 Allocate memory and initialize data fields in a DXF BLOCK_RECORD symbol table entry.
DxfBlockRecorddxf_block_record_read (DxfFile *fp, DxfBlockRecord *block_record)
 Read data from a DXF file into a DXF BLOCK_RECORD symbol table entry.
int dxf_block_record_write (DxfFile *fp, DxfBlockRecord *block_record)
 Write DXF output to a file for a DXF BLOCK_RECORD symbol table entry.
int dxf_block_record_free (DxfBlockRecord *block_record)
 Free the allocated memory for a DXF BLOCK_RECORD and all it's data fields.
void dxf_block_record_free_chain (DxfBlockRecord *block_records)
 Free the allocated memory for a chain of DXF BLOCK_RECORD entities and all their data fields.
int dxf_block_record_get_id_code (DxfBlockRecord *block_record)
 Get the ID code from a DXF BLOCK_RECORD symbol table entry.
DxfBlockRecorddxf_block_record_set_id_code (DxfBlockRecord *block_record, int id_code)
 Set the ID code for a DXF BLOCK_RECORD symbol table entry.
char * dxf_block_record_get_block_name (DxfBlockRecord *block_record)
 Get the block name from a DXF BLOCK_RECORD symbol table entry.
DxfBlockRecorddxf_block_record_set_block_name (DxfBlockRecord *block_record, char *block_name)
 Set the block name for a DXF BLOCK_RECORD symbol table entry.
int dxf_block_record_get_flag (DxfBlockRecord *block_record)
 Get the flag value from a DXF BLOCK_RECORD symbol table entry.
DxfBlockRecorddxf_block_record_set_flag (DxfBlockRecord *block_record, int flag)
 Set the flag value for a DXF BLOCK_RECORD symbol table entry.
int dxf_block_record_is_xreferenced (DxfBlockRecord *block_record)
 Test if this DXF BLOCK_RECORD is externally dependent on an xref.
int dxf_block_record_is_xresolved (DxfBlockRecord *block_record)
 Test if this DXF BLOCK_RECORD is externally dependent on a xref and has been successfully resolved.
int dxf_block_record_is_referenced (DxfBlockRecord *block_record)
 Test if this DXF BLOCK_RECORD is internally referenced by an entity.
char * dxf_block_record_get_dictionary_owner_soft (DxfBlockRecord *block_record)
 Get the soft pointer to the dictionary owner from a DXF BLOCK_RECORD symbol table entry.
DxfBlockRecorddxf_block_record_set_dictionary_owner_soft (DxfBlockRecord *block_record, char *dictionary_owner_soft)
 Set the pointer to the dictionary_owner_soft for a DXF BLOCK_RECORD symbol table entry.
char * dxf_block_record_get_dictionary_owner_hard (DxfBlockRecord *block_record)
 Get the hard pointer to the dictionary owner from a DXF BLOCK_RECORD symbol table entry.
DxfBlockRecorddxf_block_record_set_dictionary_owner_hard (DxfBlockRecord *block_record, char *dictionary_owner_hard)
 Set the pointer to the dictionary_owner_hard for a DXF BLOCK_RECORD symbol table entry.
DxfBlockRecorddxf_block_record_get_next (DxfBlockRecord *block_record)
 Get the pointer to the next BLOCK_RECORD symbol table entry from a DXF BLOCK_RECORD symbol table entry.
DxfBlockRecorddxf_block_record_set_next (DxfBlockRecord *block_record, DxfBlockRecord *next)
 Set the pointer to the next BLOCK_RECORD symbol table entry for a DXF BLOCK_RECORD symbol table entry.
DxfBlockRecorddxf_block_record_get_last (DxfBlockRecord *block_record)
 Get the pointer to the last BLOCK_RECORD symbol table entry from a linked list of DXF BLOCK_RECORD symbol table entries.

Detailed Description

Functions for a DXF block record symbol table entry (BLOCK_RECORD).

Author:
Copyright (C) 2015, 2016, 2017 by Bert Timmerman <bert.timmerman@xs4all.nl>.
Since:
The BLOCK_RECORD table was introduced in DXF R13.
Version:
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 block_record.c.


Function Documentation

DxfBlockRecord* dxf_block_record_new ( )

Allocate memory for a DXF BLOCK_RECORD symbol table entry.

Fill the memory contents with zeros.

Definition at line 53 of file block_record.c.

References _, DXF_DEBUG_BEGIN, and DXF_DEBUG_END.

Referenced by dxf_block_record_init(), and dxf_block_record_read().

DxfBlockRecord* dxf_block_record_init ( DxfBlockRecord block_record)

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

Returns:
NULL when no memory was allocated, a pointer to the allocated memory when succesful.
Parameters:
block_recordDXF block record symbol table entry.

Definition at line 91 of file block_record.c.

References _, dxf_block_record_new(), dxf_block_record_set_block_name(), dxf_block_record_set_dictionary_owner_hard(), dxf_block_record_set_dictionary_owner_soft(), dxf_block_record_set_flag(), dxf_block_record_set_id_code(), dxf_block_record_set_next(), DXF_DEBUG_BEGIN, and DXF_DEBUG_END.

Referenced by dxf_block_record_read().

Here is the call graph for this function:

DxfBlockRecord* dxf_block_record_read ( DxfFile fp,
DxfBlockRecord block_record 
)

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

The last line read from file contained the string "BLOCK_RECORD".
Now follows some data for the BLOCK_RECORD, 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 block_record.

Returns:
a pointer to block_record.
Parameters:
fpDXF file pointer to an input file (or device).
block_recordDXF block_record symbol table entry.

Definition at line 141 of file block_record.c.

References _, dxf_block_record_struct::block_name, dxf_block_record_struct::dictionary_owner_hard, dxf_block_record_struct::dictionary_owner_soft, dxf_block_record_init(), dxf_block_record_new(), DXF_DEBUG_BEGIN, DXF_DEBUG_END, dxf_file_struct::filename, dxf_block_record_struct::flag, dxf_file_struct::fp, dxf_block_record_struct::id_code, and dxf_file_struct::line_number.

Here is the call graph for this function:

int dxf_block_record_write ( DxfFile fp,
DxfBlockRecord block_record 
)

Write DXF output to a file for a DXF BLOCK_RECORD 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:
fpDXF file pointer to an output file (or device).
block_recordDXF BLOCK_RECORD symbol table entry.

Definition at line 249 of file block_record.c.

References _, dxf_file_struct::acad_version_number, AutoCAD_13, AutoCAD_14, dxf_block_record_get_block_name(), dxf_block_record_get_dictionary_owner_hard(), dxf_block_record_get_dictionary_owner_soft(), dxf_block_record_get_flag(), dxf_block_record_get_id_code(), DXF_DEBUG_BEGIN, DXF_DEBUG_END, and dxf_file_struct::fp.

Here is the call graph for this function:

int dxf_block_record_free ( DxfBlockRecord block_record)

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

Returns:
EXIT_SUCCESS when done, or EXIT_FAILURE when an error occurred.
Parameters:
block_recordDXF BLOCK_RECORD symbol table entry.

Definition at line 357 of file block_record.c.

References _, dxf_block_record_struct::block_name, dxf_block_record_struct::dictionary_owner_hard, dxf_block_record_struct::dictionary_owner_soft, DXF_DEBUG_BEGIN, DXF_DEBUG_END, and dxf_block_record_struct::next.

Referenced by dxf_block_record_free_chain().

void dxf_block_record_free_chain ( DxfBlockRecord block_records)

Free the allocated memory for a chain of DXF BLOCK_RECORD entities and all their data fields.

Parameters:
block_recordspointer to the chain of DXF BLOCK_RECORD entities.

Definition at line 397 of file block_record.c.

References _, dxf_block_record_free(), DXF_DEBUG_BEGIN, DXF_DEBUG_END, and dxf_block_record_struct::next.

Here is the call graph for this function:

int dxf_block_record_get_id_code ( DxfBlockRecord block_record)

Get the ID code from a DXF BLOCK_RECORD symbol table entry.

Returns:
ID code.
Parameters:
block_recorda pointer to a DXF BLOCK_RECORD symbol table entry.

Definition at line 430 of file block_record.c.

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

Referenced by dxf_block_record_write().

DxfBlockRecord* dxf_block_record_set_id_code ( DxfBlockRecord block_record,
int  id_code 
)

Set the ID code for a DXF BLOCK_RECORD symbol table entry.

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

Definition at line 466 of file block_record.c.

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

Referenced by dxf_block_record_init().

char* dxf_block_record_get_block_name ( DxfBlockRecord block_record)

Get the block name from a DXF BLOCK_RECORD symbol table entry.

Returns:
block name when sucessful, NULL when an error occurred.
Parameters:
block_recorda pointer to a DXF BLOCK_RECORD symbol table entry.

Definition at line 510 of file block_record.c.

References _, dxf_block_record_struct::block_name, DXF_DEBUG_BEGIN, and DXF_DEBUG_END.

Referenced by dxf_block_record_write().

DxfBlockRecord* dxf_block_record_set_block_name ( DxfBlockRecord block_record,
char *  block_name 
)

Set the block name for a DXF BLOCK_RECORD symbol table entry.

Parameters:
block_recorda pointer to a DXF BLOCK_RECORD symbol table entry.
block_namea string containing the block name for the symbol table entry.

Definition at line 547 of file block_record.c.

References _, dxf_block_record_struct::block_name, DXF_DEBUG_BEGIN, and DXF_DEBUG_END.

Referenced by dxf_block_record_init().

int dxf_block_record_get_flag ( DxfBlockRecord block_record)

Get the flag value from a DXF BLOCK_RECORD symbol table entry.

Returns:
flag value.
Parameters:
block_recorda pointer to a DXF BLOCK_RECORD symbol table entry.

Definition at line 590 of file block_record.c.

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

Referenced by dxf_block_record_write().

DxfBlockRecord* dxf_block_record_set_flag ( DxfBlockRecord block_record,
int  flag 
)

Set the flag value for a DXF BLOCK_RECORD symbol table entry.

Parameters:
block_recorda pointer to a DXF BLOCK_RECORD symbol table entry.
flagThis flag is for the benefit of AutoCAD commands; it can be ignored by most programs that read DXF files, and need not be set by programs that write DXF files.

Definition at line 634 of file block_record.c.

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

Referenced by dxf_block_record_init().

int dxf_block_record_is_xreferenced ( DxfBlockRecord block_record)

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

Returns:
TRUE when BLOCK_RECORD is externally dependent on an xref, or FALSE when BLOCK_RECORD is not externally dependent on an xref, or (-1) when an error occured.
Parameters:
block_recordDXF BLOCK_RECORD symbol table entry.

Definition at line 687 of file block_record.c.

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

int dxf_block_record_is_xresolved ( DxfBlockRecord block_record)

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

Returns:
TRUE when BLOCK_RECORD is externally dependent on a xref and has been successfully resolved, or FALSE when BLOCK_RECORD is not externally dependent on a xref and has not been successfully resolved, or (-1) when an error occured.
Parameters:
block_recordDXF BLOCK_RECORD symbol table entry.

Definition at line 721 of file block_record.c.

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

int dxf_block_record_is_referenced ( DxfBlockRecord block_record)

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

Returns:
TRUE when BLOCK_RECORD is internally referenced by an entity, or FALSE when BLOCK_RECORD is not internally referenced by an entity, or (-1) when an error occured.
Parameters:
block_recordDXF BLOCK_RECORD symbol table entry.

Definition at line 755 of file block_record.c.

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

char* dxf_block_record_get_dictionary_owner_soft ( DxfBlockRecord block_record)

Get the soft pointer to the dictionary owner from a DXF BLOCK_RECORD symbol table entry.

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

Definition at line 788 of file block_record.c.

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

Referenced by dxf_block_record_write().

DxfBlockRecord* dxf_block_record_set_dictionary_owner_soft ( DxfBlockRecord block_record,
char *  dictionary_owner_soft 
)

Set the pointer to the dictionary_owner_soft for a DXF BLOCK_RECORD symbol table entry.

Parameters:
block_recorda pointer to a DXF BLOCK_RECORD symbol table entry.
dictionary_owner_softa string containing the pointer to the dictionary_owner_soft for the entity.

Definition at line 825 of file block_record.c.

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

Referenced by dxf_block_record_init().

char* dxf_block_record_get_dictionary_owner_hard ( DxfBlockRecord block_record)

Get the hard pointer to the dictionary owner from a DXF BLOCK_RECORD symbol table entry.

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

Definition at line 870 of file block_record.c.

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

Referenced by dxf_block_record_write().

DxfBlockRecord* dxf_block_record_set_dictionary_owner_hard ( DxfBlockRecord block_record,
char *  dictionary_owner_hard 
)

Set the pointer to the dictionary_owner_hard for a DXF BLOCK_RECORD symbol table entry.

Parameters:
block_recorda pointer to a DXF BLOCK_RECORD symbol table entry.
dictionary_owner_harda string containing the pointer to the dictionary_owner_hard for the symbol table entry.

Definition at line 907 of file block_record.c.

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

Referenced by dxf_block_record_init().

DxfBlockRecord* dxf_block_record_get_next ( DxfBlockRecord block_record)

Get the pointer to the next BLOCK_RECORD symbol table entry from a DXF BLOCK_RECORD symbol table entry.

Returns:
pointer to the next BLOCK_RECORD symbol table entry.
Warning:
No checks are performed on the returned pointer.
Parameters:
block_recorda pointer to a DXF BLOCK_RECORD symbol table entry.

Definition at line 952 of file block_record.c.

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

DxfBlockRecord* dxf_block_record_set_next ( DxfBlockRecord block_record,
DxfBlockRecord next 
)

Set the pointer to the next BLOCK_RECORD symbol table entry for a DXF BLOCK_RECORD symbol table entry.

Parameters:
block_recorda pointer to a DXF BLOCK_RECORD symbol table entry.
nexta pointer to the next BLOCK_RECORD symbol table entry for the symbol table entry.

Definition at line 989 of file block_record.c.

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

Referenced by dxf_block_record_init().

DxfBlockRecord* dxf_block_record_get_last ( DxfBlockRecord block_record)

Get the pointer to the last BLOCK_RECORD symbol table entry from a linked list of DXF BLOCK_RECORD symbol table entries.

Returns:
pointer to the last BLOCK_RECORD symbol table entry.
Warning:
No checks are performed on the returned pointer.
Parameters:
block_recorda pointer to a DXF BLOCK_RECORD symbol table entry.

Definition at line 1033 of file block_record.c.

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