Recovered from cvs revision 2007-10-29 15:20:00

This commit is contained in:
hyung-hwan 2007-10-30 00:20:00 +00:00
parent 1fb4e03c11
commit 8ca13ac266
11 changed files with 382 additions and 99 deletions

View File

@ -91,6 +91,7 @@ Global
{17621C83-40C9-4305-BAF9-132E250B5FE3}.Debug|Win32.ActiveCfg = Debug|Win32 {17621C83-40C9-4305-BAF9-132E250B5FE3}.Debug|Win32.ActiveCfg = Debug|Win32
{17621C83-40C9-4305-BAF9-132E250B5FE3}.Debug|Win32.Build.0 = Debug|Win32 {17621C83-40C9-4305-BAF9-132E250B5FE3}.Debug|Win32.Build.0 = Debug|Win32
{17621C83-40C9-4305-BAF9-132E250B5FE3}.Release|Any CPU.ActiveCfg = Release|Win32 {17621C83-40C9-4305-BAF9-132E250B5FE3}.Release|Any CPU.ActiveCfg = Release|Win32
{17621C83-40C9-4305-BAF9-132E250B5FE3}.Release|Any CPU.Build.0 = Release|Win32
{17621C83-40C9-4305-BAF9-132E250B5FE3}.Release|Mixed Platforms.ActiveCfg = Release|Win32 {17621C83-40C9-4305-BAF9-132E250B5FE3}.Release|Mixed Platforms.ActiveCfg = Release|Win32
{17621C83-40C9-4305-BAF9-132E250B5FE3}.Release|Mixed Platforms.Build.0 = Release|Win32 {17621C83-40C9-4305-BAF9-132E250B5FE3}.Release|Mixed Platforms.Build.0 = Release|Win32
{17621C83-40C9-4305-BAF9-132E250B5FE3}.Release|Win32.ActiveCfg = Release|Win32 {17621C83-40C9-4305-BAF9-132E250B5FE3}.Release|Win32.ActiveCfg = Release|Win32
@ -107,6 +108,7 @@ Global
{C3EBBFAE-9D08-4FA2-8B0E-D09BEBF84EDD}.Debug|Win32.ActiveCfg = Debug|Win32 {C3EBBFAE-9D08-4FA2-8B0E-D09BEBF84EDD}.Debug|Win32.ActiveCfg = Debug|Win32
{C3EBBFAE-9D08-4FA2-8B0E-D09BEBF84EDD}.Debug|Win32.Build.0 = Debug|Win32 {C3EBBFAE-9D08-4FA2-8B0E-D09BEBF84EDD}.Debug|Win32.Build.0 = Debug|Win32
{C3EBBFAE-9D08-4FA2-8B0E-D09BEBF84EDD}.Release|Any CPU.ActiveCfg = Release|Win32 {C3EBBFAE-9D08-4FA2-8B0E-D09BEBF84EDD}.Release|Any CPU.ActiveCfg = Release|Win32
{C3EBBFAE-9D08-4FA2-8B0E-D09BEBF84EDD}.Release|Any CPU.Build.0 = Release|Win32
{C3EBBFAE-9D08-4FA2-8B0E-D09BEBF84EDD}.Release|Mixed Platforms.ActiveCfg = Release|Win32 {C3EBBFAE-9D08-4FA2-8B0E-D09BEBF84EDD}.Release|Mixed Platforms.ActiveCfg = Release|Win32
{C3EBBFAE-9D08-4FA2-8B0E-D09BEBF84EDD}.Release|Mixed Platforms.Build.0 = Release|Win32 {C3EBBFAE-9D08-4FA2-8B0E-D09BEBF84EDD}.Release|Mixed Platforms.Build.0 = Release|Win32
{C3EBBFAE-9D08-4FA2-8B0E-D09BEBF84EDD}.Release|Win32.ActiveCfg = Release|Win32 {C3EBBFAE-9D08-4FA2-8B0E-D09BEBF84EDD}.Release|Win32.ActiveCfg = Release|Win32
@ -123,6 +125,7 @@ Global
{5F2E77D5-1485-48D1-9371-987BC55FEE83}.Debug|Win32.ActiveCfg = Debug|Win32 {5F2E77D5-1485-48D1-9371-987BC55FEE83}.Debug|Win32.ActiveCfg = Debug|Win32
{5F2E77D5-1485-48D1-9371-987BC55FEE83}.Debug|Win32.Build.0 = Debug|Win32 {5F2E77D5-1485-48D1-9371-987BC55FEE83}.Debug|Win32.Build.0 = Debug|Win32
{5F2E77D5-1485-48D1-9371-987BC55FEE83}.Release|Any CPU.ActiveCfg = Release|Win32 {5F2E77D5-1485-48D1-9371-987BC55FEE83}.Release|Any CPU.ActiveCfg = Release|Win32
{5F2E77D5-1485-48D1-9371-987BC55FEE83}.Release|Any CPU.Build.0 = Release|Win32
{5F2E77D5-1485-48D1-9371-987BC55FEE83}.Release|Mixed Platforms.ActiveCfg = Release|Win32 {5F2E77D5-1485-48D1-9371-987BC55FEE83}.Release|Mixed Platforms.ActiveCfg = Release|Win32
{5F2E77D5-1485-48D1-9371-987BC55FEE83}.Release|Mixed Platforms.Build.0 = Release|Win32 {5F2E77D5-1485-48D1-9371-987BC55FEE83}.Release|Mixed Platforms.Build.0 = Release|Win32
{5F2E77D5-1485-48D1-9371-987BC55FEE83}.Release|Win32.ActiveCfg = Release|Win32 {5F2E77D5-1485-48D1-9371-987BC55FEE83}.Release|Win32.ActiveCfg = Release|Win32
@ -139,6 +142,7 @@ Global
{23B58791-FD44-4F95-9F77-34E4AF45A296}.Debug|Win32.ActiveCfg = Debug|Win32 {23B58791-FD44-4F95-9F77-34E4AF45A296}.Debug|Win32.ActiveCfg = Debug|Win32
{23B58791-FD44-4F95-9F77-34E4AF45A296}.Debug|Win32.Build.0 = Debug|Win32 {23B58791-FD44-4F95-9F77-34E4AF45A296}.Debug|Win32.Build.0 = Debug|Win32
{23B58791-FD44-4F95-9F77-34E4AF45A296}.Release|Any CPU.ActiveCfg = Release|Win32 {23B58791-FD44-4F95-9F77-34E4AF45A296}.Release|Any CPU.ActiveCfg = Release|Win32
{23B58791-FD44-4F95-9F77-34E4AF45A296}.Release|Any CPU.Build.0 = Release|Win32
{23B58791-FD44-4F95-9F77-34E4AF45A296}.Release|Mixed Platforms.ActiveCfg = Release|Win32 {23B58791-FD44-4F95-9F77-34E4AF45A296}.Release|Mixed Platforms.ActiveCfg = Release|Win32
{23B58791-FD44-4F95-9F77-34E4AF45A296}.Release|Mixed Platforms.Build.0 = Release|Win32 {23B58791-FD44-4F95-9F77-34E4AF45A296}.Release|Mixed Platforms.Build.0 = Release|Win32
{23B58791-FD44-4F95-9F77-34E4AF45A296}.Release|Win32.ActiveCfg = Release|Win32 {23B58791-FD44-4F95-9F77-34E4AF45A296}.Release|Win32.ActiveCfg = Release|Win32
@ -155,6 +159,7 @@ Global
{963AF7B5-12E6-42B6-8CBE-89136C1A109B}.Debug|Win32.ActiveCfg = Debug|Win32 {963AF7B5-12E6-42B6-8CBE-89136C1A109B}.Debug|Win32.ActiveCfg = Debug|Win32
{963AF7B5-12E6-42B6-8CBE-89136C1A109B}.Debug|Win32.Build.0 = Debug|Win32 {963AF7B5-12E6-42B6-8CBE-89136C1A109B}.Debug|Win32.Build.0 = Debug|Win32
{963AF7B5-12E6-42B6-8CBE-89136C1A109B}.Release|Any CPU.ActiveCfg = Release|Win32 {963AF7B5-12E6-42B6-8CBE-89136C1A109B}.Release|Any CPU.ActiveCfg = Release|Win32
{963AF7B5-12E6-42B6-8CBE-89136C1A109B}.Release|Any CPU.Build.0 = Release|Win32
{963AF7B5-12E6-42B6-8CBE-89136C1A109B}.Release|Mixed Platforms.ActiveCfg = Release|Win32 {963AF7B5-12E6-42B6-8CBE-89136C1A109B}.Release|Mixed Platforms.ActiveCfg = Release|Win32
{963AF7B5-12E6-42B6-8CBE-89136C1A109B}.Release|Mixed Platforms.Build.0 = Release|Win32 {963AF7B5-12E6-42B6-8CBE-89136C1A109B}.Release|Mixed Platforms.Build.0 = Release|Win32
{963AF7B5-12E6-42B6-8CBE-89136C1A109B}.Release|Win32.ActiveCfg = Release|Win32 {963AF7B5-12E6-42B6-8CBE-89136C1A109B}.Release|Win32.ActiveCfg = Release|Win32
@ -171,6 +176,7 @@ Global
{57F1E1D0-28B6-42BF-BAFB-045AEE2DCF4F}.Debug|Win32.ActiveCfg = Debug|Win32 {57F1E1D0-28B6-42BF-BAFB-045AEE2DCF4F}.Debug|Win32.ActiveCfg = Debug|Win32
{57F1E1D0-28B6-42BF-BAFB-045AEE2DCF4F}.Debug|Win32.Build.0 = Debug|Win32 {57F1E1D0-28B6-42BF-BAFB-045AEE2DCF4F}.Debug|Win32.Build.0 = Debug|Win32
{57F1E1D0-28B6-42BF-BAFB-045AEE2DCF4F}.Release|Any CPU.ActiveCfg = Release|Win32 {57F1E1D0-28B6-42BF-BAFB-045AEE2DCF4F}.Release|Any CPU.ActiveCfg = Release|Win32
{57F1E1D0-28B6-42BF-BAFB-045AEE2DCF4F}.Release|Any CPU.Build.0 = Release|Win32
{57F1E1D0-28B6-42BF-BAFB-045AEE2DCF4F}.Release|Mixed Platforms.ActiveCfg = Release|Win32 {57F1E1D0-28B6-42BF-BAFB-045AEE2DCF4F}.Release|Mixed Platforms.ActiveCfg = Release|Win32
{57F1E1D0-28B6-42BF-BAFB-045AEE2DCF4F}.Release|Mixed Platforms.Build.0 = Release|Win32 {57F1E1D0-28B6-42BF-BAFB-045AEE2DCF4F}.Release|Mixed Platforms.Build.0 = Release|Win32
{57F1E1D0-28B6-42BF-BAFB-045AEE2DCF4F}.Release|Win32.ActiveCfg = Release|Win32 {57F1E1D0-28B6-42BF-BAFB-045AEE2DCF4F}.Release|Win32.ActiveCfg = Release|Win32
@ -187,6 +193,7 @@ Global
{42FE7CED-34B7-45C8-92C9-8856E16640D2}.Debug|Win32.ActiveCfg = Debug|Win32 {42FE7CED-34B7-45C8-92C9-8856E16640D2}.Debug|Win32.ActiveCfg = Debug|Win32
{42FE7CED-34B7-45C8-92C9-8856E16640D2}.Debug|Win32.Build.0 = Debug|Win32 {42FE7CED-34B7-45C8-92C9-8856E16640D2}.Debug|Win32.Build.0 = Debug|Win32
{42FE7CED-34B7-45C8-92C9-8856E16640D2}.Release|Any CPU.ActiveCfg = Release|Win32 {42FE7CED-34B7-45C8-92C9-8856E16640D2}.Release|Any CPU.ActiveCfg = Release|Win32
{42FE7CED-34B7-45C8-92C9-8856E16640D2}.Release|Any CPU.Build.0 = Release|Win32
{42FE7CED-34B7-45C8-92C9-8856E16640D2}.Release|Mixed Platforms.ActiveCfg = Release|Win32 {42FE7CED-34B7-45C8-92C9-8856E16640D2}.Release|Mixed Platforms.ActiveCfg = Release|Win32
{42FE7CED-34B7-45C8-92C9-8856E16640D2}.Release|Mixed Platforms.Build.0 = Release|Win32 {42FE7CED-34B7-45C8-92C9-8856E16640D2}.Release|Mixed Platforms.Build.0 = Release|Win32
{42FE7CED-34B7-45C8-92C9-8856E16640D2}.Release|Win32.ActiveCfg = Release|Win32 {42FE7CED-34B7-45C8-92C9-8856E16640D2}.Release|Win32.ActiveCfg = Release|Win32
@ -203,6 +210,7 @@ Global
{868702B0-CB6B-4F1D-B98A-32193347EFAF}.Debug|Win32.ActiveCfg = Debug|Win32 {868702B0-CB6B-4F1D-B98A-32193347EFAF}.Debug|Win32.ActiveCfg = Debug|Win32
{868702B0-CB6B-4F1D-B98A-32193347EFAF}.Debug|Win32.Build.0 = Debug|Win32 {868702B0-CB6B-4F1D-B98A-32193347EFAF}.Debug|Win32.Build.0 = Debug|Win32
{868702B0-CB6B-4F1D-B98A-32193347EFAF}.Release|Any CPU.ActiveCfg = Release|Win32 {868702B0-CB6B-4F1D-B98A-32193347EFAF}.Release|Any CPU.ActiveCfg = Release|Win32
{868702B0-CB6B-4F1D-B98A-32193347EFAF}.Release|Any CPU.Build.0 = Release|Win32
{868702B0-CB6B-4F1D-B98A-32193347EFAF}.Release|Mixed Platforms.ActiveCfg = Release|Win32 {868702B0-CB6B-4F1D-B98A-32193347EFAF}.Release|Mixed Platforms.ActiveCfg = Release|Win32
{868702B0-CB6B-4F1D-B98A-32193347EFAF}.Release|Mixed Platforms.Build.0 = Release|Win32 {868702B0-CB6B-4F1D-B98A-32193347EFAF}.Release|Mixed Platforms.Build.0 = Release|Win32
{868702B0-CB6B-4F1D-B98A-32193347EFAF}.Release|Win32.ActiveCfg = Release|Win32 {868702B0-CB6B-4F1D-B98A-32193347EFAF}.Release|Win32.ActiveCfg = Release|Win32
@ -219,6 +227,7 @@ Global
{E7A8B741-4E9D-4ED4-9F77-E7F637A678A5}.Debug|Win32.ActiveCfg = Debug|Win32 {E7A8B741-4E9D-4ED4-9F77-E7F637A678A5}.Debug|Win32.ActiveCfg = Debug|Win32
{E7A8B741-4E9D-4ED4-9F77-E7F637A678A5}.Debug|Win32.Build.0 = Debug|Win32 {E7A8B741-4E9D-4ED4-9F77-E7F637A678A5}.Debug|Win32.Build.0 = Debug|Win32
{E7A8B741-4E9D-4ED4-9F77-E7F637A678A5}.Release|Any CPU.ActiveCfg = Release|Win32 {E7A8B741-4E9D-4ED4-9F77-E7F637A678A5}.Release|Any CPU.ActiveCfg = Release|Win32
{E7A8B741-4E9D-4ED4-9F77-E7F637A678A5}.Release|Any CPU.Build.0 = Release|Win32
{E7A8B741-4E9D-4ED4-9F77-E7F637A678A5}.Release|Mixed Platforms.ActiveCfg = Release|Win32 {E7A8B741-4E9D-4ED4-9F77-E7F637A678A5}.Release|Mixed Platforms.ActiveCfg = Release|Win32
{E7A8B741-4E9D-4ED4-9F77-E7F637A678A5}.Release|Mixed Platforms.Build.0 = Release|Win32 {E7A8B741-4E9D-4ED4-9F77-E7F637A678A5}.Release|Mixed Platforms.Build.0 = Release|Win32
{E7A8B741-4E9D-4ED4-9F77-E7F637A678A5}.Release|Win32.ActiveCfg = Release|Win32 {E7A8B741-4E9D-4ED4-9F77-E7F637A678A5}.Release|Win32.ActiveCfg = Release|Win32
@ -235,6 +244,7 @@ Global
{3BEA6CFE-C158-4BFB-B5FB-ED85251E3F98}.Debug|Win32.ActiveCfg = Debug|Win32 {3BEA6CFE-C158-4BFB-B5FB-ED85251E3F98}.Debug|Win32.ActiveCfg = Debug|Win32
{3BEA6CFE-C158-4BFB-B5FB-ED85251E3F98}.Debug|Win32.Build.0 = Debug|Win32 {3BEA6CFE-C158-4BFB-B5FB-ED85251E3F98}.Debug|Win32.Build.0 = Debug|Win32
{3BEA6CFE-C158-4BFB-B5FB-ED85251E3F98}.Release|Any CPU.ActiveCfg = Release|Win32 {3BEA6CFE-C158-4BFB-B5FB-ED85251E3F98}.Release|Any CPU.ActiveCfg = Release|Win32
{3BEA6CFE-C158-4BFB-B5FB-ED85251E3F98}.Release|Any CPU.Build.0 = Release|Win32
{3BEA6CFE-C158-4BFB-B5FB-ED85251E3F98}.Release|Mixed Platforms.ActiveCfg = Release|Win32 {3BEA6CFE-C158-4BFB-B5FB-ED85251E3F98}.Release|Mixed Platforms.ActiveCfg = Release|Win32
{3BEA6CFE-C158-4BFB-B5FB-ED85251E3F98}.Release|Mixed Platforms.Build.0 = Release|Win32 {3BEA6CFE-C158-4BFB-B5FB-ED85251E3F98}.Release|Mixed Platforms.Build.0 = Release|Win32
{3BEA6CFE-C158-4BFB-B5FB-ED85251E3F98}.Release|Win32.ActiveCfg = Release|Win32 {3BEA6CFE-C158-4BFB-B5FB-ED85251E3F98}.Release|Win32.ActiveCfg = Release|Win32
@ -250,6 +260,7 @@ Global
{A63E9DF9-1D47-4D81-834C-1D40406C18C4}.Debug|Mixed Platforms.Build.0 = Debug|Win32 {A63E9DF9-1D47-4D81-834C-1D40406C18C4}.Debug|Mixed Platforms.Build.0 = Debug|Win32
{A63E9DF9-1D47-4D81-834C-1D40406C18C4}.Debug|Win32.ActiveCfg = Debug|Win32 {A63E9DF9-1D47-4D81-834C-1D40406C18C4}.Debug|Win32.ActiveCfg = Debug|Win32
{A63E9DF9-1D47-4D81-834C-1D40406C18C4}.Release|Any CPU.ActiveCfg = Release|Win32 {A63E9DF9-1D47-4D81-834C-1D40406C18C4}.Release|Any CPU.ActiveCfg = Release|Win32
{A63E9DF9-1D47-4D81-834C-1D40406C18C4}.Release|Any CPU.Build.0 = Release|Win32
{A63E9DF9-1D47-4D81-834C-1D40406C18C4}.Release|Mixed Platforms.ActiveCfg = Release|Win32 {A63E9DF9-1D47-4D81-834C-1D40406C18C4}.Release|Mixed Platforms.ActiveCfg = Release|Win32
{A63E9DF9-1D47-4D81-834C-1D40406C18C4}.Release|Mixed Platforms.Build.0 = Release|Win32 {A63E9DF9-1D47-4D81-834C-1D40406C18C4}.Release|Mixed Platforms.Build.0 = Release|Win32
{A63E9DF9-1D47-4D81-834C-1D40406C18C4}.Release|Win32.ActiveCfg = Release|Win32 {A63E9DF9-1D47-4D81-834C-1D40406C18C4}.Release|Win32.ActiveCfg = Release|Win32
@ -263,7 +274,6 @@ Global
{7CC01C3D-FC1A-4587-868A-7FC4449B3F8B}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU {7CC01C3D-FC1A-4587-868A-7FC4449B3F8B}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{7CC01C3D-FC1A-4587-868A-7FC4449B3F8B}.Debug|Win32.ActiveCfg = Debug|Any CPU {7CC01C3D-FC1A-4587-868A-7FC4449B3F8B}.Debug|Win32.ActiveCfg = Debug|Any CPU
{7CC01C3D-FC1A-4587-868A-7FC4449B3F8B}.Release|Any CPU.ActiveCfg = Release|Any CPU {7CC01C3D-FC1A-4587-868A-7FC4449B3F8B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7CC01C3D-FC1A-4587-868A-7FC4449B3F8B}.Release|Any CPU.Build.0 = Release|Any CPU
{7CC01C3D-FC1A-4587-868A-7FC4449B3F8B}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {7CC01C3D-FC1A-4587-868A-7FC4449B3F8B}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{7CC01C3D-FC1A-4587-868A-7FC4449B3F8B}.Release|Mixed Platforms.Build.0 = Release|Any CPU {7CC01C3D-FC1A-4587-868A-7FC4449B3F8B}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{7CC01C3D-FC1A-4587-868A-7FC4449B3F8B}.Release|Win32.ActiveCfg = Release|Any CPU {7CC01C3D-FC1A-4587-868A-7FC4449B3F8B}.Release|Win32.ActiveCfg = Release|Any CPU
@ -277,7 +287,6 @@ Global
{F14B75D8-3ED7-4621-B5B9-E96A80B5D809}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU {F14B75D8-3ED7-4621-B5B9-E96A80B5D809}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{F14B75D8-3ED7-4621-B5B9-E96A80B5D809}.Debug|Win32.ActiveCfg = Debug|Any CPU {F14B75D8-3ED7-4621-B5B9-E96A80B5D809}.Debug|Win32.ActiveCfg = Debug|Any CPU
{F14B75D8-3ED7-4621-B5B9-E96A80B5D809}.Release|Any CPU.ActiveCfg = Release|Any CPU {F14B75D8-3ED7-4621-B5B9-E96A80B5D809}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F14B75D8-3ED7-4621-B5B9-E96A80B5D809}.Release|Any CPU.Build.0 = Release|Any CPU
{F14B75D8-3ED7-4621-B5B9-E96A80B5D809}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {F14B75D8-3ED7-4621-B5B9-E96A80B5D809}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{F14B75D8-3ED7-4621-B5B9-E96A80B5D809}.Release|Mixed Platforms.Build.0 = Release|Any CPU {F14B75D8-3ED7-4621-B5B9-E96A80B5D809}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{F14B75D8-3ED7-4621-B5B9-E96A80B5D809}.Release|Win32.ActiveCfg = Release|Any CPU {F14B75D8-3ED7-4621-B5B9-E96A80B5D809}.Release|Win32.ActiveCfg = Release|Any CPU

