• Welcome to Jose's Read Only Forum 2023.

Kick - o2 precompiler

Started by Pierre Bellisle, February 02, 2023, 08:18:12 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Pierre Bellisle

If anybody is interested in a precompiler utility, here is Kick.
It serve as an interface between an editor and co2.exe.
Editor that have a jump to line / column option when a coding error is detected are: UltraEdit, PsPad, and NotePad++.
Some may be added in the future if any request.
Kick offer multiples possibilities, from Kick.zip, read KickHelp.rtf

Kick.zip MD-5 checksum: C32A532BE74EFD24D14917A448E5F423

About KicK precompiler  by Pierre Bellisle.

Kick.exe is a precompiler program that stand between a code editor like UltraEdit or NotePad++ and Charles Pegge's Oxygen o2 Just-in-time compiler. The editor call Kick with a command line, and Kick call the compiler with an often reworked command line.
Kick is aware of the GoRC resource compiler and can call it to create a .res from a .rc.
Kick get most of is directives from the main .o2bas file wich is convenient.
It will propose to end active exe that stop the compiler to create new .exe/.dll. It will do a sound or shake the Editor window to confirm that a compilation was successful if no run command is given, this is less intrusive than a MessageBox. You may disable sound and shake by editing Kick.ini and set SoundEnable and/or ShakeEnable to zero.
You may also disable the splashscreen by editing Kick.ini and set the milisecond SplashTime to 0.
Source .o2bas files may be ANSI Code Page, UTF8, UTF16LittleEndian.
Kick.exe might be compress with Markus Oberhumer, Laszlo Molnar & John Reiser UPX.

Directive from the editor:
Usually the easiest way is to have the editor give the .o2bas or .bi, or .rc filename none or a few switch.
For example the "Compile32" command line from the editor: -32 "D:\O2\SomeCode.o2bas"
All fileNames must be between double-quotes. Full path is strongly suggested. Switches may be anywhere and space are optionnal.

Switches are:
-mem32 (-m) {Run in memory as 32bit, no switch at all give same result}
-32    (-3) {Compile 32 bit to file}
-64    (-6) {Compile 64 bit to file}
-run   (-r) {Run compiled exe}
-dll   (-d) {Compile a DLL}
(-a, -b, -c, and -i are ignored, original -m is managed by Kick)
Switches are not case sensitive.

.o2bas, .bi, .rc .inc {Main full filename to work on, or secondary if (KickUseDirectivesFrom) redirection is used}
.exe                  {Optional alternative exe full filename}
.res                  {Optional .res resource file}
If full filename are not given, Kick may complete with the informations it have)

The Kick directives are usually in the main .o2bas file. You may use (KickUseDirectivesFrom) redirection in many case. The advantage is that you do not have to switch the Editor from file to file to compile your project.
Example, in a .rc or .inc or .bi you could have the line: // KickUseDirectivesFrom "D:\O2\SomeCode.o2bas". This will cause Kick to stop reading this file and read SomeCode.o2bas for compilation directives. This way you concentrate on coding, not switching files in the Editor.

