# dmd.hdrgen

Generate D interface files.

#### Discussion

Also used to convert AST nodes to D code in general, e.g. for error messages or `printf` debugging.

#### Authors

Walter Bright

#### License

Boost License 1.0

Source: hdrgen.d

Documentation: https://dlang.org/phobos/dmd_hdrgen.html

Coverage: https://codecov.io/gh/dlang/dmd/src/master/src/dmd/hdrgen.d

- `genhdrfile`

  #### Declaration

  `void `genhdrfile`(Module `m`, ref OutBuffer `buf`);`

  Generate a header (.di) file for Module `m`.

  #### Parameters

  `Module `m`` | Module to generate header for
  `OutBuffer `buf`` | buffer to write the data to

- `toChars`

  #### Declaration

  `const(char)* `toChars`(const Statement `s`);`

  Turn a Statement into a string suitable for printf. Leaks memory.

  #### Parameters

  `Statement `s`` | Statement to convert

  #### Return Value

  0-terminated string

- `moduleToBuffer`

  #### Declaration

  `void `moduleToBuffer`(ref OutBuffer `buf`, Module `m`);`

  Dumps the full contents of module ``m`` to ``buf``.

  #### Parameters

  `OutBuffer `buf`` | buffer to write to.
  `Module `m`` | module to visit all members of.

- `floatToBuffer`

  #### Declaration

  `void `floatToBuffer`(Type `type`, const real_t `value`, ref OutBuffer `buf`, const bool `allowHex`);`

  Formats ``value`` as a literal of `type` ``type`` into ``buf``.

  #### Parameters

  `Type `type`` | literal `type` (e.g. Tfloat)
  `real_t `value`` | `value` to print
  `OutBuffer `buf`` | target buffer
  `bool `allowHex`` | whether hex floating point literals may be used for greater accuracy

- `stcToString`

  #### Declaration

  `@safe string `stcToString`(ref StorageClass `stc`);`

  Pick off one of the storage classes from `stc`, and return a string representation of it. `stc` is reduced by the one picked.

- `visibilityToChars`

  #### Declaration

  `const(char)* `visibilityToChars`(Visibility.Kind `kind`);
  pure nothrow @safe string `visibilityToString`(Visibility.Kind `kind`);`

  #### Return Value

  a human readable representation of ``kind``

- `argExpTypesToCBuffer`

  #### Declaration

  `void `argExpTypesToCBuffer`(ref OutBuffer `buf`, Expressions* `arguments`);`

  Write out argument types to `buf`.

- `parametersTypeToChars`

  #### Declaration

  `const(char)* `parametersTypeToChars`(ParameterList `pl`);`

  Pretty print function parameters.

  #### Parameters

  `ParameterList `pl`` | parameter list to print

  #### Return Value

  Null-terminated string representing parameters.

- `parameterToChars`

  #### Declaration

  `const(char)* `parameterToChars`(Parameter `parameter`, TypeFunction `tf`, bool `fullQual`);`

  Pretty print function `parameter`.

  #### Parameters

  `Parameter `parameter`` | `parameter` to print.
  `TypeFunction `tf`` | TypeFunction which holds `parameter`.
  `bool `fullQual`` | whether to fully qualify types.

  #### Return Value

  Null-terminated string representing parameters.

- `EXPtoString`

  #### Declaration

  `string `EXPtoString`(EXP `op`);`

  Convert EXP to char*.