View File

@ -1,5 +1,5 @@
/* /*
* $Id: Awk.cpp,v 1.80 2007/10/21 13:58:47 bacon Exp $ * $Id: Awk.cpp,v 1.81 2007/10/28 06:12:37 bacon Exp $
* *
* {License} * {License}
*/ */
@ -126,6 +126,21 @@ int Awk::Console::setFileName (const char_t* name)
} }
} }
int Awk::Console::setFNR (long_t fnr)
{
ase_awk_val_t* tmp;
int n;
tmp = ase_awk_makeintval (extio->run, fnr);
if (tmp == ASE_NULL) return -1;
ase_awk_refupval (extio->run, tmp);
n = ase_awk_setglobal (extio->run, ASE_AWK_GLOBAL_FNR, tmp);
ase_awk_refdownval (extio->run, tmp);
return n;
}
Awk::Console::Mode Awk::Console::getMode () const Awk::Console::Mode Awk::Console::getMode () const
{ {
return (Mode)extio->mode; return (Mode)extio->mode;
@ -1677,8 +1692,7 @@ void Awk::onRunEnd (run_t* run, int errnum, void* custom)
if (errnum == ERR_NOERR && r->callbackFailed) if (errnum == ERR_NOERR && r->callbackFailed)
{ {
ase_awk_setrunerror ( ase_awk_setrunerrnum (r->run, ERR_NOMEM);
r->run, ERR_NOMEM, 0, ASE_NULL, 0);
} }
r->awk->onRunEnd (*r); r->awk->onRunEnd (*r);

View File

@ -1,5 +1,5 @@
/* /*
* $Id: Awk.hpp,v 1.79 2007/10/25 14:43:17 bacon Exp $ * $Id: Awk.hpp,v 1.80 2007/10/28 06:12:37 bacon Exp $
* *
* {License} * {License}
*/ */
@ -273,6 +273,7 @@ public:
public: public:
Mode getMode () const; Mode getMode () const;
int setFileName (const char_t* name); int setFileName (const char_t* name);
int setFNR (long_t fnr);
protected: protected:
char_t* filename; char_t* filename;

View File

@ -1,5 +1,5 @@
/* /*
* $Id: Awk.java,v 1.29 2007/10/23 15:18:47 bacon Exp $ * $Id: Awk.java,v 1.30 2007/10/28 15:03:22 bacon Exp $
* *
* {License} * {License}
*/ */
@ -38,7 +38,7 @@ public abstract class Awk
public static final int OPTION_EXTIO = (1 << 7); public static final int OPTION_EXTIO = (1 << 7);
public static final int OPTION_COPROC = (1 << 8); public static final int OPTION_COPROC = (1 << 8);
public static final int OPTION_BLOCKLESS = (1 << 9); public static final int OPTION_BLOCKLESS = (1 << 9);
public static final int OPTION_ASEONE = (1 << 10); public static final int OPTION_BASEONE = (1 << 10);
public static final int OPTION_STRIPSPACES = (1 << 11); public static final int OPTION_STRIPSPACES = (1 << 11);
public static final int OPTION_NEXTOFILE = (1 << 12); public static final int OPTION_NEXTOFILE = (1 << 12);
public static final int OPTION_CRLF = (1 << 13); public static final int OPTION_CRLF = (1 << 13);

View File

@ -1,5 +1,5 @@
/* /*
* $Id: awk_i.h,v 1.9 2007/10/24 09:57:45 bacon Exp $ * $Id: awk_i.h,v 1.10 2007/10/28 06:12:37 bacon Exp $
* *
* {License} * {License}
*/ */
@ -256,7 +256,9 @@ struct ase_awk_run_t
void* rs; void* rs;
void* fs; void* fs;
int ignorecase; int ignorecase;
ase_size_t fnr;
ase_long_t nr;
ase_long_t fnr;
struct struct
{ {

View File

@ -1,5 +1,5 @@
/* /*
* $Id: extio.c,v 1.7 2007/10/26 12:49:24 bacon Exp $ * $Id: extio.c,v 1.8 2007/10/28 06:12:37 bacon Exp $
* *
* {License} * {License}
*/ */
@ -392,33 +392,6 @@ int ase_awk_readextio (
rs->type != ASE_AWK_VAL_STR) ASE_AWK_FREE (run->awk, rs_ptr); rs->type != ASE_AWK_VAL_STR) ASE_AWK_FREE (run->awk, rs_ptr);
ase_awk_refdownval (run, rs); ase_awk_refdownval (run, rs);
/* increment NR for console input */
if (extio_type == ASE_AWK_EXTIO_CONSOLE && ret != -1 && ret != 0)
{
ase_awk_val_t* nr;
ase_long_t lv;
ase_real_t rv;
nr = ase_awk_getglobal (run, ASE_AWK_GLOBAL_NR);
ase_awk_refupval (run, nr);
n = ase_awk_valtonum (run, nr, &lv, &rv);
ase_awk_refdownval (run, nr);
if (n == -1) ret = -1;
else
{
if (n == 1) lv = (ase_long_t)rv;
nr = ase_awk_makeintval (run, lv + 1);
if (nr == ASE_NULL) ret = -1;
else
{
if (ase_awk_setglobal (
run, ASE_AWK_GLOBAL_NR, nr) == -1) ret = -1;
}
}
}
return ret; return ret;
} }

View File

@ -1,5 +1,5 @@
/* /*
* $Id: rec.c,v 1.4 2007/10/21 13:58:47 bacon Exp $ * $Id: rec.c,v 1.5 2007/10/28 06:12:37 bacon Exp $
* *
* {License} * {License}
*/ */
@ -224,8 +224,14 @@ static int __split_record (ase_awk_run_t* run)
v = ase_awk_makeintval (run, (ase_long_t)nflds); v = ase_awk_makeintval (run, (ase_long_t)nflds);
if (v == ASE_NULL) return -1; if (v == ASE_NULL) return -1;
if (ase_awk_setglobal (run, ASE_AWK_GLOBAL_NF, v) == -1) return -1; ase_awk_refupval (run, v);
if (ase_awk_setglobal (run, ASE_AWK_GLOBAL_NF, v) == -1)
{
ase_awk_refdownval (run, v);
return -1;
}
ase_awk_refdownval (run, v);
ASE_ASSERT (nflds == run->inrec.nflds); ASE_ASSERT (nflds == run->inrec.nflds);
return 0; return 0;
} }
@ -422,8 +428,13 @@ static int __recomp_record_fields (
v = ase_awk_makeintval (run, (ase_long_t)max); v = ase_awk_makeintval (run, (ase_long_t)max);
if (v == ASE_NULL) return -1; if (v == ASE_NULL) return -1;
if (ase_awk_setglobal ( ase_awk_refupval (run, v);
run, ASE_AWK_GLOBAL_NF, v) == -1) return -1; if (ase_awk_setglobal (run, ASE_AWK_GLOBAL_NF, v) == -1)
{
ase_awk_refdownval (run, v);
return -1;
}
ase_awk_refdownval (run, v);
} }
return 0; return 0;

