-
Notifications
You must be signed in to change notification settings - Fork 131
Expand file tree
/
Copy pathgenCxxFilenames.c
More file actions
34 lines (28 loc) · 1.09 KB
/
genCxxFilenames.c
File metadata and controls
34 lines (28 loc) · 1.09 KB
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
#include "genCxxFilenames.h"
#include "class_strings.h"
/** \file genCxxFilenames.c
* functions shared by exp2cxx and the schema scanner.
* The latter creates, at configuration time, a list
* of file names so CMake knows how to compile the
* generated libs.
* exp2cxx is supposed to write to files with the same
* names, but it doesn't have access to the list the
* scanner created.
*/
/* these buffers are shared amongst (and potentially overwritten by) all functions in this file */
char impl[ BUFSIZ+1 ] = {0};
char header[ BUFSIZ+1 ] = {0};
/* struct containing pointers to above buffers. pointers are 'const char *' */
filenames_t fnames = { impl, header };
filenames_t getEntityFilenames( Entity e ) {
const char * name = ENTITYget_classname( e );
snprintf( header, BUFSIZ-1, "entity/%s.h", name );
snprintf( impl, BUFSIZ-1, "entity/%s.cc", name );
return fnames;
}
filenames_t getTypeFilenames( Type t ) {
const char * name = TYPEget_ctype( t );
snprintf( header, BUFSIZ-1, "type/%s.h", name );
snprintf( impl, BUFSIZ-1, "type/%s.cc", name );
return fnames;
}