DecMaker 1.0.5

Applications, Games, Tools, User libs and useful stuff coded in PureBasic
User avatar
luis
Addict
Addict
Posts: 3895
Joined: Wed Aug 31, 2005 11:09 pm
Location: Italy

DecMaker 1.0.5

Post by luis »

There are others tools like this already posted in the forums, so look around if this does not suits you, maybe something else will do.

It's really a quick hack, but the zip contains the source, so you can customize it to your needs if you like to.

DecMaker generate declarations for the file currently open in PB IDE, it does not process other files or includes, only the current file.
The generated declares are copied in the clipboard ready to pasted where you need them.

It must be installed as a PB tool under "Tools -> Configure Tool", if you run the exe it will pop up a window explaining the values to put in the required fields.

You can specify two options when launching it:

/tab=[n] will put n tabs between the Declare statement and the procedure's name.

/rem will allow you to specify the character(s) you want to use after a ";" to indicate your will to include that comment in the generated list of declares.

Let's see a sample program we want to generate the declares for:

Code: Select all

; DecMaker example

;! ************************
;! *** SYSTEM FUNCTIONS ***
;! ************************

Procedure SystemFunc1()
EndProcedure

Procedure SystemFunc2()
EndProcedure

Procedure SystemFunc3 (iVal, fVal.f)
EndProcedure

;! *************************
;! *** GRAPHIC FUNCTIONS ***
;! *************************

ProcedureDLL.i GraphicFunc1 (x, y)
 ProcedureReturn x * y
EndProcedure

ProcedureDLL GraphicFunc2 ()
EndProcedure

ProcedureDLL GraphicFunc3 (dVal1.d, dVal2.d)
EndProcedure


;! MISC FUNCTIONS

ProcedureC.s RandomFunc1 (sValue.s)
 ProcedureReturn ""
EndProcedure

ProcedureC.s RandomFunc2 (sValue.s)
 ProcedureReturn ""
EndProcedure
If you use this commandline: "%TEMPFILE" you will get something like this:

Code: Select all

Declare   SystemFunc1()
Declare   SystemFunc2()
Declare   SystemFunc3 (iVal, fVal.f)
Declare.i GraphicFunc1 (x, y)
Declare   GraphicFunc2 ()
Declare   GraphicFunc3 (dVal1.d, dVal2.d)
Declare.s RandomFunc1 (sValue.s)
Declare.s RandomFunc2 (sValue.s)
If you use this commandline instead: "%TEMPFILE" /tab=1 /rem="!", you will get something like this:

Code: Select all

; ************************
; *** SYSTEM FUNCTIONS ***
; ************************

Declare   SystemFunc1()
Declare   SystemFunc2()
Declare   SystemFunc3 (iVal, fVal.f)

; *************************
; *** GRAPHIC FUNCTIONS ***
; *************************

Declare.i GraphicFunc1 (x, y)
Declare   GraphicFunc2 ()
Declare   GraphicFunc3 (dVal1.d, dVal2.d)

; MISC FUNCTIONS

Declare.s RandomFunc1 (sValue.s)
Declare.s RandomFunc2 (sValue.s)
Download 1.05 from here

;* 1.01 Fixed a gigantic bug, how was it working before ?
;* 1.02 Changed the /tab option to /tab=[n]
;* 1.03 Skip processing of macro contents
;* 1.04 Removed multiple group headers when the group is empty (no declares)
;* 1.05 Single line macros also skipped
Last edited by luis on Sun Dec 28, 2014 4:21 pm, edited 12 times in total.
jack
Addict
Addict
Posts: 1358
Joined: Fri Apr 25, 2003 11:10 pm

Post by jack »

thanks luis :)
User avatar
idle
Always Here
Always Here
Posts: 5895
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Post by idle »

Thanks just what I need!
User avatar
luis
Addict
Addict
Posts: 3895
Joined: Wed Aug 31, 2005 11:09 pm
Location: Italy

Re: DecMaker

Post by luis »

Ergh... fixed an obscene bug... sorry... I've updated the link in the first post.
"Have you tried turning it off and on again ?"
zikitrake
Addict
Addict
Posts: 874
Joined: Thu Mar 25, 2004 2:15 pm
Location: Spain

Re: DecMaker

Post by zikitrake »

:D Nice tool! (Since I left JaPBe to back to original PB IDE).

Only a (solved) problem:

Change

Code: Select all

%TEMPFILE
to

Code: Select all

"%TEMPFILE"
; because with the first, I get an error message "File "C:\Documents" not found".

Thank you
PB 6.21 beta, PureVision User
User avatar
luis
Addict
Addict
Posts: 3895
Joined: Wed Aug 31, 2005 11:09 pm
Location: Italy

Re: DecMaker

Post by luis »

Yes, %TEMPFILE is a full pathname, so if you have spaces in there you should enclose it in double quotes...

It's a very stupid tool but I use it constantly :)
"Have you tried turning it off and on again ?"
zikitrake
Addict
Addict
Posts: 874
Joined: Thu Mar 25, 2004 2:15 pm
Location: Spain

Re: DecMaker

Post by zikitrake »

Stupid? why? I was using JaPBe because it has this tool. :D
PB 6.21 beta, PureVision User
User avatar
luis
Addict
Addict
Posts: 3895
Joined: Wed Aug 31, 2005 11:09 pm
Location: Italy

Re: DecMaker

Post by luis »

Well you are right, it's not stupid the tool per se, it's a little dumb the program !

It's a little rigid and I coded it in a hurry a day I was exasperated by the need to go back and edit AGAIN the declares of the changed procedures for a library, so I stopped what I was doing and hacked this together. It's not some code to be proud of ... :|
"Have you tried turning it off and on again ?"
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Re: DecMaker

Post by Kaeru Gaman »

just a suggestion...
luis wrote:If you use this commandline: "%TEMPFILE" /tab and you have at least a Tab Length of 4 in your preferences in the IDE...
is it possible for you to check the tablength?
because, if <4 you could insert 2 tabs...
or generally insert tabs with length 4, independent of the user's tablength...
oh... and have a nice day.
User avatar
luis
Addict
Addict
Posts: 3895
Joined: Wed Aug 31, 2005 11:09 pm
Location: Italy

Re: DecMaker

Post by luis »

Yes I suppose is possible, or I could simply not use tabs but spaces instead ... probably.

I posted the source exactly to make possible doing these little individual adjustments :)

Anyway I'll give it a look as soon as I have time, thank you for the suggestion!
"Have you tried turning it off and on again ?"
User avatar
luis
Addict
Addict
Posts: 3895
Joined: Wed Aug 31, 2005 11:09 pm
Location: Italy

Re: DecMaker

Post by luis »

I modified the /tab switch, now you can write /tab=n to specify the number of tabs you want.

Updated 1st post.
"Have you tried turning it off and on again ?"
Post Reply