View File

@ -1,5 +1,5 @@
/* /*
* $Id: run.c,v 1.19 2007/10/25 14:43:17 bacon Exp $ * $Id: run.c,v 1.20 2007/10/28 06:12:37 bacon Exp $
* *
* {License} * {License}
*/ */
@ -308,6 +308,18 @@ static int set_global (
run->global.convfmt.ptr = convfmt_ptr; run->global.convfmt.ptr = convfmt_ptr;
run->global.convfmt.len = convfmt_len; run->global.convfmt.len = convfmt_len;
} }
else if (idx == ASE_AWK_GLOBAL_FNR)
{
int n;
ase_long_t lv;
ase_real_t rv;
n = ase_awk_valtonum (run, val, &lv, &rv);
if (n == -1) return -1;
if (n == 1) lv = (ase_long_t)rv;
run->global.fnr = lv;
}
else if (idx == ASE_AWK_GLOBAL_FS) else if (idx == ASE_AWK_GLOBAL_FS)
{ {
ase_char_t* fs_ptr; ase_char_t* fs_ptr;
@ -356,17 +368,17 @@ static int set_global (
else if (idx == ASE_AWK_GLOBAL_IGNORECASE) else if (idx == ASE_AWK_GLOBAL_IGNORECASE)
{ {
if ((val->type == ASE_AWK_VAL_INT && if ((val->type == ASE_AWK_VAL_INT &&
((ase_awk_val_int_t*)val)->val == 0) || ((ase_awk_val_int_t*)val)->val != 0) ||
(val->type == ASE_AWK_VAL_REAL && (val->type == ASE_AWK_VAL_REAL &&
((ase_awk_val_real_t*)val)->val == 0.0) || ((ase_awk_val_real_t*)val)->val != 0.0) ||
(val->type == ASE_AWK_VAL_STR && (val->type == ASE_AWK_VAL_STR &&
((ase_awk_val_str_t*)val)->len == 0)) ((ase_awk_val_str_t*)val)->len != 0))
{ {
run->global.ignorecase = 0; run->global.ignorecase = 1;
} }
else else
{ {
run->global.ignorecase = 1; run->global.ignorecase = 0;
} }
} }
else if (idx == ASE_AWK_GLOBAL_NF) else if (idx == ASE_AWK_GLOBAL_NF)
@ -389,6 +401,18 @@ static int set_global (
} }
} }
} }
else if (idx == ASE_AWK_GLOBAL_NR)
{
int n;
ase_long_t lv;
ase_real_t rv;
n = ase_awk_valtonum (run, val, &lv, &rv);
if (n == -1) return -1;
if (n == 1) lv = (ase_long_t)rv;
run->global.nr = lv;
}
else if (idx == ASE_AWK_GLOBAL_OFMT) else if (idx == ASE_AWK_GLOBAL_OFMT)
{ {
ase_char_t* ofmt_ptr; ase_char_t* ofmt_ptr;
@ -650,7 +674,7 @@ int ase_awk_run (ase_awk_t* awk,
} }
else else
{ {
ase_awk_seterror (awk, ASE_AWK_ERUNTIME, 0, ASE_NULL, 0); ase_awk_seterrnum (awk, ASE_AWK_ERUNTIME);
} }
} }
@ -1043,22 +1067,45 @@ static void cleanup_globals (ase_awk_run_t* run)
} }
} }
static int update_fnr (ase_awk_run_t* run, ase_size_t fnr) static int update_fnr (ase_awk_run_t* run, ase_long_t fnr, ase_long_t nr)
{ {
ase_awk_val_t* tmp; ase_awk_val_t* tmp1, * tmp2;
tmp = ase_awk_makeintval (run, fnr); tmp1 = ase_awk_makeintval (run, fnr);
if (tmp == ASE_NULL) return -1; if (tmp1 == ASE_NULL) return -1;
ase_awk_refupval (run, tmp); ase_awk_refupval (run, tmp1);
if (ase_awk_setglobal (run, ASE_AWK_GLOBAL_FNR, tmp) == -1)
if (nr == fnr) tmp2 = tmp1;
else
{ {
ase_awk_refdownval (run, tmp); tmp2 = ase_awk_makeintval (run, nr);
if (tmp2 == ASE_NULL)
{
ase_awk_refdownval (run, tmp1);
return -1; return -1;
} }
ase_awk_refdownval (run, tmp); ase_awk_refupval (run, tmp2);
run->global.fnr = fnr; }
if (ase_awk_setglobal (run, ASE_AWK_GLOBAL_FNR, tmp1) == -1)
{
if (nr != fnr) ase_awk_refdownval (run, tmp2);
ase_awk_refdownval (run, tmp1);
return -1;
}
if (ase_awk_setglobal (run, ASE_AWK_GLOBAL_NR, tmp2) == -1)
{
if (nr != fnr) ase_awk_refdownval (run, tmp2);
ase_awk_refdownval (run, tmp1);
return -1;
}
if (nr != fnr) ase_awk_refdownval (run, tmp2);
ase_awk_refdownval (run, tmp1);
return 0; return 0;
} }
@ -1154,15 +1201,6 @@ static int run_main (
} }
} }
if (ase_awk_setglobal (run, ASE_AWK_GLOBAL_NR, ase_awk_val_zero) == -1)
{
/* it can simply restore the top of the stack this way
* because the values pused onto the stack so far are
* all ase_awk_val_nils */
run->stack_top = saved_stack_top;
return -1;
}
if (ase_awk_setglobal (run, ASE_AWK_GLOBAL_NF, ase_awk_val_zero) == -1) if (ase_awk_setglobal (run, ASE_AWK_GLOBAL_NF, ase_awk_val_zero) == -1)
{ {
/* it can simply restore the top of the stack this way /* it can simply restore the top of the stack this way
@ -1185,7 +1223,7 @@ static int run_main (
run->exit_level = EXIT_NONE; run->exit_level = EXIT_NONE;
n = update_fnr (run, 0); n = update_fnr (run, 0, 0);
if (n == 0) n = set_globals_to_default (run); if (n == 0) n = set_globals_to_default (run);
if (n == 0 && main != ASE_NULL) if (n == 0 && main != ASE_NULL)
{ {
@ -1451,7 +1489,7 @@ static int run_pattern_blocks (ase_awk_run_t* run)
} }
if (n == 0) break; /* end of input */ if (n == 0) break; /* end of input */
if (update_fnr (run, run->global.fnr+1) == -1) if (update_fnr (run, run->global.fnr+1, run->global.nr+1) == -1)
{ {
ADJUST_ERROR_LINE (run); ADJUST_ERROR_LINE (run);
return -1; return -1;
@ -2245,7 +2283,8 @@ static int run_nextinfile (ase_awk_run_t* run, ase_awk_nde_nextfile_t* nde)
return 0; return 0;
} }
if (update_fnr (run, 0) == -1) /* FNR resets to 0, NR remains the same */
if (update_fnr (run, 0, run->global.nr) == -1)
{ {
run->errlin = nde->line; run->errlin = nde->line;
return -1; return -1;
@ -3158,6 +3197,8 @@ static ase_awk_val_t* do_assignment_scalar (
{ {
if (set_global (run, var->id.idxa, var, val) == -1) if (set_global (run, var->id.idxa, var, val) == -1)
{ {
/* adjust error line */
run->errlin = var->line;
return ASE_NULL; return ASE_NULL;
} }
} }

View File

@ -1,17 +1,20 @@
/* /*
* $Id: AseAwkPanel.java,v 1.11 2007/10/25 14:43:17 bacon Exp $ * $Id: AseAwkPanel.java,v 1.13 2007/10/28 15:03:22 bacon Exp $
*/ */
import java.awt.*; import java.awt.*;
import java.awt.event.*; import java.awt.event.*;
import java.net.URL; import java.net.URL;
import java.net.URLConnection;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.StringReader; import java.io.StringReader;
import java.io.StringWriter; import java.io.StringWriter;
import java.io.Reader; import java.io.Reader;
import java.io.Writer; import java.io.Writer;
import java.io.InputStream;
import java.io.FileOutputStream;
import ase.awk.StdAwk; import ase.awk.StdAwk;
import ase.awk.Console; import ase.awk.Console;
@ -95,9 +98,6 @@ public class AseAwkPanel extends Panel
setWord ("sin", "cain"); setWord ("sin", "cain");
setWord ("length", "len"); setWord ("length", "len");
setWord ("OFMT", "ofmt"); setWord ("OFMT", "ofmt");
setOption (getOption() | StdAwk.OPTION_MAPTOVAR);
//setOption (getOption() & ~StdAwk.OPTION_EXTIO);
} }
public void sleep (Context ctx, String name, Return ret, Argument[] args) public void sleep (Context ctx, String name, Return ret, Argument[] args)
@ -275,19 +275,103 @@ public class AseAwkPanel extends Panel
private TextArea srcOut; private TextArea srcOut;
private TextArea conIn; private TextArea conIn;
private TextArea conOut; private TextArea conOut;
private TextField entryPoint;
private TextField jniLib; private TextField jniLib;
private boolean jniLibLoaded = false; private boolean jniLibLoaded = false;
private class Option
{
private String name;
private int value;
private boolean state;
public Option (String name, int value, boolean state)
{
this.name = name;
this.value = value;
this.state = state;
}
public String getName()
{
return this.name;
}
public int getValue()
{
return this.value;
}
public boolean getState()
{
return this.state;
}
public void setState (boolean state)
{
this.state = state;
}
}
protected Option[] options = new Option[]
{
new Option("IMPLICIT", AseAwk.OPTION_IMPLICIT, true),
new Option("EXPLICIT", AseAwk.OPTION_EXPLICIT, false),
new Option("UNIQUEFN", AseAwk.OPTION_UNIQUEFN, false),
new Option("SHADING", AseAwk.OPTION_SHADING, true),
new Option("SHIFT", AseAwk.OPTION_SHIFT, false),
new Option("IDIV", AseAwk.OPTION_IDIV, false),
new Option("STRCONCAT", AseAwk.OPTION_STRCONCAT, false),
new Option("EXTIO", AseAwk.OPTION_EXTIO, true),
new Option("BLOCKLESS", AseAwk.OPTION_BLOCKLESS, true),
new Option("BASEONE", AseAwk.OPTION_BASEONE, true),
new Option("STRIPSPACES", AseAwk.OPTION_STRIPSPACES, false),
new Option("NEXTOFILE", AseAwk.OPTION_NEXTOFILE, false),
//new Option("CRLF", AseAwk.OPTION_CRLF, false),
new Option("ARGSTOMAIN", AseAwk.OPTION_ARGSTOMAIN, false),
new Option("RESET", AseAwk.OPTION_RESET, false),
new Option("MAPTOVAR", AseAwk.OPTION_MAPTOVAR, false),
new Option("PABLOCK", AseAwk.OPTION_PABLOCK, true)
};
public AseAwkPanel () public AseAwkPanel ()
{ {
jniLib = new TextField (); jniLib = new TextField ();
Font font = new Font ("Monospaced", Font.PLAIN, 14);
srcIn = new TextArea (); srcIn = new TextArea ();
srcOut = new TextArea (); srcOut = new TextArea ();
conIn = new TextArea (); conIn = new TextArea ();
conOut = new TextArea (); conOut = new TextArea ();
srcIn.setFont (font);
srcOut.setFont (font);
conIn.setFont (font);
conOut.setFont (font);
Panel srcInPanel = new Panel();
srcInPanel.setLayout (new BorderLayout());
srcInPanel.add (new Label("Source Input"), BorderLayout.NORTH);
srcInPanel.add (srcIn, BorderLayout.CENTER);
Panel srcOutPanel = new Panel();
srcOutPanel.setLayout (new BorderLayout());
srcOutPanel.add (new Label("Source Output"), BorderLayout.NORTH);
srcOutPanel.add (srcOut, BorderLayout.CENTER);
Panel conInPanel = new Panel();
conInPanel.setLayout (new BorderLayout());
conInPanel.add (new Label("Console Input"), BorderLayout.NORTH);
conInPanel.add (conIn, BorderLayout.CENTER);
Panel conOutPanel = new Panel();
conOutPanel.setLayout (new BorderLayout());
conOutPanel.add (new Label("Console Output"), BorderLayout.NORTH);
conOutPanel.add (conOut, BorderLayout.CENTER);
Button runBtn = new Button ("Run Awk"); Button runBtn = new Button ("Run Awk");
runBtn.addActionListener (new ActionListener () runBtn.addActionListener (new ActionListener ()
@ -298,6 +382,44 @@ public class AseAwkPanel extends Panel
} }
}); });
entryPoint = new TextField();
Panel entryPanel = new Panel();
entryPanel.setLayout (new BorderLayout());
entryPanel.add (new Label("Main:"), BorderLayout.WEST);
entryPanel.add (entryPoint, BorderLayout.CENTER);
Panel leftPanel = new Panel();
leftPanel.setLayout (new BorderLayout());
leftPanel.add (runBtn, BorderLayout.SOUTH);
Panel optPanel = new Panel();
optPanel.setBackground (Color.YELLOW);
optPanel.setLayout (new GridLayout(options.length, 1));
for (int i = 0; i < options.length; i++)
{
Checkbox cb = new Checkbox(options[i].getName(), options[i].getState());
cb.addItemListener (new ItemListener ()
{
public void itemStateChanged (ItemEvent e)
{
String name = (String)e.getItem();
for (int i = 0; i < options.length; i++)
{
if (options[i].getName().equals(name))
{
options[i].setState (e.getStateChange() == ItemEvent.SELECTED);
}
}
}
});
optPanel.add (cb);
}
leftPanel.add (entryPanel, BorderLayout.NORTH);
leftPanel.add (optPanel, BorderLayout.CENTER);
Panel topPanel = new Panel (); Panel topPanel = new Panel ();
BorderLayout topPanelLayout = new BorderLayout (); BorderLayout topPanelLayout = new BorderLayout ();
topPanel.setLayout (topPanelLayout); topPanel.setLayout (topPanelLayout);
@ -315,10 +437,10 @@ public class AseAwkPanel extends Panel
centerPanelLayout.setHgap (2); centerPanelLayout.setHgap (2);
centerPanelLayout.setVgap (2); centerPanelLayout.setVgap (2);
centerPanel.add (srcIn); centerPanel.add (srcInPanel);
centerPanel.add (srcOut); centerPanel.add (srcOutPanel);
centerPanel.add (conIn); centerPanel.add (conInPanel);
centerPanel.add (conOut); centerPanel.add (conOutPanel);
BorderLayout mainLayout = new BorderLayout (); BorderLayout mainLayout = new BorderLayout ();
mainLayout.setHgap (2); mainLayout.setHgap (2);
@ -328,29 +450,62 @@ public class AseAwkPanel extends Panel
add (topPanel, BorderLayout.NORTH); add (topPanel, BorderLayout.NORTH);
add (centerPanel, BorderLayout.CENTER); add (centerPanel, BorderLayout.CENTER);
add (runBtn, BorderLayout.SOUTH); add (leftPanel, BorderLayout.WEST);
////////////////////////////////////////////////////////////
String osname = System.getProperty ("os.name").toLowerCase();
URL url = this.getClass().getResource ( URL url = this.getClass().getResource (
this.getClass().getName() + ".class"); this.getClass().getName() + ".class");
File file = new File (url.getFile()); String protocol = url.getProtocol ();
String osname = System.getProperty ("os.name").toLowerCase(); boolean isHttp = url.getPath().startsWith ("http://");
String aseBase = file.getParentFile().getParentFile().getParent(); File file = new File (isHttp? url.getPath():url.getFile());
String base = protocol.equals("jar")?
file.getParentFile().getParentFile().getParent():
file.getParentFile().getParent();
if (osname.startsWith ("windows")) if (osname.startsWith ("windows"))
{ {
String path = aseBase + "\\lib\\aseawk_jni.dll"; String path;
jniLib.setText (path.substring(6)); if (isHttp)
}
else if (osname.startsWith ("mac"))
{ {
String path = aseBase + "/lib/.libs/libaseawk_jni.dylib"; base = "http://" + base.substring(6).replace('\\', '/');
jniLib.setText (path.substring(5)); String jniUrl = base + "/lib/aseawk_jni.dll";
String userHome = System.getProperty("user.home");
path = userHome + "\\aseawk_jni.dll";
try
{
copyNative (jniUrl, path);
}
catch (IOException e)
{
showMessage ("Cannot download native library - " + e.getMessage());
path = "ERROR - Not Available";
}
} }
else else
{ {
String path = aseBase + "/lib/.libs/libaseawk_jni.so"; path = base + "\\lib\\aseawk_jni.dll";
jniLib.setText (path.substring(5)); if (protocol.equals("jar")) path = path.substring(6);
}
jniLib.setText (path);
}
else if (osname.startsWith ("mac"))
{
String path = base + "/lib/.libs/libaseawk_jni.dylib";
if (!isHttp && protocol.equals("jar")) path = path.substring(5);
jniLib.setText (path);
}
else
{
String path = base + "/lib/.libs/libaseawk_jni.so";
if (!isHttp && protocol.equals("jar")) path = path.substring(5);
jniLib.setText (path);
} }
} }
@ -398,6 +553,9 @@ public class AseAwkPanel extends Panel
} }
} }
srcOut.setText ("");
conOut.setText ("");
try try
{ {
try try
@ -410,8 +568,23 @@ public class AseAwkPanel extends Panel
return; return;
} }
for (int i = 0; i < options.length; i++)
{
if (options[i].getState())
{
awk.setOption (awk.getOption() | options[i].getValue());
}
else
{
awk.setOption (awk.getOption() & ~options[i].getValue());
}
}
awk.parse (); awk.parse ();
awk.run ();
String main = entryPoint.getText().trim();
if (main.length() > 0) awk.run (main);
else awk.run ();
} }
catch (ase.awk.Exception e) catch (ase.awk.Exception e)
@ -439,4 +612,42 @@ public class AseAwkPanel extends Panel
message.dispose (); message.dispose ();
tmp.dispose (); tmp.dispose ();
} }
private void copyNative (String sourceURL, String destFile) throws IOException
{
InputStream is = null;
FileOutputStream fos = null;
try
{
URL url = new URL(sourceURL);
URLConnection conn = url.openConnection();
is = url.openStream();
fos = new FileOutputStream(destFile);
int n;
byte[] b = new byte[1024];
while ((n = is.read(b)) != -1)
{
fos.write(b, 0, n);
}
}
catch (IOException e) { throw e; }
finally
{
if (is != null)
{
try { is.close (); }
catch (IOException e) {}
}
if (fos != null)
{
try { fos.close (); }
catch (IOException e) {}
}
}
}
} }

