1 
2 /* Compiler implementation of the D programming language
3  * Copyright (C) 1999-2019 by The D Language Foundation, All Rights Reserved
4  * written by Dave Fladebo
5  * http://www.digitalmars.com
6  * Distributed under the Boost Software License, Version 1.0.
7  * http://www.boost.org/LICENSE_1_0.txt
8  * https://github.com/dlang/dmd/blob/master/src/dmd/hdrgen.h
9  */
10 
11 #pragma once
12 
13 #include "root/dsystem.h"               // memset()
14 #include "dsymbol.h"
15 
16 void genhdrfile(Module *m);
17 
18 struct HdrGenState
19 {
20     bool hdrgen;        // true if generating header file
21     bool ddoc;          // true if generating Ddoc file
22     bool fullDump;      // true if generating a full AST dump file
23     bool fullQual;      // fully qualify types when printing
24     int tpltMember;
25     int autoMember;
26     int forStmtInit;
27 
HdrGenStateHdrGenState28     HdrGenState() { memset(this, 0, sizeof(HdrGenState)); }
29 };
30 
31 void toCBuffer(Statement *s, OutBuffer *buf, HdrGenState *hgs);
32 void toCBuffer(Type *t, OutBuffer *buf, Identifier *ident, HdrGenState *hgs);
33 void toCBuffer(Dsymbol *s, OutBuffer *buf, HdrGenState *hgs);
34 void toCBuffer(Initializer *iz, OutBuffer *buf, HdrGenState *hgs);
35 void toCBuffer(Expression *e, OutBuffer *buf, HdrGenState *hgs);
36 void toCBuffer(TemplateParameter *tp, OutBuffer *buf, HdrGenState *hgs);
37 
38 void toCBufferInstance(TemplateInstance *ti, OutBuffer *buf, bool qualifyTypes = false);
39 
40 void functionToBufferFull(TypeFunction *tf, OutBuffer *buf, Identifier *ident, HdrGenState* hgs, TemplateDeclaration *td);
41 void functionToBufferWithIdent(TypeFunction *t, OutBuffer *buf, const char *ident);
42 
43 void argExpTypesToCBuffer(OutBuffer *buf, Expressions *arguments);
44 
45 void arrayObjectsToBuffer(OutBuffer *buf, Objects *objects);
46 
47 void moduleToBuffer(OutBuffer *buf, Module *m);
48 
49 const char *parametersTypeToChars(Parameters *parameters, int varargs);
50 
51 bool stcToBuffer(OutBuffer *buf, StorageClass stc);
52 const char *stcToChars(StorageClass& stc);
53 const char *linkageToChars(LINK linkage);
54