Normalize line endings
This commit is contained in:
parent
07802f741a
commit
5ecee7c582
@ -1,10 +1,10 @@
|
|||||||
#include <args>
|
#include <args>
|
||||||
|
|
||||||
main()
|
main()
|
||||||
{
|
{
|
||||||
printf "Argument count = %d\n", argcount()
|
printf "Argument count = %d\n", argcount()
|
||||||
|
|
||||||
new opt[100]
|
new opt[100]
|
||||||
for (new index = 0; argindex(index, opt); index++)
|
for (new index = 0; argindex(index, opt); index++)
|
||||||
printf "Argument %d = %s\n", index, opt
|
printf "Argument %d = %s\n", index, opt
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
#include <rational>
|
#include <rational>
|
||||||
|
|
||||||
main()
|
main()
|
||||||
{
|
{
|
||||||
new Rational: Celsius
|
new Rational: Celsius
|
||||||
new Rational: Fahrenheit
|
new Rational: Fahrenheit
|
||||||
|
|
||||||
print "Celsius\t Fahrenheit\n"
|
print "Celsius\t Fahrenheit\n"
|
||||||
for (Celsius = 5; Celsius <= 25; Celsius++)
|
for (Celsius = 5; Celsius <= 25; Celsius++)
|
||||||
{
|
{
|
||||||
Fahrenheit = (Celsius * 1.8) + 32
|
Fahrenheit = (Celsius * 1.8) + 32
|
||||||
printf "%r \t %r\n", Celsius, Fahrenheit
|
printf "%r \t %r\n", Celsius, Fahrenheit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,37 +1,37 @@
|
|||||||
bool: ispacked(string[])
|
bool: ispacked(string[])
|
||||||
return bool: (string[0] > charmax)
|
return bool: (string[0] > charmax)
|
||||||
|
|
||||||
my_strlen(string[])
|
my_strlen(string[])
|
||||||
{
|
{
|
||||||
new len = 0
|
new len = 0
|
||||||
if (ispacked(string))
|
if (ispacked(string))
|
||||||
while (string{len} != EOS) /* get character from pack */
|
while (string{len} != EOS) /* get character from pack */
|
||||||
++len
|
++len
|
||||||
else
|
else
|
||||||
while (string[len] != EOS) /* get cell */
|
while (string[len] != EOS) /* get cell */
|
||||||
++len
|
++len
|
||||||
return len
|
return len
|
||||||
}
|
}
|
||||||
|
|
||||||
strupper(string[])
|
strupper(string[])
|
||||||
{
|
{
|
||||||
assert ispacked(string)
|
assert ispacked(string)
|
||||||
|
|
||||||
for (new i=0; string{i} != EOS; ++i)
|
for (new i=0; string{i} != EOS; ++i)
|
||||||
string{i} = toupper(string{i})
|
string{i} = toupper(string{i})
|
||||||
}
|
}
|
||||||
|
|
||||||
main()
|
main()
|
||||||
{
|
{
|
||||||
new s[10]
|
new s[10]
|
||||||
|
|
||||||
for (new i = 0; i < 5; i++)
|
for (new i = 0; i < 5; i++)
|
||||||
s{i}=i+'a'
|
s{i}=i+'a'
|
||||||
s{5}=EOS
|
s{5}=EOS
|
||||||
|
|
||||||
printf("String is %s\n", ispacked(s) ? "packed" : "unpacked")
|
printf("String is %s\n", ispacked(s) ? "packed" : "unpacked")
|
||||||
printf("String length is %d\n", my_strlen(s))
|
printf("String length is %d\n", my_strlen(s))
|
||||||
printf("Original: %s\n", s)
|
printf("Original: %s\n", s)
|
||||||
strupper(s)
|
strupper(s)
|
||||||
printf("Upper case: %s\n", s)
|
printf("Upper case: %s\n", s)
|
||||||
}
|
}
|
||||||
|
130
examples/cards.p
130
examples/cards.p
@ -1,65 +1,65 @@
|
|||||||
enum _: CardSuits
|
enum _: CardSuits
|
||||||
{
|
{
|
||||||
Clubs,
|
Clubs,
|
||||||
Diamonds,
|
Diamonds,
|
||||||
Hearts,
|
Hearts,
|
||||||
Spades,
|
Spades,
|
||||||
}
|
}
|
||||||
|
|
||||||
const CardTypes = 13
|
const CardTypes = 13
|
||||||
const TotalCards = CardSuits * CardTypes
|
const TotalCards = CardSuits * CardTypes
|
||||||
|
|
||||||
enum CardDescription
|
enum CardDescription
|
||||||
{
|
{
|
||||||
CardName[10 char],
|
CardName[10 char],
|
||||||
CardSuit,
|
CardSuit,
|
||||||
CardValue,
|
CardValue,
|
||||||
}
|
}
|
||||||
|
|
||||||
new CardNames[CardTypes][] = { !"Ace", !"Two", !"Three", !"Four", !"Five",
|
new CardNames[CardTypes][] = { !"Ace", !"Two", !"Three", !"Four", !"Five",
|
||||||
!"Six", !"Seven", !"Eight", !"Nine", !"Ten",
|
!"Six", !"Seven", !"Eight", !"Nine", !"Ten",
|
||||||
!"Jack", !"Queen", !"King" }
|
!"Jack", !"Queen", !"King" }
|
||||||
new CardValues[CardTypes] = { 11, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10 }
|
new CardValues[CardTypes] = { 11, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10 }
|
||||||
|
|
||||||
main()
|
main()
|
||||||
{
|
{
|
||||||
new Cards[ TotalCards ][ CardDescription ]
|
new Cards[ TotalCards ][ CardDescription ]
|
||||||
|
|
||||||
/* fill in the cards */
|
/* fill in the cards */
|
||||||
for (new suit = 0; suit < CardSuits; suit++)
|
for (new suit = 0; suit < CardSuits; suit++)
|
||||||
{
|
{
|
||||||
for (new card = 0; card < CardTypes; card++)
|
for (new card = 0; card < CardTypes; card++)
|
||||||
{
|
{
|
||||||
new index = suit*CardTypes + card
|
new index = suit*CardTypes + card
|
||||||
strpack Cards[ index ][CardName], CardNames[ card ]
|
strpack Cards[ index ][CardName], CardNames[ card ]
|
||||||
Cards[ index ][ CardSuit ] = suit
|
Cards[ index ][ CardSuit ] = suit
|
||||||
Cards[ index ][ CardValue ] = CardValues[ card ]
|
Cards[ index ][ CardValue ] = CardValues[ card ]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* shuffle the cards (swap an arbitrary number of randomly selected cards) */
|
/* shuffle the cards (swap an arbitrary number of randomly selected cards) */
|
||||||
for (new iter = 0; iter < 200; iter++)
|
for (new iter = 0; iter < 200; iter++)
|
||||||
{
|
{
|
||||||
new first = random(TotalCards)
|
new first = random(TotalCards)
|
||||||
new second = random(TotalCards)
|
new second = random(TotalCards)
|
||||||
new TempCard[ CardDescription ]
|
new TempCard[ CardDescription ]
|
||||||
TempCard = Cards[first]
|
TempCard = Cards[first]
|
||||||
Cards[ first ] = Cards[ second ]
|
Cards[ first ] = Cards[ second ]
|
||||||
Cards[ second ] = TempCard
|
Cards[ second ] = TempCard
|
||||||
}
|
}
|
||||||
|
|
||||||
/* print the cards with a subroutine */
|
/* print the cards with a subroutine */
|
||||||
for (new card = 0; card < TotalCards; card++)
|
for (new card = 0; card < TotalCards; card++)
|
||||||
PrintCard Cards[ card]
|
PrintCard Cards[ card]
|
||||||
}
|
}
|
||||||
|
|
||||||
PrintCard( TheCard[ CardDescription ] )
|
PrintCard( TheCard[ CardDescription ] )
|
||||||
{
|
{
|
||||||
new SuitNames[ CardSuits ][] = { !"Clubs", !"Diamonds",
|
new SuitNames[ CardSuits ][] = { !"Clubs", !"Diamonds",
|
||||||
!"Hearts", !"Spades" }
|
!"Hearts", !"Spades" }
|
||||||
|
|
||||||
printf !"%s of %s (valued %d)\n",
|
printf !"%s of %s (valued %d)\n",
|
||||||
TheCard[ CardName ],
|
TheCard[ CardName ],
|
||||||
SuitNames[ TheCard[ CardSuit ] ],
|
SuitNames[ TheCard[ CardSuit ] ],
|
||||||
TheCard[ CardValue ]
|
TheCard[ CardValue ]
|
||||||
}
|
}
|
||||||
|
@ -1,31 +1,31 @@
|
|||||||
#include <datagram>
|
#include <datagram>
|
||||||
|
|
||||||
@receivestring(const message[], const source[])
|
@receivestring(const message[], const source[])
|
||||||
printf "[%s] says: %s\n", source, message
|
printf "[%s] says: %s\n", source, message
|
||||||
|
|
||||||
@keypressed(key)
|
@keypressed(key)
|
||||||
{
|
{
|
||||||
static string[100 char]
|
static string[100 char]
|
||||||
static index
|
static index
|
||||||
|
|
||||||
if (key == '\e')
|
if (key == '\e')
|
||||||
exit /* quit on 'Esc' key */
|
exit /* quit on 'Esc' key */
|
||||||
|
|
||||||
echo key
|
echo key
|
||||||
if (key == '\r' || key == '\n' || index char == sizeof string)
|
if (key == '\r' || key == '\n' || index char == sizeof string)
|
||||||
{
|
{
|
||||||
string{index} = '\0' /* terminate string */
|
string{index} = '\0' /* terminate string */
|
||||||
sendstring string
|
sendstring string
|
||||||
index = 0
|
index = 0
|
||||||
string[index] = '\0'
|
string[index] = '\0'
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
string{index++} = key
|
string{index++} = key
|
||||||
}
|
}
|
||||||
|
|
||||||
echo(key)
|
echo(key)
|
||||||
{
|
{
|
||||||
new string[2 char] = { 0 }
|
new string[2 char] = { 0 }
|
||||||
string{0} = key == '\r' ? '\n' : key
|
string{0} = key == '\r' ? '\n' : key
|
||||||
printf string
|
printf string
|
||||||
}
|
}
|
||||||
|
@ -1,45 +1,45 @@
|
|||||||
/* parse C comments interactively, using events and a state machine */
|
/* parse C comments interactively, using events and a state machine */
|
||||||
|
|
||||||
main()
|
main()
|
||||||
state plain
|
state plain
|
||||||
|
|
||||||
@keypressed(key) <plain>
|
@keypressed(key) <plain>
|
||||||
{
|
{
|
||||||
state (key == '/') slash
|
state (key == '/') slash
|
||||||
if (key != '/')
|
if (key != '/')
|
||||||
echo key
|
echo key
|
||||||
}
|
}
|
||||||
|
|
||||||
@keypressed(key) <slash>
|
@keypressed(key) <slash>
|
||||||
{
|
{
|
||||||
state (key != '/') plain
|
state (key != '/') plain
|
||||||
state (key == '*') comment
|
state (key == '*') comment
|
||||||
echo '/' /* print '/' held back from previous state */
|
echo '/' /* print '/' held back from previous state */
|
||||||
if (key != '/')
|
if (key != '/')
|
||||||
echo key
|
echo key
|
||||||
}
|
}
|
||||||
|
|
||||||
@keypressed(key) <comment>
|
@keypressed(key) <comment>
|
||||||
{
|
{
|
||||||
echo key
|
echo key
|
||||||
state (key == '*') star
|
state (key == '*') star
|
||||||
}
|
}
|
||||||
|
|
||||||
@keypressed(key) <star>
|
@keypressed(key) <star>
|
||||||
{
|
{
|
||||||
echo key
|
echo key
|
||||||
state (key != '*') comment
|
state (key != '*') comment
|
||||||
state (key == '/') plain
|
state (key == '/') plain
|
||||||
}
|
}
|
||||||
|
|
||||||
echo(key) <plain, slash>
|
echo(key) <plain, slash>
|
||||||
printchar key, yellow
|
printchar key, yellow
|
||||||
|
|
||||||
echo(key) <comment, star>
|
echo(key) <comment, star>
|
||||||
printchar key, green
|
printchar key, green
|
||||||
|
|
||||||
printchar(ch, colour)
|
printchar(ch, colour)
|
||||||
{
|
{
|
||||||
setattr .foreground = colour
|
setattr .foreground = colour
|
||||||
printf "%c", ch
|
printf "%c", ch
|
||||||
}
|
}
|
||||||
|
@ -1,20 +1,20 @@
|
|||||||
/* Calculation of the faculty of a value */
|
/* Calculation of the faculty of a value */
|
||||||
|
|
||||||
main()
|
main()
|
||||||
{
|
{
|
||||||
print "Enter a value: "
|
print "Enter a value: "
|
||||||
new v = getvalue()
|
new v = getvalue()
|
||||||
new f = faculty(v)
|
new f = faculty(v)
|
||||||
printf "The faculty of %d is %d\n", v, f
|
printf "The faculty of %d is %d\n", v, f
|
||||||
}
|
}
|
||||||
|
|
||||||
faculty(n)
|
faculty(n)
|
||||||
{
|
{
|
||||||
assert n >= 0
|
assert n >= 0
|
||||||
|
|
||||||
new result = 1
|
new result = 1
|
||||||
while (n > 0)
|
while (n > 0)
|
||||||
result *= n--
|
result *= n--
|
||||||
|
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
@ -1,26 +1,26 @@
|
|||||||
/* Calculation of Fibonacci numbers by iteration */
|
/* Calculation of Fibonacci numbers by iteration */
|
||||||
|
|
||||||
main()
|
main()
|
||||||
{
|
{
|
||||||
print "Enter a value: "
|
print "Enter a value: "
|
||||||
new v = getvalue()
|
new v = getvalue()
|
||||||
if (v > 0)
|
if (v > 0)
|
||||||
printf "The value of Fibonacci number %d is %d\n",
|
printf "The value of Fibonacci number %d is %d\n",
|
||||||
v, fibonacci(v)
|
v, fibonacci(v)
|
||||||
else
|
else
|
||||||
printf "The Fibonacci number %d does not exist\n", v
|
printf "The Fibonacci number %d does not exist\n", v
|
||||||
}
|
}
|
||||||
|
|
||||||
fibonacci(n)
|
fibonacci(n)
|
||||||
{
|
{
|
||||||
assert n > 0
|
assert n > 0
|
||||||
|
|
||||||
new a = 0, b = 1
|
new a = 0, b = 1
|
||||||
for (new i = 2; i < n; i++)
|
for (new i = 2; i < n; i++)
|
||||||
{
|
{
|
||||||
new c = a + b
|
new c = a + b
|
||||||
a = b
|
a = b
|
||||||
b = c
|
b = c
|
||||||
}
|
}
|
||||||
return a + b
|
return a + b
|
||||||
}
|
}
|
||||||
|
@ -1,17 +1,17 @@
|
|||||||
/*
|
/*
|
||||||
The greatest common divisor of two values,
|
The greatest common divisor of two values,
|
||||||
using Euclides' algorithm .
|
using Euclides' algorithm .
|
||||||
*/
|
*/
|
||||||
|
|
||||||
main()
|
main()
|
||||||
{
|
{
|
||||||
print "Input two values\n"
|
print "Input two values\n"
|
||||||
new a = getvalue()
|
new a = getvalue()
|
||||||
new b = getvalue()
|
new b = getvalue()
|
||||||
while (a != b)
|
while (a != b)
|
||||||
if (a > b)
|
if (a > b)
|
||||||
a = a - b
|
a = a - b
|
||||||
else
|
else
|
||||||
b = b - a
|
b = b - a
|
||||||
printf "The greatest common divisor is %d\n", a
|
printf "The greatest common divisor is %d\n", a
|
||||||
}
|
}
|
||||||
|
@ -1,297 +1,297 @@
|
|||||||
/* A demo GTK application in Pawn, using gtk-server and the "process control"
|
/* A demo GTK application in Pawn, using gtk-server and the "process control"
|
||||||
* module for Pawn. This example also illustrates the use of (communicating)
|
* module for Pawn. This example also illustrates the use of (communicating)
|
||||||
* finite state machines.
|
* finite state machines.
|
||||||
*/
|
*/
|
||||||
#include <process>
|
#include <process>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
enum Btn
|
enum Btn
|
||||||
{
|
{
|
||||||
Btn0, Btn1, Btn2,
|
Btn0, Btn1, Btn2,
|
||||||
Btn3, Btn4, Btn5,
|
Btn3, Btn4, Btn5,
|
||||||
Btn6, Btn7, Btn8,
|
Btn6, Btn7, Btn8,
|
||||||
Btn9, BtnDot, BtnC,
|
Btn9, BtnDot, BtnC,
|
||||||
BtnCE, BtnPlus, BtnMin,
|
BtnCE, BtnPlus, BtnMin,
|
||||||
BtnMul, BtnDiv, BtnEqual,
|
BtnMul, BtnDiv, BtnEqual,
|
||||||
BtnNone,
|
BtnNone,
|
||||||
}
|
}
|
||||||
|
|
||||||
static entry /* GTK "entry" widget */
|
static entry /* GTK "entry" widget */
|
||||||
static numberstring[40 char]
|
static numberstring[40 char]
|
||||||
static accum
|
static accum
|
||||||
static Btn:pending_op
|
static Btn:pending_op
|
||||||
|
|
||||||
adddigit(digit, bool:reset = false)
|
adddigit(digit, bool:reset = false)
|
||||||
{
|
{
|
||||||
new command[80 char], charstr[2 char]
|
new command[80 char], charstr[2 char]
|
||||||
charstr{0} = (0 <= digit <= 9) ? digit + '0' : digit
|
charstr{0} = (0 <= digit <= 9) ? digit + '0' : digit
|
||||||
if (reset)
|
if (reset)
|
||||||
numberstring[0] = EOS
|
numberstring[0] = EOS
|
||||||
strcat numberstring, charstr
|
strcat numberstring, charstr
|
||||||
strformat command, _, true, "gtk_entry_set_text %d %s", entry, numberstring
|
strformat command, _, true, "gtk_entry_set_text %d %s", entry, numberstring
|
||||||
GTK(command)
|
GTK(command)
|
||||||
}
|
}
|
||||||
|
|
||||||
displayresult(value)
|
displayresult(value)
|
||||||
{
|
{
|
||||||
new command[80 char]
|
new command[80 char]
|
||||||
valstr numberstring, value, true
|
valstr numberstring, value, true
|
||||||
strformat command, _, true, "gtk_entry_set_text %d %s", entry, numberstring
|
strformat command, _, true, "gtk_entry_set_text %d %s", entry, numberstring
|
||||||
GTK(command)
|
GTK(command)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
resetentry(digit) <number:negated>
|
resetentry(digit) <number:negated>
|
||||||
{
|
{
|
||||||
adddigit '-', .reset = true
|
adddigit '-', .reset = true
|
||||||
adddigit digit
|
adddigit digit
|
||||||
}
|
}
|
||||||
|
|
||||||
resetentry(digit) <>
|
resetentry(digit) <>
|
||||||
{
|
{
|
||||||
adddigit digit, .reset = true
|
adddigit digit, .reset = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
event_0() <number:zero, number:negated>
|
event_0() <number:zero, number:negated>
|
||||||
{
|
{
|
||||||
resetentry 0
|
resetentry 0
|
||||||
}
|
}
|
||||||
|
|
||||||
event_0() <number:int, number:frac>
|
event_0() <number:int, number:frac>
|
||||||
{
|
{
|
||||||
adddigit 0
|
adddigit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
event_1_9(Btn:idx) <number:zero, number:negated>
|
event_1_9(Btn:idx) <number:zero, number:negated>
|
||||||
{
|
{
|
||||||
resetentry _:(idx - Btn0)
|
resetentry _:(idx - Btn0)
|
||||||
state number:int
|
state number:int
|
||||||
}
|
}
|
||||||
|
|
||||||
event_1_9(Btn:idx) <number:int, number:frac>
|
event_1_9(Btn:idx) <number:int, number:frac>
|
||||||
{
|
{
|
||||||
adddigit _:(idx - Btn0)
|
adddigit _:(idx - Btn0)
|
||||||
}
|
}
|
||||||
|
|
||||||
event_dot() <number:zero, number:negated>
|
event_dot() <number:zero, number:negated>
|
||||||
{
|
{
|
||||||
resetentry 0
|
resetentry 0
|
||||||
adddigit '.'
|
adddigit '.'
|
||||||
state number:frac
|
state number:frac
|
||||||
}
|
}
|
||||||
|
|
||||||
event_dot() <number:int>
|
event_dot() <number:int>
|
||||||
{
|
{
|
||||||
adddigit '.'
|
adddigit '.'
|
||||||
state number:frac
|
state number:frac
|
||||||
}
|
}
|
||||||
|
|
||||||
event_dot() <number:frac>
|
event_dot() <number:frac>
|
||||||
{
|
{
|
||||||
/* reject entry */
|
/* reject entry */
|
||||||
}
|
}
|
||||||
|
|
||||||
event_minus() <number:zero, number:negated>
|
event_minus() <number:zero, number:negated>
|
||||||
{
|
{
|
||||||
state number:negated
|
state number:negated
|
||||||
resetentry 0
|
resetentry 0
|
||||||
}
|
}
|
||||||
|
|
||||||
event_minus() <>
|
event_minus() <>
|
||||||
{
|
{
|
||||||
event_oper BtnMin /* forward to the "calc" automaton */
|
event_oper BtnMin /* forward to the "calc" automaton */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* helper function for the calculator automaton */
|
/* helper function for the calculator automaton */
|
||||||
performoperation()
|
performoperation()
|
||||||
{
|
{
|
||||||
/* get the other operand, perform the operation */
|
/* get the other operand, perform the operation */
|
||||||
new val = strval(numberstring)
|
new val = strval(numberstring)
|
||||||
switch (pending_op)
|
switch (pending_op)
|
||||||
{
|
{
|
||||||
case BtnPlus: accum += val
|
case BtnPlus: accum += val
|
||||||
case BtnMin: accum -= val
|
case BtnMin: accum -= val
|
||||||
case BtnMul: accum *= val
|
case BtnMul: accum *= val
|
||||||
case BtnDiv: accum = (val == 0) ? 0 : accum / val
|
case BtnDiv: accum = (val == 0) ? 0 : accum / val
|
||||||
}
|
}
|
||||||
displayresult accum
|
displayresult accum
|
||||||
}
|
}
|
||||||
|
|
||||||
event_oper(Btn:idx) <calc:idle>
|
event_oper(Btn:idx) <calc:idle>
|
||||||
{
|
{
|
||||||
/* save operand and operator */
|
/* save operand and operator */
|
||||||
accum = strval(numberstring)
|
accum = strval(numberstring)
|
||||||
pending_op = idx
|
pending_op = idx
|
||||||
|
|
||||||
state number:zero
|
state number:zero
|
||||||
state calc:pending
|
state calc:pending
|
||||||
}
|
}
|
||||||
|
|
||||||
event_oper(Btn:idx) <calc:pending>
|
event_oper(Btn:idx) <calc:pending>
|
||||||
{
|
{
|
||||||
performoperation /* do the pending operation */
|
performoperation /* do the pending operation */
|
||||||
pending_op = idx /* save the operator for the next operation */
|
pending_op = idx /* save the operator for the next operation */
|
||||||
state number:zero
|
state number:zero
|
||||||
}
|
}
|
||||||
|
|
||||||
event_equal() <calc:idle>
|
event_equal() <calc:idle>
|
||||||
{
|
{
|
||||||
/* ignore */
|
/* ignore */
|
||||||
}
|
}
|
||||||
|
|
||||||
event_equal() <calc:pending>
|
event_equal() <calc:pending>
|
||||||
{
|
{
|
||||||
performoperation /* do the pending operation */
|
performoperation /* do the pending operation */
|
||||||
state calc:idle /* reset the calculator */
|
state calc:idle /* reset the calculator */
|
||||||
state number:zero
|
state number:zero
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
event_C()
|
event_C()
|
||||||
{
|
{
|
||||||
state calc:idle
|
state calc:idle
|
||||||
state number:zero
|
state number:zero
|
||||||
resetentry 0
|
resetentry 0
|
||||||
}
|
}
|
||||||
|
|
||||||
event_CE()
|
event_CE()
|
||||||
{
|
{
|
||||||
state number:zero
|
state number:zero
|
||||||
resetentry 0
|
resetentry 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
main()
|
main()
|
||||||
{
|
{
|
||||||
if (!procexec("gtk-server stdin") && !procexec("gtk-server.exe stdin"))
|
if (!procexec("gtk-server stdin") && !procexec("gtk-server.exe stdin"))
|
||||||
fatal "unable to launch gtk-server"
|
fatal "unable to launch gtk-server"
|
||||||
|
|
||||||
/* make a window */
|
/* make a window */
|
||||||
GTK("gtk_init NULL NULL")
|
GTK("gtk_init NULL NULL")
|
||||||
new win = GTK("gtk_window_new 0")
|
new win = GTK("gtk_window_new 0")
|
||||||
GTK("gtk_window_set_title %d \"Pawn calculator\"", win)
|
GTK("gtk_window_set_title %d \"Pawn calculator\"", win)
|
||||||
GTK("gtk_widget_set_usize %d 200 200", win)
|
GTK("gtk_widget_set_usize %d 200 200", win)
|
||||||
|
|
||||||
/* add a table (align the other controls) */
|
/* add a table (align the other controls) */
|
||||||
new table = GTK("gtk_table_new 50 50 1")
|
new table = GTK("gtk_table_new 50 50 1")
|
||||||
GTK("gtk_container_add %d %d", win, table)
|
GTK("gtk_container_add %d %d", win, table)
|
||||||
|
|
||||||
/* the number entry */
|
/* the number entry */
|
||||||
entry = GTK("gtk_entry_new")
|
entry = GTK("gtk_entry_new")
|
||||||
GTK("gtk_table_attach_defaults %d %d 1 49 1 9", table, entry)
|
GTK("gtk_table_attach_defaults %d %d 1 49 1 9", table, entry)
|
||||||
|
|
||||||
/* the key pad */
|
/* the key pad */
|
||||||
new buttons[Btn]
|
new buttons[Btn]
|
||||||
buttons[BtnDot] = GTK("gtk_button_new_with_label .")
|
buttons[BtnDot] = GTK("gtk_button_new_with_label .")
|
||||||
GTK("gtk_table_attach_defaults %d %d 21 29 41 49", table, buttons[BtnDot])
|
GTK("gtk_table_attach_defaults %d %d 21 29 41 49", table, buttons[BtnDot])
|
||||||
buttons[Btn0] = GTK("gtk_button_new_with_label 0")
|
buttons[Btn0] = GTK("gtk_button_new_with_label 0")
|
||||||
GTK("gtk_table_attach_defaults %d %d 1 19 41 49", table, buttons[Btn0])
|
GTK("gtk_table_attach_defaults %d %d 1 19 41 49", table, buttons[Btn0])
|
||||||
buttons[Btn1] = GTK("gtk_button_new_with_label 1")
|
buttons[Btn1] = GTK("gtk_button_new_with_label 1")
|
||||||
GTK("gtk_table_attach_defaults %d %d 1 9 31 39", table, buttons[Btn1])
|
GTK("gtk_table_attach_defaults %d %d 1 9 31 39", table, buttons[Btn1])
|
||||||
buttons[Btn2] = GTK("gtk_button_new_with_label 2")
|
buttons[Btn2] = GTK("gtk_button_new_with_label 2")
|
||||||
GTK("gtk_table_attach_defaults %d %d 11 19 31 39", table, buttons[Btn2])
|
GTK("gtk_table_attach_defaults %d %d 11 19 31 39", table, buttons[Btn2])
|
||||||
buttons[Btn3] = GTK("gtk_button_new_with_label 3")
|
buttons[Btn3] = GTK("gtk_button_new_with_label 3")
|
||||||
GTK("gtk_table_attach_defaults %d %d 21 29 31 39", table, buttons[Btn3])
|
GTK("gtk_table_attach_defaults %d %d 21 29 31 39", table, buttons[Btn3])
|
||||||
buttons[Btn4] = GTK("gtk_button_new_with_label 4")
|
buttons[Btn4] = GTK("gtk_button_new_with_label 4")
|
||||||
GTK("gtk_table_attach_defaults %d %d 1 9 21 29", table, buttons[Btn4])
|
GTK("gtk_table_attach_defaults %d %d 1 9 21 29", table, buttons[Btn4])
|
||||||
buttons[Btn5] = GTK("gtk_button_new_with_label 5")
|
buttons[Btn5] = GTK("gtk_button_new_with_label 5")
|
||||||
GTK("gtk_table_attach_defaults %d %d 11 19 21 29", table, buttons[Btn5])
|
GTK("gtk_table_attach_defaults %d %d 11 19 21 29", table, buttons[Btn5])
|
||||||
buttons[Btn6] = GTK("gtk_button_new_with_label 6")
|
buttons[Btn6] = GTK("gtk_button_new_with_label 6")
|
||||||
GTK("gtk_table_attach_defaults %d %d 21 29 21 29", table, buttons[Btn6])
|
GTK("gtk_table_attach_defaults %d %d 21 29 21 29", table, buttons[Btn6])
|
||||||
buttons[Btn7] = GTK("gtk_button_new_with_label 7")
|
buttons[Btn7] = GTK("gtk_button_new_with_label 7")
|
||||||
GTK("gtk_table_attach_defaults %d %d 1 9 11 19", table, buttons[Btn7])
|
GTK("gtk_table_attach_defaults %d %d 1 9 11 19", table, buttons[Btn7])
|
||||||
buttons[Btn8] = GTK("gtk_button_new_with_label 8")
|
buttons[Btn8] = GTK("gtk_button_new_with_label 8")
|
||||||
GTK("gtk_table_attach_defaults %d %d 11 19 11 19", table, buttons[Btn8])
|
GTK("gtk_table_attach_defaults %d %d 11 19 11 19", table, buttons[Btn8])
|
||||||
buttons[Btn9] = GTK("gtk_button_new_with_label 9")
|
buttons[Btn9] = GTK("gtk_button_new_with_label 9")
|
||||||
GTK("gtk_table_attach_defaults %d %d 21 29 11 19", table, buttons[Btn9])
|
GTK("gtk_table_attach_defaults %d %d 21 29 11 19", table, buttons[Btn9])
|
||||||
|
|
||||||
buttons[BtnC] = GTK("gtk_button_new_with_label C")
|
buttons[BtnC] = GTK("gtk_button_new_with_label C")
|
||||||
GTK("gtk_table_attach_defaults %d %d 31 39 11 19", table, buttons[BtnC])
|
GTK("gtk_table_attach_defaults %d %d 31 39 11 19", table, buttons[BtnC])
|
||||||
buttons[BtnCE] = GTK("gtk_button_new_with_label CE")
|
buttons[BtnCE] = GTK("gtk_button_new_with_label CE")
|
||||||
GTK("gtk_table_attach_defaults %d %d 41 49 11 19", table, buttons[BtnCE])
|
GTK("gtk_table_attach_defaults %d %d 41 49 11 19", table, buttons[BtnCE])
|
||||||
buttons[BtnPlus] = GTK("gtk_button_new_with_label +")
|
buttons[BtnPlus] = GTK("gtk_button_new_with_label +")
|
||||||
GTK("gtk_table_attach_defaults %d %d 31 39 21 29", table, buttons[BtnPlus])
|
GTK("gtk_table_attach_defaults %d %d 31 39 21 29", table, buttons[BtnPlus])
|
||||||
buttons[BtnMin] = GTK("gtk_button_new_with_label -")
|
buttons[BtnMin] = GTK("gtk_button_new_with_label -")
|
||||||
GTK("gtk_table_attach_defaults %d %d 41 49 21 29", table, buttons[BtnMin])
|
GTK("gtk_table_attach_defaults %d %d 41 49 21 29", table, buttons[BtnMin])
|
||||||
buttons[BtnMul] = GTK("gtk_button_new_with_label x")
|
buttons[BtnMul] = GTK("gtk_button_new_with_label x")
|
||||||
GTK("gtk_table_attach_defaults %d %d 31 39 31 39", table, buttons[BtnMul])
|
GTK("gtk_table_attach_defaults %d %d 31 39 31 39", table, buttons[BtnMul])
|
||||||
buttons[BtnDiv] = GTK("gtk_button_new_with_label /")
|
buttons[BtnDiv] = GTK("gtk_button_new_with_label /")
|
||||||
GTK("gtk_table_attach_defaults %d %d 41 49 31 39", table, buttons[BtnDiv])
|
GTK("gtk_table_attach_defaults %d %d 41 49 31 39", table, buttons[BtnDiv])
|
||||||
buttons[BtnEqual] = GTK("gtk_button_new_with_label =")
|
buttons[BtnEqual] = GTK("gtk_button_new_with_label =")
|
||||||
GTK("gtk_table_attach_defaults %d %d 31 49 41 49", table, buttons[BtnEqual])
|
GTK("gtk_table_attach_defaults %d %d 31 49 41 49", table, buttons[BtnEqual])
|
||||||
|
|
||||||
/* initialize automata */
|
/* initialize automata */
|
||||||
state number:zero
|
state number:zero
|
||||||
state calc:idle
|
state calc:idle
|
||||||
|
|
||||||
/* wait for events, and dispatch them */
|
/* wait for events, and dispatch them */
|
||||||
GTK("gtk_widget_show_all %d", win)
|
GTK("gtk_widget_show_all %d", win)
|
||||||
|
|
||||||
resetentry 0
|
resetentry 0
|
||||||
new event
|
new event
|
||||||
new Btn:idx
|
new Btn:idx
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
event = GTK("gtk_server_callback wait")
|
event = GTK("gtk_server_callback wait")
|
||||||
|
|
||||||
/* find the button matching the event, generate the event */
|
/* find the button matching the event, generate the event */
|
||||||
for (idx = Btn0; idx < BtnNone && buttons[idx] != event; idx++)
|
for (idx = Btn0; idx < BtnNone && buttons[idx] != event; idx++)
|
||||||
{}
|
{}
|
||||||
switch (idx)
|
switch (idx)
|
||||||
{
|
{
|
||||||
case Btn0:
|
case Btn0:
|
||||||
event_0
|
event_0
|
||||||
case Btn1 .. Btn9:
|
case Btn1 .. Btn9:
|
||||||
event_1_9 idx
|
event_1_9 idx
|
||||||
case BtnDot:
|
case BtnDot:
|
||||||
event_dot
|
event_dot
|
||||||
case BtnMin:
|
case BtnMin:
|
||||||
event_minus
|
event_minus
|
||||||
case BtnPlus, BtnMul, BtnDiv:
|
case BtnPlus, BtnMul, BtnDiv:
|
||||||
event_oper idx
|
event_oper idx
|
||||||
case BtnEqual:
|
case BtnEqual:
|
||||||
event_equal
|
event_equal
|
||||||
case BtnC:
|
case BtnC:
|
||||||
event_C
|
event_C
|
||||||
case BtnCE:
|
case BtnCE:
|
||||||
event_CE
|
event_CE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while (event != win);
|
while (event != win);
|
||||||
|
|
||||||
/* direct call, because we must not wait for a reply on this command */
|
/* direct call, because we must not wait for a reply on this command */
|
||||||
procwrite "gtk_exit 0", true
|
procwrite "gtk_exit 0", true
|
||||||
}
|
}
|
||||||
|
|
||||||
GTK(const format[], ...)
|
GTK(const format[], ...)
|
||||||
{
|
{
|
||||||
new command[256 char]
|
new command[256 char]
|
||||||
switch (numargs())
|
switch (numargs())
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
strpack command, format
|
strpack command, format
|
||||||
case 2:
|
case 2:
|
||||||
strformat command, _, true, format, getarg(1)
|
strformat command, _, true, format, getarg(1)
|
||||||
case 3:
|
case 3:
|
||||||
strformat command, _, true, format, getarg(1), getarg(2)
|
strformat command, _, true, format, getarg(1), getarg(2)
|
||||||
case 4:
|
case 4:
|
||||||
strformat command, _, true, format, getarg(1), getarg(2), getarg(3)
|
strformat command, _, true, format, getarg(1), getarg(2), getarg(3)
|
||||||
case 5:
|
case 5:
|
||||||
strformat command, _, true, format, getarg(1), getarg(2), getarg(3), getarg(4)
|
strformat command, _, true, format, getarg(1), getarg(2), getarg(3), getarg(4)
|
||||||
}
|
}
|
||||||
procwrite command, true
|
procwrite command, true
|
||||||
|
|
||||||
new reply[30]
|
new reply[30]
|
||||||
procread reply, .striplf=true
|
procread reply, .striplf=true
|
||||||
if (strcmp(reply, "ok") == 0)
|
if (strcmp(reply, "ok") == 0)
|
||||||
return true
|
return true
|
||||||
return strval(reply)
|
return strval(reply)
|
||||||
}
|
}
|
||||||
|
|
||||||
fatal(const message[])
|
fatal(const message[])
|
||||||
{
|
{
|
||||||
printf "FATAL: %s\n", message
|
printf "FATAL: %s\n", message
|
||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
|
@ -1,17 +1,17 @@
|
|||||||
/* The Towers of Hanoi, a game solved through recursion */
|
/* The Towers of Hanoi, a game solved through recursion */
|
||||||
|
|
||||||
main()
|
main()
|
||||||
{
|
{
|
||||||
print "How many disks: "
|
print "How many disks: "
|
||||||
new disks = getvalue()
|
new disks = getvalue()
|
||||||
move 1, 3, 2, disks
|
move 1, 3, 2, disks
|
||||||
}
|
}
|
||||||
|
|
||||||
move(from, to, spare, numdisks)
|
move(from, to, spare, numdisks)
|
||||||
{
|
{
|
||||||
if (numdisks > 1)
|
if (numdisks > 1)
|
||||||
move from, spare, to, numdisks-1
|
move from, spare, to, numdisks-1
|
||||||
printf "Move disk from pillar %d to pillar %d\n", from, to
|
printf "Move disk from pillar %d to pillar %d\n", from, to
|
||||||
if (numdisks > 1)
|
if (numdisks > 1)
|
||||||
move spare, to, from, numdisks-1
|
move spare, to, from, numdisks-1
|
||||||
}
|
}
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
main()
|
main()
|
||||||
printf "Hello world\n"
|
printf "Hello world\n"
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include <console>
|
#include <console>
|
||||||
|
|
||||||
main()
|
main()
|
||||||
{
|
{
|
||||||
printf("Hello world\n");
|
printf("Hello world\n");
|
||||||
}
|
}
|
@ -1,61 +1,61 @@
|
|||||||
/* calculate Julian Day number from a date, and vice versa */
|
/* calculate Julian Day number from a date, and vice versa */
|
||||||
|
|
||||||
main()
|
main()
|
||||||
{
|
{
|
||||||
new d, m, y, jdn
|
new d, m, y, jdn
|
||||||
|
|
||||||
print "Give a date (dd-mm-yyyy): "
|
print "Give a date (dd-mm-yyyy): "
|
||||||
d = getvalue(_, '-', '/')
|
d = getvalue(_, '-', '/')
|
||||||
m = getvalue(_, '-', '/')
|
m = getvalue(_, '-', '/')
|
||||||
y = getvalue()
|
y = getvalue()
|
||||||
|
|
||||||
jdn = DateToJulian(d, m, y)
|
jdn = DateToJulian(d, m, y)
|
||||||
printf("Date %d/%d/%d = %d JD\n", d, m, y, jdn)
|
printf("Date %d/%d/%d = %d JD\n", d, m, y, jdn)
|
||||||
|
|
||||||
print "Give a Julian Day Number: "
|
print "Give a Julian Day Number: "
|
||||||
jdn = getvalue()
|
jdn = getvalue()
|
||||||
JulianToDate jdn, d, m, y
|
JulianToDate jdn, d, m, y
|
||||||
printf "%d JD = %d/%d/%d\n", jdn, d, m, y
|
printf "%d JD = %d/%d/%d\n", jdn, d, m, y
|
||||||
}
|
}
|
||||||
|
|
||||||
DateToJulian(day, month, year)
|
DateToJulian(day, month, year)
|
||||||
{
|
{
|
||||||
/* The first year is 1. Year 0 does not exist: it is 1 BC (or -1) */
|
/* The first year is 1. Year 0 does not exist: it is 1 BC (or -1) */
|
||||||
assert year != 0
|
assert year != 0
|
||||||
if (year < 0)
|
if (year < 0)
|
||||||
year++
|
year++
|
||||||
|
|
||||||
/* move January and February to the end of the previous year */
|
/* move January and February to the end of the previous year */
|
||||||
if (month <= 2)
|
if (month <= 2)
|
||||||
year--, month += 12
|
year--, month += 12
|
||||||
new jdn = 365*year + year/4 - year/100 + year/400
|
new jdn = 365*year + year/4 - year/100 + year/400
|
||||||
+ (153*month - 457) / 5
|
+ (153*month - 457) / 5
|
||||||
+ day + 1721119
|
+ day + 1721119
|
||||||
return jdn
|
return jdn
|
||||||
}
|
}
|
||||||
|
|
||||||
JulianToDate(jdn, &day, &month, &year)
|
JulianToDate(jdn, &day, &month, &year)
|
||||||
{
|
{
|
||||||
jdn -= 1721119
|
jdn -= 1721119
|
||||||
|
|
||||||
/* approximate year, then adjust in a loop */
|
/* approximate year, then adjust in a loop */
|
||||||
year = (400 * jdn) / 146097
|
year = (400 * jdn) / 146097
|
||||||
while (365*year + year/4 - year/100 + year/400 < jdn)
|
while (365*year + year/4 - year/100 + year/400 < jdn)
|
||||||
year++
|
year++
|
||||||
year--
|
year--
|
||||||
|
|
||||||
/* determine month */
|
/* determine month */
|
||||||
jdn -= 365*year + year/4 - year/100 + year/400
|
jdn -= 365*year + year/4 - year/100 + year/400
|
||||||
month = (5*jdn + 457) / 153
|
month = (5*jdn + 457) / 153
|
||||||
|
|
||||||
/* determine day */
|
/* determine day */
|
||||||
day = jdn - (153*month - 457) / 5
|
day = jdn - (153*month - 457) / 5
|
||||||
|
|
||||||
/* move January and February to start of the year */
|
/* move January and February to start of the year */
|
||||||
if (month > 12)
|
if (month > 12)
|
||||||
month -= 12, year++
|
month -= 12, year++
|
||||||
|
|
||||||
/* adjust negative years (year 0 must become 1 BC, or -1) */
|
/* adjust negative years (year 0 must become 1 BC, or -1) */
|
||||||
if (year <= 0)
|
if (year <= 0)
|
||||||
year--
|
year--
|
||||||
}
|
}
|
||||||
|
124
examples/ones.p
124
examples/ones.p
@ -1,62 +1,62 @@
|
|||||||
forward ones: operator+(ones: a, ones: b)
|
forward ones: operator+(ones: a, ones: b)
|
||||||
forward ones: operator-(ones: a, ones: b)
|
forward ones: operator-(ones: a, ones: b)
|
||||||
forward ones: operator-(ones: a)
|
forward ones: operator-(ones: a)
|
||||||
|
|
||||||
main()
|
main()
|
||||||
{
|
{
|
||||||
new ones: chksum = ones: 0xffffffff
|
new ones: chksum = ones: 0xffffffff
|
||||||
print "Input values in hexadecimal, zero to exit\n"
|
print "Input values in hexadecimal, zero to exit\n"
|
||||||
|
|
||||||
new ones: value
|
new ones: value
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
print ">> "
|
print ">> "
|
||||||
value = ones: getvalue(.base=16)
|
value = ones: getvalue(.base=16)
|
||||||
chksum = chksum + value
|
chksum = chksum + value
|
||||||
printf "Checksum = %x\n", chksum
|
printf "Checksum = %x\n", chksum
|
||||||
}
|
}
|
||||||
while (value)
|
while (value)
|
||||||
}
|
}
|
||||||
|
|
||||||
stock ones: operator+(ones: a, ones: b)
|
stock ones: operator+(ones: a, ones: b)
|
||||||
{
|
{
|
||||||
const ones: mask = ones: 0xffff /* word mask */
|
const ones: mask = ones: 0xffff /* word mask */
|
||||||
const ones: shift = ones: 16 /* word shift */
|
const ones: shift = ones: 16 /* word shift */
|
||||||
|
|
||||||
/* add low words and high words separately */
|
/* add low words and high words separately */
|
||||||
new ones: r1 = (a & mask) + (b & mask)
|
new ones: r1 = (a & mask) + (b & mask)
|
||||||
new ones: r2 = (a >>> shift) + (b >>> shift)
|
new ones: r2 = (a >>> shift) + (b >>> shift)
|
||||||
|
|
||||||
new ones: carry
|
new ones: carry
|
||||||
restart: /* code label (goto target) */
|
restart: /* code label (goto target) */
|
||||||
|
|
||||||
/* add carry of the new low word to the high word, then
|
/* add carry of the new low word to the high word, then
|
||||||
* strip it from the low word
|
* strip it from the low word
|
||||||
*/
|
*/
|
||||||
carry = (r1 >>> shift)
|
carry = (r1 >>> shift)
|
||||||
r2 += carry
|
r2 += carry
|
||||||
r1 &= mask
|
r1 &= mask
|
||||||
|
|
||||||
/* add the carry from the new high word back to the low
|
/* add the carry from the new high word back to the low
|
||||||
* word, then strip it from the high word
|
* word, then strip it from the high word
|
||||||
*/
|
*/
|
||||||
carry = (r2 >>> shift)
|
carry = (r2 >>> shift)
|
||||||
r1 += carry
|
r1 += carry
|
||||||
r2 &= mask
|
r2 &= mask
|
||||||
|
|
||||||
/* a carry from the high word injected back into the low
|
/* a carry from the high word injected back into the low
|
||||||
* word may cause the new low to overflow, so restart in
|
* word may cause the new low to overflow, so restart in
|
||||||
* that case
|
* that case
|
||||||
*/
|
*/
|
||||||
if (carry)
|
if (carry)
|
||||||
goto restart
|
goto restart
|
||||||
|
|
||||||
return (r2 << shift) | r1
|
return (r2 << shift) | r1
|
||||||
}
|
}
|
||||||
|
|
||||||
stock ones: operator-(ones: a)
|
stock ones: operator-(ones: a)
|
||||||
return (a == ones: 0xffffffff) ? a : ~a
|
return (a == ones: 0xffffffff) ? a : ~a
|
||||||
|
|
||||||
stock ones: operator-(ones: a, ones: b)
|
stock ones: operator-(ones: a, ones: b)
|
||||||
return a + -b
|
return a + -b
|
||||||
|
|
||||||
|
156
examples/queue.p
156
examples/queue.p
@ -1,78 +1,78 @@
|
|||||||
/* Priority queue (for simple text strings) */
|
/* Priority queue (for simple text strings) */
|
||||||
|
|
||||||
enum message
|
enum message
|
||||||
{
|
{
|
||||||
text[40 char],
|
text[40 char],
|
||||||
priority
|
priority
|
||||||
}
|
}
|
||||||
|
|
||||||
main()
|
main()
|
||||||
{
|
{
|
||||||
new msg[message]
|
new msg[message]
|
||||||
|
|
||||||
/* insert a few items (read from console input) */
|
/* insert a few items (read from console input) */
|
||||||
printf "Please insert a few messages and their priorities; \
|
printf "Please insert a few messages and their priorities; \
|
||||||
end with an empty string\n"
|
end with an empty string\n"
|
||||||
for ( ;; )
|
for ( ;; )
|
||||||
{
|
{
|
||||||
printf "Message: "
|
printf "Message: "
|
||||||
getstring .string = msg[text], .maxlength = 40, .pack = true
|
getstring .string = msg[text], .maxlength = 40, .pack = true
|
||||||
if (strlen(msg[text]) == 0)
|
if (strlen(msg[text]) == 0)
|
||||||
break
|
break
|
||||||
printf "Priority: "
|
printf "Priority: "
|
||||||
msg[priority] = getvalue()
|
msg[priority] = getvalue()
|
||||||
if (!insert(msg))
|
if (!insert(msg))
|
||||||
{
|
{
|
||||||
printf "Queue is full, cannot insert more items\n"
|
printf "Queue is full, cannot insert more items\n"
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* now print the messages extracted from the queue */
|
/* now print the messages extracted from the queue */
|
||||||
printf "\nContents of the queue:\n"
|
printf "\nContents of the queue:\n"
|
||||||
while (extract(msg))
|
while (extract(msg))
|
||||||
printf "[%d] %s\n", msg[priority], msg[text]
|
printf "[%d] %s\n", msg[priority], msg[text]
|
||||||
}
|
}
|
||||||
|
|
||||||
const queuesize = 10
|
const queuesize = 10
|
||||||
new queue[queuesize][message]
|
new queue[queuesize][message]
|
||||||
new queueitems = 0
|
new queueitems = 0
|
||||||
|
|
||||||
insert(const item[message])
|
insert(const item[message])
|
||||||
{
|
{
|
||||||
/* check if the queue can hold one more message */
|
/* check if the queue can hold one more message */
|
||||||
if (queueitems == queuesize)
|
if (queueitems == queuesize)
|
||||||
return false /* queue is full */
|
return false /* queue is full */
|
||||||
|
|
||||||
/* find the position to insert it to */
|
/* find the position to insert it to */
|
||||||
new pos = queueitems /* start at the bottom */
|
new pos = queueitems /* start at the bottom */
|
||||||
while (pos > 0 && item[priority] > queue[pos-1][priority])
|
while (pos > 0 && item[priority] > queue[pos-1][priority])
|
||||||
--pos /* higher priority: move up a slot */
|
--pos /* higher priority: move up a slot */
|
||||||
|
|
||||||
/* make place for the item at the insertion spot */
|
/* make place for the item at the insertion spot */
|
||||||
for (new i = queueitems; i > pos; --i)
|
for (new i = queueitems; i > pos; --i)
|
||||||
queue[i] = queue[i-1]
|
queue[i] = queue[i-1]
|
||||||
|
|
||||||
/* add the message to the correct slot */
|
/* add the message to the correct slot */
|
||||||
queue[pos] = item
|
queue[pos] = item
|
||||||
queueitems++
|
queueitems++
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
extract(item[message])
|
extract(item[message])
|
||||||
{
|
{
|
||||||
/* check whether the queue has one more message */
|
/* check whether the queue has one more message */
|
||||||
if (queueitems == 0)
|
if (queueitems == 0)
|
||||||
return false /* queue is empty */
|
return false /* queue is empty */
|
||||||
|
|
||||||
/* copy the topmost item */
|
/* copy the topmost item */
|
||||||
item = queue[0]
|
item = queue[0]
|
||||||
--queueitems
|
--queueitems
|
||||||
|
|
||||||
/* move the queue one position up */
|
/* move the queue one position up */
|
||||||
for (new i = 0; i < queueitems; ++i)
|
for (new i = 0; i < queueitems; ++i)
|
||||||
queue[i] = queue[i+1]
|
queue[i] = queue[i+1]
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
@ -1 +1 @@
|
|||||||
new s[]="new s[]=%c%s%c; main() printf s,34,s,34"; main() printf s,34,s,34
|
new s[]="new s[]=%c%s%c; main() printf s,34,s,34"; main() printf s,34,s,34
|
||||||
|
@ -1,39 +1,39 @@
|
|||||||
main()
|
main()
|
||||||
{
|
{
|
||||||
new HandOfCards[10]
|
new HandOfCards[10]
|
||||||
FillRandom(HandOfCards, 52)
|
FillRandom(HandOfCards, 52)
|
||||||
|
|
||||||
print "A draw of 10 numbers from a range of 0 to 51 \
|
print "A draw of 10 numbers from a range of 0 to 51 \
|
||||||
(inclusive) without duplicates:\n"
|
(inclusive) without duplicates:\n"
|
||||||
for (new i = 0; i < sizeof HandOfCards; i++)
|
for (new i = 0; i < sizeof HandOfCards; i++)
|
||||||
printf "%d ", HandOfCards[i]
|
printf "%d ", HandOfCards[i]
|
||||||
}
|
}
|
||||||
|
|
||||||
FillRandom(Series[], Range, Number = sizeof Series)
|
FillRandom(Series[], Range, Number = sizeof Series)
|
||||||
{
|
{
|
||||||
assert Range >= Number /* cannot select 50 values
|
assert Range >= Number /* cannot select 50 values
|
||||||
* without duplicates in the
|
* without duplicates in the
|
||||||
* range 0..40, for example */
|
* range 0..40, for example */
|
||||||
new Index = 0
|
new Index = 0
|
||||||
for (new Seq = Range - Number; Seq < Range; Seq++)
|
for (new Seq = Range - Number; Seq < Range; Seq++)
|
||||||
{
|
{
|
||||||
new Val = random(Seq + 1)
|
new Val = random(Seq + 1)
|
||||||
new Pos = InSeries(Series, Val, Index)
|
new Pos = InSeries(Series, Val, Index)
|
||||||
if (Pos >= 0)
|
if (Pos >= 0)
|
||||||
{
|
{
|
||||||
Series[Index] = Series[Pos]
|
Series[Index] = Series[Pos]
|
||||||
Series[Pos] = Seq
|
Series[Pos] = Seq
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Series[Index] = Val
|
Series[Index] = Val
|
||||||
Index++
|
Index++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
InSeries(Series[], Value, Top = sizeof Series)
|
InSeries(Series[], Value, Top = sizeof Series)
|
||||||
{
|
{
|
||||||
for (new i = 0; i < Top; i++)
|
for (new i = 0; i < Top; i++)
|
||||||
if (Series[i] == Value)
|
if (Series[i] == Value)
|
||||||
return i
|
return i
|
||||||
return -1
|
return -1
|
||||||
}
|
}
|
||||||
|
@ -1,25 +1,25 @@
|
|||||||
#include <file>
|
#include <file>
|
||||||
|
|
||||||
main()
|
main()
|
||||||
{
|
{
|
||||||
/* ask for a filename */
|
/* ask for a filename */
|
||||||
print "Please enter a filename: "
|
print "Please enter a filename: "
|
||||||
new filename[128 char]
|
new filename[128 char]
|
||||||
getstring filename, .pack=true
|
getstring filename, .pack=true
|
||||||
|
|
||||||
/* try to open the file */
|
/* try to open the file */
|
||||||
new File: file = fopen(filename, io_read)
|
new File: file = fopen(filename, io_read)
|
||||||
if (!file)
|
if (!file)
|
||||||
{
|
{
|
||||||
printf "The file '%s' cannot be opened for reading\n", filename
|
printf "The file '%s' cannot be opened for reading\n", filename
|
||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
|
|
||||||
/* dump the file onto the console */
|
/* dump the file onto the console */
|
||||||
new line[200]
|
new line[200]
|
||||||
while (fread(file, line))
|
while (fread(file, line))
|
||||||
print line, .highlight=true
|
print line, .highlight=true
|
||||||
|
|
||||||
/* done */
|
/* done */
|
||||||
fclose file
|
fclose file
|
||||||
}
|
}
|
||||||
|
@ -1,21 +1,21 @@
|
|||||||
/* Simple encryption, using ROT13 */
|
/* Simple encryption, using ROT13 */
|
||||||
|
|
||||||
main()
|
main()
|
||||||
{
|
{
|
||||||
printf "Please type the string to mangle: "
|
printf "Please type the string to mangle: "
|
||||||
|
|
||||||
new str[100]
|
new str[100]
|
||||||
getstring str, sizeof str
|
getstring str, sizeof str
|
||||||
rot13 str
|
rot13 str
|
||||||
|
|
||||||
printf "After mangling, the string is: \"%s\"\n", str
|
printf "After mangling, the string is: \"%s\"\n", str
|
||||||
}
|
}
|
||||||
|
|
||||||
rot13(string[])
|
rot13(string[])
|
||||||
{
|
{
|
||||||
for (new index = 0; string[index]; index++)
|
for (new index = 0; string[index]; index++)
|
||||||
if ('a' <= string[index] <= 'z')
|
if ('a' <= string[index] <= 'z')
|
||||||
string[index] = (string[index] - 'a' + 13) % 26 + 'a'
|
string[index] = (string[index] - 'a' + 13) % 26 + 'a'
|
||||||
else if ('A' <= string[index] <= 'Z')
|
else if ('A' <= string[index] <= 'Z')
|
||||||
string[index] = (string[index] - 'A' + 13) % 26 + 'A'
|
string[index] = (string[index] - 'A' + 13) % 26 + 'A'
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
/* a simple RPN calculator */
|
/* a simple RPN calculator */
|
||||||
#include strtok
|
#include strtok
|
||||||
#include stack
|
#include stack
|
||||||
#include rpnparse
|
#include rpnparse
|
||||||
|
|
||||||
main()
|
main()
|
||||||
{
|
{
|
||||||
print "Type an expression in Reverse Polish Notation: "
|
print "Type an expression in Reverse Polish Notation: "
|
||||||
new string[100]
|
new string[100]
|
||||||
getstring string, sizeof string
|
getstring string, sizeof string
|
||||||
rpncalc string
|
rpncalc string
|
||||||
}
|
}
|
||||||
|
@ -1,71 +1,71 @@
|
|||||||
/* main rpn parser and lexical analysis, part of the RPN calculator */
|
/* main rpn parser and lexical analysis, part of the RPN calculator */
|
||||||
#include <rational>
|
#include <rational>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
enum token
|
enum token
|
||||||
{
|
{
|
||||||
t_type, /* operator or token type */
|
t_type, /* operator or token type */
|
||||||
Rational: t_value, /* value, if t_type is "Number" */
|
Rational: t_value, /* value, if t_type is "Number" */
|
||||||
t_word[20], /* raw string */
|
t_word[20], /* raw string */
|
||||||
}
|
}
|
||||||
|
|
||||||
const Number = '0'
|
const Number = '0'
|
||||||
const EndOfExpr = '#'
|
const EndOfExpr = '#'
|
||||||
|
|
||||||
rpncalc(const string[])
|
rpncalc(const string[])
|
||||||
{
|
{
|
||||||
new index
|
new index
|
||||||
new field[token]
|
new field[token]
|
||||||
for ( ;; )
|
for ( ;; )
|
||||||
{
|
{
|
||||||
field = gettoken(string, index)
|
field = gettoken(string, index)
|
||||||
switch (field[t_type])
|
switch (field[t_type])
|
||||||
{
|
{
|
||||||
case Number:
|
case Number:
|
||||||
push field[t_value]
|
push field[t_value]
|
||||||
case '+':
|
case '+':
|
||||||
push pop() + pop()
|
push pop() + pop()
|
||||||
case '-':
|
case '-':
|
||||||
push - pop() + pop()
|
push - pop() + pop()
|
||||||
case '*':
|
case '*':
|
||||||
push pop() * pop()
|
push pop() * pop()
|
||||||
case '/', ':':
|
case '/', ':':
|
||||||
push 1.0 / pop() * pop()
|
push 1.0 / pop() * pop()
|
||||||
case EndOfExpr:
|
case EndOfExpr:
|
||||||
break /* exit "for" loop */
|
break /* exit "for" loop */
|
||||||
default:
|
default:
|
||||||
printf "Unknown operator '%s'\n", field[t_word]
|
printf "Unknown operator '%s'\n", field[t_word]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
printf "Result = %r\n", pop()
|
printf "Result = %r\n", pop()
|
||||||
if (clearstack())
|
if (clearstack())
|
||||||
print "Stack not empty\n", red
|
print "Stack not empty\n", red
|
||||||
}
|
}
|
||||||
|
|
||||||
gettoken(const string[], &index)
|
gettoken(const string[], &index)
|
||||||
{
|
{
|
||||||
/* first get the next "word" from the string */
|
/* first get the next "word" from the string */
|
||||||
new word[20]
|
new word[20]
|
||||||
word = strtok(string, index)
|
word = strtok(string, index)
|
||||||
|
|
||||||
/* then parse it */
|
/* then parse it */
|
||||||
new field[token]
|
new field[token]
|
||||||
field[t_word] = word
|
field[t_word] = word
|
||||||
if (strlen(word) == 0)
|
if (strlen(word) == 0)
|
||||||
{
|
{
|
||||||
field[t_type] = EndOfExpr /* special "stop" symbol */
|
field[t_type] = EndOfExpr /* special "stop" symbol */
|
||||||
field[t_value] = 0
|
field[t_value] = 0
|
||||||
}
|
}
|
||||||
else if ('0' <= word[0] <= '9')
|
else if ('0' <= word[0] <= '9')
|
||||||
{
|
{
|
||||||
field[t_type] = Number
|
field[t_type] = Number
|
||||||
field[t_value] = rationalstr(word)
|
field[t_value] = rationalstr(word)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
field[t_type] = word[0]
|
field[t_type] = word[0]
|
||||||
field[t_value] = 0
|
field[t_value] = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
return field
|
return field
|
||||||
}
|
}
|
||||||
|
@ -1,46 +1,46 @@
|
|||||||
/* Set operations, using bit arithmetic */
|
/* Set operations, using bit arithmetic */
|
||||||
|
|
||||||
main()
|
main()
|
||||||
{
|
{
|
||||||
enum (<<= 1) { A = 1, B, C, D, E, F, G }
|
enum (<<= 1) { A = 1, B, C, D, E, F, G }
|
||||||
new nextstep[] =
|
new nextstep[] =
|
||||||
{ C | E, /* A can reach C and E */
|
{ C | E, /* A can reach C and E */
|
||||||
D | E, /* B " " D and E */
|
D | E, /* B " " D and E */
|
||||||
G, /* C " " G */
|
G, /* C " " G */
|
||||||
C | F, /* D " " C and F */
|
C | F, /* D " " C and F */
|
||||||
0, /* E " " none */
|
0, /* E " " none */
|
||||||
0, /* F " " none */
|
0, /* F " " none */
|
||||||
E | F, /* G " " E and F */
|
E | F, /* G " " E and F */
|
||||||
}
|
}
|
||||||
#pragma unused A, B
|
#pragma unused A, B
|
||||||
|
|
||||||
print "The departure point: "
|
print "The departure point: "
|
||||||
new start = clamp( .value = toupper(getchar()) - 'A',
|
new start = clamp( .value = toupper(getchar()) - 'A',
|
||||||
.min = 0,
|
.min = 0,
|
||||||
.max = sizeof nextstep - 1
|
.max = sizeof nextstep - 1
|
||||||
)
|
)
|
||||||
|
|
||||||
print "\nThe number of steps: "
|
print "\nThe number of steps: "
|
||||||
new steps = getvalue()
|
new steps = getvalue()
|
||||||
|
|
||||||
/* make the set */
|
/* make the set */
|
||||||
new result = findtargets(start, steps, nextstep)
|
new result = findtargets(start, steps, nextstep)
|
||||||
printf "The points in range of %c in %d steps: ", start + 'A', steps
|
printf "The points in range of %c in %d steps: ", start + 'A', steps
|
||||||
for (new i = 0; i < sizeof nextstep; i++)
|
for (new i = 0; i < sizeof nextstep; i++)
|
||||||
if (result & 1 << i)
|
if (result & 1 << i)
|
||||||
printf "%c ", i + 'A'
|
printf "%c ", i + 'A'
|
||||||
}
|
}
|
||||||
|
|
||||||
findtargets(start, steps, nextstep[], numpoints = sizeof nextstep)
|
findtargets(start, steps, nextstep[], numpoints = sizeof nextstep)
|
||||||
{
|
{
|
||||||
new result = 0
|
new result = 0
|
||||||
new addedpoints = nextstep[start]
|
new addedpoints = nextstep[start]
|
||||||
while (steps-- > 0 && result != addedpoints)
|
while (steps-- > 0 && result != addedpoints)
|
||||||
{
|
{
|
||||||
result = addedpoints
|
result = addedpoints
|
||||||
for (new i = 0; i < numpoints; i++)
|
for (new i = 0; i < numpoints; i++)
|
||||||
if (result & 1 << i)
|
if (result & 1 << i)
|
||||||
addedpoints |= nextstep[i]
|
addedpoints |= nextstep[i]
|
||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
/* Print all primes below 100, using the "Sieve of Eratosthenes" */
|
/* Print all primes below 100, using the "Sieve of Eratosthenes" */
|
||||||
|
|
||||||
main()
|
main()
|
||||||
{
|
{
|
||||||
const max_primes = 100
|
const max_primes = 100
|
||||||
new series[max_primes] = { true, ... }
|
new series[max_primes] = { true, ... }
|
||||||
|
|
||||||
for (new i = 2; i < max_primes; ++i)
|
for (new i = 2; i < max_primes; ++i)
|
||||||
if (series[i])
|
if (series[i])
|
||||||
{
|
{
|
||||||
printf "%d ", i
|
printf "%d ", i
|
||||||
/* filter all multiples of this "prime" from the list */
|
/* filter all multiples of this "prime" from the list */
|
||||||
for (new j = 2 * i; j < max_primes; j += i)
|
for (new j = 2 * i; j < max_primes; j += i)
|
||||||
series[j] = false
|
series[j] = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,26 +1,26 @@
|
|||||||
/* stack functions, part of the RPN calculator */
|
/* stack functions, part of the RPN calculator */
|
||||||
#include <rational>
|
#include <rational>
|
||||||
|
|
||||||
static Rational: stack[50]
|
static Rational: stack[50]
|
||||||
static stackidx = 0
|
static stackidx = 0
|
||||||
|
|
||||||
push(Rational: value)
|
push(Rational: value)
|
||||||
{
|
{
|
||||||
assert stackidx < sizeof stack
|
assert stackidx < sizeof stack
|
||||||
stack[stackidx++] = value
|
stack[stackidx++] = value
|
||||||
}
|
}
|
||||||
|
|
||||||
Rational: pop()
|
Rational: pop()
|
||||||
{
|
{
|
||||||
assert stackidx > 0
|
assert stackidx > 0
|
||||||
return stack[--stackidx]
|
return stack[--stackidx]
|
||||||
}
|
}
|
||||||
|
|
||||||
clearstack()
|
clearstack()
|
||||||
{
|
{
|
||||||
assert stackidx >= 0
|
assert stackidx >= 0
|
||||||
if (stackidx == 0)
|
if (stackidx == 0)
|
||||||
return false
|
return false
|
||||||
stackidx = 0
|
stackidx = 0
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
@ -1,25 +1,25 @@
|
|||||||
/* extract words from a string (words are separated by white space) */
|
/* extract words from a string (words are separated by white space) */
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
strtok(const string[], &index)
|
strtok(const string[], &index)
|
||||||
{
|
{
|
||||||
new length = strlen(string)
|
new length = strlen(string)
|
||||||
|
|
||||||
/* skip leading white space */
|
/* skip leading white space */
|
||||||
while (index < length && string[index] <= ' ')
|
while (index < length && string[index] <= ' ')
|
||||||
index++
|
index++
|
||||||
|
|
||||||
/* store the word letter for letter */
|
/* store the word letter for letter */
|
||||||
new offset = index /* save start position of token */
|
new offset = index /* save start position of token */
|
||||||
new result[20] /* string to store the word in */
|
new result[20] /* string to store the word in */
|
||||||
while (index < length
|
while (index < length
|
||||||
&& string[index] > ' '
|
&& string[index] > ' '
|
||||||
&& index - offset < sizeof result - 1)
|
&& index - offset < sizeof result - 1)
|
||||||
{
|
{
|
||||||
result[index - offset] = string[index]
|
result[index - offset] = string[index]
|
||||||
index++
|
index++
|
||||||
}
|
}
|
||||||
result[index - offset] = EOS /* zero-terminate the string */
|
result[index - offset] = EOS /* zero-terminate the string */
|
||||||
|
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
@ -1,35 +1,35 @@
|
|||||||
/* traffic light synchronizer, using states in an event-driven model */
|
/* traffic light synchronizer, using states in an event-driven model */
|
||||||
#include <time>
|
#include <time>
|
||||||
|
|
||||||
main() state green_wait
|
main() state green_wait
|
||||||
|
|
||||||
@keypressed(key) <green_wait> state yellow_wait
|
@keypressed(key) <green_wait> state yellow_wait
|
||||||
@keypressed(key) <red_walk, red_wait> state red_walk
|
@keypressed(key) <red_walk, red_wait> state red_walk
|
||||||
@keypressed(key) <> {} /* fallback */
|
@keypressed(key) <> {} /* fallback */
|
||||||
|
|
||||||
@timer() <yellow_wait> state red_walk
|
@timer() <yellow_wait> state red_walk
|
||||||
@timer() <red_walk> state red_wait
|
@timer() <red_walk> state red_wait
|
||||||
@timer() <red_wait> state green_wait
|
@timer() <red_wait> state green_wait
|
||||||
@timer() <> {} /* fallback */
|
@timer() <> {} /* fallback */
|
||||||
|
|
||||||
|
|
||||||
entry() <green_wait>
|
entry() <green_wait>
|
||||||
print "Green / Don't walk\n"
|
print "Green / Don't walk\n"
|
||||||
|
|
||||||
entry() <yellow_wait>
|
entry() <yellow_wait>
|
||||||
{
|
{
|
||||||
print "Yellow / Don't walk\n"
|
print "Yellow / Don't walk\n"
|
||||||
settimer 2000
|
settimer 2000
|
||||||
}
|
}
|
||||||
|
|
||||||
entry() <red_walk>
|
entry() <red_walk>
|
||||||
{
|
{
|
||||||
print "Red / Walk\n"
|
print "Red / Walk\n"
|
||||||
settimer 5000
|
settimer 5000
|
||||||
}
|
}
|
||||||
|
|
||||||
entry() <red_wait>
|
entry() <red_wait>
|
||||||
{
|
{
|
||||||
print "Red / Don't walk\n"
|
print "Red / Don't walk\n"
|
||||||
settimer 2000
|
settimer 2000
|
||||||
}
|
}
|
||||||
|
@ -1,83 +1,83 @@
|
|||||||
/* a more realistic traffic light synchronizer, including an
|
/* a more realistic traffic light synchronizer, including an
|
||||||
* "override" for emergency vehicles
|
* "override" for emergency vehicles
|
||||||
*/
|
*/
|
||||||
#include <time>
|
#include <time>
|
||||||
|
|
||||||
main()
|
main()
|
||||||
state green_wait_interim
|
state green_wait_interim
|
||||||
|
|
||||||
new bool: button_memo <red_wait, green_wait_interim, yellow_wait>
|
new bool: button_memo <red_wait, green_wait_interim, yellow_wait>
|
||||||
|
|
||||||
@keypressed(key)
|
@keypressed(key)
|
||||||
{
|
{
|
||||||
switch (key)
|
switch (key)
|
||||||
{
|
{
|
||||||
case ' ': button_press
|
case ' ': button_press
|
||||||
case '*': mirt_detect
|
case '*': mirt_detect
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
button_press() <green_wait>
|
button_press() <green_wait>
|
||||||
state yellow_wait
|
state yellow_wait
|
||||||
|
|
||||||
button_press() <red_wait, green_wait_interim>
|
button_press() <red_wait, green_wait_interim>
|
||||||
button_memo = true
|
button_memo = true
|
||||||
|
|
||||||
button_press() <> /* fallback */
|
button_press() <> /* fallback */
|
||||||
{}
|
{}
|
||||||
|
|
||||||
mirt_detect()
|
mirt_detect()
|
||||||
state mirt_override
|
state mirt_override
|
||||||
|
|
||||||
@timer() <yellow_wait>
|
@timer() <yellow_wait>
|
||||||
state red_walk
|
state red_walk
|
||||||
|
|
||||||
@timer() <red_walk>
|
@timer() <red_walk>
|
||||||
state red_wait
|
state red_wait
|
||||||
|
|
||||||
@timer() <red_wait>
|
@timer() <red_wait>
|
||||||
state green_wait_interim
|
state green_wait_interim
|
||||||
|
|
||||||
@timer() <green_wait_interim>
|
@timer() <green_wait_interim>
|
||||||
{
|
{
|
||||||
state (!button_memo) green_wait
|
state (!button_memo) green_wait
|
||||||
state (button_memo) yellow_wait
|
state (button_memo) yellow_wait
|
||||||
}
|
}
|
||||||
|
|
||||||
@timer() <mirt_override>
|
@timer() <mirt_override>
|
||||||
state green_wait
|
state green_wait
|
||||||
|
|
||||||
@timer() <> /* fallback */
|
@timer() <> /* fallback */
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
entry() <green_wait_interim>
|
entry() <green_wait_interim>
|
||||||
{
|
{
|
||||||
print "Green / Don't walk\n"
|
print "Green / Don't walk\n"
|
||||||
settimer 5000
|
settimer 5000
|
||||||
}
|
}
|
||||||
|
|
||||||
entry() <yellow_wait>
|
entry() <yellow_wait>
|
||||||
{
|
{
|
||||||
print "Yellow / Don't walk\n"
|
print "Yellow / Don't walk\n"
|
||||||
button_memo = false
|
button_memo = false
|
||||||
settimer 2000
|
settimer 2000
|
||||||
}
|
}
|
||||||
|
|
||||||
entry() <red_walk>
|
entry() <red_walk>
|
||||||
{
|
{
|
||||||
print "Red / Walk\n"
|
print "Red / Walk\n"
|
||||||
settimer 5000
|
settimer 5000
|
||||||
}
|
}
|
||||||
|
|
||||||
entry() <red_wait>
|
entry() <red_wait>
|
||||||
{
|
{
|
||||||
print "Red / Don't walk\n"
|
print "Red / Don't walk\n"
|
||||||
settimer 2000
|
settimer 2000
|
||||||
}
|
}
|
||||||
|
|
||||||
entry() <mirt_override>
|
entry() <mirt_override>
|
||||||
{
|
{
|
||||||
print "Green / Don't walk\n"
|
print "Green / Don't walk\n"
|
||||||
settimer 5000
|
settimer 5000
|
||||||
}
|
}
|
||||||
|
@ -1,26 +1,26 @@
|
|||||||
@keypressed(key)
|
@keypressed(key)
|
||||||
{
|
{
|
||||||
/* get current position */
|
/* get current position */
|
||||||
new x, y
|
new x, y
|
||||||
wherexy x, y
|
wherexy x, y
|
||||||
|
|
||||||
/* determine how the update the current position */
|
/* determine how the update the current position */
|
||||||
switch (key)
|
switch (key)
|
||||||
{
|
{
|
||||||
case 'u': y-- /* up */
|
case 'u': y-- /* up */
|
||||||
case 'd': y++ /* down */
|
case 'd': y++ /* down */
|
||||||
case 'l': x-- /* left */
|
case 'l': x-- /* left */
|
||||||
case 'r': x++ /* right */
|
case 'r': x++ /* right */
|
||||||
case '\e': exit /* Escape = exit */
|
case '\e': exit /* Escape = exit */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* adjust the cursor position and draw something */
|
/* adjust the cursor position and draw something */
|
||||||
moveturtle x, y
|
moveturtle x, y
|
||||||
}
|
}
|
||||||
|
|
||||||
moveturtle(x, y)
|
moveturtle(x, y)
|
||||||
{
|
{
|
||||||
gotoxy x, y
|
gotoxy x, y
|
||||||
print '*'
|
print '*'
|
||||||
gotoxy x, y
|
gotoxy x, y
|
||||||
}
|
}
|
||||||
|
@ -1,46 +1,46 @@
|
|||||||
/* word count: count words on a string that the user types */
|
/* word count: count words on a string that the user types */
|
||||||
|
|
||||||
main()
|
main()
|
||||||
{
|
{
|
||||||
print "Please type a string: "
|
print "Please type a string: "
|
||||||
new string[100]
|
new string[100]
|
||||||
getstring string, sizeof string
|
getstring string, sizeof string
|
||||||
|
|
||||||
new count = 0
|
new count = 0
|
||||||
|
|
||||||
new word[20]
|
new word[20]
|
||||||
new index
|
new index
|
||||||
for ( ;; )
|
for ( ;; )
|
||||||
{
|
{
|
||||||
word = strtok(string, index)
|
word = strtok(string, index)
|
||||||
if (strlen(word) == 0)
|
if (strlen(word) == 0)
|
||||||
break
|
break
|
||||||
count++
|
count++
|
||||||
printf "Word %d: '%s'\n", count, word
|
printf "Word %d: '%s'\n", count, word
|
||||||
}
|
}
|
||||||
|
|
||||||
printf "\nNumber of words: %d\n", count
|
printf "\nNumber of words: %d\n", count
|
||||||
}
|
}
|
||||||
|
|
||||||
strtok(const string[], &index)
|
strtok(const string[], &index)
|
||||||
{
|
{
|
||||||
new length = strlen(string)
|
new length = strlen(string)
|
||||||
|
|
||||||
/* skip leading white space */
|
/* skip leading white space */
|
||||||
while (index < length && string[index] <= ' ')
|
while (index < length && string[index] <= ' ')
|
||||||
index++
|
index++
|
||||||
|
|
||||||
/* store the word letter for letter */
|
/* store the word letter for letter */
|
||||||
new offset = index /* save start position of token */
|
new offset = index /* save start position of token */
|
||||||
new result[20] /* string to store the word in */
|
new result[20] /* string to store the word in */
|
||||||
while (index < length
|
while (index < length
|
||||||
&& string[index] > ' '
|
&& string[index] > ' '
|
||||||
&& index - offset < sizeof result - 1)
|
&& index - offset < sizeof result - 1)
|
||||||
{
|
{
|
||||||
result[index - offset] = string[index]
|
result[index - offset] = string[index]
|
||||||
index++
|
index++
|
||||||
}
|
}
|
||||||
result[index - offset] = EOS /* zero-terminate the string */
|
result[index - offset] = EOS /* zero-terminate the string */
|
||||||
|
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
@ -1,164 +1,164 @@
|
|||||||
/**
|
/**
|
||||||
* This program illustrates Zeller's congruence algorithm to calculate
|
* This program illustrates Zeller's congruence algorithm to calculate
|
||||||
* the day of the week given a date.
|
* the day of the week given a date.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <summary>
|
* <summary>
|
||||||
* The main program: asks the user to input a date and prints on
|
* The main program: asks the user to input a date and prints on
|
||||||
* what day of the week that date falls.
|
* what day of the week that date falls.
|
||||||
* </summary>
|
* </summary>
|
||||||
*/
|
*/
|
||||||
main()
|
main()
|
||||||
{
|
{
|
||||||
new day, month, year
|
new day, month, year
|
||||||
if (readdate(day, month, year))
|
if (readdate(day, month, year))
|
||||||
{
|
{
|
||||||
new wkday = weekday(day, month, year)
|
new wkday = weekday(day, month, year)
|
||||||
printf "The date %d-%d-%d falls on a ", day, month, year
|
printf "The date %d-%d-%d falls on a ", day, month, year
|
||||||
switch (wkday)
|
switch (wkday)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
print "Saturday"
|
print "Saturday"
|
||||||
case 1:
|
case 1:
|
||||||
print "Sunday"
|
print "Sunday"
|
||||||
case 2:
|
case 2:
|
||||||
print "Monday"
|
print "Monday"
|
||||||
case 3:
|
case 3:
|
||||||
print "Tuesday"
|
print "Tuesday"
|
||||||
case 4:
|
case 4:
|
||||||
print "Wednesday"
|
print "Wednesday"
|
||||||
case 5:
|
case 5:
|
||||||
print "Thursday"
|
print "Thursday"
|
||||||
case 6:
|
case 6:
|
||||||
print "Friday"
|
print "Friday"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
print "Invalid date"
|
print "Invalid date"
|
||||||
|
|
||||||
print "\n"
|
print "\n"
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <summary>
|
* <summary>
|
||||||
* The core function of Zeller's congruence algorithm. The function
|
* The core function of Zeller's congruence algorithm. The function
|
||||||
* works for the Gregorian calender.
|
* works for the Gregorian calender.
|
||||||
* </summary>
|
* </summary>
|
||||||
*
|
*
|
||||||
* <param name="day">
|
* <param name="day">
|
||||||
* The day in the month, a value between 1 and 31.
|
* The day in the month, a value between 1 and 31.
|
||||||
* </param>
|
* </param>
|
||||||
* <param name="month">
|
* <param name="month">
|
||||||
* The month: a value between 1 and 12.
|
* The month: a value between 1 and 12.
|
||||||
* </param>
|
* </param>
|
||||||
* <param name="year">
|
* <param name="year">
|
||||||
* The year in four digits.
|
* The year in four digits.
|
||||||
* </param>
|
* </param>
|
||||||
*
|
*
|
||||||
* <returns>
|
* <returns>
|
||||||
* The day of the week, where 0 is Saturday and 6 is Friday.
|
* The day of the week, where 0 is Saturday and 6 is Friday.
|
||||||
* </returns>
|
* </returns>
|
||||||
*
|
*
|
||||||
* <remarks>
|
* <remarks>
|
||||||
* This function does not check the validity of the date; when the
|
* This function does not check the validity of the date; when the
|
||||||
* date in the parameters is invalid, the returned "day of the week"
|
* date in the parameters is invalid, the returned "day of the week"
|
||||||
* will hold an incorrect value.
|
* will hold an incorrect value.
|
||||||
* <p/>
|
* <p/>
|
||||||
* This equation fails in many programming languages, notably most
|
* This equation fails in many programming languages, notably most
|
||||||
* implementations of C, C++ and Pascal, because these languages have
|
* implementations of C, C++ and Pascal, because these languages have
|
||||||
* a loosely defined "remainder" operator. Pawn, on the other hand,
|
* a loosely defined "remainder" operator. Pawn, on the other hand,
|
||||||
* provides the true modulus operator, as defined in mathematical
|
* provides the true modulus operator, as defined in mathematical
|
||||||
* theory and as was intended by Zeller.
|
* theory and as was intended by Zeller.
|
||||||
* </remarks>
|
* </remarks>
|
||||||
*/
|
*/
|
||||||
weekday(day, month, year)
|
weekday(day, month, year)
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* <remarks>
|
* <remarks>
|
||||||
* For Zeller's congruence algorithm, the months January and
|
* For Zeller's congruence algorithm, the months January and
|
||||||
* February are the 13th and 14th month of the <em>preceding</em>
|
* February are the 13th and 14th month of the <em>preceding</em>
|
||||||
* year. The idea is that the "difficult month" February (which
|
* year. The idea is that the "difficult month" February (which
|
||||||
* has either 28 or 29 days) is moved to the end of the year.
|
* has either 28 or 29 days) is moved to the end of the year.
|
||||||
* </remarks>
|
* </remarks>
|
||||||
*/
|
*/
|
||||||
if (month <= 2)
|
if (month <= 2)
|
||||||
month += 12, --year
|
month += 12, --year
|
||||||
|
|
||||||
new j = year % 100
|
new j = year % 100
|
||||||
new e = year / 100
|
new e = year / 100
|
||||||
return (day + (month+1)*26/10 + j + j/4 + e/4 - 2*e) % 7
|
return (day + (month+1)*26/10 + j + j/4 + e/4 - 2*e) % 7
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <summary>
|
* <summary>
|
||||||
* Reads a date and stores it in three separate fields. tata
|
* Reads a date and stores it in three separate fields. tata
|
||||||
* </summary>
|
* </summary>
|
||||||
*
|
*
|
||||||
* <param name="day">
|
* <param name="day">
|
||||||
* Will hold the day number upon return.
|
* Will hold the day number upon return.
|
||||||
* </param>
|
* </param>
|
||||||
* <param name="month">
|
* <param name="month">
|
||||||
* Will hold the month number upon return.
|
* Will hold the month number upon return.
|
||||||
* </param>
|
* </param>
|
||||||
* <param name="year">
|
* <param name="year">
|
||||||
* Will hold the year number upon return.
|
* Will hold the year number upon return.
|
||||||
* </param>
|
* </param>
|
||||||
*
|
*
|
||||||
* <returns>
|
* <returns>
|
||||||
* <em>true</em> if the date is valid, <em>false</em> otherwise;
|
* <em>true</em> if the date is valid, <em>false</em> otherwise;
|
||||||
* if the function returns <em>false</em>, the values of
|
* if the function returns <em>false</em>, the values of
|
||||||
* <paramref name="day"/>, <paramref name="month"/> and
|
* <paramref name="day"/>, <paramref name="month"/> and
|
||||||
* <paramref name="year"/> cannot be relied upon.
|
* <paramref name="year"/> cannot be relied upon.
|
||||||
* </returns>
|
* </returns>
|
||||||
*/
|
*/
|
||||||
bool: readdate(&day, &month, &year)
|
bool: readdate(&day, &month, &year)
|
||||||
{
|
{
|
||||||
print "Give a date (dd-mm-yyyy): "
|
print "Give a date (dd-mm-yyyy): "
|
||||||
day = getvalue(_,'-','/')
|
day = getvalue(_,'-','/')
|
||||||
month = getvalue(_,'-','/')
|
month = getvalue(_,'-','/')
|
||||||
year = getvalue()
|
year = getvalue()
|
||||||
return 1 <= month <= 12 && 1 <= day <= daysinmonth(month,year)
|
return 1 <= month <= 12 && 1 <= day <= daysinmonth(month,year)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <summary>
|
* <summary>
|
||||||
* Returns whether a year is a leap year.
|
* Returns whether a year is a leap year.
|
||||||
* </summary>
|
* </summary>
|
||||||
*
|
*
|
||||||
* <param name="year">
|
* <param name="year">
|
||||||
* The year in 4 digits.
|
* The year in 4 digits.
|
||||||
* </param>
|
* </param>
|
||||||
*
|
*
|
||||||
* <remarks>
|
* <remarks>
|
||||||
* A year is a leap year:
|
* A year is a leap year:
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li> if it is divisable by 4, </li>
|
* <li> if it is divisable by 4, </li>
|
||||||
* <li> but <strong>not</strong> if it is divisable by 100, </li>
|
* <li> but <strong>not</strong> if it is divisable by 100, </li>
|
||||||
* <li> but it <strong>is</strong> it is divisable by 400. </li>
|
* <li> but it <strong>is</strong> it is divisable by 400. </li>
|
||||||
* </ul>
|
* </ul>
|
||||||
* </remarks>
|
* </remarks>
|
||||||
*/
|
*/
|
||||||
bool: isleapyear(year)
|
bool: isleapyear(year)
|
||||||
return year % 400 == 0 || year % 100 != 0 && year % 4 == 0
|
return year % 400 == 0 || year % 100 != 0 && year % 4 == 0
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <summary>
|
* <summary>
|
||||||
* Returns the number of days in a month (the month is an integer
|
* Returns the number of days in a month (the month is an integer
|
||||||
* in the range 1 .. 12). One needs to pass in the year as well,
|
* in the range 1 .. 12). One needs to pass in the year as well,
|
||||||
* because the function takes leap years into account.
|
* because the function takes leap years into account.
|
||||||
* </summary>
|
* </summary>
|
||||||
*
|
*
|
||||||
* <param name="month">
|
* <param name="month">
|
||||||
* The month number, a value between 1 and 12.
|
* The month number, a value between 1 and 12.
|
||||||
* </param>
|
* </param>
|
||||||
* <param name="year">
|
* <param name="year">
|
||||||
* The year in 4 digits.
|
* The year in 4 digits.
|
||||||
* </param>
|
* </param>
|
||||||
*/
|
*/
|
||||||
daysinmonth(month, year)
|
daysinmonth(month, year)
|
||||||
{
|
{
|
||||||
static daylist[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}
|
static daylist[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}
|
||||||
assert 1 <= month <= 12
|
assert 1 <= month <= 12
|
||||||
return daylist[month-1] + _:(month == 2 && isleapyear(year))
|
return daylist[month-1] + _:(month == 2 && isleapyear(year))
|
||||||
}
|
}
|
||||||
|
@ -1,78 +1,78 @@
|
|||||||
/* An assortment of additional functions in the DLL version of the
|
/* An assortment of additional functions in the DLL version of the
|
||||||
* Abstract Machine.
|
* Abstract Machine.
|
||||||
*
|
*
|
||||||
* (c) Copyright 2000-2005, ITB CompuPhase
|
* (c) Copyright 2000-2005, ITB CompuPhase
|
||||||
* This file is provided as is (no warranties).
|
* This file is provided as is (no warranties).
|
||||||
*/
|
*/
|
||||||
#if defined _amxdll_included
|
#if defined _amxdll_included
|
||||||
#endinput
|
#endinput
|
||||||
#endif
|
#endif
|
||||||
#define _amxdll_included
|
#define _amxdll_included
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
Ok,
|
Ok,
|
||||||
Okcancel,
|
Okcancel,
|
||||||
okCancel,
|
okCancel,
|
||||||
Yesno,
|
Yesno,
|
||||||
yesNo,
|
yesNo,
|
||||||
Yesnocancel,
|
Yesnocancel,
|
||||||
yesNocancel,
|
yesNocancel,
|
||||||
yesnoCancel,
|
yesnoCancel,
|
||||||
}
|
}
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
noicon,
|
noicon,
|
||||||
information,
|
information,
|
||||||
exclamation,
|
exclamation,
|
||||||
question,
|
question,
|
||||||
stop
|
stop
|
||||||
}
|
}
|
||||||
native messagebox(const message[], const caption[], buttons=Ok, icons=noicon, timeout=0);
|
native messagebox(const message[], const caption[], buttons=Ok, icons=noicon, timeout=0);
|
||||||
|
|
||||||
/* Types:
|
/* Types:
|
||||||
* i = integer (16/32 bit)
|
* i = integer (16/32 bit)
|
||||||
* l = 32-bit integer
|
* l = 32-bit integer
|
||||||
* h = handle (16/32 bit)
|
* h = handle (16/32 bit)
|
||||||
* p = packed string
|
* p = packed string
|
||||||
* s = (unpacked) string
|
* s = (unpacked) string
|
||||||
* w = 16-bit unsigned integer
|
* w = 16-bit unsigned integer
|
||||||
* lower case = by value, upper case = by reference
|
* lower case = by value, upper case = by reference
|
||||||
*
|
*
|
||||||
* The types noted as "16/32 bit" are converted to 16-bit in Win16 environments
|
* The types noted as "16/32 bit" are converted to 16-bit in Win16 environments
|
||||||
* prior to the call to the DLL.
|
* prior to the call to the DLL.
|
||||||
*
|
*
|
||||||
* calldll() attaches "32" to the dll name if it cannot load the DLL as you
|
* calldll() attaches "32" to the dll name if it cannot load the DLL as you
|
||||||
* provide it. So it loads "user32" if you specify "user" and you are in Win32.
|
* provide it. So it loads "user32" if you specify "user" and you are in Win32.
|
||||||
* calldll() also appends a "A" to the function name if it cannot find the
|
* calldll() also appends a "A" to the function name if it cannot find the
|
||||||
* function as specified. So it call "GetWindowTextA" if you ask for
|
* function as specified. So it call "GetWindowTextA" if you ask for
|
||||||
* "GetWindowText". By this means, the interface is more compatible between
|
* "GetWindowText". By this means, the interface is more compatible between
|
||||||
* 16-bit and 32-bit platforms.
|
* 16-bit and 32-bit platforms.
|
||||||
*/
|
*/
|
||||||
native calldll(const dllname[], const function[], const typestr[]="", ...);
|
native calldll(const dllname[], const function[], const typestr[]="", ...);
|
||||||
|
|
||||||
native loaddll(const dllname[]);
|
native loaddll(const dllname[]);
|
||||||
native freedll(const dllname[]);
|
native freedll(const dllname[]);
|
||||||
|
|
||||||
native iswin32();
|
native iswin32();
|
||||||
|
|
||||||
native balloon(&Balloon:handle, text[]="", x=0, y=0, timeout=-1);
|
native balloon(&Balloon:handle, text[]="", x=0, y=0, timeout=-1);
|
||||||
native balloonfont(&Balloon:handle, const font[]="", height=16, weight=400, italic=0);
|
native balloonfont(&Balloon:handle, const font[]="", height=16, weight=400, italic=0);
|
||||||
|
|
||||||
stock wGetCursorPos(&x, &y)
|
stock wGetCursorPos(&x, &y)
|
||||||
/* Get the current position of the mouse cursor relative to the upper
|
/* Get the current position of the mouse cursor relative to the upper
|
||||||
* left corner of the screen
|
* left corner of the screen
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
new point[2]
|
new point[2]
|
||||||
calldll(!"user","GetCursorPos","I",point)
|
calldll(!"user","GetCursorPos","I",point)
|
||||||
if (!iswin32())
|
if (!iswin32())
|
||||||
{
|
{
|
||||||
point[1] = point[0] >> 16
|
point[1] = point[0] >> 16
|
||||||
point[0] &= 0xffff
|
point[0] &= 0xffff
|
||||||
}
|
}
|
||||||
x = point[0]
|
x = point[0]
|
||||||
y = point[1]
|
y = point[1]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
/* Script Arguments support functions
|
/* Script Arguments support functions
|
||||||
*
|
*
|
||||||
* (c) Copyright 2005, ITB CompuPhase
|
* (c) Copyright 2005, ITB CompuPhase
|
||||||
* This file is provided as is (no warranties).
|
* This file is provided as is (no warranties).
|
||||||
*/
|
*/
|
||||||
#if defined _args_included
|
#if defined _args_included
|
||||||
#endinput
|
#endinput
|
||||||
#endif
|
#endif
|
||||||
#define _args_included
|
#define _args_included
|
||||||
#pragma library Args
|
#pragma library Args
|
||||||
|
|
||||||
native argcount();
|
native argcount();
|
||||||
native bool: argindex(index, value[], maxlength = sizeof value, bool: pack = false);
|
native bool: argindex(index, value[], maxlength = sizeof value, bool: pack = false);
|
||||||
native bool: argstr(index = 0, const option[] = "", value[] = "", maxlength = sizeof value, bool: pack = false);
|
native bool: argstr(index = 0, const option[] = "", value[] = "", maxlength = sizeof value, bool: pack = false);
|
||||||
native bool: argvalue(index = 0, const option[] = "", &value = cellmin);
|
native bool: argvalue(index = 0, const option[] = "", &value = cellmin);
|
||||||
|
@ -1,37 +1,37 @@
|
|||||||
/* Console input/output functions
|
/* Console input/output functions
|
||||||
*
|
*
|
||||||
* (c) Copyright 1998-2005, ITB CompuPhase
|
* (c) Copyright 1998-2005, ITB CompuPhase
|
||||||
* This file is provided as is (no warranties).
|
* This file is provided as is (no warranties).
|
||||||
*/
|
*/
|
||||||
#if defined _console_included
|
#if defined _console_included
|
||||||
#endinput
|
#endinput
|
||||||
#endif
|
#endif
|
||||||
#define _console_included
|
#define _console_included
|
||||||
#pragma library Console
|
#pragma library Console
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
black, /* colours as per the ANSI Escape sequences, ISO 6429 */
|
black, /* colours as per the ANSI Escape sequences, ISO 6429 */
|
||||||
red,
|
red,
|
||||||
green,
|
green,
|
||||||
yellow,
|
yellow,
|
||||||
blue,
|
blue,
|
||||||
magenta,
|
magenta,
|
||||||
cyan,
|
cyan,
|
||||||
white,
|
white,
|
||||||
}
|
}
|
||||||
|
|
||||||
native getchar(echo=true);
|
native getchar(echo=true);
|
||||||
native getstring(string[], maxlength=sizeof string, bool:pack=false);
|
native getstring(string[], maxlength=sizeof string, bool:pack=false);
|
||||||
native getvalue(base=10, term=0x0d, ...); /* 0x0d == '\r' */
|
native getvalue(base=10, term=0x0d, ...); /* 0x0d == '\r' */
|
||||||
native print(const string[], foreground=-1, background=-1, highlight=-1);
|
native print(const string[], foreground=-1, background=-1, highlight=-1);
|
||||||
native printf(const format[], {Float,Fixed,_}:...);
|
native printf(const format[], {Float,Fixed,_}:...);
|
||||||
|
|
||||||
native console(columns, lines);
|
native console(columns, lines);
|
||||||
native clrscr(); /* also resets the cursor to (1,1) */
|
native clrscr(); /* also resets the cursor to (1,1) */
|
||||||
native clreol();
|
native clreol();
|
||||||
native gotoxy(x=1, y=1);
|
native gotoxy(x=1, y=1);
|
||||||
native wherexy(&x, &y);
|
native wherexy(&x, &y);
|
||||||
native setattr(foreground=-1, background=-1, highlight=-1);
|
native setattr(foreground=-1, background=-1, highlight=-1);
|
||||||
|
|
||||||
forward @keypressed(key);
|
forward @keypressed(key);
|
||||||
|
@ -1,34 +1,34 @@
|
|||||||
/* Core functions
|
/* Core functions
|
||||||
*
|
*
|
||||||
* (c) Copyright 1998-2005, ITB CompuPhase
|
* (c) Copyright 1998-2005, ITB CompuPhase
|
||||||
* This file is provided as is (no warranties).
|
* This file is provided as is (no warranties).
|
||||||
*/
|
*/
|
||||||
#if defined _core_included
|
#if defined _core_included
|
||||||
#endinput
|
#endinput
|
||||||
#endif
|
#endif
|
||||||
#define _core_included
|
#define _core_included
|
||||||
#pragma library Core
|
#pragma library Core
|
||||||
|
|
||||||
native heapspace();
|
native heapspace();
|
||||||
|
|
||||||
native funcidx(const name[]);
|
native funcidx(const name[]);
|
||||||
|
|
||||||
native numargs();
|
native numargs();
|
||||||
native getarg(arg, index=0);
|
native getarg(arg, index=0);
|
||||||
native setarg(arg, index=0, value);
|
native setarg(arg, index=0, value);
|
||||||
|
|
||||||
native tolower(c);
|
native tolower(c);
|
||||||
native toupper(c);
|
native toupper(c);
|
||||||
native swapchars(c);
|
native swapchars(c);
|
||||||
|
|
||||||
native random(max);
|
native random(max);
|
||||||
|
|
||||||
native min(value1, value2);
|
native min(value1, value2);
|
||||||
native max(value1, value2);
|
native max(value1, value2);
|
||||||
native clamp(value, min=cellmin, max=cellmax);
|
native clamp(value, min=cellmin, max=cellmax);
|
||||||
|
|
||||||
native getproperty(id=0, const name[]="", value=cellmin, string[]="");
|
native getproperty(id=0, const name[]="", value=cellmin, string[]="");
|
||||||
native setproperty(id=0, const name[]="", value=cellmin, const string[]="");
|
native setproperty(id=0, const name[]="", value=cellmin, const string[]="");
|
||||||
native deleteproperty(id=0, const name[]="", value=cellmin);
|
native deleteproperty(id=0, const name[]="", value=cellmin);
|
||||||
native existproperty(id=0, const name[]="", value=cellmin);
|
native existproperty(id=0, const name[]="", value=cellmin);
|
||||||
|
|
||||||
|
@ -1,18 +1,18 @@
|
|||||||
/* Datagram sending/receiving
|
/* Datagram sending/receiving
|
||||||
*
|
*
|
||||||
* (c) Copyright 2005, ITB CompuPhase
|
* (c) Copyright 2005, ITB CompuPhase
|
||||||
* This file is provided as is (no warranties).
|
* This file is provided as is (no warranties).
|
||||||
*/
|
*/
|
||||||
#if defined _datagram_included
|
#if defined _datagram_included
|
||||||
#endinput
|
#endinput
|
||||||
#endif
|
#endif
|
||||||
#define _datagram_included
|
#define _datagram_included
|
||||||
#pragma library DGram
|
#pragma library DGram
|
||||||
|
|
||||||
native sendstring(const message[], const destination[]="");
|
native sendstring(const message[], const destination[]="");
|
||||||
native sendpacket(const packet[], size, const destination[]="");
|
native sendpacket(const packet[], size, const destination[]="");
|
||||||
|
|
||||||
native listenport(port);
|
native listenport(port);
|
||||||
|
|
||||||
forward @receivestring(const message[], const source[]);
|
forward @receivestring(const message[], const source[]);
|
||||||
forward @receivepacket(const packet[], size, const source[]);
|
forward @receivepacket(const packet[], size, const source[]);
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
#include <core>
|
#include <core>
|
||||||
#include <console>
|
#include <console>
|
||||||
|
@ -1,44 +1,44 @@
|
|||||||
/* File input/output functions
|
/* File input/output functions
|
||||||
*
|
*
|
||||||
* (c) Copyright 2004-2005, ITB CompuPhase
|
* (c) Copyright 2004-2005, ITB CompuPhase
|
||||||
* This file is provided as is (no warranties).
|
* This file is provided as is (no warranties).
|
||||||
*/
|
*/
|
||||||
#if defined _file_included
|
#if defined _file_included
|
||||||
#endinput
|
#endinput
|
||||||
#endif
|
#endif
|
||||||
#define _file_included
|
#define _file_included
|
||||||
#pragma library File
|
#pragma library File
|
||||||
|
|
||||||
enum filemode
|
enum filemode
|
||||||
{
|
{
|
||||||
io_read, /* file must exist */
|
io_read, /* file must exist */
|
||||||
io_write, /* creates a new file */
|
io_write, /* creates a new file */
|
||||||
io_readwrite, /* opens an existing file, or creates a new file */
|
io_readwrite, /* opens an existing file, or creates a new file */
|
||||||
io_append, /* appends to file (write-only) */
|
io_append, /* appends to file (write-only) */
|
||||||
}
|
}
|
||||||
|
|
||||||
enum seek_whence
|
enum seek_whence
|
||||||
{
|
{
|
||||||
seek_start,
|
seek_start,
|
||||||
seek_current,
|
seek_current,
|
||||||
seek_end,
|
seek_end,
|
||||||
}
|
}
|
||||||
|
|
||||||
const EOF = -1;
|
const EOF = -1;
|
||||||
|
|
||||||
native File: fopen(const name[], filemode: mode = io_readwrite);
|
native File: fopen(const name[], filemode: mode = io_readwrite);
|
||||||
native bool: fclose(File: handle);
|
native bool: fclose(File: handle);
|
||||||
native File: ftemp();
|
native File: ftemp();
|
||||||
native bool: fremove(const name[]);
|
native bool: fremove(const name[]);
|
||||||
|
|
||||||
native fwrite(File: handle, const string[]);
|
native fwrite(File: handle, const string[]);
|
||||||
native fread(File: handle, string[], size = sizeof string, bool: pack = false);
|
native fread(File: handle, string[], size = sizeof string, bool: pack = false);
|
||||||
native bool: fputchar(File: handle, value, bool: utf8 = true);
|
native bool: fputchar(File: handle, value, bool: utf8 = true);
|
||||||
native fgetchar(File: handle, bool: utf8 = true);
|
native fgetchar(File: handle, bool: utf8 = true);
|
||||||
native fblockwrite(File: handle, const buffer[], size = sizeof buffer);
|
native fblockwrite(File: handle, const buffer[], size = sizeof buffer);
|
||||||
native fblockread(File: handle, buffer[], size = sizeof buffer);
|
native fblockread(File: handle, buffer[], size = sizeof buffer);
|
||||||
|
|
||||||
native fseek(File: handle, position = 0, seek_whence: whence = seek_start);
|
native fseek(File: handle, position = 0, seek_whence: whence = seek_start);
|
||||||
native flength(File: handle);
|
native flength(File: handle);
|
||||||
native fexist(const pattern[]);
|
native fexist(const pattern[]);
|
||||||
native bool: fmatch(name[], const pattern[], index = 0, size = sizeof name);
|
native bool: fmatch(name[], const pattern[], index = 0, size = sizeof name);
|
||||||
|
@ -1,95 +1,95 @@
|
|||||||
/* Fixed point arithmetic
|
/* Fixed point arithmetic
|
||||||
*
|
*
|
||||||
* (c) Copyright 1998-2005, ITB CompuPhase
|
* (c) Copyright 1998-2005, ITB CompuPhase
|
||||||
* This file is provided as is (no warranties).
|
* This file is provided as is (no warranties).
|
||||||
*/
|
*/
|
||||||
#if defined _Fixed_included
|
#if defined _Fixed_included
|
||||||
#endinput
|
#endinput
|
||||||
#endif
|
#endif
|
||||||
#define _Fixed_included
|
#define _Fixed_included
|
||||||
#pragma library Fixed
|
#pragma library Fixed
|
||||||
|
|
||||||
enum fround_method {
|
enum fround_method {
|
||||||
fround_round,
|
fround_round,
|
||||||
fround_floor,
|
fround_floor,
|
||||||
fround_ceil,
|
fround_ceil,
|
||||||
fround_tozero,
|
fround_tozero,
|
||||||
fround_unbiased
|
fround_unbiased
|
||||||
}
|
}
|
||||||
|
|
||||||
native Fixed:fixed(value);
|
native Fixed:fixed(value);
|
||||||
native Fixed:strfixed(const string[]);
|
native Fixed:strfixed(const string[]);
|
||||||
native Fixed:fmul(Fixed:oper1, Fixed:oper2);
|
native Fixed:fmul(Fixed:oper1, Fixed:oper2);
|
||||||
native Fixed:fdiv(Fixed:dividend, Fixed:divisor);
|
native Fixed:fdiv(Fixed:dividend, Fixed:divisor);
|
||||||
native Fixed:ffract(Fixed:value);
|
native Fixed:ffract(Fixed:value);
|
||||||
native fround(Fixed:value, fround_method:method=fround_round);
|
native fround(Fixed:value, fround_method:method=fround_round);
|
||||||
native Fixed:fpower(Fixed:value, exponent);
|
native Fixed:fpower(Fixed:value, exponent);
|
||||||
native Fixed:fsqroot(Fixed:value);
|
native Fixed:fsqroot(Fixed:value);
|
||||||
native Fixed:fabs(Fixed:value);
|
native Fixed:fabs(Fixed:value);
|
||||||
|
|
||||||
#pragma rational Fixed(3)
|
#pragma rational Fixed(3)
|
||||||
|
|
||||||
/* user defined operators */
|
/* user defined operators */
|
||||||
native Fixed:operator*(Fixed:oper1, Fixed:oper2) = fmul;
|
native Fixed:operator*(Fixed:oper1, Fixed:oper2) = fmul;
|
||||||
native Fixed:operator/(Fixed:oper1, Fixed:oper2) = fdiv;
|
native Fixed:operator/(Fixed:oper1, Fixed:oper2) = fdiv;
|
||||||
native Fixed:operator=(oper) = fixed;
|
native Fixed:operator=(oper) = fixed;
|
||||||
|
|
||||||
stock Fixed:operator++(Fixed:oper)
|
stock Fixed:operator++(Fixed:oper)
|
||||||
return oper + fixed(1);
|
return oper + fixed(1);
|
||||||
|
|
||||||
stock Fixed:operator--(Fixed:oper)
|
stock Fixed:operator--(Fixed:oper)
|
||||||
return oper - fixed(1);
|
return oper - fixed(1);
|
||||||
|
|
||||||
stock Fixed:operator*(Fixed:oper1, oper2)
|
stock Fixed:operator*(Fixed:oper1, oper2)
|
||||||
return Fixed: (_:oper1 * oper2); /* "*" is commutative */
|
return Fixed: (_:oper1 * oper2); /* "*" is commutative */
|
||||||
|
|
||||||
stock Fixed:operator/(Fixed:oper1, oper2)
|
stock Fixed:operator/(Fixed:oper1, oper2)
|
||||||
return oper1 / fixed(oper2);
|
return oper1 / fixed(oper2);
|
||||||
|
|
||||||
stock Fixed:operator/(oper1, Fixed:oper2)
|
stock Fixed:operator/(oper1, Fixed:oper2)
|
||||||
return fdiv(fixed(oper1), oper2);
|
return fdiv(fixed(oper1), oper2);
|
||||||
|
|
||||||
stock Fixed:operator+(Fixed:oper1, oper2)
|
stock Fixed:operator+(Fixed:oper1, oper2)
|
||||||
return oper1 + fixed(oper2); /* "+" is commutative */
|
return oper1 + fixed(oper2); /* "+" is commutative */
|
||||||
|
|
||||||
stock Fixed:operator-(Fixed:oper1, oper2)
|
stock Fixed:operator-(Fixed:oper1, oper2)
|
||||||
return oper1 - fixed(oper2);
|
return oper1 - fixed(oper2);
|
||||||
|
|
||||||
stock Fixed:operator-(oper1, Fixed:oper2)
|
stock Fixed:operator-(oper1, Fixed:oper2)
|
||||||
return fixed(oper1) - oper2;
|
return fixed(oper1) - oper2;
|
||||||
|
|
||||||
stock bool:operator>(Fixed:oper1, oper2)
|
stock bool:operator>(Fixed:oper1, oper2)
|
||||||
return oper1 > fixed(oper2);
|
return oper1 > fixed(oper2);
|
||||||
|
|
||||||
stock bool:operator>(oper1, Fixed:oper2)
|
stock bool:operator>(oper1, Fixed:oper2)
|
||||||
return fixed(oper1) > oper2;
|
return fixed(oper1) > oper2;
|
||||||
|
|
||||||
stock bool:operator>=(Fixed:oper1, oper2)
|
stock bool:operator>=(Fixed:oper1, oper2)
|
||||||
return oper1 >= fixed(oper2);
|
return oper1 >= fixed(oper2);
|
||||||
|
|
||||||
stock bool:operator>=(oper1, Fixed:oper2)
|
stock bool:operator>=(oper1, Fixed:oper2)
|
||||||
return fixed(oper1) >= oper2;
|
return fixed(oper1) >= oper2;
|
||||||
|
|
||||||
stock bool:operator<(Fixed:oper1, oper2)
|
stock bool:operator<(Fixed:oper1, oper2)
|
||||||
return oper1 < fixed(oper2);
|
return oper1 < fixed(oper2);
|
||||||
|
|
||||||
stock bool:operator<(oper1, Fixed:oper2)
|
stock bool:operator<(oper1, Fixed:oper2)
|
||||||
return fixed(oper1) < oper2;
|
return fixed(oper1) < oper2;
|
||||||
|
|
||||||
stock bool:operator<=(Fixed:oper1, oper2)
|
stock bool:operator<=(Fixed:oper1, oper2)
|
||||||
return oper1 <= fixed(oper2);
|
return oper1 <= fixed(oper2);
|
||||||
|
|
||||||
stock bool:operator<=(oper1, Fixed:oper2)
|
stock bool:operator<=(oper1, Fixed:oper2)
|
||||||
return fixed(oper1) <= oper2;
|
return fixed(oper1) <= oper2;
|
||||||
|
|
||||||
stock bool:operator==(Fixed:oper1, oper2) /* "==" is commutative */
|
stock bool:operator==(Fixed:oper1, oper2) /* "==" is commutative */
|
||||||
return oper1 == fixed(oper2);
|
return oper1 == fixed(oper2);
|
||||||
|
|
||||||
stock bool:operator!=(Fixed:oper1, oper2) /* "!=" is commutative */
|
stock bool:operator!=(Fixed:oper1, oper2) /* "!=" is commutative */
|
||||||
return oper1 != fixed(oper2);
|
return oper1 != fixed(oper2);
|
||||||
|
|
||||||
/* forbidden operations */
|
/* forbidden operations */
|
||||||
forward operator%(Fixed:oper1, Fixed:oper2);
|
forward operator%(Fixed:oper1, Fixed:oper2);
|
||||||
forward operator%(Fixed:oper1, oper2);
|
forward operator%(Fixed:oper1, oper2);
|
||||||
forward operator%(oper1, Fixed:oper2);
|
forward operator%(oper1, Fixed:oper2);
|
||||||
|
|
||||||
|
@ -1,184 +1,184 @@
|
|||||||
/* Float arithmetic
|
/* Float arithmetic
|
||||||
*
|
*
|
||||||
* (c) Copyright 1999, Artran, Inc.
|
* (c) Copyright 1999, Artran, Inc.
|
||||||
* Written by Greg Garner (gmg@artran.com)
|
* Written by Greg Garner (gmg@artran.com)
|
||||||
* Modified in March 2001 to include user defined
|
* Modified in March 2001 to include user defined
|
||||||
* operators for the floating point functions.
|
* operators for the floating point functions.
|
||||||
*
|
*
|
||||||
* This file is provided as is (no warranties).
|
* This file is provided as is (no warranties).
|
||||||
*/
|
*/
|
||||||
#if defined _Float_included
|
#if defined _Float_included
|
||||||
#endinput
|
#endinput
|
||||||
#endif
|
#endif
|
||||||
#define _Float_included
|
#define _Float_included
|
||||||
#pragma library Float
|
#pragma library Float
|
||||||
|
|
||||||
/* Different methods of rounding */
|
/* Different methods of rounding */
|
||||||
enum floatround_method {
|
enum floatround_method {
|
||||||
floatround_round,
|
floatround_round,
|
||||||
floatround_floor,
|
floatround_floor,
|
||||||
floatround_ceil,
|
floatround_ceil,
|
||||||
floatround_tozero,
|
floatround_tozero,
|
||||||
floatround_unbiased
|
floatround_unbiased
|
||||||
}
|
}
|
||||||
enum anglemode {
|
enum anglemode {
|
||||||
radian,
|
radian,
|
||||||
degrees,
|
degrees,
|
||||||
grades
|
grades
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************************************/
|
/**************************************************/
|
||||||
/* Convert an integer into a floating point value */
|
/* Convert an integer into a floating point value */
|
||||||
native Float:float(value);
|
native Float:float(value);
|
||||||
|
|
||||||
/**************************************************/
|
/**************************************************/
|
||||||
/* Convert a string into a floating point value */
|
/* Convert a string into a floating point value */
|
||||||
native Float:strfloat(const string[]);
|
native Float:strfloat(const string[]);
|
||||||
|
|
||||||
/**************************************************/
|
/**************************************************/
|
||||||
/* Multiple two floats together */
|
/* Multiple two floats together */
|
||||||
native Float:floatmul(Float:oper1, Float:oper2);
|
native Float:floatmul(Float:oper1, Float:oper2);
|
||||||
|
|
||||||
/**************************************************/
|
/**************************************************/
|
||||||
/* Divide the dividend float by the divisor float */
|
/* Divide the dividend float by the divisor float */
|
||||||
native Float:floatdiv(Float:dividend, Float:divisor);
|
native Float:floatdiv(Float:dividend, Float:divisor);
|
||||||
|
|
||||||
/**************************************************/
|
/**************************************************/
|
||||||
/* Add two floats together */
|
/* Add two floats together */
|
||||||
native Float:floatadd(Float:oper1, Float:oper2);
|
native Float:floatadd(Float:oper1, Float:oper2);
|
||||||
|
|
||||||
/**************************************************/
|
/**************************************************/
|
||||||
/* Subtract oper2 float from oper1 float */
|
/* Subtract oper2 float from oper1 float */
|
||||||
native Float:floatsub(Float:oper1, Float:oper2);
|
native Float:floatsub(Float:oper1, Float:oper2);
|
||||||
|
|
||||||
/**************************************************/
|
/**************************************************/
|
||||||
/* Return the fractional part of a float */
|
/* Return the fractional part of a float */
|
||||||
native Float:floatfract(Float:value);
|
native Float:floatfract(Float:value);
|
||||||
|
|
||||||
/**************************************************/
|
/**************************************************/
|
||||||
/* Round a float into a integer value */
|
/* Round a float into a integer value */
|
||||||
native floatround(Float:value, floatround_method:method=floatround_round);
|
native floatround(Float:value, floatround_method:method=floatround_round);
|
||||||
|
|
||||||
/**************************************************/
|
/**************************************************/
|
||||||
/* Compare two integers. If the two elements are equal, return 0.
|
/* Compare two integers. If the two elements are equal, return 0.
|
||||||
If the first argument is greater than the second argument, return 1,
|
If the first argument is greater than the second argument, return 1,
|
||||||
If the first argument is less than the second argument, return -1. */
|
If the first argument is less than the second argument, return -1. */
|
||||||
native floatcmp(Float:oper1, Float:oper2);
|
native floatcmp(Float:oper1, Float:oper2);
|
||||||
|
|
||||||
/**************************************************/
|
/**************************************************/
|
||||||
/* Return the square root of the input value, same as floatpower(value, 0.5) */
|
/* Return the square root of the input value, same as floatpower(value, 0.5) */
|
||||||
native Float:floatsqroot(Float:value);
|
native Float:floatsqroot(Float:value);
|
||||||
|
|
||||||
/**************************************************/
|
/**************************************************/
|
||||||
/* Return the value raised to the power of the exponent */
|
/* Return the value raised to the power of the exponent */
|
||||||
native Float:floatpower(Float:value, Float:exponent);
|
native Float:floatpower(Float:value, Float:exponent);
|
||||||
|
|
||||||
/**************************************************/
|
/**************************************************/
|
||||||
/* Return the logarithm */
|
/* Return the logarithm */
|
||||||
native Float:floatlog(Float:value, Float:base=10.0);
|
native Float:floatlog(Float:value, Float:base=10.0);
|
||||||
|
|
||||||
/**************************************************/
|
/**************************************************/
|
||||||
/* Return the sine, cosine or tangent. The input angle may be in radian,
|
/* Return the sine, cosine or tangent. The input angle may be in radian,
|
||||||
degrees or grades. */
|
degrees or grades. */
|
||||||
native Float:floatsin(Float:value, anglemode:mode=radian);
|
native Float:floatsin(Float:value, anglemode:mode=radian);
|
||||||
native Float:floatcos(Float:value, anglemode:mode=radian);
|
native Float:floatcos(Float:value, anglemode:mode=radian);
|
||||||
native Float:floattan(Float:value, anglemode:mode=radian);
|
native Float:floattan(Float:value, anglemode:mode=radian);
|
||||||
|
|
||||||
/**************************************************/
|
/**************************************************/
|
||||||
/* Return the absolute value */
|
/* Return the absolute value */
|
||||||
native Float:floatabs(Float:value);
|
native Float:floatabs(Float:value);
|
||||||
|
|
||||||
|
|
||||||
/**************************************************/
|
/**************************************************/
|
||||||
#pragma rational Float
|
#pragma rational Float
|
||||||
|
|
||||||
/* user defined operators */
|
/* user defined operators */
|
||||||
native Float:operator*(Float:oper1, Float:oper2) = floatmul;
|
native Float:operator*(Float:oper1, Float:oper2) = floatmul;
|
||||||
native Float:operator/(Float:oper1, Float:oper2) = floatdiv;
|
native Float:operator/(Float:oper1, Float:oper2) = floatdiv;
|
||||||
native Float:operator+(Float:oper1, Float:oper2) = floatadd;
|
native Float:operator+(Float:oper1, Float:oper2) = floatadd;
|
||||||
native Float:operator-(Float:oper1, Float:oper2) = floatsub;
|
native Float:operator-(Float:oper1, Float:oper2) = floatsub;
|
||||||
native Float:operator=(oper) = float;
|
native Float:operator=(oper) = float;
|
||||||
|
|
||||||
stock Float:operator++(Float:oper)
|
stock Float:operator++(Float:oper)
|
||||||
return oper+1.0;
|
return oper+1.0;
|
||||||
|
|
||||||
stock Float:operator--(Float:oper)
|
stock Float:operator--(Float:oper)
|
||||||
return oper-1.0;
|
return oper-1.0;
|
||||||
|
|
||||||
stock Float:operator-(Float:oper)
|
stock Float:operator-(Float:oper)
|
||||||
return oper^Float:cellmin; /* IEEE values are sign/magnitude */
|
return oper^Float:cellmin; /* IEEE values are sign/magnitude */
|
||||||
|
|
||||||
stock Float:operator*(Float:oper1, oper2)
|
stock Float:operator*(Float:oper1, oper2)
|
||||||
return floatmul(oper1, float(oper2)); /* "*" is commutative */
|
return floatmul(oper1, float(oper2)); /* "*" is commutative */
|
||||||
|
|
||||||
stock Float:operator/(Float:oper1, oper2)
|
stock Float:operator/(Float:oper1, oper2)
|
||||||
return floatdiv(oper1, float(oper2));
|
return floatdiv(oper1, float(oper2));
|
||||||
|
|
||||||
stock Float:operator/(oper1, Float:oper2)
|
stock Float:operator/(oper1, Float:oper2)
|
||||||
return floatdiv(float(oper1), oper2);
|
return floatdiv(float(oper1), oper2);
|
||||||
|
|
||||||
stock Float:operator+(Float:oper1, oper2)
|
stock Float:operator+(Float:oper1, oper2)
|
||||||
return floatadd(oper1, float(oper2)); /* "+" is commutative */
|
return floatadd(oper1, float(oper2)); /* "+" is commutative */
|
||||||
|
|
||||||
stock Float:operator-(Float:oper1, oper2)
|
stock Float:operator-(Float:oper1, oper2)
|
||||||
return floatsub(oper1, float(oper2));
|
return floatsub(oper1, float(oper2));
|
||||||
|
|
||||||
stock Float:operator-(oper1, Float:oper2)
|
stock Float:operator-(oper1, Float:oper2)
|
||||||
return floatsub(float(oper1), oper2);
|
return floatsub(float(oper1), oper2);
|
||||||
|
|
||||||
stock bool:operator==(Float:oper1, Float:oper2)
|
stock bool:operator==(Float:oper1, Float:oper2)
|
||||||
return floatcmp(oper1, oper2) == 0;
|
return floatcmp(oper1, oper2) == 0;
|
||||||
|
|
||||||
stock bool:operator==(Float:oper1, oper2)
|
stock bool:operator==(Float:oper1, oper2)
|
||||||
return floatcmp(oper1, float(oper2)) == 0; /* "==" is commutative */
|
return floatcmp(oper1, float(oper2)) == 0; /* "==" is commutative */
|
||||||
|
|
||||||
stock bool:operator!=(Float:oper1, Float:oper2)
|
stock bool:operator!=(Float:oper1, Float:oper2)
|
||||||
return floatcmp(oper1, oper2) != 0;
|
return floatcmp(oper1, oper2) != 0;
|
||||||
|
|
||||||
stock bool:operator!=(Float:oper1, oper2)
|
stock bool:operator!=(Float:oper1, oper2)
|
||||||
return floatcmp(oper1, float(oper2)) != 0; /* "!=" is commutative */
|
return floatcmp(oper1, float(oper2)) != 0; /* "!=" is commutative */
|
||||||
|
|
||||||
stock bool:operator>(Float:oper1, Float:oper2)
|
stock bool:operator>(Float:oper1, Float:oper2)
|
||||||
return floatcmp(oper1, oper2) > 0;
|
return floatcmp(oper1, oper2) > 0;
|
||||||
|
|
||||||
stock bool:operator>(Float:oper1, oper2)
|
stock bool:operator>(Float:oper1, oper2)
|
||||||
return floatcmp(oper1, float(oper2)) > 0;
|
return floatcmp(oper1, float(oper2)) > 0;
|
||||||
|
|
||||||
stock bool:operator>(oper1, Float:oper2)
|
stock bool:operator>(oper1, Float:oper2)
|
||||||
return floatcmp(float(oper1), oper2) > 0;
|
return floatcmp(float(oper1), oper2) > 0;
|
||||||
|
|
||||||
stock bool:operator>=(Float:oper1, Float:oper2)
|
stock bool:operator>=(Float:oper1, Float:oper2)
|
||||||
return floatcmp(oper1, oper2) >= 0;
|
return floatcmp(oper1, oper2) >= 0;
|
||||||
|
|
||||||
stock bool:operator>=(Float:oper1, oper2)
|
stock bool:operator>=(Float:oper1, oper2)
|
||||||
return floatcmp(oper1, float(oper2)) >= 0;
|
return floatcmp(oper1, float(oper2)) >= 0;
|
||||||
|
|
||||||
stock bool:operator>=(oper1, Float:oper2)
|
stock bool:operator>=(oper1, Float:oper2)
|
||||||
return floatcmp(float(oper1), oper2) >= 0;
|
return floatcmp(float(oper1), oper2) >= 0;
|
||||||
|
|
||||||
stock bool:operator<(Float:oper1, Float:oper2)
|
stock bool:operator<(Float:oper1, Float:oper2)
|
||||||
return floatcmp(oper1, oper2) < 0;
|
return floatcmp(oper1, oper2) < 0;
|
||||||
|
|
||||||
stock bool:operator<(Float:oper1, oper2)
|
stock bool:operator<(Float:oper1, oper2)
|
||||||
return floatcmp(oper1, float(oper2)) < 0;
|
return floatcmp(oper1, float(oper2)) < 0;
|
||||||
|
|
||||||
stock bool:operator<(oper1, Float:oper2)
|
stock bool:operator<(oper1, Float:oper2)
|
||||||
return floatcmp(float(oper1), oper2) < 0;
|
return floatcmp(float(oper1), oper2) < 0;
|
||||||
|
|
||||||
stock bool:operator<=(Float:oper1, Float:oper2)
|
stock bool:operator<=(Float:oper1, Float:oper2)
|
||||||
return floatcmp(oper1, oper2) <= 0;
|
return floatcmp(oper1, oper2) <= 0;
|
||||||
|
|
||||||
stock bool:operator<=(Float:oper1, oper2)
|
stock bool:operator<=(Float:oper1, oper2)
|
||||||
return floatcmp(oper1, float(oper2)) <= 0;
|
return floatcmp(oper1, float(oper2)) <= 0;
|
||||||
|
|
||||||
stock bool:operator<=(oper1, Float:oper2)
|
stock bool:operator<=(oper1, Float:oper2)
|
||||||
return floatcmp(float(oper1), oper2) <= 0;
|
return floatcmp(float(oper1), oper2) <= 0;
|
||||||
|
|
||||||
stock bool:operator!(Float:oper)
|
stock bool:operator!(Float:oper)
|
||||||
return (_:oper & cellmax) == 0;
|
return (_:oper & cellmax) == 0;
|
||||||
|
|
||||||
/* forbidden operations */
|
/* forbidden operations */
|
||||||
forward operator%(Float:oper1, Float:oper2);
|
forward operator%(Float:oper1, Float:oper2);
|
||||||
forward operator%(Float:oper1, oper2);
|
forward operator%(Float:oper1, oper2);
|
||||||
forward operator%(oper1, Float:oper2);
|
forward operator%(oper1, Float:oper2);
|
||||||
|
|
||||||
|
@ -1,19 +1,19 @@
|
|||||||
/* Process control and Foreign Function Interface (calling functions
|
/* Process control and Foreign Function Interface (calling functions
|
||||||
* in DLLs or shared libraries)
|
* in DLLs or shared libraries)
|
||||||
*
|
*
|
||||||
* (c) Copyright 2006, ITB CompuPhase
|
* (c) Copyright 2006, ITB CompuPhase
|
||||||
* This file is provided as is (no warranties).
|
* This file is provided as is (no warranties).
|
||||||
*/
|
*/
|
||||||
#if defined _process_included
|
#if defined _process_included
|
||||||
#endinput
|
#endinput
|
||||||
#endif
|
#endif
|
||||||
#define _process_included
|
#define _process_included
|
||||||
#pragma library Process
|
#pragma library Process
|
||||||
|
|
||||||
native libcall(const libname[], const funcname[], const typestring[], ...);
|
native libcall(const libname[], const funcname[], const typestring[], ...);
|
||||||
native bool: libfree(const libname[]="");
|
native bool: libfree(const libname[]="");
|
||||||
|
|
||||||
native PID: procexec(const progname[]);
|
native PID: procexec(const progname[]);
|
||||||
native procwait(PID:pid);
|
native procwait(PID:pid);
|
||||||
native bool: procwrite(const line[], bool:appendlf=false);
|
native bool: procwrite(const line[], bool:appendlf=false);
|
||||||
native bool: procread(line[], size=sizeof line, bool:striplf=false, bool:packed=false);
|
native bool: procread(line[], size=sizeof line, bool:striplf=false, bool:packed=false);
|
||||||
|
@ -1,53 +1,53 @@
|
|||||||
/* Rational number support
|
/* Rational number support
|
||||||
* Loads either Float.inc or Fixed.inc, depending on the configuration
|
* Loads either Float.inc or Fixed.inc, depending on the configuration
|
||||||
*
|
*
|
||||||
* (c) Copyright 2004-2005, ITB CompuPhase
|
* (c) Copyright 2004-2005, ITB CompuPhase
|
||||||
* This file is provided as is (no warranties).
|
* This file is provided as is (no warranties).
|
||||||
*/
|
*/
|
||||||
#if defined _Rational_included
|
#if defined _Rational_included
|
||||||
#endinput
|
#endinput
|
||||||
#endif
|
#endif
|
||||||
#define _Rational_included
|
#define _Rational_included
|
||||||
|
|
||||||
/* first try to include floating point support */
|
/* first try to include floating point support */
|
||||||
#if !defined NOFLOAT
|
#if !defined NOFLOAT
|
||||||
#tryinclude <float>
|
#tryinclude <float>
|
||||||
#endif
|
#endif
|
||||||
#if defined _Float_included
|
#if defined _Float_included
|
||||||
#define Rational: Float:
|
#define Rational: Float:
|
||||||
#define rationalstr(%1) floatstr(%1)
|
#define rationalstr(%1) floatstr(%1)
|
||||||
#define rround(%1, %2) floatround(%1, %2)
|
#define rround(%1, %2) floatround(%1, %2)
|
||||||
#define rsqroot(%1) floatsqroot(%1)
|
#define rsqroot(%1) floatsqroot(%1)
|
||||||
#define rpower(%1, %2) floatpower(%1, %2)
|
#define rpower(%1, %2) floatpower(%1, %2)
|
||||||
#define rabs(%1) floatabs(%1)
|
#define rabs(%1) floatabs(%1)
|
||||||
|
|
||||||
#define rround_round floatround_round
|
#define rround_round floatround_round
|
||||||
#define rround_floor floatround_floor
|
#define rround_floor floatround_floor
|
||||||
#define rround_ceil floatround_ceil
|
#define rround_ceil floatround_ceil
|
||||||
#define rround_tozero floatround_tozero
|
#define rround_tozero floatround_tozero
|
||||||
#define rround_unbiased floatround_unbiased
|
#define rround_unbiased floatround_unbiased
|
||||||
#endinput
|
#endinput
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* loading floating point support failed, try fixed point support */
|
/* loading floating point support failed, try fixed point support */
|
||||||
#if !defined NOFIXED
|
#if !defined NOFIXED
|
||||||
#tryinclude <fixed>
|
#tryinclude <fixed>
|
||||||
#endif
|
#endif
|
||||||
#if defined _Fixed_included
|
#if defined _Fixed_included
|
||||||
#define Rational: Fixed:
|
#define Rational: Fixed:
|
||||||
#define rationalstr(%1) fixedstr(%1)
|
#define rationalstr(%1) fixedstr(%1)
|
||||||
#define rround(%1, %2) fround(%1, %2)
|
#define rround(%1, %2) fround(%1, %2)
|
||||||
#define rsqroot(%1) fsqroot(%1)
|
#define rsqroot(%1) fsqroot(%1)
|
||||||
#define rpower(%1, %2) fpower(%1, %2)
|
#define rpower(%1, %2) fpower(%1, %2)
|
||||||
#define rabs(%1) fabs(%1)
|
#define rabs(%1) fabs(%1)
|
||||||
|
|
||||||
#define rround_round fround_round
|
#define rround_round fround_round
|
||||||
#define rround_floor fround_floor
|
#define rround_floor fround_floor
|
||||||
#define rround_ceil fround_ceil
|
#define rround_ceil fround_ceil
|
||||||
#define rround_tozero fround_tozero
|
#define rround_tozero fround_tozero
|
||||||
#define rround_unbiased fround_unbiased
|
#define rround_unbiased fround_unbiased
|
||||||
#endinput
|
#endinput
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* if arrived here, neither floating point, nor fixed point support is available */
|
/* if arrived here, neither floating point, nor fixed point support is available */
|
||||||
#error Rational number support is unavailable (disabled or not installed)
|
#error Rational number support is unavailable (disabled or not installed)
|
||||||
|
@ -1,35 +1,35 @@
|
|||||||
/* String functions
|
/* String functions
|
||||||
*
|
*
|
||||||
* (c) Copyright 2005, ITB CompuPhase
|
* (c) Copyright 2005, ITB CompuPhase
|
||||||
* This file is provided as is (no warranties).
|
* This file is provided as is (no warranties).
|
||||||
*/
|
*/
|
||||||
#if defined _string_included
|
#if defined _string_included
|
||||||
#endinput
|
#endinput
|
||||||
#endif
|
#endif
|
||||||
#define _string_included
|
#define _string_included
|
||||||
#pragma library String
|
#pragma library String
|
||||||
|
|
||||||
native strlen(const string[]);
|
native strlen(const string[]);
|
||||||
native strpack(dest[], const source[], maxlength=sizeof dest);
|
native strpack(dest[], const source[], maxlength=sizeof dest);
|
||||||
native strunpack(dest[], const source[], maxlength=sizeof dest);
|
native strunpack(dest[], const source[], maxlength=sizeof dest);
|
||||||
native strcat(dest[], const source[], maxlength=sizeof dest);
|
native strcat(dest[], const source[], maxlength=sizeof dest);
|
||||||
|
|
||||||
native strmid(dest[], const source[], start=0, end=cellmax, maxlength=sizeof dest);
|
native strmid(dest[], const source[], start=0, end=cellmax, maxlength=sizeof dest);
|
||||||
native bool: strins(string[], const substr[], index, maxlength=sizeof string);
|
native bool: strins(string[], const substr[], index, maxlength=sizeof string);
|
||||||
native bool: strdel(string[], start, end);
|
native bool: strdel(string[], start, end);
|
||||||
|
|
||||||
native strcmp(const string1[], const string2[], bool:ignorecase=false, length=cellmax);
|
native strcmp(const string1[], const string2[], bool:ignorecase=false, length=cellmax);
|
||||||
native strfind(const string[], const sub[], bool:ignorecase=false, index=0);
|
native strfind(const string[], const sub[], bool:ignorecase=false, index=0);
|
||||||
|
|
||||||
native strval(const string[], index=0);
|
native strval(const string[], index=0);
|
||||||
native valstr(dest[], value, bool:pack=false);
|
native valstr(dest[], value, bool:pack=false);
|
||||||
native bool: ispacked(const string[]);
|
native bool: ispacked(const string[]);
|
||||||
|
|
||||||
native strformat(dest[], size=sizeof dest, bool:pack=false, const format[], {Fixed,Float,_}:...);
|
native strformat(dest[], size=sizeof dest, bool:pack=false, const format[], {Fixed,Float,_}:...);
|
||||||
|
|
||||||
native uudecode(dest[], const source[], maxlength=sizeof dest);
|
native uudecode(dest[], const source[], maxlength=sizeof dest);
|
||||||
native uuencode(dest[], const source[], numbytes, maxlength=sizeof dest);
|
native uuencode(dest[], const source[], numbytes, maxlength=sizeof dest);
|
||||||
native memcpy(dest[], const source[], index=0, numbytes, maxlength=sizeof dest);
|
native memcpy(dest[], const source[], index=0, numbytes, maxlength=sizeof dest);
|
||||||
|
|
||||||
stock bool: strequal(const string1[], const string2[], bool:ignorecase=false, length=cellmax)
|
stock bool: strequal(const string1[], const string2[], bool:ignorecase=false, length=cellmax)
|
||||||
return strcmp(string1, string2, ignorecase, length) == 0
|
return strcmp(string1, string2, ignorecase, length) == 0
|
||||||
|
@ -1,22 +1,22 @@
|
|||||||
/* Date/time functions
|
/* Date/time functions
|
||||||
*
|
*
|
||||||
* (c) Copyright 2001-2005, ITB CompuPhase
|
* (c) Copyright 2001-2005, ITB CompuPhase
|
||||||
* This file is provided as is (no warranties).
|
* This file is provided as is (no warranties).
|
||||||
*/
|
*/
|
||||||
#if defined _time_included
|
#if defined _time_included
|
||||||
#endinput
|
#endinput
|
||||||
#endif
|
#endif
|
||||||
#define _time_included
|
#define _time_included
|
||||||
#pragma library Time
|
#pragma library Time
|
||||||
|
|
||||||
native gettime(&hour=0, &minute=0, &second=0);
|
native gettime(&hour=0, &minute=0, &second=0);
|
||||||
native settime(hour=cellmin, minute=cellmin, second=cellmin);
|
native settime(hour=cellmin, minute=cellmin, second=cellmin);
|
||||||
native getdate(&year=0, &month=0, &day=0);
|
native getdate(&year=0, &month=0, &day=0);
|
||||||
native setdate(year=cellmin, month=cellmin, day=cellmin);
|
native setdate(year=cellmin, month=cellmin, day=cellmin);
|
||||||
native settimestamp(seconds1970);
|
native settimestamp(seconds1970);
|
||||||
|
|
||||||
native settimer(milliseconds, bool: singleshot=false);
|
native settimer(milliseconds, bool: singleshot=false);
|
||||||
native tickcount(&granularity=0);
|
native tickcount(&granularity=0);
|
||||||
native delay(milliseconds);
|
native delay(milliseconds);
|
||||||
|
|
||||||
forward @timer();
|
forward @timer();
|
||||||
|
@ -1,208 +1,208 @@
|
|||||||
#build file for CMake, see http://www.cmake.org/
|
#build file for CMake, see http://www.cmake.org/
|
||||||
|
|
||||||
PROJECT(pawnamx)
|
PROJECT(pawnamx)
|
||||||
|
|
||||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
|
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
|
||||||
|
|
||||||
# check for optional include files
|
# check for optional include files
|
||||||
INCLUDE(${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake)
|
INCLUDE(${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake)
|
||||||
CHECK_INCLUDE_FILE("unistd.h" HAVE_UNISTD_H)
|
CHECK_INCLUDE_FILE("unistd.h" HAVE_UNISTD_H)
|
||||||
IF(HAVE_UNISTD_H)
|
IF(HAVE_UNISTD_H)
|
||||||
ADD_DEFINITIONS(-DHAVE_UNISTD_H)
|
ADD_DEFINITIONS(-DHAVE_UNISTD_H)
|
||||||
ENDIF(HAVE_UNISTD_H)
|
ENDIF(HAVE_UNISTD_H)
|
||||||
CHECK_INCLUDE_FILE("inttypes.h" HAVE_INTTYPES_H)
|
CHECK_INCLUDE_FILE("inttypes.h" HAVE_INTTYPES_H)
|
||||||
IF(HAVE_INTTYPES_H)
|
IF(HAVE_INTTYPES_H)
|
||||||
ADD_DEFINITIONS(-DHAVE_INTTYPES_H)
|
ADD_DEFINITIONS(-DHAVE_INTTYPES_H)
|
||||||
ENDIF(HAVE_INTTYPES_H)
|
ENDIF(HAVE_INTTYPES_H)
|
||||||
CHECK_INCLUDE_FILE("stdint.h" HAVE_STDINT_H)
|
CHECK_INCLUDE_FILE("stdint.h" HAVE_STDINT_H)
|
||||||
IF(HAVE_STDINT_H)
|
IF(HAVE_STDINT_H)
|
||||||
ADD_DEFINITIONS(-DHAVE_STDINT_H)
|
ADD_DEFINITIONS(-DHAVE_STDINT_H)
|
||||||
ENDIF(HAVE_STDINT_H)
|
ENDIF(HAVE_STDINT_H)
|
||||||
CHECK_INCLUDE_FILE("alloca.h" HAVE_ALLOCA_H)
|
CHECK_INCLUDE_FILE("alloca.h" HAVE_ALLOCA_H)
|
||||||
IF(HAVE_ALLOCA_H)
|
IF(HAVE_ALLOCA_H)
|
||||||
ADD_DEFINITIONS(-DHAVE_ALLOCA_H)
|
ADD_DEFINITIONS(-DHAVE_ALLOCA_H)
|
||||||
ENDIF(HAVE_ALLOCA_H)
|
ENDIF(HAVE_ALLOCA_H)
|
||||||
|
|
||||||
ADD_DEFINITIONS(-DFLOATPOINT -DFIXEDPOINT)
|
ADD_DEFINITIONS(-DFLOATPOINT -DFIXEDPOINT)
|
||||||
IF (UNIX)
|
IF (UNIX)
|
||||||
ADD_DEFINITIONS(-DLINUX)
|
ADD_DEFINITIONS(-DLINUX)
|
||||||
CHECK_INCLUDE_FILE("ffi.h" HAVE_FFI_H)
|
CHECK_INCLUDE_FILE("ffi.h" HAVE_FFI_H)
|
||||||
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../linux)
|
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../linux)
|
||||||
ENDIF (UNIX)
|
ENDIF (UNIX)
|
||||||
IF(WIN32)
|
IF(WIN32)
|
||||||
ADD_DEFINITIONS(-DAMXEXPORT=__stdcall -DAMX_NATIVE_CALL=__stdcall -DSTDECL)
|
ADD_DEFINITIONS(-DAMXEXPORT=__stdcall -DAMX_NATIVE_CALL=__stdcall -DSTDECL)
|
||||||
IF(NOT BORLAND)
|
IF(NOT BORLAND)
|
||||||
LINK_LIBRARIES(winmm)
|
LINK_LIBRARIES(winmm)
|
||||||
ENDIF(NOT BORLAND)
|
ENDIF(NOT BORLAND)
|
||||||
ENDIF(WIN32)
|
ENDIF(WIN32)
|
||||||
|
|
||||||
# --------------------------------------------------------------------------
|
# --------------------------------------------------------------------------
|
||||||
# Extension modules
|
# Extension modules
|
||||||
|
|
||||||
# amxArgs
|
# amxArgs
|
||||||
SET(ARGS_SRCS amxargs.c amx.c)
|
SET(ARGS_SRCS amxargs.c amx.c)
|
||||||
ADD_LIBRARY(amxArgs SHARED ${ARGS_SRCS})
|
ADD_LIBRARY(amxArgs SHARED ${ARGS_SRCS})
|
||||||
SET_TARGET_PROPERTIES(amxArgs PROPERTIES PREFIX "")
|
SET_TARGET_PROPERTIES(amxArgs PROPERTIES PREFIX "")
|
||||||
IF(WIN32)
|
IF(WIN32)
|
||||||
SET(ARGS_SRCS ${ARGS_SRCS} dllmain.c amxargs.rc)
|
SET(ARGS_SRCS ${ARGS_SRCS} dllmain.c amxargs.rc)
|
||||||
IF(BORLAND)
|
IF(BORLAND)
|
||||||
# Borland linker uses a DEF file if one is in the output directory
|
# Borland linker uses a DEF file if one is in the output directory
|
||||||
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/amxargs.def ${CMAKE_BINARY_DIR}/amxargs.def COPY_ONLY)
|
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/amxargs.def ${CMAKE_BINARY_DIR}/amxargs.def COPY_ONLY)
|
||||||
ELSE(BORLAND)
|
ELSE(BORLAND)
|
||||||
# For Microsoft Visual C/C++ we can set explicit flags for exports
|
# For Microsoft Visual C/C++ we can set explicit flags for exports
|
||||||
SET_TARGET_PROPERTIES(amxArgs PROPERTIES LINK_FLAGS "/export:amx_ArgsInit /export:amx_ArgsCleanup /export:amx_ArgsSetCmdLine")
|
SET_TARGET_PROPERTIES(amxArgs PROPERTIES LINK_FLAGS "/export:amx_ArgsInit /export:amx_ArgsCleanup /export:amx_ArgsSetCmdLine")
|
||||||
ENDIF(BORLAND)
|
ENDIF(BORLAND)
|
||||||
ENDIF(WIN32)
|
ENDIF(WIN32)
|
||||||
IF(UNIX)
|
IF(UNIX)
|
||||||
ADD_CUSTOM_COMMAND(TARGET amxArgs POST_BUILD COMMAND strip ARGS -K amx_ArgsInit -K amx_ArgsCleanup -K amx_ArgsSetCmdLine ${CMAKE_BINARY_DIR}/amxArgs.so)
|
ADD_CUSTOM_COMMAND(TARGET amxArgs POST_BUILD COMMAND strip ARGS -K amx_ArgsInit -K amx_ArgsCleanup -K amx_ArgsSetCmdLine ${CMAKE_BINARY_DIR}/amxArgs.so)
|
||||||
ENDIF(UNIX)
|
ENDIF(UNIX)
|
||||||
|
|
||||||
# amxDGram
|
# amxDGram
|
||||||
SET(DGRAM_SRCS amxdgram.c amx.c)
|
SET(DGRAM_SRCS amxdgram.c amx.c)
|
||||||
ADD_LIBRARY(amxDGram SHARED ${DGRAM_SRCS})
|
ADD_LIBRARY(amxDGram SHARED ${DGRAM_SRCS})
|
||||||
SET_TARGET_PROPERTIES(amxDGram PROPERTIES PREFIX "")
|
SET_TARGET_PROPERTIES(amxDGram PROPERTIES PREFIX "")
|
||||||
IF(WIN32)
|
IF(WIN32)
|
||||||
SET(DGRAM_SRCS ${DGRAM_SRCS} dllmain.c amxargs.rc)
|
SET(DGRAM_SRCS ${DGRAM_SRCS} dllmain.c amxargs.rc)
|
||||||
IF(BORLAND)
|
IF(BORLAND)
|
||||||
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/amxdgram.def ${CMAKE_BINARY_DIR}/amxdgram.def COPY_ONLY)
|
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/amxdgram.def ${CMAKE_BINARY_DIR}/amxdgram.def COPY_ONLY)
|
||||||
ELSE(BORLAND)
|
ELSE(BORLAND)
|
||||||
SET_TARGET_PROPERTIES(amxDGram PROPERTIES LINK_FLAGS "/export:amx_DGramInit /export:amx_DGramCleanup")
|
SET_TARGET_PROPERTIES(amxDGram PROPERTIES LINK_FLAGS "/export:amx_DGramInit /export:amx_DGramCleanup")
|
||||||
ENDIF(BORLAND)
|
ENDIF(BORLAND)
|
||||||
ENDIF(WIN32)
|
ENDIF(WIN32)
|
||||||
IF(UNIX)
|
IF(UNIX)
|
||||||
ADD_CUSTOM_COMMAND(TARGET amxDGram POST_BUILD COMMAND strip ARGS -K amx_DGramInit -K amx_DGramCleanup ${CMAKE_BINARY_DIR}/amxDGram.so)
|
ADD_CUSTOM_COMMAND(TARGET amxDGram POST_BUILD COMMAND strip ARGS -K amx_DGramInit -K amx_DGramCleanup ${CMAKE_BINARY_DIR}/amxDGram.so)
|
||||||
ENDIF(UNIX)
|
ENDIF(UNIX)
|
||||||
|
|
||||||
# amxFile
|
# amxFile
|
||||||
SET(FILE_SRCS amxfile.c amx.c)
|
SET(FILE_SRCS amxfile.c amx.c)
|
||||||
ADD_LIBRARY(amxFile SHARED ${FILE_SRCS})
|
ADD_LIBRARY(amxFile SHARED ${FILE_SRCS})
|
||||||
SET_TARGET_PROPERTIES(amxFile PROPERTIES PREFIX "")
|
SET_TARGET_PROPERTIES(amxFile PROPERTIES PREFIX "")
|
||||||
IF(WIN32)
|
IF(WIN32)
|
||||||
SET(FILE_SRCS ${FILE_SRCS} dllmain.c amxfile.rc)
|
SET(FILE_SRCS ${FILE_SRCS} dllmain.c amxfile.rc)
|
||||||
IF(BORLAND)
|
IF(BORLAND)
|
||||||
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/amxfile.def ${CMAKE_BINARY_DIR}/amxfile.def COPY_ONLY)
|
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/amxfile.def ${CMAKE_BINARY_DIR}/amxfile.def COPY_ONLY)
|
||||||
ELSE(BORLAND)
|
ELSE(BORLAND)
|
||||||
SET_TARGET_PROPERTIES(amxFile PROPERTIES LINK_FLAGS "/export:amx_FileInit /export:amx_FileCleanup")
|
SET_TARGET_PROPERTIES(amxFile PROPERTIES LINK_FLAGS "/export:amx_FileInit /export:amx_FileCleanup")
|
||||||
ENDIF(BORLAND)
|
ENDIF(BORLAND)
|
||||||
ENDIF(WIN32)
|
ENDIF(WIN32)
|
||||||
IF(UNIX)
|
IF(UNIX)
|
||||||
ADD_CUSTOM_COMMAND(TARGET amxFile POST_BUILD COMMAND strip ARGS -K amx_FileInit -K amx_FileCleanup ${CMAKE_BINARY_DIR}/amxFile.so)
|
ADD_CUSTOM_COMMAND(TARGET amxFile POST_BUILD COMMAND strip ARGS -K amx_FileInit -K amx_FileCleanup ${CMAKE_BINARY_DIR}/amxFile.so)
|
||||||
ENDIF(UNIX)
|
ENDIF(UNIX)
|
||||||
|
|
||||||
# amxFixed
|
# amxFixed
|
||||||
SET(FIXED_SRCS fixed.c amx.c)
|
SET(FIXED_SRCS fixed.c amx.c)
|
||||||
ADD_LIBRARY(amxFixed SHARED ${FIXED_SRCS})
|
ADD_LIBRARY(amxFixed SHARED ${FIXED_SRCS})
|
||||||
SET_TARGET_PROPERTIES(amxFixed PROPERTIES PREFIX "")
|
SET_TARGET_PROPERTIES(amxFixed PROPERTIES PREFIX "")
|
||||||
IF(WIN32)
|
IF(WIN32)
|
||||||
SET(FIXED_SRCS ${FIXED_SRCS} dllmain.c amxfixed.rc)
|
SET(FIXED_SRCS ${FIXED_SRCS} dllmain.c amxfixed.rc)
|
||||||
IF(BORLAND)
|
IF(BORLAND)
|
||||||
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/amxfixed.def ${CMAKE_BINARY_DIR}/amxfixed.def COPY_ONLY)
|
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/amxfixed.def ${CMAKE_BINARY_DIR}/amxfixed.def COPY_ONLY)
|
||||||
ELSE(BORLAND)
|
ELSE(BORLAND)
|
||||||
SET_TARGET_PROPERTIES(amxFixed PROPERTIES LINK_FLAGS "/export:amx_FixedInit /export:amx_FixedCleanup")
|
SET_TARGET_PROPERTIES(amxFixed PROPERTIES LINK_FLAGS "/export:amx_FixedInit /export:amx_FixedCleanup")
|
||||||
ENDIF(BORLAND)
|
ENDIF(BORLAND)
|
||||||
ENDIF(WIN32)
|
ENDIF(WIN32)
|
||||||
IF(UNIX)
|
IF(UNIX)
|
||||||
TARGET_LINK_LIBRARIES(amxFixed m)
|
TARGET_LINK_LIBRARIES(amxFixed m)
|
||||||
ADD_CUSTOM_COMMAND(TARGET amxFixed POST_BUILD COMMAND strip ARGS -K amx_FixedInit -K amx_FixedCleanup ${CMAKE_BINARY_DIR}/amxFixed.so)
|
ADD_CUSTOM_COMMAND(TARGET amxFixed POST_BUILD COMMAND strip ARGS -K amx_FixedInit -K amx_FixedCleanup ${CMAKE_BINARY_DIR}/amxFixed.so)
|
||||||
ENDIF(UNIX)
|
ENDIF(UNIX)
|
||||||
|
|
||||||
# amxFloat
|
# amxFloat
|
||||||
SET(FLOAT_SRCS float.c amx.c)
|
SET(FLOAT_SRCS float.c amx.c)
|
||||||
ADD_LIBRARY(amxFloat SHARED ${FLOAT_SRCS})
|
ADD_LIBRARY(amxFloat SHARED ${FLOAT_SRCS})
|
||||||
SET_TARGET_PROPERTIES(amxFloat PROPERTIES PREFIX "")
|
SET_TARGET_PROPERTIES(amxFloat PROPERTIES PREFIX "")
|
||||||
IF(WIN32)
|
IF(WIN32)
|
||||||
SET(FLOAT_SRCS ${FLOAT_SRCS} dllmain.c amxfloat.rc)
|
SET(FLOAT_SRCS ${FLOAT_SRCS} dllmain.c amxfloat.rc)
|
||||||
IF(BORLAND)
|
IF(BORLAND)
|
||||||
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/amxfloat.def ${CMAKE_BINARY_DIR}/amxfloat.def COPY_ONLY)
|
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/amxfloat.def ${CMAKE_BINARY_DIR}/amxfloat.def COPY_ONLY)
|
||||||
ELSE(BORLAND)
|
ELSE(BORLAND)
|
||||||
SET_TARGET_PROPERTIES(amxFloat PROPERTIES LINK_FLAGS "/export:amx_FloatInit /export:amx_FloatCleanup")
|
SET_TARGET_PROPERTIES(amxFloat PROPERTIES LINK_FLAGS "/export:amx_FloatInit /export:amx_FloatCleanup")
|
||||||
ENDIF(BORLAND)
|
ENDIF(BORLAND)
|
||||||
ENDIF(WIN32)
|
ENDIF(WIN32)
|
||||||
IF(UNIX)
|
IF(UNIX)
|
||||||
TARGET_LINK_LIBRARIES(amxFloat m)
|
TARGET_LINK_LIBRARIES(amxFloat m)
|
||||||
ADD_CUSTOM_COMMAND(TARGET amxFloat POST_BUILD COMMAND strip ARGS -K amx_FloatInit -K amx_FloatInit ${CMAKE_BINARY_DIR}/amxFloat.so)
|
ADD_CUSTOM_COMMAND(TARGET amxFloat POST_BUILD COMMAND strip ARGS -K amx_FloatInit -K amx_FloatInit ${CMAKE_BINARY_DIR}/amxFloat.so)
|
||||||
ENDIF(UNIX)
|
ENDIF(UNIX)
|
||||||
|
|
||||||
# amxProcess
|
# amxProcess
|
||||||
SET(PROCESS_SRCS amxprocess.c amx.c)
|
SET(PROCESS_SRCS amxprocess.c amx.c)
|
||||||
IF(WIN32)
|
IF(WIN32)
|
||||||
ADD_LIBRARY(amxProcess SHARED ${PROCESS_SRCS})
|
ADD_LIBRARY(amxProcess SHARED ${PROCESS_SRCS})
|
||||||
ELSE(WIN32)
|
ELSE(WIN32)
|
||||||
IF(HAVE_FFI_H)
|
IF(HAVE_FFI_H)
|
||||||
ADD_LIBRARY(amxProcess SHARED ${PROCESS_SRCS})
|
ADD_LIBRARY(amxProcess SHARED ${PROCESS_SRCS})
|
||||||
ELSE(HAVE_FFI_H)
|
ELSE(HAVE_FFI_H)
|
||||||
MESSAGE(SEND_ERROR "amxProcess requires libffi; see http://sources.redhat.com/libffi/")
|
MESSAGE(SEND_ERROR "amxProcess requires libffi; see http://sources.redhat.com/libffi/")
|
||||||
MESSAGE(SEND_ERROR "libffi is not available (foreign function interface)")
|
MESSAGE(SEND_ERROR "libffi is not available (foreign function interface)")
|
||||||
ENDIF(HAVE_FFI_H)
|
ENDIF(HAVE_FFI_H)
|
||||||
ENDIF(WIN32)
|
ENDIF(WIN32)
|
||||||
SET_TARGET_PROPERTIES(amxProcess PROPERTIES PREFIX "")
|
SET_TARGET_PROPERTIES(amxProcess PROPERTIES PREFIX "")
|
||||||
IF(WIN32)
|
IF(WIN32)
|
||||||
SET(PROCESS_SRCS ${PROCESS_SRCS} dllmain.c amxprocess.rc)
|
SET(PROCESS_SRCS ${PROCESS_SRCS} dllmain.c amxprocess.rc)
|
||||||
IF(BORLAND)
|
IF(BORLAND)
|
||||||
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/amxprocess.def ${CMAKE_BINARY_DIR}/amxprocess.def COPY_ONLY)
|
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/amxprocess.def ${CMAKE_BINARY_DIR}/amxprocess.def COPY_ONLY)
|
||||||
ELSE(BORLAND)
|
ELSE(BORLAND)
|
||||||
SET_TARGET_PROPERTIES(amxProcess PROPERTIES LINK_FLAGS "/export:amx_ProcessInit /export:amx_ProcessCleanup")
|
SET_TARGET_PROPERTIES(amxProcess PROPERTIES LINK_FLAGS "/export:amx_ProcessInit /export:amx_ProcessCleanup")
|
||||||
ENDIF(BORLAND)
|
ENDIF(BORLAND)
|
||||||
ENDIF(WIN32)
|
ENDIF(WIN32)
|
||||||
IF(UNIX)
|
IF(UNIX)
|
||||||
TARGET_LINK_LIBRARIES(amxProcess dl)
|
TARGET_LINK_LIBRARIES(amxProcess dl)
|
||||||
ADD_CUSTOM_COMMAND(TARGET amxProcess POST_BUILD COMMAND strip ARGS -K amx_ProcessInit -K amx_ProcessCleanup ${CMAKE_BINARY_DIR}/amxProcess.so)
|
ADD_CUSTOM_COMMAND(TARGET amxProcess POST_BUILD COMMAND strip ARGS -K amx_ProcessInit -K amx_ProcessCleanup ${CMAKE_BINARY_DIR}/amxProcess.so)
|
||||||
ENDIF(UNIX)
|
ENDIF(UNIX)
|
||||||
|
|
||||||
# amxString
|
# amxString
|
||||||
SET(STRING_SRCS amxstring.c amx.c amxcons.c)
|
SET(STRING_SRCS amxstring.c amx.c amxcons.c)
|
||||||
ADD_LIBRARY(amxString SHARED ${STRING_SRCS})
|
ADD_LIBRARY(amxString SHARED ${STRING_SRCS})
|
||||||
SET_TARGET_PROPERTIES(amxString PROPERTIES PREFIX "")
|
SET_TARGET_PROPERTIES(amxString PROPERTIES PREFIX "")
|
||||||
IF(WIN32)
|
IF(WIN32)
|
||||||
SET(STRING_SRCS ${STRING_SRCS} dllmain.c amxstring.rc)
|
SET(STRING_SRCS ${STRING_SRCS} dllmain.c amxstring.rc)
|
||||||
IF(BORLAND)
|
IF(BORLAND)
|
||||||
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/amxstring.def ${CMAKE_BINARY_DIR}/amxstring.def COPY_ONLY)
|
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/amxstring.def ${CMAKE_BINARY_DIR}/amxstring.def COPY_ONLY)
|
||||||
ELSE(BORLAND)
|
ELSE(BORLAND)
|
||||||
SET_TARGET_PROPERTIES(amxString PROPERTIES LINK_FLAGS "/export:amx_StringInit /export:amx_StringCleanup")
|
SET_TARGET_PROPERTIES(amxString PROPERTIES LINK_FLAGS "/export:amx_StringInit /export:amx_StringCleanup")
|
||||||
ENDIF(BORLAND)
|
ENDIF(BORLAND)
|
||||||
ENDIF(WIN32)
|
ENDIF(WIN32)
|
||||||
IF(UNIX)
|
IF(UNIX)
|
||||||
ADD_CUSTOM_COMMAND(TARGET amxString POST_BUILD COMMAND strip ARGS -K amx_StringInit -K amx_StringCleanup ${CMAKE_BINARY_DIR}/amxString.so)
|
ADD_CUSTOM_COMMAND(TARGET amxString POST_BUILD COMMAND strip ARGS -K amx_StringInit -K amx_StringCleanup ${CMAKE_BINARY_DIR}/amxString.so)
|
||||||
ENDIF(UNIX)
|
ENDIF(UNIX)
|
||||||
|
|
||||||
# amxTime
|
# amxTime
|
||||||
SET(TIME_SRCS amxtime.c amx.c)
|
SET(TIME_SRCS amxtime.c amx.c)
|
||||||
ADD_LIBRARY(amxTime SHARED ${TIME_SRCS})
|
ADD_LIBRARY(amxTime SHARED ${TIME_SRCS})
|
||||||
SET_TARGET_PROPERTIES(amxTime PROPERTIES PREFIX "")
|
SET_TARGET_PROPERTIES(amxTime PROPERTIES PREFIX "")
|
||||||
IF(WIN32)
|
IF(WIN32)
|
||||||
SET(TIME_SRCS ${TIME_SRCS} dllmain.c amxtime.rc)
|
SET(TIME_SRCS ${TIME_SRCS} dllmain.c amxtime.rc)
|
||||||
IF(BORLAND)
|
IF(BORLAND)
|
||||||
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/amxtime.def ${CMAKE_BINARY_DIR}/amxtime.def COPY_ONLY)
|
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/amxtime.def ${CMAKE_BINARY_DIR}/amxtime.def COPY_ONLY)
|
||||||
ELSE(BORLAND)
|
ELSE(BORLAND)
|
||||||
SET_TARGET_PROPERTIES(amxTime PROPERTIES LINK_FLAGS "/export:amx_TimeInit /export:amx_TimeCleanup")
|
SET_TARGET_PROPERTIES(amxTime PROPERTIES LINK_FLAGS "/export:amx_TimeInit /export:amx_TimeCleanup")
|
||||||
ENDIF(BORLAND)
|
ENDIF(BORLAND)
|
||||||
ENDIF(WIN32)
|
ENDIF(WIN32)
|
||||||
IF(UNIX)
|
IF(UNIX)
|
||||||
ADD_CUSTOM_COMMAND(TARGET amxTime POST_BUILD COMMAND strip ARGS -K amx_TimeInit -K amx_TimeCleanup ${CMAKE_BINARY_DIR}/amxTime.so)
|
ADD_CUSTOM_COMMAND(TARGET amxTime POST_BUILD COMMAND strip ARGS -K amx_TimeInit -K amx_TimeCleanup ${CMAKE_BINARY_DIR}/amxTime.so)
|
||||||
ENDIF(UNIX)
|
ENDIF(UNIX)
|
||||||
|
|
||||||
# --------------------------------------------------------------------------
|
# --------------------------------------------------------------------------
|
||||||
# Simple run-time (example program)
|
# Simple run-time (example program)
|
||||||
|
|
||||||
SET(PAWNRUN_SRCS pawnrun.c amx.c amxcore.c amxcons.c amxdbg.c)
|
SET(PAWNRUN_SRCS pawnrun.c amx.c amxcore.c amxcons.c amxdbg.c)
|
||||||
IF (UNIX)
|
IF (UNIX)
|
||||||
SET(PAWNRUN_SRCS ${PAWNRUN_SRCS} ${CMAKE_CURRENT_SOURCE_DIR}/../linux/getch.c ${CMAKE_CURRENT_SOURCE_DIR}/../linux/binreloc.c)
|
SET(PAWNRUN_SRCS ${PAWNRUN_SRCS} ${CMAKE_CURRENT_SOURCE_DIR}/../linux/getch.c ${CMAKE_CURRENT_SOURCE_DIR}/../linux/binreloc.c)
|
||||||
ENDIF (UNIX)
|
ENDIF (UNIX)
|
||||||
ADD_EXECUTABLE(pawnrun ${PAWNRUN_SRCS})
|
ADD_EXECUTABLE(pawnrun ${PAWNRUN_SRCS})
|
||||||
SET_TARGET_PROPERTIES(pawnrun PROPERTIES COMPILE_FLAGS -DAMXDBG COMPILE_FLAGS -DENABLE_BINRELOC)
|
SET_TARGET_PROPERTIES(pawnrun PROPERTIES COMPILE_FLAGS -DAMXDBG COMPILE_FLAGS -DENABLE_BINRELOC)
|
||||||
IF (UNIX)
|
IF (UNIX)
|
||||||
TARGET_LINK_LIBRARIES(pawnrun dl)
|
TARGET_LINK_LIBRARIES(pawnrun dl)
|
||||||
ENDIF (UNIX)
|
ENDIF (UNIX)
|
||||||
|
|
||||||
# --------------------------------------------------------------------------
|
# --------------------------------------------------------------------------
|
||||||
# Simple console debugger
|
# Simple console debugger
|
||||||
|
|
||||||
SET(PAWNDBG_SRCS pawndbg.c amx.c amxcore.c amxcons.c amxdbg.c)
|
SET(PAWNDBG_SRCS pawndbg.c amx.c amxcore.c amxcons.c amxdbg.c)
|
||||||
IF (UNIX)
|
IF (UNIX)
|
||||||
SET(PAWNDBG_SRCS ${PAWNDBG_SRCS} ${CMAKE_CURRENT_SOURCE_DIR}/../linux/getch.c ${CMAKE_CURRENT_SOURCE_DIR}/../linux/binreloc.c)
|
SET(PAWNDBG_SRCS ${PAWNDBG_SRCS} ${CMAKE_CURRENT_SOURCE_DIR}/../linux/getch.c ${CMAKE_CURRENT_SOURCE_DIR}/../linux/binreloc.c)
|
||||||
ENDIF (UNIX)
|
ENDIF (UNIX)
|
||||||
ADD_EXECUTABLE(pawndbg ${PAWNDBG_SRCS})
|
ADD_EXECUTABLE(pawndbg ${PAWNDBG_SRCS})
|
||||||
SET_TARGET_PROPERTIES(pawndbg PROPERTIES COMPILE_FLAGS -DENABLE_BINRELOC)
|
SET_TARGET_PROPERTIES(pawndbg PROPERTIES COMPILE_FLAGS -DENABLE_BINRELOC)
|
||||||
IF (UNIX)
|
IF (UNIX)
|
||||||
TARGET_LINK_LIBRARIES(pawndbg dl)
|
TARGET_LINK_LIBRARIES(pawndbg dl)
|
||||||
ENDIF (UNIX)
|
ENDIF (UNIX)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
NAME amxDGram
|
NAME amxDGram
|
||||||
DESCRIPTION 'Pawn AMX: network datagram'
|
DESCRIPTION 'Pawn AMX: network datagram'
|
||||||
|
|
||||||
EXPORTS
|
EXPORTS
|
||||||
amx_DGramInit
|
amx_DGramInit
|
||||||
amx_DGramCleanup
|
amx_DGramCleanup
|
||||||
|
@ -1,54 +1,54 @@
|
|||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#if defined WIN32 || defined _WIN32 || defined __WIN32__
|
#if defined WIN32 || defined _WIN32 || defined __WIN32__
|
||||||
# include <winver.h>
|
# include <winver.h>
|
||||||
#else
|
#else
|
||||||
# include <ver.h>
|
# include <ver.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Version information
|
/* Version information
|
||||||
*
|
*
|
||||||
* All strings MUST have an explicit \0. See the Windows SDK documentation
|
* All strings MUST have an explicit \0. See the Windows SDK documentation
|
||||||
* for details on version information and the VERSIONINFO structure.
|
* for details on version information and the VERSIONINFO structure.
|
||||||
*/
|
*/
|
||||||
#define VERSION 1
|
#define VERSION 1
|
||||||
#define REVISION 0
|
#define REVISION 0
|
||||||
#define BUILD 0
|
#define BUILD 0
|
||||||
#define VERSIONSTR "1.0.0\0"
|
#define VERSIONSTR "1.0.0\0"
|
||||||
#define VERSIONNAME "amxDGram.dll\0"
|
#define VERSIONNAME "amxDGram.dll\0"
|
||||||
#define VERSIONDESCRIPTION "Pawn AMX: network datagram\0"
|
#define VERSIONDESCRIPTION "Pawn AMX: network datagram\0"
|
||||||
#define VERSIONCOMPANYNAME "ITB CompuPhase\0"
|
#define VERSIONCOMPANYNAME "ITB CompuPhase\0"
|
||||||
#define VERSIONPRODUCTNAME "amxDGram\0"
|
#define VERSIONPRODUCTNAME "amxDGram\0"
|
||||||
#define VERSIONCOPYRIGHT "Copyright \251 2006 ITB CompuPhase\0"
|
#define VERSIONCOPYRIGHT "Copyright \251 2006 ITB CompuPhase\0"
|
||||||
|
|
||||||
VS_VERSION_INFO VERSIONINFO
|
VS_VERSION_INFO VERSIONINFO
|
||||||
FILEVERSION VERSION, REVISION, BUILD, 0
|
FILEVERSION VERSION, REVISION, BUILD, 0
|
||||||
PRODUCTVERSION VERSION, REVISION, BUILD, 0
|
PRODUCTVERSION VERSION, REVISION, BUILD, 0
|
||||||
FILEFLAGSMASK 0x0000003FL
|
FILEFLAGSMASK 0x0000003FL
|
||||||
FILEFLAGS 0
|
FILEFLAGS 0
|
||||||
#if defined(WIN32)
|
#if defined(WIN32)
|
||||||
FILEOS VOS__WINDOWS32
|
FILEOS VOS__WINDOWS32
|
||||||
#else
|
#else
|
||||||
FILEOS VOS__WINDOWS16
|
FILEOS VOS__WINDOWS16
|
||||||
#endif
|
#endif
|
||||||
FILETYPE VFT_DLL
|
FILETYPE VFT_DLL
|
||||||
BEGIN
|
BEGIN
|
||||||
BLOCK "StringFileInfo"
|
BLOCK "StringFileInfo"
|
||||||
BEGIN
|
BEGIN
|
||||||
BLOCK "040904E4"
|
BLOCK "040904E4"
|
||||||
BEGIN
|
BEGIN
|
||||||
VALUE "CompanyName", VERSIONCOMPANYNAME
|
VALUE "CompanyName", VERSIONCOMPANYNAME
|
||||||
VALUE "FileDescription", VERSIONDESCRIPTION
|
VALUE "FileDescription", VERSIONDESCRIPTION
|
||||||
VALUE "FileVersion", VERSIONSTR
|
VALUE "FileVersion", VERSIONSTR
|
||||||
VALUE "InternalName", VERSIONNAME
|
VALUE "InternalName", VERSIONNAME
|
||||||
VALUE "LegalCopyright", VERSIONCOPYRIGHT
|
VALUE "LegalCopyright", VERSIONCOPYRIGHT
|
||||||
VALUE "OriginalFilename", VERSIONNAME
|
VALUE "OriginalFilename", VERSIONNAME
|
||||||
VALUE "ProductName", VERSIONPRODUCTNAME
|
VALUE "ProductName", VERSIONPRODUCTNAME
|
||||||
VALUE "ProductVersion", VERSIONSTR
|
VALUE "ProductVersion", VERSIONSTR
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
|
|
||||||
BLOCK "VarFileInfo"
|
BLOCK "VarFileInfo"
|
||||||
BEGIN
|
BEGIN
|
||||||
VALUE "Translation", 0x409, 1252
|
VALUE "Translation", 0x409, 1252
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
|
@ -1,54 +1,54 @@
|
|||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#if defined WIN32 || defined _WIN32 || defined __WIN32__
|
#if defined WIN32 || defined _WIN32 || defined __WIN32__
|
||||||
# include <winver.h>
|
# include <winver.h>
|
||||||
#else
|
#else
|
||||||
# include <ver.h>
|
# include <ver.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Version information
|
/* Version information
|
||||||
*
|
*
|
||||||
* All strings MUST have an explicit \0. See the Windows SDK documentation
|
* All strings MUST have an explicit \0. See the Windows SDK documentation
|
||||||
* for details on version information and the VERSIONINFO structure.
|
* for details on version information and the VERSIONINFO structure.
|
||||||
*/
|
*/
|
||||||
#define VERSION 1
|
#define VERSION 1
|
||||||
#define REVISION 1
|
#define REVISION 1
|
||||||
#define BUILD 0
|
#define BUILD 0
|
||||||
#define VERSIONSTR "1.1.0\0"
|
#define VERSIONSTR "1.1.0\0"
|
||||||
#define VERSIONNAME "amxFile.dll\0"
|
#define VERSIONNAME "amxFile.dll\0"
|
||||||
#define VERSIONDESCRIPTION "Pawn AMX: File I/O support\0"
|
#define VERSIONDESCRIPTION "Pawn AMX: File I/O support\0"
|
||||||
#define VERSIONCOMPANYNAME "ITB CompuPhase\0"
|
#define VERSIONCOMPANYNAME "ITB CompuPhase\0"
|
||||||
#define VERSIONPRODUCTNAME "amxFile\0"
|
#define VERSIONPRODUCTNAME "amxFile\0"
|
||||||
#define VERSIONCOPYRIGHT "Copyright \251 2004-2006 ITB CompuPhase\0"
|
#define VERSIONCOPYRIGHT "Copyright \251 2004-2006 ITB CompuPhase\0"
|
||||||
|
|
||||||
VS_VERSION_INFO VERSIONINFO
|
VS_VERSION_INFO VERSIONINFO
|
||||||
FILEVERSION VERSION, REVISION, BUILD, 0
|
FILEVERSION VERSION, REVISION, BUILD, 0
|
||||||
PRODUCTVERSION VERSION, REVISION, BUILD, 0
|
PRODUCTVERSION VERSION, REVISION, BUILD, 0
|
||||||
FILEFLAGSMASK 0x0000003FL
|
FILEFLAGSMASK 0x0000003FL
|
||||||
FILEFLAGS 0
|
FILEFLAGS 0
|
||||||
#if defined(WIN32)
|
#if defined(WIN32)
|
||||||
FILEOS VOS__WINDOWS32
|
FILEOS VOS__WINDOWS32
|
||||||
#else
|
#else
|
||||||
FILEOS VOS__WINDOWS16
|
FILEOS VOS__WINDOWS16
|
||||||
#endif
|
#endif
|
||||||
FILETYPE VFT_DLL
|
FILETYPE VFT_DLL
|
||||||
BEGIN
|
BEGIN
|
||||||
BLOCK "StringFileInfo"
|
BLOCK "StringFileInfo"
|
||||||
BEGIN
|
BEGIN
|
||||||
BLOCK "040904E4"
|
BLOCK "040904E4"
|
||||||
BEGIN
|
BEGIN
|
||||||
VALUE "CompanyName", VERSIONCOMPANYNAME
|
VALUE "CompanyName", VERSIONCOMPANYNAME
|
||||||
VALUE "FileDescription", VERSIONDESCRIPTION
|
VALUE "FileDescription", VERSIONDESCRIPTION
|
||||||
VALUE "FileVersion", VERSIONSTR
|
VALUE "FileVersion", VERSIONSTR
|
||||||
VALUE "InternalName", VERSIONNAME
|
VALUE "InternalName", VERSIONNAME
|
||||||
VALUE "LegalCopyright", VERSIONCOPYRIGHT
|
VALUE "LegalCopyright", VERSIONCOPYRIGHT
|
||||||
VALUE "OriginalFilename", VERSIONNAME
|
VALUE "OriginalFilename", VERSIONNAME
|
||||||
VALUE "ProductName", VERSIONPRODUCTNAME
|
VALUE "ProductName", VERSIONPRODUCTNAME
|
||||||
VALUE "ProductVersion", VERSIONSTR
|
VALUE "ProductVersion", VERSIONSTR
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
|
|
||||||
BLOCK "VarFileInfo"
|
BLOCK "VarFileInfo"
|
||||||
BEGIN
|
BEGIN
|
||||||
VALUE "Translation", 0x409, 1252
|
VALUE "Translation", 0x409, 1252
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
NAME amxFixed
|
NAME amxFixed
|
||||||
DESCRIPTION 'Pawn AMX: fixed-point arithmetic'
|
DESCRIPTION 'Pawn AMX: fixed-point arithmetic'
|
||||||
|
|
||||||
EXPORTS
|
EXPORTS
|
||||||
amx_FixedInit
|
amx_FixedInit
|
||||||
amx_FixedCleanup
|
amx_FixedCleanup
|
||||||
|
@ -1,54 +1,54 @@
|
|||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#if defined WIN32 || defined _WIN32 || defined __WIN32__
|
#if defined WIN32 || defined _WIN32 || defined __WIN32__
|
||||||
# include <winver.h>
|
# include <winver.h>
|
||||||
#else
|
#else
|
||||||
# include <ver.h>
|
# include <ver.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Version information
|
/* Version information
|
||||||
*
|
*
|
||||||
* All strings MUST have an explicit \0. See the Windows SDK documentation
|
* All strings MUST have an explicit \0. See the Windows SDK documentation
|
||||||
* for details on version information and the VERSIONINFO structure.
|
* for details on version information and the VERSIONINFO structure.
|
||||||
*/
|
*/
|
||||||
#define VERSION 1
|
#define VERSION 1
|
||||||
#define REVISION 0
|
#define REVISION 0
|
||||||
#define BUILD 0
|
#define BUILD 0
|
||||||
#define VERSIONSTR "1.0.0\0"
|
#define VERSIONSTR "1.0.0\0"
|
||||||
#define VERSIONNAME "amxFixed.dll\0"
|
#define VERSIONNAME "amxFixed.dll\0"
|
||||||
#define VERSIONDESCRIPTION "Pawn AMX: Fixed Point support\0"
|
#define VERSIONDESCRIPTION "Pawn AMX: Fixed Point support\0"
|
||||||
#define VERSIONCOMPANYNAME "ITB CompuPhase\0"
|
#define VERSIONCOMPANYNAME "ITB CompuPhase\0"
|
||||||
#define VERSIONPRODUCTNAME "amxFixed\0"
|
#define VERSIONPRODUCTNAME "amxFixed\0"
|
||||||
#define VERSIONCOPYRIGHT "Copyright \251 2003-2006 ITB CompuPhase\0"
|
#define VERSIONCOPYRIGHT "Copyright \251 2003-2006 ITB CompuPhase\0"
|
||||||
|
|
||||||
VS_VERSION_INFO VERSIONINFO
|
VS_VERSION_INFO VERSIONINFO
|
||||||
FILEVERSION VERSION, REVISION, BUILD, 0
|
FILEVERSION VERSION, REVISION, BUILD, 0
|
||||||
PRODUCTVERSION VERSION, REVISION, BUILD, 0
|
PRODUCTVERSION VERSION, REVISION, BUILD, 0
|
||||||
FILEFLAGSMASK 0x0000003FL
|
FILEFLAGSMASK 0x0000003FL
|
||||||
FILEFLAGS 0
|
FILEFLAGS 0
|
||||||
#if defined(WIN32)
|
#if defined(WIN32)
|
||||||
FILEOS VOS__WINDOWS32
|
FILEOS VOS__WINDOWS32
|
||||||
#else
|
#else
|
||||||
FILEOS VOS__WINDOWS16
|
FILEOS VOS__WINDOWS16
|
||||||
#endif
|
#endif
|
||||||
FILETYPE VFT_DLL
|
FILETYPE VFT_DLL
|
||||||
BEGIN
|
BEGIN
|
||||||
BLOCK "StringFileInfo"
|
BLOCK "StringFileInfo"
|
||||||
BEGIN
|
BEGIN
|
||||||
BLOCK "040904E4"
|
BLOCK "040904E4"
|
||||||
BEGIN
|
BEGIN
|
||||||
VALUE "CompanyName", VERSIONCOMPANYNAME
|
VALUE "CompanyName", VERSIONCOMPANYNAME
|
||||||
VALUE "FileDescription", VERSIONDESCRIPTION
|
VALUE "FileDescription", VERSIONDESCRIPTION
|
||||||
VALUE "FileVersion", VERSIONSTR
|
VALUE "FileVersion", VERSIONSTR
|
||||||
VALUE "InternalName", VERSIONNAME
|
VALUE "InternalName", VERSIONNAME
|
||||||
VALUE "LegalCopyright", VERSIONCOPYRIGHT
|
VALUE "LegalCopyright", VERSIONCOPYRIGHT
|
||||||
VALUE "OriginalFilename", VERSIONNAME
|
VALUE "OriginalFilename", VERSIONNAME
|
||||||
VALUE "ProductName", VERSIONPRODUCTNAME
|
VALUE "ProductName", VERSIONPRODUCTNAME
|
||||||
VALUE "ProductVersion", VERSIONSTR
|
VALUE "ProductVersion", VERSIONSTR
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
|
|
||||||
BLOCK "VarFileInfo"
|
BLOCK "VarFileInfo"
|
||||||
BEGIN
|
BEGIN
|
||||||
VALUE "Translation", 0x409, 1252
|
VALUE "Translation", 0x409, 1252
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
NAME amxFloat
|
NAME amxFloat
|
||||||
DESCRIPTION 'Pawn AMX: floating-point arithmetic'
|
DESCRIPTION 'Pawn AMX: floating-point arithmetic'
|
||||||
|
|
||||||
EXPORTS
|
EXPORTS
|
||||||
amx_FloatInit
|
amx_FloatInit
|
||||||
amx_FloatCleanup
|
amx_FloatCleanup
|
||||||
|
@ -1,54 +1,54 @@
|
|||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#if defined WIN32 || defined _WIN32 || defined __WIN32__
|
#if defined WIN32 || defined _WIN32 || defined __WIN32__
|
||||||
# include <winver.h>
|
# include <winver.h>
|
||||||
#else
|
#else
|
||||||
# include <ver.h>
|
# include <ver.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Version information
|
/* Version information
|
||||||
*
|
*
|
||||||
* All strings MUST have an explicit \0. See the Windows SDK documentation
|
* All strings MUST have an explicit \0. See the Windows SDK documentation
|
||||||
* for details on version information and the VERSIONINFO structure.
|
* for details on version information and the VERSIONINFO structure.
|
||||||
*/
|
*/
|
||||||
#define VERSION 1
|
#define VERSION 1
|
||||||
#define REVISION 0
|
#define REVISION 0
|
||||||
#define BUILD 0
|
#define BUILD 0
|
||||||
#define VERSIONSTR "1.0.0\0"
|
#define VERSIONSTR "1.0.0\0"
|
||||||
#define VERSIONNAME "amxFloat.dll\0"
|
#define VERSIONNAME "amxFloat.dll\0"
|
||||||
#define VERSIONDESCRIPTION "Pawn AMX: Floating Point support\0"
|
#define VERSIONDESCRIPTION "Pawn AMX: Floating Point support\0"
|
||||||
#define VERSIONCOMPANYNAME "ITB CompuPhase\0"
|
#define VERSIONCOMPANYNAME "ITB CompuPhase\0"
|
||||||
#define VERSIONPRODUCTNAME "amxFloat\0"
|
#define VERSIONPRODUCTNAME "amxFloat\0"
|
||||||
#define VERSIONCOPYRIGHT "Copyright \251 2003-2006 ITB CompuPhase\0"
|
#define VERSIONCOPYRIGHT "Copyright \251 2003-2006 ITB CompuPhase\0"
|
||||||
|
|
||||||
VS_VERSION_INFO VERSIONINFO
|
VS_VERSION_INFO VERSIONINFO
|
||||||
FILEVERSION VERSION, REVISION, BUILD, 0
|
FILEVERSION VERSION, REVISION, BUILD, 0
|
||||||
PRODUCTVERSION VERSION, REVISION, BUILD, 0
|
PRODUCTVERSION VERSION, REVISION, BUILD, 0
|
||||||
FILEFLAGSMASK 0x0000003FL
|
FILEFLAGSMASK 0x0000003FL
|
||||||
FILEFLAGS 0
|
FILEFLAGS 0
|
||||||
#if defined(WIN32)
|
#if defined(WIN32)
|
||||||
FILEOS VOS__WINDOWS32
|
FILEOS VOS__WINDOWS32
|
||||||
#else
|
#else
|
||||||
FILEOS VOS__WINDOWS16
|
FILEOS VOS__WINDOWS16
|
||||||
#endif
|
#endif
|
||||||
FILETYPE VFT_DLL
|
FILETYPE VFT_DLL
|
||||||
BEGIN
|
BEGIN
|
||||||
BLOCK "StringFileInfo"
|
BLOCK "StringFileInfo"
|
||||||
BEGIN
|
BEGIN
|
||||||
BLOCK "040904E4"
|
BLOCK "040904E4"
|
||||||
BEGIN
|
BEGIN
|
||||||
VALUE "CompanyName", VERSIONCOMPANYNAME
|
VALUE "CompanyName", VERSIONCOMPANYNAME
|
||||||
VALUE "FileDescription", VERSIONDESCRIPTION
|
VALUE "FileDescription", VERSIONDESCRIPTION
|
||||||
VALUE "FileVersion", VERSIONSTR
|
VALUE "FileVersion", VERSIONSTR
|
||||||
VALUE "InternalName", VERSIONNAME
|
VALUE "InternalName", VERSIONNAME
|
||||||
VALUE "LegalCopyright", VERSIONCOPYRIGHT
|
VALUE "LegalCopyright", VERSIONCOPYRIGHT
|
||||||
VALUE "OriginalFilename", VERSIONNAME
|
VALUE "OriginalFilename", VERSIONNAME
|
||||||
VALUE "ProductName", VERSIONPRODUCTNAME
|
VALUE "ProductName", VERSIONPRODUCTNAME
|
||||||
VALUE "ProductVersion", VERSIONSTR
|
VALUE "ProductVersion", VERSIONSTR
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
|
|
||||||
BLOCK "VarFileInfo"
|
BLOCK "VarFileInfo"
|
||||||
BEGIN
|
BEGIN
|
||||||
VALUE "Translation", 0x409, 1252
|
VALUE "Translation", 0x409, 1252
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
NAME amxProcess
|
NAME amxProcess
|
||||||
DESCRIPTION 'Pawn AMX: process control and foreign function interface'
|
DESCRIPTION 'Pawn AMX: process control and foreign function interface'
|
||||||
|
|
||||||
EXPORTS
|
EXPORTS
|
||||||
amx_ProcessInit
|
amx_ProcessInit
|
||||||
amx_ProcessCleanup
|
amx_ProcessCleanup
|
||||||
|
@ -1,54 +1,54 @@
|
|||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#if defined WIN32 || defined _WIN32 || defined __WIN32__
|
#if defined WIN32 || defined _WIN32 || defined __WIN32__
|
||||||
# include <winver.h>
|
# include <winver.h>
|
||||||
#else
|
#else
|
||||||
# include <ver.h>
|
# include <ver.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Version information
|
/* Version information
|
||||||
*
|
*
|
||||||
* All strings MUST have an explicit \0. See the Windows SDK documentation
|
* All strings MUST have an explicit \0. See the Windows SDK documentation
|
||||||
* for details on version information and the VERSIONINFO structure.
|
* for details on version information and the VERSIONINFO structure.
|
||||||
*/
|
*/
|
||||||
#define VERSION 1
|
#define VERSION 1
|
||||||
#define REVISION 0
|
#define REVISION 0
|
||||||
#define BUILD 0
|
#define BUILD 0
|
||||||
#define VERSIONSTR "1.0.0\0"
|
#define VERSIONSTR "1.0.0\0"
|
||||||
#define VERSIONNAME "amxProcess.dll\0"
|
#define VERSIONNAME "amxProcess.dll\0"
|
||||||
#define VERSIONDESCRIPTION "Pawn AMX: process control and foreign function interface\0"
|
#define VERSIONDESCRIPTION "Pawn AMX: process control and foreign function interface\0"
|
||||||
#define VERSIONCOMPANYNAME "ITB CompuPhase\0"
|
#define VERSIONCOMPANYNAME "ITB CompuPhase\0"
|
||||||
#define VERSIONPRODUCTNAME "amxProcess\0"
|
#define VERSIONPRODUCTNAME "amxProcess\0"
|
||||||
#define VERSIONCOPYRIGHT "Copyright \251 2005-2006 ITB CompuPhase\0"
|
#define VERSIONCOPYRIGHT "Copyright \251 2005-2006 ITB CompuPhase\0"
|
||||||
|
|
||||||
VS_VERSION_INFO VERSIONINFO
|
VS_VERSION_INFO VERSIONINFO
|
||||||
FILEVERSION VERSION, REVISION, BUILD, 0
|
FILEVERSION VERSION, REVISION, BUILD, 0
|
||||||
PRODUCTVERSION VERSION, REVISION, BUILD, 0
|
PRODUCTVERSION VERSION, REVISION, BUILD, 0
|
||||||
FILEFLAGSMASK 0x0000003FL
|
FILEFLAGSMASK 0x0000003FL
|
||||||
FILEFLAGS 0
|
FILEFLAGS 0
|
||||||
#if defined(WIN32)
|
#if defined(WIN32)
|
||||||
FILEOS VOS__WINDOWS32
|
FILEOS VOS__WINDOWS32
|
||||||
#else
|
#else
|
||||||
FILEOS VOS__WINDOWS16
|
FILEOS VOS__WINDOWS16
|
||||||
#endif
|
#endif
|
||||||
FILETYPE VFT_DLL
|
FILETYPE VFT_DLL
|
||||||
BEGIN
|
BEGIN
|
||||||
BLOCK "StringFileInfo"
|
BLOCK "StringFileInfo"
|
||||||
BEGIN
|
BEGIN
|
||||||
BLOCK "040904E4"
|
BLOCK "040904E4"
|
||||||
BEGIN
|
BEGIN
|
||||||
VALUE "CompanyName", VERSIONCOMPANYNAME
|
VALUE "CompanyName", VERSIONCOMPANYNAME
|
||||||
VALUE "FileDescription", VERSIONDESCRIPTION
|
VALUE "FileDescription", VERSIONDESCRIPTION
|
||||||
VALUE "FileVersion", VERSIONSTR
|
VALUE "FileVersion", VERSIONSTR
|
||||||
VALUE "InternalName", VERSIONNAME
|
VALUE "InternalName", VERSIONNAME
|
||||||
VALUE "LegalCopyright", VERSIONCOPYRIGHT
|
VALUE "LegalCopyright", VERSIONCOPYRIGHT
|
||||||
VALUE "OriginalFilename", VERSIONNAME
|
VALUE "OriginalFilename", VERSIONNAME
|
||||||
VALUE "ProductName", VERSIONPRODUCTNAME
|
VALUE "ProductName", VERSIONPRODUCTNAME
|
||||||
VALUE "ProductVersion", VERSIONSTR
|
VALUE "ProductVersion", VERSIONSTR
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
|
|
||||||
BLOCK "VarFileInfo"
|
BLOCK "VarFileInfo"
|
||||||
BEGIN
|
BEGIN
|
||||||
VALUE "Translation", 0x409, 1252
|
VALUE "Translation", 0x409, 1252
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
|
@ -1,54 +1,54 @@
|
|||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#if defined WIN32 || defined _WIN32 || defined __WIN32__
|
#if defined WIN32 || defined _WIN32 || defined __WIN32__
|
||||||
# include <winver.h>
|
# include <winver.h>
|
||||||
#else
|
#else
|
||||||
# include <ver.h>
|
# include <ver.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Version information
|
/* Version information
|
||||||
*
|
*
|
||||||
* All strings MUST have an explicit \0. See the Windows SDK documentation
|
* All strings MUST have an explicit \0. See the Windows SDK documentation
|
||||||
* for details on version information and the VERSIONINFO structure.
|
* for details on version information and the VERSIONINFO structure.
|
||||||
*/
|
*/
|
||||||
#define VERSION 1
|
#define VERSION 1
|
||||||
#define REVISION 0
|
#define REVISION 0
|
||||||
#define BUILD 0
|
#define BUILD 0
|
||||||
#define VERSIONSTR "1.0.0\0"
|
#define VERSIONSTR "1.0.0\0"
|
||||||
#define VERSIONNAME "amxArgs.dll\0"
|
#define VERSIONNAME "amxArgs.dll\0"
|
||||||
#define VERSIONDESCRIPTION "Pawn AMX: Script Arguments support\0"
|
#define VERSIONDESCRIPTION "Pawn AMX: Script Arguments support\0"
|
||||||
#define VERSIONCOMPANYNAME "ITB CompuPhase\0"
|
#define VERSIONCOMPANYNAME "ITB CompuPhase\0"
|
||||||
#define VERSIONPRODUCTNAME "amxArgs\0"
|
#define VERSIONPRODUCTNAME "amxArgs\0"
|
||||||
#define VERSIONCOPYRIGHT "Copyright \251 2005-2006 ITB CompuPhase\0"
|
#define VERSIONCOPYRIGHT "Copyright \251 2005-2006 ITB CompuPhase\0"
|
||||||
|
|
||||||
VS_VERSION_INFO VERSIONINFO
|
VS_VERSION_INFO VERSIONINFO
|
||||||
FILEVERSION VERSION, REVISION, BUILD, 0
|
FILEVERSION VERSION, REVISION, BUILD, 0
|
||||||
PRODUCTVERSION VERSION, REVISION, BUILD, 0
|
PRODUCTVERSION VERSION, REVISION, BUILD, 0
|
||||||
FILEFLAGSMASK 0x0000003FL
|
FILEFLAGSMASK 0x0000003FL
|
||||||
FILEFLAGS 0
|
FILEFLAGS 0
|
||||||
#if defined(WIN32)
|
#if defined(WIN32)
|
||||||
FILEOS VOS__WINDOWS32
|
FILEOS VOS__WINDOWS32
|
||||||
#else
|
#else
|
||||||
FILEOS VOS__WINDOWS16
|
FILEOS VOS__WINDOWS16
|
||||||
#endif
|
#endif
|
||||||
FILETYPE VFT_DLL
|
FILETYPE VFT_DLL
|
||||||
BEGIN
|
BEGIN
|
||||||
BLOCK "StringFileInfo"
|
BLOCK "StringFileInfo"
|
||||||
BEGIN
|
BEGIN
|
||||||
BLOCK "040904E4"
|
BLOCK "040904E4"
|
||||||
BEGIN
|
BEGIN
|
||||||
VALUE "CompanyName", VERSIONCOMPANYNAME
|
VALUE "CompanyName", VERSIONCOMPANYNAME
|
||||||
VALUE "FileDescription", VERSIONDESCRIPTION
|
VALUE "FileDescription", VERSIONDESCRIPTION
|
||||||
VALUE "FileVersion", VERSIONSTR
|
VALUE "FileVersion", VERSIONSTR
|
||||||
VALUE "InternalName", VERSIONNAME
|
VALUE "InternalName", VERSIONNAME
|
||||||
VALUE "LegalCopyright", VERSIONCOPYRIGHT
|
VALUE "LegalCopyright", VERSIONCOPYRIGHT
|
||||||
VALUE "OriginalFilename", VERSIONNAME
|
VALUE "OriginalFilename", VERSIONNAME
|
||||||
VALUE "ProductName", VERSIONPRODUCTNAME
|
VALUE "ProductName", VERSIONPRODUCTNAME
|
||||||
VALUE "ProductVersion", VERSIONSTR
|
VALUE "ProductVersion", VERSIONSTR
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
|
|
||||||
BLOCK "VarFileInfo"
|
BLOCK "VarFileInfo"
|
||||||
BEGIN
|
BEGIN
|
||||||
VALUE "Translation", 0x409, 1252
|
VALUE "Translation", 0x409, 1252
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
|
@ -1,86 +1,86 @@
|
|||||||
; Definition of the AMX structure for assembler syntax (MASM/TASM/WASM)
|
; Definition of the AMX structure for assembler syntax (MASM/TASM/WASM)
|
||||||
|
|
||||||
amx_s STRUC
|
amx_s STRUC
|
||||||
_base DD ?
|
_base DD ?
|
||||||
_dataseg DD ?
|
_dataseg DD ?
|
||||||
_callback DD ?
|
_callback DD ?
|
||||||
_debug DD ?
|
_debug DD ?
|
||||||
_cip DD ?
|
_cip DD ?
|
||||||
_frm DD ?
|
_frm DD ?
|
||||||
_hea DD ?
|
_hea DD ?
|
||||||
_hlw DD ?
|
_hlw DD ?
|
||||||
_stk DD ?
|
_stk DD ?
|
||||||
_stp DD ?
|
_stp DD ?
|
||||||
_flags DD ?
|
_flags DD ?
|
||||||
_usertags DD 4 DUP (?) ; 4 = AMX_USERNUM (#define'd in amx.h)
|
_usertags DD 4 DUP (?) ; 4 = AMX_USERNUM (#define'd in amx.h)
|
||||||
_userdata DD 4 DUP (?) ; 4 = AMX_USERNUM (#define'd in amx.h)
|
_userdata DD 4 DUP (?) ; 4 = AMX_USERNUM (#define'd in amx.h)
|
||||||
_error DD ?
|
_error DD ?
|
||||||
_paramcount DD ?
|
_paramcount DD ?
|
||||||
_pri DD ?
|
_pri DD ?
|
||||||
_alt DD ?
|
_alt DD ?
|
||||||
_reset_stk DD ?
|
_reset_stk DD ?
|
||||||
_reset_hea DD ?
|
_reset_hea DD ?
|
||||||
_syscall_d DD ?
|
_syscall_d DD ?
|
||||||
IFDEF JIT
|
IFDEF JIT
|
||||||
; the two fields below are for the JIT; they do not exist in
|
; the two fields below are for the JIT; they do not exist in
|
||||||
; the non-JIT version of the abstract machine
|
; the non-JIT version of the abstract machine
|
||||||
_reloc_size DD ? ; memory block for relocations
|
_reloc_size DD ? ; memory block for relocations
|
||||||
_code_size DD ? ; memory size of the native code
|
_code_size DD ? ; memory size of the native code
|
||||||
ENDIF
|
ENDIF
|
||||||
amx_s ENDS
|
amx_s ENDS
|
||||||
|
|
||||||
amxhead_s STRUC
|
amxhead_s STRUC
|
||||||
_size DD ? ; size of the "file"
|
_size DD ? ; size of the "file"
|
||||||
_magic DW ? ; signature
|
_magic DW ? ; signature
|
||||||
_file_version DB ? ;file format version
|
_file_version DB ? ;file format version
|
||||||
_amx_version DB ? ; required version of the AMX
|
_amx_version DB ? ; required version of the AMX
|
||||||
_h_flags DW ?
|
_h_flags DW ?
|
||||||
_defsize DW ? ; size of one public/native function entry
|
_defsize DW ? ; size of one public/native function entry
|
||||||
_cod DD ? ; initial value of COD - code block
|
_cod DD ? ; initial value of COD - code block
|
||||||
_dat DD ? ; initial value of DAT - data block
|
_dat DD ? ; initial value of DAT - data block
|
||||||
_h_hea DD ? ; initial value of HEA - start of the heap
|
_h_hea DD ? ; initial value of HEA - start of the heap
|
||||||
_h_stp DD ? ; initial value of STP - stack top
|
_h_stp DD ? ; initial value of STP - stack top
|
||||||
_h_cip DD ? ; initial value of CIP - the instruction pointer
|
_h_cip DD ? ; initial value of CIP - the instruction pointer
|
||||||
_publics DD ? ; offset to the "public functions" table
|
_publics DD ? ; offset to the "public functions" table
|
||||||
_natives DD ? ; offset to the "native functions" table
|
_natives DD ? ; offset to the "native functions" table
|
||||||
_libraries DD ? ; offset to the "library" table
|
_libraries DD ? ; offset to the "library" table
|
||||||
_pubvars DD ? ; offset to the "public variables" table
|
_pubvars DD ? ; offset to the "public variables" table
|
||||||
_tags DD ? ; offset to the "public tagnames" table
|
_tags DD ? ; offset to the "public tagnames" table
|
||||||
_nametable DD ? ; offset to the name table, file version 7 only
|
_nametable DD ? ; offset to the name table, file version 7 only
|
||||||
amxhead_s ENDS
|
amxhead_s ENDS
|
||||||
|
|
||||||
|
|
||||||
AMX_ERR_NONE EQU 0
|
AMX_ERR_NONE EQU 0
|
||||||
AMX_ERR_EXIT EQU 1
|
AMX_ERR_EXIT EQU 1
|
||||||
AMX_ERR_ASSERT EQU 2
|
AMX_ERR_ASSERT EQU 2
|
||||||
AMX_ERR_STACKERR EQU 3
|
AMX_ERR_STACKERR EQU 3
|
||||||
AMX_ERR_BOUNDS EQU 4
|
AMX_ERR_BOUNDS EQU 4
|
||||||
AMX_ERR_MEMACCESS EQU 5
|
AMX_ERR_MEMACCESS EQU 5
|
||||||
AMX_ERR_INVINSTR EQU 6
|
AMX_ERR_INVINSTR EQU 6
|
||||||
AMX_ERR_STACKLOW EQU 7
|
AMX_ERR_STACKLOW EQU 7
|
||||||
AMX_ERR_HEAPLOW EQU 8
|
AMX_ERR_HEAPLOW EQU 8
|
||||||
AMX_ERR_CALLBACK EQU 9
|
AMX_ERR_CALLBACK EQU 9
|
||||||
AMX_ERR_NATIVE EQU 10
|
AMX_ERR_NATIVE EQU 10
|
||||||
AMX_ERR_DIVIDE EQU 11 ; for catching divide errors
|
AMX_ERR_DIVIDE EQU 11 ; for catching divide errors
|
||||||
AMX_ERR_SLEEP EQU 12
|
AMX_ERR_SLEEP EQU 12
|
||||||
|
|
||||||
AMX_ERR_MEMORY EQU 16
|
AMX_ERR_MEMORY EQU 16
|
||||||
AMX_ERR_FORMAT EQU 17
|
AMX_ERR_FORMAT EQU 17
|
||||||
AMX_ERR_VERSION EQU 18
|
AMX_ERR_VERSION EQU 18
|
||||||
AMX_ERR_NOTFOUND EQU 19
|
AMX_ERR_NOTFOUND EQU 19
|
||||||
AMX_ERR_INDEX EQU 20
|
AMX_ERR_INDEX EQU 20
|
||||||
AMX_ERR_DEBUG EQU 21
|
AMX_ERR_DEBUG EQU 21
|
||||||
AMX_ERR_INIT EQU 22
|
AMX_ERR_INIT EQU 22
|
||||||
AMX_ERR_USERDATA EQU 23
|
AMX_ERR_USERDATA EQU 23
|
||||||
AMX_ERR_INIT_JIT EQU 24
|
AMX_ERR_INIT_JIT EQU 24
|
||||||
AMX_ERR_PARAMS EQU 25
|
AMX_ERR_PARAMS EQU 25
|
||||||
AMX_ERR_DOMAIN EQU 26
|
AMX_ERR_DOMAIN EQU 26
|
||||||
AMX_ERR_GENERAL EQU 27
|
AMX_ERR_GENERAL EQU 27
|
||||||
|
|
||||||
AMX_FLAG_DEBUG EQU 0002h ; symbolic info. available
|
AMX_FLAG_DEBUG EQU 0002h ; symbolic info. available
|
||||||
AMX_FLAG_COMPACT EQU 0004h
|
AMX_FLAG_COMPACT EQU 0004h
|
||||||
AMX_FLAG_BYTEOPC EQU 0008h
|
AMX_FLAG_BYTEOPC EQU 0008h
|
||||||
AMX_FLAG_NOCHECKS EQU 0010h
|
AMX_FLAG_NOCHECKS EQU 0010h
|
||||||
AMX_FLAG_BROWSE EQU 4000h
|
AMX_FLAG_BROWSE EQU 4000h
|
||||||
AMX_FLAG_RELOC EQU 8000h ; jump/call addresses relocated
|
AMX_FLAG_RELOC EQU 8000h ; jump/call addresses relocated
|
||||||
|
|
||||||
|
@ -1,86 +1,86 @@
|
|||||||
; Definition of the AMX structure for assembler syntax (NASM)
|
; Definition of the AMX structure for assembler syntax (NASM)
|
||||||
|
|
||||||
struc amx_s
|
struc amx_s
|
||||||
_base: resd 1
|
_base: resd 1
|
||||||
_dataseg: resd 1
|
_dataseg: resd 1
|
||||||
_callback: resd 1
|
_callback: resd 1
|
||||||
_debug: resd 1
|
_debug: resd 1
|
||||||
_cip: resd 1
|
_cip: resd 1
|
||||||
_frm: resd 1
|
_frm: resd 1
|
||||||
_hea: resd 1
|
_hea: resd 1
|
||||||
_hlw: resd 1
|
_hlw: resd 1
|
||||||
_stk: resd 1
|
_stk: resd 1
|
||||||
_stp: resd 1
|
_stp: resd 1
|
||||||
_flags: resd 1
|
_flags: resd 1
|
||||||
_usertags: resd 4 ; 4 = AMX_USERNUM (#define'd in amx.h)
|
_usertags: resd 4 ; 4 = AMX_USERNUM (#define'd in amx.h)
|
||||||
_userdata: resd 4 ; 4 = AMX_USERNUM (#define'd in amx.h)
|
_userdata: resd 4 ; 4 = AMX_USERNUM (#define'd in amx.h)
|
||||||
_error: resd 1
|
_error: resd 1
|
||||||
_paramcount: resd 1
|
_paramcount: resd 1
|
||||||
_pri: resd 1
|
_pri: resd 1
|
||||||
_alt: resd 1
|
_alt: resd 1
|
||||||
_reset_stk: resd 1
|
_reset_stk: resd 1
|
||||||
_reset_hea: resd 1
|
_reset_hea: resd 1
|
||||||
_syscall_d: resd 1
|
_syscall_d: resd 1
|
||||||
%ifdef JIT
|
%ifdef JIT
|
||||||
; the two fields below are for the JIT; they do not exist in
|
; the two fields below are for the JIT; they do not exist in
|
||||||
; the non-JIT version of the abstract machine
|
; the non-JIT version of the abstract machine
|
||||||
_reloc_size: resd 1 ; memory block for relocations
|
_reloc_size: resd 1 ; memory block for relocations
|
||||||
_code_size: resd 1 ; memory size of the native code
|
_code_size: resd 1 ; memory size of the native code
|
||||||
%endif
|
%endif
|
||||||
endstruc
|
endstruc
|
||||||
|
|
||||||
struc amxhead_s
|
struc amxhead_s
|
||||||
_size: resd 1 ; size of the "file"
|
_size: resd 1 ; size of the "file"
|
||||||
_magic: resw 1 ; signature
|
_magic: resw 1 ; signature
|
||||||
_file_version: resb 1; file format version
|
_file_version: resb 1; file format version
|
||||||
_amx_version: resb 1 ; required version of the AMX
|
_amx_version: resb 1 ; required version of the AMX
|
||||||
_h_flags: resw 1
|
_h_flags: resw 1
|
||||||
_defsize: resw 1 ; size of one public/native function entry
|
_defsize: resw 1 ; size of one public/native function entry
|
||||||
_cod: resd 1 ; initial value of COD - code block
|
_cod: resd 1 ; initial value of COD - code block
|
||||||
_dat: resd 1 ; initial value of DAT - data block
|
_dat: resd 1 ; initial value of DAT - data block
|
||||||
_h_hea: resd 1 ; initial value of HEA - start of the heap
|
_h_hea: resd 1 ; initial value of HEA - start of the heap
|
||||||
_h_stp: resd 1 ; initial value of STP - stack top
|
_h_stp: resd 1 ; initial value of STP - stack top
|
||||||
_h_cip: resd 1 ; initial value of CIP - the instruction pointer
|
_h_cip: resd 1 ; initial value of CIP - the instruction pointer
|
||||||
_publics: resd 1 ; offset to the "public functions" table
|
_publics: resd 1 ; offset to the "public functions" table
|
||||||
_natives: resd 1 ; offset to the "native functions" table
|
_natives: resd 1 ; offset to the "native functions" table
|
||||||
_libraries: resd 1 ; offset to the "library" table
|
_libraries: resd 1 ; offset to the "library" table
|
||||||
_pubvars: resd 1 ; offset to the "public variables" table
|
_pubvars: resd 1 ; offset to the "public variables" table
|
||||||
_tags: resd 1 ; offset to the "public tagnames" table
|
_tags: resd 1 ; offset to the "public tagnames" table
|
||||||
_nametable: resd 1 ; offset to the name table, file version 7 only
|
_nametable: resd 1 ; offset to the name table, file version 7 only
|
||||||
endstruc
|
endstruc
|
||||||
|
|
||||||
|
|
||||||
AMX_ERR_NONE EQU 0
|
AMX_ERR_NONE EQU 0
|
||||||
AMX_ERR_EXIT EQU 1
|
AMX_ERR_EXIT EQU 1
|
||||||
AMX_ERR_ASSERT EQU 2
|
AMX_ERR_ASSERT EQU 2
|
||||||
AMX_ERR_STACKERR EQU 3
|
AMX_ERR_STACKERR EQU 3
|
||||||
AMX_ERR_BOUNDS EQU 4
|
AMX_ERR_BOUNDS EQU 4
|
||||||
AMX_ERR_MEMACCESS EQU 5
|
AMX_ERR_MEMACCESS EQU 5
|
||||||
AMX_ERR_INVINSTR EQU 6
|
AMX_ERR_INVINSTR EQU 6
|
||||||
AMX_ERR_STACKLOW EQU 7
|
AMX_ERR_STACKLOW EQU 7
|
||||||
AMX_ERR_HEAPLOW EQU 8
|
AMX_ERR_HEAPLOW EQU 8
|
||||||
AMX_ERR_CALLBACK EQU 9
|
AMX_ERR_CALLBACK EQU 9
|
||||||
AMX_ERR_NATIVE EQU 10
|
AMX_ERR_NATIVE EQU 10
|
||||||
AMX_ERR_DIVIDE EQU 11 ; for catching divide errors
|
AMX_ERR_DIVIDE EQU 11 ; for catching divide errors
|
||||||
AMX_ERR_SLEEP EQU 12
|
AMX_ERR_SLEEP EQU 12
|
||||||
|
|
||||||
AMX_ERR_MEMORY EQU 16
|
AMX_ERR_MEMORY EQU 16
|
||||||
AMX_ERR_FORMAT EQU 17
|
AMX_ERR_FORMAT EQU 17
|
||||||
AMX_ERR_VERSION EQU 18
|
AMX_ERR_VERSION EQU 18
|
||||||
AMX_ERR_NOTFOUND EQU 19
|
AMX_ERR_NOTFOUND EQU 19
|
||||||
AMX_ERR_INDEX EQU 20
|
AMX_ERR_INDEX EQU 20
|
||||||
AMX_ERR_DEBUG EQU 21
|
AMX_ERR_DEBUG EQU 21
|
||||||
AMX_ERR_INIT EQU 22
|
AMX_ERR_INIT EQU 22
|
||||||
AMX_ERR_USERDATA EQU 23
|
AMX_ERR_USERDATA EQU 23
|
||||||
AMX_ERR_INIT_JIT EQU 24
|
AMX_ERR_INIT_JIT EQU 24
|
||||||
AMX_ERR_PARAMS EQU 25
|
AMX_ERR_PARAMS EQU 25
|
||||||
AMX_ERR_DOMAIN EQU 26
|
AMX_ERR_DOMAIN EQU 26
|
||||||
AMX_ERR_GENERAL EQU 27
|
AMX_ERR_GENERAL EQU 27
|
||||||
|
|
||||||
AMX_FLAG_DEBUG EQU 0002h ; symbolic info. available
|
AMX_FLAG_DEBUG EQU 0002h ; symbolic info. available
|
||||||
AMX_FLAG_COMPACT EQU 0004h
|
AMX_FLAG_COMPACT EQU 0004h
|
||||||
AMX_FLAG_BYTEOPC EQU 0008h
|
AMX_FLAG_BYTEOPC EQU 0008h
|
||||||
AMX_FLAG_NOCHECKS EQU 0010h
|
AMX_FLAG_NOCHECKS EQU 0010h
|
||||||
AMX_FLAG_BROWSE EQU 4000h
|
AMX_FLAG_BROWSE EQU 4000h
|
||||||
AMX_FLAG_RELOC EQU 8000h ; jump/call addresses relocated
|
AMX_FLAG_RELOC EQU 8000h ; jump/call addresses relocated
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
|||||||
NAME amxFile
|
NAME amxFile
|
||||||
DESCRIPTION 'File I/O support library'
|
DESCRIPTION 'File I/O support library'
|
||||||
|
|
||||||
EXPORTS
|
EXPORTS
|
||||||
amx_FileInit
|
amx_FileInit
|
||||||
amx_FileCleanup
|
amx_FileCleanup
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
|||||||
NAME amxString
|
NAME amxString
|
||||||
DESCRIPTION 'Pawn AMX: string manipulation routines'
|
DESCRIPTION 'Pawn AMX: string manipulation routines'
|
||||||
|
|
||||||
EXPORTS
|
EXPORTS
|
||||||
amx_StringInit
|
amx_StringInit
|
||||||
amx_StringCleanup
|
amx_StringCleanup
|
||||||
|
@ -1,54 +1,54 @@
|
|||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#if defined WIN32 || defined _WIN32 || defined __WIN32__
|
#if defined WIN32 || defined _WIN32 || defined __WIN32__
|
||||||
# include <winver.h>
|
# include <winver.h>
|
||||||
#else
|
#else
|
||||||
# include <ver.h>
|
# include <ver.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Version information
|
/* Version information
|
||||||
*
|
*
|
||||||
* All strings MUST have an explicit \0. See the Windows SDK documentation
|
* All strings MUST have an explicit \0. See the Windows SDK documentation
|
||||||
* for details on version information and the VERSIONINFO structure.
|
* for details on version information and the VERSIONINFO structure.
|
||||||
*/
|
*/
|
||||||
#define VERSION 1
|
#define VERSION 1
|
||||||
#define REVISION 1
|
#define REVISION 1
|
||||||
#define BUILD 0
|
#define BUILD 0
|
||||||
#define VERSIONSTR "1.1.0\0"
|
#define VERSIONSTR "1.1.0\0"
|
||||||
#define VERSIONNAME "amxString.dll\0"
|
#define VERSIONNAME "amxString.dll\0"
|
||||||
#define VERSIONDESCRIPTION "Pawn AMX: String manipulation routines\0"
|
#define VERSIONDESCRIPTION "Pawn AMX: String manipulation routines\0"
|
||||||
#define VERSIONCOMPANYNAME "ITB CompuPhase\0"
|
#define VERSIONCOMPANYNAME "ITB CompuPhase\0"
|
||||||
#define VERSIONPRODUCTNAME "amxString\0"
|
#define VERSIONPRODUCTNAME "amxString\0"
|
||||||
#define VERSIONCOPYRIGHT "Copyright \251 2005-2006 ITB CompuPhase\0"
|
#define VERSIONCOPYRIGHT "Copyright \251 2005-2006 ITB CompuPhase\0"
|
||||||
|
|
||||||
VS_VERSION_INFO VERSIONINFO
|
VS_VERSION_INFO VERSIONINFO
|
||||||
FILEVERSION VERSION, REVISION, BUILD, 0
|
FILEVERSION VERSION, REVISION, BUILD, 0
|
||||||
PRODUCTVERSION VERSION, REVISION, BUILD, 0
|
PRODUCTVERSION VERSION, REVISION, BUILD, 0
|
||||||
FILEFLAGSMASK 0x0000003FL
|
FILEFLAGSMASK 0x0000003FL
|
||||||
FILEFLAGS 0
|
FILEFLAGS 0
|
||||||
#if defined(WIN32)
|
#if defined(WIN32)
|
||||||
FILEOS VOS__WINDOWS32
|
FILEOS VOS__WINDOWS32
|
||||||
#else
|
#else
|
||||||
FILEOS VOS__WINDOWS16
|
FILEOS VOS__WINDOWS16
|
||||||
#endif
|
#endif
|
||||||
FILETYPE VFT_DLL
|
FILETYPE VFT_DLL
|
||||||
BEGIN
|
BEGIN
|
||||||
BLOCK "StringFileInfo"
|
BLOCK "StringFileInfo"
|
||||||
BEGIN
|
BEGIN
|
||||||
BLOCK "040904E4"
|
BLOCK "040904E4"
|
||||||
BEGIN
|
BEGIN
|
||||||
VALUE "CompanyName", VERSIONCOMPANYNAME
|
VALUE "CompanyName", VERSIONCOMPANYNAME
|
||||||
VALUE "FileDescription", VERSIONDESCRIPTION
|
VALUE "FileDescription", VERSIONDESCRIPTION
|
||||||
VALUE "FileVersion", VERSIONSTR
|
VALUE "FileVersion", VERSIONSTR
|
||||||
VALUE "InternalName", VERSIONNAME
|
VALUE "InternalName", VERSIONNAME
|
||||||
VALUE "LegalCopyright", VERSIONCOPYRIGHT
|
VALUE "LegalCopyright", VERSIONCOPYRIGHT
|
||||||
VALUE "OriginalFilename", VERSIONNAME
|
VALUE "OriginalFilename", VERSIONNAME
|
||||||
VALUE "ProductName", VERSIONPRODUCTNAME
|
VALUE "ProductName", VERSIONPRODUCTNAME
|
||||||
VALUE "ProductVersion", VERSIONSTR
|
VALUE "ProductVersion", VERSIONSTR
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
|
|
||||||
BLOCK "VarFileInfo"
|
BLOCK "VarFileInfo"
|
||||||
BEGIN
|
BEGIN
|
||||||
VALUE "Translation", 0x409, 1252
|
VALUE "Translation", 0x409, 1252
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
NAME amxTime
|
NAME amxTime
|
||||||
DESCRIPTION 'Pawn AMX: time routines'
|
DESCRIPTION 'Pawn AMX: time routines'
|
||||||
|
|
||||||
EXPORTS
|
EXPORTS
|
||||||
amx_TimeInit
|
amx_TimeInit
|
||||||
amx_TimeCleanup
|
amx_TimeCleanup
|
||||||
|
@ -1,54 +1,54 @@
|
|||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#if defined WIN32 || defined _WIN32 || defined __WIN32__
|
#if defined WIN32 || defined _WIN32 || defined __WIN32__
|
||||||
# include <winver.h>
|
# include <winver.h>
|
||||||
#else
|
#else
|
||||||
# include <ver.h>
|
# include <ver.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Version information
|
/* Version information
|
||||||
*
|
*
|
||||||
* All strings MUST have an explicit \0. See the Windows SDK documentation
|
* All strings MUST have an explicit \0. See the Windows SDK documentation
|
||||||
* for details on version information and the VERSIONINFO structure.
|
* for details on version information and the VERSIONINFO structure.
|
||||||
*/
|
*/
|
||||||
#define VERSION 1
|
#define VERSION 1
|
||||||
#define REVISION 1
|
#define REVISION 1
|
||||||
#define BUILD 0
|
#define BUILD 0
|
||||||
#define VERSIONSTR "1.2.0\0"
|
#define VERSIONSTR "1.2.0\0"
|
||||||
#define VERSIONNAME "amxTime.dll\0"
|
#define VERSIONNAME "amxTime.dll\0"
|
||||||
#define VERSIONDESCRIPTION "Pawn AMX: time routines\0"
|
#define VERSIONDESCRIPTION "Pawn AMX: time routines\0"
|
||||||
#define VERSIONCOMPANYNAME "ITB CompuPhase\0"
|
#define VERSIONCOMPANYNAME "ITB CompuPhase\0"
|
||||||
#define VERSIONPRODUCTNAME "amxTime\0"
|
#define VERSIONPRODUCTNAME "amxTime\0"
|
||||||
#define VERSIONCOPYRIGHT "Copyright \251 2005-2006 ITB CompuPhase\0"
|
#define VERSIONCOPYRIGHT "Copyright \251 2005-2006 ITB CompuPhase\0"
|
||||||
|
|
||||||
VS_VERSION_INFO VERSIONINFO
|
VS_VERSION_INFO VERSIONINFO
|
||||||
FILEVERSION VERSION, REVISION, BUILD, 0
|
FILEVERSION VERSION, REVISION, BUILD, 0
|
||||||
PRODUCTVERSION VERSION, REVISION, BUILD, 0
|
PRODUCTVERSION VERSION, REVISION, BUILD, 0
|
||||||
FILEFLAGSMASK 0x0000003FL
|
FILEFLAGSMASK 0x0000003FL
|
||||||
FILEFLAGS 0
|
FILEFLAGS 0
|
||||||
#if defined(WIN32)
|
#if defined(WIN32)
|
||||||
FILEOS VOS__WINDOWS32
|
FILEOS VOS__WINDOWS32
|
||||||
#else
|
#else
|
||||||
FILEOS VOS__WINDOWS16
|
FILEOS VOS__WINDOWS16
|
||||||
#endif
|
#endif
|
||||||
FILETYPE VFT_DLL
|
FILETYPE VFT_DLL
|
||||||
BEGIN
|
BEGIN
|
||||||
BLOCK "StringFileInfo"
|
BLOCK "StringFileInfo"
|
||||||
BEGIN
|
BEGIN
|
||||||
BLOCK "040904E4"
|
BLOCK "040904E4"
|
||||||
BEGIN
|
BEGIN
|
||||||
VALUE "CompanyName", VERSIONCOMPANYNAME
|
VALUE "CompanyName", VERSIONCOMPANYNAME
|
||||||
VALUE "FileDescription", VERSIONDESCRIPTION
|
VALUE "FileDescription", VERSIONDESCRIPTION
|
||||||
VALUE "FileVersion", VERSIONSTR
|
VALUE "FileVersion", VERSIONSTR
|
||||||
VALUE "InternalName", VERSIONNAME
|
VALUE "InternalName", VERSIONNAME
|
||||||
VALUE "LegalCopyright", VERSIONCOPYRIGHT
|
VALUE "LegalCopyright", VERSIONCOPYRIGHT
|
||||||
VALUE "OriginalFilename", VERSIONNAME
|
VALUE "OriginalFilename", VERSIONNAME
|
||||||
VALUE "ProductName", VERSIONPRODUCTNAME
|
VALUE "ProductName", VERSIONPRODUCTNAME
|
||||||
VALUE "ProductVersion", VERSIONSTR
|
VALUE "ProductVersion", VERSIONSTR
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
|
|
||||||
BLOCK "VarFileInfo"
|
BLOCK "VarFileInfo"
|
||||||
BEGIN
|
BEGIN
|
||||||
VALUE "Translation", 0x409, 1252
|
VALUE "Translation", 0x409, 1252
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
|
@ -1,71 +1,71 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <malloc>
|
#include <malloc>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include "amx.h"
|
#include "amx.h"
|
||||||
|
|
||||||
class LogFile;
|
class LogFile;
|
||||||
static std::map<AMX*, LogFile*> lookup;
|
static std::map<AMX*, LogFile*> lookup;
|
||||||
|
|
||||||
class LogFile {
|
class LogFile {
|
||||||
public:
|
public:
|
||||||
LogFile()
|
LogFile()
|
||||||
{
|
{
|
||||||
f = tmpfile();
|
f = tmpfile();
|
||||||
}
|
}
|
||||||
|
|
||||||
~LogFile()
|
~LogFile()
|
||||||
{
|
{
|
||||||
fclose(f);
|
fclose(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
write(AMX* amx, cell params[])
|
write(AMX* amx, cell params[])
|
||||||
{
|
{
|
||||||
int r = 0;
|
int r = 0;
|
||||||
char *pstr;
|
char *pstr;
|
||||||
|
|
||||||
amx_StrParam(amx, params[1], pstr);
|
amx_StrParam(amx, params[1], pstr);
|
||||||
if (pstr != NULL)
|
if (pstr != NULL)
|
||||||
r = fprintf(f, "%s", pstr);
|
r = fprintf(f, "%s", pstr);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
FILE *f;
|
FILE *f;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static cell n_write(AMX* amx, cell params[])
|
static cell n_write(AMX* amx, cell params[])
|
||||||
{
|
{
|
||||||
std::map<AMX*, LogFile*>::iterator p = lookup.find(amx);
|
std::map<AMX*, LogFile*>::iterator p = lookup.find(amx);
|
||||||
if (p != lookup.end())
|
if (p != lookup.end())
|
||||||
return p->second->write(amx, params);
|
return p->second->write(amx, params);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
int amx_LogFileInit(AMX* amx)
|
int amx_LogFileInit(AMX* amx)
|
||||||
{
|
{
|
||||||
LogFile* lf = new LogFile;
|
LogFile* lf = new LogFile;
|
||||||
if (lf) {
|
if (lf) {
|
||||||
lookup.insert(std::make_pair(amx, lf));
|
lookup.insert(std::make_pair(amx, lf));
|
||||||
|
|
||||||
static AMX_NATIVE_INFO nativelist[] = {
|
static AMX_NATIVE_INFO nativelist[] = {
|
||||||
{ "write", LogFile::n_write },
|
{ "write", LogFile::n_write },
|
||||||
{ 0, 0 } /* terminator */
|
{ 0, 0 } /* terminator */
|
||||||
};
|
};
|
||||||
return amx_Register(amx, nativelist, -1);
|
return amx_Register(amx, nativelist, -1);
|
||||||
} /* if */
|
} /* if */
|
||||||
return AMX_ERR_MEMORY;
|
return AMX_ERR_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
int amx_LogFileExit(AMX* amx)
|
int amx_LogFileExit(AMX* amx)
|
||||||
{
|
{
|
||||||
std::map<AMX*, LogFile*>::iterator p = lookup.find(amx);
|
std::map<AMX*, LogFile*>::iterator p = lookup.find(amx);
|
||||||
if (p != lookup.end()) {
|
if (p != lookup.end()) {
|
||||||
delete p->second;
|
delete p->second;
|
||||||
lookup.erase(p);
|
lookup.erase(p);
|
||||||
} /* if */
|
} /* if */
|
||||||
return AMX_ERR_NONE;
|
return AMX_ERR_NONE;
|
||||||
}
|
}
|
||||||
|
@ -1,72 +1,72 @@
|
|||||||
This is a collection of various complete implementations of a "pawnrun", a
|
This is a collection of various complete implementations of a "pawnrun", a
|
||||||
console mode interface to the abstract machine of Small. The Small manual
|
console mode interface to the abstract machine of Small. The Small manual
|
||||||
develops these examples in several steps, but it does not contain listings
|
develops these examples in several steps, but it does not contain listings
|
||||||
of the complete and compilable programs.
|
of the complete and compilable programs.
|
||||||
|
|
||||||
Many examples for compiling the abstract machine, for various compilers and
|
Many examples for compiling the abstract machine, for various compilers and
|
||||||
various options of the abstract machine, are given in the "Implementor's Guide"
|
various options of the abstract machine, are given in the "Implementor's Guide"
|
||||||
for the Small toolkit. Below is a brief subset of those examples, using only
|
for the Small toolkit. Below is a brief subset of those examples, using only
|
||||||
the ANSI core. If your compiler is not listed, please consult the
|
the ANSI core. If your compiler is not listed, please consult the
|
||||||
above-mentioned Implementor's Guide. In each of these examples, "prun1.c" should
|
above-mentioned Implementor's Guide. In each of these examples, "prun1.c" should
|
||||||
be replaced by "prun2.c", "prun3.c" for the other examples.
|
be replaced by "prun2.c", "prun3.c" for the other examples.
|
||||||
|
|
||||||
Borland C++ version 3.1, 16-bit:
|
Borland C++ version 3.1, 16-bit:
|
||||||
bcc prun1.c amx.c amxcore.c amxcons.c
|
bcc prun1.c amx.c amxcore.c amxcons.c
|
||||||
|
|
||||||
Microsoft Visual C/C++ version 5.0 or 6.0, 32-bit:
|
Microsoft Visual C/C++ version 5.0 or 6.0, 32-bit:
|
||||||
cl prun1.c amx.c amxcons.c amxcore.c
|
cl prun1.c amx.c amxcons.c amxcore.c
|
||||||
|
|
||||||
(note: when running with warning level 4, option "-W4", Visual C/C++
|
(note: when running with warning level 4, option "-W4", Visual C/C++
|
||||||
issues a few warnings for unused function arguments and changes of the
|
issues a few warnings for unused function arguments and changes of the
|
||||||
default structure alignment)
|
default structure alignment)
|
||||||
|
|
||||||
OpenWatcom C/C++ version 1.3, 32-bit:
|
OpenWatcom C/C++ version 1.3, 32-bit:
|
||||||
wcl386 /l=nt prun1.c amx.c amxcore.c amxcons.c
|
wcl386 /l=nt prun1.c amx.c amxcore.c amxcons.c
|
||||||
|
|
||||||
|
|
||||||
PRUN1.C
|
PRUN1.C
|
||||||
The smallest and simplest example. This program uses the functions
|
The smallest and simplest example. This program uses the functions
|
||||||
from the file AMXAUX.C (a collection of functions that are not part of
|
from the file AMXAUX.C (a collection of functions that are not part of
|
||||||
the AMX core, but that are occasionally useful or convenient). The
|
the AMX core, but that are occasionally useful or convenient). The
|
||||||
other examples are modifications and variations on this program.
|
other examples are modifications and variations on this program.
|
||||||
|
|
||||||
PRUN2.C
|
PRUN2.C
|
||||||
This example adds a debug hook and a Ctrl-Break signal function (all
|
This example adds a debug hook and a Ctrl-Break signal function (all
|
||||||
in ANSI C) to be able to abort a script with Ctrl-C or Ctrl-Break. The
|
in ANSI C) to be able to abort a script with Ctrl-C or Ctrl-Break. The
|
||||||
required modifications come from the manual. It is up to you to
|
required modifications come from the manual. It is up to you to
|
||||||
replace the ANSI C "signal" handler by some other means to abort a
|
replace the ANSI C "signal" handler by some other means to abort a
|
||||||
run-away script.
|
run-away script.
|
||||||
|
|
||||||
Note that the SIGINT signal is not very standardized, at least not
|
Note that the SIGINT signal is not very standardized, at least not
|
||||||
on Win32 compilers.
|
on Win32 compilers.
|
||||||
|
|
||||||
PRUN3.C
|
PRUN3.C
|
||||||
This example implements the virtual memory implementation, where a
|
This example implements the virtual memory implementation, where a
|
||||||
compiled script may take as much or as little memory that it requires.
|
compiled script may take as much or as little memory that it requires.
|
||||||
The technique by which it achieves this is OS-dependent; this example
|
The technique by which it achieves this is OS-dependent; this example
|
||||||
will only compile and run on any OS of the Win32 family.
|
will only compile and run on any OS of the Win32 family.
|
||||||
|
|
||||||
PRUN4.C
|
PRUN4.C
|
||||||
The examples do far have only executed function main() in the compiled
|
The examples do far have only executed function main() in the compiled
|
||||||
script. This example is a modification of PRUN1.C that accepts two
|
script. This example is a modification of PRUN1.C that accepts two
|
||||||
more parameters: a function name and a parameter. The parameter is
|
more parameters: a function name and a parameter. The parameter is
|
||||||
passed as a string to the specified function.
|
passed as a string to the specified function.
|
||||||
|
|
||||||
This sample uses a modified "rot13" example script (one in which the
|
This sample uses a modified "rot13" example script (one in which the
|
||||||
"work horse" function is made public).
|
"work horse" function is made public).
|
||||||
|
|
||||||
PRUN5.C
|
PRUN5.C
|
||||||
Another variation on PRUN1.C that shows how to use the optional garbage
|
Another variation on PRUN1.C that shows how to use the optional garbage
|
||||||
collector. Please read the appendix on the garbage collector as well,
|
collector. Please read the appendix on the garbage collector as well,
|
||||||
because in the pursuit of creating a portable sample, I have "hooked"
|
because in the pursuit of creating a portable sample, I have "hooked"
|
||||||
the garbage collector on the "debug hook" and this is actually a bad
|
the garbage collector on the "debug hook" and this is actually a bad
|
||||||
idea.
|
idea.
|
||||||
This example also requires the "Better String library", and open source
|
This example also requires the "Better String library", and open source
|
||||||
library for handling dynamic strings in a safe manner. The "Better
|
library for handling dynamic strings in a safe manner. The "Better
|
||||||
String library" is made by Paul Hsieh, and it can be found, at the time
|
String library" is made by Paul Hsieh, and it can be found, at the time
|
||||||
of this writing, at http://bstring.sourceforge.net/.
|
of this writing, at http://bstring.sourceforge.net/.
|
||||||
|
|
||||||
PRUN_JIT.C
|
PRUN_JIT.C
|
||||||
A version of PRUN1.C that sets up the JIT compiler to run the modules.
|
A version of PRUN1.C that sets up the JIT compiler to run the modules.
|
||||||
This example does not set up a debug hook, because the JIT compiler
|
This example does not set up a debug hook, because the JIT compiler
|
||||||
does not support any debug hook.
|
does not support any debug hook.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user