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

comment.c File Reference

Functions for a DXF comment entity (COMMENT). More...

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

Go to the source code of this file.

Functions

DxfCommentdxf_comment_new ()
 Allocate memory for a DXF COMMENT.
DxfCommentdxf_comment_init (DxfComment *comment)
 Allocate memory and initialize data fields in a DXF COMMENT entity.
int dxf_comment_write (DxfFile *fp, DxfComment *comment)
 Write DXF output to fp for a comment.
int dxf_comment_free (DxfComment *comment)
 Free the allocated memory for a DXF COMMENT and all it's data fields.
void dxf_comment_free_chain (DxfComment *comments)
 Free the allocated memory for a chain of DXF COMMENT entities and all their data fields.
int dxf_comment_get_id_code (DxfComment *comment)
 Get the ID code from a DXF COMMENT entity.
DxfCommentdxf_comment_set_id_code (DxfComment *comment, int id_code)
 Set the ID code for a DXF COMMENT entity.
char * dxf_comment_get_value (DxfComment *comment)
 Get the value string from a DXF COMMENT entity.
DxfCommentdxf_comment_set_value (DxfComment *comment, char *value)
 Set the given string for a DXF COMMENT entity.
DxfCommentdxf_comment_get_next (DxfComment *comment)
 Get the pointer to the next COMMENT entity from a DXF COMMENT entity.
DxfCommentdxf_comment_set_next (DxfComment *comment, DxfComment *next)
 Set the pointer to the next COMMENT for a DXF COMMENT entity.
DxfCommentdxf_comment_get_last (DxfComment *comment)
 Get the pointer to the last COMMENT entity from a linked list of DXF COMMENT entities.

Detailed Description

Functions for a DXF comment entity (COMMENT).

Author:
Copyright (C) 2008, 2012, 2014, 2015, 2016, 2017 by Bert Timmerman <bert.timmerman@xs4all.nl>.
Copyright (C) 2010 by Luis Matos <gass@otiliamatos.ath.cx>.
Version:
According to DXF R10.
According to DXF R11.
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 comment.c.


Function Documentation

DxfComment* dxf_comment_new ( )

Allocate memory for a DXF COMMENT.

Fill the memory contents with zeros.

Definition at line 51 of file comment.c.

References _, DXF_DEBUG_BEGIN, and DXF_DEBUG_END.

Referenced by dxf_comment_init().

DxfComment* dxf_comment_init ( DxfComment comment)

Allocate memory and initialize data fields in a DXF COMMENT entity.

Returns:
NULL when no memory was allocated, a pointer to the allocated memory when succesful.
Parameters:
commenta pointer to the DXF COMMENT entity.

Definition at line 89 of file comment.c.

References _, dxf_comment_new(), dxf_comment_set_id_code(), dxf_comment_set_next(), dxf_comment_set_value(), DXF_DEBUG_BEGIN, and DXF_DEBUG_END.

Here is the call graph for this function:

int dxf_comment_write ( DxfFile fp,
DxfComment comment 
)

Write DXF output to fp for a comment.

The 999 group code indicates that the following line is a comment string.
DXFOUT does not currently include such groups in a DXF output file, but DXFIN honors them and ignores the comments.
Thus, you can use the 999 group to include comments in a DXF file you've edited.

Multi-line comments are implemented as a single linked list of DxfComment structs.
A pointer to the next comment is stored in the next member of the DXF COMMENT struct.
This function writes comments to the file descriptor until a NULL pointer is encountered.

Parameters:
fpfile pointer to output file (or device).
commenta pointer to the DXF COMMENT entity.

Definition at line 140 of file comment.c.

References _, dxf_comment_get_next(), dxf_comment_get_value(), DXF_DEBUG_BEGIN, DXF_DEBUG_END, and dxf_file_struct::fp.

Here is the call graph for this function:

int dxf_comment_free ( DxfComment comment)

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

Returns:
EXIT_SUCCESS when done, or EXIT_FAILURE when an error occurred.
Parameters:
commenta pointer to the memory occupied by the DXF COMMENT entity.

Definition at line 181 of file comment.c.

References _, dxf_comment_get_value(), DXF_DEBUG_BEGIN, DXF_DEBUG_END, and dxf_comment_struct::next.

Referenced by dxf_comment_free_chain().

Here is the call graph for this function:

void dxf_comment_free_chain ( DxfComment comments)

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

Parameters:
commentsa pointer to the chain of DXF COMMENT entities.

Definition at line 220 of file comment.c.

References _, dxf_comment_free(), DXF_DEBUG_BEGIN, DXF_DEBUG_END, and dxf_comment_struct::next.

Here is the call graph for this function:

int dxf_comment_get_id_code ( DxfComment comment)

Get the ID code from a DXF COMMENT entity.

Returns:
ID code.
Parameters:
commenta pointer to a DXF COMMENT entity.

Definition at line 253 of file comment.c.

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

DxfComment* dxf_comment_set_id_code ( DxfComment comment,
int  id_code 
)

Set the ID code for a DXF COMMENT entity.

Parameters:
commenta pointer to a DXF COMMENT entity.
id_codeIdentification number for the entity.
This is to be an unique (sequential) number in the DXF file.

Definition at line 288 of file comment.c.

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

Referenced by dxf_comment_init().

char* dxf_comment_get_value ( DxfComment comment)

Get the value string from a DXF COMMENT entity.

Parameters:
commenta pointer to the chain of DXF COMMENT entities.

Definition at line 328 of file comment.c.

References _, DXF_DEBUG_BEGIN, DXF_DEBUG_END, and dxf_comment_struct::value.

Referenced by dxf_comment_free(), and dxf_comment_write().

DxfComment* dxf_comment_set_value ( DxfComment comment,
char *  value 
)

Set the given string for a DXF COMMENT entity.

Parameters:
commenta pointer to the chain of DXF COMMENT entities.
valuethe comment value (string) to be set.

Definition at line 362 of file comment.c.

References _, DXF_DEBUG_BEGIN, DXF_DEBUG_END, and dxf_comment_struct::value.

Referenced by dxf_comment_init().

DxfComment* dxf_comment_get_next ( DxfComment comment)

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

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

Definition at line 404 of file comment.c.

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

Referenced by dxf_comment_write().

DxfComment* dxf_comment_set_next ( DxfComment comment,
DxfComment next 
)

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

Parameters:
commenta pointer to a DXF COMMENT entity.
nexta pointer to the next COMMENT for the entity.

Definition at line 440 of file comment.c.

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

Referenced by dxf_comment_init().

DxfComment* dxf_comment_get_last ( DxfComment comment)

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

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

Definition at line 483 of file comment.c.

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