Tag: GuShH

Declar’em! – Automatic declaration of procedures.

Posted by on September 5, 2009

This is a tool that I’ve been using for quite a long while, just recently I fixed a small bug in the regexp and I thought it was time to share it.

For those of you using the official IDE, there’s no real solution to this “problem”. When you’re working on something small, it’s not a big deal to define a couple of declares here and there… However, on bigger code this becomes a real issue!. So why waste the time switching between IDEs or doing it by hand?…

Grab it and let me know how it runs! (nasty ugly source included).

The tool is very simple to install, I recommend you unzip directly into your PB directory and configure it as follows:


That’s it. You’re ready to declar’em!.


Centered MessageRequester() / MessageBox()

Posted by on July 2, 2009

As usual, I was browsing the PureBasic forums to see what was new, nothing much (heh…) but something caught my attention, the fact that some user requested for the IDE’s message dialogs to be “centered” ( because he had multiple displays and the messages would appear in between them ) just to get shit-faced by an actual staff member!

You can’t just say “it’s Microsoft’s fault” — Are you in some sort of mac-only cleanse?, What’s your #%&%#$ problem?!

Those who “pass the ball” (as the user suggested) are part of the problem. You, being a programmer can certainly code a simple CBT hook, right?. Are you against hooks, perhaps – you are a purist, I hear… Sorry, but sometimes solutions are “dirty” and you have to live with them.

Just for the record, I too use a split-screen and I find it annoying that dialog boxes are not centered to their parent.

Just for the record, I too use a split-screen and I find it annoying that dialog boxes are not centered to their parent.


An efficient and simple object factory for PureBasic

Posted by on May 3, 2009

Whenever you deal with structures and what have you it’s obvious that there has to be a better way of doing it. Think about it, you encapsulate your structure-related code in such a way that it becomes clean, nice and tidy — in other words it makes it easy to understand what it does.

However in essence, you end up writing pretty much the same allocate / deallocate, list, etc. code every time you incorporate a new “class” into your project. Why should we?, let’s avoid it all together and focus our efforts in the task at hand rather than in the mundane stuff.

If you open your eyes you’ll see that this is an obvious pattern but what isn’t so obvious is how do you implement a template that deals with it in an efficient and clean way within the current constraints of the language.

Well… Have no fear, EasyObject is here!
First, download it. Secondly, embrace it.

Third, you’re free to post any comments regarding on how to enhance it if you dear to!.


StrEscape, StrQuoteMeta From PHP to PB. (quotemeta, addslashes)

Posted by on June 11, 2008

If you’re used to PHP, you might of know the functions ‘quotemeta();’ and ‘addslashes();’ are very, very useful when dealing with user Input and similar activities where escaping certain entities (characters!) is very important.

This routines, while not too elegant, do the same (or similar) job as PHP but in PB:

The equivalent to quotemeta(); in PHP can be found in here.
Whereas the addslashes(); counterpart is located in here.
(I know, the PHP lexer I’m using has a bug on the PB definition, I’ll take a look later).

Ascii helper routines, part 1

Posted by on June 11, 2008

Whenever I have to manipulate strings in PB, on a low-level (ie. per-character basis) I find it almost imperative to have the following routines included in my project:

 is_alpha(); is_numeric(); is_symbol();

They are amongst the most basic routines out there, however, they are still useful nonetheless.

You can grab the include/source from here: http://gushh.net/dev/?file=pb/ascii_helpers.pb

If you’re working on a Lexer, Parser, or similar… this will come in handy in case you don’t have it already.