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
16void genhdrfile(Module *m);
17
18struct 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
28    HdrGenState() { memset(this, 0, sizeof(HdrGenState)); }
29};
30
31void toCBuffer(Statement *s, OutBuffer *buf, HdrGenState *hgs);
32void toCBuffer(Type *t, OutBuffer *buf, Identifier *ident, HdrGenState *hgs);
33void toCBuffer(Dsymbol *s, OutBuffer *buf, HdrGenState *hgs);
34void toCBuffer(Initializer *iz, OutBuffer *buf, HdrGenState *hgs);
35void toCBuffer(Expression *e, OutBuffer *buf, HdrGenState *hgs);
36void toCBuffer(TemplateParameter *tp, OutBuffer *buf, HdrGenState *hgs);
37
38void toCBufferInstance(TemplateInstance *ti, OutBuffer *buf, bool qualifyTypes = false);
39
40void functionToBufferFull(TypeFunction *tf, OutBuffer *buf, Identifier *ident, HdrGenState* hgs, TemplateDeclaration *td);
41void functionToBufferWithIdent(TypeFunction *t, OutBuffer *buf, const char *ident);
42
43void argExpTypesToCBuffer(OutBuffer *buf, Expressions *arguments);
44
45void arrayObjectsToBuffer(OutBuffer *buf, Objects *objects);
46
47void moduleToBuffer(OutBuffer *buf, Module *m);
48
49const char *parametersTypeToChars(Parameters *parameters, int varargs);
50
51bool stcToBuffer(OutBuffer *buf, StorageClass stc);
52const char *stcToChars(StorageClass& stc);
53const char *linkageToChars(LINK linkage);
54