enhanced xma realloc()
This commit is contained in:
parent
4ef1730e71
commit
221db8488e
@ -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
|
||||
};
|
||||
|
@ -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
|
||||
|
@ -491,31 +491,43 @@ 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;
|
||||
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 (blk->b.next) blk->b.next->b.prev = tmp;
|
||||
if (n->b.next) n->b.next->b.prev = tmp;
|
||||
blk->b.next = tmp;
|
||||
blk->size = size;
|
||||
|
||||
/* add 'tmp' to the free list */
|
||||
attach_to_freelist (xma, tmp);
|
||||
tmp->size = rem - HDRSIZE + HDRSIZE + n->size;
|
||||
|
||||
/* 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.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++;
|
||||
@ -523,6 +535,10 @@ static void* _realloc_merge (qse_xma_t* xma, void* b, qse_size_t size)
|
||||
xma->stat.avail += tmp->size;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* add 'tmp' to the free list */
|
||||
attach_to_freelist (xma, tmp);
|
||||
}
|
||||
}
|
||||
|
||||
return b;
|
||||
@ -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("<XMA DUMP>\n"));
|
||||
printf (QSE_T("<XMA DUMP>\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
|
||||
|
@ -1,5 +1,5 @@
|
||||
--------------------------------------------------------------------------------
|
||||
../../cmd/awk/.libs/qseawk -f cou-001.awk cou.dat </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk -f cou-001.awk cou.dat </dev/stdin 2>&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 </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk -f cou-002.awk cou.dat </dev/stdin 2>&1
|
||||
--------------------------------------------------------------------------------
|
||||
COUNTRY AREA POP CONTINENT
|
||||
|
||||
@ -31,44 +31,44 @@ England 56
|
||||
|
||||
TOTAL 25681 2819
|
||||
--------------------------------------------------------------------------------
|
||||
../../cmd/awk/.libs/qseawk -f cou-003.awk cou.dat </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk -f cou-003.awk cou.dat </dev/stdin 2>&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 </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk -f cou-004.awk cou.dat </dev/stdin 2>&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 </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk -f cou-005.awk cou.dat </dev/stdin 2>&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 </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk -f cou-006.awk cou.dat </dev/stdin 2>&1
|
||||
--------------------------------------------------------------------------------
|
||||
--------------------------------------------------------------------------------
|
||||
../../cmd/awk/.libs/qseawk -f cou-007.awk cou.dat </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk -f cou-007.awk cou.dat </dev/stdin 2>&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 </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk -f cou-008.awk cou.dat </dev/stdin 2>&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 </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk -f cou-009.awk cou.dat </dev/stdin 2>&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 </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk -f cou-010.awk cou.dat </dev/stdin 2>&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 </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk -f cou-011.awk cou.dat </dev/stdin 2>&1
|
||||
--------------------------------------------------------------------------------
|
||||
--------------------------------------------------------------------------------
|
||||
../../cmd/awk/.libs/qseawk -f cou-012.awk cou.dat </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk -f cou-012.awk cou.dat </dev/stdin 2>&1
|
||||
--------------------------------------------------------------------------------
|
||||
China 3705 1032 Asia
|
||||
India 1267 746 Asia
|
||||
--------------------------------------------------------------------------------
|
||||
../../cmd/awk/.libs/qseawk -f cou-013.awk cou.dat </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk -f cou-013.awk cou.dat </dev/stdin 2>&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 </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk -f cou-014.awk cou.dat </dev/stdin 2>&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 </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk -f cou-015.awk cou.dat </dev/stdin 2>&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 </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk -f cou-016.awk cou.dat </dev/stdin 2>&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 </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk -f cou-017.awk cou.dat </dev/stdin 2>&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 </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk -f cou-018.awk cou.dat </dev/stdin 2>&1
|
||||
--------------------------------------------------------------------------------
|
||||
--------------------------------------------------------------------------------
|
||||
../../cmd/awk/.libs/qseawk -f cou-019.awk cou.dat </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk -f cou-019.awk cou.dat </dev/stdin 2>&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 </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk -f cou-020.awk cou.dat </dev/stdin 2>&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 </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk -f cou-021.awk cou.dat </dev/stdin 2>&1
|
||||
--------------------------------------------------------------------------------
|
||||
USSR 8649000
|
||||
China 3705000
|
||||
India 1267000
|
||||
Japan 144000
|
||||
--------------------------------------------------------------------------------
|
||||
../../cmd/awk/.libs/qseawk -f cou-022.awk cou.dat </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk -f cou-022.awk cou.dat </dev/stdin 2>&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 </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk -f cou-023.awk cou.dat </dev/stdin 2>&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 </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk -f cou-024.awk cou.dat </dev/stdin 2>&1
|
||||
--------------------------------------------------------------------------------
|
||||
Total population of the 4 Asian countries is 2173 million.
|
||||
--------------------------------------------------------------------------------
|
||||
../../cmd/awk/.libs/qseawk -f cou-025.awk cou.dat </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk -f cou-025.awk cou.dat </dev/stdin 2>&1
|
||||
--------------------------------------------------------------------------------
|
||||
Asian population is 2173 million.
|
||||
European population is 172 million.
|
||||
--------------------------------------------------------------------------------
|
||||
../../cmd/awk/.libs/qseawk -f cou-026.awk cou.dat </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk -f cou-026.awk cou.dat </dev/stdin 2>&1
|
||||
--------------------------------------------------------------------------------
|
||||
Asia 2173
|
||||
Europe 172
|
||||
North America 340
|
||||
South America 134
|
||||
--------------------------------------------------------------------------------
|
||||
../../cmd/awk/.libs/qseawk -f cou-027.awk cou.dat </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk -f cou-027.awk cou.dat </dev/stdin 2>&1
|
||||
--------------------------------------------------------------------------------
|
||||
Asia 2173
|
||||
North America 340
|
||||
Europe 172
|
||||
South America 134
|
||||
--------------------------------------------------------------------------------
|
||||
../../cmd/awk/.libs/qseawk -f emp-001.awk emp.dat </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk -f emp-001.awk emp.dat </dev/stdin 2>&1
|
||||
--------------------------------------------------------------------------------
|
||||
Kathy 40
|
||||
Mark 100
|
||||
Mary 121
|
||||
Susie 76.5
|
||||
--------------------------------------------------------------------------------
|
||||
../../cmd/awk/.libs/qseawk -f emp-002.awk emp.dat </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk -f emp-002.awk emp.dat </dev/stdin 2>&1
|
||||
--------------------------------------------------------------------------------
|
||||
Beth
|
||||
Dan
|
||||
--------------------------------------------------------------------------------
|
||||
../../cmd/awk/.libs/qseawk -f emp-003.awk emp.dat </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk -f emp-003.awk emp.dat </dev/stdin 2>&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 </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk -f emp-004.awk emp.dat </dev/stdin 2>&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 </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk -f emp-005.awk emp.dat </dev/stdin 2>&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 </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk -f emp-006.awk emp.dat </dev/stdin 2>&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 </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk -f emp-007.awk emp.dat </dev/stdin 2>&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 </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk -f emp-008.awk emp.dat </dev/stdin 2>&1
|
||||
--------------------------------------------------------------------------------
|
||||
Mark 5.00 20
|
||||
Mary 5.50 22
|
||||
--------------------------------------------------------------------------------
|
||||
../../cmd/awk/.libs/qseawk -f emp-009.awk emp.dat </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk -f emp-009.awk emp.dat </dev/stdin 2>&1
|
||||
--------------------------------------------------------------------------------
|
||||
$100.00 for Mark
|
||||
$121.00 for Mary
|
||||
$76.50 for Susie
|
||||
--------------------------------------------------------------------------------
|
||||
../../cmd/awk/.libs/qseawk -f emp-010.awk emp.dat </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk -f emp-010.awk emp.dat </dev/stdin 2>&1
|
||||
--------------------------------------------------------------------------------
|
||||
Susie 4.25 18
|
||||
--------------------------------------------------------------------------------
|
||||
../../cmd/awk/.libs/qseawk -f emp-011.awk emp.dat </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk -f emp-011.awk emp.dat </dev/stdin 2>&1
|
||||
--------------------------------------------------------------------------------
|
||||
Susie 4.25 18
|
||||
--------------------------------------------------------------------------------
|
||||
../../cmd/awk/.libs/qseawk -f emp-012.awk emp.dat </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk -f emp-012.awk emp.dat </dev/stdin 2>&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 </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk -f emp-013.awk emp.dat </dev/stdin 2>&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 </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk -f emp-014.awk emp.dat </dev/stdin 2>&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 </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk -f emp-015.awk emp.dat </dev/stdin 2>&1
|
||||
--------------------------------------------------------------------------------
|
||||
--------------------------------------------------------------------------------
|
||||
../../cmd/awk/.libs/qseawk -f emp-016.awk emp.dat </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk -f emp-016.awk emp.dat </dev/stdin 2>&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 </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk -f emp-017.awk emp.dat </dev/stdin 2>&1
|
||||
--------------------------------------------------------------------------------
|
||||
3 employees worked more than 15 hours
|
||||
--------------------------------------------------------------------------------
|
||||
../../cmd/awk/.libs/qseawk -f emp-018.awk emp.dat </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk -f emp-018.awk emp.dat </dev/stdin 2>&1
|
||||
--------------------------------------------------------------------------------
|
||||
6 employees
|
||||
--------------------------------------------------------------------------------
|
||||
../../cmd/awk/.libs/qseawk -f emp-019.awk emp.dat </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk -f emp-019.awk emp.dat </dev/stdin 2>&1
|
||||
--------------------------------------------------------------------------------
|
||||
6 employees
|
||||
total pay is 337.5
|
||||
average pay is 56.25
|
||||
--------------------------------------------------------------------------------
|
||||
../../cmd/awk/.libs/qseawk -f emp-020.awk emp.dat </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk -f emp-020.awk emp.dat </dev/stdin 2>&1
|
||||
--------------------------------------------------------------------------------
|
||||
highest hourly rage: 5.50 for Mary
|
||||
--------------------------------------------------------------------------------
|
||||
../../cmd/awk/.libs/qseawk -f emp-021.awk emp.dat </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk -f emp-021.awk emp.dat </dev/stdin 2>&1
|
||||
--------------------------------------------------------------------------------
|
||||
Beth Dan Kathy Mark Mary Susie
|
||||
--------------------------------------------------------------------------------
|
||||
../../cmd/awk/.libs/qseawk -f emp-022.awk emp.dat </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk -f emp-022.awk emp.dat </dev/stdin 2>&1
|
||||
--------------------------------------------------------------------------------
|
||||
Susie 4.25 18
|
||||
--------------------------------------------------------------------------------
|
||||
../../cmd/awk/.libs/qseawk -f emp-023.awk emp.dat </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk -f emp-023.awk emp.dat </dev/stdin 2>&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 </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk -f emp-024.awk emp.dat </dev/stdin 2>&1
|
||||
--------------------------------------------------------------------------------
|
||||
6 lines, 18 words, 77 characters
|
||||
--------------------------------------------------------------------------------
|
||||
../../cmd/awk/.libs/qseawk -f emp-025.awk emp.dat </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk -f emp-025.awk emp.dat </dev/stdin 2>&1
|
||||
--------------------------------------------------------------------------------
|
||||
no employees are paid more than $6/hour
|
||||
--------------------------------------------------------------------------------
|
||||
../../cmd/awk/.libs/qseawk -f emp-026.awk emp.dat </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk -f emp-026.awk emp.dat </dev/stdin 2>&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 </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk -f emp-027.awk emp.dat </dev/stdin 2>&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 </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk -f adr-001.awk adr.dat </dev/stdin 2>&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 </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk -f adr-002.awk adr.dat </dev/stdin 2>&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 </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk -f unr-001.awk unr.dat </dev/stdin 2>&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 </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk --strictnaming=off --newline=on -o- -f lang-001.awk </dev/stdin 2>&1
|
||||
--------------------------------------------------------------------------------
|
||||
function f (__p0)
|
||||
{
|
||||
@ -426,7 +426,7 @@ BEGIN {
|
||||
|
||||
hello
|
||||
--------------------------------------------------------------------------------
|
||||
../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-002.awk </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-002.awk </dev/stdin 2>&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 </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-003.awk </dev/stdin 2>&1
|
||||
--------------------------------------------------------------------------------
|
||||
function fn (__p0)
|
||||
{
|
||||
@ -954,11 +954,11 @@ BEGIN {
|
||||
|
||||
50
|
||||
--------------------------------------------------------------------------------
|
||||
../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-004.awk </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-004.awk </dev/stdin 2>&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 </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk --implicit=off --explicit=on --newline=on -o- -f lang-005.awk </dev/stdin 2>&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 </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk --implicit=off --explicit=on --newline=on -o- -f lang-006.awk </dev/stdin 2>&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 </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk --implicit=on --explicit=on --newline=on -o- -f lang-007.awk </dev/stdin 2>&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 </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk --implicit=off --explicit=on --newline=on -o- -f lang-008.awk </dev/stdin 2>&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 </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk --implicit=off --explicit=on --newline=on --strictnaming=off -o- -f lang-009.awk lang-009.awk </dev/stdin 2>&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 </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-010.awk this is just a test </dev/stdin 2>&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 </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-011.awk </dev/stdin 2>&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 </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-012.awk </dev/stdin 2>&1
|
||||
--------------------------------------------------------------------------------
|
||||
BEGIN {
|
||||
OFS = " ";
|
||||
@ -1345,7 +1345,7 @@ a < " " : 1
|
||||
-0.123
|
||||
122.877
|
||||
--------------------------------------------------------------------------------
|
||||
../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-013.awk </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-013.awk </dev/stdin 2>&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 </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-014.awk </dev/stdin 2>&1
|
||||
--------------------------------------------------------------------------------
|
||||
BEGIN {
|
||||
a = (10 + 20);
|
||||
@ -1365,11 +1365,11 @@ BEGIN {
|
||||
|
||||
30 30 30
|
||||
--------------------------------------------------------------------------------
|
||||
../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-015.awk </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-015.awk </dev/stdin 2>&1
|
||||
--------------------------------------------------------------------------------
|
||||
ERROR: CODE 15 LINE 3 COLUMN 50 - block nested too deeply
|
||||
--------------------------------------------------------------------------------
|
||||
../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-016.awk </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-016.awk </dev/stdin 2>&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 </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-017.awk </dev/stdin 2>&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 </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk --call main --newline=on -o- -f lang-017.awk </dev/stdin 2>&1
|
||||
--------------------------------------------------------------------------------
|
||||
function gety ()
|
||||
{
|
||||
@ -1479,31 +1479,31 @@ END {
|
||||
0
|
||||
2
|
||||
--------------------------------------------------------------------------------
|
||||
../../cmd/awk/.libs/qseawk --explicit=on --newline=on -o- -f lang-018.awk </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk --explicit=on --newline=on -o- -f lang-018.awk </dev/stdin 2>&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 </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk --explicit=on --newline=on -o- -f lang-019.awk </dev/stdin 2>&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 </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk --explicit=on --newline=on -o- -f lang-020.awk </dev/stdin 2>&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 </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk --explicit=on --newline=on -o- -f lang-021.awk </dev/stdin 2>&1
|
||||
--------------------------------------------------------------------------------
|
||||
ERROR: CODE 50 LINE 3 COLUMN 8 - '+' not a valid variable name
|
||||
--------------------------------------------------------------------------------
|
||||
../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-022.awk </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-022.awk </dev/stdin 2>&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 </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk --explicit=on --newline=on -o- -f lang-023.awk </dev/stdin 2>&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 </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk --explicit=on --newline=on -o- -f lang-024.awk </dev/stdin 2>&1
|
||||
--------------------------------------------------------------------------------
|
||||
BEGIN {
|
||||
local __l0;
|
||||
@ -1513,7 +1513,7 @@ BEGIN {
|
||||
|
||||
1
|
||||
--------------------------------------------------------------------------------
|
||||
../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-025.awk </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-025.awk </dev/stdin 2>&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 </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-026.awk </dev/stdin 2>&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 </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-027.awk </dev/stdin 2>&1
|
||||
--------------------------------------------------------------------------------
|
||||
ERROR: CODE 17 LINE 2 COLUMN 1 - invalid character '<NUL>'
|
||||
--------------------------------------------------------------------------------
|
||||
../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-028.awk </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-028.awk </dev/stdin 2>&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 </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk --explicit=on --newline=on -o- -f lang-029.awk </dev/stdin 2>&1
|
||||
--------------------------------------------------------------------------------
|
||||
ERROR: CODE 42 LINE 9 COLUMN 9 - function 'abc' redefined
|
||||
--------------------------------------------------------------------------------
|
||||
../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-030.awk </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-030.awk </dev/stdin 2>&1
|
||||
--------------------------------------------------------------------------------
|
||||
BEGIN {
|
||||
print (1 + 0);
|
||||
@ -1598,7 +1598,7 @@ BEGIN {
|
||||
0
|
||||
0
|
||||
--------------------------------------------------------------------------------
|
||||
../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-031.awk </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-031.awk </dev/stdin 2>&1
|
||||
--------------------------------------------------------------------------------
|
||||
BEGIN {
|
||||
print match("hhhheeeo",/e+/);
|
||||
@ -1632,7 +1632,7 @@ BEGIN {
|
||||
0 -1
|
||||
--------------------------
|
||||
--------------------------------------------------------------------------------
|
||||
../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-032.awk </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-032.awk </dev/stdin 2>&1
|
||||
--------------------------------------------------------------------------------
|
||||
BEGIN {
|
||||
a = 91;
|
||||
@ -1654,7 +1654,7 @@ BEGIN {
|
||||
---------------------
|
||||
9210
|
||||
--------------------------------------------------------------------------------
|
||||
../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-033.awk </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-033.awk </dev/stdin 2>&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 </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk --newline=on --rwpipe=on -o- -f lang-034.awk </dev/stdin 2>&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 </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk --newline=on -o- -vdatafile=lang-035.dat1 -vgroupname=lang-035 -f lang-035.awk lang-035.dat2 </dev/stdin 2>&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 </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-036.awk lang-036.dat </dev/stdin 2>&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 </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-037.awk lang-037.dat </dev/stdin 2>&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 </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-038.awk </dev/stdin 2>&1
|
||||
--------------------------------------------------------------------------------
|
||||
BEGIN {
|
||||
xstr = "abcdefabcdefabcdef";
|
||||
@ -2020,7 +2020,7 @@ BEGIN {
|
||||
7 abc
|
||||
13 abc
|
||||
--------------------------------------------------------------------------------
|
||||
../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-039.awk </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-039.awk </dev/stdin 2>&1
|
||||
--------------------------------------------------------------------------------
|
||||
BEGIN {
|
||||
print (length() 11);
|
||||
@ -2030,7 +2030,7 @@ BEGIN {
|
||||
011
|
||||
2
|
||||
--------------------------------------------------------------------------------
|
||||
../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-040.awk </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-040.awk </dev/stdin 2>&1
|
||||
--------------------------------------------------------------------------------
|
||||
BEGIN {
|
||||
for (x in y)
|
||||
@ -2038,7 +2038,7 @@ BEGIN {
|
||||
}
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-041.awk </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-041.awk </dev/stdin 2>&1
|
||||
--------------------------------------------------------------------------------
|
||||
BEGIN {
|
||||
abc = 20;
|
||||
@ -2047,7 +2047,7 @@ BEGIN {
|
||||
|
||||
2010
|
||||
--------------------------------------------------------------------------------
|
||||
../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-042.awk </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk --newline=on -o- -f lang-042.awk </dev/stdin 2>&1
|
||||
--------------------------------------------------------------------------------
|
||||
BEGIN {
|
||||
print //;
|
||||
@ -2087,7 +2087,7 @@ IGNORECASE= 1
|
||||
1
|
||||
1
|
||||
--------------------------------------------------------------------------------
|
||||
../../cmd/awk/.libs/qseawk --newline=on -F: -f columnate.awk ./passwd.dat </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk --newline=on -F: -f columnate.awk ./passwd.dat </dev/stdin 2>&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 </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk --newline=on --include=on -f levenshtein-utests.awk </dev/stdin 2>&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 </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk --newline=on -v target=89000 -f rcalc.awk </dev/stdin 2>&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 </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk -f quicksort.awk quicksort.dat </dev/stdin 2>&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 </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk -f quicksort2.awk quicksort2.dat </dev/stdin 2>&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 <asm.dat 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk -f asm.awk asm.s <asm.dat 2>&1
|
||||
--------------------------------------------------------------------------------
|
||||
549
|
||||
--------------------------------------------------------------------------------
|
||||
../../cmd/awk/.libs/qseawk -f stripcomment.awk stripcomment.dat </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk -f stripcomment.awk stripcomment.dat </dev/stdin 2>&1
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
|
||||
@ -2208,7 +2208,7 @@ int main ()
|
||||
return 0;
|
||||
}
|
||||
--------------------------------------------------------------------------------
|
||||
../../cmd/awk/.libs/qseawk -f wordfreq.awk wordfreq.awk </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk -f wordfreq.awk wordfreq.awk </dev/stdin 2>&1
|
||||
--------------------------------------------------------------------------------
|
||||
_ 2
|
||||
a 2
|
||||
@ -2236,7 +2236,7 @@ in 1
|
||||
1 1
|
||||
blank 2
|
||||
--------------------------------------------------------------------------------
|
||||
../../cmd/awk/.libs/qseawk -f hanoi.awk </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk -f hanoi.awk </dev/stdin 2>&1
|
||||
--------------------------------------------------------------------------------
|
||||
0 54321
|
||||
1
|
||||
@ -2367,7 +2367,7 @@ blank 2
|
||||
2
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
../../cmd/awk/.libs/qseawk -f indent.awk indent.dat </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/awk/.libs/qseawk -f indent.awk indent.dat </dev/stdin 2>&1
|
||||
--------------------------------------------------------------------------------
|
||||
#!/bin/sh
|
||||
|
||||
|
2383
qse/regress/awk/regress.out.xma
Normal file
2383
qse/regress/awk/regress.out.xma
Normal file
File diff suppressed because it is too large
Load Diff
@ -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}.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"
|
||||
rm -f "${OUTFILE_XMA}.$$"
|
||||
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
|
||||
|
@ -1,5 +1,5 @@
|
||||
--------------------------------------------------------------------------------
|
||||
../../cmd/sed/.libs/qsesed -n -f s001.sed s001.dat </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/sed/.libs/qsesed -n -f s001.sed s001.dat </dev/stdin 2>&1
|
||||
--------------------------------------------------------------------------------
|
||||
ab...c AAA
|
||||
|
||||
@ -15,7 +15,7 @@ pq...r AAA2
|
||||
kbs ddd
|
||||
dif cccc
|
||||
--------------------------------------------------------------------------------
|
||||
../../cmd/sed/.libs/qsesed -f s002.sed s002.dat </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/sed/.libs/qsesed -f s002.sed s002.dat </dev/stdin 2>&1
|
||||
--------------------------------------------------------------------------------
|
||||
ab...c AAA
|
||||
|
||||
@ -31,7 +31,7 @@ pq...r AAA2
|
||||
kbs ddd
|
||||
dif cccc
|
||||
--------------------------------------------------------------------------------
|
||||
../../cmd/sed/.libs/qsesed -f s003.sed s003.dat </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/sed/.libs/qsesed -f s003.sed s003.dat </dev/stdin 2>&1
|
||||
--------------------------------------------------------------------------------
|
||||
ab...c AAA
|
||||
|
||||
@ -47,7 +47,7 @@ pq...r AAA2
|
||||
kbs ddd
|
||||
dif cccc
|
||||
--------------------------------------------------------------------------------
|
||||
../../cmd/sed/.libs/qsesed -f s004.sed s004.dat </dev/stdin 2>&1
|
||||
[CMD] ../../cmd/sed/.libs/qsesed -f s004.sed s004.dat </dev/stdin 2>&1
|
||||
--------------------------------------------------------------------------------
|
||||
linux {
|
||||
HOST: com.com
|
||||
|
61
qse/regress/sed/regress.out.xma
Normal file
61
qse/regress/sed/regress.out.xma
Normal file
@ -0,0 +1,61 @@
|
||||
--------------------------------------------------------------------------------
|
||||
[CMD] ../../cmd/sed/.libs/qsesed -m 500000 -n -f s001.sed s001.dat </dev/stdin 2>&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 </dev/stdin 2>&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 </dev/stdin 2>&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 </dev/stdin 2>&1
|
||||
--------------------------------------------------------------------------------
|
||||
linux {
|
||||
HOST: com.com
|
||||
ADDRESS: 45.34.34.33
|
||||
}
|
||||
|
||||
|
||||
linux {
|
||||
HOST: com.com
|
||||
ADDRESS: 45.34.34.33
|
||||
}
|
@ -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"
|
||||
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"
|
||||
}
|
||||
}
|
||||
;;
|
||||
leakcheck)
|
||||
bin_valgrind="`which valgrind 2> /dev/null || echo ""`"
|
||||
|
@ -1,11 +1,15 @@
|
||||
#include <qse/cmn/xma.h>
|
||||
#include <qse/cmn/stdio.h>
|
||||
|
||||
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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user