PrivateSection/EndPrivateSection

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
Josh
Addict
Addict
Posts: 1183
Joined: Sat Feb 13, 2010 3:45 pm

PrivateSection/EndPrivateSection

Post by Josh »

Don't panic, it's not a further wish for Private keyword in modules :mrgreen:

I'm using a preprocessor. For this I write some own commands, which are interpreted by the preprocessor. This own commands can be placed on different positions in the code. For example, I'm writing the following code and my preprocessor makes a complete interface and the vtable from this and write the code into an pbi file:

Code: Select all

  Interface ISCE_SITE
    QueryInterface      (@SCE_Site_QueryInterface)
    AddRef              (@SCE_Site_AddRef)
    Release             (@SCE_Site_Release)
    GetLCID             (@SCE_Site_GetLCID)
    GetItemInfo         (@SCE_Site_GetItemInfo)
    GetDocVersionString (@SCE_Site_GetDocVersionString)
    OnScriptTerminate   (@SCE_Site_OnScriptTerminate)
    OnStateChange       (@SCE_Site_OnStateChange)
    OnScriptError       (@SCE_Site_OnScriptError)
    OnEnterScript       (@SCE_Site_OnEnterScript)
    OnLeaveScript       (@SCE_Site_OnLeaveScript)
  EndInterface
Inside this sections the compiler should ignore absolutly all (also compilerIf's). In best case, the content of this sections should be ignored for autocomplete too.

At the moment I have bedded this commands between CompilerIf / CompilerendIf. To find this with my preprocessor, I have to use the additional commands PrivatSection / EndPrivateSection inside the compilerif. Unfortunately it's not possible to use PrivatSection / EndPrivatSection and change this to CompilerIf's by macro. So I'm asking, is it possible to get this native.

Thxs
Josh
sorry for my bad english
Little John
Addict
Addict
Posts: 4779
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: PrivateSection/EndPrivateSection

Post by Little John »

A preprocessor can just remove all lines between PrivateSection and EndPrivateSection from the source code, before passing it to the compiler.
User avatar
Josh
Addict
Addict
Posts: 1183
Joined: Sat Feb 13, 2010 3:45 pm

Re: PrivateSection/EndPrivateSection

Post by Josh »

Little John wrote:A preprocessor can just remove all lines between PrivateSection and EndPrivateSection from the source code, before passing it to the compiler.
My preprocessor writes the created code in a special pbi file, which is included at the start of my project.

Changing the original codes is no good solution. This makes only troubles, if your project has more then one file.
sorry for my bad english
User avatar
idle
Always Here
Always Here
Posts: 5844
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: PrivateSection/EndPrivateSection

Post by idle »

+1 on defining keywords

define EndPrivateSection = EndCompilerIF
or like fasm's fix
fix EndPrivateSection = EndCompilerIF
Windows 11, Manjaro, Raspberry Pi OS
Image
Post Reply