fixed a variable not matching the size of underlying registers for QSE_SYSCALL0
This commit is contained in:
parent
8160249b38
commit
444abec9fe
@ -1,6 +1,9 @@
|
|||||||
QSEAWK Language {#awk-lang}
|
QSEAWK Language {#awk-lang}
|
||||||
================================================================================
|
================================================================================
|
||||||
|
|
||||||
|
Overview
|
||||||
|
--------
|
||||||
|
|
||||||
QSEAWK implements the language described in the
|
QSEAWK implements the language described in the
|
||||||
[The AWK Programming Language][awkbook] with extensions.
|
[The AWK Programming Language][awkbook] with extensions.
|
||||||
|
|
||||||
@ -8,22 +11,47 @@ QSEAWK reads an AWK program, recognizes various tokens contained while skipping
|
|||||||
comments and whitespaces that don't constinute a token, analyses syntax, and
|
comments and whitespaces that don't constinute a token, analyses syntax, and
|
||||||
tranforms them to an internal form for execution.
|
tranforms them to an internal form for execution.
|
||||||
|
|
||||||
### Comments ###
|
An QSEAWK program can be composed of the following elements at the top level.
|
||||||
|
|
||||||
|
- pattern-action blocks
|
||||||
|
- *BEGIN* blocks
|
||||||
|
- *END* blocks
|
||||||
|
- user-defined functions
|
||||||
|
- comments
|
||||||
|
- \@global variables
|
||||||
|
- \@include statements
|
||||||
|
|
||||||
|
The following code snippet is a valid QSEAWK program that print the string
|
||||||
|
*hello, world* to the console. it is composed of a single *BEGIN* block.
|
||||||
|
|
||||||
|
~~~~~{.awk}
|
||||||
|
BEGIN {
|
||||||
|
print "hello, world";
|
||||||
|
}
|
||||||
|
~~~~~
|
||||||
|
|
||||||
|
Comments
|
||||||
|
--------
|
||||||
|
|
||||||
A single-line comment is introduced by a hash character #, and is terminated at
|
A single-line comment is introduced by a hash character #, and is terminated at
|
||||||
the end of the same line. Additionally, it supports a C-style multi-line comment
|
the end of the same line. Additionally, it supports a C-style multi-line comment
|
||||||
enclosed in /* and */. The multi-line comment can't nest and can't appear within
|
enclosed in /* and */. The multi-line comment can't nest and can't appear within
|
||||||
string literals and regular expressions.
|
string literals and regular expressions.
|
||||||
|
|
||||||
x = y; # assign y to x.
|
~~~~~{.awk}
|
||||||
/*
|
x = y; # assign y to x.
|
||||||
this line is ignored.
|
/*
|
||||||
this line is ignored too.
|
this line is ignored.
|
||||||
*/
|
this line is ignored too.
|
||||||
|
*/
|
||||||
|
~~~~~
|
||||||
|
|
||||||
## Tokens ##
|
Tokens
|
||||||
|
------
|
||||||
|
|
||||||
A token is composed of one or more consecutive characters.
|
When QSEAWK parses a program, it classifies the a series of input charcters
|
||||||
|
into meaningful tokens. It can extract the smallest meaningful unit through
|
||||||
|
this tokenization process. There are
|
||||||
|
|
||||||
### Numbers ###
|
### Numbers ###
|
||||||
|
|
||||||
|
@ -496,8 +496,8 @@ the user-level applications with the following differences:
|
|||||||
|
|
||||||
#define QSE_SYSCALL0(ret,num) \
|
#define QSE_SYSCALL0(ret,num) \
|
||||||
__asm__ volatile ( \
|
__asm__ volatile ( \
|
||||||
"int $0x80\n" \
|
"int $0x80\n" \
|
||||||
: "=a"(ret) \
|
: "=a"(ret) \
|
||||||
: "a"((qse_uint32_t)num) \
|
: "a"((qse_uint32_t)num) \
|
||||||
: "memory" \
|
: "memory" \
|
||||||
)
|
)
|
||||||
|
@ -199,7 +199,7 @@ static int fnc_getpid (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi)
|
|||||||
|
|
||||||
static int fnc_gettid (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi)
|
static int fnc_gettid (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi)
|
||||||
{
|
{
|
||||||
qse_long_t pid;
|
qse_intptr_t pid;
|
||||||
qse_awk_val_t* retv;
|
qse_awk_val_t* retv;
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
@ -226,7 +226,7 @@ static int fnc_gettid (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi)
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
retv = qse_awk_rtx_makeintval (rtx, pid);
|
retv = qse_awk_rtx_makeintval (rtx, (qse_long_t)pid);
|
||||||
if (retv == QSE_NULL) return -1;
|
if (retv == QSE_NULL) return -1;
|
||||||
|
|
||||||
qse_awk_rtx_setretval (rtx, retv);
|
qse_awk_rtx_setretval (rtx, retv);
|
||||||
|
Loading…
Reference in New Issue
Block a user