From 444abec9fe4d43b86705296cfcc550a9dcc8add1 Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Tue, 15 Jan 2013 11:51:26 +0000 Subject: [PATCH] fixed a variable not matching the size of underlying registers for QSE_SYSCALL0 --- qse/doc/page/awk-lang.md | 44 ++++++++++++++++++++++++++++++++-------- qse/lib/cmn/syscall.h | 4 ++-- qse/mod/awk/sys.c | 4 ++-- 3 files changed, 40 insertions(+), 12 deletions(-) diff --git a/qse/doc/page/awk-lang.md b/qse/doc/page/awk-lang.md index 11d50528..791da53c 100644 --- a/qse/doc/page/awk-lang.md +++ b/qse/doc/page/awk-lang.md @@ -1,6 +1,9 @@ QSEAWK Language {#awk-lang} ================================================================================ +Overview +-------- + QSEAWK implements the language described in the [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 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 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 string literals and regular expressions. - x = y; # assign y to x. - /* - this line is ignored. - this line is ignored too. - */ +~~~~~{.awk} + x = y; # assign y to x. + /* + 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 ### diff --git a/qse/lib/cmn/syscall.h b/qse/lib/cmn/syscall.h index ef195f73..289e1bd7 100644 --- a/qse/lib/cmn/syscall.h +++ b/qse/lib/cmn/syscall.h @@ -496,8 +496,8 @@ the user-level applications with the following differences: #define QSE_SYSCALL0(ret,num) \ __asm__ volatile ( \ - "int $0x80\n" \ - : "=a"(ret) \ + "int $0x80\n" \ + : "=a"(ret) \ : "a"((qse_uint32_t)num) \ : "memory" \ ) diff --git a/qse/mod/awk/sys.c b/qse/mod/awk/sys.c index fabd4d2c..7bfdb1f7 100644 --- a/qse/mod/awk/sys.c +++ b/qse/mod/awk/sys.c @@ -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) { - qse_long_t pid; + qse_intptr_t pid; qse_awk_val_t* retv; #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 - retv = qse_awk_rtx_makeintval (rtx, pid); + retv = qse_awk_rtx_makeintval (rtx, (qse_long_t)pid); if (retv == QSE_NULL) return -1; qse_awk_rtx_setretval (rtx, retv);