PBHGEN - PureBasic Header Generator

Applications, Games, Tools, User libs and useful stuff coded in PureBasic
Henry00
User
User
Posts: 88
Joined: Thu Jul 12, 2012 7:00 pm
Location: Germany
Contact:

Re: PBHGEN - PureBasic Header Generator

Post by Henry00 »

Hi Tristano, no it uses compiler directives to load the appropriate define lines. It used to make multiple files but that's an old version.

CompilerIf #PB_Compiler_Module = ""
Declare NormalEmptyProcedure()
Declare BracketStuff(String$ = "heh" + Chr(50), Okay.l = 50)
CompilerEndIf
CompilerIf #PB_Compiler_Module = "TestA"

Declare Func1()
Declare Func2()
Declare A()
CompilerEndIf

Outside of any module the first condition will be true (#PB_Compiler_Module = ""). Inside of module TestA the second condition will be true (CompilerIf #PB_Compiler_Module = "TestA"). This separates the code that will be included into any portion of your program. You have two options, either you make everything inside of your module public (which doesn't work well with PureBasic's code suggestions which is why it's nearly impossible to make this an automated feature as it only adds confusion):

Code: Select all

DeclareModule TestA
  IncludeFile #PB_Compiler_File + "i" ;- PBHGEN
EndDeclareModule
Or you use it like usual, inside of the module itself (to make any procedures not mentioned in the DeclareModule statement accessible from anywhere):

Code: Select all

DeclareModule TestA
  Declare A()
EndDeclareModule

Module TestA
  IncludeFile #PB_Compiler_File + "i" ;- PBHGEN
  Procedure A()
    B()
  EndProcedure
  Procedure B()
    Debug "Works"
  EndProcedure
EndModule
As for automatically adding inclusion lines into the source, that's likely not going to be happening, mainly because some people may prefer the additional control over when what gets included and because the IDE will continue to ask whether to reload the file whenever it's modified externally.
Henry00
User
User
Posts: 88
Joined: Thu Jul 12, 2012 7:00 pm
Location: Germany
Contact:

Re: PBHGEN - PureBasic Header Generator

Post by Henry00 »

I have updated the broken links in the first post. The project is now open source on GitHub as well: https://github.com/00laboratories/PBHGEN
It's great to see that this project continues to help a lot people. As always be sure to let me know if there's any new PureBasic syntax that breaks things! :)
Henry00
User
User
Posts: 88
Joined: Thu Jul 12, 2012 7:00 pm
Location: Germany
Contact:

Re: PBHGEN - PureBasic Header Generator

Post by Henry00 »

Version 5.71
Fixed double colon operator inside procedure arguments OnVstMain(*Effect.Vst2::AEffect).
TRS-Eric
User
User
Posts: 14
Joined: Thu Apr 23, 2020 7:42 pm

Re: PBHGEN - PureBasic Header Generator

Post by TRS-Eric »

This tool is a must have for purebasic. Thanks!
---
BASIC related discord: https://discord.gg/KS4en5y5j4
Henry00
User
User
Posts: 88
Joined: Thu Jul 12, 2012 7:00 pm
Location: Germany
Contact:

Re: PBHGEN - PureBasic Header Generator

Post by Henry00 »

Version 5.72
Fixed runtime keyword not getting detected properly.
TRS-Eric wrote:This tool is a must have for purebasic. Thanks!
And thank you Eric for providing the fix above, I am glad you like it! :)
Henry00
User
User
Posts: 88
Joined: Thu Jul 12, 2012 7:00 pm
Location: Germany
Contact:

Re: PBHGEN - PureBasic Header Generator

Post by Henry00 »

Version 5.73
Removed the timestamp and version info in generated headers to make them git-friendly.
Removed ambiguous licensing terms at GitHub (it's MIT).
Post Reply