2 // Compiler implementation of the D programming language
3 // Copyright (c) 1999-2006 by Digital Mars
5 // Initial header generation implementation by Dave Fladebo
6 // http://www.digitalmars.com
7 // License for redistribution is by either the Artistic License
8 // in artistic.txt, or the GNU General Public License in gnu.txt.
9 // See the included readme.txt for details.
11 // Routines to emit header files
16 #define TEST_EMIT_ALL 0 // For Testing
31 #include "..\root\mem.h"
33 #include "../root/mem.h"
49 #include "staticassert.h"
54 #include "declaration.h"
55 #include "aggregate.h"
56 #include "expression.h"
57 #include "statement.h"
61 void argsToCBuffer(OutBuffer
*buf
, Array
*arguments
, HdrGenState
*hgs
);
63 void Module::genhdrfile()
67 hdrbufr
.printf("// D import file generated from '%s'", srcfile
->toChars());
71 memset(&hgs
, 0, sizeof(hgs
));
74 toCBuffer(&hdrbufr
, &hgs
);
76 // Transfer image to file
77 hdrfile
->setbuffer(hdrbufr
.data
, hdrbufr
.offset
);
80 char *pt
= FileName::path(hdrfile
->toChars());
82 FileName::ensurePathExists(pt
);
88 void Module::toCBuffer(OutBuffer
*buf
, HdrGenState
*hgs
)
92 buf
->writestring("module ");
93 buf
->writestring(md
->toChars());
98 for (int i
= 0; i
< members
->dim
; i
++)
99 { Dsymbol
*s
= (Dsymbol
*)members
->data
[i
];
101 s
->toHBuffer(buf
, hgs
);
106 void Dsymbol::toHBuffer(OutBuffer
*buf
, HdrGenState
*hgs
)
112 /*************************************/