File: projectFile.h

package info (click to toggle)
dfcgen-gtk 0.6-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 2,456 kB
  • sloc: ansic: 9,688; sh: 4,936; makefile: 207; sed: 16
file content (130 lines) | stat: -rw-r--r-- 4,897 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
/**
 * \file        projectFile.h
 * \brief       Project file handling.
 * \note        All double values written to a DFCGen project file are
 *              formatted in the \e C locale for \c LC_NUMERIC.
 * \copyright   Copyright (C) 2006-2022 Ralf Hoppe <ralf.hoppe@dfcgen.de>
 */

#ifndef PRJFILE_H
#define PRJFILE_H


/* INCLUDE FILES **************************************************************/

#include "dfcProject.h"


#ifdef  __cplusplus
extern "C" {
#endif


/* GLOBAL TYPE DECLARATIONS ***************************************************/

/** Export types, to be used with function prjFileExport().
 */
    typedef enum
    {
        PRJFILE_EXPORT_PLAIN,                        /**< plain text (*.txt) */
        PRJFILE_EXPORT_MATLAB,                        /**< MATLAB file (*.m) */
        PRJFILE_EXPORT_CLANG,                              /* "C" file (*.c) */
    } PRJFILE_EXPORT_TYPE;


/* GLOBAL CONSTANT DECLARATIONS ***********************************************/

#define PRJFILE_NAME_SUFFIX     ".dfc"   /**< Default project filename suffix */


/* GLOBAL VARIABLE DECLARATIONS ***********************************************/


/* GLOBAL MACRO DEFINITIONS ***************************************************/


/* EXPORTED FUNCTIONS *********************************************************/


/* FUNCTION *******************************************************************/
/** Exports a filter project to a file.
 *
 *  \param type         Export type.
 *  \param filename     Filename of file (inclusive path).
 *  \param pProject     Pointer to project data.
 *
 *  \return             Zero on succes, else an error number from errno.h.
 ******************************************************************************/
    int prjFileExport (PRJFILE_EXPORT_TYPE type, const char *filename,
                       DFCPRJ_FILTER *pProject);



/* FUNCTION *******************************************************************/
/** Writes a filter project to a file.
 *
 *  \param filename     Filename of file (inclusive path).
 *  \param pProject     Pointer to project data.
 *
 *  \return             Zero on succes, else an error number.
 ******************************************************************************/
    int prjFileWrite (const char *filename, DFCPRJ_FILTER *pProject);


/* FUNCTION *******************************************************************/
/** Reads a filter project from a file. In case of an error it sets the pointer
 *  to the error structure, which itself can be used to display the original
 *  error message. Modification of the error structure pointer indicates an
 *  critical error. In that case it has to be free'ed with g_error_free().
 *
 *  \param filename     Filename of file (with path).
 *  \param pProject     Pointer to project buffer. This project will be
 *                      overwritten (only) on success.
 *  \param err          Pointer to an error (structure) pointer. The pointer
 *                      to the error structure must be set NULL before calling
 *                      function prjFileRead().
 *
 ******************************************************************************/
    void prjFileRead (const char *filename, DFCPRJ_FILTER *pProject, GError **err);



/* FUNCTION *******************************************************************/
/** Scans for project info (header) data in a DFCGen project file. In case
 *  of an error it sets the pointer to the error structure, which itself can be
 *  used to display the original error message. Modification of the error
 *  structure pointer indicates an critical error. In that case it has to be
 *  free'ed with g_error_free().
 *
 *  \param filename     Filename of file (with path).
 *  \param pInfo        Pointer to project info data buffer.
 *  \param err          Pointer to an error (structure) pointer. The pointer
 *                      to the error structure must be set NULL before calling
 *                      function prjFileScan().
 *
 ******************************************************************************/
    void prjFileScan (const char *filename, DFCPRJ_INFO *pInfo, GError **err);


/* FUNCTION *******************************************************************/
/** Frees malloc'ed memory space from project info (author, title, desc).
 *  This function is designed as a counterpart to function prjFileScan().
 *
 *  \param pInfo        Pointer to project info data.
 *
 ******************************************************************************/
    void prjFileFree (DFCPRJ_INFO *pInfo);


#ifdef  __cplusplus
}
#endif


#endif /* PRJFILE_H */


/******************************************************************************/
/* END OF FILE                                                                */
/******************************************************************************/