Redirections may be up to 15 level, Example:
SomeCode15.o2bas redirect to SomeCode14.o2bas, (// KickUseDirectivesFrom "D:\o2\SomeCode14.o2bas" // Optional comment)
SomeCode14.o2bas redirect to SomeCode13.o2bas, (// KickUseDirectivesFrom "D:\o2\SomeCode13.o2bas" // Optional comment)
SomeCode02.o2bas redirect to SomeCode01.o2bas, (// KickUseDirectivesFrom "D:\o2\SomeCode01.o2bas" // Optional comment)

The directives start with double-slash and have the "Kick" prefix.
You may add comments after a second double-slash on the same line.

Kick directives examples:
// KickCompiler "D:\o2Old\co2.exe" // Use another Compiler/Folder, like for another o2 version
// KickResource "SomeFile.res" // Integrate this resource file in compilation
// KickExeFileName "SomeCodeToTry.exe" // Optional exe/dll FileName
// KickSwitch -mem32 -32 -64 -run -dll  // See switch above (No switch mean -mem32)
// KickExeArgument "SomeArgCommandLine" // Command line to give to starting .exe
// KickLog // Log from Kick.exe for debug purpose
// KickHelp // Show this help
// KickOxyLog // Show Oxy text log
// KickUseDirectivesFrom "D:\Dev\o2\SomeOtherFile.o2bas" // Tell Kick to use directives from another file.
// KickEnd // To save time, Kick will not search Kick info passed this point
   .rc file only support KickUseDirectivesFrom and KickEnd.

.rc and .res compilation
If you compile a .rc, result will be .res file.
If you compile a .o2bas with an .res in // KickResource, then the exe will be compiled including the .res
If you compile a .o2bas with an .rc in // KickResource, the .res file will be compiled, and then the exe will be compiled including the .res.

Bitness feature:
If Pause key is down or Scroll-Lock is on when calling Kick, then the bitness of the exe/dll will be changed.
Aka: if a -32 swicth is found, 64bit will be used and vice-versa
This feature may be removed in the future.

O2 compiler directive:
Kick will respect the next directives
$ dll               
$ FileName "D:\o2\SomeCode.exe" 
#file "D:\o2\SomeCode.exe"
include "RTL32.inc"
include "RTL64.inc"

TextViewer.exe is used to show log and this help, it should be kept in the Kick folder.

Special keys
From your IDE, if you hold the PAUSE or the Left-WINDOW key down
while clicking your compile or compile/run button then the bitness will be flipped,
meaning, 32 bit option will become 64 and vice-versa.
Same effect if SCROLL-LOCK is on.
SHIFT key down force a run in memory 32

Splash screen
You may right click on the splash screen to keep it running or left click to end it.
To change the timeout, edit the Kick.ini [Properties] miliseconds SplashTime field.
Zero (0) mean no splash screen, maximum value is 10,000  for 10 seconds.

You may put a shortcut to Kick.exe on the desktop.
In certain case, if Kick freeze the editor, then starting it again it will try to auto terminate.

Theo Gottwald

This looks like it should be added to the Compiler.
Unless you want to enhace it to a Preprocessor that will also make changes in the code.

Pierre Bellisle

Hi Theo,

Can you elaborate on "enhance it to a Preprocessor that will also make changes in the code."
What do you mean precisely?

Theo Gottwald

Anybody has a unique idea of Commands and improvements he would like to add to any Compiler out there.

Me for example have a long liust of stuff i would like to aadd to Powerbasic, for example an optional
"INIT and Destroy" option for Variables, Procedures and this is just one thing.

This can be added in the compiler, but a lot of stuff can also be done by an intelligent pre-processor, which can first "Pre-Process" the code and then write the final to to be compiled.

If you have an own Editor you can even give this new language a new name and Filetype.
That would be the next step ... if you are so far :-)

Then you can start and make your own enhancements.
Then the question is, which enhancements you would like.

If you have your own Editor "On Top of (whatever)" you can make your own enhancements using a Pre-Processor.
Take the "Initialisation" and "Destruction" of Variables just as a Sample.
Other Stuff would be to be able to call a (Debug?)-Subprogramm whenever a variable is touched by the System.

Pierre Bellisle

Guten Tag Theo,

I see. My view is that writing an editor/IDE is not an easy task. There is a lot of good ones out there. The better I found is UltraEdit, I work with it for years and the only editors I found that was close but not better was Visual-Studio-Code and Sublime-Text.

I know Aurel, José Roca, Jürgen Kühlwein, and Paul Squires, and some others wrote their own. I really do not want to offend anybody here, but for me the best is still UltraEdit by far. (I hope you will forgive me Aurel!)

Multi caret, vertical and block selection, vertical edit and insertion, powerful search, highlight all occurrences of a chosen word, customization syntax highlight, word-auto-complete, auto-brace, many configurable buttons, hex-edit, etc, etc, etc. (See on YouTube)

So my reasoning is to not write an editor or IDE,  instead, pick the best one and build utilitys around it. UltraEdit are polishing their product for 25 years.

With PreCompiler and even PrePreCompiler in my case I can have an Oxygen .o2bas file, a PowerBASIC file, a FreeBASIC file, and a PureBASIC file all opened in the editor and all I have is one Compile button, one Compile & Run button, and one Run button. The compilation options are in the file if any are needed other than default.

For example, destruction of a variables, as you wrote, could be done simply by an utility called from UltraEdit. This is the way I like.

This said, I totally respect those other that write their own editor or IDE. Choice is a gift.

Theo Gottwald

How do you customize UltraEdit for Powerbasic?
Is it included in the Package or do yo uuse own "Template"?
I know Ultraedit for long Years, maybe its worth a closer Look then.
Which commercial version do you recommend for PB Users?
In my case i will still use JK-Edit, but if i have multiple large Projects open at the same Time,
i can not handle it easily in JK-Edit. So i use JK-Edit and the PB-Editor "Side by side".
Maybe UEdit would be an Option if it can be customized for PB.

Pierre Bellisle

I use my own config files.
Use the latest version, you can download a one month free demo at

I will prepare you a package with what I got for PowerBASIC.
Including a little "How to..."
I might do it tomorrow if I got time, I hope...

Added: Almost finish, will be back tomorrow...

Theo Gottwald

Hallo Pierre,
the most easy way to explain it, would be if you can make a Youtube Video that shows your system.
I see that the pricing with $150 is the same like in earlier time and looks ok for me.
So lets see your package. If i understand it, its maybe interesting.
To post that stuff, maybe you can open a new post in "3rd Party" so anybody can see it.

Zlatko Vid

$150 ...ughhh

thank you very much but NO  ;D

Pierre Bellisle

Hi Aurel,
yep, the price is really high for an editor, even it it is real good.
This is a major concern.
Around $40~$50 would have been more fair in my opinion.

Hi Theo,
I will think about the video, it's a good idea.
In the mean time, remember that there are many already on Youtube.

Bernard Kunzy

I have been using UltraEdit for years (version, for me it is the best to edit binary files, and it is able to manage very very large files.

Theo Gottwald

Quote from: Pierre Bellisle on March 11, 2023, 09:35:06 AM
Hi Theo,
I will think about the video, it's a good idea.
In the mean time, remember that there are many already on Youtube.
Hallo Pierre,
For Me counts, "How you work with it doing Powerbasic".
I doubt that there are such videos on YT. Unless you made them.
The best Program for making such Explanation Videos is "Camtasia".
I think its $199 or like that :-).

The Point is that i know Ultraedit for Years, i had an very old version long time ago.
So i know its really fast, and that helps when programming.
I guess there are really experienced ASM Programmers behind.
They can take what they want, because for long Time Users there are no Alternatives to UEdit.
However it must be customized to support PB specific functions like Debugging or Compiling, open folder etc.
Otherwise it will not be as fast as it can be. So I would like to see how you do it.
Aside from the price, "Know How" is most important.

Pierre Bellisle

I will se if I can do something, give me a little time,
I hope that Joel or Ethan Coen could help me...