View File

@ -1,5 +1,5 @@
/* /*
* $Id: Awk.cpp,v 1.45 2007/10/11 14:39:46 bacon Exp $ * $Id: Awk.cpp,v 1.46 2007/10/28 06:12:37 bacon Exp $
*/ */
#include <ase/awk/StdAwk.hpp> #include <ase/awk/StdAwk.hpp>
@ -216,12 +216,12 @@ public:
protected: protected:
void onRunStart (const Run& run) void onRunStart (Run& run)
{ {
ase_printf (ASE_T("*** awk run started ***\n")); ase_printf (ASE_T("*** awk run started ***\n"));
} }
void onRunEnd (const Run& run) void onRunEnd (Run& run)
{ {
ErrorCode err = run.getErrorCode(); ErrorCode err = run.getErrorCode();
@ -234,7 +234,7 @@ protected:
ase_printf (ASE_T("*** awk run ended ***\n")); ase_printf (ASE_T("*** awk run ended ***\n"));
} }
void onRunReturn (const Run& run, const Argument& ret) void onRunReturn (Run& run, const Argument& ret)
{ {
size_t len; size_t len;
const char_t* ptr = ret.toStr (&len); const char_t* ptr = ret.toStr (&len);
@ -412,7 +412,28 @@ protected:
while (n < (ssize_t)len) while (n < (ssize_t)len)
{ {
ase_cint_t c = ase_fgetc (fp); ase_cint_t c = ase_fgetc (fp);
if (c == ASE_CHAR_EOF) break; if (c == ASE_CHAR_EOF)
{
if (t->nextConIdx >= numConInFiles) break;
const char_t* fn = conInFile[t->nextConIdx];
FILE* nfp = ase_fopen (fn, ASE_T("r"));
if (nfp == ASE_NULL) return -1;
if (io.setFileName(fn) == -1 || io.setFNR(0) == -1)
{
fclose (nfp);
return -1;
}
fclose (fp);
fp = nfp;
t->nextConIdx++;
t->handle = fp;
if (n == 0) continue;
else break;
}
buf[n++] = c; buf[n++] = c;
if (c == ASE_T('\n')) break; if (c == ASE_T('\n')) break;

View File

@ -1,5 +1,5 @@
/* /*
* $Id: awk.c,v 1.20 2007/10/26 12:49:24 bacon Exp $ * $Id: awk.c,v 1.21 2007/10/28 06:12:37 bacon Exp $
*/ */
#include <ase/awk/awk.h> #include <ase/awk/awk.h>
@ -555,9 +555,9 @@ static ase_ssize_t awk_extio_console (
} }
if (ase_awk_setglobal ( if (ase_awk_setglobal (
epa->run, ASE_AWK_GLOBAL_NR, ase_awk_val_zero) == -1) epa->run, ASE_AWK_GLOBAL_FNR, ase_awk_val_zero) == -1)
{ {
/* need to reset NR */ /* need to reset FNR */
fclose (fp); fclose (fp);
return -1; return -1;
} }