added QSE_FIO_TEXT to qse_fio_t

This commit is contained in:
2009-01-27 09:26:15 +00:00
parent ae55f22bf9
commit 3f48dd3d7f
14 changed files with 290 additions and 166 deletions

View File

@ -244,6 +244,9 @@ protected:
sa_int.sa_handler = stop_run;
sigemptyset (&sa_int.sa_mask);
sa_int.sa_flags = 0;
#ifdef SA_RESTART
sa_int.sa_flags |= SA_RESTART;
#endif
sigaction (SIGINT, &sa_int, NULL);
#endif

View File

@ -58,6 +58,7 @@ static void dprint (const qse_char_t* fmt, ...)
}
}
#ifdef _WIN32
static BOOL WINAPI stop_run (DWORD ctrl_type)
{
@ -71,12 +72,38 @@ static BOOL WINAPI stop_run (DWORD ctrl_type)
return FALSE;
}
#else
static int setsignal (int sig, void(*handler)(int), int restart)
{
struct sigaction sa_int;
sa_int.sa_handler = handler;
sigemptyset (&sa_int.sa_mask);
sa_int.sa_flags = 0;
if (restart)
{
#ifdef SA_RESTART
sa_int.sa_flags |= SA_RESTART;
#endif
}
else
{
#ifdef SA_INTERRUPT
sa_int.sa_flags |= SA_INTERRUPT;
#endif
}
return sigaction (sig, &sa_int, NULL);
}
static void stop_run (int sig)
{
int e = errno;
qse_awk_stop (app_run);
errno = e;
}
#endif
static void set_intr_run (void)
@ -84,14 +111,7 @@ static void set_intr_run (void)
#ifdef _WIN32
SetConsoleCtrlHandler (stop_run, TRUE);
#else
{
struct sigaction sa_int;
sa_int.sa_handler = stop_run;
sigemptyset (&sa_int.sa_mask);
sa_int.sa_flags = 0;
sigaction (SIGINT, &sa_int, NULL);
}
setsignal (SIGINT, stop_run, 1);
#endif
}
@ -100,14 +120,7 @@ static void unset_intr_run (void)
#ifdef _WIN32
SetConsoleCtrlHandler (stop_run, FALSE);
#else
{
struct sigaction sa_int;
sa_int.sa_handler = SIG_DFL;
sigemptyset (&sa_int.sa_mask);
sa_int.sa_flags = 0;
sigaction (SIGINT, &sa_int, NULL);
}
setsignal (SIGINT, SIG_DFL, 1);
#endif
}

View File

@ -1,21 +1,24 @@
BEGIN {
print "more";
//print | "more";
//print > "echo";
//print >> "echo";
#print | "more";
#print > "echo";
#print >> "echo";
getline x < "abc"; /* open("abc", O_RDONLY|O_LARGEFILE) = 3 */
//print 10 >> "abc"; /* open("abc", O_WRONLY|O_APPEND|O_CREAT|O_LARGEFILE, 0666) = 4 */
#print 10 >> "abc"; /* open("abc", O_WRONLY|O_APPEND|O_CREAT|O_LARGEFILE, 0666) = 4 */
getline x < "abc";
//print x;
#print x;
a = close ("abc"); /* close(4) */
print "a=" a;
//print "hey"
#print "hey"
b = close ("abc"); /* close(3) */
print "b=" b;
getline x < "Makefile.cl";
getline y < "awk.c";
print x;
print y;
c = close ("Makefile.cl");
d = close ("awk.c");