The Small language forum - message archive for 2001
The archive is sorted on date; the oldest messages appear first.
[67] Suggestion: counting branching
Posted By Jim Bellinger on January 01, 2001 at 16:28:07:
It'd be nice if the AMX addin piece could count branches or somesuch and break after a user specified count (as an option). This would be very convenient as I really can't have infinate loops happening (would be very very bad). Thanks, just a suggestioN! :)
[68] Re: Suggestion: counting branching
Posted By Thiadmer Riemersma on January 02, 2001 at 11:37:34:In Reply to: Suggestion: counting branching posted byJim Bellinger on January 01, 2001 at 16:28:07:
: It'd be nice if the AMX addin piece could count branches or somesuch and break after a user specified count (as an option). This would be very convenient as I really can't have infinate loops happening [...]
I uploaded a new manual which explains how to do this (in the chapter on the abstract machine). The SRUN sample now contains some more-or-less portable code to achieve this.
Thiadmer
[69] how to sleep
Posted By jaleco on January 02, 2001 at 22:51:26:
hi I am newbies to SMALLC ,
if have a question how to "sleep"
should if use "#emit opcode", or ....
and how to resume ? just call AM_EXEC,again ???
[70] Re: how to sleep
Posted By Thiadmer Riemersma on January 03, 2001 at 03:40:12:In Reply to: how to sleep posted byjaleco on January 02, 2001 at 22:51:26:
: if have a question how to "sleep"
: should if use "#emit opcode", or ....
: and how to resume ? just call AM_EXEC,again ???
The "sleep" functionality is very new, very undocumented and very unfinished...
1. You have to use "#emit sleep 0" where 0 may be replaced by some other value. amx_Exec() will hold that value in its "result" parameter.
2. To resume, call amx_Exec() with the pseudo function index AMX_EXEC_CONT (instead of AMX_EXEC_MAIN or a real index of a public function).
[71] Re: how to sleep
Posted By jaleco on January 03, 2001 at 05:00:54:In Reply to: Re: how to sleep posted byThiadmer Riemersma on January 03, 2001 at 03:40:12:
thanks for reply ,
I found a bug,
new a = 10 ;
new i = 0 ;
for (i = 0 ;i<10;i++)
{
printf("^nstart %d,%d",a,i) ;
#emit sleep
}
I didn't type sleep 0
this cause strang result
,then I look assmebly
I know why , because it become
"sleep jump 0" not
sleep
jump 0 ,
I wonder why it no error message
[72] how to make fix size program
Posted By jaleco on January 03, 2001 at 05:04:32:
I am build a application,
I want my script do run , by an absolut size,
how to do this ?
[73] Re: how to sleep
Posted By Søren Hannibal on January 03, 2001 at 12:02:29:In Reply to: Re: how to sleep posted byjaleco on January 03, 2001 at 05:00:54:
Without having looked at how the compiler handles the #emit I would guess that if you don't type a number it won't store a number after the opcode and if you do it will store it.
AFAIK #emit was written to test assembler commands, and the compiler has no clue about whether this opcode uses a variable or not. Therefore "it's not a bug, it's a feature". The final implementation will not use the #emit function so the bug will be eliminated automatically.
-Soren
: thanks for reply ,
: I found a bug,
: new a = 10 ;
: new i = 0 ;
: for (i = 0 ;i<10;i++)
: {
: printf("^nstart %d,%d",a,i) ;
: #emit sleep
:
: }
: I didn't type sleep 0
: this cause strang result
: ,then I look assmebly
: I know why , because it become
: "sleep jump 0" not
: sleep
: jump 0 ,
: I wonder why it no error message
[74] Re: how to sleep
Posted By Thiadmer Riemersma on January 04, 2001 at 08:46:55:In Reply to: Re: how to sleep posted bySøren Hannibal on January 03, 2001 at 12:02:29:
#emit is very primitive; it was indeed intended to test instructions before "carving them in stone". Nevertheless, I will check the #emit directive: it should not append other data on the same line.
Thiadmer
[75] Re: how to make fix size program
Posted By Thiadmer Riemersma on January 04, 2001 at 08:51:54:In Reply to: how to make fix size program posted byjaleco on January 03, 2001 at 05:04:32:
: I want my script do run , by an absolut size,
: how to do this ?
If I understand you correctly, you want a compiled Small program to fit in, say, 10 kBytes exactly, no more, not less. This, you cannot do in Small.
With a post-processing step, what you could to is to adjust the stack size after compiling. The total of the program size (code + data) subtracted from the fixed memory space then gives the (new) stack size. You can play with "#pragma dynamic nnn" until it fits, or build a program that changes the stack size value in the header of the compiled file.
[76] Life sign
Posted By Marc Peter on January 05, 2001 at 10:49:52:Hello everyone!
Just to show I'm still alive and willing to participate
further in the developement of Small, I'm posting this
message.
Of course my primary concern is in the core implemen-
tation of the abstract machine in assembler and the
JIT compiler.
For this I have a suggestion: With the Watcom
compiler going open source there is one special thing
going to be possible: Translate Small into temporay
C code and compile this using an embedded version
of the Watcom compiler. This would yield yet another
great speed boost, as well as simplify the interface
to the AMX. I have to admit though, that with this
solution Small won't be that light weight scripting
engine anymore. Comments? Thiadmer?
Regards
Marc
ps: If you encounter problems with the asssembler
AMX implementations, you should drop me a mail in
addition to posting here, as this will yield a better
response time...
[77] How to prevent user from accessing parent directories etc of INCLUDE directory
Posted By Jim Bellinger on January 07, 2001 at 17:33:06:For security I need to be able to not allow using INCLUDE files that are in directories such as ..\blah.inc, or C:\blah.inc, etcetra. How can this be done? Thank you.
By the way, I am not sure if this is too much to ask but would it be possible to have floating point support in the future? That would be very useful. Thank you. :)
[79] Re: How to prevent user from accessing parent directories etc of INCLUDE directory
Posted By Thiadmer Riemersma on January 08, 2001 at 07:15:43:In Reply to: How to prevent user from accessing parent directories etc of INCLUDE directory posted byJim Bellinger on January 07, 2001 at 17:33:06:
: For security I need to be able to not allow using INCLUDE files that are in directories such as ..\blah.inc, or C:\blah.inc, etcetra. How can this be done?
You would need to modify the compiler. In the file SC2.C, you could modify the function plungefile() to fail for every filename that starts with "X:" (where "X" is just any letter) or that contains a ".." substring anywhere in its path.
I don't know what you mean with "security" in this case, or how this limitation could enhance it. Is this a feature that more users could find useful?
: By the way, I am not sure if this is too much to ask but would it be possible to have floating point support in the future?
I have done some initial steps toward "operator overloading" which, in combination with native functions working on floats, would make working with floating point a lot easier. But I cannot say when I will finish this feature (if at all).
Thiadmer
[80] Re: Life sign
Posted By Thiadmer Riemersma on January 08, 2001 at 07:15:54:In Reply to: Life sign posted byMarc Peter on January 05, 2001 at 10:49:52:
Hello Peter,
Happy new year. Small is still alive too, and evolving slowly.
: [...] With the Watcom
: compiler going open source there is one special thing
: going to be possible: Translate Small into temporay
: C code and compile this using an embedded version
: of the Watcom compiler. This would yield yet another
: great speed boost, as well as simplify the interface
: to the AMX. I have to admit though, that with this
: solution Small won't be that light weight scripting
: engine anymore. Comments? Thiadmer?
At first thought, a JIT should be able to reach about the same performance as code that is compiled directly (see this as a ballpark measure). Compiled C is probably faster than Small+JIT because the Small compiler does not optimize the code very well, and the JIT does not post-optimize either. You could come quite close, I think, to achieving the performance level of compiled C with an optimizing Small compiler and an optimizing JIT.
That said, code optimization has also been off my mind lately, as the performance of your assembler virtual machine is adequate for my needs (and I have received some praise and no complaints on the performance of Small).
: ps: If you encounter problems with the asssembler
: AMX implementations, you should drop me a mail in
: addition to posting here, as this will yield a better
: response time...
I have made some modifications to the assembler interpreter (AMXEXEC.ASM) to support a few new opcodes. This interpreter is very stable and used in production. The JIT also saw some modifications, but it is slightly out of date: I am not sure whether it (still) assembles with MASM and the newly introduced SLEEP opcode is lacking.
[81] Re: How to prevent user from accessing parent directories etc of INCLUDE directory
Posted By James Bellinger on January 09, 2001 at 17:32:19:In Reply to: Re: How to prevent user from accessing parent directories etc of INCLUDE directory posted byThiadmer Riemersma on January 08, 2001 at 07:15:43:
: You would need to modify the compiler. In the file SC2.C, you could modify the function plungefile() to fail for every filename that starts with "X:" (where "X" is just any letter) or that contains a ".." substring anywhere in its path.
: I don't know what you mean with "security" in this case, or how this limitation could enhance it. Is this a feature that more users could find useful?
Oh, THEY won't find it useful, but as the script gives access to some of the internals of the engine and it is a multiplayer online game I don't want a disgruntled gamemaster to be able to do any damage to the server.
: : By the way, I am not sure if this is too much to ask but would it be possible to have floating point support in the future?
: I have done some initial steps toward "operator overloading" which, in combination with native functions working on floats, would make working with floating point a lot easier. But I cannot say when I will finish this feature (if at all).
: Thiadmer
That'd be great. Floating point would be most helpful :)
[82] Re: Life sign
Posted By Marc Peter on January 10, 2001 at 10:14:03:In Reply to: Re: Life sign posted byThiadmer Riemersma on January 08, 2001 at 07:15:54:
: Hello Peter,
: Happy new year. Small is still alive too, and evolving slowly.
Oh yes, I forgot. Seasons Greetings, too, from me.
Regarding the evolving of Small, I have some ideas
as well. I will send them in a different post.
: That said, code optimization has also been off my mind lately, as the performance of your assembler virtual machine is adequate for my needs (and I have received some praise and no complaints on the performance of Small).
Glad to hear that. Maybe I was a bit too enthusiastic about the Open Source Watcom...
: The JIT also saw some modifications, but it is slightly out of date: I am not sure whether it (still) assembles with MASM and the newly introduced SLEEP opcode is lacking.
I'm going to have a look at it. Updating the JIT with an opcode can't be that tricky. I think I can remember that I once tried the JIT with M$ VC4.0 and it worked.
Cheers
Marc (That's my first name, btw)
[83] Re: How to prevent user from accessing parent directories etc of INCLUDE directory
Posted By Marc Peter on January 10, 2001 at 10:21:36:In Reply to: How to prevent user from accessing parent directories etc of INCLUDE directory posted byJim Bellinger on January 07, 2001 at 17:33:06:
: By the way, I am not sure if this is too much to ask but would it be possible to have floating point support in the future? That would be very useful. Thank you. :)
The way I would implement this, is by having a native function that takes a string with a formula and returns a handle that can be given to another function (along with any desired parameters) to calculate a value. That wouldn't require a single change to the small compiler.
(Positive floats can be compared in integer mode, too, if that helps. Anyway, there would be relational operators in the string-grammer to implement coparision of arbitrary floats.) I've already done this kind of parser in Java for my diploma, so this wouldn't be a problem.
Any comments?
Cheers
Marc
[84] unsigned numbers
Posted By Tim Newsome on January 26, 2001 at 19:42:35:I'm looking to support unsigned compares in Small. I think the most natural way would be to turn < etc. into unsigned, and then have functions to do signed compares. I can see how to make that change (mess with os_lt etc), but I'm wondering if there are other assumptions in the compiler somewhere that would break horribly if I were to do that.
Tim
[85] Re: unsigned numbers
Posted By Thiadmer Riemersma on January 29, 2001 at 03:45:19:In Reply to: unsigned numbers posted byTim Newsome on January 26, 2001 at 19:42:35:
: I'm looking to support unsigned compares in Small. I think the most natural way would be to turn < etc. into unsigned, and then have functions to do signed compares. I can see how to make that change (mess with os_lt etc), but I'm wondering if there are other assumptions in the compiler somewhere that would break horribly if I were to do that.
One other assumetion that I am aware of is the "constant folding" optimization, which calculates the result of both sides of an operator are constant (e.g. "5 < 8"). This algorithm also assumes signed cells.
Of course, for unsigned numbers, you would have to modify the "lex()" routine to be able to read in numbers larger than the maximum signed value of a cell.
The original Small C, which was the basis for Small, supported both signed and unsigned integers. I removed this, assuming that signed large integers would be "big enough" for purposes that Small would be used. This led to the introduction of a new operator ">>>" for (unsigned shift right").
[86] Multi-module Small programs
Posted By Brian Poe on January 31, 2001 at 14:51:10:
To emulate a multi-module program, is the preferred way to create a "project" .sma file that simply
#includes each file in the project?
[87] Re: Multi-module Small programs
Posted By Thiadmer Riemersma on February 01, 2001 at 07:20:03:In Reply to: Multi-module Small programs posted byBrian Poe on January 31, 2001 at 14:51:10:
: To emulate a multi-module program, is the preferred way to create a "project" .sma file that simply
: #includes each file in the project?
Yes, that is the only way to do it. The Small compiler is a two-pass, and strips off functions that the program never calls (but you should prefix such optional functions with the "stock" keyword to avoid a warning).
Thiadmer
[88] Floating point (again)...
Posted By Brian Poe on February 01, 2001 at 12:52:22:
Thiadmer, could you briefly outline how Small could be modified to "natively" work with floating
point numbers? By this i mean support for code such as;
new float fX, fY, fZ;
fX = 1.25
fY = 3.25;
fZ = fX * pow(fY) / fX
...you get the idea. I'd be willing to spend a substantial amount of time on the Small source to get
floating point implemented.
thanks,Brian Poe
[89] Re: Floating point (again)...
Posted By Thiadmer Riemersma on February 02, 2001 at 04:07:23:In Reply to: Floating point (again)... posted byBrian Poe on February 01, 2001 at 12:52:22:
: Thiadmer, could you briefly outline how Small could be modified to "natively" work with floating
: point numbers? By this i mean support for code such as;
: new float fX, fY, fZ;
: fX = 1.25
: fY = 3.25;
: fZ = fX * pow(fY) / fX
If you want to modify Small so that it uses ONLY floating point, you must change the lexographic analysis functions (lex() and number() in SC2.C) to understand floating point literals. Then you must modify at least functions calc() in SC3.C, which is used for constant folding. I think all other changes would be in the abstract machine. In the abstract machine, all arithmetic must be done with floating point, of course, but pay attention for the few implicit comparisons to zero.
If you wish to have Small support both floating point and integers, you will need to re-introduce a kind of "type mechanism" that I removed from the original "Small C" (on which I based Small). In addition to the changes mentioned above, you must add a "type" field to the "symbol", "value" and "constval" structures (SC.H) and modify the expression parser in SC3.C to select the correct operation depending of the types of the operands on both sides of an operator. Then you must generate code for the new floating point operations, requiring changes in SC4.C (code generator) and SC6.C (assembler). Adding error messages is simple, but note that the message table is compressed and that the source and the compressed data are in the same file (SC5.SCP). You should add the new message to the "readable" part of one of the message tables. You may also want to adjust the peephole optimizer. Modifying the AMX is also more work, because many new opcodes (for dealing with floating point) will need to be implemented.
All in all, this is indeed a large investment.
For a compromise, I am currently working on "overloadable operators" in Small. The operator will choose which function to use based on the tags of the operands. So I am not introducing "types" in Small, and there is no type checking; Small has "tag checking" (and this tag checking may need to be made stricter for the purpose of overloaded operators --we'll see). The difference between tags and types may appear subtle, but tags are much more limited: Small will not be able to perform "constant folding" on floating point values, and you will not be able to use floating point constants in preprocessor directives. For convenience, I will try to make one exception: the lex() and number() functions should know how to handle floating point constants.
With overloaded operators, your demo program would look like:
new float:fX, float:fY, float:fZ
fX = 1.25
fY = 3.25
fZ = fX * pow(fY) / fX
plus, of course, the definitions of the overloaded operators:
native operator*(float:a, float:b) = flt_mult
native operator/(float:a, float:b) = flt_div
Now, when will I get this working? I don't know. Since my company doesn't make money on Small, it comes last. I would expect to have it implemented in a month, but don't be disappointed if I am late.
Some background information
---------------------------
When designing Small, I chose integers for two reasons: 1) for the applications that I had in mind (animation), I needed to be able to rule out rounding errors. 2) in interfacing with native functions, I was going to store all kinds of "handles" in a cell. Those handles could be pointers to internal data in the host application. For Small programs, a "handle" was just a magic value, some random bit pattern. With 32-bit integers as a cell, this works, but not all bit patterns form valid floating point numbers and I read that some processors issue an exception when you try to store an invalid bit pattern in a floating point register.
[90] Re: Floating point (again)...
Posted By Brian Poe on February 02, 2001 at 17:06:58:In Reply to: Re: Floating point (again)... posted byThiadmer Riemersma on February 02, 2001 at 04:07:23:
Thank you for your detailed response. The overloaded
operators looks very promising so i will hold out
and see how that performs. Could a preprocessor
step simplify the declaration of a "float" type i.e.
"new float fX, fY, fZ;" where the preprocessor would
emit the proper "tagged" declaration new float:fX, float:fY, float:fZ; ??
[91] Re: Floating point (again)...
Posted By Thiadmer Riemersma on February 05, 2001 at 05:17:27:In Reply to: Re: Floating point (again)... posted byBrian Poe on February 02, 2001 at 17:06:58:
: Could a preprocessor step simplify the declaration of a "float" type i.e.
: "new float fX, fY, fZ;" where the preprocessor would
: emit the proper "tagged" declaration new float:fX, float:fY, float:fZ; ??
Possibly, but I am not going to adapt the preprocessor for such a purpose: it adds too much complexity (starting from the fact that the preprocessor is line-based and the compiler is token-based). In most cases, there is a work-around. Instead of the common C-like way to handle variables (declare first, initialize later) I would like to have Small promote the C++ way (declare and initialize where needed). In other words, I would encourage you to write the example snippet presented earlier as:
new float:fX = 1.25
new float:fY = 3.25;
new float:fZ = fX * pow(fY) / fX
Thiadmer
[92] Re: Floating point (again)...
Posted By Brian Poe on February 05, 2001 at 11:57:41:In Reply to: Re: Floating point (again)... posted byThiadmer Riemersma on February 05, 2001 at 05:17:27:
That is not to say this would not fit into your proposed mods?;
new float:fX = 1.25
new float:fY = 3.25;
new float:fZ = fX * pow(fY) / fX
.
.
.
fZ = .......
[93] Re: Floating point (again)...
Posted By Thiadmer Riemersma on February 06, 2001 at 05:48:56:In Reply to: Re: Floating point (again)... posted byBrian Poe on February 05, 2001 at 11:57:41:
: That is not to say this would not fit into your proposed mods?;
Exactly
[94] amx_SetString impact on stack/heap
Posted By Florian Zschocke on February 08, 2001 at 09:56:16:
I am a newbie on Small and I have a question on how amx_SetString handles the stack/heap. What happens, when you set a C string to AMX string which is smaller than the AMX string? Imagin the following code:
Some Small program:
main() {
new s1[5];
native_function(s1);
printf("s1: %s\n", s1);
}
And some C code which implements the native_function:
static cell native_function( /* ... */ ) {
char string[21] = "01234567899876543210";
cell* cstr;
/* get the address for the Small string */
amx_SetString(cptr, string , 0);
}
Is this safe to use? Does SetString know how large the string in the VM is? What is going to be the output of the Small program? Am I wrecking havoc on the stack or heap with this? I read in one post that the VM does not allocate dynamic memory. So I guess that the string is not expanded to hold the full string passed in from C. Would there be a way to have it expanded?
Thanks,
Florian.
[95] Re: amx_SetString impact on stack/heap
Posted By Thiadmer Riemersma on February 09, 2001 at 08:34:05:In Reply to: amx_SetString impact on stack/heap posted byFlorian Zschocke on February 08, 2001 at 09:56:16:
A native function that stores a string that is larger than what the Small program has allocated for it, overwrites the data in the Small "abstract machine". Obviously, native functions should try to avoid this. Unfortunately, a native function cannot always know the bounds of an array. I consider the following rules:
1. In general, use arrays with an indeterminate length only for input. If a native function needs to store data in an array that is passed in as a parameter, declare this array parameter with a fixed size. For example:
native init_vector(vect[4], x, y, z)
2. If the first rule is cumbersome (as in the case of string functions), the native function can check whether it overwrites the bounds of the stack (or heap) or of the global data, but it cannot check whether it possibly overwrites part of another variable (while staying in the bounds of the stack/heap/data). You may want to add a "size" parameter to the native function so that the Small program already says how big the array is.
You cannot currently grow arrays dynamically. A native function can allocate memory inside the abstract machine, but the only way that a Small routine can access that memory is when the native function calls amx_Exec() and passes the address as a parameter.
Thiadmer
[96] multiple-instances of the same code
Posted By wastiee on February 13, 2001 at 10:53:06:Well, i haven't dig into Small very much yet, i was searching for a usable stable and binary scripting language to use in a new MUD (Multi User Dungeon), mostly for NPC (non-player character) AIs, and also for other things, like item-scripts, etc.
So, this means that, if there're 100 of the same NPC in the MUD World, then there'll be 100 different AIs running. Will Small interpreter (virtual machine, whatever it's called :P) allocate memory for each instance's code differently, or will it use the same code-memory-area with different memory addresses for data?
[97] Re: multiple-instances of the same code
Posted By Thiadmer Riemersma on February 14, 2001 at 03:17:35:In Reply to: multiple-instances of the same code posted bywastiee on February 13, 2001 at 10:53:06:
: [...], if there're 100 of the same NPC in the MUD World, then there'll be 100 different AIs running. Will Small interpreter (virtual machine, whatever it's called :P) allocate memory for each instance's code differently, or will it use the same code-memory-area with different memory addresses for data?
Small stores code and data in one continuous block, so 100 virtual machines (the manual calls them "abstract machines" or "AMX") with the same code have 100 blocks of memory with that code.
Separating code from data and re-using code has long been on the wish list, but I have not yet implemented it.
Thiadmer
[98] Limiting the number of instructions to be run
Posted By Kerem 'wastiee' HADIMLI on February 15, 2001 at 10:17:19:Well, is it possible to say the main exec function something like 'execute 50 instuctions, save state, and return', and then, after the program calls it again, it should continue from where it paused?
The reason i need something like this is, i'm planning to run multiple AMXes in an unthreaded program (multiplayer text-adventure server) in a "main_loop()".
If anyone implemented something like this, or have ideas about how this can be implemented, please reply.
Regards,
Kerem 'wastiee' HADIMLI
[99] Re: Limiting the number of instructions to be run
Posted By Kerem 'wastiee' HADIMLI on February 15, 2001 at 17:41:50:In Reply to: Limiting the number of instructions to be run posted byKerem 'wastiee' HADIMLI on February 15, 2001 at 10:17:19:
I have just examined the code a little bit more, and read the topic named 'how to sleep'.
I guess it'll work if i put a counter variable to it, that'll increase by each instruction, and when it becomes equal to some number (probably a number passed as parameter to amx_Exec()), it'll execute the same code that's executed when a 'sleep' (defined as "op_halt") instruction is seen.
Will this work? I'll be glad if someone can answer.
Regards,
Kerem 'wastiee' HADIMLI
[100] Re: Limiting the number of instructions to be run
Posted By Thiadmer Riemersma on February 19, 2001 at 04:49:51:In Reply to: Limiting the number of instructions to be run posted byKerem 'wastiee' HADIMLI on February 15, 2001 at 10:17:19:
: Well, is it possible to say the main exec function something like 'execute 50 instuctions, save state, and return', and then, after the program calls it again, it should continue from where it paused?
You can detect how many source code lines were executed (this is not the same as "instructions") with a "debug hook". The "srun" example shows this and (I think) the manual also has a section on it.
The tricky bit now is "restarting". To restart an abstract machine, the full status of the abstract machine should be stored. Currently, only the "sleep" instruction does so. In your case, the debug hook must also be able to store the full status. This is already on my "to do" list.
Thiadmer
[101] Re: Limiting the number of instructions to be run
Posted By Thiadmer Riemersma on February 19, 2001 at 04:53:37:In Reply to: Re: Limiting the number of instructions to be run posted byKerem 'wastiee' HADIMLI on February 15, 2001 at 17:41:50:
: I guess it'll work if i put a counter variable to it, that'll increase by each instruction, and when it becomes equal to some number (probably a number passed as parameter to amx_Exec()), it'll execute the same code that's executed when a 'sleep' (defined as "op_halt") instruction is seen.
I haven't tried this but, out of the top of my head, this should work.
Thiadmer
[102] regression test
Posted By Dieter Neubauer on March 15, 2001 at 10:00:17:do you have a regression test that can be used to validate that changes made to small will hurt the code in any other area?
I'm currently porting small to a 16 Bit machine, thereby finding some bugs that only appear with BIT16. Are you interested in getting back the changed sources? in which form?
[103] Re: regression test
Posted By Thiadmer Riemersma on March 15, 2001 at 10:40:17:In Reply to: regression test posted byDieter Neubauer on March 15, 2001 at 10:00:17:
: do you have a regression test that can be used to validate that changes made to small will hurt the code in any other area?
I have an ad-hoc regression test. Whenever I find a bug, I add a test for that particular bug to my test. The tests are mostly for the compiler. The abstract machine is tested too, but only in one form: usually Watcom/ASM. That is, if a bug is only in the "ANSI C" form of the abstract machine, the regression test is not likely to find it.
: I'm currently porting small to a 16 Bit machine, thereby finding some bugs that only appear with BIT16. Are you interested in getting back the changed sources? in which form?
If you can send me the source code and give me the date of the Small package on which it was based.
Thiadmer
[104] Re: regression test
Posted By Dieter Neubauer on March 16, 2001 at 09:16:26:In Reply to: Re: regression test posted byThiadmer Riemersma on March 15, 2001 at 10:40:17:
: : do you have a regression test that can be used to validate that changes made to small will hurt the code in any other area?
: I have an ad-hoc regression test. Whenever I find a bug, I add a test for that particular bug to my test. The tests are mostly for the compiler. The abstract machine is tested too, but only in one form: usually Watcom/ASM. That is, if a bug is only in the "ANSI C" form of the abstract machine, the regression test is not likely to find it.
: : I'm currently porting small to a 16 Bit machine, thereby finding some bugs that only appear with BIT16. Are you interested in getting back the changed sources? in which form?
: If you can send me the source code and give me the date of the Small package on which it was based.
: Thiadmer
Is it possible to get your regression test or is it downloadabel in any area?
[105] Re: regression test
Posted By Thiadmer Riemersma on March 17, 2001 at 09:27:28:In Reply to: Re: regression test posted byDieter Neubauer on March 16, 2001 at 09:16:26:
: Is it possible to get your regression test or is it downloadabel in any area?
I will make it downloadable. The regression test is a set of source files and a large batch file that runs all these source files through the Small compiler. I will keep you informed when I have it uploaded.
Thiadmer
[106] DLL's?
Posted By Joseph Fernald on March 27, 2001 at 11:05:47:
I've spent some time searching through the documentation on the site and have yet to find an answer to this question so I was wondering if one of you would be kind enough to answer. I'm wondering if it's possible to link to C++ dll files and use their functionality in the Small language, if so how? Thanks in advance.
[107] Re: DLL's?
Posted By Steven Blackburn on March 30, 2001 at 07:14:48:In Reply to: DLL's? posted byJoseph Fernald on March 27, 2001 at 11:05:47:
: I'm wondering if it's possible to link to C++ dll files and use their functionality in the Small language, if so how?
Firstly, I should say that I haven't got around to using Small yet, but intend to in the near future. As such, I cant directly comment on Small but on the problem in general.
The problem with linking from *any* language to a DLL written using C++ is that the C++ compiler mangles the names used by functions to support function overloading. This means that while you think a function should be named "do_something" it will probably be changed to "do_something_iVb" (or some such garbage). Alas, the ANSI standard does not define how the names should be manged, which makes it impossible to predict what names to use when the DLL is loaded. So on the first count, C++ can not be used.
It is possible to write a C++ dll so that names arent mangled, but then your interface can not use classes of overloading. This still might not be supportable by Small though, as DLLs are platform specific and I get the impression that the language should compile on quite a few platforms (Linux, perhaps).
Perhaps you could write a set of native functions which would call the DLLs that you want? This way the language is not polluted with Windows specific things....
Steve.
[108] German translation
Posted By If i only knew! on March 30, 2001 at 08:55:53:
Does anyone know where to get a german translation for the small manual???
[109] problem building compiler
Posted By David Lam on March 30, 2001 at 09:31:45:I am having problem building the compiler.
In MSVC6, the following were not found during linking:-
_delete_aliastable
_insert_alias
_lookup_alias
These are functions called in sc1 and sc6. The header sc.h suggested that they are in sclist.c. But sclist.c is no where to be found in the smallkit.zip distribution.
Can anyone offer any help?
TIA
David Lam
[110] Re: problem building compiler
Posted By David Lam on March 30, 2001 at 09:36:10:In Reply to: problem building compiler posted byDavid Lam on March 30, 2001 at 09:31:45:
I forgot to state that the smallkit.zip had a readme.txt file dated 24/03/2001.
Thanks
David Lam
: I am having problem building the compiler.
: In MSVC6, the following were not found during linking:-
: _delete_aliastable
: _insert_alias
: _lookup_alias
: These are functions called in sc1 and sc6. The header sc.h suggested that they are in sclist.c. But sclist.c is no where to be found in the smallkit.zip distribution.
: Can anyone offer any help?
: TIA
: David Lam
[111] Structures
Posted By Richard van Zon on March 30, 2001 at 17:02:57:I know Small is a typeless language, but in my application I need to define properties to a variable in a structure-way like button.x=30. So it's more like objects than structs, but I thought about solving it with tagnames, but as far as I read, that's not very dynamic in this case.
I mean I can't use variables dynamicly then like button1, button2 etc...
What's the best way and is there a way to simulate structures like described above ?
thanks...
[112] Re: DLL's?
Posted By Thiadmer Riemersma on April 01, 2001 at 08:29:55:In Reply to: DLL's? posted byJoseph Fernald on March 27, 2001 at 11:05:47:
: I'm wondering if it's possible to link to C++ dll files and use their functionality in the Small language, if so how? Thanks in advance.
I have included a general purpose DLL call function in the DLL versions of the abstract machine; the function is called "calldll()". It is not very well documented, and the corresponding loaddll() and freedll() functions are still missing. I made the function mostly because I needed a quick function to call any Win32 API function and the USER, KERNEL and GDI modules are already loaded for a Win32 "windowed" application.
If you need to call specific native functions from a specific DLL, the DLL just needs to register its functions to the AMX. The readme.txt file has some information on this.
Thiadmer
[113] Re: problem building compiler
Posted By Thiadmer Riemersma on April 01, 2001 at 08:33:37:In Reply to: problem building compiler posted byDavid Lam on March 30, 2001 at 09:31:45:
I am sorry. The file is missing in the distribution. I will upload a corrected smallkit.zip soon (today if possible).
Thiadmer
[114] Re: Structures
Posted By Thiadmer Riemersma on April 01, 2001 at 08:38:26:In Reply to: Structures posted byRichard van Zon on March 30, 2001 at 17:02:57:
: I know Small is a typeless language, but in my application I need to define properties to a variable in a structure-way like button.x=30. So it's more like objects than structs, but I thought about solving it with tagnames, but as far as I read, that's not very dynamic in this case.
The closest that one can come to structure is arrays combined with enumerations. The manual skims over the subject, I know, but their is a short description with an example on page 15 (of the latest manual). The example creates a "rectangle" enum and an array based on this: the indices of the array are tag checked.
Thiadmer
[115] Big Endian Compiler
Posted By Robert Daniels on April 13, 2001 at 19:03:44:
I've been attempting to get a version of Small running on a motorola coldfire 5307 running uClinux and have run into some problems with the compiler. I had to make a few tweeks to make it output header information in correct endianess and finally got a simple "Hello World" program to compile and run all on uClinux. When I moved on to bigger and better scripts, my compiler started having problems. I'm wondering if there could be further endian problems, has this compiler been built and tested on a big endian machine? Anyone else out there using small on a big endian machine?
[116] Re: Big Endian Compiler
Posted By Thiadmer Riemersma on April 14, 2001 at 10:19:26:In Reply to: Big Endian Compiler posted byRobert Daniels on April 13, 2001 at 19:03:44:
: I'm wondering if there could be further endian problems, has this compiler been built and tested on a big endian machine?
A few people wrote me that they intended to port Small to a Macintosh machine, but I have no further news from them. I do not have a big endian machine myself.
I know that at one time there were problems with the header of the .AMX file. I fixed those (I think) but there may be more of those errors left.
Anyway, if you can send me the changes you had to make, I can merge them into the original source, so that you don't have to repeat your modifications every time I update the tools.
Thiadmer
[117] Re: #pragma pack
Posted By Kantharaj Etigi on May 02, 2001 at 11:29:48:In Reply to: #pragma pack posted byLinus Nuber on November 29, 2000 at 08:45:01:
Hello!
Could any one help me how this " #pragma pack " works in Solaris 7.
When I compile and execute following C program code, it results in "Segmentation Fault(coredump)" while executing gethostbyname system call.
I think it because of pragma. This works fine in winNT.
I appreciate your help in resolving this problem.
Thanks & regards
Kantharaj Etigi
test1.c:
--------
//typedef struct _RTPPACKET typedef struct _NODE #pragma pack() // /********************************************************************************** // // } // end of InitRTPProducer /********************************************************************************** for(i = 0; i < ulPacketDataLen; i++) bSilenceValue = 127; } // end of Init16to8LUT_ULaw struct hostent * hp; InitRTPProducer(); hp =(struct hostent *) gethostbyname("localhost"); return(0); } // end of main testmake.gcc CFLAGS=-DUNIX -I. -g all: mytest mytest: test1.o
I succesfully embedded small to our new building automation and hospital air climatisation control system. The system controls air temperatures and air speed in high important areas in hospitals like operation rooms, intensive care room etc. The Small is used here to program scenarios and it is installed on a 80386Sx embedded computer. The performance is also excellent. We usd the Small because we wnt to be able to change the scenarios without compiling. We now compile Small programs on PC and download it via FTP. (Our controller support TCP/IP, FTP, HTTP and Telnet) Best regards, HAN CICIMEN
The Small compiler, when compiled under Linux, I could code around that in the .amx loading routine but
In Reply to: Different headers for Linux and Windows.
posted byFlorian Zschocke on May 09, 2001 at 11:14:27:
The LINUX compiler DOES write out 2 byte shorts. What you see are padding
bytes, because the following 'long' elements in the structure are aligned at
4 byte adresses.
To get rid of these problemns you should enclose the AMX_HEADER declaration
in amx.h with
In the newest version of the compiler, this is already done!
In Reply to: Re: Different headers for Linux and Windows.
posted byLinus Nuber on May 09, 2001 at 11:32:02:
: The LINUX compiler DOES write out 2 byte shorts. What you see are padding bytes, because the following 'long' elements in the structure are aligned at 4 byte adresses. Thought so. We had plenty of problems with the pack pragma because it messed up our other structures. : In the newest version of the compiler, this is already done! Oh, good thing I asked. :-) I'll get the latest version then. Thanks a lot,
In Reply to: Re: Different headers for Linux and Windows.
posted byFlorian Zschocke on May 09, 2001 at 13:16:43:
: Thought so. We had plenty of problems with the pack pragma because it messed up our other structures. As far as I know, the '#pragma pack ()' line resets the compiler to the standard alignment, so that only the AMX_HEADER structure is packed. The new version packs ALL structures, so you should reset the alignment after the AMX_HEADER typedef! : Is the code produced by it compatible with the AMX from February? The last version, which broke the AMX is AFAIK older. It was the compiler vesion, which invents the 'if (a < b < c)' syntax. Linus
In Reply to: Re: Different headers for Linux and Windows.
posted byLinus Nuber on May 14, 2001 at 04:34:10:
: As far as I know, the '#pragma pack ()' line resets the compiler to the standard alignment, so that only the AMX_HEADER structure is packed. The new version packs ALL structures, so you should reset the alignment after the AMX_HEADER typedef! I will reset the #pragma pack() at the end of the AMX.H file. : : Is the code produced by it compatible with the AMX from February? : The last version, which broke the AMX is AFAIK older. It was the compiler vesion, which invents the 'if (a < b < c)' syntax. I added a "sleep" instruction in January 2001 (at least, in January it got is final shape). That was the last time that I added or removed opcodes. The AMX header (and file format) only changed since then to solve problems with Big Endian versus Little Endian processors. By the way, only the "compact" file format is portable accross Big Endian and Little Endian processors. The format is currently not the default output file format of the compiler.
In Reply to: Re: Different headers for Linux and Windows.
posted byLinus Nuber on May 14, 2001 at 04:34:10:
: The last version, which broke the AMX is AFAIK older. It was the compiler vesion, which invents the 'if (a < b < c)' syntax. Off topic, by the way: I did not invent the syntax "if (a < b < c)"; I copied it from BCPL. Optional semicolons is another feature that I copied from BCPL. Thiadmer
In Reply to: multiple-instances of the same code
posted bywastiee on February 13, 2001 at 10:53:06:
I am currently writing a C++ wrapper for Small that accomplishes exactly this. There is only one copy of the Small code and multiple copies of the data block. Each time you execute on that Small script the wrapper will copy that instance's version of the data into and then out of VM space. There are some performance issues in this, especially if the small script has a huge data space, but in most cases I don't expect it to be a problem. The data space for a script shouldn't be that huge, and the overhead of doing a memcpy into and out of the script's memory space will hopefully just be a necessary and acceptable cost of executing a script. I am also looking at writing an object oriented wrapper for Small, so you can use a more conventional looking class model and then a pre-processor will convert the C++'ish looking code into C/Small script code behind the scenes. When/If I get this stuff finished I will be releasing it open source. John
In Reply to: Re: #pragma pack
posted byKantharaj Etigi on May 02, 2001 at 11:29:48:
Hi Kantha, Thanks in advance, : Could any one help me how this " #pragma pack " works in Solaris 7. : When I compile and execute following C program code, it results in "Segmentation Fault(coredump)" while executing gethostbyname system call. : I think it because of pragma. This works fine in winNT. : I appreciate your help in resolving this problem. : Thanks & regards : : : : //typedef struct _RTPPACKET : typedef struct _NODE : #pragma pack() : : // : : /********************************************************************************** : // : : } // end of InitRTPProducer : /********************************************************************************** : : for(i = 0; i < ulPacketDataLen; i++) : : : bSilenceValue = 127; : } // end of Init16to8LUT_ULaw : : struct hostent * hp; : InitRTPProducer(); : hp =(struct hostent *) gethostbyname("localhost"); : return(0); : } // end of main : testmake.gcc : CFLAGS=-DUNIX -I. -g : all: mytest : mytest: test1.o
Hello, Is it possible to do socket programming in Small? I've tried to include the correct headers and I get a segfault. Perhaps I'm missing something.. could you help me out? Thank you,
In Reply to: Socket programming in Small?
posted byRon Jamison on June 21, 2001 at 04:36:48:
: Is it possible to do socket programming in Small? I've tried to include the correct headers and I get a segfault. You need a native function library with the socket functions. I know this library has been made, but I do not have it myself. Thiadmer
I have read and understand the license that covers the Small language and all associate files, but I have one major question: Now i bring attention to " ... a subsystem of a larger software product ... ". What about a product that essentially IS the small script compiler and abstract machine; BUT for Palm. The generaly premise behind the product is a way to compile memo-text files on the palm into a program, which can then be executed. I already have a working version, and i also have a working version that produces the program files for palm, with no abstract machine required. Anyone know? Is there any additional Licensing info? Or anyone who has knowlegde of how the terms set out within the license can be interpreted?
Call me crazy, but why do my switch statements not work?? I noticed that you don't need a break; command, so that's affirmative. I haven't found any documentation on how the language works, as far as regular commands go. Anyone have any tips? Please e-mail me. Thanks
In Reply to: The License
posted byNicholas Cooper on June 22, 2001 at 19:16:38:
: As stated in the license : : Now i bring attention to " ... a subsystem of a larger software product ... ". What about a product that essentially IS the small script compiler and abstract machine; BUT for Palm. [...] It is okay to distribute a modified Small (even if those modifications are very minor). Typically, a license permits one to only distribute *unmodified* files. I wanted people to be able to use adapted versions of Small in their applications. The other clause in the license permits you to do what you want: Then, there are four conditions that tell you to include the copyright and the license if you are going to distribute source code, to acknowledge the origin of the software and to take responsibility for the changes that you made. Thiadmer (author of Small)
In Reply to: Switch?
posted byJoe Hansche on June 23, 2001 at 03:09:30:
: Call me crazy, but why do my switch statements not work?? I noticed that you don't need a break; command, so that's affirmative. The switch statement is very different from that of C/C++ (it is closer to the CASE statement in Pascal). There is no break, and only one statement can (and must) follow each case. To have multiple statements in a case, you must create a compound block for those statements. You can specify multiple values (and even ranges) per case. You may want to look at the The "weekday.sma" example in the toolkit, which has a switch. : I haven't found any documentation on how the language works, as far as regular commands go. All instructions are in the Small manual, the chapter is "Statements". Also read the chapter "Pitfalls" that covers more differences from C/C++. Thiadmer
In Reply to: Re: Switch?
posted byThiadmer Riemersma on June 23, 2001 at 06:42:29:
Ahhh thanks... I guess in that case, the reason I haven't seen any of these is that I didn't actually download a toolkit. I'm writing a plugin for AdminMod for Counter-Strike =P ... So, is Case a function (ie: case(1) : The switch statement is very different from that of C/C++ (it is closer to the CASE statement in Pascal). There is no break, and only one statement can (and must) follow each case. To have multiple statements in a case, you must create a compound block for those statements. You can specify multiple values (and even ranges) per case. : You may want to look at the The "weekday.sma" example in the toolkit, which has a switch. : : I haven't found any documentation on how the language works, as far as regular commands go. : All instructions are in the Small manual, the chapter is "Statements". Also read the chapter "Pitfalls" that covers more differences from C/C++. : Thiadmer
In Reply to: Switch?
posted byJoe Hansche on June 23, 2001 at 03:09:30:
OK, I know I'm not doing this right. and since I just figured the language
out from other sources, I didn't actually see a switch statement. So, could
anyone tell me if this is correct or what I need to change?? Thanks!
Whenver I try compiling it, it just hangs the compiler. It will never
actually show an error or display "Done". Any tips are appreciated
I'm getting a strange error whenever I register my plugin... It say something like "amx_BrowseRelocate: Assertion ... 'op>0 && op
In Reply to: BrowseRelocate Errors! ??
posted byJoe on June 23, 2001 at 20:10:23:
Sorry about that... This forum doesn't like < signs unless they're part of HTML... It should read like this: "amx_BrowseRelocate: Assertion ... 'op>0 && op
In Reply to: BrowseRelocate Errors! ??
posted byJoe on June 23, 2001 at 20:10:23:
You know what? Just screw it... Look at the quoted reply in the Comments box. This thing doesn't even use & codes... ohh well.
In Reply to: Re: Socket programming in Small?
posted byThiadmer Riemersma on June 22, 2001 at 03:17:31:
: You need a native function library with the socket functions. I know this library has been made, but I do not have it myself. Thiadmer, I realize I'm way below everybody else posting here in terms of knowledge of compilers and the Small API, so please be understanding of my newbie-like request. Although I know enough C to change existing code I am not very adept at writing my own. I could, given the proper amount of time, but my time is alotted to projects which I can finish efficiently. I can easily modify existing code in small and recompile it, but locating the person who wrote the "native function library" for small which contains socket functions is beyond me. This seems like a small community, and I'm unable to locate much info about Small online. Could you please point me in the right direction? I'd love to find such a library to work with. Thank you,
In Reply to: BrowseRelocate Errors! ??
posted byJoe on June 23, 2001 at 20:10:23:
: I'm getting a strange error whenever I register my plugin... It say something like "amx_BrowseRelocate: Assertion ... 'op>0 && op Thiadmer
In Reply to: Re: Switch?
posted byJoe on June 23, 2001 at 19:01:58:
: [...] What is missing are the colons after each case. So you should say "case 1:" instead of "case 1". Then again, you did find a bug (the Small compiler shouldn't hang). I will fix that. Thank you for reporting it. Thiadmer
In Reply to: BrowseRelocate Errors! ??
posted byJoe on June 23, 2001 at 20:10:23:
I just saw your other message where you mentioned that you are making a plug-in for Counter-Strike (I have heard of the game, but I do not know it). Small's compiler and manuals are evolving. Once in a while, someone takes the toolkit and embeds it. From that point on, Small is "frozen" as far as their application is concerned, but I continue to work on Small. That is to say, the people from AdminMod should provide you with the Small manual that reflects the compiler and abstract machine that they used. If you grab the manual from my side, it will probably mention features that AdminMod's "Small" compiler does not have. Worse, if you grab my Small compiler, chances are that the newest compiler uses an instruction that the abstract machine in AdminMod does not support. This would explain the error in amx_BrowseRelocate() that you saw. I will try to get in touch with the programmers of AdminMod to find out what version they are using (and to suggest that they update to the latest version). I suggest that you do that too; they may have a manual that matches their version of the compiler. If their compiler is over a year old, the syntax of the "switch" instruction may be quite different, for example. Thiadmer
In Reply to: BrowseRelocate Errors! ??
posted byJoe on June 23, 2001 at 20:10:23:
: It say something like "amx_BrowseRelocate: Assertion ... 'op>0 && op someArray[iIndex]++; That does not work. You have to use someArray[iIndex] += 1;
In Reply to: Re: BrowseRelocate Errors! ??
posted byFlorian Zschocke on June 25, 2001 at 07:28:36:
: The current version of AdminMod (2.50x) uses the 1.5 version of the Small compiler. The error you see stems from a bug in that compiler version. My guess is that you have something like this in your code: : someArray[iIndex]++; : That does not work. You have to use : someArray[iIndex] += 1; Indeed I recently fixed such an error. The fix is in a version that I just oploaded (June 25, 2001). Sorry for the trouble it gave you. Thiadmer
In Reply to: Switch?
posted byJoe Hansche on June 23, 2001 at 03:09:30:
: Call me crazy, but why do my switch statements not work?? I noticed that you don't need a break; command, so that's affirmative. I haven't found any documentation on how the language works, as far as regular commands go. Anyone have any tips? Please e-mail me. Thanks Yeah that stupid '{' got me today in a switch statement too. I call it an error in the language but I guess it's by design for some reason.
After issuing the make -f makefile.linux, I received this error: After changing line 560 in sc2.c it compiled (all I did was change "strnicmp" to "strncmp".) I'll admit that I am not much of a C coder, but I have never heard of the strnicmp function.
In Reply to: Problem compiling on RedHat Linux 7.0.
posted byRob Candland on July 12, 2001 at 14:14:27:
: After issuing the make -f makefile.linux, I received this error: : After changing line 560 in sc2.c it compiled (all I did was change "strnicmp" to "strncmp".) : I'll admit that I am not much of a C coder, but I have never heard of the strnicmp function. Ah, stricmp is the case-insensitive compare. seemed to work fine on my Linux box.
In Reply to: Problem compiling on RedHat Linux 7.0.
posted byRob Candland on July 12, 2001 at 14:14:27:
: After issuing the make -f makefile.linux, I received this error: Another strnicmp() pops up (I thought I had fixed removed all those functions long ago). strnicmp() is a string compare, case insensitive, and with a specified maximum length. It is a blend of strncmp() and stricmp() (or strcmpi() as some compilers have it). This function is not defined by ANSI and GLIBC doesn't have it. At least, not by that name. GLIBC has a function strncasecmp() which does extactly what is needed. So what is needed, is a #define that renames strnicmp() to strncasecmp(). I suggest that you add this in the file "sclinux.h". In the next upload, I will have fixed this too, by the way. Thiadmer
Hello everyone, and thank you for veiwing this. I have recently com across the admin mod, and downloaded a few plugins for it, I then realized I MUST know how to make my own. If anyone has a good website for me to learn small or a manual, e-mail me or reply please. FYI I have some programming history, if that helps at all. Thanks SOOOOO much,
In Reply to: I am a newbie please help.
posted byHollin WIlkins on July 20, 2001 at 22:02:49:
:[...] If anyone has a good website for me to learn small or a manual, e-mail me or reply please. FYI I have some programming history, if that helps at all. The Small manual is at this site (see the link at the bottom of this message too). It includes a tutorial. Note that the Small manual does not mention admin mod even once. However, the main site for admin mod has tutorials too. Thiadmer
In Reply to: I am a newbie please help.
posted byHollin WIlkins on July 20, 2001 at 22:02:49:
: Hello everyone, and thank you for veiwing this. I have recently com across the admin mod, and downloaded a few plugins for it, I then realized I MUST know how to make my own. If anyone has a good website for me to learn small or a manual, e-mail me or reply please. FYI I have some programming history, if that helps at all. You will find a link to the manual for the Small version that Adminmod uses at this page: http://www.adminmod.org/index.php?go=config
Just wanted to briefly touch the subject of existing or necessary Small tools. I have been working with the language for only a limited time now, but am truly impressed by it's facilities and ease of use for both systems developers and scripters. I have been working on a set of tools that I find useful when working in a Small environment, including a GUI interface to the compiler and a disassembler. In the future I am also hoping of adding run-time debugging, and a set of windows specific extensions. I am curious to know if there are any Small developers or communities that are collaborating in projects such as this. Are there enough Small users to warrant such development? What is the dominant OS among small users? I'd appreciate any input on the subject. As previously stated, I am truly amazed by Small and would like to contribute to the community as much as possible. Thanks, It seems like I sould be able to doing something like
the following but of course it generates this error:
Is there some syntax that I am missing that allows
me to pass an array of strings to functions like this?
In Reply to: Passing array of strings to a function
posted byPatrick Down on July 25, 2001 at 18:01:29:
: : hello.sma(14) Error [048]: array dimensions must match : Is there some syntax that I am missing that allows Your func() function is defined to take a one-dimensional array, but in your
main() you are passing it two-dimensional arrays. This cannot work in Small.
One option is to make func() accept a two-dimensional array, but then you would
have to define it as either:
neither of which matches your intention (if I understood that right). The
other option is to have the loops in main() and pass func() one-dimensional
arrays, like in:
This is not exactly what you want either. Actually, what you would need is
to declare func() as:
In Reply to: Re: Passing array of strings to a function
posted byThiadmer Riemersma on July 26, 2001 at 10:34:08:
: func(text[][],size) Yes that would do it. : but Small does currently not support this. I have just looked up the Small manual and concluded that it must be possible to change the compiler so that it accepts this syntax for function parameters. I will put that on my wish list. Thanks, I've worked around it for now. I hope the compiler will support it in the future.
In Reply to: Small Tools
posted byDavid Dickhaut on July 24, 2001 at 16:30:37:
: I am curious to know if there are any Small developers or communities that are collaborating in projects such as this. Are there enough Small users to warrant such development? What is the dominant OS among small users? Small is used for very diverse goals. I originally intended to use it for scriptable animation and games. When Dr. Dobb's published an article about Small, I was surprised to see that they put it in the "Embedded Systems" column, but it turns out that Small fits well in that catagory. On the main Small page (http://www.compuphase.com/small.htm), I list the users and usages that I am aware of (under the caption "Where is Small used?"). From that list, you can make educated guesses about a lot of things. Below are a few of my guesses: 1. The predominant operating systems that Small is used with are Win32 and Linux, on desktop machines anyway. On embedded systems, the OS-gamma is more diverse. 2. There are no communities that cooperate in enhancing Small. The "Enlightenment" projects came the closest to the concept of a Small development community, but I haven't heard from the Enlightenment team for a while. Several individuals and several companies have made modifications to better fit Small into their systems. Not every extension to Small is donated for inclusion in the main distribution, however, and I do not always merge the modifications that were donated into the main distribution. 3. Many products that use Small have a way to shield users from the command line tools. Usually, the compiler is launched automatically from the host application and it runs in the background; the abstract machine is embedded into the host application (nobody actually uses the "SRUN" sample, except for testing). I have never cared a lot about giving Small a GUI, because most host applications would need a host-specific GUI anyway. Where I have been wrong is the debugger. Writing a debugger from scratch is a lot of work. My "SDBG" sample is not application-specific and too spartan. This leads to many host applications that lack a debugger. Anyway, I am glad that you like Small. Thiadmer
Please explain how to give the user name and password in the mailing script given with remotely anywhere Please!!1
various bits and pieces...
about() stop using longjmp/setjmp! augh. what ugly code. it also crashes djgpp most
horridly.
get rid of the waitkey in about(). its inconsitent with every other CLI
program out there. thats what piping to more/less is for.
below is test3.sma to reproduce compiler crashing.
In Reply to: Mail
posted bySashi on July 28, 2001 at 05:35:19:
: Please explain how to give the user name and password in the mailing script given with remotely anywhere All I know about the application "Remotely Anywhere" is that it uses Small for scripting. Setting the name and password is probably specific to the application, although it may be hardcoded in the script. I suggest that you ask this at www.remotelyanywhere.com (they ought to know). Thiadmer
In Reply to: Bugs and bits and pieces
posted byStewy on July 29, 2001 at 12:25:58:
: about() : stop using longjmp/setjmp! augh. what ugly code. it also crashes djgpp most horridly. Actually, one would want to tackle this with exception handling. But the code is in C and the closest thing that C offers is longjmp(). I will try to verify longjmp() with djgpp; it shouldn't crash. : get rid of the waitkey in about(). its inconsitent with every other CLI program out there. thats what piping to more/less is for. : below is test3.sma to reproduce compiler crashing. I will look into this. Thank you for the report. Thiadmer
In Reply to: Re: Bugs and bits and pieces
posted byThiadmer Riemersma on July 30, 2001 at 05:06:49:
: I will look into this. Thank you for the report. i'll let you know how i go.
I am interested in small if it can be integrated into our game engine. thanx :)
In Reply to: Can a native C/C++ function call some small function explicitely or pass parameters to small ?
posted byDick Guan on August 04, 2001 at 02:00:20:
: The situation is that at each frame(or at each step in game-loop), we would decide which small script to run and we have several related parameters to pass. how can we do that with small AMX smoothly? 1. In the Small script, you must make the functions that you want to call from the outside "public". 2. When you load the script, you can either look up specific public functions by name (amx_FindPublic) or browse through the list of all public functions (amx_GetPublic). In either case, you will end up matching a function name to a function index (an integer). 3. In amx_Exec, pass the function index plus all parameters. The parameters must be cell-sized. If you are going to pass arrays, you must allocate space for these arrays in the abstract machine. To this end, use amx_Allot and amx_Release. Hope this helps. By the way, I do something along these lines in a demo for our EGI animation toolkit. At various events (e.g. just before displaying a new frame, or when reaching a label) the EGI player calls an associated "event function" from the animation script. Thiadmer
In Reply to: Re: Can a native C/C++ function call some small function explicitely or pass parameters to small ?
posted byThiadmer Riemersma on August 04, 2001 at 07:35:01:
Thanx a lot :) Dick
In Reply to: Re: Can a native C/C++ function call some small function explicitely or pass parameters to small ?
posted byThiadmer Riemersma on August 04, 2001 at 07:35:01:
: 3. In amx_Exec, pass the function index plus all parameters. The parameters must be cell-sized. If you are going to pass arrays, you must allocate space for these arrays in the abstract machine. To this end, use amx_Allot and amx_Release. Thiadmer, could you elaborate som more on amx_Alloc() and amx_Release()? How are they used? Do I understand you correctly when i assume that amx_Alloc() is called before amx_Exec() and after the Exec() returns amx_Release() gets called to free up the allocated space? Does the space get allocated on the stack or on the heap? Also, what could be possible causes for a stack/heap collision? Thanks,
In Reply to: Switch?
posted byJoe Hansche on June 23, 2001 at 03:09:30:
: Call me crazy, but why do my switch statements not work?? I noticed that you don't need a break; command, so that's affirmative. I haven't found any documentation on how the language works, as far as regular commands go. Anyone have any tips? Please e-mail me. Thanks hehe... I was just reading thru the Small page again today, and I saw something that caught my eye... Well, it should -- it's my NAME! =P Seemed somehow I found a bug =) Then I came here and found this reply... So, NOW I know it's a bug in the compiler =) Just thought I'd share that with you. hehe, thought it was pretty funny =P -Joe
In Reply to: Re: Can a native C/C++ function call some small function explicitely or pass parameters to small ?
posted byFlorian Zschocke on August 07, 2001 at 10:13:01:
: Thiadmer, could you elaborate som more on amx_Alloc() and amx_Release()? How are they used? Do I understand you correctly when i assume that amx_Alloc() is called before amx_Exec() and after the Exec() returns amx_Release() gets called to free up the allocated space? Does the space get allocated on the stack or on the heap? I was going to write you how to use the functions and to direct you to the manual, when I found that the manual is very, very brief on the subject and also, the description does not match the code. I have to look more carefully, but at the moment, I think that the code is correct and the documentation is wrong. The intended usage is, indeed, that you call amx_Allot() before calling amx_Exec() and to call amx_Release() afterwards. Three points: 1. Between amx_Allot() and amx_Exec() you can fill the memory that you grabbed (with string data, or otherwise), using a pointer that amx_Allot() returns. 2. axm_Allot() also returns a second address: the AMX address. This value, you must pass in the call to amx_Exec() at the position of the array (or reference parameter). 3. Between the return from amx_Exec() and the call to amx_Release(), you can read back the contents of the array. If the Small function filled the array, you can read the new data. This also works for reference parameters. In this context, a reference parameter is just an array with size 1. The memory is allocated from the "heap". : Also, what could be possible causes for a stack/heap collision? I have always used small stack sizes, because my own scripts are only little and I rarely need large arrays. The default stack has been 2048 cells for a long time. I think that recently I increased it to 4096 cells. For some purposes, this is still a small stack. So one possible cause for a stack heap collision is a stack that is simply to small for your purposes. Note that the "heap" in Small is more like a second stack. Default values for arrays and references stored on the heap. If you make heavy use of default values (for arrays and references) the heap fills quickly. There is a compiler option and a #pragma to set the size of the stack. Actually, it sets the size for the stack and the heap combined (both share the same block). The more recent versions of the compiler support a config file (SC.CFG) in which you can set your default options. Of course, a recursive function can also be quite "stack intensive". Calling amx_Allot() repeatedly without ever calling amx_Release() also does the trick. Thiadmer
I am loading multiple scripts at one time. To save some memory I am sharing one Heap/Stack space among the multiple AMX. Is there anything in the Heap or Stack that needs to be preserved in between function calls? Aren't the global variables in a different memory space? As soon as I exit from a public function, I should be able to trash the Heap/Stack space, correct?
In Reply to: Different AMX sharing the same Heap/Stack space
posted byOdie Calima on August 09, 2001 at 18:00:17:
: I am loading multiple scripts at one time. To save some memory I am sharing one Heap/Stack space among the multiple AMX. Is there anything in the Heap or Stack that needs to be preserved in between function calls? Aren't the global variables in a different memory space? As soon as I exit from a public function, I should be able to trash the Heap/Stack space, correct? What is mostly requested is the ability to share the "code", not the data. Global variables are in a memory block that follows the code and precedes the stack. The stack holds local variables and grows downwards. The heap is actually a second stack; it holds temporary copies of the "default values" of array or reference parameters. The heap grows upward. In absence of multi-threading, I see no reason why multiple abstarct machines could not share the stack and the heap. The important thing to straighten out is that the stack and heap pointers in all AMX structures must be kept synchronized. After amx_Exec() returns, the stack and heap pointers (i.e. the STK and HEA pseudo-registers) should have exactly the same values as just before the call to amx_Exec(), with one exception (!) the "sleep" instruction causes amx_Exec() to abort *without* resetting the stack and heap, so that the abstract machine can be restarted. Thiadmer
Hi all,
In Reply to: Documentation
posted byB. Ahrenholz on August 14, 2001 at 12:10:15:
: [...] where can I get a documentation or manual for small? It's downloadable? The latest manual is at: http://www.compuphase.com/small.htm (You can also use the link at the bottom of this message.) If you are useing AdminMod, the manual for the Small version that AdminMod currently embeds is at: Thiadmer
I wanted to make sure the Console window started minimised and I'll probably want to make other modifications to the DLL later. So I started a new MSVC project, imported the files, set the preprocessor flags AMXAPI = __stdcall and predefining amx_Init, this is where the problems start, push() causes compiler errors and the whole amx_Init rempping seems to be causing problems too. Can anybody please help! Or better still does anybody have an MSVC project for building the AMX32M DLL. Cheers! -Jason
In Reply to: Problems compiling AMX DLL under MSVC 6
posted byJason Reeve on August 18, 2001 at 12:15:05:
: [...], push() causes compiler errors and the whole amx_Init rempping seems to be causing problems too. I have no immediate solution, but I will look into this. The push() function is a trick which I copied from a programming book from the Windows 3.1 era. I know that it works under 16-bit compilers by Borland and Microsoft and in 32-bit compilers by Watcom and Borland. Perhaps, indeed, Microsoft Visual C/C++ imposes stricter checks. You should be compiling in "C" mode, by the way, not in "C++" mode. The reason is that in C++ the definition "void push()" is equal to "void push(void)". By the way, function push() is only called from CallDLL(), if you don't need the functionality of calldll(), you can just put a "#if 0 ... #endif" pair around it. The amx_Init() remapping should work, though. Make sure that you compile all AMX related source files with amx_Init defined to amx_InitAMX. Thiadmer
In Reply to: Re: Problems compiling AMX DLL under MSVC 6
posted byThiadmer Riemersma on August 19, 2001 at 09:55:32:
Ok, thanks, I'll recheck what I have amx_Init defined as. I've not had much experience with DLL's and I'm having difficulty generating the .lib file for the AMX DLL. I usually just ask MSVC for a DLL project and it does all that stuff for me! Now I have to convert the AMX DLL project and I'm stuffed without my handy dandy DLL wizard! Any tips? Cheers, Jason
In Reply to: Re: Problems compiling AMX DLL under MSVC 6
posted byJason Reeve on August 19, 2001 at 15:11:18:
I have managed to create the lib file using a .DEF file. So now it compiles, links, generates the lib and dll files. But I have a new problem. The DLL for AMX seems to init ok, the test program loads but when it comes to print "hello" (I'm using hello.sma example) it fails to open the console window, I debugged it as far as 'printstring' in amxcons.c where it should call 'amx_putchar' but it never seems to get there and so never opens the console window. Any ideas? Cheers, Jason
In Reply to: Update,,,
posted byJason Reeve on August 19, 2001 at 20:36:16:
I fixed the problem with the console, I noticed after looking around the Watcom make file there was a preprocessor directive to define NO_DEF_FUNCS I added this to my MSVC compiler options and I now have the AMX (with assembler core) compiling as a DLL. If anybody wants the project files then give me a shout and I'll place them on our webserver and publish the link. Cheers, Jason.
Hi, in sc.h If we modify it (bigger or smaller), what points should we care and what's your opinions and suggestions ? thanx.
In Reply to: About sc(small compiler)'s length restriction on symbol name
posted byDick Guan on August 29, 2001 at 11:30:53:
: If we modify it (bigger or smaller), what points should we care and what's your opinions and suggestions ? Be careful, there is a #define sEXPMAX in amx.c (SRUN source code) too.
In Reply to: About sc(small compiler)'s length restriction on symbol name
posted byDick Guan on August 29, 2001 at 11:30:53:
: Through our testing on small, we figure out that there are length restriction on symbol name, and we are interested in increasing it a little :) The Small compiler makes a difference between maximum lengths of "public" symbols and maximum lengths of all other symbols. sNAMEMAX (non-public symbols) can be increased without problems, the only drawback is increased memory usage. When changing sEXPMAX, the file format changes (as the names of public symbols are stored in the compiled file). If you increase it: 1. make sure that the abstract machine is aware of this too (as Clem Vasseur mentioned, the definition of sEXPMAX also occurs in AMX.C; I copied this #define rather than using a shared include file so that the abstract machine could be compiled separately). 2. make sure there won't be mixups between compiled files produced by different compilers, so if you are going to provide the compiler with your product, tell your users that they should use the compiler that they can grab from this site. : #define sSTKMAX 80 sSTKMAX is used for entirely different purposes; it is most heavily used for nested include files. A small stack can be a problem if you heavily nest your include files. There is no problem in increasing it. Thiadmer
I'm new to Small (thx (or not) to AdminMod) I wanted to highlight the syntax. I'm using TextPad and i'm doing this for PHP and it works well. I've search for Small but didn't find it :/
In Reply to: Syntax Highlight
posted byConrad on September 04, 2001 at 17:09:23:
: I wanted to highlight the syntax. I'm using TextPad and i'm doing this for PHP and it works well. : I've search for Small but didn't find it :/ Small is not THAT popular that text editors include the syntax highlighting definitions. Most keywords in Small are shared with C. There are a few differences: type names ("int", "double", etc.) are no keywords in Small, and Small has a few more keywords for different purposes ("native", "public", "new"). I do not know TextPad, but usually, these editors allow you to add syntax highlighting formats. A list of all keywords can be found in the Small manual (http://www.compuphase.com/smalldoc.pdf). Thiadmer
In Reply to: Syntax Highlight
posted byConrad on September 04, 2001 at 17:09:23:
: I wanted to highlight the syntax. I'm using TextPad and i'm doing this for PHP and it works well. As Thiadmer explained you should do fine with the C text highlighting. There is a syntax file available at the Adminmod Scripting forum which defines the syntax highlighting for Small for the editor UltraEdit. As of now I know of no such file for TextPad. You could check there if somebody else has done it for TextPad, though.
I try to use these *property functions and nothing work :/ I've read the manual and i'm a bit confused with the four parameters. Maybe my English (i'm french) isn't so good :P So if I could have a exemple wich works it will be great. In fact I try to access to vars by a dynamic method thru a function which takes the var name in param and return the value (or a default value). don't getproperty and setproperty could help doing this ? Transition from an interpreted language (php) is a bit difficult :)
Hi people,
I've written a small SMALL testing program ;)The program has only to call the hello.amx.
When I want to compile my console app I'm getting the following error:
Does someone know how I can get it working?
Bye,
The code:
In Reply to: Re: Syntax Highlight
posted byFlorian Zschocke on September 07, 2001 at 14:22:31:
If you use EditPro (shareware from Serpiksoft at http://www.serpik.com/) you can build your own syntax file (or I can give you mine). However it's shareware so if you find some FREE counterpart, let me know on this forum :)
In Reply to: Getting unresolved external symbol using AMX_NATIVE_INFO
posted byAlexander bierbrauer on September 10, 2001 at 07:59:32:
At first sight it seems a name decoration problem between C++ and C. Maybe the solution is something like : extern "C" { //extern "C" avoids name decoration
Hi people, I've read the documentation and understand everything so far...but I can't get it working in practice! Does anyone have some sample VC6 code for me??? I'm getting error 19 but don't know how to get rid of it. that's the code of test.sma: native test(); main() I'm getting the error on amx_Init(amx,program); Here's the rest of the code: AMX_NATIVE_INFO test_Natives[]={{"test",test}}; /******************************* file=fopen(path,"rb"); fread(&header,sizeof(AMX_HEADER),1,file); error=amx_Init(amx,program); return NULL; void main() cout<<"SMALL testprogram\n"< error=amx_Register(&amx,test_Natives,-1); if(error!=AMX_ERR_NONE)
In Reply to: Help!! anyone got some code or can help me??
posted byAlexander Bierbrauer on September 10, 2001 at 13:17:44:
In Reply to: Help!! anyone got some code or can help me??
posted byAlexander Bierbrauer on September 10, 2001 at 13:17:44:
Error 19 is AMX_ERR_NOTFOUND (from AMX.H). Are you sure that it is amx_Init() that returns this? When looking through the code in AMX.C, it would be amx_Register() that causes error AMX_ERR_NOTFOUND rather than amx_Init(). amx_Register() returns AMX_ERR_NOTFOUND when the compiled Small program contains (still more) unresolved native functions after the call to amx_Register(). : AMX_NATIVE_INFO test_Natives[]={{"test",test}}; One error that I see in your code (but I do not know if that is related to your problem) is that the test_Natives list is not NULL terminated, but the count passed into amx_Register() is nevertheless set to -1. amx_Register() has two options: either you pass in a valid count of native functions in the structure (1, in your case), or you pass in a NULL-terminated list. Thiadmer
In Reply to: What kind of error do you get?
posted byXanathar on September 10, 2001 at 18:09:31:
Hi, I've changed the program a little. I'm using hello.amx now (provided by SMALL)...now, I'm getting an error on this line: It's error Nr.6 (must be signed to an array...).. what the hell went wrong?? I do not see any important differences between my code and srun.c. Here's the code...please....helpp!!!!!!!!!!! extern "C" /******************************* file=fopen(path,"rb"); fread(&header,sizeof(AMX_HEADER),1,file); error=amx_Init(amx,program); return NULL; void main() program=loadprogram(&amx,"hello.amx"); error=amx_Register(&amx,core_Natives,-1); if(error==AMX_ERR_NONE) if(error!=AMX_ERR_NONE)
Small compiler 1.6 Copyright (c) 1997-2001, ITB CompuPhase An integer divide by zero was encountered at address 0x004096ca. ----------------------------------------------------- ----------------------------------------------------- This seems to happen when compiling certain files with a #pragma tabsize 0. Thank you for all :)
In Reply to: Bug Report (?)
posted byXanathar on September 14, 2001 at 03:10:06:
If you need the files to test it, I'll send them thru mail :D
In Reply to: Bug Report (?)
posted byXanathar on September 14, 2001 at 03:10:06:
: Small compiler 1.7 Copyright (c) 1997-2001, ITB CompuPhase Yes, please send me the files that provoke this error by e-mail. Thank you. Thiadmer
In Reply to: Re: Bug Report (?)
posted byThiadmer Riemersma on September 14, 2001 at 03:38:24:
I've noticed some mail problems.. tell me if you don't receive it :)
In Reply to: Help with *property functions
posted byConrad on September 07, 2001 at 18:04:43:
plz just a getproperty or setproperty example which works !!
Can in some future pragma pack(1) be changed in something like (for example) :
The problem is that it's extremely difficult to manage pragma pack under GCC/G++
since a pragma pack misplaced can actually trash STL code and/or other
classes/structs [trashed vtables, etc]. Thanx for the attention :)
In Reply to: Help with *property functions
posted byConrad on September 07, 2001 at 18:04:43:
Here you are. There is one problem though, when testing the second part of this example program (on "value properties"), I noticed two bugs in the code that make it not work. This is how it should work, however; I will have these bugs fixed in the next release. By the way, the first part of the example ("string properties") works fine. Thiadmer
In Reply to: Re: Help with *property functions
posted byThiadmer Riemersma on September 24, 2001 at 03:28:19:
(also for the mail ;) I've made some test and it seems to work in my scripts. Thx cause without this i would not figure how to use these func.
In Reply to: Proposal
posted byXanathar on September 23, 2001 at 06:39:54:
: The problem is that it's extremely difficult to manage pragma pack under GCC/G++ since a pragma pack misplaced can actually trash STL code and/or other classes/structs [trashed vtables, etc]. I thought that had been fixed by turning #pragma pack off at the end of amx.h?
In Reply to: Re: Proposal
posted byFlorian Zschocke on September 25, 2001 at 07:22:34:
I'm trying to compile small under DOS using DJGPP (gcc 2.95.2). I then tried the examples and test suite, and thought most of the things ran OK, I got a couple of bugs, that seem related to assignement: - queue.sma give a run-time error 4 on line 51, when it try to insert the first message in the queue. using sdbg, pos sometime contains a random number when execution reaches line 51. and the debugger won't display the content of "queueitem" (symbol not found). - in the test suite, all the tests but one succeed: the 4th ("a ^= b ^= ...") gives the wrong result: One question: why are there such restriction on the user defined operators (no references, no arrays, no assignement operator redefined)? handling strings the way C does is not very easy, and can be a lot of trouble to the people who will use scripts without being real programmers. defining operators to work on strings could help a lot... thanks for your time Julien Cugniere
In Reply to: compiling small under DOS using djgpp
posted byJulien Cugniere on September 26, 2001 at 12:41:46:
: handling strings the way C does is not very easy, and can be a lot of trouble to the people who will use scripts without being real programmers. defining operators to work on strings could help a lot... I totally agree. Also, it would be cool if BIT16 actually worked. Does somebody successfully uses BIT16 with the current version ? Speaking of compile-time defines, NODBGCALLS does nothing (?) and NOEMIT is not documented. Sorry Thiadmer for posting here but since it takes you a month to reply to my email, well... :)
In Reply to: compiling small under DOS using djgpp
posted byJulien Cugniere on September 26, 2001 at 12:41:46:
: - queue.sma give a run-time error 4 on line 51, when it try to insert the first message in the queue. using sdbg, pos sometime contains a random number when execution reaches line 51. and the debugger won't display the content of "queueitem" (symbol not found). This somehow looks like a code generation bug. I will look into it. Thank you for the report. : - in the test suite, all the tests but one succeed: the 4th ("a ^= b ^= ...") gives the wrong result: This test fails in every Small version. Actually, this test should not be in the test suite; I keep it around to remind me of an incompatibility of Small versus C. This test would fail in Java too. At first I thought I would fix it. Now I think that it is better to document the behaviour of Small in relation to this particular construct. : One question: why are there such restriction on the user defined operators (no references, no arrays, no assignement operator redefined)? handling strings the way C does is not very easy, and can be a lot of trouble to the people who will use scripts without being real programmers. defining operators to work on strings could help a lot... "No references", because assignment should not have side effects on the operands. That is, after doing printf("%d", b + c); you would not expect b or c to have been modified by the + operator. "No arrays" is due to implementation difficulties. Allowing arrays on in user-defined operators is on my wish list. "No assignment" is partially because of implementation issues and partially because I feel that data should not change due to an assignement (but I admit that for automatic type conversions, it is convenient to automatically change data by means of a user-defined operator). Thiadmer
I've just downloaded smallkit & built a win32 console application based on sclib using my Microsoft Visual C++ 6.0, and (at warning level 1 and above) got over a dozen errors - almost all type compatibility, but a couple of others. I added all the necessary casts, they seem portable, should I send the modified sources in? Also VC issues two warnings about variables used-without-being-set in function declglb - and they look like they might be worth checking by somebody who understands the code.
In Reply to: Re: Is Small Assembler compiler threadsafe?
posted byThiadmer Riemersma on November 06, 2000 at 03:20:26:
: :[...] is the Assembler compiler threadsafe? : The Just-in-Time compiler (files JITR.ASM and JITS.ASM) are, to the best of my knowledge, thread-safe (it stores all data on the stack). : In case you were referring to the AMXECEC.ASM file (the assembler core of the abstract machine). This file is thread-safe as well. : The Small compiler (files SC*.C) is not re-entrant (or thread-safe). : Thiadmer
Hi, I've built a CScript class that is based on my CThread class, being a complete newbie when it comes to multithreading, i feel there may be a really easy answer to my problem... I'm getting a serious performance hit with just two scripts running in their own threads. There is no perceptible loss of performance If I disable multithreading and just call Upadate() routines every frame instead. I tried calling sleep(0), which relinquishes the rest of the time reserved by that thread to other threads of the same priority and that helped a little. I can't stress enough just how bad the performance hit is. BTW just in case anybody asks, I have no msg handling just a plain while( !finished ) in the Threadproc, so the script is running 'full speed' unfortunately it seems to have priority over my main app, so the framerate slows to a crawl. Like I said, disable the multithreading and the script causes no noticable performance hit, so it does look like my implementation of multithreading is at fault. Any help would be appreciated, cheers. -Jason
In Reply to: Errors & warnings from MSVC++ 6.0
posted bySpike McLarty on September 29, 2001 at 02:06:02:
: I've just downloaded smallkit & built a win32 console application based on sclib using my Microsoft Visual C++ 6.0, and (at warning level 1 and above) got over a dozen errors [...] I am interested in the error messages. You can send me the information. That said, we have Microsoft Visual C/C++ here too, so I should be able to reproduce the problem. I am using Watcom C/C++ 11.0 (at the highest warning level) and occasionally GCC for Linux. Every compiler appears to catch different errors. Thiadmer
In Reply to: Re: compiling small under DOS using djgpp
posted byClem Vasseur on September 26, 2001 at 15:54:38:
: Also, it would be cool if BIT16 actually worked. Does somebody successfully uses BIT16 with the current version ? I am not sure of the current version, but I merged in changes of Dieter Neubauer at april 10. So the BIT16 option should largely work. One known caveat: floating point or fixed point is not supported in BIT16. : Speaking of compile-time defines, NODBGCALLS does nothing (?) [...] You are right. I forgot to remove it from the README.TXT. It turned out that people used debug hooks for other things that just debugging, so the hooks are always present. : [...] and NOEMIT is not documented. The #emit directive is a kludge, I added it for Marc Peter who wanted to experiment with new opcodes. Since the instruction set appears to be stabilizing now, I wanted to remove the #emit directive. The first step in this was by enclosing it in a #ifdef NOEMIT ... #endif section. That said, I could have mentioned it in the README.TXT. Thiadmer
In Reply to: Threading under Win32
posted byJason Reeve on October 01, 2001 at 16:24:17:
Haven't understood completely the problem. If the problem is the performance hit in main app when a script is running in the background you can think about inserting a Sleep(1) (or any other number) in your C/C++ code between iterations of the script. If the script run continuosly, you may want to exec it with something like : err = amx_Exec(m_AMX, &ret, idx, ...); And insert sleep(0) or anything else in your small code too. Sleep is defined in winbase.h (which is included automagically if you include windows.h, btw). Hope it'll solve :)
In Reply to: May work may not :)
posted byXanathar on October 04, 2001 at 09:36:16:
Yes the script does run continuosly, but it does need to be run at a pretty fast rate as it is controlling content for a game engine. The problem is, it was taking way to much CPU time away from the main app. I thought some kind of priority tweaking may work, but so far no success. I'll try your tips and let you know what the result is. Cheers, -Jason
This code : mnu_addItem (s, 0, 9, "Virtu'"); mnu_addItem (s, 0, 9, "Virtu"); doesn't. Actually all of these are natives of my prog, so I can't send you a test script. Anyway, the compiler should report "'" as an error (should be "^'" I think) imho. Bye :)
Ok, two I found today, sample follows.. (1) new rock_size[3] = {64,32,16} causes a freeze! so I tried... x = -rock_size[0] again, freeze So I tried... x = -16 No freeze, weird, I'd really apprciate any comments on this error in particular as it has me very concerned! (2) Here's another try setting a float to a negative number like this, new float:somevar = -1.0 you'll get a compiler error, at least on my stock version of sc you do. -Jason
To compile small scripts on the fly and without calling an extern program, I have included the sc compiler into a VC++/Win32 project. The code handling the -D option does not work this way, because the "dos_setdrive" macro is not enabled for the VC++ environment. The fix: #include <direct.h> /* for _chdrive() */ I must admit that I'm not sure about possible compatibility issues - for example I did not find any code to reset the current (before the sc_compile() call) drive/directory. This does not matter in a stand-alone compiler, but it could be a good idea for an integration of the compiler in other applications.
In Reply to: -D compiler option
posted byDaniel Ludwig on October 16, 2001 at 18:19:27:
: The fix: err, the forum screwed up this, lets try again :) #include <direct.h> /* for _chdrive() */
In Reply to: -D compiler option
posted byDaniel Ludwig on October 16, 2001 at 18:19:27:
: The code handling the -D option does not work this way, because the "dos_setdrive" macro is not enabled for the VC++ environment. I have copied your changes for the next release. : [...] for example I did not find any code to reset the current (before the sc_compile() call) drive/directory. This does not matter in a stand-alone compiler, but it could be a good idea for an integration of the compiler in other applications. Indeed, I will make a note of it. Thiadmer
In Reply to: Probable Bug Report
posted byXanathar on October 04, 2001 at 18:29:56:
: This code : : mnu_addItem (s, 0, 9, "Virtu'"); : : [...] Anyway, the compiler should report "'" as an error (should be "^'" I think) imho. If you need to embed a double quote in a string, you must type "a ^"quoted^" word"; if you need to have a single quote in a cell, you should type '^''. But there is no problem to simply put a single quote in a string (like in "Jimmy's guitar") or to put a double quote between two single quotes. I tried to reproduce your problem but in my experiment the compiler put the ' in at the end of the string correctly. The only way that I see that the single quote could harm is when the native function cannot handle it. Thiadmer
In Reply to: Weird Bugs (possibly!)
posted byJason Reeve on October 13, 2001 at 10:55:03:
Could you send me the full source of the example; I just tried the simple example below and it worked correctly. main() : new float:somevar = -1.0 I assume that the variable is a global variable. Then, the compiler will give you the message "must be constant expression". This is a problem in the compiler that I will fix. As a side note, if the variable is a local variable, the above declaration works. The cause of the problem is that the '-' is regarded as the minus operator, instead of as a sign. Normally, the expression parser optimizes the arithmetic operation on a constant value away to a new constant expression, but here it cannot do this because the '-' on floating point values is a user-defined operator. Thiadmer
In Reply to: Re: -D compiler option
posted byDaniel Ludwig on October 17, 2001 at 04:20:02:
The forum Perl script cannot cope with special HTML characters like <, > and &. On the other hand, it does allow HTML codes, but only if it has seen a certain tag. One can add both and Thiadmer
Hello, Is it possible to simulate multithreading in SMALL, or to execute more than one function at a time ?
In Reply to: Re: Weird Bugs (possibly!)
posted byThiadmer Riemersma on October 17, 2001 at 10:07:18:
: Could you send me the full source of the example; I just tried the simple example below and it worked correctly. Sure, I'll do this tomorrow, -Jason
In Reply to: Multithreading in SMALL
posted byPierre-Paul Hackens on October 19, 2001 at 05:31:33:
: Is it possible to simulate multithreading in SMALL, or to execute more than one function at a time ? Your application must provide support for this. The abstract machine (the routines in AMX.C) are re-entrant. If your application creates multiple threads and each thread calls amx_Exec(), then several functions in a Small script run concurrently. You can also create a native function that spawns a new thread and calls amx_Exec() again. Thiadmer
Server maintenance broke the message forum script. This has now been fixed. My apologies for any inconvenience in using this forum lately.
Would it be possible to have 'constructors' and 'destructors' to override for custom types? (also, can any custom type aside from float be done?) This would be useful because then a pointer or somesuch to an actual object could be stored in the variable. Thanks :)
In Reply to: Constructor/Destructor?
posted byJames Bellinger on November 29, 2001 at 07:58:53:
: Would it be possible to have 'constructors' and 'destructors' to override for custom types? I will add this to my "to do" list for Small. It is indeed useful. : (also, can any custom type aside from float be done?) User-defined operators operate of "cells". The restruction is therefore that a custom type fits in a cell. The manual has a section on creating user-defined operators for "ones complement" arithmetic. (By the way, the compiler supports "fixed point" as well as floating point.) Thiadmer
In Reply to: Re: Constructor/Destructor?
posted byThiadmer Riemersma on November 29, 2001 at 11:23:00:
: : Would it be possible to have 'constructors' and 'destructors' to override for custom types? : I will add this to my "to do" list for Small. It is indeed useful. : : (also, can any custom type aside from float be done?) : User-defined operators operate of "cells". The restruction is therefore that a custom type fits in a cell. The manual has a section on creating user-defined operators for "ones complement" arithmetic. (By the way, the compiler supports "fixed point" as well as floating point.) : Thiadmer Out of curiosity, doesn't this cell restriction mean that Small's floating point extension will not work on a machine with cells that are not 32-bit? Also, is Small 64-bit ready? And how soon is AMD's Hammer series coming out? :D hehe
In Reply to: Re: Constructor/Destructor?
posted byJames Bellinger on November 29, 2001 at 12:30:35:
: Out of curiosity, doesn't this cell restriction mean that Small's floating point extension will not work on a machine with cells that are not 32-bit? Also, is Small 64-bit ready? And how soon is AMD's Hammer series coming out? :D hehe Small supports only the 32-bit IEEE 754 "single precision" floating point format, not the 64-bit "double precision" format. Small will probably not run out-of-the-box when using 64-bit "cells", but a large portion will probably run okay. Things that require changes are the fixed point and floating point formats and the byte-alignment options for "packed" strings. But that will have to wait until I get a 64-bit CPU (or until someone else ports it). Thiadmer
With this trick small toolkit should work on openbsd machines.. just consider
it as linux
In sclinux.h :
:]
In Reply to: Re: Constructor/Destructor?
posted byThiadmer Riemersma on November 30, 2001 at 03:20:36:
: : Out of curiosity, doesn't this cell restriction mean that Small's floating point extension will not work on a machine with cells that are not 32-bit? Also, is Small 64-bit ready? And how soon is AMD's Hammer series coming out? :D hehe : Small supports only the 32-bit IEEE 754 "single precision" floating point format, not the 64-bit "double precision" format. : Small will probably not run out-of-the-box when using 64-bit "cells", but a large portion will probably run okay. Things that require changes are the fixed point and floating point formats and the byte-alignment options for "packed" strings. But that will have to wait until I get a 64-bit CPU (or until someone else ports it). : Thiadmer Regarding floating point, I was thinking it would be more of an issue in the case of 16-bit Virtual Machines. I don't use one, so it isn't an issue for me, but for those with 16 bit cells floating point is impossible, is it not?
Im new to Small, I have a small script which has a function called SmallPrint(text[]) now, say I called that function in my small script like: SmallPrint("hello world") how would I retreive that string "Hello world" in my actual C++ program in the SmallPrint handler function? I know how to get numerical values as they are just like params[n], but Im not sure about strings. Thanks
I have a small script I am trying to run. Its like this: void main() It causes a lot of assertion failures and then crashes. I have tried a lot of different loading functions from some of the examples, but they all crash when amx_Init() is called. Its getting kinda annoying now. It doesnt even have to be a huge script either, I tested a script which had about 20 lines in and it had the same problem... Can anyone please help me here?
In Reply to: Trouble Loading files with the Abstract Machine
posted byGD on December 02, 2001 at 16:20:59:
I just wanted to add the error message I was getting when amx_Init() was being called... --------------------------------------- amx.c Expression: shift>0 || (code[(int)codesize] & 0x80)==0) Why does this happen? it runs ok with smaller scripts. -GD
Has anyone here edited the WORDLIST.txt file for UltraEdit32 to work with the SMALL language yet? I've started, but ran into trouble with the regex of the Function String, as I do not fully understand regex yet =/ Any help is appreciated. Thanks :)
In Reply to: Re: Constructor/Destructor?
posted byJames Bellinger on November 30, 2001 at 19:57:05:
: Regarding floating point, I was thinking it would be more of an issue in the case of 16-bit Virtual Machines. I don't use one, so it isn't an issue for me, but for those with 16 bit cells floating point is impossible, is it not? Quite correct; Small requires a 32-bit "cell" type to support floating point arithmetic. Actually, I do not really support 16-bit cell types for Small; a few people have claimed that they got it working, but I never tested it myself.
In Reply to: OpenBSD trick
posted byXanathar on November 30, 2001 at 14:49:37:
: With this trick small toolkit should work on openbsd machines.. just consider it as linux : In sclinux.h : : #if defined(__OpenBSD__) Thank you. I will add this section to sclinux.h. Thiadmer
In Reply to: Getting String parameters..
posted byGreg Denness on December 01, 2001 at 19:16:06:
: Im new to Small, I have a small script which has a function called SmallPrint(text[]) : now, say I called that function in my small script like: : SmallPrint("hello world") : how would I retreive that string "Hello world" in my actual C++ program in the SmallPrint handler function? I know how to get numerical values as they are just like params[n], but Im not sure about strings. For strings (and for arrays in general), you can get a pointer to the string to the array in the abstract machine with amx_GetAddr(). For example, with "cstr" declared as a pointer to cells, you can call: amx_GetAddr(amx,params[1],&cstr); Mostly, you will want a "char" pointer, rather than a cell pointer. To that end, convert the string to a C/C++ compatible string with amx_GetString(). You can find examples of these techniques in AMXCORE.C. Thiadmer
In Reply to: Re: Trouble Loading files with the Abstract Machine
posted byGD on December 02, 2001 at 19:01:07:
: assertion failed! : amx.c : Expression: shift>0 || (code[(int)codesize] & 0x80)==0) This is a serious error. You will probably be able to circumvent it by compiling the scripts with the "-C-" compiler option. Can you give me details on how you compiled the AMX files (compiler version, options, ...). For the compiler, do you use the binaries from my site or do you re-compile it? Could you also send me the script (the .SMA and .AMX files) that fails? I did a quick test just now (with 250 printf()'s) and it ran on my machine. Thiadmer
In Reply to: UltraEdit Wordlist
posted byJoe Hansche on December 02, 2001 at 22:25:40:
: Has anyone here edited the WORDLIST.txt file for UltraEdit32 to work with the SMALL language yet? I've started, but ran into trouble with the regex of the Function String, as I do not fully understand regex yet =/ To the best of my knowledge, UltraEdit uses the /Function string only for the "function list" (menu: View / Views/Lists / Function list). This can indeed be very convenient if it works well. Unfortunately, I have been unable, so far, to capture all function definitions and only function definitions. What I have come up with is: /Function String 1 = "%^([a-zA-Z_@0-9]+^)[ ^t]++([a-zA-Z_:&=^^'^"., 0-9^[^]-]++)" This captures plain functions and native and public functions, but not static or stock. When I tried to add static and stock, the regular expressions stopped working (my error, undoubtedly). I have sent a wordlist for Small to IDM corporation. In time, they will add it to their web site. In time, I will put it on my site as well (next opdate). Thiadmer
In Reply to: Re: UltraEdit Wordlist
posted byThiadmer Riemersma on December 05, 2001 at 03:03:37:
: : Has anyone here edited the WORDLIST.txt file for UltraEdit32 to work with the SMALL language yet? I've started, but ran into trouble with the regex of the Function String, as I do not fully understand regex yet =/ : To the best of my knowledge, UltraEdit uses the /Function string only for the "function list" (menu: View / Views/Lists / Function list). This can indeed be very convenient if it works well. Unfortunately, I have been unable, so far, to capture all function definitions and only function definitions. What I have come up with is: : /Function String 1 = "%^([a-zA-Z_@0-9]+^)[ ^t]++([a-zA-Z_:&=^^'^"., 0-9^[^]-]++)" : This captures plain functions and native and public functions, but not static or stock. When I tried to add static and stock, the regular expressions stopped working (my error, undoubtedly). : I have sent a wordlist for Small to IDM corporation. In time, they will add it to their web site. In time, I will put it on my site as well (next opdate). : Thiadmer Thank you Thiadmer =) I'll try that!
Hi, Are you able to pass floats as parameters to native functions? Please help me with this one. Aside from a few floating point worries Small is absolutely great! The best scripting language I have seen yet.
In Reply to: What does the Floating Point Module do exacty?
posted byTomy truman on December 08, 2001 at 21:21:05:
: I see that you can include<float> for some kind of floating point support in small script, but how do you use it once you have included it? Floating point support is implemented through native functions and user defined operators. The only compiler extension towards floating point is that it recognizes floating point literals. : Are you able to pass floats as parameters to native functions? Yes, the include file FLOAT.INC defines a few native functions. The implementation of those native functions is in FLOAT.CPP. Basically, a native function receives the floating point values as "unsigned longs", which you then have to cast to "float". The README.TXT gives instructions how to compile the run-time to support floating point arithmetic. Thiadmer There is one thing bothering me. Why does the "case" statement doesn't allow
break or grouping of several cases ? I sometimes needed an option for that:
It is better than using multiple "if". It's also more readble for the
human eye.
Hi. I'm new to this forum, please excuse my nogood english. I'v decided to use Small in realtime software on game console. On my software, a Small object (amx) can be attached to 3d-object, ex) new obj:cube = CreateCube(parent); But, I want to reduce the memory usage of Small VM. Currently, All VM have Independently malloced memory. Would you teach the technique to share program/data section ?
Hello all. Are there any AMX decompilers or disassembers available? Can anyone point me in the right direction? I wasn't able to find anything through a web search or on the main Small page. Thanks. -Chris
In Reply to: A Suggestion
posted byGilad Novik on December 13, 2001 at 09:56:30:
: [...] Why does the "case" statement doesn't allow break or grouping of several cases ? Small does support grouping case statements, but in a different syntax: The main difference from C/C++ is that you must execute one statement for each case: no more, no less. This is why the two function calls to Function1() and Function2() are grouped in one compound statement. If you have multiple cases that should run through the same code, separate them with a comma after the "case" keyword; if you have a range, you can use "a .. b" and you can even specify multiple ranges. The background for changing this syntax and behaviour of the "switch" statements was that most people see (and use) the "switch" statement as a "structured if", whereas C/C++ implements it as a "structured goto". Fixing the common error of forgetting a break to end a statement list was a pratical goal.
This: #define DOOR_LAYERS 3 new door[DOOR_LAYERS][DOORS_EACH][2] = { \ gives me a Error [053]: exceeding maximum number of dimensions Any idea why? Looks like the right amount of dimensions to me. The documentation isn't very clear on multiple lines for arrays though, maybe that's it..
In Reply to: Hmm, what is the problem here?
posted byJim Bellinger on December 15, 2001 at 12:33:17:
: gives me a Error [053]: exceeding maximum number of dimensions No, the problem is that the current release of Small supports one-dimensional and two-dimensional arrays. Your example is a three-dimensional array. Thiadmer
In Reply to: Re: Hmm, what is the problem here?
posted byThiadmer Riemersma on December 17, 2001 at 02:57:15:
: : gives me a Error [053]: exceeding maximum number of dimensions : No, the problem is that the current release of Small supports one-dimensional and two-dimensional arrays. Your example is a three-dimensional array. : Thiadmer Egad! :/ Will this be changed at some point? Just curious :) In the meantime I should just multiply it myself to get the correct index, I suppose.
In Reply to: Re: Hmm, what is the problem here?
posted byJim Bellinger on December 17, 2001 at 18:17:44:
: Egad! :/ Will this be changed at some point? Just curious :) Much of the code to handle two-dimensional arrays will already handle arrays of any dimension. The technical issues are in the handling of the (nested) initializer lists. Fixing this limitation is on my wish list, but I have no schedule for implementation. Thiadmer
In Reply to: Re: A Suggestion
posted byThiadmer Riemersma on December 14, 2001 at 05:52:39:
What I mean, is that sometimes, the fall threw option, is very convenient.
Consider the following code:
In Reply to: Re: A Suggestion
posted byThiadmer Riemersma on December 14, 2001 at 05:52:39:
Sorry for the previous code. I've just understood your point (I am slow :)) No need to answer the previous follow up :)
Hi, Is Small capable of executing OS commands? Like system(); in perl. Thanks! Hi, I was wondering how to do this:
I want to be able to call a public function in one script from another script
using a native function called CallFunction(), I also want to be able to pass
paramters to it and get the return value.
I can do most of that, but the only thing Im hainvg trouble with is passing
paramters to the function being called.
Heres what I have so far:
This works ok, but it doesnt allow for paramters passing, I want the CallFunction function to look like this:
Where the ... are paramters which should be passed to the function called by CallFunction. I notice that amx_Exec has a method for passing a variable number of parameters to the function its calling but it uses an ellipsis.
So I need some way of passing the parameters which are supplied to the CallFunction method (which would start at params+2), to the amx_Exec function.
This would be really good if I could becuase then I could have scripts calling other scripts with paramters and return values which would really be very useful.
Can anyone help please?
In Reply to: Execute OS command
posted byJonas Björklund on December 18, 2001 at 16:19:46:
You define your function yourself. You can define a native function: Command(const szFilename[]) and assign it a function which in turn, will execute the file (or command) which was specified as a parameter
In Reply to: Calling Functions from different scripts
posted byDave Sims on December 18, 2001 at 16:25:27:
Never mind, I figured it out now, I found the amx_Execv function. I was wondering, how much slower is compiled small script compared to normal code?
In Reply to: Re: Calling Functions from different scripts
posted byDave Sims on December 19, 2001 at 10:13:50:
: I was wondering, how much slower is compiled small script compared to normal code? I ported the "SIEVE.SMA" program from Small to C. When there is no console output (just calculations), and when using the assembler core of the abstract machine (AMXEXEC.ASM), SIEVE.SMA runs about 15 times slower than SIEVE.C. In practice, it is not that bad, however. As soon as I re-enable the "printf()" statements in the Sieve programs, SIEVE.SMA runs only twice as slow as SIEVE.C (and even this figure bay be biased in favor of the C program, because the "Small" printf() does a "flush" after each print and the C library function does not). In the early days when I worked on Small, I compared it with Java 1.1. My results back then were that Small with the ANSI C core for the abstract machine was about equally fast as the Java VM (1.1) if, again, all printf()'s are disabled. Small is more efficient when it comes to calling native functions than Java. Thiadmer
In Reply to: Re: I am a newbie please help.
posted byFlorian Zschocke on July 24, 2001 at 07:58:15:
sup i need help wit admin mod codes "n" cheats
First of all, I wish to thank Thiadmer Riemersma for such a beautiful language. Nice work.
I noticed that it doesn't check to make sure that the dest pointer [ int AMXAPI amx_GetString(char *dest,cell *source) ] passed to it is valid (by valid I mean not NULL) and if it is gracefully return some error msg like AMX_ERR_INDEX or AMX_ERR_ASSERT, I dunno... none really applies. Basically what I mean is to add this at the top of the function: if(!dest) return AMX_ERR_ASSERT; much nicer then having your exception handling functions kick in.
In Reply to: Extending with Native Functions
posted byAlain Schlesser on December 24, 2001 at 13:53:24:
: I wanted to get some advice. Is it possible to enable users to build DLLs with Native Functions that can then be integrated without recompiling the compiler/virtual machine? I have an implementation for this in the AMX DLLs, but it has not been fully tested. The idea is the following: Assume that I create a DLL with native functions for communication over a serial line (SERIAL.DLL). Next to the DLL, I also create an include file for the Small script files with the definitions (SERIAL.INC). First of all, when a script uses a native function, somehow the run-time must know what DLL it is in. For that purpose, near the top of SERIAL.INC, I add the line: The DLL should also contain a native function called amx_NativeList(). This function takes no parameters and returns a pointer to a list of AMX_NATIVE_INFO structures (in the form that amx_Register() expects it). After loading a compiled script, the run-time should now run through the table of "dependent libraries" in the compiled script, load the DLLs, call the amx_NativeList() functions in these DLLs and call amx_Register() with the pointer that amx_NativeList() returns. This is implemented in the AMX DLLs (in a revised amx_Init() function) so you may want to look at that for details. Now that I am describing this, it occurs to me that functions like amx_GetLibrary() and amx_NumLibraries() are missing in AMX.C. For the moment, you will have to get this information directly from the file header. The file header is documented somewhere in an appendix in the manual. Thiadmer
In Reply to: Socket programming in Small?
posted byRon Jamison on June 21, 2001 at 04:36:48:
yes, I would also be interested in a sockets library for the small language. I've not been able to find any information at all. : Hello, : Is it possible to do socket programming in Small? I've tried to include the correct headers and I get a segfault. Perhaps I'm missing something.. could you help me out? : Thank you,
#include
#include
#include
#include
#include
#include
#include
#include
#include
#define BYTE short int
#define ULONG unsigned long
#define RTP_HEADER_SIZE 12
#pragma pack(1)
typedef struct _RTPPACKET
{
BYTE b0;
BYTE b1;
BYTE b2;
BYTE b3;
BYTE b4;
BYTE b5;
BYTE b6;
BYTE b7;
BYTE b8;
BYTE b9;
BYTE b10;
BYTE b11;
BYTE abData[1];
}RTPPACKET;
typedef RTPPACKET * PRTPPACKET;
{
PRTPPACKET pRTPPacket;
ULONG ulBytesInThisPacket;
ULONG ulTimesPostponed;
struct _NODE * pNext;
} NODE;
typedef NODE * PNODE;
void UpdateSilencePacket(void);
int InitRTPProducer(void);
void Init16to8LUT_ULaw(void);
// Global variables used by this file
//
PRTPPACKET pRTPSilencePacket = NULL;
unsigned long ulRTPPacketDelay = 40; // Default delay is 40 msecs
unsigned long ulPacketDataLen = 320; // ulRTPPacketDelay * 8
short int bSilenceValue = 127; // Initialize the silence value
**
** Function: InitRTPProducer
**
** Description:
**
** Parameters: None
**
** Returns: TRUE - success
** FALSE - failure
**
***********************************************************************************/
int InitRTPProducer(void)
{
// Initialize the silence packet
//
pRTPSilencePacket = (PRTPPACKET)malloc(RTP_HEADER_SIZE + ulPacketDataLen);
if(pRTPSilencePacket == NULL)
{
return(0);
}
// Initialize the 16 to 8 look up table (LUT) -
//
Init16to8LUT_ULaw();
return(1);
**
** Function: UpdateSilencePacket
**
** Description: This routine will update the contents of the silence packet
** with the proper silence value
**
** Parameters: None
**
** Returns: None
**
***********************************************************************************/
void UpdateSilencePacket(void)
{
ULONG i;
if(pRTPSilencePacket == NULL)
{
return;
}
{
pRTPSilencePacket->abData[i] = bSilenceValue;
}
} // end of UpdateSilencePacket
/**********************************************************************************
**
** Function: Init16to8LUT_ULaw
**
** Description:
**
** Parameters: None
**
** Returns: None
**
***********************************************************************************/
void Init16to8LUT_ULaw(void)
{
ULONG i;
UpdateSilencePacket();
int main(int argc, char * argv[])
{
if(hp == NULL)
{
return 1;
}
------------
CC=gcc
gcc -o $@ $^ -lsocket -lnsl
[118] Succesfully Embedded the Small
Posted By Han cicimen on May 04, 2001 at 08:26:49:
The system works excellent for more than one month 24 hour a day without a problem or crash down . We plan to expand the project (adding security control etc). Thanks for such a powerfull and small footprint and may be more important reliable language.
[119] Different headers for Linux and Windows.
Posted By Florian Zschocke on May 09, 2001 at 11:14:27:
generates different headers than the Windows version.
Is that an intended behaviour?
We use Small in a cross-platform application and have
to compile Small files seperately for the two platforms.
If we use Windows compiled .amx files in the Linux
applicationa that will segfault the program.
I wanted to know beforehand if there was a reason for
different Small binaries on different OSes. The only
difference that I could make out is that on Windows
the four struct elements for the number of public
functions, public variables, libraries and, uh, the
forth one :), are two bytes. The Linux compiler writes
them in four bytes.
[120] Re: Different headers for Linux and Windows.
Posted By Linus Nuber on May 09, 2001 at 11:32:02:#pragma pack (1)
typedef ...
} AMX_HEADER;
#pragma pack()
[121] Re: Different headers for Linux and Windows.
Posted By Florian Zschocke on May 09, 2001 at 13:16:43:
Is the code produced by it compatible with the AMX from February?
Florian.
[122] Re: Different headers for Linux and Windows.
Posted By Linus Nuber on May 14, 2001 at 04:34:10:
[123] Re: Different headers for Linux and Windows.
Posted By Thiadmer Riemersma on May 14, 2001 at 06:52:19:
[124] Re: Different headers for Linux and Windows.
Posted By Thiadmer Riemersma on May 15, 2001 at 03:19:53:
[126] Re: multiple-instances of the same code
Posted By John W. Ratcliff on June 14, 2001 at 10:31:11:
[127] Re: #pragma pack
Posted By Chandra on June 20, 2001 at 20:57:47:
I am working on a Solaris driver for our chip & the same driver code plus libraries r working in NT but it panics & crashes the Sun Sparc. I am running Solaris 7 too. I think gcc doesnt have a -misalign option unlike the Sun's Workshop C compiler. I too am unable to fix this problem cos i dont ave access to Sun C compiler. If u find any other problem/ if u find a solution to this pragma problem, can u pl let me know too??
Chandra
: Hello!
: Kantharaj Etigi
: test1.c:
: --------
: #include
: #include
: #include
: #include
: #include
: #include
: #include
: #include
: #include
: #define BYTE short int
: #define ULONG unsigned long
: #define RTP_HEADER_SIZE 12
: #pragma pack(1)
: typedef struct _RTPPACKET
: {
: BYTE b0;
: BYTE b1;
: BYTE b2;
: BYTE b3;
: BYTE b4;
: BYTE b5;
: BYTE b6;
: BYTE b7;
: BYTE b8;
: BYTE b9;
: BYTE b10;
: BYTE b11;
: BYTE abData[1];
: }RTPPACKET;
: typedef RTPPACKET * PRTPPACKET;
: {
: PRTPPACKET pRTPPacket;
: ULONG ulBytesInThisPacket;
: ULONG ulTimesPostponed;
: struct _NODE * pNext;
: } NODE;
: typedef NODE * PNODE;
: void UpdateSilencePacket(void);
: int InitRTPProducer(void);
: void Init16to8LUT_ULaw(void);
: // Global variables used by this file
: //
: PRTPPACKET pRTPSilencePacket = NULL;
: unsigned long ulRTPPacketDelay = 40; // Default delay is 40 msecs
: unsigned long ulPacketDataLen = 320; // ulRTPPacketDelay * 8
: short int bSilenceValue = 127; // Initialize the silence value
: **
: ** Function: InitRTPProducer
: **
: ** Description:
: **
: ** Parameters: None
: **
: ** Returns: TRUE - success
: ** FALSE - failure
: **
: ***********************************************************************************/
: int InitRTPProducer(void)
: {
: // Initialize the silence packet
: //
: pRTPSilencePacket = (PRTPPACKET)malloc(RTP_HEADER_SIZE + ulPacketDataLen);
: if(pRTPSilencePacket == NULL)
: {
: return(0);
: }
: //
: // Initialize the 16 to 8 look up table (LUT) -
: //
: Init16to8LUT_ULaw();
: return(1);
: **
: ** Function: UpdateSilencePacket
: **
: ** Description: This routine will update the contents of the silence packet
: ** with the proper silence value
: **
: ** Parameters: None
: **
: ** Returns: None
: **
: ***********************************************************************************/
: void UpdateSilencePacket(void)
: {
: ULONG i;
: if(pRTPSilencePacket == NULL)
: {
: return;
: }
: {
: pRTPSilencePacket->abData[i] = bSilenceValue;
: }
: } // end of UpdateSilencePacket
: /**********************************************************************************
: **
: ** Function: Init16to8LUT_ULaw
: **
: ** Description:
: **
: ** Parameters: None
: **
: ** Returns: None
: **
: ***********************************************************************************/
: void Init16to8LUT_ULaw(void)
: {
: ULONG i;
: UpdateSilencePacket();
: int main(int argc, char * argv[])
: {
: if(hp == NULL)
: {
: return 1;
: }
: ------------
: CC=gcc
: gcc -o $@ $^ -lsocket -lnsl
[128] Socket programming in Small?
Posted By Ron Jamison on June 21, 2001 at 04:36:48:
Ron Jamison
[129] Re: Socket programming in Small?
Posted By Thiadmer Riemersma on June 22, 2001 at 03:17:31:
[130] The License
Posted By Nicholas Cooper on June 22, 2001 at 19:16:38:
As stated in the license :
"The use of this software as a subsystem of a larger software product is explicitly allowed, regardless of whether that larger product is proprietary, gratis or commercially available"
[131] Switch?
Posted By Joe Hansche on June 23, 2001 at 03:09:30:
-Joe
[132] Re: The License
Posted By Thiadmer Riemersma on June 23, 2001 at 06:31:04:
: "The use of this software as a subsystem of a larger software product is explicitly allowed, regardless of whether that larger product is proprietary, gratis or commercially available"
"Permission is hereby granted, without written agreement and without paid license or royalty fees, to use, copy, modify, and distribute this software and its documentation for any purpose, subject to the following conditions: [...]"
[133] Re: Switch?
Posted By Thiadmer Riemersma on June 23, 2001 at 06:42:29:
[134] Re: Switch?
Posted By Joe on June 23, 2001 at 18:56:42:
-Joe
: : Call me crazy, but why do my switch statements not work?? I noticed that you don't need a break; command, so that's affirmative.
[135] Re: Switch?
Posted By Joe on June 23, 2001 at 19:01:58:switch(iWarns) {
case 1
for(new i=0;i<10;i++)
slap(iUser);
case 2
execclient(iUser,"kill");
case 3
kick(iUser);
case 4
ban(iUser,15);
}
return PLUGIN_CONTINUE;
[136] BrowseRelocate Errors! ??
Posted By Joe on June 23, 2001 at 20:10:23:
[137] Re: BrowseRelocate Errors! ??
Posted By joe on June 23, 2001 at 20:14:32:
[138] Re: BrowseRelocate Errors! ??
Posted By joe on June 23, 2001 at 20:16:13:
[139] Re: Socket programming in Small?
Posted By Ron Jamison on June 24, 2001 at 02:37:43:
Ron Jamison
[140] Re: BrowseRelocate Errors! ??
Posted By Thiadmer Riemersma on June 24, 2001 at 12:22:20:
[141] Re: Switch?
Posted By Thiadmer Riemersma on June 24, 2001 at 12:31:46:
: Whenver I try compiling it, it just hangs the compiler. It will never actually show an error or display "Done". Any tips are appreciated
[142] Re: BrowseRelocate Errors! ??
Posted By Thiadmer Riemersma on June 24, 2001 at 12:43:48:
[143] Re: BrowseRelocate Errors! ??
Posted By Florian Zschocke on June 25, 2001 at 07:28:36:
[144] Re: BrowseRelocate Errors! ??
Posted By Thiadmer Riemersma on June 25, 2001 at 12:13:58:
[145] Re: Switch?
Posted By Luke Sankey on July 04, 2001 at 19:38:39:
: -Joe
[146] Problem compiling on RedHat Linux 7.0.
Posted By Rob Candland on July 12, 2001 at 14:14:27:
sc2.o: In function `checktongue':
/home/robc/small/compiler/sc2.c:560: undefined reference to `strnicmp'
[147] Re: Problem compiling on RedHat Linux 7.0.
Posted By Rob C on July 12, 2001 at 17:10:59:
: sc2.o: In function `checktongue':
: /home/robc/small/compiler/sc2.c:560: undefined reference to `strnicmp'
So, therefore:
for (ptr=plebeian; *ptr!='\0' && strncmp(tolower(string), tolower(ptr), (int)(strchr(ptr,'|')-ptr))!=0; ptr=strchr(ptr,'|')+1)
[148] Re: Problem compiling on RedHat Linux 7.0.
Posted By Thiadmer Riemersma on July 13, 2001 at 03:44:09:
: sc2.o: In function `checktongue':
: /home/robc/small/compiler/sc2.c:560: undefined reference to `strnicmp'
[149] I am a newbie please help.
Posted By Hollin WIlkins on July 20, 2001 at 22:02:49:
Hollin Wilkins
[150] Re: I am a newbie please help.
Posted By Thiadmer Riemersma on July 22, 2001 at 11:06:16:
[151] Re: I am a newbie please help.
Posted By Florian Zschocke on July 24, 2001 at 07:58:15:
[152] Small Tools
Posted By David Dickhaut on July 24, 2001 at 16:30:37:
Dave
[153] Passing array of strings to a function
Posted By Patrick Down on July 25, 2001 at 18:01:29:
hello.sma(14) Error [048]: array dimensions must match
#include
[154] Re: Passing array of strings to a function
Posted By Thiadmer Riemersma on July 26, 2001 at 10:34:08:
: It seems like I sould be able to doing something like
: the following but of course it generates this error:
: me to pass an array of strings to functions like this?
func(test[2][],size)
or
func(test[3][],size)
for(new i = 0; i < 2; ++i)
func(TestArray1[i],2);
func(text[][],size)
but Small does currently not support this. I have just looked up the Small
manual and concluded that it must be possible to change the compiler so that it
accepts this syntax for function parameters. I will put that on my wish list.
[155] Re: Passing array of strings to a function
Posted By Patrick Down on July 26, 2001 at 14:25:07:
: This is not exactly what you want either. Actually, what you would need is to declare func() as:
[156] Re: Small Tools
Posted By Thiadmer Riemersma on July 27, 2001 at 05:27:31:
[157] Mail
Posted By Sashi on July 28, 2001 at 05:35:19:
[158] Bugs and bits and pieces
Posted By Stewy on July 29, 2001 at 12:25:58:
has printf and puts. be consistent. i changed them all to printfs
and added line feeds to the end of strings (ok ok so minor minor nitpick!;)
/*
test3.sma
SC v1.6
29-jul-01
BUG: create an enum then a new variable of same name.
crashes compiler
*/
#include
[159] Re: Mail
Posted By Thiadmer Riemersma on July 30, 2001 at 04:56:11:
[160] Re: Bugs and bits and pieces
Posted By Thiadmer Riemersma on July 30, 2001 at 05:06:49:
: has printf and puts. be consistent.
In the version that I am working on, all string output will run through an "interface" function similar to sc_error().
longjmp() replaces and exir() or abort(). In some cases, you want to stop compiling right now. However, when running the compiler as a "library function" (instead of as an application), you cannot abort the program with exit(), as this would kill the entire application instead of just the compiler.
I will make it conditionally compiled. In the Linux version, the waitkey() function is already unused.
[161] Re: Bugs and bits and pieces
Posted By Stewy on August 01, 2001 at 14:50:06:
: : below is test3.sma to reproduce compiler crashing.
thanks thiadmer. i'm gonne poke around more in the compiler, see if i can create some more test file examples to help pin down bugs in compilation.
[162] Can a native C/C++ function call some small function explicitely or pass parameters to small ?
Posted By Dick Guan on August 04, 2001 at 02:00:20:
The situation is that at each frame(or at each step in game-loop), we would decide which small script to run and we have several related parameters to pass. how can we do that with small AMX smoothly?
[163] Re: Can a native C/C++ function call some small function explicitely or pass parameters to small ?
Posted By Thiadmer Riemersma on August 04, 2001 at 07:35:01:
[164] Re: Can a native C/C++ function call some small function explicitely or pass parameters to small ?
Posted By Dick Guan on August 05, 2001 at 06:04:24:
I'll give it a try~
[165] Re: Can a native C/C++ function call some small function explicitely or pass parameters to small ?
Posted By Florian Zschocke on August 07, 2001 at 10:13:01:
Florian.
[166] Re: Switch?
Posted By Joe on August 07, 2001 at 11:28:48:
: -Joe
[167] Re: Can a native C/C++ function call some small function explicitely or pass parameters to small ?
Posted By Thiadmer Riemersma on August 08, 2001 at 09:41:43:
[168] Different AMX sharing the same Heap/Stack space
Posted By Odie Calima on August 09, 2001 at 18:00:17:
[169] Re: Different AMX sharing the same Heap/Stack space
Posted By Thiadmer Riemersma on August 10, 2001 at 05:40:47:
[170] Documentation
Posted By B. Ahrenholz on August 14, 2001 at 12:10:15:
a simple question: where can I get a documentation or manual for small? It's downloadable? If somebody can give me a hint it would be greatly appreciated. Thanks in advance
[171] Re: Documentation
Posted By Thiadmer Riemersma on August 15, 2001 at 02:56:35:
http://www.adminmod.org/index.php?go=config
[172] Problems compiling AMX DLL under MSVC 6
Posted By Jason Reeve on August 18, 2001 at 12:15:05:
[173] Re: Problems compiling AMX DLL under MSVC 6
Posted By Thiadmer Riemersma on August 19, 2001 at 09:55:32:
[174] Re: Problems compiling AMX DLL under MSVC 6
Posted By Jason Reeve on August 19, 2001 at 15:11:18:
[175] Update,,,
Posted By Jason Reeve on August 19, 2001 at 20:36:16:
[176] Fixed!
Posted By Jason Reeve on August 20, 2001 at 15:41:25:
[177] About sc(small compiler)'s length restriction on symbol name
Posted By Dick Guan on August 29, 2001 at 11:30:53:
Through our testing on small, we figure out that there are length restriction on symbol name, and we are interested in increasing it a little :)
#define sEXPMAX 19 /* maximum length of exported symbol name */
#define sSTKMAX 80 /* stack for nested #includes and other uses */
[178] Re: About sc(small compiler)'s length restriction on symbol name
Posted By Clem Vasseur on August 29, 2001 at 14:03:23:
[179] Re: About sc(small compiler)'s length restriction on symbol name
Posted By Thiadmer Riemersma on August 30, 2001 at 06:52:29:
[180] Syntax Highlight
Posted By Conrad on September 04, 2001 at 17:09:23:
At the moment i'm using the C-textpad-file to do the job but i'm not sure it's so good since i'm not a C programmer.
[181] Re: Syntax Highlight
Posted By Thiadmer Riemersma on September 05, 2001 at 06:42:32:
: At the moment i'm using the C-textpad-file to do the job but i'm not sure it's so good since i'm not a C programmer.
[182] Re: Syntax Highlight
Posted By Florian Zschocke on September 07, 2001 at 14:22:31:
[183] Help with *property functions
Posted By Conrad on September 07, 2001 at 18:04:43:
[184] Getting unresolved external symbol using AMX_NATIVE_INFO
Posted By Alexander bierbrauer on September 10, 2001 at 07:59:32:error LNK2001: Nichtaufgeloestes externes Symbol "struct AMX_NATIVE_INFO * console_Natives" (?console_Nativesb_3PAUAMX_NATIVE_INFOb_A)
Alex
#define AMX_NATIVE_CALL __stdcall
#define AMXAPI __stdcall
#include <stdlib.h>
#include <stdio.h>
#include <iostream.h>
#include <memory.h>
#include <amx.h>
void core_Init(void); /* two functions from AMX_CORE.C */
void core_Exit(void);
extern AMX_NATIVE_INFO console_Natives[];
/*******************************
* this function loads a amx-file
*******************************/
void *loadprogram(AMX *amx,char *path)
{
FILE *file;
AMX_HEADER header;
void *program=NULL;
file=fopen(path,"rb");
if(!file)
{
cout<<endl<<path<<" does not exist!"<<endl;
return NULL;
}
fread(&header,sizeof(AMX_HEADER),1,file);
if((program=malloc((int)header.stp))!=NULL)
{
rewind(file);
fread(program,1,(int)header.size,file);
fclose(file);
memset(amx,0,sizeof(AMX));
if(amx_Init(amx,program)==AMX_ERR_NONE)
return program;
free(program);
}
return NULL;
}
void main()
{
char path[256];
AMX amx;
cell ret;
int error;
void *program;
cout<<"SMALL testprogram\n"<<endl;
cout<<"AMX file to run: ";
cin>>path;
cout<<"running "<<path<<"...";
program=loadprogram(&amx,path);
error=amx_Register(&amx,console_Natives,-1);
if(error=AMX_ERR_NONE)
error=amx_Exec(&amx,&ret,AMX_EXEC_MAIN,0);
if(error!=AMX_ERR_NONE)
cout<<"run time error "<<error<<" on line "<<amx.curline <<endl;
free(program);
}
[185] Syntax Highlight
Posted By Xanathar on September 10, 2001 at 11:58:24:
[186] Re: Getting unresolved external symbol using AMX_NATIVE_INFO
Posted By Xanathar on September 10, 2001 at 12:05:27:
extern AMX_NATIVE_INFO console_Natives[];
void core_Init(void);
void core_Exit(void);
}
[187] Help!! anyone got some code or can help me??
Posted By Alexander Bierbrauer on September 10, 2001 at 13:17:44:
{
test();
}
Does someone know why??
cell AMX_NATIVE_CALL test(AMX *amx,cell *params)
{
cout<<"Hallo!";
return 0;
}
* this function loads a amx-file
*******************************/
void *loadprogram(AMX *amx,char *path)
{
FILE *file;
AMX_HEADER header;
void *program=NULL;
int error=0;
if(!file)
{
cout<
}
if((program=malloc((int)header.stp))!=NULL)
{
rewind(file);
fread(program,1,(int)header.size,file);
fclose(file);
memset(amx,0,sizeof(*amx));
if(error==AMX_ERR_NONE)return program;
else cout<<" Fehler:"<
}
}
{
char path[256];
AMX amx;
cell ret;
int error;
void *program;
cin>>path;
cout<<"running "<
if(error=AMX_ERR_NONE)
error=amx_Exec(&amx,&ret,AMX_EXEC_MAIN,0);
cout<<"run time error "<
}
[188] What kind of error do you get?
Posted By Xanathar on September 10, 2001 at 18:09:31:
--
[189] Re: Help!! anyone got some code or can help me??
Posted By Thiadmer Riemersma on September 11, 2001 at 02:49:13:
: I'm getting error 19 but don't know how to get rid of it.
: [...]
: error=amx_Register(&amx,test_Natives,-1);
[190] Re: What kind of error do you get?
Posted By Alexander Bierbrauer on September 11, 2001 at 08:53:03:
error=amx_Exec(&amx,&ret,AMX_EXEC_MAIN,0);
extern AMX_NATIVE_INFO core_Natives[];
* this function loads a amx-file
*******************************/
void *loadprogram(AMX *amx,char *path)
{
FILE *file;
AMX_HEADER header;
void *program=NULL;
int error=0;
if(!file)
{
cout<
}
if((program=malloc((int)header.stp))!=NULL)
{
rewind(file);
fread(program,1,(int)header.size,file);
fclose(file);
memset(amx,0,sizeof(*amx));
if(error==AMX_ERR_NONE)return program;
else cout<<" Fehler:"<
}
}
{
AMX amx;
cell ret;
int error;
void *program;
error=amx_Exec(&amx,&ret,AMX_EXEC_MAIN,0);
cout<<"run time error "<
}<<>>
[191] Bug Report (?)
Posted By Xanathar on September 14, 2001 at 03:10:06:
Small compiler 1.7 Copyright (c) 1997-2001, ITB CompuPhase
An integer divide by zero was encountered at address 0x00409dcf
If I delete the pragma, the compiler builds ok (except for warning 217 of course).
[192] Also..
Posted By Xanathar again on September 14, 2001 at 03:16:45:
[193] Re: Bug Report (?)
Posted By Thiadmer Riemersma on September 14, 2001 at 03:38:24:
: An integer divide by zero was encountered at address 0x00409dcf
[194] Sent...
Posted By Xanathar on September 14, 2001 at 09:28:02:
[195] Please !!
Posted By Conrad on September 21, 2001 at 17:20:30:
[196] Proposal
Posted By Xanathar on September 23, 2001 at 06:39:54:#ifdef LINUX
#define PACK_NEEDED __attribute__ ((packed))
#else
#define PACK_NEEDED
#pragma pack(1)
// add anything regarding TC :)
#endif
struct ___amx_native_info {
char *name;
AMX_NATIVE func;
} PACK_NEEDED;
typedef struct ___amx_native_info AMX_NATIVE_INFO;
#endif
[197] Re: Help with *property functions
Posted By Thiadmer Riemersma on September 24, 2001 at 03:28:19:#include <core>
#include <console>
main()
{
/* There are two ways to work with properties
* 1. you can look up values for names (string property)
* 2. you can look up names for values (value property)
*
* Properties can furthermore be assigned to a specific
* category. You may, for example, have global properties
* in addition to properties that you keep local to one
* abstract machine. You select the category with the "id"
* parameter of all property functions. In the examples
* below, I have only added properties to the default
* category 0, and never specified the "id" parameter.
*/
/* This example shows you how to use "string properties";
* that is, the property is identified by its name and it
* has a numeric value.
*/
/* set a few properties */
setproperty( .name="apple", .value=1 )
setproperty( .name="banana", .value=2 )
/* print the properties if they exist */
if (existproperty( .name="banana" ) )
printf("property 'banana' = %d^n", getproperty( .name="banana" ) )
else
printf("property 'banana' does not exist^n")
if (existproperty( .name="citron" ) )
printf("property 'citron' = %d^n", getproperty( .name="citron" ) )
else
printf("property 'citron' does not exist^n")
/* delete the properties */
deleteproperty( .name="apple" )
deleteproperty( .name="banana" )
/* Now, a similar example with "value properties". Here,
* a property is identified with a unique value and it
* keeps a string value.
*/
setproperty( .value=10, .string="lemon" )
setproperty( .value=11, .string="mango" )
/* print the properties if they exist */
if (existproperty( .value=11 ) )
{
new namestr[10]
getproperty( .value=11, .string=namestr )
printf("property 11 = %s^n", namestr )
}
else
printf("property 11 does not exist^n")
if (existproperty( .value=12 ) )
{
new namestr[10]
getproperty( .value=12, .string=namestr )
printf("property 12 = %s^n", namestr )
}
else
printf("property 12 does not exist^n")
/* delete the properties */
deleteproperty( .value=10 )
deleteproperty( .value=11 )
}
[198] Thanks
Posted By Conrad on September 24, 2001 at 17:11:08:
[199] Re: Proposal
Posted By Florian Zschocke on September 25, 2001 at 07:22:34:
[200] Oh.. sorry haven't seen :) [NT]
Posted By Xanathar on September 26, 2001 at 10:59:21:
...
[201] compiling small under DOS using djgpp
Posted By Julien Cugniere on September 26, 2001 at 12:41:46:
srun compiled successfully using the standard command line. To compile sc, I used a modified version of makefile.linux. It compiled, but gave warnings about malformed pragma pack. I corrected these by changing the source to use the linux syntax.
a==0, b==4 (should be a==5, b==4)
I tried to compile it with VisualC++ 5.0, and got the same symptoms!
Apart from that, small seems very good, I just wish I could get it to work... =)
[202] Re: compiling small under DOS using djgpp
Posted By Clem Vasseur on September 26, 2001 at 15:54:38:
[203] Re: compiling small under DOS using djgpp
Posted By Thiadmer Riemersma on September 28, 2001 at 11:45:55:
: a==0, b==4 (should be a==5, b==4)
[204] Errors & warnings from MSVC++ 6.0
Posted By Spike McLarty on September 29, 2001 at 02:06:02:
[205] Re: Is Small Assembler compiler threadsafe?
Posted By cakir on October 01, 2001 at 08:23:14:
[206] Threading under Win32
Posted By Jason Reeve on October 01, 2001 at 16:24:17:
[207] Re: Errors & warnings from MSVC++ 6.0
Posted By Thiadmer Riemersma on October 04, 2001 at 02:36:53:
[208] Re: compiling small under DOS using djgpp
Posted By Thiadmer Riemersma on October 04, 2001 at 02:49:52:
[209] May work may not :)
Posted By Xanathar on October 04, 2001 at 09:36:16:
while (err == AMX_ERR_SLEEP) {
err = amx_Exec(m_AMX, &ret, AMX_EXEC_CONT, ...);
Sleep(5);
}
[210] Re: May work may not :)
Posted By Jason Reeve on October 04, 2001 at 12:02:13:
[211] Probable Bug Report
Posted By Xanathar on October 04, 2001 at 18:29:56:
mnu_setCallback (s, funcidx ("foo"));
mnu_show (s);
makes Small VM crash..
while..
mnu_setCallback (s, funcidx ("foo"));
mnu_show (s);
[212] Weird Bugs (possibly!)
Posted By Jason Reeve on October 13, 2001 at 10:55:03:
...
x = -rock_size[type]
[213] -D compiler option
Posted By Daniel Ludwig on October 16, 2001 at 18:19:27:
in sc1.c, line 40, insert:
#define dos_setdrive(i) _chdrive(i)
[214] Re: -D compiler option
Posted By Daniel Ludwig on October 17, 2001 at 04:20:02:
: in sc1.c, line 40, insert:
#define dos_setdrive(i) _chdrive(i)
[215] Re: -D compiler option
Posted By Thiadmer Riemersma on October 17, 2001 at 10:03:55:
[216] Re: Probable Bug Report
Posted By Thiadmer Riemersma on October 17, 2001 at 10:04:36:
: mnu_setCallback (s, funcidx ("foo"));
: mnu_show (s);
: makes Small VM crash..
[217] Re: Weird Bugs (possibly!)
Posted By Thiadmer Riemersma on October 17, 2001 at 10:07:18:
: new rock_size[3] = {64,32,16}
: ...
: x = -rock_size[type]
#include <console>
{
new x, type
new rock_size[3] = {64,32,16}
x = -rock_size[type]
printf("Value=%d^n",x)
}
: try setting a float to a negative number like this,
[218] Re: -D compiler option
Posted By Thiadmer Riemersma on October 18, 2001 at 04:32:45:
: err, the forum screwed up this, lets try again :)
[219] Multithreading in SMALL
Posted By Pierre-Paul Hackens on October 19, 2001 at 05:31:33:
[220] Re: Weird Bugs (possibly!)
Posted By Jason Reeve on October 19, 2001 at 20:48:00:
[221] Re: Multithreading in SMALL
Posted By Thiadmer Riemersma on October 21, 2001 at 11:14:19:
[222] Small forum is restored
Posted By Thiadmer Riemersma on November 15, 2001 at 04:06:40:
[223] Constructor/Destructor?
Posted By James Bellinger on November 29, 2001 at 07:58:53:
[224] Re: Constructor/Destructor?
Posted By Thiadmer Riemersma on November 29, 2001 at 11:23:00:
[225] Re: Constructor/Destructor?
Posted By James Bellinger on November 29, 2001 at 12:30:35:
[226] Re: Constructor/Destructor?
Posted By Thiadmer Riemersma on November 30, 2001 at 03:20:36:
[227] OpenBSD trick
Posted By Xanathar on November 30, 2001 at 14:49:37:
#if defined(__OpenBSD__)
#define __BYTE_ORDER BYTE_ORDER
#define __LITTLE_ENDIAN LITTLE_ENDIAN
#define __BIG_ENDIAN BIG_ENDIAN
#endif
[228] Re: Constructor/Destructor?
Posted By James Bellinger on November 30, 2001 at 19:57:05:
[229] Getting String parameters..
Posted By Greg Denness on December 01, 2001 at 19:16:06:
[230] Trouble Loading files with the Abstract Machine
Posted By GD on December 02, 2001 at 16:20:59:
{
printf("test");
printf("test");
printf("test");
printf("test");
printf("test");
x50 more...
}
I wanted to test if the Abstract Machine could handle larger scripts. However it doesnt work at all, whenever I call amx_Init() with this script it falls over dead.
[231] Re: Trouble Loading files with the Abstract Machine
Posted By GD on December 02, 2001 at 19:01:07:
assertion failed!
line: 573
---------------------------------------
if you choose to ignore this then a few more assertion failures pop up and it finally crashes.
[232] UltraEdit Wordlist
Posted By Joe Hansche on December 02, 2001 at 22:25:40:
-Joe
[233] Re: Constructor/Destructor?
Posted By Thiadmer Riemersma on December 03, 2001 at 03:16:43:
[234] Re: OpenBSD trick
Posted By Thiadmer Riemersma on December 03, 2001 at 03:25:38:
: #define __BYTE_ORDER BYTE_ORDER
: #define __LITTLE_ENDIAN LITTLE_ENDIAN
: #define __BIG_ENDIAN BIG_ENDIAN
: #endif
[235] Re: Getting String parameters..
Posted By Thiadmer Riemersma on December 03, 2001 at 12:17:12:
[236] Re: Trouble Loading files with the Abstract Machine
Posted By Thiadmer Riemersma on December 04, 2001 at 04:02:54:
: line: 573
: ---------------------------------------
[237] Re: UltraEdit Wordlist
Posted By Thiadmer Riemersma on December 05, 2001 at 03:03:37:
/Function String 2 = "%^{native^}^{public^}[ ^t]++^([a-zA-Z_@0-9]+^)[ ^t]++([a-zA-Z_:&=^^'^"., 0-9^[^]-]++)"
[238] Re: UltraEdit Wordlist
Posted By Joe on December 05, 2001 at 04:54:24:
: /Function String 2 = "%^{native^}^{public^}[ ^t]++^([a-zA-Z_@0-9]+^)[ ^t]++([a-zA-Z_:&=^^'^"., 0-9^[^]-]++)"
-Joe
[239] What does the Floating Point Module do exacty?
Posted By Tomy truman on December 08, 2001 at 21:21:05:
I see that you can include<float> for some kind of floating point support in small script, but how do you use it once you have included it?
[240] Re: What does the Floating Point Module do exacty?
Posted By Thiadmer Riemersma on December 10, 2001 at 07:30:12:
[241] A Suggestion
Posted By Gilad Novik on December 13, 2001 at 09:56:30:
switch (x)
{
case a:
case b:
Function1();
Function2();
break;
case c:
Function3();
}
[242] Can I share a program/data section ?
Posted By chop on December 13, 2001 at 11:58:55:
Already, Small is running as 3d-object animation scripting tool.
so many of amx are available at a same time.
AttachScript( cube, "cube_main" );
but, It seems to be possible to share a program section
( and data section too? ) of same .amx file.
[243] AMX Decompiler or Disassembler ??
Posted By Chris Ruvolo on December 14, 2001 at 00:06:39:
[244] Re: A Suggestion
Posted By Thiadmer Riemersma on December 14, 2001 at 05:52:39:
switch (x)
{
case a, b:
{
Function1()
Function2()
}
case c:
Function3()
}
[245] Hmm, what is the problem here?
Posted By Jim Bellinger on December 15, 2001 at 12:33:17:
#define DOORS_EACH 4
{ \
{ 89, 106 }, \
{ 88, 96 }, \
{ 77, 97 }, \
{ 79, 108 } \
}, \
{ \
{ 81, 105 }, \
{ 80, 100 }, \
{ 85, 99 }, \
{ 86, 104 } \
}, \
{ \
{ 82, 102 }, \
{ 84, 102 }, \
{ 83, 101 }, \
{ 83, 103 } \
} \
}
[246] Re: Hmm, what is the problem here?
Posted By Thiadmer Riemersma on December 17, 2001 at 02:57:15:
[247] Re: Hmm, what is the problem here?
Posted By Jim Bellinger on December 17, 2001 at 18:17:44:
[248] Re: Hmm, what is the problem here?
Posted By Thiadmer Riemersma on December 18, 2001 at 02:57:06:
[249] Re: A Suggestion
Posted By Gilad Novik on December 18, 2001 at 05:45:29:int nBase=0;
switch (x)
{
case 'a':
nBase=10;
case 't':
nBase=50;
case 'z':
nBase=100;
Function1(nBase); // This function will match all cases above
break;
default:
printf("Unknown option\n");
}
[250] Re: A Suggestion
Posted By Gilad Novik on December 18, 2001 at 05:52:05:
[251] Execute OS command
Posted By Jonas Björklund on December 18, 2001 at 16:19:46:
[252] Calling Functions from different scripts
Posted By Dave Sims on December 18, 2001 at 16:25:27:
static cell AMX_NATIVE_CALL CallFunction(AMX *amx, cell *params)
{
char szString[ENT_STRING_MAX];
int wIndex;
cell ret;
// Get the String from the Second Param
GetStringParam(amx, params[2], szString);
CEntity* pTemp = GetEntity(amx, params);
if (pTemp)
{
if (pTemp->GetAMX())
{
amx_FindPublic(pTemp->GetAMX(), szString, &wIndex);
amx_Exec(pTemp->GetAMX(), &ret, wIndex, 0);
return ret;
}
}
return 0;
}
CallFunction(entity[], funcname[], ...);
[253] You can write it yourself
Posted By Gilad Novik on December 19, 2001 at 07:12:27:
[254] Re: Calling Functions from different scripts
Posted By Dave Sims on December 19, 2001 at 10:13:50:
[255] Re: Calling Functions from different scripts
Posted By Thiadmer Riemersma on December 21, 2001 at 06:08:22:
[256] i need with admin mod codes and cheats
Posted By TEAM FORTRESS [MAN] on December 22, 2001 at 16:21:48:
e-mail me @ maddog_jjw@hotmail.com
[257] Extending with Native Functions
Posted By Alain Schlesser on December 24, 2001 at 13:53:24:
I wanted to get some advice. Is it possible to enable users to build DLLs with Native Functions that can then be integrated without recompiling the compiler/virtual machine? I thought about something like a DLL which gives info about the functions it includes upon loading. Can these functions then be included in the virtual machine without recompilation so that all my native functions can be in separate DLLs?
Thanks in advance,
Alain
[258] Minor Problem w/ amx_GetString
Posted By Doug Goldstein on December 30, 2001 at 05:24:27:
[259] Re: Extending with Native Functions
Posted By Thiadmer Riemersma on December 31, 2001 at 03:45:17:
#pragma library "serial.dll"
[260] Re: Socket programming in Small?
Posted By J Sidhu on December 31, 2001 at 06:02:33:
: Ron Jamison