Will read a PureBasic source file (*.pb) and generate a header out of it (*.pbi).
Declare statements are generated for every procedure automatically.
This program also works with SpiderBasic.
PureBasic is a great language but I was always annoyed about the fact I could never choose where I would locate my Procedures. If I wished to use a Procedure somewhere I would have to move it above of the Procedure that was going to call it.
The Declare statement allows to tell the compiler specific Procedures are going to exist and to find them but writing them over and over and fixing arguments is not only a pain but makes your source look like a mess. That’s the reason I required an automatic header generator for PureBasic. I hope you too will enjoy the new freedom thanks to this little tool!
Henry de Jongh
Under “Tools” in the PureBasic IDE add a new tool called “PBHGEN”.
At Commandline select your copy of PBHGEN.exe.
At Arguments type “%FILE”.
At Event to trigger the tool select Sourcecode Saved.
Ensure you include your headers in the Source Code using:
IncludeFile #PB_Compiler_File + "i" ;- PBHGEN
To use automatic header generation in modules also use:
Module MyModule IncludeFile #PB_Compiler_File + "i" ;- PBHGEN EndModule
At the moment if you wish to have a procedure with structured List/Array/Map arguments, you will have to put that procedure above the code where you call it from.
This does not apply when using basic types and is a limitation of PureBasic.
- Added SpiderBasic header generation support.
Version 5.31e – Compatible with PureBasic 5.42
- Fixed a comment after EndProcedure / EndModule / EndMacro skipping the next procedure declaration.
- Now ignoring content between Macro / EndMacro statements.
- Fixed case where the compiler directives failed when a module is declared above global procedures.
- Using compiler directives to remove the need of multiple files for modules.
- Improved parsing engine to comply with latest PureBasic syntax.
- Optimized header file content and size.
- Now supports any amount of spaces in front of a procedure.
- Treats a colon seperator as a new line to allow multiple declarations on a single line.
- Added support for module header generation (requires additional files and include lines in source code).
- Now naming version after PureBasic’s version when possible.
- Added support for Runtime procedure statements.
- Added support for case independent keyword detection.
- Improved ProcedureDLL and ProcedureCDLL with appropriate DeclareDLL and DeclareCDLL.
- Fixed issue with multiline arguments. Thanks majikeyric for pointing this out.
- Fixed issue with a space in the directory/file path of source file.
- Stops when encountering the statement seperator “:” or comment “;” operators.
- Fixed issue where array arguments would still have impossible structures.
- Added support for structured List/Array/Map arguments with some conditions.
- Added support for all basic types when used with List/Array/Map arguments.
- Fixed issue where a *pointer.structure had no default parameter.
- Fixed issue with a string as custom parameter, it was not escaped.
- Fixed issue where a *pointer would cause further Procedure Parameters to lose their types.
- Fixed issue with Structured List/Array/Map in Procedure Parameters.
- Fixed issue with Structure Pointers in Procedure Parameters, transforms to Pointers now.
- Initial Design