fixed some sample files

This commit is contained in:
hyung-hwan 2014-03-03 15:36:30 +00:00
parent 97261f9606
commit fa3757222a
8 changed files with 43 additions and 17 deletions

View File

@ -1,5 +1,4 @@
#include <qse/awk/stdawk.h> #include <qse/awk/stdawk.h>
#include <qse/cmn/stdio.h>
static const qse_char_t* script = QSE_T("BEGIN { print \"hello, world\"; }"); static const qse_char_t* script = QSE_T("BEGIN { print \"hello, world\"; }");
@ -11,6 +10,8 @@ int main ()
qse_awk_parsestd_t psin[2]; qse_awk_parsestd_t psin[2];
int ret = -1; int ret = -1;
qse_openstdsios ();
/* create an awk object */ /* create an awk object */
awk = qse_awk_openstd (0); awk = qse_awk_openstd (0);
if (awk == QSE_NULL) if (awk == QSE_NULL)
@ -69,5 +70,6 @@ oops:
/* destroy the awk object */ /* destroy the awk object */
if (awk) qse_awk_close (awk); if (awk) qse_awk_close (awk);
qse_closestdsios ();
return ret; return ret;
} }

View File

@ -1,7 +1,6 @@
#include <qse/awk/stdawk.h> #include <qse/awk/stdawk.h>
#include <qse/cmn/str.h> #include <qse/cmn/str.h>
#include <qse/cmn/main.h> #include <qse/cmn/main.h>
#include <qse/cmn/stdio.h>
#include "awk00.h" #include "awk00.h"
/* i'll print records with the second field grater than 4. /* i'll print records with the second field grater than 4.
@ -154,7 +153,11 @@ oops:
int qse_main (int argc, qse_achar_t* argv[]) int qse_main (int argc, qse_achar_t* argv[])
{ {
extern void init_awk_sample_locale (void); int x;
qse_openstdsios ();
init_awk_sample_locale (); init_awk_sample_locale ();
return qse_runmain (argc, argv, awk_main); x = qse_runmain (argc, argv, awk_main);
qse_closestdsios ();
return x;
} }

View File

@ -1,7 +1,6 @@
#include <qse/awk/stdawk.h> #include <qse/awk/stdawk.h>
#include <qse/cmn/str.h> #include <qse/cmn/str.h>
#include <qse/cmn/main.h> #include <qse/cmn/main.h>
#include <qse/cmn/stdio.h>
#include "awk00.h" #include "awk00.h"
/* i'll print records with the second field grater than 4. /* i'll print records with the second field grater than 4.
@ -170,6 +169,10 @@ oops:
int qse_main (int argc, qse_achar_t* argv[]) int qse_main (int argc, qse_achar_t* argv[])
{ {
int x;
qse_openstdsios ();
init_awk_sample_locale (); init_awk_sample_locale ();
return qse_runmain (argc, argv, awk_main); x = qse_runmain (argc, argv, awk_main);
qse_closestdsios ();
return x;
} }

View File

@ -1,6 +1,5 @@
#include <qse/awk/stdawk.h> #include <qse/awk/stdawk.h>
#include <qse/cmn/main.h> #include <qse/cmn/main.h>
#include <qse/cmn/stdio.h>
#include "awk00.h" #include "awk00.h"
static const qse_char_t* src = QSE_T( static const qse_char_t* src = QSE_T(
@ -119,6 +118,10 @@ oops:
int qse_main (int argc, qse_achar_t* argv[]) int qse_main (int argc, qse_achar_t* argv[])
{ {
int x;
init_awk_sample_locale (); init_awk_sample_locale ();
return qse_runmain (argc, argv, awk_main); qse_openstdsios ();
x = qse_runmain (argc, argv, awk_main);
qse_closestdsios ();
return x;
} }

View File

@ -1,6 +1,5 @@
#include <qse/awk/stdawk.h> #include <qse/awk/stdawk.h>
#include <qse/cmn/main.h> #include <qse/cmn/main.h>
#include <qse/cmn/stdio.h>
#include "awk00.h" #include "awk00.h"
static const qse_char_t* src = QSE_T( static const qse_char_t* src = QSE_T(
@ -124,7 +123,11 @@ oops:
int qse_main (int argc, qse_achar_t* argv[]) int qse_main (int argc, qse_achar_t* argv[])
{ {
int x;
qse_openstdsios ();
init_awk_sample_locale (); init_awk_sample_locale ();
return qse_runmain (argc, argv, awk_main); x = qse_runmain (argc, argv, awk_main);
qse_closestdsios ();
return x;
} }

View File

@ -1,6 +1,5 @@
#include <qse/awk/stdawk.h> #include <qse/awk/stdawk.h>
#include <qse/cmn/main.h> #include <qse/cmn/main.h>
#include <qse/cmn/stdio.h>
#include "awk00.h" #include "awk00.h"
static const qse_char_t* src = QSE_T( static const qse_char_t* src = QSE_T(
@ -133,7 +132,11 @@ oops:
int qse_main (int argc, qse_achar_t* argv[]) int qse_main (int argc, qse_achar_t* argv[])
{ {
int x;
qse_openstdsios ();
init_awk_sample_locale (); init_awk_sample_locale ();
return qse_runmain (argc, argv, awk_main); x = qse_runmain (argc, argv, awk_main);
qse_closestdsios ();
return x;
} }

View File

@ -1,6 +1,5 @@
#include <qse/awk/stdawk.h> #include <qse/awk/stdawk.h>
#include <qse/cmn/main.h> #include <qse/cmn/main.h>
#include <qse/cmn/stdio.h>
#include "awk00.h" #include "awk00.h"
static const qse_char_t* src = QSE_T( static const qse_char_t* src = QSE_T(
@ -158,7 +157,11 @@ oops:
int qse_main (int argc, qse_achar_t* argv[]) int qse_main (int argc, qse_achar_t* argv[])
{ {
int x;
qse_openstdsios ();
init_awk_sample_locale (); init_awk_sample_locale ();
return qse_runmain (argc, argv, awk_main); x = qse_runmain (argc, argv, awk_main);
qse_closestdsios ();
return x;
} }

View File

@ -1,9 +1,9 @@
#include <qse/cmn/path.h> #include <qse/cmn/path.h>
#include <qse/cmn/stdio.h>
#include <qse/cmn/main.h> #include <qse/cmn/main.h>
#include <qse/cmn/mbwc.h> #include <qse/cmn/mbwc.h>
#include <qse/cmn/str.h> #include <qse/cmn/str.h>
#include <qse/cmn/mem.h> #include <qse/cmn/mem.h>
#include <qse/cmn/sio.h>
#include <locale.h> #include <locale.h>
#if defined(_WIN32) #if defined(_WIN32)
@ -65,6 +65,8 @@ static int path_main (int argc, qse_char_t* argv[])
int qse_main (int argc, qse_achar_t* argv[]) int qse_main (int argc, qse_achar_t* argv[])
{ {
int x;
#if defined(_WIN32) #if defined(_WIN32)
char locale[100]; char locale[100];
UINT codepage = GetConsoleOutputCP(); UINT codepage = GetConsoleOutputCP();
@ -83,6 +85,10 @@ int qse_main (int argc, qse_achar_t* argv[])
setlocale (LC_ALL, ""); setlocale (LC_ALL, "");
qse_setdflcmgrbyid (QSE_CMGR_SLMB); qse_setdflcmgrbyid (QSE_CMGR_SLMB);
#endif #endif
return qse_runmain (argc, argv, path_main);
qse_openstdsios ();
x = qse_runmain (argc, argv, path_main);
qse_closestdsios ();
return x;
} }