Mercurial > projects > ldc
annotate dmd/hdrgen.c @ 1138:4c8bb03e4fbc
Update DtoConstFP() to be correct after LLVM r67562, which changed the way the
APFloat constructor expects its i80 APInts to be formatted. (They're now
actually consistent with the x87 format)
author | Frits van Bommel <fvbommel wxs.nl> |
---|---|
date | Tue, 24 Mar 2009 15:24:59 +0100 |
parents | b30fe7e1dbb9 |
children |
rev | line source |
---|---|
1 | 1 |
2 // Compiler implementation of the D programming language | |
3 // Copyright (c) 1999-2006 by Digital Mars | |
4 // All Rights Reserved | |
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. | |
10 | |
11 // Routines to emit header files | |
12 | |
13 #ifdef _DH | |
14 | |
15 #define PRETTY_PRINT | |
16 #define TEST_EMIT_ALL 0 // For Testing | |
17 | |
18 #define LOG 0 | |
19 | |
20 #include <stdio.h> | |
21 #include <stdlib.h> | |
22 #include <assert.h> | |
23 #if __DMC__ | |
24 #include <complex.h> | |
25 #endif | |
26 | |
1103
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
571
diff
changeset
|
27 #include "rmem.h" |
1 | 28 |
29 #include "id.h" | |
30 #include "init.h" | |
31 | |
32 #include "attrib.h" | |
33 #include "cond.h" | |
34 #include "enum.h" | |
35 #include "import.h" | |
36 #include "module.h" | |
37 #include "mtype.h" | |
38 #include "scope.h" | |
39 #include "staticassert.h" | |
40 #include "template.h" | |
41 #include "utf.h" | |
42 #include "version.h" | |
43 | |
44 #include "declaration.h" | |
45 #include "aggregate.h" | |
46 #include "expression.h" | |
47 #include "statement.h" | |
48 #include "mtype.h" | |
49 #include "hdrgen.h" | |
50 | |
51 void argsToCBuffer(OutBuffer *buf, Array *arguments, HdrGenState *hgs); | |
52 | |
53 void Module::genhdrfile() | |
54 { | |
55 OutBuffer hdrbufr; | |
56 | |
57 hdrbufr.printf("// D import file generated from '%s'", srcfile->toChars()); | |
58 hdrbufr.writenl(); | |
59 | |
60 HdrGenState hgs; | |
61 memset(&hgs, 0, sizeof(hgs)); | |
62 hgs.hdrgen = 1; | |
63 | |
64 toCBuffer(&hdrbufr, &hgs); | |
65 | |
66 // Transfer image to file | |
67 hdrfile->setbuffer(hdrbufr.data, hdrbufr.offset); | |
68 hdrbufr.data = NULL; | |
69 | |
70 char *pt = FileName::path(hdrfile->toChars()); | |
71 if (*pt) | |
72 FileName::ensurePathExists(pt); | |
73 mem.free(pt); | |
74 hdrfile->writev(); | |
75 } | |
76 | |
77 | |
78 void Module::toCBuffer(OutBuffer *buf, HdrGenState *hgs) | |
79 { | |
80 if (md) | |
81 { | |
82 buf->writestring("module "); | |
83 buf->writestring(md->toChars()); | |
84 buf->writebyte(';'); | |
85 buf->writenl(); | |
86 } | |
87 | |
88 for (int i = 0; i < members->dim; i++) | |
89 { Dsymbol *s = (Dsymbol *)members->data[i]; | |
90 | |
91 s->toHBuffer(buf, hgs); | |
92 } | |
93 } | |
94 | |
95 | |
96 void Dsymbol::toHBuffer(OutBuffer *buf, HdrGenState *hgs) | |
97 { | |
98 toCBuffer(buf, hgs); | |
99 } | |
100 | |
101 | |
102 /*************************************/ | |
103 | |
104 #endif // #ifdef _DH |