Page 1 of 1
I have failed...
Posted: 02 Sep 2007, 15:22
by KDR_11k
Code: Select all
#ifndef __STACK_H
#define __STACK_H
static-var stack_error;
#define STACK(stackvar) static-var push_stackvar, pval_stackvar, pop_stackvar, stackvar, stackvar_isempty;\
func_stackvar(value, rec) {\
while (!pop_stackvar) {\
if(push_stackvar) {\
push_stackvar=0;\
call-script func_stackvar(pval_stackvar + 0, rec + 1);\
}\
sleep 30;\
}\
stackvar = value;\
if (rec == 0) stackvar_isempty = 1;\
pop_stackvar = 0;\
}\
\
stackvar_push(value) {\
if (stackvar_isempty) {\
stackvar_isempty = 0;\
start-script func_stackvar(value+0);\
}\
else {\
push_stackvar = 1;\
pval_stackvar = value;\
}\
}\
\
stackvar_pop() {\
if (!stackvar_isempty) {\
pop_stackvar = 1;\
stack_error=0;\
}\
else {\
stack_error=1;\
}\
}
#endif
This thing should be an implementation of a stack in BOS. Unfortunately, since #define won't replace its parameter properly if it's part of another identifier (e.g. function name) it won't work well, to have more than one stack in your code you'd have to copy&paste and search/replace the stackvar... Guess it's not possible to do this well.
Posted: 02 Sep 2007, 16:35
by imbaczek
use luaCOB, much much easier.
Posted: 02 Sep 2007, 18:04
by nemppu
lol fail)))))
Posted: 02 Sep 2007, 18:05
by nemppu
soz i dont very good
Posted: 02 Sep 2007, 18:09
by KDR_11k
imbaczek wrote:use luaCOB, much much easier.
Yeah, probably.
Posted: 02 Sep 2007, 18:45
by Guessmyname
Your location is breaking the forum! Ahhhhh!!!!!!!
Posted: 02 Sep 2007, 21:30
by rattle
I don't very good either.
PS: I noticed this too. BOS' macros are rather limited in their use.
Posted: 04 Sep 2007, 07:20
by MadRat
That's a limiting factor only if you know what is a stack. I bet most people don't get as fancy as you want simply because they find it easier to copy from existing examples. Well at least I'd always cut and paste from cavedog bos files for the basic framework of a bos to speed up the process.
Using the rem tag \ in the middle of your while statement looks like bad general usage of a rem statement. I'm surprised the bos compiler even knows in those cases to continue to read beyond that rem comment for the rest of the statement.
Posted: 04 Sep 2007, 10:21
by zwzsg
Your next mission, should you choose to accept it, is to acquire
Scriptor source code by any mean necessary, and "fix" our issues at the source.
Posted: 04 Sep 2007, 12:18
by imbaczek
scriptor is fubar, I was thinking about making a completely new compiler, probably would be easier...
Posted: 04 Sep 2007, 14:39
by KDR_11k
MadRat wrote:Using the rem tag \ in the middle of your while statement looks like bad general usage of a rem statement. I'm surprised the bos compiler even knows in those cases to continue to read beyond that rem comment for the rest of the statement.
WTF are you talking about?
Posted: 04 Sep 2007, 15:14
by zwzsg
MadRad got confused beween // and /* */, used to insert comments, which he calls remarks, and \, which is used to make a macro span several lines.
Posted: 04 Sep 2007, 16:44
by FLOZi
i.e. as usual he didn't know what he was talking about.
Posted: 04 Sep 2007, 21:29
by imbaczek
BTW is there a reason why everybody tells everyone to use scriptor instead of
http://cc.tauniverse.com/boscompiler.html ?
Posted: 04 Sep 2007, 21:30
by smoth
no idea, I have never used bos compiler. Scriptor is the tool everyone uses because we know for sure it works correctly.
Posted: 04 Sep 2007, 21:45
by Dragon45
The one you linked imbaczek, is neither as stable nor as pretty (IIRC) as Scriptor.
i think its also built to utilize some advanced features of a hacked TA.exe that mafia/prognosis developed a while back, and as such, has never really been as 'stable'.
Someone made something called The Brain a while back, and that as actually very feature-rich, but for some reason it never became widely accepted in the community (consistency and stability issues again, i think).
Scriptor has been the de facto standard for years.
Posted: 04 Sep 2007, 22:13
by zwzsg
I did try the Brain once. It was horrendous, would refuse most of my code, for stupid reason, like if I had a variable named k I couldn't use any other variable called kxx, it wouldn't tell which line was faulty like Scriptor does, it seemed to have lots of pass and intermediate compilation stages, and was generally loads of phail.
Scriptor's not perfect, but it's the best!
Ok, I admit I have not tried Cobbler or other alternatives
Posted: 05 Sep 2007, 02:06
by imbaczek
That assembler/compiler combo looks neat, source code says it does some optimizations. Does scriptor do that?
Also, prettiness is not something to judge a compiler on IMHO

Grab notepad++ and make a BOS syntax file that makes stuff pretty.
Posted: 05 Sep 2007, 03:52
by Argh
I have used BASM. It is not suitable for work with Spring, it produces code that Spring will not execute properly (probably order-of-instructions stuff, but the problems may be larger than that). It was very, very useful for studying low-level assembly of COB, though.