From 221db8488e473025c921ef85d89cbd84054455e6 Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Sun, 1 Aug 2010 01:45:47 +0000 Subject: [PATCH] enhanced xma realloc() --- qse/cmd/sed/sed.c | 2 +- qse/include/qse/cmn/xma.h | 6 + qse/lib/cmn/xma.c | 149 +- qse/regress/awk/regress.out | 220 +-- qse/regress/awk/regress.out.xma | 2383 +++++++++++++++++++++++++++++++ qse/regress/awk/regress.sh | 113 +- qse/regress/sed/regress.out | 8 +- qse/regress/sed/regress.out.xma | 61 + qse/regress/sed/regress.sh | 66 +- qse/samples/cmn/xma.c | 122 +- 10 files changed, 2837 insertions(+), 293 deletions(-) create mode 100644 qse/regress/awk/regress.out.xma create mode 100644 qse/regress/sed/regress.out.xma diff --git a/qse/cmd/sed/sed.c b/qse/cmd/sed/sed.c index 30fb24f6..c77c9ebf 100644 --- a/qse/cmd/sed/sed.c +++ b/qse/cmd/sed/sed.c @@ -38,7 +38,7 @@ static qse_ulong_t g_memlimit = 0; static qse_mmgr_t xma_mmgr = { qse_xma_alloc, - QSE_NULL, + qse_xma_realloc, qse_xma_free, QSE_NULL }; diff --git a/qse/include/qse/cmn/xma.h b/qse/include/qse/cmn/xma.h index f729ac6d..d3bd0da7 100644 --- a/qse/include/qse/cmn/xma.h +++ b/qse/include/qse/cmn/xma.h @@ -96,6 +96,12 @@ void qse_xma_free ( void* b ); +void qse_xma_dump ( + qse_xma_t* xma, + int (*printf)(const qse_char_t* fmt,...) +); + + #ifdef __cplusplus } #endif diff --git a/qse/lib/cmn/xma.c b/qse/lib/cmn/xma.c index e77083d1..566f6744 100644 --- a/qse/lib/cmn/xma.c +++ b/qse/lib/cmn/xma.c @@ -491,37 +491,53 @@ static void* _realloc_merge (qse_xma_t* xma, void* b, qse_size_t size) if (rem >= MINBLKLEN) { qse_xma_blk_t* tmp; + qse_xma_blk_t* n = blk->b.next; /* the leftover is large enough to hold a block * of minimum size. split the current block. * let 'tmp' point to the leftover. */ tmp = (qse_xma_blk_t*)(((qse_byte_t*)(blk + 1)) + size); tmp->avail = 1; - tmp->size = rem - HDRSIZE; - /* link 'tmp' to the block list */ - tmp->b.next = blk->b.next; - tmp->b.prev = blk; - if (blk->b.next) blk->b.next->b.prev = tmp; - blk->b.next = tmp; - blk->size = size; + if (n && n->avail) + { + /* merge with the next block */ + detach_from_freelist (xma, n); + + tmp->b.next = n->b.next; + tmp->b.prev = blk; + if (n->b.next) n->b.next->b.prev = tmp; + blk->b.next = tmp; + blk->size = size; + + tmp->size = rem - HDRSIZE + HDRSIZE + n->size; + +#ifdef QSE_XMA_ENABLE_STAT + xma->stat.alloc -= rem; + /* rem - HDRSIZE(tmp) + HDRSIZE(n) */ + xma->stat.avail += rem; +#endif + } + else + { + /* link 'tmp' to the block list */ + tmp->b.next = n; + tmp->b.prev = blk; + if (n) n->b.prev = tmp; + blk->b.next = tmp; + blk->size = size; + + tmp->size = rem - HDRSIZE; + +#ifdef QSE_XMA_ENABLE_STAT + xma->stat.nfree++; + xma->stat.alloc -= rem; + xma->stat.avail += tmp->size; +#endif + } /* add 'tmp' to the free list */ attach_to_freelist (xma, tmp); - -/* TODO: if the next block is free. need to merge tmp with that..... */ -/* TODO: if the next block is free. need to merge tmp with that..... */ -/* TODO: if the next block is free. need to merge tmp with that..... */ -/* TODO: if the next block is free. need to merge tmp with that..... */ -/* TODO: if the next block is free. need to merge tmp with that..... */ -/* TODO: if the next block is free. need to merge tmp with that..... */ -/* TODO: if the next block is free. need to merge tmp with that..... */ - -#ifdef QSE_XMA_ENABLE_STAT - xma->stat.nfree++; - xma->stat.alloc -= rem; - xma->stat.avail += tmp->size; -#endif } } @@ -711,7 +727,7 @@ void qse_xma_free (qse_xma_t* xma, void* b) } } -void qse_xma_dump (qse_xma_t* xma) +void qse_xma_dump (qse_xma_t* xma, int (*printf)(const qse_char_t* fmt,...)) { qse_xma_blk_t* tmp; unsigned long long fsum, asum; @@ -719,19 +735,19 @@ void qse_xma_dump (qse_xma_t* xma) unsigned long long isum; #endif - qse_printf (QSE_T("\n")); + printf (QSE_T("\n")); #ifdef QSE_XMA_ENABLE_STAT - qse_printf (QSE_T("== statistics ==\n")); - qse_printf (QSE_T("total = %llu\n"), (unsigned long long)xma->stat.total); - qse_printf (QSE_T("alloc = %llu\n"), (unsigned long long)xma->stat.alloc); - qse_printf (QSE_T("avail = %llu\n"), (unsigned long long)xma->stat.avail); + printf (QSE_T("== statistics ==\n")); + printf (QSE_T("total = %llu\n"), (unsigned long long)xma->stat.total); + printf (QSE_T("alloc = %llu\n"), (unsigned long long)xma->stat.alloc); + printf (QSE_T("avail = %llu\n"), (unsigned long long)xma->stat.avail); #endif - qse_printf (QSE_T("== blocks ==\n")); - qse_printf (QSE_T(" size avail address\n")); + printf (QSE_T("== blocks ==\n")); + printf (QSE_T(" size avail address\n")); for (tmp = xma->head, fsum = 0, asum = 0; tmp; tmp = tmp->b.next) { - qse_printf (QSE_T(" %-18llu %-5d %p\n"), (unsigned long long)tmp->size, tmp->avail, tmp); + printf (QSE_T(" %-18llu %-5d %p\n"), (unsigned long long)tmp->size, tmp->avail, tmp); if (tmp->avail) fsum += tmp->size; else asum += tmp->size; } @@ -740,68 +756,19 @@ void qse_xma_dump (qse_xma_t* xma) isum = (xma->stat.nfree + xma->stat.nused) * HDRSIZE; #endif - qse_printf (QSE_T("---------------------------------------\n")); - qse_printf (QSE_T("Allocated blocks: %18llu bytes\n"), asum); - qse_printf (QSE_T("Available blocks: %18llu bytes\n"), fsum); + printf (QSE_T("---------------------------------------\n")); + printf (QSE_T("Allocated blocks: %18llu bytes\n"), asum); + printf (QSE_T("Available blocks: %18llu bytes\n"), fsum); #ifdef QSE_XMA_ENABLE_STAT - qse_printf (QSE_T("Internal use : %18llu bytes\n"), isum); - qse_printf (QSE_T("Total : %18llu bytes\n"), asum + fsum + isum); + printf (QSE_T("Internal use : %18llu bytes\n"), isum); + printf (QSE_T("Total : %18llu bytes\n"), asum + fsum + isum); +#endif + + QSE_ASSERT (asum == xma->stat.alloc); + QSE_ASSERT (fsum == xma->stat.avail); +#ifdef QSE_XMA_ENABLE_STAT + QSE_ASSERT (isum == xma->stat.total - (xma->stat.alloc + xma->stat.avail)); + QSE_ASSERT (asum + fsum + isum == xma->stat.total); #endif } -#if 0 -int main () -{ - int i; - void* ptr[100]; - - qse_xma_t* xma = qse_xma_open (100000L); - if (xma == QSE_NULL) - { - printf ("cannot open xma\n"); - return -1; - } - - for (i = 0; i < 100; i++) - { - int sz = (i + 1) * 10; - /*int sz = 10240;*/ - ptr[i] = qse_xma_alloc (xma, sz); - if (ptr[i] == QSE_NULL) - { - printf ("failed to alloc %d\n", sz); - break; - } - printf ("%d %p\n", sz, ptr[i]); - } - - for (--i; i > 0; i-= 3) - { - if (i >= 0) qse_xma_free (xma, ptr[i]); - } - -/* - qse_xma_free (xma, ptr[0]); - qse_xma_free (xma, ptr[1]); - qse_xma_free (xma, ptr[2]); -*/ - - { - void* x, * y; - - printf ("%p\n", qse_xma_alloc (xma, 5000)); - printf ("%p\n", qse_xma_alloc (xma, 1000)); - printf ("%p\n", (x = qse_xma_alloc (xma, 10))); - printf ("%p\n", (y = qse_xma_alloc (xma, 40))); - - if (x) qse_xma_free (xma, x); - if (y) qse_xma_free (xma, y); - printf ("%p\n", (x = qse_xma_alloc (xma, 10))); - printf ("%p\n", (y = qse_xma_alloc (xma, 40))); - } - qse_xma_dump (xma); - - qse_xma_close (xma); - return 0; -} -#endif diff --git a/qse/regress/awk/regress.out b/qse/regress/awk/regress.out index 98a75b12..99137993 100644 --- a/qse/regress/awk/regress.out +++ b/qse/regress/awk/regress.out @@ -1,5 +1,5 @@ -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk -f cou-001.awk cou.dat &1 +[CMD] ../../cmd/awk/.libs/qseawk -f cou-001.awk cou.dat &1 -------------------------------------------------------------------------------- USSR 275 Canada 25 @@ -13,7 +13,7 @@ Japan 120 Germany 61 England 56 -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk -f cou-002.awk cou.dat &1 +[CMD] ../../cmd/awk/.libs/qseawk -f cou-002.awk cou.dat &1 -------------------------------------------------------------------------------- COUNTRY AREA POP CONTINENT @@ -31,44 +31,44 @@ England 56 TOTAL 25681 2819 -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk -f cou-003.awk cou.dat &1 +[CMD] ../../cmd/awk/.libs/qseawk -f cou-003.awk cou.dat &1 -------------------------------------------------------------------------------- India 1267 746 Asia Japan 144 120 Asia Germany 96 61 Europe England 94 56 Europe -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk -f cou-004.awk cou.dat &1 +[CMD] ../../cmd/awk/.libs/qseawk -f cou-004.awk cou.dat &1 -------------------------------------------------------------------------------- USSR 8649 275 Asia USA 3615 237 North America Mexico 762 78 North America -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk -f cou-005.awk cou.dat &1 +[CMD] ../../cmd/awk/.libs/qseawk -f cou-005.awk cou.dat &1 -------------------------------------------------------------------------------- Canada 3852 25 North America Brazil 3286 134 South America Mexico 762 78 North America England 94 56 Europe -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk -f cou-006.awk cou.dat &1 +[CMD] ../../cmd/awk/.libs/qseawk -f cou-006.awk cou.dat &1 -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk -f cou-007.awk cou.dat &1 +[CMD] ../../cmd/awk/.libs/qseawk -f cou-007.awk cou.dat &1 -------------------------------------------------------------------------------- USSR 8649 275 Asia China 3705 1032 Asia India 1267 746 Asia Japan 144 120 Asia -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk -f cou-008.awk cou.dat &1 +[CMD] ../../cmd/awk/.libs/qseawk -f cou-008.awk cou.dat &1 -------------------------------------------------------------------------------- USSR 8649 275 Asia China 3705 1032 Asia India 1267 746 Asia Japan 144 120 Asia -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk -f cou-009.awk cou.dat &1 +[CMD] ../../cmd/awk/.libs/qseawk -f cou-009.awk cou.dat &1 -------------------------------------------------------------------------------- Canada 3852 25 North America USA 3615 237 North America @@ -78,22 +78,22 @@ France 211 55 Europe Germany 96 61 Europe England 94 56 Europe -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk -f cou-010.awk cou.dat &1 +[CMD] ../../cmd/awk/.libs/qseawk -f cou-010.awk cou.dat &1 -------------------------------------------------------------------------------- USSR 8649 275 Asia China 3705 1032 Asia India 1267 746 Asia Japan 144 120 Asia -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk -f cou-011.awk cou.dat &1 +[CMD] ../../cmd/awk/.libs/qseawk -f cou-011.awk cou.dat &1 -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk -f cou-012.awk cou.dat &1 +[CMD] ../../cmd/awk/.libs/qseawk -f cou-012.awk cou.dat &1 -------------------------------------------------------------------------------- China 3705 1032 Asia India 1267 746 Asia -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk -f cou-013.awk cou.dat &1 +[CMD] ../../cmd/awk/.libs/qseawk -f cou-013.awk cou.dat &1 -------------------------------------------------------------------------------- USSR 8649 275 Asia China 3705 1032 Asia @@ -103,7 +103,7 @@ Japan 144 120 Asia Germany 96 61 Europe England 94 56 Europe -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk -f cou-014.awk cou.dat &1 +[CMD] ../../cmd/awk/.libs/qseawk -f cou-014.awk cou.dat &1 -------------------------------------------------------------------------------- USSR 8649 275 Asia China 3705 1032 Asia @@ -113,7 +113,7 @@ Japan 144 120 Asia Germany 96 61 Europe England 94 56 Europe -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk -f cou-015.awk cou.dat &1 +[CMD] ../../cmd/awk/.libs/qseawk -f cou-015.awk cou.dat &1 -------------------------------------------------------------------------------- USSR 8649 275 Asia China 3705 1032 Asia @@ -123,7 +123,7 @@ Japan 144 120 Asia Germany 96 61 Europe England 94 56 Europe -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk -f cou-016.awk cou.dat &1 +[CMD] ../../cmd/awk/.libs/qseawk -f cou-016.awk cou.dat &1 -------------------------------------------------------------------------------- USSR 8649 275 Asia China 3705 1032 Asia @@ -133,16 +133,16 @@ Japan 144 120 Asia Germany 96 61 Europe England 94 56 Europe -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk -f cou-017.awk cou.dat &1 +[CMD] ../../cmd/awk/.libs/qseawk -f cou-017.awk cou.dat &1 -------------------------------------------------------------------------------- Canada 3852 25 North America China 3705 1032 Asia USA 3615 237 North America -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk -f cou-018.awk cou.dat &1 +[CMD] ../../cmd/awk/.libs/qseawk -f cou-018.awk cou.dat &1 -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk -f cou-019.awk cou.dat &1 +[CMD] ../../cmd/awk/.libs/qseawk -f cou-019.awk cou.dat &1 -------------------------------------------------------------------------------- cou.dat: USSR 8649 275 Asia cou.dat: Canada 3852 25 North America @@ -150,7 +150,7 @@ cou.dat: China 3705 1032 Asia cou.dat: USA 3615 237 North America cou.dat: Brazil 3286 134 South America -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk -f cou-020.awk cou.dat &1 +[CMD] ../../cmd/awk/.libs/qseawk -f cou-020.awk cou.dat &1 -------------------------------------------------------------------------------- cou.dat: USSR 8649 275 Asia cou.dat: Canada 3852 25 North America @@ -158,14 +158,14 @@ cou.dat: China 3705 1032 Asia cou.dat: USA 3615 237 North America cou.dat: Brazil 3286 134 South America -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk -f cou-021.awk cou.dat &1 +[CMD] ../../cmd/awk/.libs/qseawk -f cou-021.awk cou.dat &1 -------------------------------------------------------------------------------- USSR 8649000 China 3705000 India 1267000 Japan 144000 -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk -f cou-022.awk cou.dat &1 +[CMD] ../../cmd/awk/.libs/qseawk -f cou-022.awk cou.dat &1 -------------------------------------------------------------------------------- USSR 8649 275 Asia Canada 3852 25 NA @@ -179,7 +179,7 @@ Japan 144 120 Asia Germany 96 61 Europe England 94 56 Europe -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk -f cou-023.awk cou.dat &1 +[CMD] ../../cmd/awk/.libs/qseawk -f cou-023.awk cou.dat &1 -------------------------------------------------------------------------------- USSR 8649 275 Asia 31.7956 Canada 3852 25 North America 6.49013 @@ -193,42 +193,42 @@ Japan 144 120 Asia 833.333 Germany 96 61 Europe 635.417 England 94 56 Europe 595.745 -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk -f cou-024.awk cou.dat &1 +[CMD] ../../cmd/awk/.libs/qseawk -f cou-024.awk cou.dat &1 -------------------------------------------------------------------------------- Total population of the 4 Asian countries is 2173 million. -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk -f cou-025.awk cou.dat &1 +[CMD] ../../cmd/awk/.libs/qseawk -f cou-025.awk cou.dat &1 -------------------------------------------------------------------------------- Asian population is 2173 million. European population is 172 million. -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk -f cou-026.awk cou.dat &1 +[CMD] ../../cmd/awk/.libs/qseawk -f cou-026.awk cou.dat &1 -------------------------------------------------------------------------------- Asia 2173 Europe 172 North America 340 South America 134 -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk -f cou-027.awk cou.dat &1 +[CMD] ../../cmd/awk/.libs/qseawk -f cou-027.awk cou.dat &1 -------------------------------------------------------------------------------- Asia 2173 North America 340 Europe 172 South America 134 -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk -f emp-001.awk emp.dat &1 +[CMD] ../../cmd/awk/.libs/qseawk -f emp-001.awk emp.dat &1 -------------------------------------------------------------------------------- Kathy 40 Mark 100 Mary 121 Susie 76.5 -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk -f emp-002.awk emp.dat &1 +[CMD] ../../cmd/awk/.libs/qseawk -f emp-002.awk emp.dat &1 -------------------------------------------------------------------------------- Beth Dan -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk -f emp-003.awk emp.dat &1 +[CMD] ../../cmd/awk/.libs/qseawk -f emp-003.awk emp.dat &1 -------------------------------------------------------------------------------- 3 Beth 0 3 Dan 0 @@ -237,7 +237,7 @@ Dan 3 Mary 22 3 Susie 18 -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk -f emp-004.awk emp.dat &1 +[CMD] ../../cmd/awk/.libs/qseawk -f emp-004.awk emp.dat &1 -------------------------------------------------------------------------------- 1 Beth 4.00 0 2 Dan 3.74 0 @@ -246,7 +246,7 @@ Dan 5 Mary 5.50 22 6 Susie 4.25 18 -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk -f emp-005.awk emp.dat &1 +[CMD] ../../cmd/awk/.libs/qseawk -f emp-005.awk emp.dat &1 -------------------------------------------------------------------------------- total pay for Beth is 0 total pay for Dan is 0 @@ -255,7 +255,7 @@ total pay for Mark is 100 total pay for Mary is 121 total pay for Susie is 76.5 -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk -f emp-006.awk emp.dat &1 +[CMD] ../../cmd/awk/.libs/qseawk -f emp-006.awk emp.dat &1 -------------------------------------------------------------------------------- total pay for Beth is $0.00 total pay for Dan is $0.00 @@ -264,7 +264,7 @@ total pay for Mark is $100.00 total pay for Mary is $121.00 total pay for Susie is $76.50 -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk -f emp-007.awk emp.dat &1 +[CMD] ../../cmd/awk/.libs/qseawk -f emp-007.awk emp.dat &1 -------------------------------------------------------------------------------- Beth $ 0.00 Dan $ 0.00 @@ -273,26 +273,26 @@ Mark $100.00 Mary $121.00 Susie $ 76.50 -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk -f emp-008.awk emp.dat &1 +[CMD] ../../cmd/awk/.libs/qseawk -f emp-008.awk emp.dat &1 -------------------------------------------------------------------------------- Mark 5.00 20 Mary 5.50 22 -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk -f emp-009.awk emp.dat &1 +[CMD] ../../cmd/awk/.libs/qseawk -f emp-009.awk emp.dat &1 -------------------------------------------------------------------------------- $100.00 for Mark $121.00 for Mary $76.50 for Susie -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk -f emp-010.awk emp.dat &1 +[CMD] ../../cmd/awk/.libs/qseawk -f emp-010.awk emp.dat &1 -------------------------------------------------------------------------------- Susie 4.25 18 -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk -f emp-011.awk emp.dat &1 +[CMD] ../../cmd/awk/.libs/qseawk -f emp-011.awk emp.dat &1 -------------------------------------------------------------------------------- Susie 4.25 18 -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk -f emp-012.awk emp.dat &1 +[CMD] ../../cmd/awk/.libs/qseawk -f emp-012.awk emp.dat &1 -------------------------------------------------------------------------------- Beth 4.00 0 Kathy 4.00 10 @@ -300,7 +300,7 @@ Mark 5.00 20 Mary 5.50 22 Susie 4.25 18 -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk -f emp-013.awk emp.dat &1 +[CMD] ../../cmd/awk/.libs/qseawk -f emp-013.awk emp.dat &1 -------------------------------------------------------------------------------- Beth 4.00 0 Kathy 4.00 10 @@ -310,7 +310,7 @@ Mary 5.50 22 Mary 5.50 22 Susie 4.25 18 -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk -f emp-014.awk emp.dat &1 +[CMD] ../../cmd/awk/.libs/qseawk -f emp-014.awk emp.dat &1 -------------------------------------------------------------------------------- Beth 4.00 0 Kathy 4.00 10 @@ -318,10 +318,10 @@ Mark 5.00 20 Mary 5.50 22 Susie 4.25 18 -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk -f emp-015.awk emp.dat &1 +[CMD] ../../cmd/awk/.libs/qseawk -f emp-015.awk emp.dat &1 -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk -f emp-016.awk emp.dat &1 +[CMD] ../../cmd/awk/.libs/qseawk -f emp-016.awk emp.dat &1 -------------------------------------------------------------------------------- NAME RATE HOURS @@ -332,33 +332,33 @@ Mark 5.00 20 Mary 5.50 22 Susie 4.25 18 -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk -f emp-017.awk emp.dat &1 +[CMD] ../../cmd/awk/.libs/qseawk -f emp-017.awk emp.dat &1 -------------------------------------------------------------------------------- 3 employees worked more than 15 hours -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk -f emp-018.awk emp.dat &1 +[CMD] ../../cmd/awk/.libs/qseawk -f emp-018.awk emp.dat &1 -------------------------------------------------------------------------------- 6 employees -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk -f emp-019.awk emp.dat &1 +[CMD] ../../cmd/awk/.libs/qseawk -f emp-019.awk emp.dat &1 -------------------------------------------------------------------------------- 6 employees total pay is 337.5 average pay is 56.25 -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk -f emp-020.awk emp.dat &1 +[CMD] ../../cmd/awk/.libs/qseawk -f emp-020.awk emp.dat &1 -------------------------------------------------------------------------------- highest hourly rage: 5.50 for Mary -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk -f emp-021.awk emp.dat &1 +[CMD] ../../cmd/awk/.libs/qseawk -f emp-021.awk emp.dat &1 -------------------------------------------------------------------------------- Beth Dan Kathy Mark Mary Susie -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk -f emp-022.awk emp.dat &1 +[CMD] ../../cmd/awk/.libs/qseawk -f emp-022.awk emp.dat &1 -------------------------------------------------------------------------------- Susie 4.25 18 -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk -f emp-023.awk emp.dat &1 +[CMD] ../../cmd/awk/.libs/qseawk -f emp-023.awk emp.dat &1 -------------------------------------------------------------------------------- Beth 4 Dan 3 @@ -367,15 +367,15 @@ Mark 4 Mary 4 Susie 5 -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk -f emp-024.awk emp.dat &1 +[CMD] ../../cmd/awk/.libs/qseawk -f emp-024.awk emp.dat &1 -------------------------------------------------------------------------------- 6 lines, 18 words, 77 characters -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk -f emp-025.awk emp.dat &1 +[CMD] ../../cmd/awk/.libs/qseawk -f emp-025.awk emp.dat &1 -------------------------------------------------------------------------------- no employees are paid more than $6/hour -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk -f emp-026.awk emp.dat &1 +[CMD] ../../cmd/awk/.libs/qseawk -f emp-026.awk emp.dat &1 -------------------------------------------------------------------------------- Susie 4.25 18 Mary 5.50 22 @@ -384,7 +384,7 @@ Kathy 4.00 10 Dan 3.74 0 Beth 4.00 0 -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk -f emp-027.awk emp.dat &1 +[CMD] ../../cmd/awk/.libs/qseawk -f emp-027.awk emp.dat &1 -------------------------------------------------------------------------------- Susie 4.25 18 Mary 5.50 22 @@ -393,18 +393,18 @@ Kathy 4.00 10 Dan 3.74 0 Beth 4.00 0 -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk -f adr-001.awk adr.dat &1 +[CMD] ../../cmd/awk/.libs/qseawk -f adr-001.awk adr.dat &1 -------------------------------------------------------------------------------- James Brown 012-345-678 Richie Ren 02-3473-9192 Toh WeeKung 9102-1203 -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk -f adr-002.awk adr.dat &1 +[CMD] ../../cmd/awk/.libs/qseawk -f adr-002.awk adr.dat &1 -------------------------------------------------------------------------------- James Brown Somewhere over the rainbow 012-345-678 Toh WeeKung Singapore 9102-1203 -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk -f unr-001.awk unr.dat &1 +[CMD] ../../cmd/awk/.libs/qseawk -f unr-001.awk unr.dat &1 -------------------------------------------------------------------------------- Beth 4 0 Dan 3.74 0 @@ -413,7 +413,7 @@ Mark 5.00 20 Mary 5.5 22 Susie 4.25 18 -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk --strictnaming=off --newline=on -o- -f lang-001.awk &1 +[CMD] ../../cmd/awk/.libs/qseawk --strictnaming=off --newline=on -o- -f lang-001.awk &1 -------------------------------------------------------------------------------- function f (__p0) { @@ -426,7 +426,7 @@ BEGIN { hello -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-002.awk &1 +[CMD] ../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-002.awk &1 -------------------------------------------------------------------------------- function f (__p0) { @@ -939,7 +939,7 @@ my hello my hello ERROR: CODE 15 LINE 6 COLUMN 1 - block nested too deeply -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-003.awk &1 +[CMD] ../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-003.awk &1 -------------------------------------------------------------------------------- function fn (__p0) { @@ -954,11 +954,11 @@ BEGIN { 50 -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-004.awk &1 +[CMD] ../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-004.awk &1 -------------------------------------------------------------------------------- ERROR: CODE 42 LINE 3 COLUMN 9 - function 'a' redefined -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk --implicit=off --explicit=on --newline=on -o- -f lang-005.awk &1 +[CMD] ../../cmd/awk/.libs/qseawk --implicit=off --explicit=on --newline=on -o- -f lang-005.awk &1 -------------------------------------------------------------------------------- function a (__p0) { @@ -982,11 +982,11 @@ BEGIN { 50 100 -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk --implicit=off --explicit=on --newline=on -o- -f lang-006.awk &1 +[CMD] ../../cmd/awk/.libs/qseawk --implicit=off --explicit=on --newline=on -o- -f lang-006.awk &1 -------------------------------------------------------------------------------- ERROR: CODE 43 LINE 5 COLUMN 10 - global variable 'a' redefined -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk --implicit=on --explicit=on --newline=on -o- -f lang-007.awk &1 +[CMD] ../../cmd/awk/.libs/qseawk --implicit=on --explicit=on --newline=on -o- -f lang-007.awk &1 -------------------------------------------------------------------------------- global __g17; @@ -1005,7 +1005,7 @@ BEGIN { 20 30 -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk --implicit=off --explicit=on --newline=on -o- -f lang-008.awk &1 +[CMD] ../../cmd/awk/.libs/qseawk --implicit=off --explicit=on --newline=on -o- -f lang-008.awk &1 -------------------------------------------------------------------------------- global x; @@ -1027,7 +1027,7 @@ BEGIN { 2 1 -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk --implicit=off --explicit=on --newline=on --strictnaming=off -o- -f lang-009.awk lang-009.awk &1 +[CMD] ../../cmd/awk/.libs/qseawk --implicit=off --explicit=on --newline=on --strictnaming=off -o- -f lang-009.awk lang-009.awk &1 -------------------------------------------------------------------------------- function a (__p0) { @@ -1044,7 +1044,7 @@ END { } 1000 -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-010.awk this is just a test &1 +[CMD] ../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-010.awk this is just a test &1 -------------------------------------------------------------------------------- BEGIN { print "ARGC=",ARGC; @@ -1101,7 +1101,7 @@ ARGC [+10124.1123000000] is positive [A ] [-000000000000000000000000000000000000000000000001] abc10 000000000000000000000000000040 g good K -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-011.awk &1 +[CMD] ../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-011.awk &1 -------------------------------------------------------------------------------- BEGIN { a[1,2,3] = 20; @@ -1144,7 +1144,7 @@ BEGIN { (1,2,3) in a ==> 20 (4,5) not in a -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-012.awk &1 +[CMD] ../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-012.awk &1 -------------------------------------------------------------------------------- BEGIN { OFS = " "; @@ -1345,7 +1345,7 @@ a < " " : 1 -0.123 122.877 -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-013.awk &1 +[CMD] ../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-013.awk &1 -------------------------------------------------------------------------------- BEGIN { CONVFMT = "%s"; @@ -1354,7 +1354,7 @@ BEGIN { ERROR: CODE 103 LINE 3 COLUMN 2 - recursion detected in format conversion -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-014.awk &1 +[CMD] ../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-014.awk &1 -------------------------------------------------------------------------------- BEGIN { a = (10 + 20); @@ -1365,11 +1365,11 @@ BEGIN { 30 30 30 -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-015.awk &1 +[CMD] ../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-015.awk &1 -------------------------------------------------------------------------------- ERROR: CODE 15 LINE 3 COLUMN 50 - block nested too deeply -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-016.awk &1 +[CMD] ../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-016.awk &1 -------------------------------------------------------------------------------- BEGIN { printf "[[[[[%s]]]]\n",sprintf("abc %s abc",sprintf("def %s %s",sprintf("%s %s %s","xyz",1.2342,"xyz"),sprintf("ttt %s tttt",123.12))); @@ -1379,7 +1379,7 @@ BEGIN { [[[[[abc def xyz 1.2342 xyz ttt 123.12 tttt abc]]]] [[[[ttt 123.12 tttt]]]] -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-017.awk &1 +[CMD] ../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-017.awk &1 -------------------------------------------------------------------------------- function gety () { @@ -1430,7 +1430,7 @@ END { END OF PROGRAM END OF PROGRAM 2 -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk --call main --newline=on -o- -f lang-017.awk &1 +[CMD] ../../cmd/awk/.libs/qseawk --call main --newline=on -o- -f lang-017.awk &1 -------------------------------------------------------------------------------- function gety () { @@ -1479,31 +1479,31 @@ END { 0 2 -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk --explicit=on --newline=on -o- -f lang-018.awk &1 +[CMD] ../../cmd/awk/.libs/qseawk --explicit=on --newline=on -o- -f lang-018.awk &1 -------------------------------------------------------------------------------- ERROR: CODE 47 LINE 1 COLUMN 8 - duplicate global variable 'ARGV' -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk --explicit=on --newline=on -o- -f lang-019.awk &1 +[CMD] ../../cmd/awk/.libs/qseawk --explicit=on --newline=on -o- -f lang-019.awk &1 -------------------------------------------------------------------------------- ERROR: CODE 49 LINE 1 COLUMN 15 - '+' not a valid parameter name -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk --explicit=on --newline=on -o- -f lang-020.awk &1 +[CMD] ../../cmd/awk/.libs/qseawk --explicit=on --newline=on -o- -f lang-020.awk &1 -------------------------------------------------------------------------------- ERROR: CODE 50 LINE 1 COLUMN 8 - '+' not a valid variable name -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk --explicit=on --newline=on -o- -f lang-021.awk &1 +[CMD] ../../cmd/awk/.libs/qseawk --explicit=on --newline=on -o- -f lang-021.awk &1 -------------------------------------------------------------------------------- ERROR: CODE 50 LINE 3 COLUMN 8 - '+' not a valid variable name -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-022.awk &1 +[CMD] ../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-022.awk &1 -------------------------------------------------------------------------------- ERROR: CODE 23 LINE 2 COLUMN 9 - left parenthesis expected in place of '=' -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk --explicit=on --newline=on -o- -f lang-023.awk &1 +[CMD] ../../cmd/awk/.libs/qseawk --explicit=on --newline=on -o- -f lang-023.awk &1 -------------------------------------------------------------------------------- ERROR: CODE 28 LINE 5 COLUMN 20 - colon expected in place of ';' -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk --explicit=on --newline=on -o- -f lang-024.awk &1 +[CMD] ../../cmd/awk/.libs/qseawk --explicit=on --newline=on -o- -f lang-024.awk &1 -------------------------------------------------------------------------------- BEGIN { local __l0; @@ -1513,7 +1513,7 @@ BEGIN { 1 -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-025.awk &1 +[CMD] ../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-025.awk &1 -------------------------------------------------------------------------------- BEGIN { iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiix = 20; @@ -1522,7 +1522,7 @@ BEGIN { ERROR: CODE 78 LINE 3 COLUMN 9 - variable 'iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiix' not deletable -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-026.awk &1 +[CMD] ../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-026.awk &1 -------------------------------------------------------------------------------- BEGIN { abc[20] = "abc"; @@ -1534,19 +1534,19 @@ BEGIN { abc ERROR: CODE 86 LINE 4 COLUMN 2 - map 'abc' not assignable with a scalar -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-027.awk &1 +[CMD] ../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-027.awk &1 -------------------------------------------------------------------------------- ERROR: CODE 17 LINE 2 COLUMN 1 - invalid character '' -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-028.awk &1 +[CMD] ../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-028.awk &1 -------------------------------------------------------------------------------- ERROR: CODE 41 LINE 2 COLUMN 10 - intrinsic function 'substr' redefined -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk --explicit=on --newline=on -o- -f lang-029.awk &1 +[CMD] ../../cmd/awk/.libs/qseawk --explicit=on --newline=on -o- -f lang-029.awk &1 -------------------------------------------------------------------------------- ERROR: CODE 42 LINE 9 COLUMN 9 - function 'abc' redefined -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-030.awk &1 +[CMD] ../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-030.awk &1 -------------------------------------------------------------------------------- BEGIN { print (1 + 0); @@ -1598,7 +1598,7 @@ BEGIN { 0 0 -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-031.awk &1 +[CMD] ../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-031.awk &1 -------------------------------------------------------------------------------- BEGIN { print match("hhhheeeo",/e+/); @@ -1632,7 +1632,7 @@ BEGIN { 0 -1 -------------------------- -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-032.awk &1 +[CMD] ../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-032.awk &1 -------------------------------------------------------------------------------- BEGIN { a = 91; @@ -1654,7 +1654,7 @@ BEGIN { --------------------- 9210 -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-033.awk &1 +[CMD] ../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-033.awk &1 -------------------------------------------------------------------------------- BEGIN { while ((("cat lang-033.awk" | getline x) > 0)) @@ -1666,7 +1666,7 @@ BEGIN { print x } -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk --newline=on --rwpipe=on -o- -f lang-034.awk &1 +[CMD] ../../cmd/awk/.libs/qseawk --newline=on --rwpipe=on -o- -f lang-034.awk &1 -------------------------------------------------------------------------------- BEGIN { print "15" || "sort"; @@ -1687,7 +1687,7 @@ xx: 13 xx: 14 xx: 15 -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk --newline=on -o- -vdatafile=lang-035.dat1 -vgroupname=lang-035 -f lang-035.awk lang-035.dat2 &1 +[CMD] ../../cmd/awk/.libs/qseawk --newline=on -o- -vdatafile=lang-035.dat1 -vgroupname=lang-035 -f lang-035.awk lang-035.dat2 &1 -------------------------------------------------------------------------------- BEGIN { max_cid_vars = 100; @@ -1931,7 +1931,7 @@ lease 10.218.255.151 { uid "\001\000\033[\234\220\000"; } -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-036.awk lang-036.dat &1 +[CMD] ../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-036.awk lang-036.dat &1 -------------------------------------------------------------------------------- { if (($0 ~ /^-+$/)) @@ -1963,7 +1963,7 @@ pq...r AAA2 kbs ddd dif cccc -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-037.awk lang-037.dat &1 +[CMD] ../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-037.awk lang-037.dat &1 -------------------------------------------------------------------------------- BEGIN { RS = "\n-+\n"; @@ -1991,7 +1991,7 @@ pq...r AAA2 kbs ddd dif cccc -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-038.awk &1 +[CMD] ../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-038.awk &1 -------------------------------------------------------------------------------- BEGIN { xstr = "abcdefabcdefabcdef"; @@ -2020,7 +2020,7 @@ BEGIN { 7 abc 13 abc -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-039.awk &1 +[CMD] ../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-039.awk &1 -------------------------------------------------------------------------------- BEGIN { print (length() 11); @@ -2030,7 +2030,7 @@ BEGIN { 011 2 -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-040.awk &1 +[CMD] ../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-040.awk &1 -------------------------------------------------------------------------------- BEGIN { for (x in y) @@ -2038,7 +2038,7 @@ BEGIN { } -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-041.awk &1 +[CMD] ../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-041.awk &1 -------------------------------------------------------------------------------- BEGIN { abc = 20; @@ -2047,7 +2047,7 @@ BEGIN { 2010 -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-042.awk &1 +[CMD] ../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-042.awk &1 -------------------------------------------------------------------------------- BEGIN { print //; @@ -2087,7 +2087,7 @@ IGNORECASE= 1 1 1 -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk --newline=on -F: -f columnate.awk ./passwd.dat &1 +[CMD] ../../cmd/awk/.libs/qseawk --newline=on -F: -f columnate.awk ./passwd.dat &1 -------------------------------------------------------------------------------- root x 0 0 root /root /bin/bash daemon x 1 1 daemon /usr/sbin /bin/sh @@ -2128,7 +2128,7 @@ mysql x 117 124 MySQL Server,,, /var/lib openldap x 118 125 OpenLDAP Server Account,,, /nonexistent /bin/false postfix x 119 126 /var/spool/postfix /bin/false -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk --newline=on --include=on -f levenshtein-utests.awk &1 +[CMD] ../../cmd/awk/.libs/qseawk --newline=on --include=on -f levenshtein-utests.awk &1 -------------------------------------------------------------------------------- 3: Correct distance between 'kitten' and 'sitting' 3: Correct distance between 'Saturday' and 'Sunday' @@ -2143,7 +2143,7 @@ postfix x 119 126 /var/spo 1: Correct distance between 'freshpack' and 'freshpak' 1: Correct distance between 'freshpak' and 'freshpack' -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk --newline=on -v target=89000 -f rcalc.awk &1 +[CMD] ../../cmd/awk/.libs/qseawk --newline=on -v target=89000 -f rcalc.awk &1 -------------------------------------------------------------------------------- Result Ra Rb Connect Error @@ -2154,7 +2154,7 @@ Result Ra Rb Connect Error 89137.93 470000 110000 parallel +0.15%% 89189.19 220000 150000 parallel +0.21%% -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk -f quicksort.awk quicksort.dat &1 +[CMD] ../../cmd/awk/.libs/qseawk -f quicksort.awk quicksort.dat &1 -------------------------------------------------------------------------------- 0.0000000000 0.11111111111111111111111111111 @@ -2173,7 +2173,7 @@ Result Ra Rb Connect Error 1.E12 99X -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk -f quicksort2.awk quicksort2.dat &1 +[CMD] ../../cmd/awk/.libs/qseawk -f quicksort2.awk quicksort2.dat &1 -------------------------------------------------------------------------------- 0.0000000000 0.11111111111111111111111111111 @@ -2192,11 +2192,11 @@ Result Ra Rb Connect Error 1.E12 99X -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk -f asm.awk asm.s &1 +[CMD] ../../cmd/awk/.libs/qseawk -f asm.awk asm.s &1 -------------------------------------------------------------------------------- 549 -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk -f stripcomment.awk stripcomment.dat &1 +[CMD] ../../cmd/awk/.libs/qseawk -f stripcomment.awk stripcomment.dat &1 -------------------------------------------------------------------------------- @@ -2208,7 +2208,7 @@ int main () return 0; } -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk -f wordfreq.awk wordfreq.awk &1 +[CMD] ../../cmd/awk/.libs/qseawk -f wordfreq.awk wordfreq.awk &1 -------------------------------------------------------------------------------- _ 2 a 2 @@ -2236,7 +2236,7 @@ in 1 1 1 blank 2 -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk -f hanoi.awk &1 +[CMD] ../../cmd/awk/.libs/qseawk -f hanoi.awk &1 -------------------------------------------------------------------------------- 0 54321 1 @@ -2367,7 +2367,7 @@ blank 2 2 -------------------------------------------------------------------------------- - ../../cmd/awk/.libs/qseawk -f indent.awk indent.dat &1 +[CMD] ../../cmd/awk/.libs/qseawk -f indent.awk indent.dat &1 -------------------------------------------------------------------------------- #!/bin/sh diff --git a/qse/regress/awk/regress.out.xma b/qse/regress/awk/regress.out.xma new file mode 100644 index 00000000..4b1d4b7a --- /dev/null +++ b/qse/regress/awk/regress.out.xma @@ -0,0 +1,2383 @@ +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 -f cou-001.awk cou.dat &1 +-------------------------------------------------------------------------------- +USSR 275 +Canada 25 +China 1032 +USA 237 +Brazil 134 +India 746 +Mexico 78 +France 55 +Japan 120 +Germany 61 +England 56 +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 -f cou-002.awk cou.dat &1 +-------------------------------------------------------------------------------- + COUNTRY AREA POP CONTINENT + + USSR 8649 275 Asia + Canada 3852 25 North America + China 3705 1032 Asia + USA 3615 237 North America + Brazil 3286 134 South America + India 1267 746 Asia + Mexico 762 78 North America + France 211 55 Europe + Japan 144 120 Asia + Germany 96 61 Europe + England 94 56 Europe + + TOTAL 25681 2819 +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 -f cou-003.awk cou.dat &1 +-------------------------------------------------------------------------------- +India 1267 746 Asia +Japan 144 120 Asia +Germany 96 61 Europe +England 94 56 Europe +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 -f cou-004.awk cou.dat &1 +-------------------------------------------------------------------------------- +USSR 8649 275 Asia +USA 3615 237 North America +Mexico 762 78 North America +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 -f cou-005.awk cou.dat &1 +-------------------------------------------------------------------------------- +Canada 3852 25 North America +Brazil 3286 134 South America +Mexico 762 78 North America +England 94 56 Europe +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 -f cou-006.awk cou.dat &1 +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 -f cou-007.awk cou.dat &1 +-------------------------------------------------------------------------------- +USSR 8649 275 Asia +China 3705 1032 Asia +India 1267 746 Asia +Japan 144 120 Asia +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 -f cou-008.awk cou.dat &1 +-------------------------------------------------------------------------------- +USSR 8649 275 Asia +China 3705 1032 Asia +India 1267 746 Asia +Japan 144 120 Asia +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 -f cou-009.awk cou.dat &1 +-------------------------------------------------------------------------------- +Canada 3852 25 North America +USA 3615 237 North America +Brazil 3286 134 South America +Mexico 762 78 North America +France 211 55 Europe +Germany 96 61 Europe +England 94 56 Europe +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 -f cou-010.awk cou.dat &1 +-------------------------------------------------------------------------------- +USSR 8649 275 Asia +China 3705 1032 Asia +India 1267 746 Asia +Japan 144 120 Asia +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 -f cou-011.awk cou.dat &1 +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 -f cou-012.awk cou.dat &1 +-------------------------------------------------------------------------------- +China 3705 1032 Asia +India 1267 746 Asia +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 -f cou-013.awk cou.dat &1 +-------------------------------------------------------------------------------- +USSR 8649 275 Asia +China 3705 1032 Asia +India 1267 746 Asia +France 211 55 Europe +Japan 144 120 Asia +Germany 96 61 Europe +England 94 56 Europe +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 -f cou-014.awk cou.dat &1 +-------------------------------------------------------------------------------- +USSR 8649 275 Asia +China 3705 1032 Asia +India 1267 746 Asia +France 211 55 Europe +Japan 144 120 Asia +Germany 96 61 Europe +England 94 56 Europe +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 -f cou-015.awk cou.dat &1 +-------------------------------------------------------------------------------- +USSR 8649 275 Asia +China 3705 1032 Asia +India 1267 746 Asia +France 211 55 Europe +Japan 144 120 Asia +Germany 96 61 Europe +England 94 56 Europe +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 -f cou-016.awk cou.dat &1 +-------------------------------------------------------------------------------- +USSR 8649 275 Asia +China 3705 1032 Asia +India 1267 746 Asia +France 211 55 Europe +Japan 144 120 Asia +Germany 96 61 Europe +England 94 56 Europe +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 -f cou-017.awk cou.dat &1 +-------------------------------------------------------------------------------- +Canada 3852 25 North America +China 3705 1032 Asia +USA 3615 237 North America +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 -f cou-018.awk cou.dat &1 +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 -f cou-019.awk cou.dat &1 +-------------------------------------------------------------------------------- +cou.dat: USSR 8649 275 Asia +cou.dat: Canada 3852 25 North America +cou.dat: China 3705 1032 Asia +cou.dat: USA 3615 237 North America +cou.dat: Brazil 3286 134 South America +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 -f cou-020.awk cou.dat &1 +-------------------------------------------------------------------------------- +cou.dat: USSR 8649 275 Asia +cou.dat: Canada 3852 25 North America +cou.dat: China 3705 1032 Asia +cou.dat: USA 3615 237 North America +cou.dat: Brazil 3286 134 South America +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 -f cou-021.awk cou.dat &1 +-------------------------------------------------------------------------------- +USSR 8649000 +China 3705000 +India 1267000 +Japan 144000 +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 -f cou-022.awk cou.dat &1 +-------------------------------------------------------------------------------- +USSR 8649 275 Asia +Canada 3852 25 NA +China 3705 1032 Asia +USA 3615 237 NA +Brazil 3286 134 SA +India 1267 746 Asia +Mexico 762 78 NA +France 211 55 Europe +Japan 144 120 Asia +Germany 96 61 Europe +England 94 56 Europe +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 -f cou-023.awk cou.dat &1 +-------------------------------------------------------------------------------- +USSR 8649 275 Asia 31.7956 +Canada 3852 25 North America 6.49013 +China 3705 1032 Asia 278.543 +USA 3615 237 North America 65.5602 +Brazil 3286 134 South America 40.7791 +India 1267 746 Asia 588.792 +Mexico 762 78 North America 102.362 +France 211 55 Europe 260.664 +Japan 144 120 Asia 833.333 +Germany 96 61 Europe 635.417 +England 94 56 Europe 595.745 +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 -f cou-024.awk cou.dat &1 +-------------------------------------------------------------------------------- +Total population of the 4 Asian countries is 2173 million. +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 -f cou-025.awk cou.dat &1 +-------------------------------------------------------------------------------- +Asian population is 2173 million. +European population is 172 million. +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 -f cou-026.awk cou.dat &1 +-------------------------------------------------------------------------------- +Asia 2173 +Europe 172 +North America 340 +South America 134 +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 -f cou-027.awk cou.dat &1 +-------------------------------------------------------------------------------- + Asia 2173 + North America 340 + Europe 172 + South America 134 +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 -f emp-001.awk emp.dat &1 +-------------------------------------------------------------------------------- +Kathy 40 +Mark 100 +Mary 121 +Susie 76.5 +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 -f emp-002.awk emp.dat &1 +-------------------------------------------------------------------------------- +Beth +Dan +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 -f emp-003.awk emp.dat &1 +-------------------------------------------------------------------------------- +3 Beth 0 +3 Dan 0 +3 Kathy 10 +3 Mark 20 +3 Mary 22 +3 Susie 18 +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 -f emp-004.awk emp.dat &1 +-------------------------------------------------------------------------------- +1 Beth 4.00 0 +2 Dan 3.74 0 +3 Kathy 4.00 10 +4 Mark 5.00 20 +5 Mary 5.50 22 +6 Susie 4.25 18 +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 -f emp-005.awk emp.dat &1 +-------------------------------------------------------------------------------- +total pay for Beth is 0 +total pay for Dan is 0 +total pay for Kathy is 40 +total pay for Mark is 100 +total pay for Mary is 121 +total pay for Susie is 76.5 +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 -f emp-006.awk emp.dat &1 +-------------------------------------------------------------------------------- +total pay for Beth is $0.00 +total pay for Dan is $0.00 +total pay for Kathy is $40.00 +total pay for Mark is $100.00 +total pay for Mary is $121.00 +total pay for Susie is $76.50 +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 -f emp-007.awk emp.dat &1 +-------------------------------------------------------------------------------- +Beth $ 0.00 +Dan $ 0.00 +Kathy $ 40.00 +Mark $100.00 +Mary $121.00 +Susie $ 76.50 +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 -f emp-008.awk emp.dat &1 +-------------------------------------------------------------------------------- +Mark 5.00 20 +Mary 5.50 22 +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 -f emp-009.awk emp.dat &1 +-------------------------------------------------------------------------------- +$100.00 for Mark +$121.00 for Mary +$76.50 for Susie +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 -f emp-010.awk emp.dat &1 +-------------------------------------------------------------------------------- +Susie 4.25 18 +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 -f emp-011.awk emp.dat &1 +-------------------------------------------------------------------------------- +Susie 4.25 18 +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 -f emp-012.awk emp.dat &1 +-------------------------------------------------------------------------------- +Beth 4.00 0 +Kathy 4.00 10 +Mark 5.00 20 +Mary 5.50 22 +Susie 4.25 18 +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 -f emp-013.awk emp.dat &1 +-------------------------------------------------------------------------------- +Beth 4.00 0 +Kathy 4.00 10 +Mark 5.00 20 +Mark 5.00 20 +Mary 5.50 22 +Mary 5.50 22 +Susie 4.25 18 +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 -f emp-014.awk emp.dat &1 +-------------------------------------------------------------------------------- +Beth 4.00 0 +Kathy 4.00 10 +Mark 5.00 20 +Mary 5.50 22 +Susie 4.25 18 +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 -f emp-015.awk emp.dat &1 +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 -f emp-016.awk emp.dat &1 +-------------------------------------------------------------------------------- +NAME RATE HOURS + +Beth 4.00 0 +Dan 3.74 0 +Kathy 4.00 10 +Mark 5.00 20 +Mary 5.50 22 +Susie 4.25 18 +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 -f emp-017.awk emp.dat &1 +-------------------------------------------------------------------------------- +3 employees worked more than 15 hours +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 -f emp-018.awk emp.dat &1 +-------------------------------------------------------------------------------- +6 employees +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 -f emp-019.awk emp.dat &1 +-------------------------------------------------------------------------------- +6 employees +total pay is 337.5 +average pay is 56.25 +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 -f emp-020.awk emp.dat &1 +-------------------------------------------------------------------------------- +highest hourly rage: 5.50 for Mary +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 -f emp-021.awk emp.dat &1 +-------------------------------------------------------------------------------- +Beth Dan Kathy Mark Mary Susie +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 -f emp-022.awk emp.dat &1 +-------------------------------------------------------------------------------- +Susie 4.25 18 +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 -f emp-023.awk emp.dat &1 +-------------------------------------------------------------------------------- +Beth 4 +Dan 3 +Kathy 5 +Mark 4 +Mary 4 +Susie 5 +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 -f emp-024.awk emp.dat &1 +-------------------------------------------------------------------------------- +6 lines, 18 words, 77 characters +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 -f emp-025.awk emp.dat &1 +-------------------------------------------------------------------------------- +no employees are paid more than $6/hour +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 -f emp-026.awk emp.dat &1 +-------------------------------------------------------------------------------- +Susie 4.25 18 +Mary 5.50 22 +Mark 5.00 20 +Kathy 4.00 10 +Dan 3.74 0 +Beth 4.00 0 +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 -f emp-027.awk emp.dat &1 +-------------------------------------------------------------------------------- +Susie 4.25 18 +Mary 5.50 22 +Mark 5.00 20 +Kathy 4.00 10 +Dan 3.74 0 +Beth 4.00 0 +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 -f adr-001.awk adr.dat &1 +-------------------------------------------------------------------------------- +James Brown 012-345-678 +Richie Ren 02-3473-9192 +Toh WeeKung 9102-1203 +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 -f adr-002.awk adr.dat &1 +-------------------------------------------------------------------------------- +James Brown Somewhere over the rainbow 012-345-678 +Toh WeeKung Singapore 9102-1203 +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 -f unr-001.awk unr.dat &1 +-------------------------------------------------------------------------------- +Beth 4 0 +Dan 3.74 0 +0 4.00 10 +Mark 5.00 20 +Mary 5.5 22 +Susie 4.25 18 +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 --strictnaming=off --newline=on -o- -f lang-001.awk &1 +-------------------------------------------------------------------------------- +function f (__p0) +{ + print __p0; +} + +BEGIN { + f("hello"); +} + +hello +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 --newline=on -o- -f lang-002.awk &1 +-------------------------------------------------------------------------------- +function f (__p0) +{ + print __p0; + f("my hello"); +} + +BEGIN { + f(10); +} + +10 +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +my hello +ERROR: CODE 15 LINE 6 COLUMN 1 - block nested too deeply +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 --newline=on -o- -f lang-003.awk &1 +-------------------------------------------------------------------------------- +function fn (__p0) +{ + __p0 = 20; +} + +BEGIN { + f = 50; + fn(100); + print f; +} + +50 +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 --newline=on -o- -f lang-004.awk &1 +-------------------------------------------------------------------------------- +ERROR: CODE 42 LINE 3 COLUMN 9 - function 'a' redefined +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 --implicit=off --explicit=on --newline=on -o- -f lang-005.awk &1 +-------------------------------------------------------------------------------- +function a (__p0) +{ + print __p0; +} + +BEGIN { + local __l0, __l1; + { + __l0 = 50; + { + __l1 = 30; + print __l1; + } + print __l0; + } + a(100); +} + +30 +50 +100 +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 --implicit=off --explicit=on --newline=on -o- -f lang-006.awk &1 +-------------------------------------------------------------------------------- +ERROR: CODE 43 LINE 5 COLUMN 10 - global variable 'a' redefined +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 --implicit=on --explicit=on --newline=on -o- -f lang-007.awk &1 +-------------------------------------------------------------------------------- +global __g17; + +function fn () +{ + a = 20; + return a; +} + +BEGIN { + __g17 = 30; + print fn(); + print __g17; +} + +20 +30 +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 --implicit=off --explicit=on --newline=on -o- -f lang-008.awk &1 +-------------------------------------------------------------------------------- +global x; + +BEGIN { + local __l0, __l1; + x = 1; + { + __l0 = 2; + { + __l1 = 3; + print __l1; + } + print __l0; + } + print x; +} + +3 +2 +1 +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 --implicit=off --explicit=on --newline=on --strictnaming=off -o- -f lang-009.awk lang-009.awk &1 +-------------------------------------------------------------------------------- +function a (__p0) +{ + print __p0; +} + +BEGIN { + local __l0; + __l0 = 20; +} + +END { + a(1000); +} +1000 +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 --newline=on -o- -f lang-010.awk this is just a test &1 +-------------------------------------------------------------------------------- +BEGIN { + print "ARGC=",ARGC; + for (i in ARGV) + { + print (("ARGV[" i) "]"),ARGV[i]; + } + print "----------------------"; + print "ARGC=",ARGC; + split("111 22 333 555 666 777",ARGV); + for (i in ARGV) + { + print (("ARGV[" i) "]"),ARGV[i]; + } + if ((ARGC >= 0)) + printf ("ARGC [%++#10.10i] is positive\n",10); + if ((ARGC >= 0)) + printf ("ARGC [%++#10.10f] is positive\n",10); + if ((ARGC >= 0)) + printf ("ARGC [%++#10.10E] is positive\n",10124.1123); + if ((ARGC >= 0)) + printf ("ARGC [%++#10.10G] is positive\n",10124.1123); + if ((ARGC >= 0)) + printf ("ARGC [%++#10.10g] is positive\n",10124.1123); + if ((ARGC >= 0)) + printf ("ARGC [%++#10.10f] is positive\n",10124.1123); + printf ("[%d], [%f], [%s]\n",10124.1123,10124.1123,10124.1123); + printf ("[%-10c] [% 0*.*d]\n",65,45,48,(-(1))); + print sprintf("abc%d %*.*d %c %s %c",10,20,30,40,"good","good",75.34); +} + +ARGC= 6 +ARGV[0] qseawk +ARGV[1] this +ARGV[2] is +ARGV[3] just +ARGV[4] a +ARGV[5] test +---------------------- +ARGC= 6 +ARGV[1] 111 +ARGV[2] 22 +ARGV[3] 333 +ARGV[4] 555 +ARGV[5] 666 +ARGV[6] 777 +ARGC [+0000000010] is positive +ARGC [+10.0000000000] is positive +ARGC [+1.0124112300E+04] is positive +ARGC [+10124.11230] is positive +ARGC [+10124.11230] is positive +ARGC [+10124.1123000000] is positive +[10124], [10124.112300], [10124.1] +[A ] [-000000000000000000000000000000000000000000000001] +abc10 000000000000000000000000000040 g good K +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 --newline=on -o- -f lang-011.awk &1 +-------------------------------------------------------------------------------- +BEGIN { + a[1,2,3] = 20; + a[4,5,6] = 30; + for (i in a) + { + n = split(i,k,SUBSEP); + for (j = 1; (j <= n); (j)++) + { + print k[j]; + } + print "-------------------"; + } + if (((1,2,3) in a)) + { + print ("(1,2,3) in a ==> " a[1,2,3]); + } + else + { + print "(1,2,3) not in a"; + } + if (((4,5) in a)) + { + print ("(4,5) in a ==> " a[4,5]); + } + else + { + print "(4,5) not in a"; + } +} + +4 +5 +6 +------------------- +1 +2 +3 +------------------- +(1,2,3) in a ==> 20 +(4,5) not in a +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 --newline=on -o- -f lang-012.awk &1 +-------------------------------------------------------------------------------- +BEGIN { + OFS = " "; + print "1==1 :",(1 == 1); + print "1==0 :",(1 == 0); + print "1.0==1 :",(1.0 == 1); + print "1.1==1 :",(1.1 == 1); + print "1.0!=1 :",(1.0 != 1); + print "1.1!=1 :",(1.1 != 1); + print "\"abc\" == \"abc\"",("abc" == "abc"); + print "\"abc\" != \"abc\"",("abc" != "abc"); + print "--------------------------"; + print "a == \"\" :",(a == ""); + print "a >= \"\" :",(a >= ""); + print "a <= \"\" :",(a <= ""); + print "a > \"\" :",(a > ""); + print "a < \"\" :",(a < ""); + print "--------------------------"; + print "a == \" \" :",(a == " "); + print "a >= \" \" :",(a >= " "); + print "a <= \" \" :",(a <= " "); + print "a > \" \" :",(a > " "); + print "a < \" \" :",(a < " "); + print "--------------------------"; + print "\"\" == a :",("" == a); + print "\"\" >= a:",("" >= a); + print "\"\" <= a:",("" <= a); + print "\"\" > a:",("" > a); + print "\"\" < a:",("" < a); + print "--------------------------"; + print "\" \" == a :",(" " == a); + print "\" \" >= a:",(" " >= a); + print "\" \" <= a:",(" " <= a); + print "\" \" > a:",(" " > a); + print "\" \" < a:",(" " < a); + print "--------------------------"; + print "10 == \"10\"",(10 == "10"); + print "10 != \"10\"",(10 != "10"); + print "10 >= \"10\"",(10 >= "10"); + print "10 <= \"10\"",(10 <= "10"); + print "10 > \"10\"",(10 > "10"); + print "10 < \"10\"",(10 < "10"); + print "--------------------------"; + print "10 == \"11\"",(10 == "11"); + print "10 != \"11\"",(10 != "11"); + print "10 >= \"11\"",(10 >= "11"); + print "10 <= \"11\"",(10 <= "11"); + print "10 > \"11\"",(10 > "11"); + print "10 < \"11\"",(10 < "11"); + print "--------------------------"; + print "11 == \"10\"",(11 == "10"); + print "11 != \"10\"",(11 != "10"); + print "11 >= \"10\"",(11 >= "10"); + print "11 <= \"10\"",(11 <= "10"); + print "11 > \"10\"",(11 > "10"); + print "11 < \"10\"",(11 < "10"); + print "--------------------------"; + print "010 == \"8\"",(010 == "8"); + print "010 != \"8\"",(010 != "8"); + print "010 >= \"8\"",(010 >= "8"); + print "010 <= \"8\"",(010 <= "8"); + print "010 > \"8\"",(010 > "8"); + print "010 < \"8\"",(010 < "8"); + print "--------------------------"; + print "10 == \"10.0\"",(10 == "10.0"); + print "10 != \"10.0\"",(10 != "10.0"); + print "10 >= \"10.0\"",(10 >= "10.0"); + print "10 <= \"10.0\"",(10 <= "10.0"); + print "10 > \"10.0\"",(10 > "10.0"); + print "10 < \"10.0\"",(10 < "10.0"); + print "--------------------------"; + print "10.0 == \"10\"",(10.0 == "10"); + print "10.0 != \"10\"",(10.0 != "10"); + print "10.0 >= \"10\"",(10.0 >= "10"); + print "10.0 <= \"10\"",(10.0 <= "10"); + print "10.0 > \"10\"",(10.0 > "10"); + print "10.0 < \"10\"",(10.0 < "10"); + print "--------------------------"; + print "\"10\" == 10.0",("10" == 10.0); + print "\"10\" != 10.0",("10" != 10.0); + print "\"10\" >= 10.0",("10" >= 10.0); + print "\"10\" <= 10.0",("10" <= 10.0); + print "\"10\" > 10.0",("10" > 10.0); + print "\"10\" < 10.0",("10" < 10.0); + print "--------------------------"; + print "\"10\" == 10.1",("10" == 10.1); + print "\"10\" != 10.1",("10" != 10.1); + print "\"10\" >= 10.1",("10" >= 10.1); + print "\"10\" <= 10.1",("10" <= 10.1); + print "\"10\" > 10.1",("10" > 10.1); + print "\"10\" < 10.1",("10" < 10.1); + print (0.234 + 1.01123); + print 12345678901234567890E20; + print .123; + print (+(.123)); + print (-(.123)); + print .123E-; + print (+(.123E-)); + print (-(.123E-)); + print ((-(.123E-)) + "123"); +} + +1==1 : 1 +1==0 : 0 +1.0==1 : 1 +1.1==1 : 0 +1.0!=1 : 0 +1.1!=1 : 1 +"abc" == "abc" 1 +"abc" != "abc" 0 +-------------------------- +a == "" : 1 +a >= "" : 1 +a <= "" : 1 +a > "" : 0 +a < "" : 0 +-------------------------- +a == " " : 0 +a >= " " : 0 +a <= " " : 1 +a > " " : 0 +a < " " : 1 +-------------------------- +"" == a : 1 +"" >= a: 1 +"" <= a: 1 +"" > a: 0 +"" < a: 0 +-------------------------- +" " == a : 0 +" " >= a: 1 +" " <= a: 0 +" " > a: 1 +" " < a: 0 +-------------------------- +10 == "10" 1 +10 != "10" 0 +10 >= "10" 1 +10 <= "10" 1 +10 > "10" 0 +10 < "10" 0 +-------------------------- +10 == "11" 0 +10 != "11" 1 +10 >= "11" 0 +10 <= "11" 1 +10 > "11" 0 +10 < "11" 1 +-------------------------- +11 == "10" 0 +11 != "10" 1 +11 >= "10" 1 +11 <= "10" 0 +11 > "10" 1 +11 < "10" 0 +-------------------------- +010 == "8" 1 +010 != "8" 0 +010 >= "8" 1 +010 <= "8" 1 +010 > "8" 0 +010 < "8" 0 +-------------------------- +10 == "10.0" 0 +10 != "10.0" 1 +10 >= "10.0" 0 +10 <= "10.0" 1 +10 > "10.0" 0 +10 < "10.0" 1 +-------------------------- +10.0 == "10" 1 +10.0 != "10" 0 +10.0 >= "10" 1 +10.0 <= "10" 1 +10.0 > "10" 0 +10.0 < "10" 0 +-------------------------- +"10" == 10.0 1 +"10" != 10.0 0 +"10" >= 10.0 1 +"10" <= 10.0 1 +"10" > 10.0 0 +"10" < 10.0 0 +-------------------------- +"10" == 10.1 0 +"10" != 10.1 1 +"10" >= 10.1 0 +"10" <= 10.1 1 +"10" > 10.1 0 +"10" < 10.1 1 +1.24523 +1.23457e+39 +0.123 +0.123 +-0.123 +0.123 +0.123 +-0.123 +122.877 +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 --newline=on -o- -f lang-013.awk &1 +-------------------------------------------------------------------------------- +BEGIN { + CONVFMT = "%s"; + printf ("%s\n",10.34); +} + +ERROR: CODE 103 LINE 3 COLUMN 2 - recursion detected in format conversion +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 --newline=on -o- -f lang-014.awk &1 +-------------------------------------------------------------------------------- +BEGIN { + a = (10 + 20); + b = (10 + 20); + c = (10 + 20); + print a,b,c; +} + +30 30 30 +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 --newline=on -o- -f lang-015.awk &1 +-------------------------------------------------------------------------------- +ERROR: CODE 15 LINE 3 COLUMN 50 - block nested too deeply +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 --newline=on -o- -f lang-016.awk &1 +-------------------------------------------------------------------------------- +BEGIN { + printf "[[[[[%s]]]]\n",sprintf("abc %s abc",sprintf("def %s %s",sprintf("%s %s %s","xyz",1.2342,"xyz"),sprintf("ttt %s tttt",123.12))); + printf "[[[[%s]]]]\n",sprintf("ttt %s tttt",123.12); +} + +[[[[[abc def xyz 1.2342 xyz ttt 123.12 tttt abc]]]] +[[[[ttt 123.12 tttt]]]] +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 --newline=on -o- -f lang-017.awk &1 +-------------------------------------------------------------------------------- +function gety () +{ + return (y)++; +} + +function getx () +{ + if ((x == 2)) + error(); + return (x)++; +} + +function main () +{ + x = 0; + y = 0; + print (getx() + gety()); + print (getx() + gety()); + print (getx() + gety()); + print (getx() + gety()); + return 999; +} + +function error () +{ + exit 200; +} + +BEGIN { + main(); +} + +END { + print "END OF PROGRAM"; + return 10; +} +END { + print "END OF PROGRAM 2"; + exit 100; +} +END { + print "END OF PROGRAM 3"; + exit 900; +} +0 +2 +END OF PROGRAM +END OF PROGRAM 2 +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 --call main --newline=on -o- -f lang-017.awk &1 +-------------------------------------------------------------------------------- +function gety () +{ + return (y)++; +} + +function getx () +{ + if ((x == 2)) + error(); + return (x)++; +} + +function main () +{ + x = 0; + y = 0; + print (getx() + gety()); + print (getx() + gety()); + print (getx() + gety()); + print (getx() + gety()); + return 999; +} + +function error () +{ + exit 200; +} + +BEGIN { + main(); +} + +END { + print "END OF PROGRAM"; + return 10; +} +END { + print "END OF PROGRAM 2"; + exit 100; +} +END { + print "END OF PROGRAM 3"; + exit 900; +} +0 +2 +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 --explicit=on --newline=on -o- -f lang-018.awk &1 +-------------------------------------------------------------------------------- +ERROR: CODE 47 LINE 1 COLUMN 8 - duplicate global variable 'ARGV' +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 --explicit=on --newline=on -o- -f lang-019.awk &1 +-------------------------------------------------------------------------------- +ERROR: CODE 49 LINE 1 COLUMN 15 - '+' not a valid parameter name +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 --explicit=on --newline=on -o- -f lang-020.awk &1 +-------------------------------------------------------------------------------- +ERROR: CODE 50 LINE 1 COLUMN 8 - '+' not a valid variable name +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 --explicit=on --newline=on -o- -f lang-021.awk &1 +-------------------------------------------------------------------------------- +ERROR: CODE 50 LINE 3 COLUMN 8 - '+' not a valid variable name +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 --newline=on -o- -f lang-022.awk &1 +-------------------------------------------------------------------------------- +ERROR: CODE 23 LINE 2 COLUMN 9 - left parenthesis expected in place of '=' +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 --explicit=on --newline=on -o- -f lang-023.awk &1 +-------------------------------------------------------------------------------- +ERROR: CODE 28 LINE 5 COLUMN 20 - colon expected in place of ';' +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 --explicit=on --newline=on -o- -f lang-024.awk &1 +-------------------------------------------------------------------------------- +BEGIN { + local __l0; + __l0 = 21; + print ((__l0 > 20))?1:2; +} + +1 +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 --newline=on -o- -f lang-025.awk &1 +-------------------------------------------------------------------------------- +BEGIN { + iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiix = 20; + delete iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiix; +} + +ERROR: CODE 78 LINE 3 COLUMN 9 - variable 'iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiix' not deletable +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 --newline=on -o- -f lang-026.awk &1 +-------------------------------------------------------------------------------- +BEGIN { + abc[20] = "abc"; + print abc[20]; + abc = 10; + print abc; +} + +abc +ERROR: CODE 86 LINE 4 COLUMN 2 - map 'abc' not assignable with a scalar +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 --newline=on -o- -f lang-027.awk &1 +-------------------------------------------------------------------------------- +ERROR: CODE 17 LINE 2 COLUMN 1 - invalid character '' +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 --newline=on -o- -f lang-028.awk &1 +-------------------------------------------------------------------------------- +ERROR: CODE 41 LINE 2 COLUMN 10 - intrinsic function 'substr' redefined +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 --explicit=on --newline=on -o- -f lang-029.awk &1 +-------------------------------------------------------------------------------- +ERROR: CODE 42 LINE 9 COLUMN 9 - function 'abc' redefined +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 --newline=on -o- -f lang-030.awk &1 +-------------------------------------------------------------------------------- +BEGIN { + print (1 + 0); + print (0B11111111 + 0); + print (10 + 0); + print (0x10 + 0); + print (0b00000010 + 0); + print (0b + 0); + print (0x + 0); + print "-----------------------"; + print ((+(1)) + 0); + print ((+(0B11111111)) + 0); + print ((+(10)) + 0); + print ((+(0x10)) + 0); + print ((+(0b00000010)) + 0); + print ((+(0b)) + 0); + print ((+(0x)) + 0); + print "-----------------------"; + print ((-(1)) + 0); + print ((-(0B11111111)) + 0); + print ((-(10)) + 0); + print ((-(0x10)) + 0); + print ((-(0b00000010)) + 0); + print ((-(0b)) + 0); + print ((-(0x)) + 0); +} + +1 +255 +10 +16 +2 +0 +0 +----------------------- +1 +255 +10 +16 +2 +0 +0 +----------------------- +-1 +-255 +-10 +-16 +-2 +0 +0 +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 --newline=on -o- -f lang-031.awk &1 +-------------------------------------------------------------------------------- +BEGIN { + print match("hhhheeeo",/e+/); + print RSTART,RLENGTH; + print match("heeeo",/e/); + print RSTART,RLENGTH; + print match("heeeo",/t/); + print RSTART,RLENGTH; + print "--------------------------"; + print match("hhhheeeo","e+"); + print RSTART,RLENGTH; + print match("heeeo","e"); + print RSTART,RLENGTH; + print match("heeeo","t"); + print RSTART,RLENGTH; + print "--------------------------"; +} + +5 +5 3 +2 +2 1 +0 +0 -1 +-------------------------- +5 +5 3 +2 +2 1 +0 +0 -1 +-------------------------- +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 --newline=on -o- -f lang-032.awk &1 +-------------------------------------------------------------------------------- +BEGIN { + a = 91; + print ((a)++ 10); + print ((a)++ 10); + print ((a)++ 10); + print ((a)++ 10); + print ((a)++ 10); + print "---------------------"; + a = 91; + print (++(a) 10); +} + +9110 +9210 +9310 +9410 +9510 +--------------------- +9210 +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 --newline=on -o- -f lang-033.awk &1 +-------------------------------------------------------------------------------- +BEGIN { + while ((("cat lang-033.awk" | getline x) > 0)) + print x; +} + +BEGIN { + while ("cat lang-033.awk" | getline x > 0) + print x +} +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 --newline=on --rwpipe=on -o- -f lang-034.awk &1 +-------------------------------------------------------------------------------- +BEGIN { + print "15" || "sort"; + print "14" || "sort"; + print "13" || "sort"; + print "12" || "sort"; + print "11" || "sort"; + close("sort","r"); + print "-----"; + while ((("sort" || getline x) > 0)) + print "xx:",x; +} + +----- +xx: 11 +xx: 12 +xx: 13 +xx: 14 +xx: 15 +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 --newline=on -o- -vdatafile=lang-035.dat1 -vgroupname=lang-035 -f lang-035.awk lang-035.dat2 &1 +-------------------------------------------------------------------------------- +BEGIN { + max_cid_vars = 100; + first = 1; + while (((getline x < datafile) > 0)) + { + if (first) + { + first = 0; + continue; + } + n = split(x,f,","); + if ((n < 3)) + continue; + if ((f[3] == "")) + continue; + for (suffix = 0; (suffix < max_cid_vars); (suffix)++) + { + oldval = tab[f[2],suffix]; + if ((oldval == "")) + { + tab[f[2],suffix] = f[3]; + break; + } + } + } +} + +/^lease[[:space:]]+.+[[:space:]]*{[[:space:]]*$/ { + voice_no = 0; +} + +{ + if ((($1 == "option") && ($2 == "agent.circuit-id"))) + { + pos = index($0,"agent.circuit-id "); + len = length($0); + last = substr($0,len,1); + adj = 0; + if ((last != ";")) + (adj)++; + cid = substr($0,(pos + 17),(length($0) - ((pos + 17) + adj))); + for (suffix = 0; (suffix < max_cid_vars); (suffix)++) + { + val = tab[cid,suffix]; + if ((val == "")) + break; + print ((((" info awk.voice-no-" voice_no) " ") val) ";"); + (voice_no)++; + } + } + print $0; + if ((($1 == "hardware") && ($2 == "ethernet"))) + { + print ((" info awk.groupname \"" groupname) "\";"); + } +} + +# The format of this file is documented in the dhcpd.leases(5) manual page. +# This lease file was written by isc-dhcp-V3.1.1 + +lease 20.1.20.52 { + starts 5 2009/08/07 08:33:03; + ends 5 2009/08/07 08:38:14; + tstp 5 2009/08/07 08:38:14; + cltt 5 2009/08/07 08:33:03; + binding state free; + hardware ethernet 00:13:5e:4f:d2:d3; + info awk.groupname "lang-035"; +} +lease 20.1.20.57 { + starts 1 2009/08/10 09:04:12; + ends 2 2009/08/11 09:04:12; + cltt 1 2009/08/10 09:04:12; + binding state active; + next binding state free; + hardware ethernet 00:13:5e:50:23:6b; + info awk.groupname "lang-035"; + info awk.voice-no-0 "68599021"; + option agent.circuit-id "BLM1500_AR3_ILAB ONT/9/1/1 /0.0"; + option agent.unknown-9 0:0:0:c1:8:45:52:49:43:53:53:4f:4e; +} +lease 20.1.20.54 { + starts 1 2009/08/10 09:04:16; + ends 2 2009/08/11 09:04:16; + cltt 1 2009/08/10 09:04:16; + binding state active; + next binding state free; + hardware ethernet 00:13:5e:50:25:aa; + info awk.groupname "lang-035"; + info awk.voice-no-0 "68599011"; + option agent.circuit-id "BLM1500_AR3_ILAB ONT/9/1/2 /0.0"; + option agent.unknown-9 0:0:0:c1:8:45:52:49:43:53:53:4f:4e; +} +lease 20.1.20.55 { + starts 1 2009/08/10 13:53:08; + ends 2 2009/08/11 13:53:08; + cltt 1 2009/08/10 13:53:08; + binding state active; + next binding state free; + hardware ethernet 00:13:5e:50:20:af; + info awk.groupname "lang-035"; + info awk.voice-no-0 "68599012"; + option agent.circuit-id "BLM1500_AR3_ILAB ONT/9/2/1 /0.0"; + option agent.unknown-9 0:0:0:c1:8:45:52:49:43:53:53:4f:4e; +} +lease 20.1.20.56 { + starts 1 2009/08/10 13:53:42; + ends 2 2009/08/11 13:53:42; + cltt 1 2009/08/10 13:53:42; + binding state active; + next binding state free; + hardware ethernet 00:13:5e:50:20:29; + info awk.groupname "lang-035"; + info awk.voice-no-0 "68599022"; + option agent.circuit-id "BLM1500_AR3_ILAB ONT/9/2/2 /0.0"; + option agent.unknown-9 0:0:0:c1:8:45:52:49:43:53:53:4f:4e; +} +lease 10.218.255.53 { + starts 5 2009/08/07 08:18:04; + ends 5 2009/08/07 08:28:04; + tstp 5 2009/08/07 08:28:04; + cltt 5 2009/08/07 08:18:04; + binding state free; + hardware ethernet 00:1b:5b:9c:4f:7d; + info awk.groupname "lang-035"; + uid "\001\000\033[\234O}"; +} +lease 10.218.255.54 { + starts 5 2009/08/07 08:32:37; + ends 5 2009/08/07 08:42:37; + tstp 5 2009/08/07 08:42:37; + cltt 5 2009/08/07 08:32:37; + binding state free; + hardware ethernet 00:1b:5b:9c:1b:35; + info awk.groupname "lang-035"; + uid "\001\000\033[\234\0335"; +} +lease 10.218.255.59 { + starts 5 2009/08/07 10:39:01; + ends 6 2009/08/08 10:29:45; + tstp 6 2009/08/08 10:29:45; + cltt 5 2009/08/07 10:39:01; + binding state free; + hardware ethernet 00:1f:b3:79:7e:30; + info awk.groupname "lang-035"; + uid "\001\000\037\263y~0"; +} +lease 10.218.255.58 { + starts 0 2009/08/09 14:21:00; + ends 1 2009/08/10 09:13:42; + tstp 1 2009/08/10 09:13:42; + cltt 0 2009/08/09 14:21:00; + binding state free; + hardware ethernet 00:19:e4:43:0e:c8; + info awk.groupname "lang-035"; + uid "\001\000\031\344C\016\310"; +} +lease 10.218.255.55 { + starts 1 2009/08/10 09:02:31; + ends 2 2009/08/11 09:02:31; + cltt 1 2009/08/10 09:02:31; + binding state active; + next binding state free; + hardware ethernet 00:1b:5b:9c:90:00; + info awk.groupname "lang-035"; + uid "\001\000\033[\234\220\000"; + info awk.voice-no-0 "68599019"; + info awk.voice-no-1 "68599014"; + option agent.circuit-id "AR_Remote atm 1/1/03/12:2.100"; + option agent.remote-id "22M-fast"; +} +lease 10.218.255.52 { + starts 1 2009/08/10 09:04:04; + ends 2 2009/08/11 09:04:04; + cltt 1 2009/08/10 09:04:04; + binding state active; + next binding state free; + hardware ethernet 00:1b:5b:9c:81:35; + info awk.groupname "lang-035"; + uid "\001\000\033[\234\2015"; +} +lease 10.218.255.56 { + starts 1 2009/08/10 09:06:09; + ends 2 2009/08/11 09:06:09; + cltt 1 2009/08/10 09:06:09; + binding state active; + next binding state free; + hardware ethernet 00:1e:c7:fb:29:7d; + info awk.groupname "lang-035"; + uid "\001\000\036\307\373)}"; +} +lease 10.218.255.57 { + starts 1 2009/08/10 09:14:33; + ends 2 2009/08/11 09:14:33; + cltt 1 2009/08/10 09:14:33; + binding state active; + next binding state free; + hardware ethernet 00:1e:c7:fb:29:4d; + info awk.groupname "lang-035"; + uid "\001\000\036\307\373)M"; +} +lease 10.218.255.66 { + starts 1 2009/08/10 13:57:24; + ends 2 2009/08/11 13:57:24; + cltt 1 2009/08/10 13:57:24; + binding state active; + next binding state free; + hardware ethernet 00:1a:04:f9:e2:90; + info awk.groupname "lang-035"; + uid "\001\000\032\004\371\342\220"; + info awk.voice-no-0 "68599018"; + option agent.circuit-id "AR_Remote atm 1/1/03/02:2.100"; + option agent.remote-id "3play"; +} +lease 10.218.255.60 { + starts 1 2009/08/10 17:25:17; + ends 2 2009/08/11 17:25:17; + cltt 1 2009/08/10 17:25:17; + binding state active; + next binding state free; + hardware ethernet 00:1e:c7:fb:29:1d; + info awk.groupname "lang-035"; + uid "\001\000\036\307\373)\035"; + info awk.voice-no-0 "68599017"; + info awk.voice-no-1 "68599013"; + option agent.circuit-id "AL_AM3_LAB atm 1/1/01/01:2.100"; + option agent.remote-id "Testing DHCP"; +} +# The format of this file is documented in the dhcpd.leases(5) manual page. +# This lease file was written by isc-dhcp-V3.1.1 + +lease 10.218.255.151 { + starts 5 2009/08/07 08:09:38; + ends 5 2009/08/07 08:13:59; + tstp 5 2009/08/07 08:13:59; + cltt 5 2009/08/07 08:09:38; + binding state free; + hardware ethernet 00:1b:5b:9c:90:00; + info awk.groupname "lang-035"; + uid "\001\000\033[\234\220\000"; +} +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 --newline=on -o- -f lang-036.awk lang-036.dat &1 +-------------------------------------------------------------------------------- +{ + if (($0 ~ /^-+$/)) + { + (getline x); + printf " %s\n",x; + nobar = 0; + } + else + { + if (nobar) + printf "\n"; + printf "%s",$0; + nobar = 1; + } +} + +ab...c AAA + +de...f +gh...i AAA1 + +jk...l +mn...o +pq...r AAA2 + + + +kbs ddd +dif cccc +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 --newline=on -o- -f lang-037.awk lang-037.dat &1 +-------------------------------------------------------------------------------- +BEGIN { + RS = "\n-+\n"; + first = 1; +} + +{ + if ((!(first))) + printf " "; + printf "%s",$0; + first = 0; +} + +ab...c AAA + +de...f +gh...i AAA1 + +jk...l +mn...o +pq...r AAA2 + + + +kbs ddd +dif cccc +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 --newline=on -o- -f lang-038.awk &1 +-------------------------------------------------------------------------------- +BEGIN { + xstr = "abcdefabcdefabcdef"; + xsub = "abc"; + xlen = length(xsub); + i = 1; + while ((i = index(xstr,xsub,i) > 0)) + { + print i,substr(xstr,i,xlen); + i += xlen; + } + print "----------------"; + i = 1; + while ((match(xstr,xsub,i) > 0)) + { + print RSTART,substr(xstr,RSTART,RLENGTH); + i = (RSTART + RLENGTH); + } +} + +1 abc +7 abc +13 abc +---------------- +1 abc +7 abc +13 abc +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 --newline=on -o- -f lang-039.awk &1 +-------------------------------------------------------------------------------- +BEGIN { + print (length() 11); + print length(11); +} + +011 +2 +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 --newline=on -o- -f lang-040.awk &1 +-------------------------------------------------------------------------------- +BEGIN { + for (x in y) + print x; +} + +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 --newline=on -o- -f lang-041.awk &1 +-------------------------------------------------------------------------------- +BEGIN { + abc = 20; + print (abc 10); +} + +2010 +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 --newline=on -o- -f lang-042.awk &1 +-------------------------------------------------------------------------------- +BEGIN { + print //; + print /=/; + print /.*/; + a = 5; + a /= 10; + print a; + for (IGNORECASE = 0; (IGNORECASE <= 1); (IGNORECASE)++) + { + print "IGNORECASE=",IGNORECASE; + print ("abc" ~ /^[[:upper:]]+$/); + print ("abc" ~ /^[[:lower:]]+$/); + print ("ABC" ~ /^[[:upper:]]+$/); + print ("ABC" ~ /^[[:lower:]]+$/); + print ("AbC" ~ /^[[:upper:]]+$/); + print ("aBc" ~ /^[[:lower:]]+$/); + } +} + +1 +0 +1 +0.5 +IGNORECASE= 0 +0 +1 +1 +0 +0 +0 +IGNORECASE= 1 +1 +1 +1 +1 +1 +1 +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 --newline=on -F: -f columnate.awk ./passwd.dat &1 +-------------------------------------------------------------------------------- +root x 0 0 root /root /bin/bash +daemon x 1 1 daemon /usr/sbin /bin/sh +bin x 2 2 bin /bin /bin/sh +sys x 3 3 sys /dev /bin/sh +sync x 4 65534 sync /bin /bin/sync +games x 5 60 games /usr/games /bin/sh +man x 6 12 man /var/cache/man /bin/sh +lp x 7 7 lp /var/spool/lpd /bin/sh +mail x 8 8 mail /var/mail /bin/sh +news x 9 9 news /var/spool/news /bin/sh +uucp x 10 10 uucp /var/spool/uucp /bin/sh +proxy x 13 13 proxy /bin /bin/sh +www-data x 33 33 www-data /var/www /bin/sh +backup x 34 34 backup /var/backups /bin/sh +list x 38 38 Mailing List Manager /var/list /bin/sh +irc x 39 39 ircd /var/run/ircd /bin/sh +gnats x 41 41 Gnats Bug-Reporting System (admin) /var/lib/gnats /bin/sh +nobody x 65534 65534 nobody /nonexistent /bin/sh +libuuid x 100 101 /var/lib/libuuid /bin/sh +syslog x 101 102 /home/syslog /bin/false +klog x 102 103 /home/klog /bin/false +hplip x 103 7 HPLIP system user,,, /var/run/hplip /bin/false +avahi-autoipd x 104 110 Avahi autoip daemon,,, /var/lib/avahi-autoipd /bin/false +gdm x 105 111 Gnome Display Manager /var/lib/gdm /bin/false +saned x 106 113 /home/saned /bin/false +pulse x 107 114 PulseAudio daemon,,, /var/run/pulse /bin/false +messagebus x 108 117 /var/run/dbus /bin/false +polkituser x 109 118 PolicyKit,,, /var/run/PolicyKit /bin/false +avahi x 110 119 Avahi mDNS daemon,,, /var/run/avahi-daemon /bin/false +haldaemon x 111 120 Hardware abstraction layer,,, /var/run/hald /bin/false +statd x 112 65534 /var/lib/nfs /bin/false +sshd x 113 65534 /var/run/sshd /usr/sbin/nologin +speech-dispatcher x 114 29 Speech Dispatcher,,, /var/run/speech-dispatcher /bin/sh +couchdb x 115 116 CouchDB Administrator,,, /var/lib/couchdb /bin/bash +kernoops x 116 65534 Kernel Oops Tracking Daemon,,, / /bin/false +mysql x 117 124 MySQL Server,,, /var/lib/mysql /bin/false +openldap x 118 125 OpenLDAP Server Account,,, /nonexistent /bin/false +postfix x 119 126 /var/spool/postfix /bin/false +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 --newline=on --include=on -f levenshtein-utests.awk &1 +-------------------------------------------------------------------------------- +3: Correct distance between 'kitten' and 'sitting' +3: Correct distance between 'Saturday' and 'Sunday' +1: Correct distance between 'acc' and 'ac' +2: Correct distance between 'foo' and 'four' +0: Correct distance between 'foo' and 'foo' +2: Correct distance between 'cow' and 'cat' +5: Correct distance between 'cat' and 'moocow' +5: Correct distance between 'cat' and 'cowmoo' +1: Correct distance between 'sebastian' and 'sebastien' +5: Correct distance between 'more' and 'cowbell' +1: Correct distance between 'freshpack' and 'freshpak' +1: Correct distance between 'freshpak' and 'freshpack' +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 --newline=on -v target=89000 -f rcalc.awk &1 +-------------------------------------------------------------------------------- +Result Ra Rb Connect Error + +88800.00 82000 6800 series -0.22%% +89000.00 56000 33000 series +89000.00 62000 27000 series +89130.43 820000 100000 parallel +0.15%% +89137.93 470000 110000 parallel +0.15%% +89189.19 220000 150000 parallel +0.21%% +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 -f quicksort.awk quicksort.dat &1 +-------------------------------------------------------------------------------- +0.0000000000 +0.11111111111111111111111111111 +1 +0xA +11.2839091 +12 +29 +0b11111 +34 +35 +92 +301 +493 +19123 +1.E12 +99X +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 -f quicksort2.awk quicksort2.dat &1 +-------------------------------------------------------------------------------- +0.0000000000 +0.11111111111111111111111111111 +1 +0xA +11.2839091 +12 +29 +0b11111 +34 +35 +92 +301 +493 +19123 +1.E12 +99X +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 -f asm.awk asm.s &1 +-------------------------------------------------------------------------------- +549 +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 -f stripcomment.awk stripcomment.dat &1 +-------------------------------------------------------------------------------- + + +#include +int main () +{ + + printf ("hello, world\n"); + return 0; +} +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 -f wordfreq.awk wordfreq.awk &1 +-------------------------------------------------------------------------------- +_ 2 +a 2 +print 2 +case 1 +tolower 1 +i 4 +freq 3 +distinctions 1 +frequencies 1 +list 1 +alnum 2 +nf 1 +punctuation 1 +remove 2 +awk 1 +end 1 +gsub 2 +of 1 +word 4 +wordfreq 1 +for 2 +in 1 +0 3 +1 1 +blank 2 +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 -f hanoi.awk &1 +-------------------------------------------------------------------------------- +0 54321 +1 +2 + +0 5432 +1 1 +2 + +0 543 +1 1 +2 2 + +0 543 +1 +2 21 + +0 54 +1 3 +2 21 + +0 541 +1 3 +2 2 + +0 541 +1 32 +2 + +0 54 +1 321 +2 + +0 5 +1 321 +2 4 + +0 5 +1 32 +2 41 + +0 52 +1 3 +2 41 + +0 521 +1 3 +2 4 + +0 521 +1 +2 43 + +0 52 +1 1 +2 43 + +0 5 +1 1 +2 432 + +0 5 +1 +2 4321 + +0 +1 5 +2 4321 + +0 1 +1 5 +2 432 + +0 1 +1 52 +2 43 + +0 +1 521 +2 43 + +0 3 +1 521 +2 4 + +0 3 +1 52 +2 41 + +0 32 +1 5 +2 41 + +0 321 +1 5 +2 4 + +0 321 +1 54 +2 + +0 32 +1 541 +2 + +0 3 +1 541 +2 2 + +0 3 +1 54 +2 21 + +0 +1 543 +2 21 + +0 1 +1 543 +2 2 + +0 1 +1 5432 +2 + +0 +1 54321 +2 + +-------------------------------------------------------------------------------- +[CMD] ../../cmd/awk/.libs/qseawk -m 500000 -f indent.awk indent.dat &1 +-------------------------------------------------------------------------------- +#!/bin/sh + +if [ $# -ne 0 ] +then + echo "not the right usage" + exit 1 +fi + +while true +do + sleep 20 +done diff --git a/qse/regress/awk/regress.sh b/qse/regress/awk/regress.sh index 0e675c28..687a389e 100755 --- a/qse/regress/awk/regress.sh +++ b/qse/regress/awk/regress.sh @@ -17,8 +17,8 @@ echo_title() echo "--------------------------------------------------------------------------------" while [ $# -gt 0 ] do - echo -n "$1 " - echo -n "$1 " >/dev/stderr + echo -n "[CMD] $1 " + echo -n "[CMD] $1 " >/dev/stderr shift done echo @@ -40,15 +40,23 @@ print_usage() QSEAWK=../../cmd/awk/.libs/qseawk [ -f "${QSEAWK}" ] || QSEAWK=../../cmd/awk/qseawk } +[ -z "${QSESED}" ] && { + QSESED=../../cmd/sed/.libs/qsesed + [ -f "${QSESED}" ] || QSEAWK=../../cmd/sed/qsesed +} [ -f "${QSEAWK}" -a -x "${QSEAWK}" ] || { echo_so "the executable '${QSEAWK}' is not found or not executable" exit 1 } +[ -f "${QSESED}" -a -x "${QSESED}" ] || { + echo_so "the executable '${QSESED}' is not found or not executable" + exit 1 +} TMPFILE="${TMPFILE:=./regress.temp}" OUTFILE="${OUTFILE:=./regress.out}" - -GLOBALOPTS="-m 500000" +OUTFILE_XMA="${OUTFILE}.xma" +XMAOPTS="-m 500000" PROGS=" cou-001.awk!cou.dat!! @@ -177,6 +185,7 @@ PROGS=" run_scripts() { valgrind="${1}" + extraopts="${2}" echo "${PROGS}" > "${TMPFILE}" while read prog @@ -200,50 +209,74 @@ run_scripts() [ -z "${redinfile}" ] && redinfile="/dev/stdin" - echo_title "${valgrind} ${QSEAWK} ${GLOBALOPTS} ${awkopts} -f ${orgscript} ${datafile} <${redinfile} 2>&1" - ${valgrind} ${QSEAWK} ${GLOBALOPTS} -o "${script}.dp" ${awkopts} -f ${script} ${datafile} <${redinfile} 2>&1 + echo_title "${valgrind} ${QSEAWK} ${extraopts} ${awkopts} -f ${orgscript} ${datafile} <${redinfile} 2>&1" + ${valgrind} ${QSEAWK} ${extraopts} -o "${script}.dp" ${awkopts} -f ${script} ${datafile} <${redinfile} 2>&1 done < "${TMPFILE}" rm -f "${TMPFILE}" } +run_test() +{ + outfile="${1}" + extraopts="${2}" + + rm -f *.dp + echo_so "FIRST RUN WITH ORIGINAL SOURCE" + run_scripts "" "${extraopts}" > "${outfile}.test" + echo_so "SECOND RUN WITH DEPARSED SOURCE" + run_scripts "" "${extraopts}" > "${outfile}.test2" + rm -f *.dp + + diff "${outfile}.test" "${outfile}.test2" > /dev/null || { + echo_so "ERROR: Difference is found between the first run and the second run." + echo_so " The output of the first run is stored in '${outfile}.test'." + echo_so " The output of the seconds run is stored in '${outfile}.test2'." + echo_so " You may execute 'diff ${outfile}.test ${outfile}.test2' for more info." + exit 1 + } + + rm -f "${outfile}.test2" + + # diff -q is not supported on old platforms. + # redirect output to /dev/null instead. + diff "${outfile}" "${outfile}.test" > /dev/null || { + echo_so "ERROR: Difference is found between expected output and actual output." + echo_so " The expected output is stored in '${outfile}'." + echo_so " The actual output is stored in '${outfile}.test'." + echo_so " You may execute 'diff ${outfile} ${outfile}.test' for more info." + return 1 + } + rm -f "${outfile}.test" + return 0 +} + case $1 in init) rm -f *.dp - run_scripts > "${OUTFILE}" + run_scripts "" "" > "${OUTFILE}" + run_scripts "" "${XMAOPTS}" > "${OUTFILE_XMA}" rm -f *.dp echo_so "INIT OK" ;; test) - rm -f *.dp - echo_so "FIRST RUN WITH ORIGINAL SOURCE" - run_scripts > "${OUTFILE}.test" - echo_so "SECOND RUN WITH DEPARSED SOURCE" - run_scripts > "${OUTFILE}.test2" - rm -f *.dp - - diff "${OUTFILE}.test" "${OUTFILE}.test2" > /dev/null || { - echo_so "ERROR: Difference is found between the first run and the second run." - echo_so " The output of the first run is stored in '${OUTFILE}.test'." - echo_so " The output of the seconds run is stored in '${OUTFILE}.test2'." - echo_so " You may execute 'diff ${OUTFILE}.test ${OUTFILE}.test2' for more info." - exit 1 + run_test "${OUTFILE}" "" && { + run_test "${OUTFILE_XMA}" "${XMAOPTS}" && { + #diff "${OUTFILE}" "${OUTFILE_XMA}" | grep -v '^\[CMD\] ' + ${QSESED} "s|${QSEAWK} ${XMAOPTS}|${QSEAWK} |" "${OUTFILE_XMA}" > "${OUTFILE_XMA}.$$" + diff "${OUTFILE}" "${OUTFILE_XMA}.$$" || { + rm -f "${OUTFILE_XMA}.$$" + echo_so "ERROR: Difference is found between normal output and xma output." + echo_so " The normal output is stored in '${OUTFILE}'." + echo_so " The xma output is stored in '${OUTFILE_XMA}'." + echo_so " Ignore lines staring with [CMD] in the difference." + exit 1; + } + rm -f "${OUTFILE_XMA}.$$" + echo_so "TEST OK" + } } - - rm -f "${OUTFILE}.test2" - - # diff -q is not supported on old platforms. - # redirect output to /dev/null instead. - diff "${OUTFILE}" "${OUTFILE}.test" > /dev/null || { - echo_so "ERROR: Difference is found between expected output and actual output." - echo_so " The expected output is stored in '${OUTFILE}'." - echo_so " The actual output is stored in '${OUTFILE}.test'." - echo_so " You may execute 'diff ${OUTFILE} ${OUTFILE}.test' for more info." - exit 1 - } - rm -f "${OUTFILE}.test" - echo_so "TEST OK" ;; leakcheck) bin_valgrind="`which valgrind 2> /dev/null || echo ""`" @@ -251,7 +284,7 @@ leakcheck) echo_so "valgrind not found. cannot perform this test" exit 1 } - run_scripts "${bin_valgrind} --leak-check=full --show-reachable=yes --track-fds=yes" 2>&1 > "${OUTFILE}.test" + run_scripts "${bin_valgrind} --leak-check=full --show-reachable=yes --track-fds=yes" "" 2>&1 > "${OUTFILE}.test" x=`grep -Fic "no leaks are possible" "${OUTFILE}.test"` y=`grep -Fic "${bin_valgrind}" "${OUTFILE}.test"` if [ ${x} -eq ${y} ] @@ -270,14 +303,4 @@ leakcheck) ;; esac -exit 0 - ;; -*) - echo_so "USAGE: $0 init" - echo_so " $0 test" - echo_so " $0 leakcheck" - exit 1 - ;; -esac - exit 0 diff --git a/qse/regress/sed/regress.out b/qse/regress/sed/regress.out index 6cd0dcd3..f11fdf5d 100644 --- a/qse/regress/sed/regress.out +++ b/qse/regress/sed/regress.out @@ -1,5 +1,5 @@ -------------------------------------------------------------------------------- - ../../cmd/sed/.libs/qsesed -n -f s001.sed s001.dat &1 +[CMD] ../../cmd/sed/.libs/qsesed -n -f s001.sed s001.dat &1 -------------------------------------------------------------------------------- ab...c AAA @@ -15,7 +15,7 @@ pq...r AAA2 kbs ddd dif cccc -------------------------------------------------------------------------------- - ../../cmd/sed/.libs/qsesed -f s002.sed s002.dat &1 +[CMD] ../../cmd/sed/.libs/qsesed -f s002.sed s002.dat &1 -------------------------------------------------------------------------------- ab...c AAA @@ -31,7 +31,7 @@ pq...r AAA2 kbs ddd dif cccc -------------------------------------------------------------------------------- - ../../cmd/sed/.libs/qsesed -f s003.sed s003.dat &1 +[CMD] ../../cmd/sed/.libs/qsesed -f s003.sed s003.dat &1 -------------------------------------------------------------------------------- ab...c AAA @@ -47,7 +47,7 @@ pq...r AAA2 kbs ddd dif cccc -------------------------------------------------------------------------------- - ../../cmd/sed/.libs/qsesed -f s004.sed s004.dat &1 +[CMD] ../../cmd/sed/.libs/qsesed -f s004.sed s004.dat &1 -------------------------------------------------------------------------------- linux { HOST: com.com diff --git a/qse/regress/sed/regress.out.xma b/qse/regress/sed/regress.out.xma new file mode 100644 index 00000000..c024b81f --- /dev/null +++ b/qse/regress/sed/regress.out.xma @@ -0,0 +1,61 @@ +-------------------------------------------------------------------------------- +[CMD] ../../cmd/sed/.libs/qsesed -m 500000 -n -f s001.sed s001.dat &1 +-------------------------------------------------------------------------------- +ab...c AAA + +de...f +gh...i AAA1 + +jk...l +mn...o +pq...r AAA2 + + + +kbs ddd +dif cccc +-------------------------------------------------------------------------------- +[CMD] ../../cmd/sed/.libs/qsesed -m 500000 -f s002.sed s002.dat &1 +-------------------------------------------------------------------------------- +ab...c AAA + +de...f +gh...i AAA1 + +jk...l +mn...o +pq...r AAA2 + + + +kbs ddd +dif cccc +-------------------------------------------------------------------------------- +[CMD] ../../cmd/sed/.libs/qsesed -m 500000 -f s003.sed s003.dat &1 +-------------------------------------------------------------------------------- +ab...c AAA + +de...f +gh...i AAA1 + +jk...l +mn...o +pq...r AAA2 + + + +kbs ddd +dif cccc +-------------------------------------------------------------------------------- +[CMD] ../../cmd/sed/.libs/qsesed -m 500000 -f s004.sed s004.dat &1 +-------------------------------------------------------------------------------- +linux { +HOST: com.com +ADDRESS: 45.34.34.33 +} + + +linux { +HOST: com.com +ADDRESS: 45.34.34.33 +} diff --git a/qse/regress/sed/regress.sh b/qse/regress/sed/regress.sh index 85abd7aa..05eb6feb 100755 --- a/qse/regress/sed/regress.sh +++ b/qse/regress/sed/regress.sh @@ -17,8 +17,8 @@ echo_title() echo "--------------------------------------------------------------------------------" while [ $# -gt 0 ] do - echo -n "$1 " - echo -n "$1 " >/dev/stderr + echo -n "[CMD] $1 " + echo -n "[CMD] $1 " >/dev/stderr shift done echo @@ -47,8 +47,8 @@ print_usage() TMPFILE="${TMPFILE:=./regress.temp}" OUTFILE="${OUTFILE:=./regress.out}" - -GLOBALOPTS="-m 500000" +OUTFILE_XMA="${OUTFILE}.xma" +XMAOPTS="-m 500000" PROGS=" s001.sed/s001.dat//-n @@ -66,6 +66,7 @@ PROGS=" run_scripts() { valgrind="$1" + extraopts="$2" echo "${PROGS}" > "${TMPFILE}" while read prog @@ -87,35 +88,56 @@ run_scripts() [ -z "${redinfile}" ] && redinfile="/dev/stdin" - echo_title "${valgrind} ${QSESED} ${GLOBALOPTS} ${options} -f ${script} ${datafile} <${redinfile} 2>&1" - ${valgrind} ${QSESED} ${GLOBALOPTS} ${options} -f ${script} ${datafile} <${redinfile} 2>&1 + echo_title "${valgrind} ${QSESED} ${extraopts} ${options} -f ${script} ${datafile} <${redinfile} 2>&1" + ${valgrind} ${QSESED} ${extraopts} ${options} -f ${script} ${datafile} <${redinfile} 2>&1 done < "${TMPFILE}" rm -f "${TMPFILE}" } -case $1 in -init) - rm -f *.dp - run_scripts > "${OUTFILE}" - rm -f *.dp - echo_so "INIT OK" - ;; -test) - run_scripts > "${OUTFILE}.test" +run_test() +{ + outfile="${1}" + extraopts="${2}" + + run_scripts "" "${extraopts}"> "${outfile}.test" # diff -q is not supported on old platforms. # redirect output to /dev/null instead. - diff "${OUTFILE}" "${OUTFILE}.test" > /dev/null || { + diff "${outfile}" "${outfile}.test" > /dev/null || { echo_so "ERROR: Difference is found between expected output and actual output." - echo_so " The expected output is stored in '${OUTFILE}'." - echo_so " The actual output is stored in '${OUTFILE}.test'." - echo_so " You may execute 'diff ${OUTFILE} ${OUTFILE}.test' for more info." - exit 1 + echo_so " The expected output is stored in '${outfile}'." + echo_so " The actual output is stored in '${outfile}.test'." + echo_so " You may execute 'diff ${outfile} ${outfile}.test' for more info." + return 1 + } + rm -f "${outfile}.test" + return 0 +} + +case $1 in +init) + run_scripts "" "" > "${OUTFILE}" + run_scripts "" "${XMAOPTS}" > "${OUTFILE_XMA}" + echo_so "INIT OK" + ;; +test) + run_test "${OUTFILE}" "" && { + run_test "${OUTFILE_XMA}" "${XMAOPTS}" && { + ${QSESED} "s|${QSEAWK} ${XMAOPTS}|${QSEAWK} |" "${OUTFILE_XMA}" > "${OUTFILE_XMA}.$$" + diff "${OUTFILE}" "${OUTFILE_XMA}.$$" || { + rm -f "${OUTFILE_XMA}.$$" + echo_so "ERROR: Difference is found between normal output and xma output." + echo_so " The normal output is stored in '${OUTFILE}'." + echo_so " The xma output is stored in '${OUTFILE_XMA}'." + echo_so " Ignore lines staring with [CMD] in the difference." + exit 1; + } + rm -f "${OUTFILE_XMA}.$$" + echo_so "TEST OK" + } } - rm -f "${OUTFILE}.test" - echo_so "TEST OK" ;; leakcheck) bin_valgrind="`which valgrind 2> /dev/null || echo ""`" diff --git a/qse/samples/cmn/xma.c b/qse/samples/cmn/xma.c index 146fc000..47937893 100644 --- a/qse/samples/cmn/xma.c +++ b/qse/samples/cmn/xma.c @@ -1,11 +1,15 @@ #include #include -int main () +#define R(f) \ + do { \ + qse_printf (QSE_T("== %s ==\n"), QSE_T(#f)); \ + if (f() == -1) return -1; \ + } while (0) + +static int test1 () { - int i; void* ptr[100]; - void* x; qse_xma_t* xma = qse_xma_open (QSE_NULL, 0, 100000L); if (xma == QSE_NULL) @@ -18,17 +22,88 @@ int main () ptr[1] = qse_xma_alloc (xma, 1000); ptr[2] = qse_xma_alloc (xma, 3000); ptr[3] = qse_xma_alloc (xma, 1000); - qse_xma_dump (xma); - qse_xma_free (xma, ptr[0]); - qse_xma_free (xma, ptr[2]); + //qse_xma_dump (xma, qse_printf); + //qse_xma_free (xma, ptr[0]); + //qse_xma_free (xma, ptr[2]); //qse_xma_free (xma, ptr[3]); - qse_xma_dump (xma); - qse_printf (QSE_T("===============================\n")); - qse_xma_realloc (xma, ptr[1], 500); - qse_xma_dump (xma); + qse_xma_dump (xma, qse_printf); + qse_xma_realloc (xma, ptr[0], 500); + qse_xma_realloc (xma, ptr[3], 500); + qse_xma_dump (xma, qse_printf); + + qse_xma_close (xma); + return 0; +} + +static int test2 () +{ + void* ptr[100]; + + qse_xma_t* xma = qse_xma_open (QSE_NULL, 0, 100000L); + if (xma == QSE_NULL) + { + qse_printf (QSE_T("cannot open xma\n")); + return -1; + } + + ptr[0] = qse_xma_alloc (xma, 5000); + ptr[1] = qse_xma_alloc (xma, 1000); + ptr[2] = qse_xma_alloc (xma, 3000); + ptr[3] = qse_xma_alloc (xma, 1000); + qse_xma_dump (xma, qse_printf); + qse_xma_free (xma, ptr[0]); + qse_xma_free (xma, ptr[2]); + + qse_xma_dump (xma, qse_printf); + qse_xma_realloc (xma, ptr[1], 500); + qse_xma_dump (xma, qse_printf); + + qse_xma_close (xma); + return 0; +} + +static int test3 () +{ + void* ptr[100]; + + qse_xma_t* xma = qse_xma_open (QSE_NULL, 0, 100000L); + if (xma == QSE_NULL) + { + qse_printf (QSE_T("cannot open xma\n")); + return -1; + } + + ptr[0] = qse_xma_alloc (xma, 5000); + ptr[1] = qse_xma_alloc (xma, 1000); + ptr[2] = qse_xma_alloc (xma, 3000); + ptr[3] = qse_xma_alloc (xma, 1000); + qse_xma_dump (xma, qse_printf); + qse_xma_free (xma, ptr[0]); + qse_xma_free (xma, ptr[2]); + + qse_xma_dump (xma, qse_printf); + ptr[1] = qse_xma_realloc (xma, ptr[1], 3000); + qse_xma_dump (xma, qse_printf); + qse_xma_free (xma, ptr[1]); + qse_xma_dump (xma, qse_printf); + + qse_xma_close (xma); + return 0; +} + +static int test4 () +{ + int i; + void* ptr[100]; + + qse_xma_t* xma = qse_xma_open (QSE_NULL, 0, 2000000L); + if (xma == QSE_NULL) + { + qse_printf (QSE_T("cannot open xma\n")); + return -1; + } -#if 0 for (i = 0; i < 100; i++) { int sz = (i + 1) * 10; @@ -39,7 +114,6 @@ int main () qse_printf (QSE_T("failed to alloc %d\n"), sz); break; } - qse_printf (QSE_T("%d %p\n"), sz, ptr[i]); } for (--i; i > 0; i-= 3) @@ -56,19 +130,27 @@ int main () { void* x, * y; - qse_printf (QSE_T("%p\n"), qse_xma_alloc (xma, 5000)); - qse_printf (QSE_T("%p\n"), qse_xma_alloc (xma, 1000)); - qse_printf (QSE_T("%p\n"), (x = qse_xma_alloc (xma, 10))); - qse_printf (QSE_T("%p\n"), (y = qse_xma_alloc (xma, 40))); + qse_xma_alloc (xma, 5000); + qse_xma_alloc (xma, 1000); + x = qse_xma_alloc (xma, 10); + y = qse_xma_alloc (xma, 40); if (x) qse_xma_free (xma, x); if (y) qse_xma_free (xma, y); - qse_printf (QSE_T("%p\n"), (x = qse_xma_alloc (xma, 10))); - qse_printf (QSE_T("%p\n"), (y = qse_xma_alloc (xma, 40))); + x = qse_xma_alloc (xma, 10); + y = qse_xma_alloc (xma, 40); } - qse_xma_dump (xma); -#endif + qse_xma_dump (xma, qse_printf); qse_xma_close (xma); return 0; } + +int main () +{ + R (test1); + R (test2); + R (test3); + R (test4); + return 0; +}