libmaa-1.4.4/0000755000175000017500000000000013457657444012702 5ustar cheusovcheusovlibmaa-1.4.4/tests/0000755000175000017500000000000013457657444014044 5ustar cheusovcheusovlibmaa-1.4.4/tests/base/0000755000175000017500000000000013457657444014756 5ustar cheusovcheusovlibmaa-1.4.4/tests/base/expect.out0000644000175000017500000000132613457657444017001 0ustar cheusovcheusov0 = a (base26) 1 = b (base26) 2 = c (base26) 3 = d (base26) 4 = e (base26) 5 = f (base26) 6 = g (base26) 7 = h (base26) 8 = i (base26) 9 = j (base26) 6553 = jsb (base26) 13106 = tkc (base26) 19659 = bdcd (base26) 26212 = bmue (base26) 32765 = bwmf (base26) 39318 = cgeg (base26) 45871 = cpwh (base26) 52424 = czoi (base26) 58977 = djgj (base26) 65530 = dsyk (base26) 0 = A (base64) 1 = B (base64) 2 = C (base64) 3 = D (base64) 4 = E (base64) 5 = F (base64) 6 = G (base64) 7 = H (base64) 8 = I (base64) 9 = J (base64) 6553 = BmZ (base64) 13106 = DMy (base64) 19659 = EzL (base64) 26212 = GZk (base64) 32765 = H/9 (base64) 39318 = JmW (base64) 45871 = LMv (base64) 52424 = MzI (base64) 58977 = OZh (base64) 65530 = P/6 (base64) libmaa-1.4.4/tests/base/basetest.c0000644000175000017500000000526313457657444016742 0ustar cheusovcheusov/* basetest.c -- Test base64 and base26 numbers * Created: Sun Nov 10 11:51:11 1996 by faith@dict.org * Copyright 1996, 2002 Rickard E. Faith (faith@dict.org) * Copyright 2002-2008 Aleksey Cheusov (vle@gmx.net) * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ #include "maaP.h" int main( int argc, char **argv ) { long int i; const char *result; long int limit = 0xffff; if (argc == 2) limit = strtol( argv[1], NULL, 0 ); for (i = 0; i < limit; i++) { result = b26_encode( i ); if (i != b26_decode( result )) { printf( "%s => %ld != %ld\n", result, b26_decode( result ), i ); } if (i < 100) { result = b26_encode( 0 ); if (0 != b26_decode( result )) { printf( "%s => %ld != %ld (cache problem)\n", result, b26_decode( result ), 0L ); } result = b26_encode( i ); if (i != b26_decode( result )) { printf( "%s => %ld != %ld (cache problem)\n", result, b64_decode( result ), i ); } } if (i < 10 || !(i % (limit/10))) printf( "%ld = %s (base26)\n", i, result ); } for (i = 0; i < limit; i++) { result = b64_encode( i ); if (i != b64_decode( result )) { printf( "%s => %ld != %ld\n", result, b64_decode( result ), i ); } if (i < 100) { result = b64_encode( 0 ); if (0 != b64_decode( result )) { printf( "%s => %ld != %ld (cache problem)\n", result, b64_decode( result ), 0L ); } result = b64_encode( i ); if (i != b64_decode( result )) { printf( "%s => %ld != %ld (cache problem)\n", result, b64_decode( result ), i ); } } if (i < 10 || !(i % (limit/10))) printf( "%ld = %s (base64)\n", i, result ); } return 0; } libmaa-1.4.4/tests/base/Makefile0000644000175000017500000000016113457657444016414 0ustar cheusovcheusovPROG = basetest SRCS = basetest.c WARNS = 4 WARNERR = yes .include "../../mk/test.mk" .include libmaa-1.4.4/tests/prime/0000755000175000017500000000000013457657444015160 5ustar cheusovcheusovlibmaa-1.4.4/tests/prime/expect.out0000644000175000017500000000000613457657444017175 0ustar cheusovcheusov10007 libmaa-1.4.4/tests/prime/primetest.c0000644000175000017500000000274513457657444017350 0ustar cheusovcheusov/* primetest.c -- * Created: Thu Jul 20 22:15:54 1995 by faith@dict.org * Copyright 1995, 1996, 2002 Rickard E. Faith (faith@dict.org) * Copyright 2002-2008 Aleksey Cheusov (vle@gmx.net) * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ #include "maaP.h" int main( int argc, char **argv ) { if (argc != 2) { printf( "%lu\n", prm_next_prime( 10000 ) ); } else { printf( "%lu\n", prm_next_prime( strtoul( argv[1], NULL, 0 ) ) ); } return 0; } libmaa-1.4.4/tests/prime/Makefile0000644000175000017500000000016313457657444016620 0ustar cheusovcheusovPROG = primetest SRCS = primetest.c WARNS = 4 WARNERR = yes .include "../../mk/test.mk" .include libmaa-1.4.4/tests/stack/0000755000175000017500000000000013457657444015151 5ustar cheusovcheusovlibmaa-1.4.4/tests/stack/expect.out0000644000175000017500000000013113457657444017165 0ustar cheusovcheusovisempty=1 isempty=0 pop=50 pop=40 pop=30 pop=20 pop=10 isempty=1 top=20 top=20 isempty=0 libmaa-1.4.4/tests/stack/stacktest.c0000644000175000017500000000402213457657444017320 0ustar cheusovcheusov/* sltest.c -- * Copyright 2018 Aleksey Cheusov (vle@gmx.net) * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ #include "maaP.h" #include int main( int argc, char **argv ) { stk_Stack stack = NULL; stk_Stack stack2 = NULL; void * datum; maa_init( argv[0] ); stack = stk_create(); printf("isempty=%d\n", stk_isempty(stack)); stk_push(stack, __UNCONST("10")); stk_push(stack, __UNCONST("20")); stk_push(stack, __UNCONST("30")); stk_push(stack, __UNCONST("40")); stk_push(stack, __UNCONST("50")); printf("isempty=%d\n", stk_isempty(stack)); while ((datum = stk_pop(stack)) != NULL){ printf("pop=%s\n", (char *) datum); } printf("isempty=%d\n", stk_isempty(stack)); stk_push(stack, __UNCONST("10")); stk_push(stack, __UNCONST("20")); printf("top=%s\n", (char *) stk_top(stack)); printf("top=%s\n", (char *) stk_top(stack)); printf("isempty=%d\n", stk_isempty(stack)); stack2 = stk_create(); stk_destroy(stack); stk_destroy(stack2); maa_shutdown(); return 0; } libmaa-1.4.4/tests/stack/Makefile0000644000175000017500000000016313457657444016611 0ustar cheusovcheusovPROG = stacktest SRCS = stacktest.c WARNS = 4 WARNERR = yes .include "../../mk/test.mk" .include libmaa-1.4.4/tests/sl/0000755000175000017500000000000013457657444014462 5ustar cheusovcheusovlibmaa-1.4.4/tests/sl/sltest.c0000644000175000017500000000572213457657444016152 0ustar cheusovcheusov/* sltest.c -- * Created: Mon Feb 19 08:57:34 1996 by faith@dict.org * Copyright 1996, 2002 Rickard E. Faith (faith@dict.org) * Copyright 2002-2008 Aleksey Cheusov (vle@gmx.net) * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ #include "maaP.h" #include #undef DUMP static int compare( const void *datum1, const void *datum2 ) { long a = (long)datum1; long b = (long)datum2; if (a < b) return -1; if (a > b) return 1; return 0; } static int print( const void *datum ) { printf ("%li ", (long) datum); return 0; } static const void *key( const void *datum ) { return datum; } int main( int argc, char **argv ) { sl_List sl; int count; int i; maa_init( argv[0] ); if (argc == 1) { count = 10; } else if (argc != 2 ) { fprintf( stderr, "usage: sltest count\n" ); return 1; } else { count = atoi( argv[1] ); } printf( "Running test for count of %d\n", count ); sl = sl_create( compare, key, NULL ); for (i = 1; i < count; i++) { printf( "adding %d\n", i ); sl_insert( sl, (void *) (intptr_t) i ); #ifdef DUMP _sl_dump( sl ); #endif } sl_iterate( sl, print ); printf( "\n" ); sl_delete( sl, (void *)5 ); sl_iterate( sl, print ); printf( "\n" ); sl_insert( sl, (void *)0 ); sl_iterate( sl, print ); printf( "\n" ); sl_insert( sl, (void *)66 ); sl_iterate( sl, print ); printf( "\n" ); sl_insert( sl, (void *)100 ); sl_iterate( sl, print ); printf( "\n" ); sl_insert( sl, (void *)-1 ); sl_iterate( sl, print ); printf( "\n" ); sl_insert( sl, (void *)5 ); sl_iterate( sl, print ); printf( "\n" ); sl_insert( sl, (void *)67 ); sl_iterate( sl, print ); printf( "\n" ); sl_insert( sl, (void *)68 ); sl_iterate( sl,print ); printf( "\n" ); sl_insert( sl, (void *)65 ); sl_iterate( sl, print ); printf( "\n" ); sl_destroy( sl ); return 0; } libmaa-1.4.4/tests/sl/expect.out0000644000175000017500000000060013457657444016477 0ustar cheusovcheusovRunning test for count of 10 adding 1 adding 2 adding 3 adding 4 adding 5 adding 6 adding 7 adding 8 adding 9 1 2 3 4 5 6 7 8 9 1 2 3 4 6 7 8 9 0 1 2 3 4 6 7 8 9 0 1 2 3 4 6 7 8 9 66 0 1 2 3 4 6 7 8 9 66 100 -1 0 1 2 3 4 6 7 8 9 66 100 -1 0 1 2 3 4 5 6 7 8 9 66 100 -1 0 1 2 3 4 5 6 7 8 9 66 67 100 -1 0 1 2 3 4 5 6 7 8 9 66 67 68 100 -1 0 1 2 3 4 5 6 7 8 9 65 66 67 68 100 libmaa-1.4.4/tests/sl/Makefile0000644000175000017500000000015513457657444016123 0ustar cheusovcheusovPROG = sltest SRCS = sltest.c WARNS = 4 WARNERR = yes .include "../../mk/test.mk" .include libmaa-1.4.4/tests/prm/0000755000175000017500000000000013457657444014642 5ustar cheusovcheusovlibmaa-1.4.4/tests/prm/expect.out0000644000175000017500000000016513457657444016665 0ustar cheusovcheusov37 is prime: 1 39 is prime: 0 33 is prime: 0 smallest prime greater than 39: 41 smallest prime greater than 100: 101 libmaa-1.4.4/tests/prm/prmtest.c0000644000175000017500000000310113457657444016477 0ustar cheusovcheusov/* memtest.c -- * Copyright 2018 Aleksey Cheusov (vle@gmx.net) * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ #include #include #include #include "maa.h" int main(int argc, char** argv) { maa_init(argv[0]); printf("37 is prime: %d\n", prm_is_prime(37)); printf("39 is prime: %d\n", prm_is_prime(39)); printf("33 is prime: %d\n", prm_is_prime(33)); printf("smallest prime greater than 39: %lu\n", prm_next_prime(39)); printf("smallest prime greater than 100: %lu\n", prm_next_prime(100)); maa_shutdown(); return 0; } libmaa-1.4.4/tests/prm/Makefile0000644000175000017500000000015713457657444016305 0ustar cheusovcheusovPROG = prmtest SRCS = prmtest.c WARNS = 4 WARNERR = yes .include "../../mk/test.mk" .include libmaa-1.4.4/tests/bit/0000755000175000017500000000000013457657444014622 5ustar cheusovcheusovlibmaa-1.4.4/tests/bit/expect.out0000644000175000017500000000144013457657444016642 0ustar cheusovcheusov0x00000000 has 0 bits set 0x00000001 has 1 bits set 0x00000003 has 2 bits set 0x00000007 has 3 bits set 0x0000000f has 4 bits set 0x0000001f has 5 bits set 0x0000003f has 6 bits set 0x0000007f has 7 bits set 0x000000ff has 8 bits set 0x800000ff has 9 bits set 0xc00000ff has 10 bits set 0xe00000ff has 11 bits set 0xf00000ff has 12 bits set 0xf80000ff has 13 bits set 0xf80000ff has 7 bit set: yes 0xf80000ff has 8 bit set: no 0xf80000ff has 9 bit set: no 0xf80000ff has 27 bit set: yes 0xf80000ff has 28 bit set: yes 0xf80000ff has 29 bit set: yes 0xf80000fe has 12 bits set 0x780000fe has 11 bits set 0x780000fc has 10 bits set 0x780000ec has 9 bits set 0x7800006c has 8 bits set 0x7800006c has 8 bits set 0x7800006c has 14 bit set: no 0x7800006c has 15 bit set: no 0x7800006c has 16 bit set: no libmaa-1.4.4/tests/bit/bittest.c0000644000175000017500000000737313457657444016456 0ustar cheusovcheusov/* bittest.c -- Test the bit functions, especially the counter * Created: Mon Oct 2 10:10:57 1995 by faith@dict.org * Copyright 1995, 2002 Rickard E. Faith (faith@dict.org) * Copyright 2002-2008 Aleksey Cheusov (vle@gmx.net) * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ #include "maaP.h" int main( int argc, char **argv ) { unsigned long t = 0; printf( "0x%08lx has %d bits set\n", t, bit_cnt( &t ) ); bit_set( &t, 0 ); printf( "0x%08lx has %d bits set\n", t, bit_cnt( &t ) ); bit_set( &t, 1 ); printf( "0x%08lx has %d bits set\n", t, bit_cnt( &t ) ); bit_set( &t, 2 ); printf( "0x%08lx has %d bits set\n", t, bit_cnt( &t ) ); bit_set( &t, 3 ); printf( "0x%08lx has %d bits set\n", t, bit_cnt( &t ) ); bit_set( &t, 4 ); printf( "0x%08lx has %d bits set\n", t, bit_cnt( &t ) ); bit_set( &t, 5 ); printf( "0x%08lx has %d bits set\n", t, bit_cnt( &t ) ); bit_set( &t, 6 ); printf( "0x%08lx has %d bits set\n", t, bit_cnt( &t ) ); bit_set( &t, 7 ); printf( "0x%08lx has %d bits set\n", t, bit_cnt( &t ) ); bit_set( &t, 31 ); printf( "0x%08lx has %d bits set\n", t, bit_cnt( &t ) ); bit_set( &t, 30 ); printf( "0x%08lx has %d bits set\n", t, bit_cnt( &t ) ); bit_set( &t, 29 ); printf( "0x%08lx has %d bits set\n", t, bit_cnt( &t ) ); bit_set( &t, 28 ); printf( "0x%08lx has %d bits set\n", t, bit_cnt( &t ) ); bit_set( &t, 27 ); printf( "0x%08lx has %d bits set\n", t, bit_cnt( &t ) ); printf( "0x%08lx has %d bit set: %s\n", t, 7, bit_tst( &t, 7 ) ? "yes" : "no" ); printf( "0x%08lx has %d bit set: %s\n", t, 8, bit_tst( &t, 8 ) ? "yes" : "no" ); printf( "0x%08lx has %d bit set: %s\n", t, 9, bit_tst( &t, 9 ) ? "yes" : "no" ); printf( "0x%08lx has %d bit set: %s\n", t, 27, bit_tst( &t, 27 ) ? "yes" : "no" ); printf( "0x%08lx has %d bit set: %s\n", t, 28, bit_tst( &t, 28 ) ? "yes" : "no" ); printf( "0x%08lx has %d bit set: %s\n", t, 29, bit_tst( &t, 29 ) ? "yes" : "no" ); printf( "\n" ); bit_clr( &t, 0 ); printf( "0x%08lx has %d bits set\n", t, bit_cnt( &t ) ); bit_clr( &t, 31 ); printf( "0x%08lx has %d bits set\n", t, bit_cnt( &t ) ); bit_clr( &t, 1 ); printf( "0x%08lx has %d bits set\n", t, bit_cnt( &t ) ); bit_clr( &t, 4 ); printf( "0x%08lx has %d bits set\n", t, bit_cnt( &t ) ); bit_clr( &t, 7 ); printf( "0x%08lx has %d bits set\n", t, bit_cnt( &t ) ); printf( "\n" ); bit_clr( &t, 16 ); printf( "0x%08lx has %d bits set\n", t, bit_cnt( &t ) ); printf( "0x%08lx has %d bit set: %s\n", t, 14, bit_tst( &t, 14 ) ? "yes" : "no" ); printf( "0x%08lx has %d bit set: %s\n", t, 15, bit_tst( &t, 15 ) ? "yes" : "no" ); printf( "0x%08lx has %d bit set: %s\n", t, 16, bit_tst( &t, 16 ) ? "yes" : "no" ); return 0; } libmaa-1.4.4/tests/bit/Makefile0000644000175000017500000000015713457657444016265 0ustar cheusovcheusovPROG = bittest SRCS = bittest.c WARNS = 4 WARNERR = yes .include "../../mk/test.mk" .include libmaa-1.4.4/tests/basics/0000755000175000017500000000000013457657444015310 5ustar cheusovcheusovlibmaa-1.4.4/tests/basics/expect.out0000644000175000017500000000002513457657444017326 0ustar cheusovcheusovversion: 999.999.999 libmaa-1.4.4/tests/basics/basicstest.c0000644000175000017500000000277213457657444017630 0ustar cheusovcheusov/* memtest.c -- * Created: Sat Jul 1 22:42:09 1995 by faith@dict.org * Copyright 1995, 2002 Rickard E. Faith (faith@dict.org) * Copyright 2002-2008 Aleksey Cheusov (vle@gmx.net) * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ #include #include #include #include "maa.h" int main(int argc, char** argv) { maa_init(argv[0]); printf("version: %d.%d.%d\n", maa_version_major(), maa_version_minor(), maa_version_teeny()); maa_shutdown(); return 0; } libmaa-1.4.4/tests/basics/Makefile0000644000175000017500000000016513457657444016752 0ustar cheusovcheusovPROG = basicstest SRCS = basicstest.c WARNS = 4 WARNERR = yes .include "../../mk/test.mk" .include libmaa-1.4.4/tests/arg/0000755000175000017500000000000013457657444014615 5ustar cheusovcheusovlibmaa-1.4.4/tests/arg/argtest.c0000644000175000017500000000547113457657444016441 0ustar cheusovcheusov/* argtest.c -- * Created: Sun Jan 7 20:23:34 1996 by faith@dict.org * Copyright 1996, 2002 Rickard E. Faith (faith@dict.org) * Copyright 2002-2008 Aleksey Cheusov (vle@gmx.net) * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ #include "maaP.h" int main( int argc, char **argv ) { arg_List a; int c; char **v; int i; FILE *f; char buffer [2000]; char *first_bq, *last_bq; maa_init( argv[0] ); --argc; ++argv; if (argc) f = fopen (argv [0], "r"); else f = fopen ("argtest.in", "r"); if (!f) exit (10); while (fgets (buffer, sizeof(buffer), f)){ first_bq = strchr (buffer, '`'); last_bq = strrchr (buffer, '`'); if (!first_bq || !last_bq) return 11; *first_bq++ = '\0'; *last_bq = '\0'; printf ("---------------------\nInput = \"%s\"\n\n", first_bq); /* 0 */ a = arg_argify (first_bq, 0); arg_get_vector (a, &c, &v); for (i = 0; i < c; i++){ printf ("Arg %d = \"%s\"\n", i, v[i]); } arg_destroy( a ); printf ("\n"); /* no escape */ a = arg_argify (first_bq, ARG_NO_ESCAPE); arg_get_vector (a, &c, &v); for (i = 0; i < c; i++){ printf ("Arg %d = \"%s\"\n", i, v[i]); } arg_destroy( a ); printf ("\n"); /* no quote */ a = arg_argify (first_bq, ARG_NO_QUOTE); arg_get_vector (a, &c, &v); for (i = 0; i < c; i++){ printf ("Arg %d = \"%s\"\n", i, v[i]); } arg_destroy( a ); printf ("\n"); /* no quote and no escape */ a = arg_argify (first_bq, ARG_NO_QUOTE | ARG_NO_ESCAPE); arg_get_vector (a, &c, &v); for (i = 0; i < c; i++){ printf ("Arg %d = \"%s\"\n", i, v[i]); } arg_destroy( a ); printf ("\n"); } return 0; } libmaa-1.4.4/tests/arg/expect.out0000644000175000017500000000722513457657444016644 0ustar cheusovcheusov--------------------- Input = "\\This is a "test of quotes" and ano'ther test' " Arg 0 = "\This" Arg 1 = "is" Arg 2 = "a" Arg 3 = "test of quotes" Arg 4 = "and" Arg 5 = "another test" Arg 0 = "\\This" Arg 1 = "is" Arg 2 = "a" Arg 3 = "test of quotes" Arg 4 = "and" Arg 5 = "another test" Arg 0 = "\This" Arg 1 = "is" Arg 2 = "a" Arg 3 = ""test" Arg 4 = "of" Arg 5 = "quotes"" Arg 6 = "and" Arg 7 = "ano'ther" Arg 8 = "test'" Arg 0 = "\\This" Arg 1 = "is" Arg 2 = "a" Arg 3 = ""test" Arg 4 = "of" Arg 5 = "quotes"" Arg 6 = "and" Arg 7 = "ano'ther" Arg 8 = "test'" --------------------- Input = ""quotes"" Arg 0 = "quotes" Arg 0 = "quotes" Arg 0 = ""quotes"" Arg 0 = ""quotes"" --------------------- Input = ""quotesa" foo "" "quotes'b" '' 'foo'"'"'bar'" Arg 0 = "quotesa" Arg 1 = "foo" Arg 2 = "" Arg 3 = "quotes'b" Arg 4 = "" Arg 5 = "foo'bar" Arg 0 = "quotesa" Arg 1 = "foo" Arg 2 = "" Arg 3 = "quotes'b" Arg 4 = "" Arg 5 = "foo'bar" Arg 0 = ""quotesa"" Arg 1 = "foo" Arg 2 = """" Arg 3 = ""quotes'b"" Arg 4 = "''" Arg 5 = "'foo'"'"'bar'" Arg 0 = ""quotesa"" Arg 1 = "foo" Arg 2 = """" Arg 3 = ""quotes'b"" Arg 4 = "''" Arg 5 = "'foo'"'"'bar'" --------------------- Input = "noquotes" Arg 0 = "noquotes" Arg 0 = "noquotes" Arg 0 = "noquotes" Arg 0 = "noquotes" --------------------- Input = " aaa1 foo " Arg 0 = "aaa1" Arg 1 = "foo" Arg 0 = "aaa1" Arg 1 = "foo" Arg 0 = "aaa1" Arg 1 = "foo" Arg 0 = "aaa1" Arg 1 = "foo" --------------------- Input = " aaa2 foo" Arg 0 = "aaa2" Arg 1 = "foo" Arg 0 = "aaa2" Arg 1 = "foo" Arg 0 = "aaa2" Arg 1 = "foo" Arg 0 = "aaa2" Arg 1 = "foo" --------------------- Input = "aaa3 foo " Arg 0 = "aaa3" Arg 1 = "foo" Arg 0 = "aaa3" Arg 1 = "foo" Arg 0 = "aaa3" Arg 1 = "foo" Arg 0 = "aaa3" Arg 1 = "foo" --------------------- Input = " " --------------------- Input = "" --------------------- Input = "\\" Arg 0 = "\" Arg 0 = "\\" Arg 0 = "\" Arg 0 = "\\" --------------------- Input = "1''2''3''4" Arg 0 = "1234" Arg 0 = "1234" Arg 0 = "1''2''3''4" Arg 0 = "1''2''3''4" --------------------- Input = "' 1'' 2' " Arg 0 = " 1 2" Arg 0 = " 1 2" Arg 0 = "'" Arg 1 = "1''" Arg 2 = "2'" Arg 0 = "'" Arg 1 = "1''" Arg 2 = "2'" --------------------- Input = "" 1"" 2" " Arg 0 = " 1 2" Arg 0 = " 1 2" Arg 0 = """ Arg 1 = "1""" Arg 2 = "2"" Arg 0 = """ Arg 1 = "1""" Arg 2 = "2"" --------------------- Input = " " 123"' 234' " Arg 0 = " 123 234" Arg 0 = " 123 234" Arg 0 = """ Arg 1 = "123"'" Arg 2 = "234'" Arg 0 = """ Arg 1 = "123"'" Arg 2 = "234'" --------------------- Input = "1''""''""''""''""2" Arg 0 = "12" Arg 0 = "12" Arg 0 = "1''""''""''""''""2" Arg 0 = "1''""''""''""''""2" --------------------- Input = "''1""2''" Arg 0 = "12" Arg 0 = "12" Arg 0 = "''1""2''" Arg 0 = "''1""2''" --------------------- Input = "''1 ""2 '' """ Arg 0 = "1" Arg 1 = "2" Arg 2 = "" Arg 3 = "" Arg 0 = "1" Arg 1 = "2" Arg 2 = "" Arg 3 = "" Arg 0 = "''1" Arg 1 = """2" Arg 2 = "''" Arg 3 = """" Arg 0 = "''1" Arg 1 = """2" Arg 2 = "''" Arg 3 = """" --------------------- Input = "'\''1" Arg 0 = "\1" Arg 0 = "\1" Arg 0 = "'''1" Arg 0 = "'\''1" --------------------- Input = "1\ 2\ 3\ 4 \ 5" Arg 0 = "1 2 3 4" Arg 1 = " 5" Arg 0 = "1\" Arg 1 = "2\" Arg 2 = "3\" Arg 3 = "4" Arg 4 = "\" Arg 5 = "5" Arg 0 = "1 2 3 4" Arg 1 = " 5" Arg 0 = "1\" Arg 1 = "2\" Arg 2 = "3\" Arg 3 = "4" Arg 4 = "\" Arg 5 = "5" --------------------- Input = "\ \ \ \ " Arg 0 = " " Arg 0 = "\" Arg 1 = "\" Arg 2 = "\" Arg 3 = "\" Arg 0 = " " Arg 0 = "\" Arg 1 = "\" Arg 2 = "\" Arg 3 = "\" --------------------- Input = "\ \'\"\ " Arg 0 = " '" " Arg 0 = "\" Arg 1 = "\\"\ " Arg 0 = " '" " Arg 0 = "\" Arg 1 = "\'\"\" libmaa-1.4.4/tests/arg/argtest.in0000644000175000017500000000051113457657444016613 0ustar cheusovcheusov`\\This is a "test of quotes" and ano'ther test' ` `"quotes"` `"quotesa" foo "" "quotes'b" '' 'foo'"'"'bar'` `noquotes` ` aaa1 foo ` ` aaa2 foo` `aaa3 foo ` ` ` `` `\\` `1''2''3''4` `' 1'' 2' `" 1"" 2" ` " 123"' 234' ` `1''""''""''""''""2` `''1""2''` `''1 ""2 '' ""` `'\''1` `1\ 2\ 3\ 4 \ 5` `\ \ \ \ ` `\ \'\"\ ` libmaa-1.4.4/tests/arg/Makefile0000644000175000017500000000022713457657444016256 0ustar cheusovcheusovPROG = argtest SRCS = argtest.c TEST_PROG_ARGS = ${.CURDIR}/argtest.in WARNS = 4 WARNERR = yes .include "../../mk/test.mk" .include libmaa-1.4.4/tests/debug/0000755000175000017500000000000013457657444015132 5ustar cheusovcheusovlibmaa-1.4.4/tests/debug/expect.out0000644000175000017500000000003513457657444017151 0ustar cheusovcheusovVerbose not set Test not set libmaa-1.4.4/tests/debug/debugtest.c0000644000175000017500000000372113457657444017267 0ustar cheusovcheusov/* debugtest.c -- * Created: Sun Dec 25 18:57:38 1994 by faith@dict.org * Copyright 1994, 1996, 2002 Rickard E. Faith (faith@dict.org) * Copyright 2002-2008 Aleksey Cheusov (vle@gmx.net) * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ #include "maaP.h" #include #define DBG_VERBOSE 0x00000001 #define DBG_TEST 0x00000002 int main( int argc, char **argv ) { int c; maa_init( argv[0] ); dbg_register( DBG_VERBOSE, "verbose" ); dbg_register( DBG_TEST, "test" ); while ((c = getopt( argc, argv, "d:" )) != -1) { switch (c) { case 'd': dbg_set( optarg ); break; default: fprintf( stderr, "Usage: debugtest [-dverbose] [-dtest]\n" ); break; } } if (dbg_test( DBG_VERBOSE )) printf( "Verbose set\n" ); else printf( "Verbose not set\n" ); if (dbg_test( DBG_TEST )) printf( "Test set\n" ); else printf( "Test not set\n" ); return 0; } libmaa-1.4.4/tests/debug/Makefile0000644000175000017500000000016313457657444016572 0ustar cheusovcheusovPROG = debugtest SRCS = debugtest.c WARNS = 4 WARNERR = yes .include "../../mk/test.mk" .include libmaa-1.4.4/tests/pr/0000755000175000017500000000000013457657444014465 5ustar cheusovcheusovlibmaa-1.4.4/tests/pr/expect.out0000644000175000017500000000003213457657444016501 0ustar cheusovcheusovGot: "foo " status = 0x00 libmaa-1.4.4/tests/pr/prtest.c0000644000175000017500000000525513457657444016161 0ustar cheusovcheusov/* prtest.c -- * Created: Fri Jan 12 14:18:32 1996 by faith@dict.org * Copyright 1996, 2002 Rickard E. Faith (faith@dict.org) * Copyright 2002-2008 Aleksey Cheusov (vle@gmx.net) * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ #include "maaP.h" int main( int argc, char **argv ) { int fdin = 0; int fdout; char buf[BUFSIZ]; int c; int i; ssize_t cnt = 0; maa_init( argv[0] ); while ((c = getopt( argc, argv, "D" )) != EOF) switch (c) { case 'D': dbg_set( ".pr" ); break; } if (argc-optind == 0) { pr_open( "echo foo", PR_USE_STDIN | PR_CREATE_STDOUT, &fdin, &fdout, NULL ); } else { for (i = optind; i < argc; i++) { pr_open( argv[i], PR_USE_STDIN | PR_CREATE_STDOUT, &fdin, &fdout, NULL ); fdin = fdout; } } printf ("Got:"); while (cnt = read (fdout, buf, BUFSIZ-1), cnt > 0){ buf [cnt] = 0; printf( " \"%s\"\n", buf ); } printf( "status = 0x%02x\n", pr_close (fdout) ); #if 0 printf( "%s\n", maa_version() ); pr_open( "echo foobar", PR_USE_STDIN | PR_CREATE_STDOUT, NULL, &instr, NULL ); pr_open( "cat", PR_USE_STDIN | PR_CREATE_STDOUT, &instr, &outstr, NULL ); fgets( buf, sizeof( buf ), outstr ); printf( "Got \"%s\"\n", buf ); printf( "status = 0x%02x\n", pr_close( outstr ) ); pr_open( "cat", PR_CREATE_STDIN | PR_CREATE_STDOUT, &instr, &outstr, NULL ); fprintf( instr, "this is a test\n" ); fflush( instr ); fgets( buf, sizeof( buf ), outstr ); printf( "Got \"%s\"\n", buf ); printf( "status = 0x%02x\n", pr_close( instr ) ); printf( "status = 0x%02x\n", pr_close( outstr ) ); #endif return 0; } libmaa-1.4.4/tests/pr/Makefile0000644000175000017500000000015513457657444016126 0ustar cheusovcheusovPROG = prtest SRCS = prtest.c WARNS = 4 WARNERR = yes .include "../../mk/test.mk" .include libmaa-1.4.4/tests/log/0000755000175000017500000000000013457657444014625 5ustar cheusovcheusovlibmaa-1.4.4/tests/log/expect.out0000644000175000017500000000012213457657444016641 0ustar cheusovcheusovDay Mth NN NN:NN:NN NNNN HOSTNAME logtest[NNNNN]: (main) Error??? No-o-o-o... :-) libmaa-1.4.4/tests/log/logtest.c0000644000175000017500000000274413457657444016461 0ustar cheusovcheusov/* sltest.c -- * Created: Fri, 27 Feb 2009 23:21:31 +0200 by vle@gmx.net * Copyright 2009 Aleksey Cheusov (vle@gmx.net) * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ #include "maaP.h" int main( int argc, char **argv ) { const char *logfn; --argc, ++argv; if (!argc) return 1; logfn = argv [0]; maa_init (argv [0]); log_file ("logtest", logfn); log_error ("main", "Error??? No-o-o-o... :-)"); maa_shutdown (); return 0; } libmaa-1.4.4/tests/log/logtest.sh0000755000175000017500000000052013457657444016642 0ustar cheusovcheusov#!/bin/sh rm -f _log_file.txt env LC_ALL=C ./logtest _log_file.txt awk ' { sub(/Mon|Tue|Wed|Thu|Fri|Sat|Sun/, "Day") sub(/Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec/, "Mth") sub(/\[[0-9]+\]/, "[NNNNN]") gsub(/[0-9][0-9]/, "NN") gsub(/[0-9]/, "NN") $6 = "HOSTNAME" print }' _log_file.txt rm -f _log_file.txt libmaa-1.4.4/tests/log/Makefile0000644000175000017500000000022513457657444016264 0ustar cheusovcheusovPROG = logtest SRCS = logtest.c TEST_PROG = ${SRCDIR_log}/logtest.sh WARNS = 4 WARNERR = yes .include "../../mk/test.mk" .include libmaa-1.4.4/tests/list/0000755000175000017500000000000013457657444015017 5ustar cheusovcheusovlibmaa-1.4.4/tests/list/listtest.c0000644000175000017500000000442213457657444017040 0ustar cheusovcheusov/* listtest.c -- * Created: Wed Aug 9 11:36:09 1995 by faith@dict.org * Copyright 1995, 1996, 2002 Rickard E. Faith (faith@dict.org) * Copyright 2002-2008 Aleksey Cheusov (vle@gmx.net) * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ #include "maaP.h" static int print( const void *datum ) { printf( "%s ", (char*) __UNCONST(datum) ); return 0; } int main( int argc, char **argv ) { lst_List list = lst_create(); lst_Position p; char *e; long i; maa_init( argv[0] ); lst_append( list, "1" ); lst_iterate( list, print ); printf( "\n" ); lst_append( list, "2" ); lst_append( list, "3" ); lst_iterate( list, print ); printf( "\n" ); lst_push( list, "0" ); lst_iterate( list, print ); printf( "\n" ); printf( "Length = %d (expect 4)\n", lst_length( list ) ); LST_ITERATE(list,p,e) { printf( "%s ", e ); } printf( "\n" ); lst_pop( list ); lst_iterate( list, print ); printf( "\n" ); printf( "Length = %d (expect 3)\n", lst_length( list ) ); lst_truncate( list, 1 ); lst_iterate( list, print ); printf( "\n" ); printf( "Length = %d (expect 1)\n", lst_length( list ) ); for (i = 0; i < 10000; i++) lst_push( list, (void *)i ); lst_destroy( list ); return 0; } libmaa-1.4.4/tests/list/expect.out0000644000175000017500000000015013457657444017034 0ustar cheusovcheusov1 1 2 3 0 1 2 3 Length = 4 (expect 4) 0 1 2 3 1 2 3 Length = 3 (expect 3) 1 Length = 1 (expect 1) libmaa-1.4.4/tests/list/Makefile0000644000175000017500000000016113457657444016455 0ustar cheusovcheusovPROG = listtest SRCS = listtest.c WARNS = 4 WARNERR = yes .include "../../mk/test.mk" .include libmaa-1.4.4/tests/string/0000755000175000017500000000000013457657444015352 5ustar cheusovcheusovlibmaa-1.4.4/tests/string/expect.out0000644000175000017500000000004413457657444017371 0ustar cheusovcheusovRunning test for count of 100 Done. libmaa-1.4.4/tests/string/stringtest.c0000644000175000017500000000433213457657444017726 0ustar cheusovcheusov/* stringtest.c -- Test program for Khepera string table routines * Created: Thu Dec 22 14:05:57 1994 by faith@dict.org * Copyright 1994, 1996, 2002 Rickard E. Faith (faith@dict.org) * Copyright 2002-2008 Aleksey Cheusov (vle@gmx.net) * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ #include "maaP.h" #include int main( int argc, char **argv ) { int i; int count; const char **orig; char buf[100]; maa_init( argv[0] ); if (argc == 1) { count = 100; } else if (argc != 2 ) { fprintf( stderr, "usage: stringtest count\n" ); return 1; } else { count = atoi( argv[1] ); } orig = xmalloc( count * sizeof( const char ** ) ); printf( "Running test for count of %d\n", count ); for (i = 0; i < count; i++) { sprintf( buf, "key%d", i ); orig[i] = str_find( buf ); } for (i = 0; i < count; i++) { const char *this; sprintf( buf, "key%d", i ); this = str_find( buf ); if (orig[i] != this) printf( "Pointers are different for \"%s\" (\"%s\"): %p and %p\n", buf, this, orig[i], this ); } xfree( orig ); printf( "Done.\n" ); return 0; } libmaa-1.4.4/tests/string/Makefile0000644000175000017500000000016513457657444017014 0ustar cheusovcheusovPROG = stringtest SRCS = stringtest.c WARNS = 4 WARNERR = yes .include "../../mk/test.mk" .include libmaa-1.4.4/tests/memobj/0000755000175000017500000000000013457657444015315 5ustar cheusovcheusovlibmaa-1.4.4/tests/memobj/expect.out0000644000175000017500000000127313457657444017341 0ustar cheusovcheusovobj1=1 obj2=2 Statistics for object memory manager at 0xF00DBEAF 2 objects allocated, of which 2 are in use 0 objects have been reused Statistics for object memory manager at 0xF00DBEAF 2 objects allocated, of which 1 are in use 0 objects have been reused obj2_reused=22 Statistics for object memory manager at 0xF00DBEAF 2 objects allocated, of which 2 are in use 1 objects have been reused obj2_zeroed=0 Statistics for object memory manager at 0xF00DBEAF 2 objects allocated, of which 2 are in use 2 objects have been reused obj1=1 obj2=2 obj3=3 Statistics for object memory manager at 0xF00DBEAF 3 objects allocated, of which 3 are in use 2 objects have been reused libmaa-1.4.4/tests/memobj/memobjtest.c0000644000175000017500000000425713457657444017642 0ustar cheusovcheusov/* memtest.c -- * Copyright 2018 Aleksey Cheusov (vle@gmx.net) * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ #include #include #include #include "maa.h" int main(int argc, char** argv) { mem_Object objects = NULL; int *one; int *two; int *three; maa_init(argv[0]); objects = mem_create_objects(sizeof(int)); one = (int *) mem_get_object(objects); *one = 1; two = (int *) mem_get_object(objects); *two = 2; printf("obj1=%d\n", *one); printf("obj2=%d\n", *two); mem_print_object_stats(objects, stdout); mem_free_object(objects, two); mem_print_object_stats(objects, stdout); *two = 22; two = (int *) mem_get_object(objects); printf("obj2_reused=%d\n", *two); mem_print_object_stats(objects, stdout); mem_free_object(objects, two); two = (int *) mem_get_empty_object(objects); printf("obj2_zeroed=%d\n", *two); *two = 2; mem_print_object_stats(objects, stdout); three = (int *) mem_get_empty_object(objects); *three = 3; printf("obj1=%d\n", *one); printf("obj2=%d\n", *two); printf("obj3=%d\n", *three); mem_print_object_stats(objects, stdout); mem_destroy_objects(objects); maa_shutdown(); return 0; } libmaa-1.4.4/tests/memobj/Makefile0000644000175000017500000000016513457657444016757 0ustar cheusovcheusovPROG = memobjtest SRCS = memobjtest.c WARNS = 4 WARNERR = yes .include "../../mk/test.mk" .include libmaa-1.4.4/tests/set/0000755000175000017500000000000013457657444014637 5ustar cheusovcheusovlibmaa-1.4.4/tests/set/expect.out0000644000175000017500000002340613457657444016665 0ustar cheusovcheusovRunning test for count of 100 "key100" is not a member of the set key80 key71 key62 key53 key44 key9 key35 key26 key97 key17 key88 key79 key0 key50 key8 key41 key6 key32 key23 key94 key14 key85 key76 key67 key58 key49 key5 key31 key3 key22 key13 key20 key91 key11 key82 key73 key64 key55 key46 key37 key28 key99 key19 key2 key90 key10 key81 key72 key63 key70 key54 key61 key45 key52 key36 key43 key27 key34 key18 key25 key96 key16 key87 key78 key69 key60 key51 key42 key7 key33 key40 key24 key95 key15 key86 key93 key77 key84 key68 key75 key59 key66 key57 key48 key39 key4 key30 key21 key92 key12 key83 key74 key65 key56 key47 key38 key29 key98 key89 key1 item0 = GX0|b&y1d|98GmF%0<"~S'bRH0Y%$*()7 item33 = JU item34 = Dfm@ item35 = %glLm|ho{Yk%G,% item36 = sryaobPk~HImg85, item37 = hZ'Q* item38 = pd:v+F{X:mR{]5LH item39 = tq"\)7i4 item40 = C!KC9ioM`UO)6-hD4[G-Q& item42 = ^NGk9zJ item43 = 8K\eiK3I bS6p<[$x item44 = 2I item45 = B(Vi item46 = pd>C}jBYP,$cU$E);5Ew:=yLg"oo item47 = XcI=!m:l/t<J@nxJf[z`u!P item54 = hXL>(FGi(3dN^ item55 = ?uZ]@{L8F item56 = t@sjAD-* item57 = ZI$!pn)$RXcjxXEUxA"1g5&()pJM~T item58 = Y}NZn=drp=VZ5. item59 = 'Am9("?0+/[X-/"g-QA|n%o^C item60 = 9XT9C\Z0uc24t item61 = DOwR_z9mKZi item62 = `Yy$~2\SL item63 = '/$kB9 item64 = `]/W/oRI\}#F8d1h~DER item65 = DaxTfdwDW]S/lBa5_9Fw~F)gD item66 = -v?QX8&>|}>@U{te item67 = 7G~6&8]~6#(~GV+>u]w.d6*a item68 = K7P?|8VD6mKOJIeNRd item69 = (o4~M,,1B6swb*H!'aXKwFwGq@,? item70 = q5{`Jy.W%?y<3q~=9 EzYqr h9q item71 = F1|7 item72 = wxqq'HvFB3Z42w item73 = 2=Il.zDPQh\T%'1t|n> item81 = J+K'\ item98 = dZ8<%M\=8|: lookup0 = GX0|b&y1d|98GmF%0<"~S'bRH0Y%$*()7 lookup33 = JU lookup34 = Dfm@ lookup35 = %glLm|ho{Yk%G,% lookup36 = sryaobPk~HImg85, lookup37 = hZ'Q* lookup38 = pd:v+F{X:mR{]5LH lookup39 = tq"\)7i4 lookup40 = C!KC9ioM`UO)6-hD4[G-Q& lookup42 = ^NGk9zJ lookup43 = 8K\eiK3I bS6p<[$x lookup44 = 2I lookup45 = B(Vi lookup46 = pd>C}jBYP,$cU$E);5Ew:=yLg"oo lookup47 = XcI=!m:l/t<J@nxJf[z`u!P lookup54 = hXL>(FGi(3dN^ lookup55 = ?uZ]@{L8F lookup56 = t@sjAD-* lookup57 = ZI$!pn)$RXcjxXEUxA"1g5&()pJM~T lookup58 = Y}NZn=drp=VZ5. lookup59 = 'Am9("?0+/[X-/"g-QA|n%o^C lookup60 = 9XT9C\Z0uc24t lookup61 = DOwR_z9mKZi lookup62 = `Yy$~2\SL lookup63 = '/$kB9 lookup64 = `]/W/oRI\}#F8d1h~DER lookup65 = DaxTfdwDW]S/lBa5_9Fw~F)gD lookup66 = -v?QX8&>|}>@U{te lookup67 = 7G~6&8]~6#(~GV+>u]w.d6*a lookup68 = K7P?|8VD6mKOJIeNRd lookup69 = (o4~M,,1B6swb*H!'aXKwFwGq@,? lookup70 = q5{`Jy.W%?y<3q~=9 EzYqr h9q lookup71 = F1|7 lookup72 = wxqq'HvFB3Z42w lookup73 = 2=Il.zDPQh\T%'1t|n> lookup81 = J+K'\ lookup98 = dZ8<%M\=8|: int0 = 9136939 int1 = 6951572 int2 = 9797458 int3 = 2924202 int4 = 16134833 int5 = 11578460 int6 = 4908661 int7 = 9437436 int8 = 1835159 int9 = 13813621 int10 = 11994451 int11 = 14124016 int12 = 8071401 int13 = 7528608 int14 = 8945981 int15 = 1946409 int16 = 12509545 int17 = 6572894 int18 = 1141724 int19 = 5881069 int20 = 12401852 int21 = 11949136 int22 = 2162214 int23 = 11663235 int24 = 13364545 int25 = 7728542 int26 = 2852630 int27 = 10036785 int28 = 7557431 int29 = 11701118 int30 = 12139658 int31 = 16694370 int32 = 1875475 int33 = 5159900 int34 = 2841356 int35 = 1233092 int36 = 16738343 int37 = 7750017 int38 = 10670527 int39 = 1796303 int40 = 4786422 int41 = 5887763 int42 = 15920302 int43 = 12857823 int44 = 13416370 int45 = 8089068 int46 = 14804232 int47 = 9148717 int48 = 14661961 int49 = 15945938 int50 = 15029785 int51 = 10286598 int52 = 11117858 int53 = 414767 int54 = 5172617 int55 = 7705188 int56 = 8143308 int57 = 8025247 int58 = 964757 int59 = 15700739 int60 = 2949133 int61 = 13104415 int62 = 15617893 int63 = 4824607 int64 = 1487099 int65 = 1682034 int66 = 6057699 int67 = 1448226 int68 = 9432050 int69 = 16728226 int70 = 3244529 int71 = 14218472 int72 = 5838773 int73 = 2387633 int74 = 10299080 int75 = 2477928 int76 = 10476683 int77 = 8326096 int78 = 11626644 int79 = 8361429 int80 = 7494819 int81 = 9879213 int82 = 1870811 int83 = 1835478 int84 = 10293980 int85 = 7043428 int86 = 9540666 int87 = 1660072 int88 = 15068657 int89 = 10505423 int90 = 583596 int91 = 1240592 int92 = 6832639 int93 = 16201489 int94 = 6065199 int95 = 8319738 int96 = 1106290 int97 = 12122897 int98 = 9767964 int99 = 10538340 intlookup0 = 9136939 intlookup1 = 6951572 intlookup2 = 9797458 intlookup3 = 2924202 intlookup4 = 16134833 intlookup5 = 11578460 intlookup6 = 4908661 intlookup7 = 9437436 intlookup8 = 1835159 intlookup9 = 13813621 intlookup10 = 11994451 intlookup11 = 14124016 intlookup12 = 8071401 intlookup13 = 7528608 intlookup14 = 8945981 intlookup15 = 1946409 intlookup16 = 12509545 intlookup17 = 6572894 intlookup18 = 1141724 intlookup19 = 5881069 intlookup20 = 12401852 intlookup21 = 11949136 intlookup22 = 2162214 intlookup23 = 11663235 intlookup24 = 13364545 intlookup25 = 7728542 intlookup26 = 2852630 intlookup27 = 10036785 intlookup28 = 7557431 intlookup29 = 11701118 intlookup30 = 12139658 intlookup31 = 16694370 intlookup32 = 1875475 intlookup33 = 5159900 intlookup34 = 2841356 intlookup35 = 1233092 intlookup36 = 16738343 intlookup37 = 7750017 intlookup38 = 10670527 intlookup39 = 1796303 intlookup40 = 4786422 intlookup41 = 5887763 intlookup42 = 15920302 intlookup43 = 12857823 intlookup44 = 13416370 intlookup45 = 8089068 intlookup46 = 14804232 intlookup47 = 9148717 intlookup48 = 14661961 intlookup49 = 15945938 intlookup50 = 15029785 intlookup51 = 10286598 intlookup52 = 11117858 intlookup53 = 414767 intlookup54 = 5172617 intlookup55 = 7705188 intlookup56 = 8143308 intlookup57 = 8025247 intlookup58 = 964757 intlookup59 = 15700739 intlookup60 = 2949133 intlookup61 = 13104415 intlookup62 = 15617893 intlookup63 = 4824607 intlookup64 = 1487099 intlookup65 = 1682034 intlookup66 = 6057699 intlookup67 = 1448226 intlookup68 = 9432050 intlookup69 = 16728226 intlookup70 = 3244529 intlookup71 = 14218472 intlookup72 = 5838773 intlookup73 = 2387633 intlookup74 = 10299080 intlookup75 = 2477928 intlookup76 = 10476683 intlookup77 = 8326096 intlookup78 = 11626644 intlookup79 = 8361429 intlookup80 = 7494819 intlookup81 = 9879213 intlookup82 = 1870811 intlookup83 = 1835478 intlookup84 = 10293980 intlookup85 = 7043428 intlookup86 = 9540666 intlookup87 = 1660072 intlookup88 = 15068657 intlookup89 = 10505423 intlookup90 = 583596 intlookup91 = 1240592 intlookup92 = 6832639 intlookup93 = 16201489 intlookup94 = 6065199 intlookup95 = 8319738 intlookup96 = 1106290 intlookup97 = 12122897 intlookup98 = 9767964 intlookup99 = 10538340 Set 1: bar foo Set 1 (again): bar foo Set 2: bar t2-foo Set 1 == Set 2 ? ===> 0 Set 1 == Set 1 ? ===> 1 Union: foo bar t2-foo Intersection: bar Difference: foo libmaa-1.4.4/tests/set/settest.c0000644000175000017500000001151713457657444016503 0ustar cheusovcheusov/* settest.c -- Test program for Khepera set routines * Created: Wed Nov 9 15:04:25 1994 by faith@dict.org * Copyright 1994-1996, 2002 Rickard E. Faith (faith@dict.org) * Copyright 2002-2008 Aleksey Cheusov (vle@gmx.net) * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ #include "maaP.h" extern void init_rand( void ); extern int get_rand( int ll, int ul ); static int iterator( const void *key ) { printf( "%s\n", (char *) __UNCONST(key) ); return 0; } static int freer( const void *key ) { xfree( __UNCONST(key) ); return 0; } int main( int argc, char **argv ) { set_Set t; set_Set t1; set_Set t2; int i; int j; int count; set_Position p; const void *k; if (argc == 1) { count = 100; } else if (argc != 2 ) { fprintf( stderr, "usage: settest count\n" ); return 1; } else { count = atoi( argv[1] ); } printf( "Running test for count of %d\n", count ); /* Test sequential keys */ t = set_create( NULL, NULL ); for (i = 0; i < count; i++) { char *key = xmalloc( 20 ); sprintf( key, "key%d", i ); set_insert( t, key ); } for (i = count; i >= 0; i--) { char key[100]; sprintf( key, "key%d", i ); if (!set_member( t, key )) printf( "\"%s\" is not a member of the set\n", key ); } if (count <= 200) set_iterate( t, iterator ); /* set_print_stats( t, stdout );*/ set_iterate( t, freer ); set_destroy( t ); /* Test random keys */ t = set_create( NULL, NULL ); init_rand(); for (i = 0; i < count; i++) { int len = get_rand( 2, 32 ); char *key = xmalloc( len + 1 ); for (j = 0; j < len; j++) key[j] = get_rand( 32, 128 ); key[ len ] = '\0'; set_insert( t, key ); printf( "item%d = %s\n", i, key ); } init_rand(); for (i = 0; i < count; i++) { int len = get_rand( 2, 32 ); char *key = xmalloc( len + 1 ); for (j = 0; j < len; j++) key[j] = get_rand( 32, 128 ); key[ len ] = '\0'; printf( "lookup%d = %s\n", i, key ); if (!set_member( t, key )) printf( "\"%s\" is not a member of the set", key ); xfree( key ); } /* set_print_stats( t, stdout );*/ set_iterate( t, freer ); set_destroy( t ); /* Test (random) integer keys */ t = set_create( hsh_pointer_hash, hsh_pointer_compare ); init_rand(); for (i = 0; i < count; i++) { long key = get_rand( 1, 16777216 ); set_insert( t, (void *)key ); printf( "int%d = %ld\n", i, key ); } init_rand(); for (i = 0; i < count; i++) { long key = get_rand( 1, 16777216 ); printf( "intlookup%d = %ld\n", i, key ); if (!set_member( t, (void *)key )) printf( "%ld is not a member of the set", key ); } /* set_print_stats( t, stdout );*/ set_destroy( t ); /* Test set operations */ t1 = set_create( NULL, NULL ); t2 = set_create( NULL, NULL ); set_insert( t1, "foo" ); set_insert( t1, "bar" ); set_insert( t2, "t2-foo" ); set_insert( t2, "bar" ); printf( "\nSet 1:\n" ); set_iterate( t1, iterator ); printf( "\nSet 1 (again):\n" ); SET_ITERATE(t1,p,k) printf( "%s\n", (const char *)k ); printf( "\nSet 2:\n" ); set_iterate( t2, iterator ); printf( "Set 1 == Set 2 ? ===> %d\n", set_equal( t1, t2 ) ); printf( "Set 1 == Set 1 ? ===> %d\n", set_equal( t1, t1 ) ); printf( "\nUnion:\n"); t = set_union( t1, t2 ); set_iterate( t, iterator ); set_destroy( t ); printf( "\nIntersection:\n"); t = set_inter( t1, t2 ); set_iterate( t, iterator ); set_destroy( t ); printf( "\nDifference:\n"); t = set_diff( t1, t2 ); set_iterate( t, iterator ); set_destroy( t ); set_destroy( t1 ); set_destroy( t2 ); return 0; } libmaa-1.4.4/tests/set/Makefile0000644000175000017500000000023413457657444016276 0ustar cheusovcheusovPROG = settest SRCS = settest.c rnd.c .PATH: ../../maa MKC_FEATURES = libm WARNS = 4 WARNERR = yes .include "../../mk/test.mk" .include libmaa-1.4.4/tests/hash/0000755000175000017500000000000013457657444014767 5ustar cheusovcheusovlibmaa-1.4.4/tests/hash/expect.out0000644000175000017500000000301013457657444017002 0ustar cheusovcheusovRunning test for count of 100 Expected "datum100", got "(null)" key80: datum80 key71: datum71 key62: datum62 key53: datum53 key44: datum44 key9: datum9 key35: datum35 key26: datum26 key97: datum97 key17: datum17 key88: datum88 key79: datum79 key0: datum0 key50: datum50 key8: datum8 key41: datum41 key6: datum6 key32: datum32 key23: datum23 key94: datum94 key14: datum14 key85: datum85 key76: datum76 key67: datum67 key58: datum58 key49: datum49 key5: datum5 key31: datum31 key3: datum3 key22: datum22 key13: datum13 key20: datum20 key91: datum91 key11: datum11 key82: datum82 key73: datum73 key64: datum64 key55: datum55 key46: datum46 key37: datum37 key28: datum28 key99: datum99 key19: datum19 key2: datum2 key90: datum90 key10: datum10 key81: datum81 key72: datum72 key63: datum63 key70: datum70 key54: datum54 key61: datum61 key45: datum45 key52: datum52 key36: datum36 key43: datum43 key27: datum27 key34: datum34 key18: datum18 key25: datum25 key96: datum96 key16: datum16 key87: datum87 key78: datum78 key69: datum69 key60: datum60 key51: datum51 key42: datum42 key7: datum7 key33: datum33 key40: datum40 key24: datum24 key95: datum95 key15: datum15 key86: datum86 key93: datum93 key77: datum77 key84: datum84 key68: datum68 key75: datum75 key59: datum59 key66: datum66 key57: datum57 key48: datum48 key39: datum39 key4: datum4 key30: datum30 key21: datum21 key92: datum92 key12: datum12 key83: datum83 key74: datum74 key65: datum65 key56: datum56 key47: datum47 key38: datum38 key29: datum29 key98: datum98 key89: datum89 key1: datum1 libmaa-1.4.4/tests/hash/hashtest.c0000644000175000017500000001113113457657444016753 0ustar cheusovcheusov/* hashtest.c -- Test program for Khepera hash table routines * Created: Sun Nov 6 18:55:23 1994 by faith@dict.org * Copyright 1994, 1995, 2002 Rickard E. Faith (faith@dict.org) * Copyright 2002-2008 Aleksey Cheusov (vle@gmx.net) * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ #include "maaP.h" extern void init_rand( void ); extern int get_rand( int ll, int ul ); static int iterator( const void *key, const void *datum ) { printf( "%s: %s\n", (const char *)key, (const char *)datum ); return 0; } static int freer( const void *key, const void *datum ) { xfree( __UNCONST(datum) ); xfree( __UNCONST(key) ); return 0; } static int free_data( const void *key, const void *datum ) { xfree( __UNCONST(datum) ); return 0; } int main( int argc, char **argv ) { hsh_HashTable t; int i; int j; int count; if (argc == 1) { count = 100; } else if (argc != 2 ) { fprintf( stderr, "usage: hashtest count\n" ); return 1; } else { count = atoi( argv[1] ); } printf( "Running test for count of %d\n", count ); /* Test sequential keys */ t = hsh_create( NULL, NULL ); for (i = 0; i < count; i++) { char *key = xmalloc( 20 ); char *datum = xmalloc( 20 ); sprintf( key, "key%d", i ); sprintf( datum, "datum%d", i ); hsh_insert( t, key, datum ); } for (i = count; i >= 0; i--) { char key[100]; char datum[100]; const char *pt; sprintf( key, "key%d", i ); sprintf( datum, "datum%d", i ); pt = hsh_retrieve( t, key ); if (!pt || strcmp( pt, datum )) { printf( "Expected \"%s\", got \"%s\"\n", datum, pt ? pt : "(null)" ); } } if (count <= 200) hsh_iterate( t, iterator ); /* hsh_print_stats( t, stdout );*/ hsh_iterate( t, freer ); hsh_destroy( t ); /* Test random keys */ t = hsh_create( NULL, NULL ); init_rand(); for (i = 0; i < count; i++) { int len = get_rand( 2, 32 ); char *key = xmalloc( len + 1 ); char *datum = xmalloc( 20 ); for (j = 0; j < len; j++) key[j] = get_rand( 32, 128 ); key[ len ] = '\0'; sprintf( datum, "datum%d", i ); hsh_insert( t, key, datum ); } init_rand(); for (i = 0; i < count; i++) { int len = get_rand( 2, 32 ); char *key = xmalloc( len + 1 ); char datum[100]; const char *pt; for (j = 0; j < len; j++) key[j] = get_rand( 32, 128 ); key[ len ] = '\0'; sprintf( datum, "datum%d", i ); pt = hsh_retrieve( t, key ); if (!pt || strcmp( pt, datum )) printf( "Expected \"%s\", got \"%s\" for key \"%s\"\n", datum, pt, key ); xfree( key ); } /* hsh_print_stats( t, stdout );*/ hsh_iterate( t, freer ); hsh_destroy( t ); /* Test (random) integer keys */ t = hsh_create( hsh_pointer_hash, hsh_pointer_compare ); init_rand(); for (i = 0; i < count; i++) { long key = get_rand( 1, 16777216 ); char *datum = xmalloc( 20 ); sprintf( datum, "datum%d", i ); hsh_insert( t, (void *)key, datum ); } init_rand(); for (i = 0; i < count; i++) { long key = get_rand( 1, 16777216 ); char datum[100]; const char *pt; sprintf( datum, "datum%d", i ); pt = hsh_retrieve( t, (void *)key ); if (!pt || strcmp( pt, datum )) printf( "Expected \"%s\", got \"%s\" for key %ld\n", datum, pt, key ); } /* hsh_print_stats( t, stdout );*/ hsh_iterate( t, free_data ); hsh_destroy( t ); return 0; } libmaa-1.4.4/tests/hash/Makefile0000644000175000017500000000025113457657444016425 0ustar cheusovcheusovPROG = hashtest SRCS = hashtest.c rnd.c .PATH: ${.CURDIR}/../../maa MKC_FEATURES = libm WARNS = 4 WARNERR = yes .include "../../mk/test.mk" .include libmaa-1.4.4/tests/memstr/0000755000175000017500000000000013457657444015353 5ustar cheusovcheusovlibmaa-1.4.4/tests/memstr/expect.out0000644000175000017500000000074313457657444017400 0ustar cheusovcheusovStatistics for string memory manager at 0xF00DBEAF 0 strings, using 0 bytes str1=Peter Hammill Statistics for string memory manager at 0xF00DBEAF 1 strings, using 14 bytes str2=King Crimson Statistics for string memory manager at 0xF00DBEAF 2 strings, using 27 bytes str3=Van Der Graaf Generator Statistics for string memory manager at 0xF00DBEAF 3 strings, using 51 bytes str4=Led Zeppelin Statistics for string memory manager at 0xF00DBEAF 4 strings, using 64 bytes libmaa-1.4.4/tests/memstr/memstrtest.c0000644000175000017500000000435313457657444017733 0ustar cheusovcheusov/* memtest.c -- * Created: Sat Jul 1 22:42:09 1995 by faith@dict.org * Copyright 1995, 2002 Rickard E. Faith (faith@dict.org) * Copyright 2002-2008 Aleksey Cheusov (vle@gmx.net) * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ #include #include #include #include "maa.h" static char const *names [] = { "Peter Hammill", "King Crimson", "Van ", "Der ", "Graaf ", "Generator", "Led Zeppelin" }; int main(int argc, char** argv) { mem_String strings = NULL; maa_init(argv[0]); strings = mem_create_strings(); mem_print_string_stats(strings, stdout); printf("str1=%s\n", mem_strcpy(strings, names[0])); mem_print_string_stats(strings, stdout); printf("str2=%s\n", mem_strcpy(strings, names[1])); mem_print_string_stats(strings, stdout); mem_grow(strings, names[2], strlen(names[2])); mem_grow(strings, names[3], strlen(names[3])); mem_grow(strings, names[4], strlen(names[4])); mem_grow(strings, names[5], strlen(names[5])); printf("str3=%s\n", mem_finish(strings)); mem_print_string_stats(strings, stdout); printf("str4=%s\n", mem_strncpy(strings, names[6], strlen(names[6]))); mem_print_string_stats(strings, stdout); mem_destroy_strings(strings); maa_shutdown(); return 0; } libmaa-1.4.4/tests/memstr/Makefile0000644000175000017500000000016513457657444017015 0ustar cheusovcheusovPROG = memstrtest SRCS = memstrtest.c WARNS = 4 WARNERR = yes .include "../../mk/test.mk" .include libmaa-1.4.4/README0000644000175000017500000000123013457657444013556 0ustar cheusovcheusovThis library implements some basic data structures and algorithms such as command line arguments handling, base26 and base64 routines, bits manipulation, debugging and error reporting routines, hash tables, sets, lists, stacks, skip lists, string pool routines, memory management routines, parsing routines, process management routines, source code management routines and timer support. Development of this software at the University of North Carolina, Chapel Hill was supported by ARPA via ONR contract N00014-92-C-0182, by Rome Labs contract F30602-94-C-0037, and by a Cray Fellowship from Cray Research, Inc. and NCSC (North Carolina Supercomputing Center). libmaa-1.4.4/maa/0000755000175000017500000000000013457657444013440 5ustar cheusovcheusovlibmaa-1.4.4/maa/timer.c0000644000175000017500000001676113457657444014737 0ustar cheusovcheusov/* timer.c -- Timer support * Created: Sat Oct 7 13:05:31 1995 by faith@dict.org * Copyright 1995-1998, 2002 Rickard E. Faith (faith@dict.org) * Copyright 2002-2008 Aleksey Cheusov (vle@gmx.net) * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * \section{Timer Support} * * \intro These routines provide access to a microsecond-resolution time * that can be used for profiling. * */ #include "maaP.h" static hsh_HashTable _tim_Hash; typedef struct tim_Entry { double real; /* wall time in sec */ double self_user; /* user time in sec */ double self_system; /* system time in sec */ double children_user; /* user time in sec */ double children_system; /* system time in sec */ struct timeval real_mark; struct rusage self_mark; struct rusage children_mark; } *tim_Entry; static void _tim_check( void ) { if (!_tim_Hash) _tim_Hash = hsh_create( NULL, NULL ); } /* \doc Start the named timer. */ void tim_start( const char *name ) { tim_Entry entry; _tim_check(); if (!(entry = (tim_Entry)__UNCONST(hsh_retrieve( _tim_Hash, name )))) { entry = xmalloc( sizeof( struct tim_Entry ) ); entry->real = 0.0; entry->self_user = 0.0; entry->self_system = 0.0; entry->children_user = 0.0; entry->children_system = 0.0; hsh_insert( _tim_Hash, name, entry ); } gettimeofday( &entry->real_mark, NULL ); getrusage( RUSAGE_SELF, &entry->self_mark ); getrusage( RUSAGE_CHILDREN, &entry->children_mark ); } /* \doc Stop the named timer. */ void tim_stop( const char *name ) { tim_Entry entry; struct timeval real; struct rusage rusage; #define DIFFTIME(now,then)\ (((now).tv_sec - (then).tv_sec) \ + ((now).tv_usec - (then).tv_usec)/1000000) _tim_check(); gettimeofday( &real, NULL ); if (!(entry = (tim_Entry)__UNCONST(hsh_retrieve( _tim_Hash, name )) )) err_internal ( __func__, "No timer: %s\n", (name ? name : "") ); entry->real = DIFFTIME( real, entry->real_mark ); getrusage( RUSAGE_SELF, &rusage ); entry->self_user = DIFFTIME( rusage.ru_utime, entry->self_mark.ru_utime ); entry->self_system = DIFFTIME( rusage.ru_stime, entry->self_mark.ru_stime ); getrusage( RUSAGE_CHILDREN, &rusage ); entry->children_user = DIFFTIME( rusage.ru_utime, entry->children_mark.ru_utime ); entry->children_system = DIFFTIME( rusage.ru_stime, entry->children_mark.ru_stime ); } /* \doc Reset the named timer to zero elapsed time. Use |tim_start| to reset the start time. */ void tim_reset( const char *name ) { tim_Entry entry; _tim_check(); if (!(entry = (tim_Entry)__UNCONST(hsh_retrieve( _tim_Hash, name )) )) err_internal ( __func__, "No timer: %s\n", (name ? name : "") ); entry->real = 0.0; entry->self_user = 0.0; entry->self_system = 0.0; entry->children_user = 0.0; entry->children_system = 0.0; } /* \doc Get the wall time in seconds from the named timer. The return value is a |double| and has microsecond resolution if the current system provides that accuracy (most don't). */ double tim_get_real( const char *name ) { tim_Entry entry; _tim_check(); if (!(entry = (tim_Entry)__UNCONST(hsh_retrieve( _tim_Hash, name )) )) err_internal ( __func__, "No timer: %s\n", (name ? name : "") ); return entry->real; } /* \doc Get the number of seconds of user CPU time. */ double tim_get_user( const char *name ) { tim_Entry entry; _tim_check(); if (!(entry = (tim_Entry)__UNCONST(hsh_retrieve( _tim_Hash, name )) )) err_internal ( __func__, "No timer: %s\n", (name ? name : "") ); #if 0 printf( "self: maxrss %ld ixrss %ld idrss %ld isrss %ld minflt %ld" " majflt %ld nswap %ld inblock %ld outblock %ld msgsnd %ld" " msgrcv %ld nsignals %ld nvcwm %ld nivcsm %ld\n", entry->self_mark.ru_maxrss, entry->self_mark.ru_ixrss, entry->self_mark.ru_idrss, entry->self_mark.ru_isrss, entry->self_mark.ru_minflt, entry->self_mark.ru_majflt, entry->self_mark.ru_nswap, entry->self_mark.ru_inblock, entry->self_mark.ru_oublock, entry->self_mark.ru_msgsnd, entry->self_mark.ru_msgrcv, entry->self_mark.ru_nsignals, entry->self_mark.ru_nvcsw, entry->self_mark.ru_nivcsw ); printf( "chld: maxrss %ld ixrss %ld idrss %ld isrss %ld minflt %ld" " majflt %ld nswap %ld inblock %ld outblock %ld msgsnd %ld" " msgrcv %ld nsignals %ld nvcwm %ld nivcsm %ld\n", entry->children_mark.ru_maxrss, entry->children_mark.ru_ixrss, entry->children_mark.ru_idrss, entry->children_mark.ru_isrss, entry->children_mark.ru_minflt, entry->children_mark.ru_majflt, entry->children_mark.ru_nswap, entry->children_mark.ru_inblock, entry->children_mark.ru_oublock, entry->children_mark.ru_msgsnd, entry->children_mark.ru_msgrcv, entry->children_mark.ru_nsignals, entry->children_mark.ru_nvcsw, entry->children_mark.ru_nivcsw ); #endif return (entry->self_user + entry->children_user); } /* \doc Get the number of seconds of system CPU time. */ double tim_get_system( const char *name ) { tim_Entry entry; _tim_check(); if (!(entry = (tim_Entry)__UNCONST(hsh_retrieve( _tim_Hash, name )) )) err_internal ( __func__, "No timer: %s\n", (name ? name : "") ); return (entry->self_system + entry->children_system); } /* \doc Print the named timer values to |str|. The format is similar to "time(1)". */ void tim_print_timer( FILE *str, const char *name ) { fprintf( str, "%-20s %0.3fr %0.3fu %0.3fs\n", name, tim_get_real( name ), tim_get_user( name ), tim_get_system( name ) ); } static int _tim_iterator( const void *key, const void *datum, void *arg ) { FILE *str = (FILE *)arg; tim_print_timer( str, key ); return 0; } /* \doc Print all the timers to |str|. The order is arbitary. */ void tim_print_timers( FILE *str ) { if (_tim_Hash) hsh_iterate_arg( _tim_Hash, _tim_iterator, str ); } static int _tim_freer( const void *key, const void *datum ) { xfree( __UNCONST(datum) ); /* Discard const */ return 0; } /* \doc Free all memory associated with the timers. This function is called automatically at program termination. There should never be a need to call this function in user-level code. */ void _tim_shutdown( void ) { if (_tim_Hash) { hsh_iterate( _tim_Hash, _tim_freer ); hsh_destroy( _tim_Hash ); } _tim_Hash = NULL; } libmaa-1.4.4/maa/mkrnd.c0000644000175000017500000000310513457657444014716 0ustar cheusovcheusov/* mkrnd.c -- * Created: Wed Sep 25 09:55:23 1996 by faith@dict.org * Copyright 1996, 2002 Rickard E. Faith (faith@dict.org) * Copyright 2002-2008 Aleksey Cheusov (vle@gmx.net) * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ #include "maaP.h" int main( int argc, char **argv ) { int count; int i; if (argc != 2) { fprintf( stderr, "Usage: mkrnd \n" ); exit( 1 ); } count = atoi( argv[1] ); for (i = 0; i < count; i++) { printf( "%f, ", (double)random()/(double)INT_MAX); } printf( "\n" ); return 0; } libmaa-1.4.4/maa/alloca.c0000644000175000017500000003340513457657444015044 0ustar cheusovcheusov/* alloca.c -- allocate automatically reclaimed memory (Mostly) portable public-domain implementation -- D A Gwyn This implementation of the PWB library alloca function, which is used to allocate space off the run-time stack so that it is automatically reclaimed upon procedure exit, was inspired by discussions with J. Q. Johnson of Cornell. J.Otto Tennant contributed the Cray support. There are some preprocessor constants that can be defined when compiling for your specific system, for improved efficiency; however, the defaults should be okay. The general concept of this implementation is to keep track of all alloca-allocated blocks, and reclaim any that are found to be deeper in the stack than the current invocation. This heuristic does not reclaim storage as soon as it becomes invalid, but it will do so eventually. As a special case, alloca(0) reclaims storage without allocating any. It is a good idea to use alloca(0) in your main control loop, etc. to force garbage collection. */ #ifdef HAVE_CONFIG_H #include #endif #ifdef emacs #include "blockinput.h" #endif /* If compiling with GCC 2, this file's not needed. */ #if !defined (__GNUC__) || __GNUC__ < 2 /* If someone has defined alloca as a macro, there must be some other way alloca is supposed to work. */ #ifndef alloca #ifdef emacs #ifdef static /* actually, only want this if static is defined as "" -- this is for usg, in which emacs must undefine static in order to make unexec workable */ #ifndef STACK_DIRECTION you lose -- must know STACK_DIRECTION at compile-time #endif /* STACK_DIRECTION undefined */ #endif /* static */ #endif /* emacs */ /* If your stack is a linked list of frames, you have to provide an "address metric" ADDRESS_FUNCTION macro. */ #if defined (CRAY) && defined (CRAY_STACKSEG_END) long i00afunc (); #define ADDRESS_FUNCTION(arg) (char *) i00afunc (&(arg)) #else #define ADDRESS_FUNCTION(arg) &(arg) #endif #if __STDC__ typedef void *pointer; #else typedef char *pointer; #endif #define NULL 0 /* Different portions of Emacs need to call different versions of malloc. The Emacs executable needs alloca to call xmalloc, because ordinary malloc isn't protected from input signals. On the other hand, the utilities in lib-src need alloca to call malloc; some of them are very simple, and don't have an xmalloc routine. Non-Emacs programs expect this to call use xmalloc. Callers below should use malloc. */ #ifndef emacs #define malloc xmalloc #endif extern pointer malloc (); /* Define STACK_DIRECTION if you know the direction of stack growth for your system; otherwise it will be automatically deduced at run-time. STACK_DIRECTION > 0 => grows toward higher addresses STACK_DIRECTION < 0 => grows toward lower addresses STACK_DIRECTION = 0 => direction of growth unknown */ #ifndef STACK_DIRECTION #define STACK_DIRECTION 0 /* Direction unknown. */ #endif #if STACK_DIRECTION != 0 #define STACK_DIR STACK_DIRECTION /* Known at compile-time. */ #else /* STACK_DIRECTION == 0; need run-time code. */ static int stack_dir; /* 1 or -1 once known. */ #define STACK_DIR stack_dir static void find_stack_direction () { static char *addr = NULL; /* Address of first `dummy', once known. */ auto char dummy; /* To get stack address. */ if (addr == NULL) { /* Initial entry. */ addr = ADDRESS_FUNCTION (dummy); find_stack_direction (); /* Recurse once. */ } else { /* Second entry. */ if (ADDRESS_FUNCTION (dummy) > addr) stack_dir = 1; /* Stack grew upward. */ else stack_dir = -1; /* Stack grew downward. */ } } #endif /* STACK_DIRECTION == 0 */ /* An "alloca header" is used to: (a) chain together all alloca'ed blocks; (b) keep track of stack depth. It is very important that sizeof(header) agree with malloc alignment chunk size. The following default should work okay. */ #ifndef ALIGN_SIZE #define ALIGN_SIZE sizeof(double) #endif typedef union hdr { char align[ALIGN_SIZE]; /* To force sizeof(header). */ struct { union hdr *next; /* For chaining headers. */ char *deep; /* For stack depth measure. */ } h; } header; static header *last_alloca_header = NULL; /* -> last alloca header. */ /* Return a pointer to at least SIZE bytes of storage, which will be automatically reclaimed upon exit from the procedure that called alloca. Originally, this space was supposed to be taken from the current stack frame of the caller, but that method cannot be made to work for some implementations of C, for example under Gould's UTX/32. */ pointer alloca (size) unsigned size; { auto char probe; /* Probes stack depth: */ register char *depth = ADDRESS_FUNCTION (probe); #if STACK_DIRECTION == 0 if (STACK_DIR == 0) /* Unknown growth direction. */ find_stack_direction (); #endif /* Reclaim garbage, defined as all alloca'd storage that was allocated from deeper in the stack than currently. */ { register header *hp; /* Traverses linked list. */ #ifdef emacs BLOCK_INPUT; #endif for (hp = last_alloca_header; hp != NULL;) if ((STACK_DIR > 0 && hp->h.deep > depth) || (STACK_DIR < 0 && hp->h.deep < depth)) { register header *np = hp->h.next; free ((pointer) hp); /* Collect garbage. */ hp = np; /* -> next header. */ } else break; /* Rest are not deeper. */ last_alloca_header = hp; /* -> last valid storage. */ #ifdef emacs UNBLOCK_INPUT; #endif } if (size == 0) return NULL; /* No allocation required. */ /* Allocate combined header + user data storage. */ { register pointer new = malloc (sizeof (header) + size); /* Address of header. */ ((header *) new)->h.next = last_alloca_header; ((header *) new)->h.deep = depth; last_alloca_header = (header *) new; /* User storage begins just after header. */ return (pointer) ((char *) new + sizeof (header)); } } #if defined (CRAY) && defined (CRAY_STACKSEG_END) #ifdef DEBUG_I00AFUNC #include #endif #ifndef CRAY_STACK #define CRAY_STACK #ifndef CRAY2 /* Stack structures for CRAY-1, CRAY X-MP, and CRAY Y-MP */ struct stack_control_header { long shgrow:32; /* Number of times stack has grown. */ long shaseg:32; /* Size of increments to stack. */ long shhwm:32; /* High water mark of stack. */ long shsize:32; /* Current size of stack (all segments). */ }; /* The stack segment linkage control information occurs at the high-address end of a stack segment. (The stack grows from low addresses to high addresses.) The initial part of the stack segment linkage control information is 0200 (octal) words. This provides for register storage for the routine which overflows the stack. */ struct stack_segment_linkage { long ss[0200]; /* 0200 overflow words. */ long sssize:32; /* Number of words in this segment. */ long ssbase:32; /* Offset to stack base. */ long:32; long sspseg:32; /* Offset to linkage control of previous segment of stack. */ long:32; long sstcpt:32; /* Pointer to task common address block. */ long sscsnm; /* Private control structure number for microtasking. */ long ssusr1; /* Reserved for user. */ long ssusr2; /* Reserved for user. */ long sstpid; /* Process ID for pid based multi-tasking. */ long ssgvup; /* Pointer to multitasking thread giveup. */ long sscray[7]; /* Reserved for Cray Research. */ long ssa0; long ssa1; long ssa2; long ssa3; long ssa4; long ssa5; long ssa6; long ssa7; long sss0; long sss1; long sss2; long sss3; long sss4; long sss5; long sss6; long sss7; }; #else /* CRAY2 */ /* The following structure defines the vector of words returned by the STKSTAT library routine. */ struct stk_stat { long now; /* Current total stack size. */ long maxc; /* Amount of contiguous space which would be required to satisfy the maximum stack demand to date. */ long high_water; /* Stack high-water mark. */ long overflows; /* Number of stack overflow ($STKOFEN) calls. */ long hits; /* Number of internal buffer hits. */ long extends; /* Number of block extensions. */ long stko_mallocs; /* Block allocations by $STKOFEN. */ long underflows; /* Number of stack underflow calls ($STKRETN). */ long stko_free; /* Number of deallocations by $STKRETN. */ long stkm_free; /* Number of deallocations by $STKMRET. */ long segments; /* Current number of stack segments. */ long maxs; /* Maximum number of stack segments so far. */ long pad_size; /* Stack pad size. */ long current_address; /* Current stack segment address. */ long current_size; /* Current stack segment size. This number is actually corrupted by STKSTAT to include the fifteen word trailer area. */ long initial_address; /* Address of initial segment. */ long initial_size; /* Size of initial segment. */ }; /* The following structure describes the data structure which trails any stack segment. I think that the description in 'asdef' is out of date. I only describe the parts that I am sure about. */ struct stk_trailer { long this_address; /* Address of this block. */ long this_size; /* Size of this block (does not include this trailer). */ long unknown2; long unknown3; long link; /* Address of trailer block of previous segment. */ long unknown5; long unknown6; long unknown7; long unknown8; long unknown9; long unknown10; long unknown11; long unknown12; long unknown13; long unknown14; }; #endif /* CRAY2 */ #endif /* not CRAY_STACK */ #ifdef CRAY2 /* Determine a "stack measure" for an arbitrary ADDRESS. I doubt that "lint" will like this much. */ static long i00afunc (long *address) { struct stk_stat status; struct stk_trailer *trailer; long *block, size; long result = 0; /* We want to iterate through all of the segments. The first step is to get the stack status structure. We could do this more quickly and more directly, perhaps, by referencing the $LM00 common block, but I know that this works. */ STKSTAT (&status); /* Set up the iteration. */ trailer = (struct stk_trailer *) (status.current_address + status.current_size - 15); /* There must be at least one stack segment. Therefore it is a fatal error if "trailer" is null. */ if (trailer == 0) abort (); /* Discard segments that do not contain our argument address. */ while (trailer != 0) { block = (long *) trailer->this_address; size = trailer->this_size; if (block == 0 || size == 0) abort (); trailer = (struct stk_trailer *) trailer->link; if ((block <= address) && (address < (block + size))) break; } /* Set the result to the offset in this segment and add the sizes of all predecessor segments. */ result = address - block; if (trailer == 0) { return result; } do { if (trailer->this_size <= 0) abort (); result += trailer->this_size; trailer = (struct stk_trailer *) trailer->link; } while (trailer != 0); /* We are done. Note that if you present a bogus address (one not in any segment), you will get a different number back, formed from subtracting the address of the first block. This is probably not what you want. */ return (result); } #else /* not CRAY2 */ /* Stack address function for a CRAY-1, CRAY X-MP, or CRAY Y-MP. Determine the number of the cell within the stack, given the address of the cell. The purpose of this routine is to linearize, in some sense, stack addresses for alloca. */ static long i00afunc (long address) { long stkl = 0; long size, pseg, this_segment, stack; long result = 0; struct stack_segment_linkage *ssptr; /* Register B67 contains the address of the end of the current stack segment. If you (as a subprogram) store your registers on the stack and find that you are past the contents of B67, you have overflowed the segment. B67 also points to the stack segment linkage control area, which is what we are really interested in. */ stkl = CRAY_STACKSEG_END (); ssptr = (struct stack_segment_linkage *) stkl; /* If one subtracts 'size' from the end of the segment, one has the address of the first word of the segment. If this is not the first segment, 'pseg' will be nonzero. */ pseg = ssptr->sspseg; size = ssptr->sssize; this_segment = stkl - size; /* It is possible that calling this routine itself caused a stack overflow. Discard stack segments which do not contain the target address. */ while (!(this_segment <= address && address <= stkl)) { #ifdef DEBUG_I00AFUNC fprintf (stderr, "%011o %011o %011o\n", this_segment, address, stkl); #endif if (pseg == 0) break; stkl = stkl - pseg; ssptr = (struct stack_segment_linkage *) stkl; size = ssptr->sssize; pseg = ssptr->sspseg; this_segment = stkl - size; } result = address - this_segment; /* If you subtract pseg from the current end of the stack, you get the address of the previous stack segment's end. This seems a little convoluted to me, but I'll bet you save a cycle somewhere. */ while (pseg != 0) { #ifdef DEBUG_I00AFUNC fprintf (stderr, "%011o %011o\n", pseg, size); #endif stkl = stkl - pseg; ssptr = (struct stack_segment_linkage *) stkl; size = ssptr->sssize; pseg = ssptr->sspseg; result += size; } return (result); } #endif /* not CRAY2 */ #endif /* CRAY */ #endif /* no alloca */ #endif /* not GCC version 2 */ libmaa-1.4.4/maa/list.c0000644000175000017500000002761013457657444014565 0ustar cheusovcheusov/* list.c -- List routines for Khepera * Created: Wed Nov 9 19:40:00 1994 by faith@dict.org as stack.c * Copyright 1994-1997, 2002 Rickard E. Faith (faith@dict.org) * Copyright 2002-2008 Aleksey Cheusov (vle@gmx.net) * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * \section{List Routines} * * \intro The list routines provide support for a general linked list * containting objects that are pointers to "void". The list can be viewed * as a stack or queue -- data can be added to the head or the tail, but * can only be removed from the head (this data structure is sometimes * called a ``qstack''). (If only a stack is needed, the stack routines are * more efficient.) * */ #include "maaP.h" typedef struct data { const void *datum; struct data *next; } *dataType; typedef struct list { #if MAA_MAGIC int magic; #endif struct data *head; struct data *tail; unsigned int count; } *listType; static mem_Object mem; static long int _lst_allocated; static void _lst_check( listType l, const char *function ) { if (!l) err_internal( function, "list is null\n" ); #if MAA_MAGIC if (l->magic != LST_MAGIC) err_internal( function, "Incorrect magic: 0x%08x (should be 0x%08x)\n", l->magic, LST_MAGIC ); #endif } long int lst_total_allocated( void ) { return _lst_allocated; } /* \doc |lst_create| initializes a list object. */ lst_List lst_create( void ) { listType l = xmalloc( sizeof( struct list ) ); _lst_allocated += sizeof(struct list); #if MAA_MAGIC l->magic = LST_MAGIC; #endif l->head = NULL; l->tail = NULL; l->count = 0; if (!mem) mem = mem_create_objects( sizeof( struct data ) ); return l; } void _lst_shutdown( void ) { if (mem) mem_destroy_objects( mem ); mem = NULL; } /* \doc |lst_destroy| destroys all memory associated with the |list|. The memory used by data is \emph{not} freed---this memory is the responsibility of the user. */ void lst_destroy( lst_List list ) { listType l = (listType)list; dataType d; _lst_check( l, __func__ ); for (d = l->head; d;) { dataType next = d->next; mem_free_object( mem, d ); d = next; } #if MAA_MAGIC l->magic = LST_MAGIC_FREED; #endif xfree( list ); } /* \doc |lst_append| appends |datum| on the |list|. */ void lst_append( lst_List list, const void *datum ) { listType l; dataType d; if (!list) return; l = (listType)list; d = mem_get_object( mem ); _lst_allocated += sizeof(struct data); _lst_check( l, __func__ ); d->datum = datum; d->next = NULL; if (l->tail) { assert( l->tail->next == NULL ); l->tail->next = d; } l->tail = d; if (!l->head) l->head = d; ++l->count; } /* \doc |lst_push| prepends |datum| on the |list|. */ void lst_push( lst_List list, const void *datum ) { listType l = (listType)list; dataType d = mem_get_object( mem ); _lst_allocated += sizeof(struct data); _lst_check( l, __func__ ); d->datum = datum; d->next = l->head; l->head = d; if (!l->tail) l->tail = d; ++l->count; } /* \doc |lst_pop| removes the first datum on the |list| and returns the pointer. If the |list| is empty, |lst_pop| returns "NULL". */ void *lst_pop( lst_List list ) { listType l = (listType)list; void *datum = NULL; _lst_check( l, __func__ ); if (l->head) { dataType old = l->head; datum = __UNCONST(old->datum); /* Discard const */ l->head = l->head->next; if (!l->head) l->tail = NULL; --l->count; mem_free_object( mem, old ); } return datum; } /* \doc |lst_top| returns a pointer to the datum that is the first element of the |list|, but does \emph{not} remove this datum from the |list|. If the |list| is empty, |lst_top| returns "NULL". */ void *lst_top( lst_List list ) { listType l = (listType)list; _lst_check( l, __func__ ); if (l->head) return __UNCONST(l->head->datum); /* Discard const */ return NULL; } /* \doc |lst_nth_get| returns a pointer to the $n$-th datum in the |list|, or "NULL" if the $n$th element does not exist. */ void *lst_nth_get( lst_List list, unsigned int n ) { listType l = (listType)list; dataType d; unsigned int i; _lst_check( l, __func__ ); if (n < 1 || n > l->count) return NULL; for (i = 1, d = l->head; i < n && d; i++, d = d->next); if (i != n) err_internal( __func__, "Can't find element %d of %d\n", n, l->count ); return __UNCONST(d->datum); /* Discard const. */ } /* \doc |lst_nth_set| locates the $n$-th datum in the |list| and replaces that datum with |datum|. If the $n$th element does not exist, the program will halt with an error. (I.e., it is the programmer's responsibility to check |lst_length| and only pass valid values of |n|.) */ void lst_nth_set( lst_List list, unsigned int n, const void *datum ) { listType l = (listType)list; dataType d; unsigned int i; _lst_check( l, __func__ ); if (n < 1 || n > l->count) err_fatal( __func__, "Attempt to change element %d of %d elements\n", n, l->count ); for (i = 1, d = l->head; i < n && d; i++, d = d->next); if (i != n) err_internal( __func__, "Can't find element %d of %d\n", n, l->count ); d->datum = datum; } /* \doc |lst_member| returns non-zero if the pointer to |datum| is also a pointer on the list, and zero otherwise. Note that only pointers are compared, so identical copies of data structures will be viewed as non-equal. */ int lst_member( lst_List list, const void *datum ) { listType l = (listType)list; dataType d; _lst_check( l, __func__ ); for (d = l->head; d; d = d->next) if (d->datum == datum) return 1; return 0; } /* \doc |lst_length| returns the number of elements in the list. */ unsigned int lst_length( lst_List list ) { listType l = (listType)list; _lst_check( l, __func__ ); return l->count; } /* \doc |lst_truncate| truncates a list to |length| elements. If the list is not longer than |length|, nothing it done. */ void lst_truncate( lst_List list, unsigned int length ) { listType l = (listType)list; dataType d; dataType next; unsigned int i; _lst_check( l, __func__ ); if (l->count <= length) return; if (!length) { next = l->head; l->head = l->tail = NULL; } else { /* Find new end of list */ for (i = 1, d = l->head; i < length && d; d = d->next); /* Remember start of remainder of list */ next = d->next; /* Truncate list */ d->next = NULL; l->tail = d; } /* Free truncated portion of list */ while (next) { dataType tmp = next->next; mem_free_object( mem, next ); next = tmp; --l->count; } assert( l->count == length ); } /* \doc |lst_truncate_position| truncates a list beyond |position| (i.e., |position| is always left in the list. If |postition| is "NULL", then the list is emptied. This convention is useful when using |lst_last_postition| to get a marker allowing an older state of a list to be restored. */ void lst_truncate_position( lst_List list, lst_Position position ) { listType l = (listType)list; dataType d; dataType next; _lst_check( l, __func__ ); if (!position) { next = l->head; l->head = l->tail = NULL; } else { d = position; /* New end of list */ next = d->next; /* Start of remainder of list */ /* Truncate */ d->next = NULL; l->tail = d; } /* Free truncated portion of list */ while (next) { dataType tmp = next->next; mem_free_object( mem, next ); next = tmp; --l->count; } } /* \doc |lst_iterate| is used to iterate a function over every element in the |list|. The function, |iterator|, is passed a pointer to each element. If |iterator| returns a non-zero value, the iterations stop, and |lst_iterate| returns. */ int lst_iterate( lst_List list, int (*iterator)( const void *datum ) ) { listType l = (listType)list; dataType d; _lst_check( l, __func__ ); for (d = l->head; d; d = d->next) if (iterator( d->datum )) return 1; return 0; } /* \doc |lst_iterate_arg| is used to iterate a function over every element in the |list|. The function, |iterator|, is passed a pointer to each element. If |iterator| returns a non-zero value, the iterations stop, and |lst_iterate| returns. */ int lst_iterate_arg( lst_List list, int (*iterator)( const void *datum, void *arg ), void *arg ) { listType l = (listType)list; dataType d; _lst_check( l, __func__ ); for (d = l->head; d; d = d->next) if (iterator( d->datum, arg )) return 1; return 0; } /* \doc |lst_init_position| returns a position marker for the head of the list. This marker can be used with |lst_next_position| and |lst_get_position|. */ lst_Position lst_init_position( lst_List list ) { listType l = (listType)list; _lst_check( l, __func__ ); return l->head; } /* \doc |lst_last_position| returns a position marker for the tail of the list. This marker can be used with |lst_truncate_position| to restore a previous state of the list. */ lst_Position lst_last_position( lst_List list ) { listType l = (listType)list; _lst_check( l, __func__ ); return l->tail; } /* \doc |lst_next_position| returns a position marker for the element after the element marked by |position|, or "NULL" if |position| is the last element in the list. */ lst_Position lst_next_position( lst_Position position ) { dataType d = (dataType)position; if (!d) return NULL; return d->next; } /* \doc |lst_nth_position| returns a position marker for the $n$th element in the list, or "NULL" if the $n$th element does not exist. */ lst_Position lst_nth_position( lst_List list, unsigned int n ) { listType l = (listType)list; dataType d; unsigned int i; _lst_check( l, __func__ ); if (n < 1 || n > l->count) return NULL; for (i = 1, d = l->head; i < n && d; i++, d = d->next); if (i != n) err_internal( __func__, "Can't find element %d of %d\n", n, l->count ); return d; } /* \doc |lst_get_position| returns the datum associated with the |position| marker, or "NULL" if there is no such element. */ void *lst_get_position( lst_Position position ) { dataType d = (dataType)position; if (!d) return NULL; return __UNCONST(d->datum); /* Discard const */ } /* \doc |lst_set_position| sets the |datum| associated with the |position| marker. */ void lst_set_position( lst_Position position, const void *datum ) { dataType d = (dataType)position; if (d) d->datum = datum; } /* \doc |lst_dump| prints each |datum| on the list in hex */ static int _lst_dump_node( const void *datum ) { printf(" 0x%p\n", datum); return 0; } void lst_dump( lst_List l ) { lst_iterate(l,_lst_dump_node); } libmaa-1.4.4/maa/maaP.h0000644000175000017500000000366213457657444014476 0ustar cheusovcheusov/* maaP.h -- Internal header file for libmaa * Created: Sun Nov 19 13:19:44 1995 by faith@dict.org * Copyright 1994-1998, 2002 Rickard E. Faith (faith@dict.org) * Copyright 2002-2008 Aleksey Cheusov (vle@gmx.net) * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ #ifndef _MAAP_H_ #define _MAAP_H_ #include #include #include #include #include #include #include #include #include #include #include #include #include #define __UNCONST(a) ((void *)(unsigned long)(const void *)(a)) #if HAVE_HEADER_ALLOCA_H # include #endif #if !defined(SIZEOF_VOID_P) # define SIZEOF_VOID_P sizeof (void *) #endif #if HAVE_HEADER_SYS_RESOURCE_H # include #endif /* Local stuff */ #ifndef max #define max(a,b) ((a)>(b)?(a):(b)) #endif #include "maa.h" #endif libmaa-1.4.4/maa/xmalloc.c0000644000175000017500000000447313457657444015253 0ustar cheusovcheusov/* xmalloc.c -- Error-checking malloc * Created: Sun Nov 6 18:14:10 1994 by faith@dict.org * Copyright 1994-1996, 2002 Rickard E. Faith (faith@dict.org) * Copyright 2002-2008 Aleksey Cheusov (vle@gmx.net) * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ #include "maaP.h" #include void *xmalloc( size_t size ) { void *pt = malloc( size ); if (!pt) err_fatal( __func__, "Out of memory while allocating %lu bytes\n", (unsigned long)size ); return pt; } void *xcalloc( size_t num, size_t size ) { void *pt = calloc( num, size ); if (!pt) err_fatal( __func__, "Out of memory while allocating %lu X %lu byte block\n", (unsigned long)num, (unsigned long)size ); return pt; } void *xrealloc( void *pt, size_t size ) { void *new = realloc( pt, size ); if (!new) err_fatal( __func__, "Out of memory while reallocating block at %p to" " %lu bytes\n", pt, (unsigned long)size ); return new; } void xfree( void *pt ) { if (pt) free( pt ); else err_fatal( __func__, "Attempt to free null pointer\n" ); } char *xstrdup( const char *s ) { size_t len = strlen (s); char *pt = xmalloc (len + 1); if (!pt) err_fatal( __func__, "Out of memory while duplicating string\n" ); memcpy (pt, s, len + 1); return pt; } libmaa-1.4.4/maa/hash.c0000644000175000017500000004247613457657444014544 0ustar cheusovcheusov/* hash.c -- Hash table routines for Khepera * Created: Thu Nov 3 20:07:29 1994 by faith@dict.org * Copyright 1994-1997, 1999, 2002 Rickard E. Faith (faith@dict.org) * Copyright 2002-2008 Aleksey Cheusov (vle@gmx.net) * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * \section{Hash Table Routines} * * \intro Generic hash table support is provided for storing generic data * associated with keys. The hash table has prime length, with * self-organizing linked lists \cite[pp.~398--9]{faith:Knuth73c} used for * collision resolution. The hash table automatically grows as necessary to * preserve efficient access. * */ #include "maaP.h" typedef struct bucket { const void *key; unsigned long hash; const void *datum; struct bucket *next; } *bucketType; typedef struct table { #if MAA_MAGIC int magic; #endif unsigned long prime; unsigned long entries; bucketType *buckets; unsigned long resizings; unsigned long retrievals; unsigned long hits; unsigned long misses; unsigned long (*hash)( const void * ); int (*compare)( const void *, const void * ); int readonly; } *tableType; static void _hsh_check( tableType t, const char *function ) { if (!t) err_internal( function, "table is null\n" ); #if MAA_MAGIC if (t->magic != HSH_MAGIC) err_internal( function, "Magic match failed: 0x%08x (should be 0x%08x)\n", t->magic, HSH_MAGIC ); #endif if (!t->buckets) err_internal( function, "no buckets\n" ); } static hsh_HashTable _hsh_create( unsigned long seed, unsigned long (*hash)( const void * ), int (*compare)( const void *, const void * )) { tableType t; unsigned long i; unsigned long prime = prm_next_prime( seed ); t = xmalloc( sizeof( struct table ) ); #if MAA_MAGIC t->magic = HSH_MAGIC; #endif t->prime = prime; t->entries = 0; t->buckets = xmalloc( prime * sizeof( struct bucket ) ); t->resizings = 0; t->retrievals = 0; t->hits = 0; t->misses = 0; t->hash = hash ? hash : hsh_string_hash; t->compare = compare ? compare : hsh_string_compare; t->readonly = 0; for (i = 0; i < prime; i++) t->buckets[i] = NULL; return t; } /* \doc The |hsh_create| function initilizes a generic hash table. Keys and data are pointers to "void". The internal representation of the hash table will grow automatically when an insertion is performed and the table is more than half full. The |hash| function should take a pointer to a |key| and return an "unsigned long". If |hash| is "NULL", then the |key| is assumed to be a pointer to a null-terminated string, and the function shown in \grind{hsh_string_hash} will be used for |hash| (the algorithm for this function is from \cite[p.~435]{faith:Aho88}). The |compare| function should take a pair of pointers to keys and return zero if the keys are equal and non-zero if the keys are not equal. If |compare| is "NULL", then the keys are assumed to point to null-terminated strings, and the |strcmp| function will be used for |compare|. Additionally, the |hsh_pointer_hash| and |hsh_pointer_compare| functions are available and can be used to treat the \emph{value} of the "void" pointer as the key. These functions are often useful for maintaining sets of objects. */ hsh_HashTable hsh_create( unsigned long (*hash)( const void * ), int (*compare)( const void *, const void * ) ) { return _hsh_create( 0, hash, compare ); } static void _hsh_destroy_buckets( hsh_HashTable table ) { unsigned long i; tableType t = (tableType)table; _hsh_check( t, __func__ ); for (i = 0; i < t->prime; i++) { bucketType b = t->buckets[i]; while (b) { bucketType next = b->next; xfree( b ); /* terminal */ b = next; } } xfree( t->buckets ); /* terminal */ t->buckets = NULL; } static void _hsh_destroy_table( hsh_HashTable table ) { tableType t = (tableType)table; #if MAA_MAGIC t->magic = HSH_MAGIC_FREED; #endif xfree( t ); /* terminal */ } /* \doc |hsh_destroy| frees all of the memory associated with the hash table. The memory used by keys and data is \emph{not} freed---this memory is the responsibility of the user. However, a call to |hsh_iterate| can be used to free this memory \emph{immediately} before a call to |hsh_destroy|. */ void hsh_destroy( hsh_HashTable table ) { _hsh_check( table, __func__ ); if (((tableType)table)->readonly) err_internal( __func__, "Attempt to destroy readonly table\n" ); _hsh_destroy_buckets( table ); _hsh_destroy_table( table ); } static void _hsh_insert( hsh_HashTable table, unsigned long hash, const void *key, const void *datum ) { tableType t = (tableType)table; unsigned long h = hash % t->prime; bucketType b; _hsh_check( t, __func__ ); b = xmalloc( sizeof( struct bucket ) ); b->key = key; b->hash = hash; b->datum = datum; b->next = NULL; if (t->buckets[h]) b->next = t->buckets[h]; t->buckets[h] = b; ++t->entries; } /* \doc |hsh_insert| inserts a new |key| into the |table|. If the insertion is successful, zero is returned. If the |key| already exists, 1 is returned. Hence, the way to change the |datum| associated with a |key| is first to call |hsh_delete|. If the internal representation of the hash table becomes more than half full, its size is increased automatically. At present, this requires that all of the key pointers are copied into a new table. Rehashing is not required, however, since the hash values are stored for each key. */ int hsh_insert( hsh_HashTable table, const void *key, const void *datum ) { tableType t = (tableType)table; unsigned long hashValue = t->hash( key ); unsigned long h; _hsh_check( t, __func__ ); if (t->readonly) err_internal( __func__, "Attempt to insert into readonly table\n" ); /* Keep table less than half full */ if (t->entries * 2 > t->prime) { tableType new = _hsh_create( t->prime * 3, t->hash, t->compare ); unsigned long i; for (i = 0; i < t->prime; i++) { if (t->buckets[i]) { bucketType pt; for (pt = t->buckets[i]; pt; pt = pt->next) _hsh_insert( new, pt->hash, pt->key, pt->datum ); } } /* fixup values */ _hsh_destroy_buckets( t ); t->prime = new->prime; t->buckets = new->buckets; _hsh_destroy_table( new ); ++t->resizings; } h = hashValue % t->prime; if (t->buckets[h]) { /* Assert uniqueness */ bucketType pt; for (pt = t->buckets[h]; pt; pt = pt->next) if (!t->compare( pt->key, key )) return 1; } _hsh_insert( t, hashValue, key, datum ); return 0; } /* \doc |hsh_delete| removes a |key| and the associated datum from the |table|. Zero is returned if the |key| was present. Otherwise, 1 is returned. */ int hsh_delete( hsh_HashTable table, const void *key ) { tableType t = (tableType)table; unsigned long h = t->hash( key ) % t->prime; _hsh_check( t, __func__ ); if (t->readonly) err_internal( __func__, "Attempt to delete from readonly table\n" ); if (t->buckets[h]) { bucketType pt; bucketType prev; for (prev = NULL, pt = t->buckets[h]; pt; prev = pt, pt = pt->next) if (!t->compare( pt->key, key )) { --t->entries; if (!prev) t->buckets[h] = pt->next; else prev->next = pt->next; xfree( pt ); return 0; } } return 1; } /* \doc |hsh_retrieve| retrieves the datum associated with a |key|. If the |key| is not present in the |table|, then "NULL" is returned. */ const void *hsh_retrieve( hsh_HashTable table, const void *key ) { tableType t = (tableType)table; unsigned long h = t->hash( key ) % t->prime; _hsh_check( t, __func__ ); ++t->retrievals; if (t->buckets[h]) { bucketType pt; bucketType prev; for (prev = NULL, pt = t->buckets[h]; pt; prev = pt, pt = pt->next) if (!t->compare( pt->key, key )) { if (!prev) { ++t->hits; } else if (!t->readonly) { /* Self organize */ prev->next = pt->next; pt->next = t->buckets[h]; t->buckets[h] = pt; } return pt->datum; } } ++t->misses; return NULL; } /* \doc |hsh_iterate| is used to iterate a function over every value in the |table|. The function, |iterator|, is passed the |key| and |datum| pair for each entry in the table. If |iterator| returns a non-zero value, the iterations stop, and |hsh_iterate| returns non-zero. Note that the keys are in some arbitrary order, and that this order may change between two successive calls to |hsh_iterate|. */ int hsh_iterate( hsh_HashTable table, int (*iterator)( const void *key, const void *datum ) ) { tableType t = (tableType)table; unsigned long i; bucketType pt; bucketType next; /* Save, because pt might vanish. */ _hsh_check( t, __func__ ); for (i = 0; i < t->prime; i++) { if (t->buckets[i]) { for (pt = t->buckets[i]; pt; pt = next) { next = pt->next; if (iterator( pt->key, pt->datum )) return 1; } } } return 0; } /* \doc |hsh_iterate_arg| is used to iterate a function over every value in the |table|. The function, |iterator|, is passed the |key| and |datum| pair for each entry in the table. If |iterator| returns a non-zero value, the iterations stop, and |hsh_iterate| returns non-zero. Note that the keys are in some arbitrary order, and that this order may change between two successive calls to |hsh_iterate|. */ int hsh_iterate_arg( hsh_HashTable table, int (*iterator)( const void *key, const void *datum, void *arg ), void *arg ) { tableType t = (tableType)table; unsigned long i; bucketType pt; bucketType next; /* Save, because pt might vanish. */ _hsh_check( t, __func__ ); for (i = 0; i < t->prime; i++) { if (t->buckets[i]) { for (pt = t->buckets[i]; pt; pt = next) { next = pt->next; if (iterator( pt->key, pt->datum, arg )) return 1; } } } return 0; } /* a function callable from hsh_iterate() to print key values */ static int _hsh_key_strings( const void *k, const void *d ) { const char *s; static int i = 0; if (k == NULL) { i=0; return 0; } s = k; printf("%s ",s); if ((i += strlen(s)+2) >= 60) { i=0; printf("\n"); } return 0; } /* print all keys in table t as strings */ void hsh_key_strings(hsh_HashTable t) { _hsh_key_strings(NULL,NULL); hsh_iterate(t,_hsh_key_strings); printf("\n"); } /* \doc |hsh_get_stats| returns statistics about the |table|. The |hsh_Stats| structure is shown in \grind{hsh_Stats}. */ hsh_Stats hsh_get_stats( hsh_HashTable table ) { tableType t = (tableType)table; hsh_Stats s = xmalloc( sizeof( struct hsh_Stats ) ); unsigned long i; unsigned count; _hsh_check( t, __func__ ); s->size = t->prime; s->resizings = t->resizings; s->entries = 0; s->buckets_used = 0; s->singletons = 0; s->maximum_length = 0; s->retrievals = t->retrievals; s->hits = t->hits; s->misses = t->misses; for (i = 0; i < t->prime; i++) { if (t->buckets[i]) { bucketType pt; ++s->buckets_used; for (count = 0, pt = t->buckets[i]; pt; ++count, pt = pt->next); if (count == 1) ++s->singletons; s->maximum_length = max( s->maximum_length, count ); s->entries += count; } } if (t->entries != s->entries ) err_internal( __func__, "Incorrect count for entries: %lu vs. %lu\n", t->entries, s->entries ); return s; } /* \doc |hsh_print_stats| prints the statistics for |table| on the specified |stream|. If |stream| is "NULL", then "stdout" will be used. */ void hsh_print_stats( hsh_HashTable table, FILE *stream ) { FILE *str = stream ? stream : stdout; hsh_Stats s = hsh_get_stats( table ); _hsh_check( table, __func__ ); fprintf( str, "Statistics for hash table at %p:\n", table ); fprintf( str, " %lu resizings to %lu total\n", s->resizings, s->size ); fprintf( str, " %lu entries (%lu buckets used, %lu without overflow)\n", s->entries, s->buckets_used, s->singletons ); fprintf( str, " maximum list length is %lu", s->maximum_length ); if (s->buckets_used) fprintf( str, " (optimal is %.1f)\n", (double)s->entries / (double)s->buckets_used ); else fprintf( str, "\n" ); fprintf( str, " %lu retrievals (%lu from top, %lu failed)\n", s->retrievals, s->hits, s->misses ); xfree( s ); /* rare */ } unsigned long hsh_string_hash( const void *key ) { const char *pt = (const char *)key; unsigned long h = 0; if (!pt) err_internal( __func__, "String-valued keys may not be NULL\n" ); while (*pt) { h += *pt++; #if 0 h *= 65599L; /* prime near %$2^{16}$% */ #else h *= 2654435789U; /* prime near %$\frac{\sqrt{5}-1}{2}2^{32}$% */ #endif } return h & 0xffffffff; } unsigned long hsh_pointer_hash( const void *key ) { const char *pt; unsigned long h = 0; int i; #ifdef WORDS_BIGENDIAN pt = ((const char *)&key) + SIZEOF_VOID_P - 1; #else pt = (const char *)&key; #endif for (i = 0; i < SIZEOF_VOID_P; i++) { #ifdef WORDS_BIGENDIAN h += *pt--; #else h += *pt++; #endif #if 0 h *= 65599L; /* prime near %$2^{16}$% */ #else h *= 2654435789U; /* prime near %$\frac{\sqrt{5}-1}{2}2^{32}$% */ #endif } return h & 0xffffffff; } int hsh_string_compare( const void *key1, const void *key2 ) { if (!key1 || !key2) err_internal( __func__, "String-valued keys may not be NULL: key1=%p, key2=%p\n", key1, key2 ); return strcmp( (const char *)key1, (const char *)key2 ); } int hsh_pointer_compare( const void *key1, const void *key2 ) { const char *p1 = (const char *)&key1; const char *p2 = (const char *)&key2; int i; for (i = 0; i < SIZEOF_VOID_P; i++) if (*p1++ != *p2++) return 1; return 0; } /* \doc |hsh_init_position| returns a position marker for some arbitary first element in the table. This marker can be used with |hsh_next_position| and |hsh_get_position|. */ hsh_Position hsh_init_position( hsh_HashTable table ) { tableType t = (tableType)table; unsigned long i; _hsh_check( t, __func__ ); for (i = 0; i < t->prime; i++) if (t->buckets[i]) { t->readonly = 1; return t->buckets[i]; } return NULL; } /* \doc |hsh_next_position| returns a position marker for the next element in the table. Elements are in arbitrary order based on their positions in the hash table. */ hsh_Position hsh_next_position( hsh_HashTable table, hsh_Position position ) { tableType t = (tableType)table; bucketType b = (bucketType)position; unsigned long i; unsigned long h; _hsh_check( t, __func__ ); if (!b) { t->readonly = 0; return NULL; } if (b->next) return b->next; for (h = b->hash % t->prime, i = h + 1; i < t->prime; i++) if (t->buckets[i]) return t->buckets[i]; t->readonly = 0; return NULL; } /* \doc |hsh_get_position| returns the datum associated with the |position| marker, or "NULL" if there is no such datum. |key| is set to the key associated with this datum, or "NULL" is there is no such datum. */ void *hsh_get_position( hsh_Position position, void **key ) { bucketType b = (bucketType)position; *key = NULL; if (!b) return NULL; *key = __UNCONST(b->key); /* Discard const */ return __UNCONST(b->datum); /* Discard const */ } /* \doc |hsh_readonly| sets the |readonly| flag for the |table| to |flag|. |flag| should be 0 or 1. The value of the previous flag is returned. When a hash table is marked as readonly, self-organization of the bucket-overflow lists will not take place, and any attempt to modify the list (e.g., insertion or deletion) will result in an error. */ int hsh_readonly( hsh_HashTable table, int flag ) { tableType t = (tableType)table; int current; _hsh_check( t, __func__ ); current = t->readonly; t->readonly = flag; return current; } libmaa-1.4.4/maa/base64.c0000644000175000017500000001116613457657444014675 0ustar cheusovcheusov/* base64.c -- Encode/decode integers in base64 format * Created: Mon Sep 23 16:55:12 1996 by faith@dict.org * Copyright 1996, 2002 Rickard E. Faith (faith@dict.org) * Copyright 2002-2008 Aleksey Cheusov (vle@gmx.net) * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * \section{Base-64 Routines} * * \intro These routines use the 64-character subset of International * Alphabet IA5 discussed in RFC 1421 (printeable encoding) and RFC 1522 * (base64 MIME). * Value Encoding Value Encoding Value Encoding Value Encoding 0 A 17 R 34 i 51 z 1 B 18 S 35 j 52 0 2 C 19 T 36 k 53 1 3 D 20 U 37 l 54 2 4 E 21 V 38 m 55 3 5 F 22 W 39 n 56 4 6 G 23 X 40 o 57 5 7 H 24 Y 41 p 58 6 8 I 25 Z 42 q 59 7 9 J 26 a 43 r 60 8 10 K 27 b 44 s 61 9 11 L 28 c 45 t 62 + 12 M 29 d 46 u 63 / 13 N 30 e 47 v 14 O 31 f 48 w (pad) = 15 P 32 g 49 x 16 Q 33 h 50 y * */ #include "maaP.h" static unsigned char b64_list[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; #define XX 100 static int b64_index[256] = { XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,62, XX,XX,XX,63, 52,53,54,55, 56,57,58,59, 60,61,XX,XX, XX,XX,XX,XX, XX, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10, 11,12,13,14, 15,16,17,18, 19,20,21,22, 23,24,25,XX, XX,XX,XX,XX, XX,26,27,28, 29,30,31,32, 33,34,35,36, 37,38,39,40, 41,42,43,44, 45,46,47,48, 49,50,51,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, }; /* |b64_encode| encodes |val| in a printable base 64 format. A MSB-first encoding is generated. */ const char *b64_encode( unsigned long val ) { static char result[7]; int i; result[0] = b64_list[ (val & 0xc0000000) >> 30 ]; result[1] = b64_list[ (val & 0x3f000000) >> 24 ]; result[2] = b64_list[ (val & 0x00fc0000) >> 18 ]; result[3] = b64_list[ (val & 0x0003f000) >> 12 ]; result[4] = b64_list[ (val & 0x00000fc0) >> 6 ]; result[5] = b64_list[ (val & 0x0000003f) ]; result[6] = 0; for (i = 0; i < 5; i++) if (result[i] != b64_list[0]) return result + i; return result + 5; } unsigned long b64_decode_buf (const char *val, size_t len) { unsigned long v = 0; int i; int offset = 0; for (i = len - 1; i >= 0; i--) { int tmp = b64_index[ (unsigned char)val[i] ]; if (tmp == XX) err_internal( __func__, "Illegal character in base64 value: `%c'\n", val[i] ); v |= tmp << offset; offset += 6; } return v; } unsigned long b64_decode (const char *val) { return b64_decode_buf (val, strlen (val)); } libmaa-1.4.4/maa/pr.c0000644000175000017500000003214313457657444014230 0ustar cheusovcheusov/* pr.c -- Process creation and tracking support * Created: Sun Jan 7 13:34:08 1996 by faith@dict.org * Copyright 1996, 2002 Rickard E. Faith (faith@dict.org) * Copyright 2002-2008 Aleksey Cheusov (vle@gmx.net) * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * \section{Process Management Routines} * * \intro The process management routines are designed to facilitate the * creation and management of child processes, coprocesses, and associated * pipelines and I/O. Some support for daemons and socket connections is * also provided. * */ #include "maaP.h" #include #include #include #include #include typedef struct _pr_Obj { int pid; } *_pr_Obj; static _pr_Obj _pr_objects = NULL; #if 0 static void _pr_check( pr_Object object, const char *function ) { Obj o = (Obj)object; if (!o) err_internal( function, "object is null\n" ); #if MAA_MAGIC if (o->magic != PR_MAGIC) err_internal( function, "Magic match failed: 0x%08x (should be 0x%08x)\n", o->magic, PR_MAGIC ); #endif } #endif /* The idea for the max_fd call is from W. Richard Stevens; Advanced Programming in the UNIX Environment (Addison-Wesley Publishing Co., 1992); page 43. The implementation here, however, is different from that provided by Stevens for his open_max routine. */ static int max_fd( void ) { static int maxFd = 0; if (maxFd) return maxFd; if ((maxFd = sysconf( _SC_OPEN_MAX )) > 0) return maxFd; #ifdef NOFILE return maxFd = NOFILE; /* Usually in sys/params.h */ #else # ifdef _NFILE return maxFd = _NFILE; # else return maxFd = 256; /* best guess */ # endif #endif } static void _pr_init( void ) { if (!_pr_objects) _pr_objects = xcalloc( max_fd(), sizeof( struct _pr_Obj ) ); } void _pr_shutdown( void ) { int i; if (_pr_objects) { for (i = 0; i < max_fd(); i++) { /* FIXME: blah */; if (_pr_objects[i].pid) { kill( _pr_objects[i].pid, SIGKILL ); /* FIXME! be gentler. */ pr_wait( _pr_objects[i].pid ); _pr_objects[i].pid = 0; } } xfree( _pr_objects ); _pr_objects = NULL; } } int pr_open( const char *command, int flags, int *infd, int *outfd, int *errfd) { int pid; int fdin[2]; int fdout[2]; int fderr[2]; arg_List list; int argc; char **argv; int null; _pr_init(); if (flags & ~(PR_USE_STDIN | PR_USE_STDOUT | PR_USE_STDERR | PR_CREATE_STDIN | PR_CREATE_STDOUT | PR_CREATE_STDERR | PR_STDERR_TO_STDOUT)) err_internal( __func__, "Illegal flags: 0x%08x\n", flags ); if ((flags & PR_USE_STDIN) && (flags & PR_CREATE_STDIN)) err_internal( __func__, "Cannot both use and create stdin\n" ); if ((flags & PR_USE_STDOUT) && (flags & PR_CREATE_STDOUT)) err_internal( __func__, "Cannot both use and create stdout\n" ); if ((flags & PR_USE_STDERR) && (flags & PR_CREATE_STDERR)) err_internal( __func__, "Cannot both use and create stderr\n" ); if ((flags & PR_STDERR_TO_STDOUT) && ((flags & PR_USE_STDERR) || (flags & PR_CREATE_STDERR))) err_internal( __func__, "Cannot use/create stderr when duping to stdout\n" ); list = arg_argify( command, 0 ); arg_get_vector( list, &argc, &argv ); PRINTF(MAA_PR,("Execing %s with \"%s\"\n", argv[0], command )); if ((flags & PR_CREATE_STDIN) && pipe( fdin ) < 0) err_fatal_errno( __func__, "Cannot create pipe for stdin\n" ); if ((flags & PR_CREATE_STDOUT) && pipe( fdout ) < 0) err_fatal_errno( __func__, "Cannot create pipe for stdout\n" ); if ((flags & PR_CREATE_STDERR) && pipe( fderr ) < 0) err_fatal_errno( __func__, "Cannot create pipe for stderr\n" ); if ((pid = fork()) < 0) err_fatal_errno( __func__, "Cannot fork\n" ); if (pid == 0) { /* child */ int i; #define CHILD(CREATE,USE,fds,writefd,readfd,fd,FILENO,flag) \ if (flags & CREATE) { \ close( fds[writefd] ); \ dup2( fds[readfd], FILENO ); \ close( fds[readfd] ); \ } else if (flags & USE) { \ if (fd && *fd) { \ dup2( *fd, FILENO ); \ close( *fd ); \ } else { \ if ((null = open( "/dev/null", flag )) >= 0) { \ dup2( null, FILENO ); \ close( null ); \ } \ } \ } CHILD( PR_CREATE_STDIN, PR_USE_STDIN, fdin, 1, 0, infd, STDIN_FILENO, O_RDONLY ); CHILD( PR_CREATE_STDOUT, PR_USE_STDOUT, fdout, 0, 1, outfd, STDOUT_FILENO, O_WRONLY ); CHILD( PR_CREATE_STDERR, PR_USE_STDERR, fderr, 0, 1, errfd, STDERR_FILENO, O_WRONLY ); #undef CHILD if (flags & PR_STDERR_TO_STDOUT) dup2( STDOUT_FILENO, STDERR_FILENO ); for (i = 0; i < max_fd(); i++) if (_pr_objects[i].pid > 0) close( i ); execvp( argv[0], argv ); _exit(127); } /* parent */ #define PARENT(CREATE,USE,fds,readfd,writefd,fd,flag,name) \ if (flags & CREATE) { \ close( fds[ readfd ] ); \ *fd = fds[ writefd ]; \ _pr_objects[ *fd ].pid = pid; \ PRINTF(MAA_PR,(name " = %d; ",*fd)); \ } else if (flags & USE) { \ if (fd && *fd) { \ PRINTF(MAA_PR,(name " = %d*; ",*fd)); \ _pr_objects[ *fd ].pid =0; \ close( *fd ); \ } \ } PARENT( PR_CREATE_STDIN, PR_USE_STDIN, fdin, 0, 1, infd, "w", "stdin" ); PARENT( PR_CREATE_STDOUT, PR_USE_STDOUT, fdout, 1, 0, outfd, "r", "stdout" ); PARENT( PR_CREATE_STDERR, PR_USE_STDERR, fderr, 1, 0, errfd, "r", "stderr" ); #undef PARENT PRINTF(MAA_PR,("child pid = %d\n",pid)); arg_destroy( list ); return pid; } int pr_wait( int pid ) { int exitStatus = 0; int status; PRINTF(MAA_PR,("waiting on pid %d\n",pid)); while (waitpid( pid, &status, 0 ) < 0) { if (errno != EINTR) { if (errno == ECHILD) return 0; /* We've already waited */ /* This is really bad... */ PRINTF(MAA_PR,("waitpid() < 0, errno = %d\n", errno )); perror( __func__ ); return -1; } } if (WIFEXITED( status )) exitStatus |= WEXITSTATUS( status ); /* SIGPIPE is ok here, since tar may shutdown early. Anything else is a problem. */ if (WIFSIGNALED( status ) && WTERMSIG( status ) != SIGPIPE) exitStatus |= 128 + WTERMSIG( status ); /* like bash :-) */ PRINTF(MAA_PR,("Child %d exited with status 0x%04x\n",pid,exitStatus)); return exitStatus; } int pr_close_nowait( int fd ) { int pid; if (!_pr_objects) err_internal( __func__, "No previous call to pr_open()\n" ); if (!(pid = _pr_objects[ fd ].pid)) err_internal( __func__, "File (%d) not created by pr_open()\n", fd ); _pr_objects[ fd ].pid = 0; close( fd ); return pid; } int pr_close( int fd ) { int pid = pr_close_nowait( fd ); return pr_wait( pid ); } int pr_readwrite( int in, int out, const char *inBuffer, int inLen, char *outBuffer, int outMaxLen ) { long flags; const char *inPt = inBuffer; char *outPt = outBuffer; int outLen = 0; fd_set rfds, wfds, efds; struct timeval tv; int n; int count; int retval; int status; if ((flags = fcntl( in, F_GETFL )) < 0) err_fatal_errno( __func__, "Can't get flags for output stream\n" ); #ifdef O_NONBLOCK flags |= O_NONBLOCK; #else flags |= FNDELAY; #endif fcntl( in, F_SETFL, flags ); if ((flags = fcntl( out, F_GETFL )) < 0) err_fatal_errno( __func__, "Can't get flags for input stream\n" ); #ifdef O_NONBLOCK flags |= O_NONBLOCK; #else flags |= FNDELAY; #endif fcntl( out, F_SETFL, flags ); n = max( in, out ) + 1; for (;;) { tv.tv_sec = 5; tv.tv_usec = 0; FD_ZERO( &rfds ); FD_ZERO( &wfds ); FD_ZERO( &efds ); FD_SET( out, &rfds ); FD_SET( out, &efds ); if (inLen) { FD_SET( in, &wfds ); FD_SET( in, &efds ); } switch ((retval = select( n, &rfds, &wfds, &efds, &tv ))) { case -1: err_fatal_errno( __func__, "Filter failed\n" ); break; /* case 0: err_fatal( __func__, "Filter hung\n" ); break; */ default: if (dbg_test(MAA_PR)) { printf( "select(2) returns %d," " inLen = %d, outLen = %d, outMaxLen = %d\n", retval, inLen, outLen, outMaxLen ); if (FD_ISSET( in, &rfds )) printf( " in/read\n" ); if (FD_ISSET( out, &rfds )) printf( " out/read\n" ); if (FD_ISSET( in, &wfds )) printf( " in/write\n" ); if (FD_ISSET( out, &wfds )) printf( " out/write\n" ); if (FD_ISSET( in, &efds )) printf( " in/error\n" ); if (FD_ISSET( out, &efds )) printf( " out/error\n" ); } if (inLen) { if ((count = write( in, inPt, inLen )) <= 0) { if (errno != EAGAIN) err_fatal_errno( __func__, "Error writing to filter\n" ); } else { PRINTF(MAA_PR,(" wrote %d\n",count)); inLen -= count; inPt += count; if (!inLen) { pr_close_nowait( in ); n = out + 1; } } } if ((count = read( out, outPt, outMaxLen )) <= 0) { if (!count) { if (inLen) err_fatal( __func__, "End of output, but input not flushed\n" ); if ((status = pr_close( out ))) err_warning( __func__, "Filter had non-zero exit status: 0x%x\n", status ); return outLen; } else if (errno != EAGAIN) err_fatal_errno( __func__, "Error reading from filter\n" ); } else { PRINTF(MAA_PR,(" read %d\n",count)); outLen += count; outPt += count; if ((outMaxLen -= count) < 0) err_fatal( __func__, "Output buffer overflow\n" ); } break; } } } int pr_filter( const char *command, const char *inBuffer, int inLen, char *outBuffer, int outMaxLen ) { int in, out; pr_open( command, PR_CREATE_STDIN | PR_CREATE_STDOUT, &in, &out, NULL ); return pr_readwrite( in, out, inBuffer, inLen, outBuffer, outMaxLen ); } int pr_spawn( const char *command ) { arg_List list; int argc; char **argv; int pid; int status; int exitStatus = 0; _pr_init(); list = arg_argify( command, 0 ); arg_get_vector( list, &argc, &argv ); PRINTF(MAA_PR,("Execing %s with \"%s\"\n", argv[0], command )); if ((pid = fork()) < 0) err_fatal_errno( __func__, "Cannot fork\n" ); if (pid == 0) { /* child */ execvp( argv[0], argv ); _exit(127); } /* parent */ PRINTF(MAA_PR,("child pid = %d\n",pid)); arg_destroy( list ); PRINTF(MAA_PR,("waiting on pid %d\n",pid)); while (waitpid( pid, &status, 0 ) < 0) { if (errno != EINTR) { if (errno == ECHILD) return 0; /* We've already waited */ /* This is really bad... */ PRINTF(MAA_PR,("waitpid() < 0, errno = %d\n", errno )); perror( __func__ ); return -1; } } if (WIFEXITED( status )) exitStatus |= WEXITSTATUS( status ); /* SIGPIPE is ok here, since tar may shutdown early. Anything else is a problem. */ if (WIFSIGNALED( status ) && WTERMSIG( status ) != SIGPIPE) exitStatus |= 128 + WTERMSIG( status ); /* like bash :-) */ PRINTF(MAA_PR,("Child %d exited with status 0x%04x\n",pid,exitStatus)); return exitStatus; } libmaa-1.4.4/maa/text.c0000644000175000017500000000534213457657444014574 0ustar cheusovcheusov/* text.c -- Text manipulation routines for Libmaa * Created: Wed Apr 24 14:51:51 1996 by faith@dict.org * Copyright 1996, 2002 Rickard E. Faith (faith@dict.org) * Copyright 2002-2008 Aleksey Cheusov (vle@gmx.net) * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ #include #include "maaP.h" /* \doc Given a string, return (in a |static| buffer), the Soundex value for the string. The basic algorithm for the soundex routine is from Donald E. Knuth's THE ART OF COMPUTER PROGRAMMING, Volume 3: Sorting and Searching (Addison-Wesley Publishing Co., 1973, pages 391 and 392). Knuth notes that the method was originally described by Margaret K. Odell and Robert C. Russell [US Patents 1261167 (1918) and 1435663 (1922)]. */ void txt_soundex2( const char *string, char * result /* five chars */ ) { char *pt = result; int upper_case; /* abcdefghijklmnopqrstuvwxyz */ static const char map[] = "01230120022455012623010202"; char previous = 0; char transform; int i; strcpy( result, "Z000" ); for (i = 0; *string && i < 4; ++string) { if (isascii ( (unsigned char) *string ) && isalpha( (unsigned char) *string )) { upper_case = toupper( (unsigned char) *string ); transform = map[ upper_case - 'A' ]; if (!i) { *pt++ = upper_case; ++i; } else { if (transform != '0' && transform != previous) { *pt++ = transform; ++i; } } previous = transform; } } } const char * txt_soundex( const char *string ) { static char buf [5]; txt_soundex2 (string, buf); return buf; } libmaa-1.4.4/maa/debug.c0000644000175000017500000001614713457657444014703 0ustar cheusovcheusov/* debug.c -- Debugging support for Khepera * Created: Fri Dec 23 10:53:10 1994 by faith@dict.org * Copyright 1994-1997, 2002 Rickard E. Faith (faith@dict.org) * Copyright 2002-2008 Aleksey Cheusov (vle@gmx.net) * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * \section{Debugging Support} * * \intro These routines provide low-level support for run-time debugging * messages. A set of global flags are maintained using "#define" * statements. These flags are assumed to be 32-bit integers, the top two * bits of which are used to select one of four sets of debugging lags. * Each set, therefore, has 30 bits of flag information. The last set * (i.e., when the top two bits are both set) is reserved for internal use * by the \khepera library. For convenience, each flag can be given a * unique name, so that flags can be set easily with command-line options. * */ #include "maaP.h" #define TEST(flags,var) (((flags)>>31) \ ? (((flags)>>30) \ ? ((var[3] & (flags)) << 2) \ : ((var[2] & (flags)) << 2)) \ : (((flags)>>30) \ ? ((var[1] & (flags)) << 2) \ : ((var[0] & (flags)) << 2))) static hsh_HashTable hash; static dbg_Type setFlags[4]; static dbg_Type usedFlags[4]; /* |_dbg_exists| returns non-zero if |flag| has been associated with a name (using the |_dbg_register| function). */ static int _dbg_exists( dbg_Type flag ) { return TEST( flag, usedFlags ); } /* |_dbg_name| returns a pointer to the name that was associated with the |flag|. */ static const char *_dbg_name( dbg_Type flag ) { hsh_Position position; void *key; void *datum; if (!hash) err_fatal( __func__, "No debugging names registered\n" ); HSH_ITERATE( hash, position, key, datum ) { if (flag == (dbg_Type)datum) { HSH_ITERATE_END( hash ); return key; } } return "unknown flag"; } /* |_dbg_register| is documented in the |dbg_register| section. */ void _dbg_register( dbg_Type flag, const char *name ) { dbg_Type tmp; for (tmp = flag & 0x3fffffff; tmp && !(tmp & 1); tmp >>= 1); if (!tmp || tmp >> 1) err_fatal( __func__, "Malformed flag (%lx):" " a single low-order bit must be set\n", flag ); if (!hash) hash = hsh_create( NULL, NULL ); if (_dbg_exists( flag )) err_fatal( __func__, "The debug flag %lx has been used for \"%s\"" " and cannot be reused for \"%s\"\n", flag, _dbg_name( flag ), name ); hsh_insert( hash, name, (void *)flag ); } /* \doc |dbg_register| is used to set up an asociated between a |flag| and a |name|. After this association is made, calls to |dbg_set| can use |name| to set the global debugging flag. Both of the high bits cannot be set simultaneously---these flags are reserved for internal use by the \khepera library.\footnote{For internal \khepera library use, |_dbg_register| can be used to register flags which have both high bits set.} */ void dbg_register( dbg_Type flag, const char *name ) { /* These values are reserved for Khepera */ if ((flag & 0xc0000000) == 0xc0000000) err_fatal( __func__, "Flag (%lx) may not have both high-order bits set\n", flag ); _dbg_register( flag, name ); } /* \doc |dbg_set| sets the |name| flag. If |name| is ``none,'' then all flags are cleared. */ void dbg_set( const char *name ) { dbg_Type flag; if (!name) err_internal( __func__, "name is NULL\n" ); if (!hash) err_fatal( __func__, "No debugging names registered\n" ); if (!strcmp( name, "none" )) { setFlags[0] = setFlags[1] = setFlags[2] = setFlags[3] = 0; return; } if (!strcmp( name, "all" )) { setFlags[0] = setFlags[1] = setFlags[2] = setFlags[3] = ~0; return; } if (!(flag = (dbg_Type)hsh_retrieve( hash, name ))) { if (!(flag = (dbg_Type)hsh_retrieve( hash, name+1 )) && *name != '-' && *name != '+') { fprintf( stderr, "Valid debugging flags are:\n" ); dbg_list( stderr ); err_fatal( __func__, "\"%s\" is not a valid debugging flag\n", name ); } else { if (*name == '+') setFlags[ flag >> 30 ] |= flag; else setFlags[ flag >> 30 ] &= ~flag; /* - */ } } else { setFlags[ flag >> 30 ] |= flag; } } /* \doc Used to set the flag using the predefined macro instead of the string name. */ void dbg_set_flag( dbg_Type flag ) { setFlags[ flag >> 30 ] |= flag; } /* \doc Used to unset the flag using the predefined macro instead of the string name. */ void dbg_unset_flag( dbg_Type flag ) { setFlags[ flag >> 30 ] &= ~flag; } /* \doc This function tests the |flag|, returning non-zero if the |flag| is set, and zero otherwise. */ int dbg_test( dbg_Type flag ) { return TEST( flag, setFlags ); } /* \doc |dbg_destroy| destroys the memory associated with the debugging support routines. This routine should \emph{never} be called by the programmer: it is automatically called at program termination on systems that support the |atexit| or |on_exit| calls. */ void dbg_destroy( void ) { if (hash) hsh_destroy( hash ); hash = NULL; setFlags[0] = setFlags[1] = setFlags[2] = setFlags[3] = 0; usedFlags[0] = usedFlags[1] = usedFlags[2] = usedFlags[3] = 0; } static int _dbg_user( const void *key, const void *datum, void *arg ) { FILE *stream = (FILE *)arg; dbg_Type flag = (dbg_Type)datum; if ((flag & 0xc0000000) != 0xc0000000) fprintf( stream, " %s\n", (char*) __UNCONST(key) ); return 0; } static int _dbg_builtin( const void *key, const void *datum, void *arg ) { FILE *stream = (FILE *)arg; dbg_Type flag = (dbg_Type)datum; if ((flag & 0xc0000000) == 0xc0000000) fprintf( stream, " %s (builtin)\n", (char*) __UNCONST(key) ); return 0; } /* |dbg_list| lists all of the valid user-level debugging flags to the specified |stream|. */ void dbg_list( FILE *stream ) { hsh_iterate_arg( hash, _dbg_user, stream ); hsh_iterate_arg( hash, _dbg_builtin, stream ); } libmaa-1.4.4/maa/base26.c0000644000175000017500000000677413457657444014704 0ustar cheusovcheusov/* base64.c -- Encode/decode integers in base64 format * Created: Mon Sep 23 16:55:12 1996 by faith@dict.org * Copyright 1996, 2002 Rickard E. Faith (faith@dict.org) * Copyright 2002-2008 Aleksey Cheusov (vle@gmx.net) * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * \section{Base-26 Routines} * * \intro These routines perform encoding and decodingusing the 26 * lowercase characters, a-z. This is sometimes useful for generating * unique identifiers that do not contain numbers. * */ #include "maaP.h" static unsigned char b26_list[] = "abcdefghijklmnopqrstuvwxyz"; #define XX 100 static int b26_index[256] = { XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10, 11,12,13,14, 15,16,17,18, 19,20,21,22, 23,24,25,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, }; /* |b26_encode| encodes |val| in a printable base 26 format. A MSB-first encoding is generated. */ const char *b26_encode( unsigned long val ) { static char result[8] = { 'a', 'a', 'a', 'a', 'a', 'a', 'a', '\0'}; static unsigned long previous = 0; int i; if (previous != val) { previous = val; for (i = 6; i >= 0; i--) { result[i] = b26_list[ val % 26 ]; val = val / 26; } result[7] = 0; } for (i = 0; i < 6; i++) if (result[i] != b26_list[0]) return result + i; return result + 6; } unsigned long b26_decode( const char *val ) { unsigned long v = 0; int i; int offset = 1; int len = strlen( val ); for (i = len - 1; i >= 0; i--) { int tmp = b26_index[ (unsigned char)val[i] ]; if (tmp == XX) err_internal( __func__, "Illegal character in base26 value: `%c' (%d)\n", val[i], val[i] ); v += tmp * offset; offset *= 26; } return v; } libmaa-1.4.4/maa/memory.c0000644000175000017500000002477113457657444015127 0ustar cheusovcheusov/* memory.c -- Memory management for Khepera * Created: Thu Dec 22 09:58:38 1994 by faith@dict.org * Copyright 1994-1996, 2002 Rickard E. Faith (faith@dict.org) * Copyright 2002-2008 Aleksey Cheusov (vle@gmx.net) * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * \section{Memory Management Routines} * * \intro The memory management routines provide simple support for string * object storage. These routines are generally used as building blocks by * other parts of the \khepera library (e.g., string pools and abstract * syntax trees). * */ #include "maaP.h" typedef struct stringInfo { #if MAA_MAGIC int magic; #endif int count; int bytes; int growing_size; stk_Stack allocated; } *stringInfo; typedef struct objectInfo { #if MAA_MAGIC int magic; #endif int total; int used; int reused; int size; stk_Stack stack; /* for free list */ stk_Stack allocated; } *objectInfo; #if !MAA_MAGIC #define _mem_magic_strings(i,function) \ do { \ if (!i) err_internal( function, "mem_String is null\n" ); \ } while (0); #else static void _mem_magic_strings( stringInfo i, const char *function ) { if (!i) err_internal( function, "mem_String is null\n" ); if (i->magic != MEM_STRINGS_MAGIC) err_internal( function, "Incorrect magic: 0x%08x (should be 0x%08x)\n", i->magic, MEM_STRINGS_MAGIC ); } #endif /* \doc |mem_create_strings| creates a memory object for storing strings. */ mem_String mem_create_strings( void ) { stringInfo info = xmalloc( sizeof( struct stringInfo ) ); #if MAA_MAGIC info->magic = MEM_STRINGS_MAGIC; #endif info->count = 0; info->bytes = 0; info->allocated = stk_create(); info->growing_size = 0; return info; } /* \doc |mem_destroy_strings| destroys the memory object returned from |mem_create_strings|. All memory if freed, including that used for the strings. Therefore, any pointers to strings in the table will be left dangling. */ void mem_destroy_strings( mem_String info ) { stringInfo i = (stringInfo)info; _mem_magic_strings( i, __func__ ); #if MAA_MAGIC i->magic = MEM_STRINGS_MAGIC_FREED; #endif while (!stk_isempty(i->allocated)){ xfree(stk_pop(i->allocated)); } stk_destroy(i->allocated); xfree( i ); /* terminal */ } /* \doc |mem_strcpy| copies a |string| into the memory object pointed to by |info|. */ const char *mem_strcpy( mem_String info, const char *string ) { stringInfo i = (stringInfo)info; int len = strlen( string ); char * str; _mem_magic_strings( i, __func__ ); ++i->count; i->bytes += len + 1; i->growing_size = 0; str = xstrdup(string); stk_push(i->allocated, str); return str; } /* \doc |mem_strncpy| copies |len| bytes of |string| into the memory object pointed to by |info|. A null is added to the end of the copied sequence. */ const char *mem_strncpy( mem_String info, const char *string, int len ) { stringInfo i = (stringInfo)info; char * str; _mem_magic_strings( i, __func__ ); ++i->count; i->bytes += len + 1; i->growing_size = 0; str = xmalloc(len + 1); memcpy(str, string, len + 1); stk_push(i->allocated, str); return str; } /* \doc |mem_grow| copies |len| of |string| onto the top of the memory object pointed to by |info|. Several calls to |mem_grow| should be followed by a single call to |mem_finish| without any intervening calls to other functions which modify |info|. */ void mem_grow( mem_String info, const char *string, int len ) { stringInfo i = (stringInfo)info; void *p; _mem_magic_strings( i, __func__ ); i->bytes += len; if (i->growing_size){ p = stk_pop(i->allocated); p = xrealloc(p, i->growing_size + len); }else{ p = xmalloc(len); } memcpy((char *)p + i->growing_size, string, len); i->growing_size += len; stk_push(i->allocated, p); } /* \doc |mem_finish| finishes the growth of the object performed by |mem_grow|. */ const char *mem_finish( mem_String info ) { stringInfo i = (stringInfo)info; _mem_magic_strings( i, __func__ ); mem_grow(i, "", 1); ++i->count; i->growing_size = 0; return (char *) stk_top(i->allocated); } /* \doc |mem_get_string_stats| returns statistics about the memory object pointed to by |info|. The |mem_StringStats| structure is shown in \grind{mem_StringStats}. */ mem_StringStats mem_get_string_stats( mem_String info ) { stringInfo i = (stringInfo)info; mem_StringStats s = xmalloc( sizeof( struct mem_StringStats ) ); _mem_magic_strings( i, __func__ ); s->count = i->count; s->bytes = i->bytes; return s; } /* \doc |mem_print_string_stats| prints the statistics for the memory object pointed to by |info| on the specified |stream|. If |stream| is "NULL", then "stdout" will be used. */ void mem_print_string_stats( mem_String info, FILE *stream ) { FILE *str = stream ? stream : stdout; mem_StringStats s = mem_get_string_stats( info ); _mem_magic_strings( info, __func__ ); fprintf( str, "Statistics for string memory manager at %p:\n", info ); fprintf( str, " %d strings, using %d bytes\n", s->count, s->bytes ); xfree( s ); /* rare */ } #if !MAA_MAGIC #define _mem_magic_objects(i,function) /* */ #else static void _mem_magic_objects( objectInfo i, const char *function ) { if (!i) err_internal( function, "mem_Object is null\n" ); if (i->magic != MEM_OBJECTS_MAGIC) err_internal( function, "Incorrect magic: 0x%08x (should be 0x%08x)\n", i->magic, MEM_OBJECTS_MAGIC ); } #endif /* \doc |mem_create_objects| creates a memory storage object for object of |size| bytes. */ mem_Object mem_create_objects( int size ) { objectInfo info = xmalloc( sizeof ( struct objectInfo ) ); #if MAA_MAGIC info->magic = MEM_OBJECTS_MAGIC; #endif info->total = 0; info->used = 0; info->reused = 0; info->size = size; info->stack = stk_create(); info->allocated = stk_create(); return info; } /* \doc |mem_destroy_objects| destroys the memory object returned from |mem_create_objects|. All memory if freed, including that used for the object. Therefore, any pointers to objects stored by |info| will be left dangling. */ void mem_destroy_objects( mem_Object info ) { objectInfo i = (objectInfo)info; _mem_magic_objects( i, __func__ ); #if MAA_MAGIC i->magic = MEM_OBJECTS_MAGIC_FREED; #endif while (!stk_isempty(i->allocated)){ xfree(stk_pop(i->allocated)); } stk_destroy( i->allocated ); stk_destroy( i->stack ); xfree( i ); /* terminal */ } /* \doc |mem_get_object| returns a pointer to a block of memory which is |size| bytes long (as specified in the call to |mem_create_objects|). This block is either newly allocated memory, or is memory which was previously allocated by |mem_get_object| and subsequently freed by |mem_free_object|. */ void *mem_get_object( mem_Object info ) { objectInfo i = (objectInfo)info; void *obj = stk_pop( i->stack ); _mem_magic_objects( i, __func__ ); if (!obj) { obj = xmalloc(i->size); stk_push(i->allocated, obj); ++i->total; } else { ++i->reused; } ++i->used; return obj; } /* \doc |mem_get_empty_object| is exactly like |mem_get_object|, except the memory associated with the object is set to all zeros. */ void *mem_get_empty_object( mem_Object info ) { objectInfo i = (objectInfo)info; void *obj = mem_get_object( info ); memset( obj, 0, i->size ); return obj; } /* \doc |mem_free_object| ``frees'' the object, |obj|, which was previously obtained from |mem_get_object|. The memory associated with the object is not actually freed, but the object pointer is stored on a stack, and is available for subsequent calls to |mem_get_object|. */ void mem_free_object( mem_Object info, void *obj ) { objectInfo i = (objectInfo)info; _mem_magic_objects( i, __func__ ); stk_push( i->stack, obj ); --i->used; } /* \doc |mem_get_object_stats| returns statistics about the memory object pointed to by |info|. The |mem_ObjectStats| structure is shown in \grind{mem_ObjectStats}. */ mem_ObjectStats mem_get_object_stats( mem_Object info ) { objectInfo i = (objectInfo)info; mem_ObjectStats s = xmalloc( sizeof( struct mem_ObjectStats ) ); _mem_magic_objects( i, __func__ ); if (info) { s->total = i->total; s->used = i->used; s->reused = i->reused; s->size = i->size; } else { s->total = 0; s->used = 0; s->reused = 0; s->size = 0; } return s; } /* \doc |mem_print_object_stats| prints the statistics for the memory object pointed to by |info| on the specified |stream|. If |stream| is "NULL", then "stdout" will be used. */ void mem_print_object_stats( mem_Object info, FILE *stream ) { FILE *str = stream ? stream : stdout; mem_ObjectStats s = mem_get_object_stats( info ); _mem_magic_objects( info, __func__ ); fprintf( str, "Statistics for object memory manager at %p:\n", info ); fprintf( str, " %d objects allocated, of which %d are in use\n", s->total, s->used ); fprintf( str, " %d objects have been reused\n", s->reused ); xfree( s ); /* rare */ } libmaa-1.4.4/maa/bit.c0000644000175000017500000000513013457657444014361 0ustar cheusovcheusov/* bit.c -- * Created: Thu Sep 28 18:09:30 1995 by faith@dict.org * Copyright 1995-1996, 2002 Rickard E. Faith (faith@dict.org) * Copyright 2002-2008 Aleksey Cheusov (vle@gmx.net) * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * \section{Bit manipulation routines} * * \intro These are a set of simple routine to manipulate bits in an * integer. * */ #include "maaP.h" /* \doc Set |bit| in |flags|. */ void bit_set( unsigned long *flags, int bit ) { *flags |= (1UL << bit); } /* \doc Clear |bit| in |flags|. */ void bit_clr( unsigned long *flags, int bit ) { *flags &= ~(1UL << bit); } /* \doc Test |bit| in |flags|, returning non-zero if the bit is set and zero if the bit is clear. */ int bit_tst( unsigned long *flags, int bit ) { return (*flags & (1UL << bit)); } /* \doc Return a count of the number of bits set in |flags|. */ int bit_cnt( unsigned long *flags ) { unsigned long x = *flags; #if SIZEOF_LONG == 4 x = (x >> 1 & 0x55555555) + (x & 0x55555555); x = ((x >> 2) & 0x33333333) + (x & 0x33333333); x = ((x >> 4) + x) & 0x0f0f0f0f; x = ((x >> 8) + x); return (x + (x >> 16)) & 0xff; #else #if SIZEOF_LONG == 8 x = (x >> 1 & 0x5555555555555555) + (x & 0x5555555555555555); x = ((x >> 2) & 0x3333333333333333) + (x & 0x3333333333333333); x = ((x >> 4) + x) & 0x0f0f0f0f0f0f0f0f; x = ((x >> 8) + x) & 0x00ff00ff00ff00ff; x = ((x >> 16) + x) & 0x0000ffff0000ffff; return (x + (x >> 32)) & 0xff; #else err_internal( __func__, "Implemented for 32-bit and 64-bit longs, not %d-bit longs\n", SIZEOF_LONG * 8 ); #endif #endif } libmaa-1.4.4/maa/maa.h0000644000175000017500000006064513457657444014362 0ustar cheusovcheusov/* maa.h -- Header file for visible libmaa functions * Created: Sun Nov 19 13:21:21 1995 by faith@dict.org * Copyright 1994-1998, 2002 Rickard E. Faith (faith@dict.org) * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ #ifndef _MAA_H_ #define _MAA_H_ #include #include #ifndef __GNUC__ #define __attribute__(x) #endif /* If MAA_MAGIC is non-zero, important structures will be tagged with a magic number which will be checked for integrity at each access. This uses up more memory, and is slightly slower, but helps debugging quite a bit. */ #ifndef MAA_MAGIC #define MAA_MAGIC 1 #endif #if MAA_MAGIC #define HSH_MAGIC 0x01020304 #define HSH_MAGIC_FREED 0x10203040 #define SET_MAGIC 0x02030405 #define SET_MAGIC_FREED 0x20304050 #define LST_MAGIC 0x03040506 #define LST_MAGIC_FREED 0x30405060 #define MEM_STRINGS_MAGIC 0x23232323 #define MEM_STRINGS_MAGIC_FREED 0x32323232 #define MEM_OBJECTS_MAGIC 0x42424242 #define MEM_OBJECTS_MAGIC_FREED 0x24242424 #define ARG_MAGIC 0xfeedbead #define ARG_MAGIC_FREED 0xefdeebda #define PR_MAGIC 0x0bad7734 #define PR_MAGIC_FREED 0xb0da7743 #define SL_LIST_MAGIC 0xabcdef01 #define SL_LIST_MAGIC_FREED 0xbadcfe10 #define SL_ENTRY_MAGIC 0xacadfeed #define SL_ENTRY_MAGIC_FREED 0xcadaefde #endif /* version.c */ extern const char *maa_revision_string; /* maa.c */ #define MAA_MEMORY (3U<<30|1<<29) /* Print memory usage statistics at exit */ #define MAA_TIME (3U<<30|1<<28) /* Print timer information at exit */ #define MAA_PR (3U<<30|1<<27) /* Debug process routines */ #define MAA_SL (3U<<30|1<<26) /* Debug skip list routines */ #define MAA_PARSE (3U<<30|1<<25) /* Debug parsing */ #define MAA_SRC (3U<<30|1<<24) /* Source library */ extern void maa_init( const char *programName ); extern void maa_shutdown( void ); extern int maa_version_major( void ); extern int maa_version_minor( void ); extern int maa_version_teeny( void ); extern const char *maa_version( void ); /* xmalloc.c */ extern void *xmalloc( size_t size ); extern void *xcalloc( size_t num, size_t size ); extern void *xrealloc( void *pt, size_t size ); extern void xfree( void *pt ); extern char *xstrdup( const char *s ); /* bit.c */ extern void bit_set( unsigned long *flags, int bit ); extern void bit_clr( unsigned long *flags, int bit ); extern int bit_tst( unsigned long *flags, int bit ); extern int bit_cnt( unsigned long *flags ); /* prime.c */ extern int prm_is_prime( unsigned int value ); extern unsigned long prm_next_prime( unsigned int start ); /* hash.c */ typedef void *hsh_HashTable; typedef void *hsh_Position; typedef struct hsh_Stats { unsigned long size; /* Size of table */ unsigned long resizings; /* Number of resizings */ unsigned long entries; /* Total entries in table */ unsigned long buckets_used; /* Number of hash buckets in use */ unsigned long singletons; /* Number of length one lists */ unsigned long maximum_length; /* Maximum list length */ unsigned long retrievals; /* Total number of retrievals */ unsigned long hits; /* Number of retrievals from top of a list */ unsigned long misses; /* Number of unsuccessful retrievals */ } *hsh_Stats; extern hsh_HashTable hsh_create( unsigned long (*hash)( const void * ), int (*compare)( const void *, const void * ) ); extern void hsh_destroy( hsh_HashTable table ); extern int hsh_insert( hsh_HashTable table, const void *key, const void *datum ); extern int hsh_delete( hsh_HashTable table, const void *key ); extern const void *hsh_retrieve( hsh_HashTable table, const void *key ); extern int hsh_iterate( hsh_HashTable table, int (*iterator)( const void *key, const void *datum ) ); extern int hsh_iterate_arg( hsh_HashTable table, int (*iterator)( const void *key, const void *datum, void *arg ), void *arg ); extern hsh_Stats hsh_get_stats( hsh_HashTable table ); extern void hsh_print_stats( hsh_HashTable table, FILE *stream ); extern unsigned long hsh_string_hash( const void *key ); extern unsigned long hsh_pointer_hash( const void *key ); extern int hsh_string_compare( const void *key1, const void *key2 ); extern int hsh_pointer_compare( const void *key1, const void *key2 ); extern void hsh_key_strings(hsh_HashTable); extern hsh_Position hsh_init_position( hsh_HashTable table ); extern hsh_Position hsh_next_position( hsh_HashTable table, hsh_Position position ); extern void *hsh_get_position( hsh_Position position, void **key ); extern int hsh_readonly( hsh_HashTable table, int flag ); #define HSH_POSITION_INIT(P,T) ((P)=hsh_init_position(T)) #define HSH_POSITION_NEXT(P,T) ((P)=hsh_next_position(T,P)) #define HSH_POSITION_OK(P) (P) #define HSH_POSITION_GET(P,K,D) ((D)=hsh_get_position(P,&K)) #define HSH_POSITION_GETKEY(P,K) (hsh_get_position(P,&K)) /* iterate over all (key, datum) pairs, (K,D), in hash table T */ #define HSH_ITERATE(T,P,K,D) \ for (HSH_POSITION_INIT((P),(T)); \ HSH_POSITION_OK(P) && (HSH_POSITION_GET((P),(K),(D)),1); \ HSH_POSITION_NEXT((P),(T))) /* iterate over all keys K, in hash table T */ #define HSH_ITERATE_KEYS(T,P,K) \ for (HSH_POSITION_INIT((P),(T)); \ HSH_POSITION_OK(P) && (HSH_POSITION_GETKEY((P),(K)),1); \ HSH_POSITION_NEXT((P),(T))) /* If the HSH_ITERATE loop is exited before all elements in the table are seen, then HSH_ITERATE_END should be called. Calling this function after complete loops does no harm. */ #define HSH_ITERATE_END(T) hsh_readonly(T,0) /* set.c */ typedef void *set_Set; typedef void *set_Position; typedef struct set_Stats{ unsigned long size; /* Size of table */ unsigned long resizings; /* Number of resizings */ unsigned long entries; /* Total entries in table */ unsigned long buckets_used; /* Number of hash buckets in use */ unsigned long singletons; /* Number of length one lists */ unsigned long maximum_length; /* Maximum list length */ unsigned long retrievals; /* Total number of retrievals */ unsigned long hits; /* Number of retrievals from top of a list */ unsigned long misses; /* Number of unsuccessful retrievals */ } *set_Stats; typedef unsigned long (*set_HashFunction)( const void * ); typedef int (*set_CompareFunction)( const void *, const void * ); extern set_Set set_create( set_HashFunction hash, set_CompareFunction compare ); extern set_HashFunction set_get_hash( set_Set set ); extern set_CompareFunction set_get_compare( set_Set set ); extern void set_destroy( set_Set set ); extern int set_insert( set_Set set, const void *elem ); extern int set_delete( set_Set set, const void *elem ); extern int set_member( set_Set set, const void *elem ); extern int set_iterate( set_Set set, int (*iterator)( const void *key ) ); extern int set_iterate_arg( set_Set set, int (*iterator)( const void *elem, void *arg ), void *arg ); extern set_Set set_add( set_Set set1, set_Set set2 ); extern set_Set set_del( set_Set set1, set_Set set2 ); extern set_Set set_union( set_Set set1, set_Set set2 ); extern set_Set set_inter( set_Set set1, set_Set set2 ); extern set_Set set_diff( set_Set set1, set_Set set2 ); extern int set_equal( set_Set set1, set_Set set2 ); extern set_Stats set_get_stats( set_Set set ); extern void set_print_stats( set_Set set, FILE *stream ); extern int set_count( set_Set set ); extern set_Position set_init_position( set_Set set ); extern set_Position set_next_position( set_Set set, set_Position position ); extern void *set_get_position( set_Position position ); extern int set_readonly( set_Set set, int flag ); #define SET_POSITION_INIT(P,S) ((P)=set_init_position(S)) #define SET_POSITION_NEXT(P,S) ((P)=set_next_position(S,P)) #define SET_POSITION_OK(P) (P) #define SET_POSITION_GET(P,E) ((E)=set_get_position(P)) /* iterate over all entries E in set S */ #define SET_ITERATE(S,P,E) \ for (SET_POSITION_INIT((P),(S)); \ SET_POSITION_OK(P) && (SET_POSITION_GET((P),(E)),1); \ SET_POSITION_NEXT((P),(S))) /* If the SET_ITERATE loop is exited before all elements in the set are seen, then SET_ITERATE_END should be called. Calling this function after complete loops does no harm. */ #define SET_ITERATE_END(S) set_readonly(S,0) /* stack.c */ typedef void *stk_Stack; extern stk_Stack stk_create( void ); extern void stk_destroy( stk_Stack stack ); extern void stk_push( stk_Stack stack, void *datum ); extern void *stk_pop( stk_Stack stack ); extern void *stk_top( stk_Stack stack ); extern int stk_isempty( stk_Stack stack ); /* list.c */ typedef void *lst_List; typedef void *lst_Position; extern lst_List lst_create( void ); extern void lst_destroy( lst_List list ); extern void lst_append( lst_List list, const void *datum ); extern void lst_push( lst_List list, const void *datum ); extern void *lst_pop( lst_List list ); extern void *lst_top( lst_List list ); extern void *lst_nth_get( lst_List list, unsigned int n ); extern void lst_nth_set( lst_List list, unsigned int n, const void *datum ); extern int lst_member( lst_List list, const void *datum ); extern unsigned int lst_length( lst_List list ); extern int lst_iterate( lst_List list, int (*iterator)( const void *datum ) ); extern int lst_iterate_arg( lst_List list, int (*iterator)( const void *datum, void *arg ), void *arg ); extern void lst_truncate( lst_List list, unsigned int length ); extern void lst_truncate_position( lst_List list, lst_Position position ); extern lst_Position lst_init_position( lst_List list ); extern lst_Position lst_last_position( lst_List list ); extern lst_Position lst_next_position( lst_Position position ); extern lst_Position lst_nth_position( lst_List list, unsigned int n ); extern void *lst_get_position( lst_Position position ); extern void lst_set_position( lst_Position position, const void *datum ); extern void lst_dump( lst_List list ); extern void _lst_shutdown( void ); extern long int lst_total_allocated( void ); #define LST_POSITION_INIT(P,L) ((P)=lst_init_position(L)) #define LST_POSITION_NEXT(P) ((P)=lst_next_position(P)) #define LST_POSITION_OK(P) (P) #define LST_POSITION_GET(P,E) ((E)=lst_get_position(P)) /* iterate over all entries E in list L */ #define LST_ITERATE(L,P,E) \ for (LST_POSITION_INIT((P),(L)); \ LST_POSITION_OK(P) && (LST_POSITION_GET((P),(E)),1); \ LST_POSITION_NEXT(P)) /* iterate over all entries in lists L1 and L2 */ #define LST_ITERATE2(L1,L2,P1,P2,E1,E2) \ for (LST_POSITION_INIT((P1),(L1)), LST_POSITION_INIT((P2),(L2)); \ LST_POSITION_OK(P1) && LST_POSITION_OK(P2) \ && (LST_POSITION_GET((P1),(E1)),LST_POSITION_GET((P2),(E2)),1); \ LST_POSITION_NEXT(P1), LST_POSITION_NEXT(P2)) /* error.c */ extern void err_set_program_name( const char *programName ); extern const char *err_program_name( void ); extern void err_fatal( const char *routine, const char *format, ... ) __attribute__((noreturn,format(printf, 2, 3))); extern void err_fatal_errno( const char *routine, const char *format, ... ) __attribute__((noreturn,format(printf, 2, 3))); extern void err_warning( const char *routine, const char *format, ... ) __attribute__((format(printf, 2, 3))); extern void err_internal( const char *routine, const char *format, ... ) __attribute__((noreturn,format(printf, 2, 3))); /* memory.c */ typedef void *mem_String; typedef void *mem_Object; typedef struct mem_StringStats { int count; /* Number of strings or objects */ int bytes; /* Number of bytes allocated */ } *mem_StringStats; typedef struct mem_ObjectStats { int total; /* Total objects requested */ int used; /* Total currently in use */ int reused; /* Total reused */ int size; /* Size of each object */ } *mem_ObjectStats; extern mem_String mem_create_strings( void ); extern void mem_destroy_strings( mem_String info ); extern const char *mem_strcpy( mem_String info, const char *string ); extern const char *mem_strncpy( mem_String info, const char *string, int len ); extern void mem_grow( mem_String info, const char *string, int len ); extern const char *mem_finish( mem_String info ); extern mem_StringStats mem_get_string_stats( mem_String info ); extern void mem_print_string_stats( mem_String info, FILE *stream ); extern mem_Object mem_create_objects( int size ); extern void mem_destroy_objects( mem_Object info ); extern void *mem_get_object( mem_Object info ); extern void *mem_get_empty_object( mem_Object info ); extern void mem_free_object( mem_Object info, void *obj ); extern mem_ObjectStats mem_get_object_stats( mem_Object info ); extern void mem_print_object_stats( mem_Object info, FILE *stream ); /* string.c */ typedef void *str_Pool; typedef hsh_Position str_Position; typedef struct str_Stats { int count; /* Number of strings created */ int bytes; /* Number of bytes allocated */ int retrievals; /* Total number of retrievals */ int hits; /* Number of retrievals from top of a list */ int misses; /* Number of unsuccessful retrievals */ } *str_Stats; extern str_Pool str_pool_create( void ); extern void str_pool_destroy( str_Pool pool ); extern int str_pool_exists( str_Pool pool, const char *s ); extern const char *str_pool_find( str_Pool pool, const char *s ); extern const char *str_pool_copy( str_Pool pool, const char *s ); extern const char *str_pool_copyn( str_Pool pool, const char *s, int length ); extern void str_pool_grow( str_Pool pool, const char *s, int length ); extern const char *str_pool_finish( str_Pool pool ); extern str_Stats str_pool_get_stats( str_Pool pool ); extern void str_pool_print_stats( str_Pool pool, FILE *stream ); extern str_Position str_pool_init_position( str_Pool table ); extern str_Position str_pool_next_position( str_Pool table, str_Position position ); extern void str_pool_get_position( str_Position position, char const *const *key ); #define str_pool_readonly(pool, flag) hsh_readonly ((pool), (flag)) extern int str_pool_iterate( str_Pool pool, int (*iterator)( const char *s ) ); extern int str_pool_iterate_arg( str_Pool pool, int (*iterator)( const char *s, void *arg ), void *arg ); #define STR_POSITION_INIT(P,T) ((P)=str_pool_init_position(T)) #define STR_POSITION_NEXT(P,T) ((P)=str_pool_next_position(T,P)) #define STR_POSITION_OK(P) (P) #define STR_POSITION_GET(P,K) (str_pool_get_position(P,&K), K) /* iterate over all keys (K) in string pool T */ #define STR_ITERATE(T,P,K) \ for (STR_POSITION_INIT((P),(T)); \ STR_POSITION_OK(P) && (STR_POSITION_GET((P),(K)),1); \ STR_POSITION_NEXT((P),(T))) /* If the STR_ITERATE loop is exited before all elements in the table are seen, then STR_ITERATE_END should be called. Calling this function after complete loops does no harm. */ #define STR_ITERATE_END(T) str_readonly(T,0) extern int str_exists( const char *s ); extern const char *str_find( const char *s ); extern const char *str_findn( const char *s, int length ); extern const char *str_copy( const char *s ); extern const char *str_copyn( const char *s, int length ); extern void str_grow( const char *s, int length ); extern const char *str_finish( void ); extern const char *str_unique( const char *prefix ); extern void str_destroy( void ); extern str_Stats str_get_stats( void ); extern void str_print_stats( FILE *stream ); /* debug.c */ typedef unsigned long int dbg_Type; extern void dbg_register( dbg_Type flag, const char *name ); extern void _dbg_register( dbg_Type flag, const char *name ); extern void dbg_destroy( void ); extern void dbg_set( const char *name ); extern void dbg_set_flag( dbg_Type flag ); extern void dbg_unset_flag( dbg_Type flag ); extern int dbg_test( dbg_Type flag ); extern void dbg_list( FILE *stream ); #define PRINTF(flag,arg) if (dbg_test(flag)) { log_info arg; } /* flags.c */ typedef unsigned long int flg_Type; extern void flg_register( flg_Type flag, const char *name ); extern void flg_destroy( void ); extern void flg_set( const char *name ); extern int flg_test( flg_Type flag ); extern void flg_list( FILE *stream ); extern const char *flg_name( flg_Type flag ); /* timer.c */ extern void tim_start( const char *name ); extern void tim_stop( const char *name ); extern void tim_reset( const char *name ); extern double tim_get_real( const char *name ); extern double tim_get_user( const char *name ); extern double tim_get_system( const char *name ); extern void tim_print_timer( FILE *str, const char *name ); extern void tim_print_timers( FILE *str ); extern void _tim_shutdown( void ); /* arg.c */ #define ARG_NO_ESCAPE 0x0001 /* Backslashed are not escape characters */ #define ARG_NO_QUOTE 0x0002 /* Don't use quote marks for quoting */ typedef void *arg_List; extern arg_List arg_create( void ); extern void arg_destroy( arg_List arg ); extern arg_List arg_add( arg_List arg, const char *string ); extern arg_List arg_addn( arg_List arg, const char *string, int length ); extern void arg_grow( arg_List arg, const char *string, int length ); extern arg_List arg_finish( arg_List arg ); extern const char *arg_get( arg_List arg, int item ); extern int arg_count( arg_List arg ); extern void arg_get_vector( arg_List arg, int *argc, char ***argv ); extern arg_List arg_argify( const char *string, int quoteStyle ); /* pr.c */ #define PR_USE_STDIN 0x00000001 #define PR_USE_STDOUT 0x00000002 #define PR_USE_STDERR 0x00000004 #define PR_CREATE_STDIN 0x00000010 #define PR_CREATE_STDOUT 0x00000020 #define PR_CREATE_STDERR 0x00000040 #define PR_STDERR_TO_STDOUT 0x00000100 extern int pr_open( const char *command, int flags, int *infd, int *outfd, int *errfd ); extern int pr_close_nowait( int fd ); extern int pr_close( int fd ); extern int pr_wait( int pid ); extern void _pr_shutdown( void ); extern int pr_spawn( const char *command ); int pr_readwrite( int in, int out, const char *inBuffer, int inLen, char *outBuffer, int outMaxLen ); int pr_filter( const char *command, const char *inBuffer, int inLen, char *outBuffer, int outMaxLen ); /* sl.c */ typedef void *sl_List; typedef int (*sl_Iterator)( const void *datum ); typedef int (*sl_IteratorArg)( const void *datum, void *arg ); extern sl_List sl_create( int (*compare)( const void *key1, const void *key2 ), const void *(*key)( const void *datum ), const char *(*print)( const void *datum ) ); extern void sl_destroy( sl_List list ); extern void _sl_shutdown( void ); extern void sl_insert( sl_List list, const void *datum ); extern void sl_delete( sl_List list, const void *datum ); extern const void *sl_find( sl_List list, const void *key ); extern int sl_iterate( sl_List list, sl_Iterator f ); extern int sl_iterate_arg( sl_List list, sl_IteratorArg f, void *arg ); extern void _sl_dump( sl_List list ); /* text.c */ extern const char * txt_soundex( const char *string ); extern void txt_soundex2( const char *string, char *result /* five chars */ ); /* base64.c */ extern const char *b64_encode( unsigned long val ); extern unsigned long b64_decode( const char *val ); extern unsigned long b64_decode_buf (const char *val, size_t len); /* base26.c */ extern const char *b26_encode( unsigned long val ); extern unsigned long b26_decode( const char *val ); /* source.c */ typedef void *src_Type; typedef struct src_Stats { int lines_used; /* Lines used */ int lines_allocated; /* Lines allocated */ int lines_bytes; /* Bytes required to store lines */ int tokens_total; /* Tokens used */ int tokens_reused; /* Tokens reused */ int tokens_size; /* Size of a token information object */ } *src_Stats; extern void src_create( void ); extern void src_destroy( void ); extern const char *src_line( const char *line, int len ); extern void src_new_file( const char *filename ); extern void src_new_line( int line ); extern void src_advance( int length ); extern void src_cpp_line( const char *line, int length ); extern src_Type src_get( int length ); extern const char *src_filename( src_Type source ); extern int src_linenumber( src_Type source ); extern int src_offset( src_Type source ); extern int src_length( src_Type source ); extern const char *src_source_line( src_Type source ); extern void src_parse_error( FILE *stream, src_Type source, const char *message ); extern void src_print_error( FILE *stream, src_Type source, const char *format, ... ); extern void src_print_message( FILE *str, src_Type source, const char *format, ... ); extern void src_print_line( FILE *stream, src_Type source ); extern src_Stats src_get_stats( void ); extern void src_print_stats( FILE *stream ); /* parse-concrete.c */ extern void prs_register_concrete( const char *symbol, const char *concrete ); extern const char *prs_concrete( const char *symbol ); extern void _prs_shutdown( void ); /* log.c */ #define LOG_OPTION_FULL 1 #define LOG_OPTION_NO_FULL 2 extern void log_syslog( const char *ident ); extern void log_set_facility( const char *facility ); extern const char *log_get_facility( void ); extern void log_option( int option ); extern void log_file( const char *ident, const char *filename ); extern void log_stream( const char *ident, FILE *stream ); extern void log_close( void ); extern void log_error_va( const char *routine, const char *format, va_list ap ); extern void log_error( const char *routine, const char *format, ... ); extern void log_info_va( const char *format, va_list ap ); extern void log_info( const char *format, ... ); #endif libmaa-1.4.4/maa/arggram.txt0000644000175000017500000000224213457657444015621 0ustar cheusovcheusov# STATE_SRC INPUT OUTPUT STATE_DEST ST_SPACES DQ SKIP ST_IN_DQ ST_SPACES SQ SKIP ST_IN_SQ ST_SPACES OTHER INCLUDE ST_IN_TOK ST_SPACES BS SKIP ST_IN_TOK_BS ST_SPACES NULL FINISH EXIT ST_SPACES SPACE FINISH ST_SPACES ST_IN_TOK DQ SKIP ST_IN_DQ ST_IN_TOK SQ SKIP ST_IN_SQ ST_IN_TOK OTHER INCLUDE ST_IN_TOK ST_IN_TOK BS SKIP ST_IN_TOK_BS ST_IN_TOK NULL FINISH EXIT ST_IN_TOK SPACE FINISH ST_SPACES ST_IN_TOK_BS DQ INCLUDE ST_IN_TOK ST_IN_TOK_BS SQ INCLUDE ST_IN_TOK ST_IN_TOK_BS OTHER INCLUDE ST_IN_TOK ST_IN_TOK_BS BS INCLUDE ST_IN_TOK ST_IN_TOK_BS NULL FINISH ERROR ST_IN_TOK_BS SPACE INCLUDE ST_IN_TOK ST_IN_DQ DQ SKIP ST_SPACES ST_IN_DQ SQ INCLUDE ST_IN_DQ ST_IN_DQ OTHER INCLUDE ST_IN_DQ ST_IN_DQ BS INCLUDE ST_IN_DQ ST_IN_DQ NULL FINISH ERROR ST_IN_DQ SPACE INCLUDE ST_IN_DQ ST_IN_SQ DQ INCLUDE ST_IN_SQ ST_IN_SQ SQ SKIP ST_SPACES ST_IN_SQ OTHER INCLUDE ST_IN_SQ ST_IN_SQ BS INCLUDE ST_IN_SQ ST_IN_SQ NULL FINISH ERROR ST_IN_SQ SPACE INCLUDE ST_IN_SQ libmaa-1.4.4/maa/arggram2c0000644000175000017500000000366013457657444015235 0ustar cheusovcheusov#!/usr/bin/awk -f # # converts arggram.txt to arggram.c # usage: arggram2c < arggram.txt > arggram.c # BEGIN { current_state = 0 current_action = 0 current_chartype = 0 } { sub(/[#].*$/, "") } NF == 0 { next } { sub(/EXIT/, "-1", $4) sub(/ERROR/, "-2", $4) if ($1 in states){ $1 = states [$1] }else if ($1 >= 0){ states [$1] = current_state++ $1 = states [$1] } if ($2 in chartypes){ $2 = chartypes [$2] }else{ chartypes [$2] = current_chartype++ $2 = chartypes [$2] } if ($3 in actions){ $3 = actions [$3] }else{ actions [$3] = current_action++ $3 = actions [$3] } if ($4 in states){ $4 = states [$4] }else if ($4 >= 0){ states [$4] = current_state++ $4 = states [$4] } act [$1, $2] = $3 trans [$1, $2] = $4 } END { printf "#define STATE_EXIT (int) (-1)\n" printf "#define STATE_ERROR (int) (-2)\n" printf "\n" } END { for (i in chartypes){ print "#define CHARTYPE_" i " " chartypes [i] } printf "\n#define CHARTYPES_COUNT %i\n\n", current_chartype } END { for (i in actions){ print "#define ACTION_" i " " actions [i] } printf "\n#define ACTIONS_COUNT %i\n\n", current_action } END { print "static const int action [" current_state "] [" current_chartype "] = {" for (i=0; i < current_state; ++i){ if (i) printf ",\n" printf " " for (j=0; j < current_chartype; ++j){ if (j) printf ", " else printf "{ " printf "%i", act [i, j] } printf " }" } print "};\n" } END { print "static const int transition [" current_state "] [" current_chartype "] = {" for (i=0; i < current_state; ++i){ if (i) printf ",\n" printf " " for (j=0; j < current_chartype; ++j){ if (j) printf ", " else printf "{ " printf "%i", trans [i, j] } printf " }" } print "};\n" } libmaa-1.4.4/maa/arg.c0000644000175000017500000001702713457657444014364 0ustar cheusovcheusov/* arg.c -- Argument list support * Created: Sun Jan 7 13:39:29 1996 by faith@dict.org * Copyright 1996-1997, 2002 Rickard E. Faith (faith@dict.org) * Copyright 2002-2008 Aleksey Cheusov (vle@gmx.net) * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * \section{Argument List Routines} * * \intro Argument lists are vectors of pointers to strings (e.g., the * standard |char **argv|). These routines manage the efficient creation, * manipulation, and deletion of these sorts of lists. * */ #include "maaP.h" typedef struct Arg { #if MAA_MAGIC unsigned magic; #endif int argc; /* Current count */ int argm; /* Maximum count */ char **argv; /* Vector */ mem_String object; } *Arg; static void _arg_check( arg_List arg, const char *function ) { Arg a = (Arg)arg; if (!a) err_internal( function, "arg is null\n" ); #if MAA_MAGIC if (a->magic != ARG_MAGIC) err_internal( function, "Magic match failed: 0x%08x (should be 0x%08x)\n", a->magic, ARG_MAGIC ); #endif } /* \doc Create an |arg_List| object. */ arg_List arg_create( void ) { Arg a = xmalloc( sizeof( struct Arg ) ); #if MAA_MAGIC a->magic = ARG_MAGIC; #endif a->argc = 0; a->argm = 2; a->argv = xmalloc( a->argm * sizeof( char ** ) ); a->argv[0] = NULL; a->object = mem_create_strings(); return a; } /* \doc Free all memory associated with |arg|, including the memory used for the strings. */ void arg_destroy( arg_List arg ) { Arg a = (Arg)arg; _arg_check( a, __func__ ); mem_destroy_strings( a->object ); xfree( a->argv ); #if MAA_MAGIC a->magic = ARG_MAGIC_FREED; #endif xfree( a ); } /* \doc Add |string| as the next item in |arg|. */ arg_List arg_add( arg_List arg, const char *string ) { Arg a = (Arg)arg; const char *new; _arg_check( a, __func__ ); new = mem_strcpy( a->object, string ); if (a->argm <= a->argc + 2 ) a->argv = xrealloc( a->argv, sizeof( char **) * (a->argm *= 2) ); a->argv[a->argc++] = (char *)__UNCONST(new); /* discard const */ a->argv[a->argc] = NULL; return a; } /* \doc Add |length| characters of |string| as the next item in |arg|. A terminating "NULL" is added to the copied |string|. */ arg_List arg_addn( arg_List arg, const char *string, int length ) { Arg a = (Arg)arg; const char *new; _arg_check( a, __func__ ); new = mem_strncpy( a->object, string, length ); if (a->argm <= a->argc + 2 ) a->argv = xrealloc( a->argv, sizeof( char **) * (a->argm *= 2) ); a->argv[a->argc++] = (char *)__UNCONST(new); /* discard const */ a->argv[a->argc] = NULL; return a; } /* \doc Grow the next item of |arg| with |length| characters of |string|. Several calls to |arg_grow| should be followed by a single call to |arg_finish| without any intervening calls to other functions which modify |arg|. */ void arg_grow( arg_List arg, const char *string, int length ) { Arg a = (Arg)arg; _arg_check( a, __func__ ); mem_grow( a->object, string, length ); } /* \doc Finish the growth of the next item in |arg| started by |arg_grow|. */ arg_List arg_finish( arg_List arg ) { Arg a = (Arg)arg; const char *new; _arg_check( a, __func__ ); new = mem_finish( a->object ); if (a->argm <= a->argc + 2 ) a->argv = xrealloc( a->argv, sizeof( char **) * (a->argm *= 2) ); a->argv[a->argc++] = (char *)__UNCONST(new); /* discard const */ a->argv[a->argc] = NULL; return a; } /* \doc Return |item| from |arg|. |arg| is 0-based. */ const char *arg_get( arg_List arg, int item ) /* FIXME! inline? */ { Arg a = (Arg)arg; _arg_check( a, __func__ ); if (item < 0 || item >= a->argc) err_internal( __func__, "Request for item %d in list containing %d items\n", item, a->argc ); return a->argv[ item ]; } /* \doc Return the number of items in |arg|. */ int arg_count( arg_List arg ) /* FIXME! inline? */ { _arg_check( arg, __func__ ); return ((Arg)arg)->argc; } /* \doc Get an |argc| and |argv| from |arg|. These are suitable for use in calls to |exec|. The |argc|+1 item in |argv| is "NULL". */ void arg_get_vector( arg_List arg, int *argc, char ***argv ) { Arg a = (Arg)arg; _arg_check( a, __func__ ); *argc = a->argc; *argv = a->argv; } /* \doc Break up |string| into arguments, placing them as items in |arg|. Items within single or double quotes may contain spaces. The quotes are stripped as in shell argument processing. Backslash followed by outside quoted or double-quote subtokens is treated just as */ #include "arggram.c" #if ACTIONS_COUNT != 3 #error Modify arg_argify function or change arggram.txt #endif #if CHARTYPES_COUNT != 6 #error Modify char2char_type function or change arggram.txt #endif static int char2char_type (int quoteStyle, char ch) { switch (ch){ case '"': if (ARG_NO_QUOTE & quoteStyle) return CHARTYPE_OTHER; else return CHARTYPE_DQ; case '\'': if (ARG_NO_QUOTE & quoteStyle) return CHARTYPE_OTHER; else return CHARTYPE_SQ; case '\\': if (ARG_NO_ESCAPE & quoteStyle) return CHARTYPE_OTHER; else return CHARTYPE_BS; case ' ': case '\t': case '\r': case '\v': case '\n': return CHARTYPE_SPACE; case '\0': return CHARTYPE_NULL; default: return CHARTYPE_OTHER; } } arg_List arg_argify( const char *string, int quoteStyle ) { Arg a = arg_create(); const char *last = NULL; const char *pt = string; char ch; int ch_type; int state = 0; int curr_act = -1; do { ch = *pt; ch_type = char2char_type (quoteStyle, ch); curr_act = action [state] [ch_type]; /* fprintf (stderr, "%i -- %i(%c) / %i --> %i\n", state, ch_type, ch, curr_act, transition [state] [ch_type]);*/ state = transition [state] [ch_type]; switch (curr_act){ case ACTION_INCLUDE: if (!last) last = pt; break; case ACTION_SKIP: if (last){ arg_grow (a, last, pt - last); } last = pt + 1; break; case ACTION_FINISH: /* assert (last);*/ if (last){ arg_grow (a, last, pt - last); arg_finish (a); last = NULL; } break; default: abort (); } ++pt; }while (ch && state >= 0); switch (state){ case -1: /* Fine! Normal exit*/ break; case -2: /* Parsing error */ break; default: /* Oooops! */ err_internal( __func__, "arg.c:arg_argify is buggy!!!:\n"); } return a; } libmaa-1.4.4/maa/set.c0000644000175000017500000005331513457657444014406 0ustar cheusovcheusov/* set.c -- Set routines for Khepera * Created: Wed Nov 9 13:31:24 1994 by faith@dict.org * Copyright 1994-1997, 2002 Rickard E. Faith (faith@dict.org) * Copyright 2002-2008 Aleksey Cheusov (vle@gmx.net) * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * \section{Set Routines} * * \intro The set implementation is similar to the hash table * implementation, except that the set object does not associate a |datum| * with a |key|. For sets, keys are called elements. All of the hash * table functions are supported, with the addition of a membership test * and several set operations. * * The underlying data structure is a hash table of prime length, with * self-organizing linked lists \cite[pp.~398--9]{faith:Knuth73c} used for * collision resolution. The hash table automatically grows as necessary * to preserve efficient access. * */ #include "maaP.h" typedef struct bucket { const void *elem; unsigned int hash; struct bucket *next; } *bucketType; typedef struct set { #if MAA_MAGIC int magic; #endif unsigned long prime; unsigned long entries; bucketType *buckets; unsigned long resizings; unsigned long retrievals; unsigned long hits; unsigned long misses; unsigned long (*hash)( const void * ); int (*compare)( const void *, const void * ); int readonly; } *setType; static void _set_check( setType t, const char *function ) { if (!t) err_internal( function, "set is null\n" ); #if MAA_MAGIC if (t->magic != SET_MAGIC) err_internal( function, "Bad magic: 0x%08x (should be 0x%08x)\n", t->magic, SET_MAGIC ); #endif } static set_Set _set_create( unsigned long seed, set_HashFunction hash, set_CompareFunction compare ) { setType t; unsigned long i; unsigned long prime = prm_next_prime( seed ); t = xmalloc( sizeof( struct set ) ); #if MAA_MAGIC t->magic = SET_MAGIC; #endif t->prime = prime; t->entries = 0; t->buckets = xmalloc( t->prime * sizeof( struct bucket ) ); t->resizings = 0; t->retrievals = 0; t->hits = 0; t->misses = 0; t->hash = hash ? hash : hsh_string_hash; t->compare = compare ? compare : hsh_string_compare; t->readonly = 0; for (i = 0; i < t->prime; i++) t->buckets[i] = NULL; return t; } /* \doc The |set_create| function initilizes a set object. Elements are pointers to "void". The internal representation of the set will grow automatically when an insertion is performed and the table is more than half full. The |hash| function should take a pointer to a |elem| and return an "unsigned int". If |hash| is "NULL", then the |elem| is assumed to be a pointer to a null-terminated string, and the function shown in \grindref{fig:hshstringhash} will be used for |hash|. The |compare| function should take a pair of pointers to elements and return zero if the elements are the same and non-zero if they are different. If |compare| is "NULL", then the elements are assumed to point to null-terminated strings, and the |strcmp| function will be used for |compare|. Additionally, the |hsh_pointer_hash| and |hsh_pointer_compare| functions are available and can be used to treat the \emph{value} of the "void" pointer as the element. These functions are often useful for maintaining sets of objects. */ set_Set set_create( set_HashFunction hash, set_CompareFunction compare ) { return _set_create( 0, hash, compare ); } set_HashFunction set_get_hash( set_Set set ) { setType t = (setType)set; _set_check( t, __func__ ); return t->hash; } set_CompareFunction set_get_compare( set_Set set ) { setType t = (setType)set; _set_check( t, __func__ ); return t->compare; } static void _set_destroy_buckets( set_Set set ) { unsigned long i; setType t = (setType)set; _set_check( t, __func__ ); for (i = 0; i < t->prime; i++) { bucketType b = t->buckets[i]; while (b) { bucketType next = b->next; xfree( b ); /* terminal */ b = next; } } xfree( t->buckets ); /* terminal */ t->buckets = NULL; } static void _set_destroy_table( set_Set set ) { setType t = (setType)set; _set_check( t, __func__ ); #if MAA_MAGIC t->magic = SET_MAGIC_FREED; #endif xfree( t ); /* terminal */ } /* \doc |set_destroy| frees all of the memory associated with the set object. The memory used by elements is \emph{not} freed---this memory is the responsibility of the user. However, a call to |set_iterate| can be used to free this memory \emph{immediately} before a call to |set_destroy|. */ void set_destroy( set_Set set ) { setType t = (setType)set; _set_check( t, __func__ ); if (t->readonly) err_internal( __func__, "Attempt to destroy readonly set\n" ); _set_destroy_buckets( set ); _set_destroy_table( set ); } static void _set_insert( set_Set set, unsigned int hash, const void *elem ) { setType t = (setType)set; unsigned long h = hash % t->prime; bucketType b; _set_check( t, __func__ ); b = xmalloc( sizeof( struct bucket ) ); b->hash = hash; b->elem = elem; b->next = NULL; if (t->buckets[h]) b->next = t->buckets[h]; t->buckets[h] = b; ++t->entries; } /* \doc |set_insert| inserts a new |elem| into the |set|. If the insertion is successful, zero is returned. If the |elem| already exists, 1 is returned. If the internal representation of the set becomes more than half full, its size is increased automatically. At present, this requires that all of the element pointers are copied into a new set. Rehashing is not required, however, since the hash values are stored for each element. */ int set_insert( set_Set set, const void *elem ) { setType t = (setType)set; unsigned long hashValue = t->hash( elem ); unsigned long h; _set_check( t, __func__ ); if (t->readonly) err_internal( __func__, "Attempt to insert into readonly set\n" ); /* Keep table less than half full */ if (t->entries * 2 > t->prime) { setType new = _set_create( t->prime * 3, t->hash, t->compare ); unsigned long i; for (i = 0; i < t->prime; i++) { if (t->buckets[i]) { bucketType pt; for (pt = t->buckets[i]; pt; pt = pt->next) _set_insert( new, pt->hash, pt->elem ); } } /* fixup values */ _set_destroy_buckets( t ); t->prime = new->prime; t->buckets = new->buckets; _set_destroy_table( new ); ++t->resizings; } h = hashValue % t->prime; if (t->buckets[h]) { /* Assert uniqueness */ bucketType pt; for (pt = t->buckets[h]; pt; pt = pt->next) if (!t->compare( pt->elem, elem )) return 1; } _set_insert( t, hashValue, elem ); return 0; } /* \doc |set_delete| removes an |elem| from the |set|. Zero is returned if the |elem| was present. Otherwise, 1 is returned. */ int set_delete( set_Set set, const void *elem ) { setType t = (setType)set; unsigned long h = t->hash( elem ) % t->prime; _set_check( t, __func__ ); if (t->readonly) err_internal( __func__, "Attempt to delete from readonly set\n" ); if (t->buckets[h]) { bucketType pt; bucketType prev; for (prev = NULL, pt = t->buckets[h]; pt; prev = pt, pt = pt->next) if (!t->compare( pt->elem, elem )) { --t->entries; if (!prev) t->buckets[h] = pt->next; else prev->next = pt->next; xfree( pt ); return 0; } } return 1; } /* \doc |set_member| returns 1 if |elem| is in |set|. Otherwise, zero is returned. */ int set_member( set_Set set, const void *elem ) { setType t = (setType)set; unsigned long h = t->hash( elem ) % t->prime; _set_check( t, __func__ ); ++t->retrievals; if (t->buckets[h]) { bucketType pt; bucketType prev; for (prev = NULL, pt = t->buckets[h]; pt; prev = pt, pt = pt->next) if (!t->compare( pt->elem, elem )) { if (!prev) { ++t->hits; } else if (!t->readonly) { /* Self organize */ prev->next = pt->next; pt->next = t->buckets[h]; t->buckets[h] = pt; } return 1; } } ++t->misses; return 0; } /* \doc |set_iterate| is used to iterate a function over every |elem| in the |set|. The function, |iterator|, is passed each |elem|. If |iterator| returns a non-zero value, the iterations stop, and |set_iterate| returns. Note that the elements are in some arbitrary order, and that this order may change between two successive calls to |set_iterate|. */ int set_iterate( set_Set set, int (*iterator)( const void *elem ) ) { setType t = (setType)set; unsigned long i; int savedReadonly; _set_check( t, __func__ ); savedReadonly = t->readonly; t->readonly = 1; for (i = 0; i < t->prime; i++) { if (t->buckets[i]) { bucketType pt; for (pt = t->buckets[i]; pt; pt = pt->next) if (iterator( pt->elem )) { t->readonly = savedReadonly; return 1; } } } t->readonly = savedReadonly; return 0; } /* \doc |set_iterate_arg| is used to iterate a function over every |elem| in the |set|. The function, |iterator|, is passed each |elem|. If |iterator| returns a non-zero value, the iterations stop, and |set_iterate| returns. Note that the elements are in some arbitrary order, and that this order may change between two successive calls to |set_iterate|. */ int set_iterate_arg( set_Set set, int (*iterator)( const void *elem, void *arg ), void *arg ) { setType t = (setType)set; unsigned long i; int savedReadonly; _set_check( t, __func__ ); savedReadonly = t->readonly; t->readonly = 1; for (i = 0; i < t->prime; i++) { if (t->buckets[i]) { bucketType pt; for (pt = t->buckets[i]; pt; pt = pt->next) if (iterator( pt->elem, arg )) { t->readonly = savedReadonly; return 1; } } } t->readonly = savedReadonly; return 0; } /* \doc |set_init_position| returns a position marker for some arbitary first element in the set. This marker can be used with |set_next_position| and |set_get_position|. */ set_Position set_init_position( set_Set set ) { setType t = (setType)set; unsigned long i; _set_check( t, __func__ ); for (i = 0; i < t->prime; i++) if (t->buckets[i]) { t->readonly = 1; return t->buckets[i]; } return NULL; } /* \doc |set_next_position| returns a position marker for the next element in the set. Elements are in arbitrary order based on their positions in the hash table. */ set_Position set_next_position( set_Set set, set_Position position ) { setType t = (setType)set; bucketType b = (bucketType)position; unsigned long i; unsigned long h; _set_check( t, __func__ ); if (!b) { t->readonly = 0; return NULL; } if (b->next) return b->next; for (h = b->hash % t->prime, i = h + 1; i < t->prime; i++) if (t->buckets[i]) return t->buckets[i]; t->readonly = 0; return NULL; } /* \doc |set_get_position| returns the element associated with the |position| marker, or "NULL" if there is no such element. */ void *set_get_position( set_Position position ) { bucketType b = (bucketType)position; if (!b) return NULL; return __UNCONST(b->elem); /* Discard const */ } /* \doc |set_readonly| sets the |readonly| flag for the |set| to |flag|. |flag| should be 0 or 1. The value of the previous flag is returned. When a set is marked as readonly, self-organization of the bucket-overflow lists will not take place, and any attempt to modify the list (e.g., insertion or deletion) will result in an error. */ int set_readonly( set_Set set, int flag ) { setType t = (setType)set; int current; _set_check( t, __func__ ); current = t->readonly; t->readonly = flag; return current; } /* \doc |set_add| returns |set1|, which now contains all of the elements in |set1| and |set2|. Only pointers to elements are copied, \emph{not} the data pointed (this has memory management implications). The |hash| and |compare| functions must be identical for the two sets. |set2| is not changed. */ set_Set set_add( set_Set set1, set_Set set2 ) { setType t1 = (setType)set1; setType t2 = (setType)set2; unsigned long i; _set_check( t1, __func__ ); _set_check( t2, __func__ ); if (t1->hash != t2->hash) err_fatal( __func__, "Sets do not have identical hash functions\n" ); if ( t1->compare != t2->compare ) err_fatal( __func__, "Sets do not have identical comparison functions\n" ); for (i = 0; i < t2->prime; i++) { if (t2->buckets[i]) { bucketType pt; for (pt = t2->buckets[i]; pt; pt = pt->next) set_insert( set1, pt->elem ); } } return set1; } /* \doc |set_del| returns |set1|, which now contains all of the elements in |set1| other than those in |set2|. Only pointers to elements are copied, \emph{not} the data pointed (this has memory management implications). The |hash| and |compare| functions must be identical for the two sets. |set2| is not changed. */ set_Set set_del( set_Set set1, set_Set set2 ) { setType t1 = (setType)set1; setType t2 = (setType)set2; unsigned long i; _set_check( t1, __func__ ); _set_check( t2, __func__ ); if (t1->hash != t2->hash) err_fatal( __func__, "Sets do not have identical hash functions\n" ); if ( t1->compare != t2->compare ) err_fatal( __func__, "Sets do not have identical comparison functions\n" ); for (i = 0; i < t2->prime; i++) { if (t2->buckets[i]) { bucketType pt; for (pt = t2->buckets[i]; pt; pt = pt->next) set_delete( set1, pt->elem ); } } return set1; } /* \doc |set_union| returns a new set which is the union of |set1| and |set2|. Only pointers to elements are copied, \emph{not} the data pointed (this has memory management implications). The |hash| and |compare| functions must be identical for the two sets. */ set_Set set_union( set_Set set1, set_Set set2 ) { setType t1 = (setType)set1; setType t2 = (setType)set2; set_Set set; unsigned long i; _set_check( t1, __func__ ); _set_check( t2, __func__ ); if (t1->hash != t2->hash) err_fatal( __func__, "Sets do not have identical hash functions\n" ); if ( t1->compare != t2->compare ) err_fatal( __func__, "Sets do not have identical comparison functions\n" ); set = set_create( t1->hash, t1->compare ); for (i = 0; i < t1->prime; i++) { if (t1->buckets[i]) { bucketType pt; for (pt = t1->buckets[i]; pt; pt = pt->next) set_insert( set, pt->elem ); } } for (i = 0; i < t2->prime; i++) { if (t2->buckets[i]) { bucketType pt; for (pt = t2->buckets[i]; pt; pt = pt->next) set_insert( set, pt->elem ); } } return set; } /* \doc |set_inter| returns a new set which is the intersection of |set1| and |set2|. Only pointers to elements are copied, \emph{not} the data pointed (this has memory management implications). The |hash| and |compare| functions must be identical for the two sets. */ set_Set set_inter( set_Set set1, set_Set set2 ) { setType t1 = (setType)set1; setType t2 = (setType)set2; set_Set set; unsigned long i; int savedReadonly; _set_check( t1, __func__ ); _set_check( t2, __func__ ); if (t1->hash != t2->hash) err_fatal( __func__, "Sets do not have identical hash functions\n" ); if ( t1->compare != t2->compare ) err_fatal( __func__, "Sets do not have identical comparison functions\n" ); set = set_create( t1->hash, t1->compare ); savedReadonly = t2->readonly; t2->readonly = 1; /* save time on set_member */ for (i = 0; i < t1->prime; i++) { if (t1->buckets[i]) { bucketType pt; for (pt = t1->buckets[i]; pt; pt = pt->next) if (set_member( t2, pt->elem )) set_insert( set, pt->elem ); } } t2->readonly = savedReadonly; return set; } /* \doc |set_diff| returns a new set which is the difference resulting from removing every element in |set2| from the elements in |set1|. Only pointers to elements are copied, \emph{not} the data pointed (this has memory management implications). The |hash| and |compare| functions must be identical for the two sets. */ set_Set set_diff( set_Set set1, set_Set set2 ) { setType t1 = (setType)set1; setType t2 = (setType)set2; set_Set set; unsigned long i; int savedReadonly; _set_check( t1, __func__ ); _set_check( t2, __func__ ); if (t1->hash != t2->hash) err_fatal( __func__, "Sets do not have identical hash functions\n" ); if ( t1->compare != t2->compare ) err_fatal( __func__, "Sets do not have identical comparison functions\n" ); set = set_create( t1->hash, t1->compare ); savedReadonly = t2->readonly; t2->readonly = 1; /* save time on set_member */ for (i = 0; i < t1->prime; i++) { if (t1->buckets[i]) { bucketType pt; for (pt = t1->buckets[i]; pt; pt = pt->next) if (!set_member( t2, pt->elem )) set_insert( set, pt->elem ); } } t2->readonly = savedReadonly; return set; } /* \doc |set_equal| returns non-zero if |set1| and |set2| contain the same number of elements, and all of the elements in |set1| are also in |set2|. The |hash| and |compare| functions must be identical for the two sets. */ int set_equal( set_Set set1, set_Set set2 ) { setType t1 = (setType)set1; setType t2 = (setType)set2; unsigned long i; int savedReadonly; _set_check( t1, __func__ ); _set_check( t2, __func__ ); if (t1->hash != t2->hash) err_fatal( __func__, "Sets do not have identical hash functions\n" ); if ( t1->compare != t2->compare ) err_fatal( __func__, "Sets do not have identical comparison functions\n" ); if (t1->entries != t2->entries) return 0; /* not equal */ savedReadonly = t2->readonly; t2->readonly = 1; /* save time on set_member */ for (i = 0; i < t1->prime; i++) { if (t1->buckets[i]) { bucketType pt; for (pt = t1->buckets[i]; pt; pt = pt->next) if (!set_member( t2, pt->elem )) { t2->readonly = savedReadonly; return 0; /* not equal */ } } } t2->readonly = savedReadonly; return 1; /* equal */ } int set_count( set_Set set ) { setType t = (setType)set; _set_check( t, __func__ ); return t->entries; } /* \doc |set_get_stats| returns statistics about the |set|. The |set_Stats| structure is shown in \grind{set_Stats}. */ set_Stats set_get_stats( set_Set set ) { setType t = (setType)set; set_Stats s = xmalloc( sizeof( struct set_Stats ) ); unsigned long i; unsigned long count; _set_check( t, __func__ ); s->size = t->prime; s->resizings = t->resizings; s->entries = 0; s->buckets_used = 0; s->singletons = 0; s->maximum_length = 0; s->retrievals = t->retrievals; s->hits = t->hits; s->misses = t->misses; for (i = 0; i < t->prime; i++) { if (t->buckets[i]) { bucketType pt; ++s->buckets_used; for (count = 0, pt = t->buckets[i]; pt; ++count, pt = pt->next); if (count == 1) ++s->singletons; s->maximum_length = max( s->maximum_length, count ); s->entries += count; } } if ( t->entries != s->entries ) err_internal( __func__, "Incorrect count for entries: %lu vs. %lu\n", t->entries, s->entries ); return s; } /* \doc |set_print_stats| prints the statistics for |set| on the specified |stream|. If |stream| is "NULL", then "stdout" will be used. */ void set_print_stats( set_Set set, FILE *stream ) { setType t = (setType)set; FILE *str = stream ? stream : stdout; set_Stats s = set_get_stats( t ); _set_check( t, __func__ ); fprintf( str, "Statistics for set at %p:\n", set ); fprintf( str, " %lu resizings to %lu total\n", s->resizings, s->size ); fprintf( str, " %lu entries (%lu buckets used, %lu without overflow)\n", s->entries, s->buckets_used, s->singletons ); fprintf( str, " maximum list length is %lu", s->maximum_length ); if (s->buckets_used) fprintf( str, " (optimal is %.1f)\n", (double)s->entries / (double)s->buckets_used ); else fprintf( str, "\n" ); fprintf( str, " %lu retrievals (%lu from top, %lu failed)\n", s->retrievals, s->hits, s->misses ); xfree( s ); /* rare */ } libmaa-1.4.4/maa/sl.c0000644000175000017500000003254313457657444014231 0ustar cheusovcheusov/* sl.c -- Skip lists * Created: Sun Feb 18 11:51:06 1996 by faith@dict.org * Copyright 1996-1997, 2002 Rickard E. Faith (faith@dict.org) * Copyright 1996 Lars Nyland (nyland@cs.unc.edu) * Copyright 2002-2008 Aleksey Cheusov (vle@gmx.net) * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * \section{Skip List Routines} * * \intro Skip list support is provided as an alternative to balanced * trees. Skip lists have the advantage that an inorder walk through the * list is possible in the face of additions and deletions from the list. * Balanced tree, algorithms, in contrast, make this sort of traversal * impossible because of the rotations that are necessary for the * balancing. * * For these lists, the |key| is derivable from the |datum| that is stored * in the list. This makes it possible for the actualy keys to change, as * long as the ordering of the data stay the same. This is essential for * the use of skip lists for \khepera trees. * * This code is derived from \cite{faith:Pugh90} and from a skip list * implementation by Lars Nyland. * */ #include "maaP.h" #define SL_DEBUG 0 /* Debug like crazy */ typedef struct _sl_Entry { #if MAA_MAGIC int magic; #endif const void *datum; #if SL_DEBUG int levels; /* levels for this entry */ #endif struct _sl_Entry *forward[1]; /* variable sized array */ } *_sl_Entry; typedef struct _sl_List { #if MAA_MAGIC unsigned magic; #endif int level; int count; /* number of data */ struct _sl_Entry *head; int (*compare)( const void *key1, const void *key2 ); const void *(*key)( const void *datum ); const char *(*print)( const void *datum ); } *_sl_List; static mem_Object _sl_Memory; #define _sl_MaxLevel 16 #define PRINT(l,d) ((l)->print ? (l)->print(d) : _sl_print(d)) static void _sl_check_list( _sl_List l, const char *function ) { if (!l) err_internal( function, "skip list is null\n" ); #if MAA_MAGIC if (l->magic != SL_LIST_MAGIC) err_internal( function, "Bad magic: 0x%08x (should be 0x%08x)\n", l->magic, SL_LIST_MAGIC ); #endif } #if !SL_DEBUG #define _sl_check_entry(e,f) /* */ #else static int _sl_check_entry( _sl_Entry e, const char *function ) { if (!e) err_internal( function, "entry is null\n" ); #if MAA_MAGIC if (e->magic != SL_ENTRY_MAGIC) { err_warning( function, "Bad magic: 0x%08x (should be 0x%08x)\n", e->magic, SL_ENTRY_MAGIC ); return 1; } #endif return 0; } #endif #if !SL_DEBUG #define _sl_check(x) /* */ #else static void _sl_check( sl_List list ) { _sl_List l = (_sl_List)list; int count = 0; _sl_Entry pt; _sl_check_list( list, __func__ ); for (pt = l->head->forward[0]; pt; pt = pt->forward[0] ) { ++count; if (pt && pt->forward[0] && l->compare( l->key( pt->datum ), l->key( pt->forward[0]->datum ) ) >= 0) { _sl_dump( list ); err_internal( __func__, "Datum 0x%p=%lu >= 0x%p=%lu\n", l->key( pt->datum ), (unsigned long)l->key( pt->datum ), l->key( pt->forward[0]->datum ), (unsigned long)l->key( pt->forward[0]->datum ) ); } } if (count != l->count) { err_internal( __func__, "Count should be %d instead of %d\n", count, l->count ); } } #endif static _sl_Entry _sl_create_entry( int maxLevel, const void *datum ) { _sl_Entry e; if (maxLevel > _sl_MaxLevel) err_internal( __func__, "level %d > %d\n", maxLevel, _sl_MaxLevel ); e = xmalloc( sizeof( struct _sl_Entry ) + (maxLevel + 1) * sizeof( _sl_Entry ) ); #if MAA_MAGIC e->magic = SL_ENTRY_MAGIC; #endif e->datum = datum; #if SL_DEBUG e->levels = maxLevel + 1; #endif return e; } /* \doc |sl_create| initializes a skip list. The |compare| function returns -1, 0, or 1 depending on the ordering of |key1| and |key2|. The |key| function converts a |datum| into a |key|. The |print| function returns a string representation of |datum|, and is allowed to always return a pointer to the same static buffer. |compare| must be provided. If |key| is not provided, then |datum| will be used as the key. If |print| is not provided, then the |datum| pointer will be printed when necessary. */ sl_List sl_create( int (*compare)( const void *key1, const void *key2 ), const void *(*key)( const void *datum ), const char *(*print)( const void *datum ) ) { _sl_List l; int i; if (!_sl_Memory) { _sl_Memory = mem_create_objects( sizeof( struct _sl_List ) ); } if (!compare) err_internal( __func__, "compare function is NULL\n" ); if (!key) err_internal( __func__, "key function is NULL\n" ); l = mem_get_object( _sl_Memory ); #if MAA_MAGIC l->magic = SL_LIST_MAGIC; #endif l->level = 0; l->head = _sl_create_entry( _sl_MaxLevel, NULL ); l->compare = compare; l->key = key; l->print = print; l->count = 0; for (i = 0; i <= _sl_MaxLevel; i++) l->head->forward[i] = NULL; return l; } /* \doc |sl_destroy| removes all of the memory associated with the maintenance of the specified skip |list|. The pointer to the user-defined |datum| is "not" freed -- this is the responsibility of the user. */ void sl_destroy( sl_List list ) { _sl_List l = (_sl_List)list; _sl_Entry e; _sl_Entry next; _sl_check_list( list, __func__ ); for (e = l->head; e; e = next) { next = e->forward[0]; #if MAA_MAGIC e->magic = SL_ENTRY_MAGIC_FREED; #endif xfree( e ); } #if MAA_MAGIC l->magic = SL_LIST_MAGIC_FREED; #endif mem_free_object( _sl_Memory, l ); } /* \doc |_sl_shutdown| is used to free the internal data structures used by the skip list package. Since it is called automatically by \libmaa, it should not be called explicitly by the user. */ void _sl_shutdown( void ) { if (_sl_Memory) mem_destroy_objects( _sl_Memory ); _sl_Memory = NULL; } #if 0 static int rnd( void ) /* generate bit stream */ { static int i = 0; i = !i; return i; } #endif static int _sl_random_level( void ) { int level = 1; /* FIXME! Assumes random() is. We should use our own random() to make sure. This also assumes that p == 0.5, which is probably reasonable, but maybe should be a user-defined parameter. */ while ((random() & 0x80) && level < _sl_MaxLevel) ++level; return level; } static const char *_sl_print( const void *datum ) { static char buf[1024]; sprintf( buf, "%p", datum ); return buf; } static _sl_Entry _sl_locate( _sl_List l, const void *key, _sl_Entry update[] ) { int i; _sl_Entry pt; _sl_check( l ); for (i = l->level, pt = l->head; i >= 0; i--) { while (pt->forward[i] && l->compare( l->key( pt->forward[i]->datum ), key ) < 0) pt = pt->forward[i]; update[i] = pt; } return pt->forward[0]; } /* \doc Insert |datum| into |list|. */ void sl_insert( sl_List list, const void *datum ) { _sl_List l = (_sl_List)list; _sl_Entry update[_sl_MaxLevel + 1]; _sl_Entry pt; const void *key; int i; int level = _sl_random_level(); _sl_Entry entry; _sl_check_list( list, __func__ ); key = l->key( datum ); pt = _sl_locate( l, key, update ); if (pt && !l->compare( l->key( pt->datum ), key )) err_internal( __func__, "Datum \"%s\" is already in list\n", PRINT(l,datum) ); if (level > l->level) { level = ++l->level; update[level] = l->head; } entry = _sl_create_entry( level, datum ); /* Fixup forward pointers */ for (i = 0; i <= level; i++) { entry->forward[i] = update[i]->forward[i]; update[i]->forward[i] = entry; } ++l->count; _sl_check( list ); } /* \doc Delete |datum| from |list|. */ void sl_delete( sl_List list, const void *datum ) { _sl_List l = (_sl_List)list; _sl_Entry update[_sl_MaxLevel + 1]; _sl_Entry pt; const void *key; int i; _sl_check_list( list, __func__ ); key = l->key( datum ); pt = _sl_locate( l, key, update ); if (!pt || l->compare( l->key( pt->datum ), key )) { _sl_dump( list ); err_internal( __func__, "Datum \"%s\" is not in list\n", PRINT(l,datum) ); } /* Fixup forward pointers */ for (i = 0; i <= l->level; i++) { if (update[i]->forward[i] == pt) update[i]->forward[i] = pt->forward[i]; } xfree( pt ); while (l->level && !l->head->forward[ l->level ]) --l->level; --l->count; _sl_check( list ); } /* \doc Find the datum in |list| that has an associated value of |key|. Return that datum (a pointer), or "NULL" if the |key| is not found. */ const void *sl_find( sl_List list, const void *key ) { _sl_List l = (_sl_List)list; _sl_Entry update[_sl_MaxLevel + 1]; _sl_Entry pt; _sl_check_list( list, __func__ ); pt = _sl_locate( l, key, update ); if (pt && !l->compare( l->key( pt->datum ), key )) return pt->datum; return NULL; } /* \doc Iterate |f| over every datum in |list|. If |f| returns non-zero, then abort the remainder of the iteration. Iterations are designed to do something appropriate in the face of arbitrary insertions and deletions performed by |f|. */ int sl_iterate( sl_List list, sl_Iterator f ) { _sl_List l = (_sl_List)list; _sl_Entry pt; int retcode; int count; int i; const void **copy; if (!list) return 0; _sl_check_list( list, __func__ ); /* WARNING! This *ASSUMES* that the data to the right of the current point will remain at its memory location during the walk. Only memory locations for data to the left of the point may change! */ count = l->count; copy = alloca( count * sizeof( void * ) ); for (i = 0, pt = l->head->forward[0]; pt; i++, pt = pt->forward[0]) { copy[i] = pt->datum; } for (i = 0; i < count; i++) { if ((retcode = f( copy[i] ))) return retcode; } _sl_check( list ); return 0; } /* \doc Iterate |f| over every datum in |list|. If |f| returns non-zero, then abort the remainder of the iteration. Iterations are designed to do something appropriate in the face of arbitrary insertions and deletions performed by |f|. */ int sl_iterate_arg( sl_List list, sl_IteratorArg f, void *arg ) { _sl_List l = (_sl_List)list; _sl_Entry pt; int retcode; int count; int i; const void **copy; if (!list) return 0; _sl_check_list( list, __func__ ); /* WARNING! This *ASSUMES* that the data to the right of the current point will remain at its memory location during the walk. Only memory locations for data to the left of the point may change! */ count = l->count; copy = alloca( count * sizeof( void * ) ); for (i = 0, pt = l->head->forward[0]; pt; i++, pt = pt->forward[0]) { _sl_check_entry( pt, __func__ ); copy[i] = pt->datum; } for (i = 0; i < count; i++) { if ((retcode = f( copy[i], arg ))) return retcode; } _sl_check( list ); return 0; } /* \doc Dump the internal data structures associated with |list|. This is purely for debugging. */ void _sl_dump( sl_List list ) { _sl_List l = (_sl_List)list; _sl_Entry pt; int count = 0; _sl_check_list( list, __func__ ); printf( "Level = %d, count = %d\n", l->level, l->count ); for (pt = l->head; pt; pt = pt->forward[0]) { #if SL_DEBUG int i; printf( " Entry %p (%d/%p/0x%p=%lu) has 0x%x levels:\n", pt, count++, pt->datum, pt->datum ? l->key( pt->datum ) : 0, (unsigned long)(pt->datum ? l->key( pt->datum ) : 0), pt->levels ); for (i = 0; i < pt->levels; i++) printf( " %p\n", pt->forward[i] ); #else printf( " Entry %p (%d/%p/0x%p=%lu)\n", (void *)pt, count++, pt->datum, pt->datum ? l->key( pt->datum ) : 0, (unsigned long)(pt->datum ? l->key( pt->datum ) : 0) ); #endif } } libmaa-1.4.4/maa/prime.c0000644000175000017500000000515113457657444014722 0ustar cheusovcheusov/* prime.c -- Find prime numbers * Created: Thu Jul 20 22:04:37 1995 by faith@dict.org * Copyright 1995, 1996, 2002 Rickard E. Faith (faith@dict.org) * Copyright 2002-2008 Aleksey Cheusov (vle@gmx.net) * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * \section{Prime Number Routines} * * \intro These routines are used to find the next larger prime number for * expansion of the hash tables used by the hash and set routines. These * routines are only useful for 32-bit unsigned values. * */ #include "maaP.h" /* \doc |prm_is_prime| returns 1 if |value| is prime; 0 otherwise. Primality is determined by testings all odd divisors less than the square root of |value|. For 32-bit integers, this may mean that we will test about $\frac{\sqrt{2^{32}-1}}{2} = 32768$ odd values instead of the 6542 primes that would actually need to be tested. (A table of pre-computed primes using less than 26kB of memory could be used to recover this factor of 5 performance loss.) */ int prm_is_prime( unsigned int value ) { unsigned int divisor = 3; unsigned int square = divisor * divisor; if (value == 2) return 1; if (value == 3) return 1; if (!(value & 1)) return 0; /* even */ while (square < value && value % divisor) { ++divisor; square += 4 * divisor; ++divisor; } return value % divisor != 0; } /* \doc |prm_next_prime| returns the smallest odd prime greater than or equal to |start|. */ unsigned long prm_next_prime( unsigned int start ) { unsigned int next; for (next = start | 1; !prm_is_prime( next ); next += 2); return next; } libmaa-1.4.4/maa/log.c0000644000175000017500000002134613457657444014373 0ustar cheusovcheusov/* log.c -- Logging routines, for a single, program-wide logging facility * Created: Mon Mar 10 09:37:21 1997 by faith@dict.org * Copyright 1997-1999, 2001-2002 Rickard E. Faith (faith@dict.org) * Copyright 2002-2008 Aleksey Cheusov (vle@gmx.net) * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "maaP.h" #ifdef HAVE_SYSLOG_NAMES #define SYSLOG_NAMES #endif #include #include #include #include #include #ifndef MAXHOSTNAMELEN #define MAXHOSTNAMELEN 64 #endif static int logFd = -1; static FILE *logUserStream; static int logSyslog; static int inhibitFull = 0; static int logOpen; static int logFacility = LOG_USER; static const char *logIdent; static const char *logFilenameOrig; static char *logFilename; static char *logFilenameTmp; static int logFilenameLen; static char logHostname[MAXHOSTNAMELEN]; #ifndef HAVE_SYSLOG_NAMES typedef struct _code { const char *c_name; int c_val; } CODE; CODE facilitynames[] = { #if LOG_AUTH { "auth", LOG_AUTH }, #endif #if LOG_AUTHPRIV { "authpriv", LOG_AUTHPRIV }, #endif #if LOG_CRON { "cron", LOG_CRON }, #endif #if LOG_DAEMON { "daemon", LOG_DAEMON }, #endif #if LOG_FTP { "ftp", LOG_FTP }, #endif #if LOG_KERN { "kern", LOG_KERN }, #endif #if LOG_LPR { "lpr", LOG_LPR }, #endif #if LOG_MAIL { "mail", LOG_MAIL }, #endif #if LOG_NEWS { "news", LOG_NEWS }, #endif #if LOG_SYSLOG { "syslog", LOG_SYSLOG }, #endif #if LOG_USER { "user", LOG_USER }, #endif #if LOG_UUCP { "uucp", LOG_UUCP }, #endif #if LOG_LOCAL0 { "local0", LOG_LOCAL0 }, #endif #if LOG_LOCAL1 { "local1", LOG_LOCAL1 }, #endif #if LOG_LOCAL2 { "local2", LOG_LOCAL2 }, #endif #if LOG_LOCAL3 { "local3", LOG_LOCAL3 }, #endif #if LOG_LOCAL4 { "local4", LOG_LOCAL4 }, #endif #if LOG_LOCAL5 { "local5", LOG_LOCAL5 }, #endif #if LOG_LOCAL6 { "local6", LOG_LOCAL6 }, #endif #if LOG_LOCAL7 { "local7", LOG_LOCAL7 }, #endif { NULL, -1 }, }; #endif static void _log_set_hostname( void ) { static int hostnameSet = 0; char *pt; if (!hostnameSet) { memset( logHostname, 0, sizeof(logHostname) ); gethostname( logHostname, sizeof(logHostname)-1 ); if ((pt = strchr(logHostname, '.'))) *pt = '\0'; ++hostnameSet; } } void log_set_facility(const char *facility) { CODE *pt; for (pt = facilitynames; pt->c_name; pt++) { if (!strcmp(pt->c_name, facility)) { logFacility = pt->c_val; return; } } err_fatal(__func__, "%s is not a valid facility name\n", facility); } const char *log_get_facility(void) { CODE *pt; for (pt = facilitynames; pt->c_name; pt++) if (pt->c_val == logFacility) return pt->c_name; return NULL; } void log_option( int option ) { if (option == LOG_OPTION_NO_FULL) inhibitFull = 1; else inhibitFull = 0; } void log_syslog( const char *ident ) { if (ident){ if (logSyslog) err_internal( __func__, "Syslog facility already open\n" ); openlog( ident, LOG_PID|LOG_NOWAIT, logFacility ); ++logOpen; ++logSyslog; }else{ if (!logSyslog) return; closelog (); --logOpen; --logSyslog; } } static void log_mkpath(const char *filename) { char *tmp = alloca(strlen(filename) + 1); char *pt; strcpy(tmp, filename); for (pt = tmp; *pt; pt++) { if (*pt == '/' && pt != tmp) { *pt = '\0'; mkdir(tmp, 0755); *pt = '/'; } } } static void _log_check_filename(void) { time_t t; struct tm *tm; if (!logFilename || !logFilenameTmp || !logFilenameLen) return; time(&t); tm = localtime(&t); strftime(logFilenameTmp, logFilenameLen, logFilenameOrig, tm); if (strcmp(logFilenameTmp, logFilename)) { strcpy(logFilename, logFilenameTmp); if (logFd >= 0) close(logFd); log_mkpath(logFilename); if ((logFd = open( logFilename, O_WRONLY|O_CREAT|O_APPEND, 0644 )) < 0) err_fatal_errno( __func__, "Cannot open \"%s\" for append\n", logFilename ); } } void log_file( const char *ident, const char *filename ) { if (ident && filename){ if (logFd >= 0) err_internal( __func__, "Log file \"%s\" open when trying to open \"%s\"\n", logFilename, filename ); logIdent = str_find( ident ); logFilenameOrig = str_find(filename); logFilenameLen = strlen(filename)*3+1024; logFilename = xmalloc(logFilenameLen + 1); logFilenameTmp = xmalloc(logFilenameLen + 1); logFilename[0] = '\0'; _log_check_filename(); _log_set_hostname(); ++logOpen; }else{ if (logFd < 0) return; close (logFd); logFd = -1; if (logFilename) xfree (logFilename); logFilename = NULL; if (logFilenameTmp) xfree (logFilenameTmp); logFilenameTmp = NULL; logFilenameLen = 0; --logOpen; } } void log_stream( const char *ident, FILE *stream ) { if (ident && stream){ if (logUserStream) err_internal( __func__, "User stream already open\n" ); logUserStream = stream; logIdent = str_find( ident ); _log_set_hostname(); ++logOpen; }else{ if (!logUserStream) return; if (logUserStream != stdout && logUserStream != stderr) { fclose (logUserStream); } logUserStream = NULL; --logOpen; } } void log_close( void ) { log_file (NULL, NULL); log_stream (NULL, NULL); log_syslog (NULL); } static void _log_base_va( const char *routine, int log_facility, const char *format, va_list ap ) { va_list ap_copy; time_t t; static char buf [8192] = ""; static char buf_main [4096] = ""; static char buf_preamble [256] = ""; va_copy (ap_copy, ap); if (!logOpen) return; time(&t); if (logFd >= 0 || logUserStream) { /* preamble */ if (inhibitFull) { buf_preamble [0] = 0; } else { snprintf (buf_preamble, sizeof (buf_preamble), "%24.24s %s %s[%ld]: ", ctime(&t), logHostname, logIdent, (long int) getpid()); } /* main part of log message */ vsnprintf (buf_main, sizeof (buf_main), format, ap ); /* full log message */ if (routine){ snprintf (buf, sizeof (buf), "%s(%s) %s\n", buf_preamble, routine, buf_main); }else{ snprintf (buf, sizeof (buf), "%s%s\n", buf_preamble, buf_main); } /* writing */ if (logFd >= 0) { _log_check_filename(); while (-1 == write (logFd, buf, strlen (buf)) && errno == EINTR); } if (logUserStream) { fseek( logUserStream, 0L, SEEK_END ); /* might help if luser didn't open stream with "a" */ if (logUserStream == stdout || logUserStream == stderr) fprintf( logUserStream, "%s", buf_main ); else fprintf( logUserStream, "%s", buf ); fflush( logUserStream ); } } if (logSyslog) { vsyslog( log_facility, format, ap_copy ); } } void log_error_va( const char *routine, const char *format, va_list ap ) { _log_base_va (routine, LOG_ERR, format, ap); } void log_error( const char *routine, const char *format, ... ) { va_list ap; va_start( ap, format ); log_error_va( routine, format, ap ); va_end( ap ); } void log_info_va( const char *format, va_list ap ) { _log_base_va (NULL, LOG_INFO, format, ap); } void log_info( const char *format, ... ) { va_list ap; va_start( ap, format ); log_info_va( format, ap ); va_end( ap ); } libmaa-1.4.4/maa/string.c0000644000175000017500000003106013457657444015112 0ustar cheusovcheusov/* string.c -- String pool for Khepera * Created: Wed Dec 21 21:32:34 1994 by faith@dict.org * Copyright 1994-1997, 2002 Rickard E. Faith (faith@dict.org) * Copyright 2002-2008 Aleksey Cheusov (vle@gmx.net) * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * \section{String Pool Routines} * * \intro These routines provide support for string pool objects. In * general, only the |str_find| and |str_findn| functions will be used. * This function takes a pointer to a null-terminated string and returns a * pointer to another null-terminated string which contains the same * information. The pointer returned will be identical for all identical * strings. Memory for string storage is automatically reclaimed at * program termination on systems that support |atexit| or |on_exit|. * */ #include "maaP.h" static str_Pool global; typedef struct poolInfo { mem_String string; hsh_HashTable hash; } *poolInfo; /* \doc |str_pool_create| initialized a string pool object. */ str_Pool str_pool_create( void ) { poolInfo pool = xmalloc( sizeof( struct poolInfo ) ); pool->string = mem_create_strings(); pool->hash = hsh_create( NULL, NULL ); return pool; } /* \doc |str_pool_destroy| destroys the string pool object, |pool|, and all memory associated with it. */ void str_pool_destroy( str_Pool pool ) { poolInfo p = (poolInfo)pool; if (!p || !p->string || !p->hash) err_fatal( __func__, "String pool improperly initialized\n" ); mem_destroy_strings( p->string ); hsh_destroy( p->hash ); xfree( p ); /* terminal */ } /* \doc |str_pool_exists| returns non-zero if the string, |s|, is already in the string pool, |pool|. */ int str_pool_exists( str_Pool pool, const char *s ) { const char *datum; poolInfo p = (poolInfo)pool; if ((datum = hsh_retrieve( p->hash, s ))) return 1; return 0; } /* \doc |str_pool_find| looks up the string, |s|, in the memory associated with the string pool object, |pool|. If the string is found, a pointer to the previously stored string is returned. Otherwise, the string is copied into string pool memory, and a pointer to the newly allocated memory is returned. */ const char *str_pool_find( str_Pool pool, const char *s ) { const char *datum; poolInfo p = (poolInfo)pool; if ((datum = hsh_retrieve( p->hash, s ))) return datum; datum = mem_strcpy( p->string, s ); hsh_insert( p->hash, datum, datum ); return datum; } /* \doc |str_pool_iterate| is used to iterate a function over every value in the |pool|. The function, |iterator|, is passed the |s| for each entry in the pool. If |iterator| returns a non-zero value, the iterations stop, and |str_pool_iterate| returns non-zero. Note that the keys are in some arbitrary order, and that this order may change between two successive calls to |str_pool_iterate|. */ int str_pool_iterate( str_Pool pool, int (*iterator)( const char *s ) ) { poolInfo p = (poolInfo) pool; hsh_HashTable hash = p -> hash; hsh_Position hash_pos; void *key; /* printf ("inside str_pool_iterate\n"); */ HSH_ITERATE_KEYS (hash, hash_pos, key){ if ((*iterator) ((const char *) key)) return 1; } return 0; } /* \doc |str_pool_iterate| is used to iterate a function over every value in the |pool|. The function, |iterator|, is passed the |s| for each entry in the pool. If |iterator| returns a non-zero value, the iterations stop, and |str_pool_iterate| returns non-zero. Note that the keys are in some arbitrary order, and that this order may change between two successive calls to |str_pool_iterate|. */ int str_pool_iterate_arg( str_Pool pool, int (*iterator)( const char *s, void *arg ), void *arg ) { poolInfo p = (poolInfo) pool; hsh_HashTable hash = p -> hash; hsh_Position hash_pos; void *key; HSH_ITERATE_KEYS (hash, hash_pos, key){ if ((*iterator) (key, arg)){ HSH_ITERATE_END (hash); return 1; } } return 0; } str_Position str_pool_init_position (str_Pool pool) { poolInfo p = (poolInfo) pool; return hsh_init_position (p -> hash); } str_Position str_pool_next_position (str_Pool pool, str_Position position) { poolInfo p = (poolInfo) pool; return hsh_next_position (p -> hash, position); } void str_pool_get_position (str_Position position, char const * const*key) { hsh_get_position (position, (void **) __UNCONST(key)); } /* \doc |str_pool_copy| returns a copy of the string, |s|, using memory from the string pool object, |pool|. This can be used for data that is known to be unique. No checks are made for uniqueness, however; and a pointer to the string is not placed in the hash table. */ const char *str_pool_copy( str_Pool pool, const char *s ) { poolInfo p = (poolInfo)pool; return mem_strcpy( p->string, s ); } /* \doc |str_pool_copyn| returns a copy of the string, |s|, using memory from the string pool object, |pool|. The string will be |length| bytes long, and will be "NULL" terminated. This can be used for data that is known to be unique. No checks are made for uniqueness, however; and a pointer to the string is not placed in the hash table. */ const char *str_pool_copyn( str_Pool pool, const char *s, int length ) { poolInfo p = (poolInfo)pool; return mem_strncpy( p->string, s, length ); } /* \doc |str_pool_grow| will grow a string in the specified |pool| until |str_pool_finish| is called. There must not be any other calls to modify the specified string |pool| between the first call to |str_pool_grow| and the call to |str_pool_finish|. */ void str_pool_grow( str_Pool pool, const char *s, int length ) { poolInfo p = (poolInfo)pool; mem_grow( p->string, s, length ); } /* \doc |str_pool_finish| will finish the growth of a string performed by multiple calls to |str_pool_grow|. The string will be null terminated and will be entered into the specified string |pool|. Calls to |str_pool_grow| follows by a call to |str_pool_finish| is equivalent to a single call to |str_pool_find|. */ const char *str_pool_finish( str_Pool pool ) { poolInfo p = (poolInfo)pool; const char *datum; mem_grow( p->string, "\0", 1 ); /* guarantee null termination */ datum = mem_finish( p->string ); hsh_insert( p->hash, datum, datum ); return datum; } /* \doc |str_pool_get_stats| returns statistics about the specified string |pool|. The |str_Stats| structure is shown in \grind{str_Stats}. */ str_Stats str_pool_get_stats( str_Pool pool ) { poolInfo p = (poolInfo)pool; str_Stats s = xmalloc( sizeof( struct str_Stats ) ); if (p) { mem_StringStats m = mem_get_string_stats( p->string ); hsh_Stats h = hsh_get_stats( p->hash ); s->count = m->count; s->bytes = m->bytes; s->retrievals = h->retrievals; s->hits = h->hits; s->misses = h->misses; xfree( h ); /* rare */ xfree( m ); /* rare */ } else { s->count = 0; s->bytes = 0; s->retrievals = 0; s->hits = 0; s->misses = 0; } return s; } /* \doc |str_pool_print_stats| prints the statistics for the specified string |pool| on the specified |stream|. If |stream| is "NULL", then "stdout" will be used. */ void str_pool_print_stats( str_Pool pool, FILE *stream ) { FILE *str = stream ? stream : stdout; str_Stats s = str_pool_get_stats( pool ); fprintf( str, "Statistics for %sstring pool at %p:\n", pool == global ? "global " : "", pool ); fprintf( str, " %d strings using %d bytes\n", s->count, s->bytes ); fprintf( str, " %d retrievals (%d from top, %d failed)\n", s->retrievals, s->hits, s->misses ); xfree( s ); /* rare */ } static void _str_check_global( void ) { if (!global) global = str_pool_create(); } /* \doc |str_exists| acts like |str_pool_exists|, except the global string pool is used. */ int str_exists( const char *s ) { return str_pool_exists( global, s ); } /* \doc |str_find| acts like |str_pool_find|, except the global string pool is used. If the global string pool has not been initialized, it will be initialized automatically. Further, on systems that support |atexit| or |on_exit|, |str_destroy| will be called automatically at program termination. */ const char *str_find( const char *s ) { _str_check_global(); return str_pool_find( global, s ); } /* \doc |str_findn| acts like |str_find|, except that the length of the string is specified, and the string does not have to be "NULL" terminated. */ const char *str_findn( const char *s, int length ) { char *tmp = alloca( sizeof( char ) * (length + 1) ); _str_check_global(); strncpy( tmp, s, length); tmp [ length ] = 0; return str_pool_find( global, tmp ); } /* \doc |str_copy| acts like |str_pool_copy|, except the global string pool is used. If the global string pool has not been initialized, it will be initialized automatically. Further, on systems that support |atexit| or |on_exit|, |str_destroy| will be called automatically at program termination. */ const char *str_copy( const char *s ) { _str_check_global(); return str_pool_copy( global, s ); } /* \doc |str_copyn| acts like |str_copy|, except that the length of the string is specified, and the string does not have to be "NULL" terminated. */ const char *str_copyn( const char *s, int length ) { return str_pool_copyn( global, s, length ); } /* \doc |str_grow| will grow a string until |str_finish| is called. There must not be any other calls to modify the global string pool between the first call to |str_grow| and the call to |str_finish|. */ void str_grow( const char *s, int length ) { _str_check_global(); str_pool_grow( global, s, length ); } /* \doc |str_finish| will finish the growth of a string performed by multiple calls to |str_grow|. The string will be null terminated and will be entered into the global string pool tables. Calls to |str_grow| follows by a call to |str_finish| is equivalent to a single call to |str_findn|. */ const char *str_finish( void ) { _str_check_global(); return str_pool_finish( global ); } /* \doc |str_unique| returns a unique string with the given prefix. This is not the most pretty way to generate unique strings, and should be improved. The string is placed in the string pool and does not need to be freed. */ const char *str_unique( const char *prefix ) { static int i = 1; char *buf = alloca( strlen( prefix ) + 100 ); do { sprintf( buf, "%s%d", prefix, i++ ); } while (str_exists( buf )); return str_find( buf ); } /* \doc |str_destroy| frees all of the memory associated with the global string pool. Since this function is called automatically at program termination on systems that support |atexit| or |on_exit|, there should be no need to call this function explicitly. If this function is called explicitly, the next call to |str_find| will re-initialize the global string pool. */ void str_destroy( void ) { if (global) str_pool_destroy( global ); global = NULL; } /* \doc |str_get_stats| returns statistics about the global string pool. The |str_Stats| structure is shown in \grindref{fig:strStats}. */ str_Stats str_get_stats( void ) { return str_pool_get_stats( global ); } /* \doc |str_print_stats| prints the statistics for the global string pool on the specified |stream|. If |stream| is "NULL", then "stdout" will be used. */ void str_print_stats( FILE *stream ) { str_pool_print_stats( global, stream ); } libmaa-1.4.4/maa/maa.c0000644000175000017500000000511713457657444014346 0ustar cheusovcheusov/* maa.c -- General Support for libmaa * Created: Sun Nov 19 13:24:35 1995 by faith@dict.org * Copyright 1995, 1996, 2002 Rickard E. Faith (faith@dict.org) * Copyright 2002-2008 Aleksey Cheusov (vle@gmx.net) * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * \section{General Support} * */ #include "maaP.h" #include "maa.h" /* \doc |maa_init| should be called at the start of "main()", and serves to initialize debugging and other support for \libmaa. */ void maa_init( const char *programName ) { tim_start( "total" ); err_set_program_name( programName ); _dbg_register( MAA_MEMORY, ".memory" ); _dbg_register( MAA_TIME, ".time" ); _dbg_register( MAA_PR, ".pr" ); _dbg_register( MAA_SL, ".sl" ); _dbg_register( MAA_SRC, ".src" ); _dbg_register( MAA_PARSE, ".parse" ); } void maa_shutdown( void ) { if (dbg_test(MAA_MEMORY) || dbg_test(MAA_TIME)) fprintf( stderr, "%s\n", maa_version() ); if (dbg_test(MAA_MEMORY)) { str_print_stats( stderr ); } _pr_shutdown(); str_destroy(); _lst_shutdown(); _sl_shutdown(); tim_stop( "total" ); if (dbg_test(MAA_TIME)) { tim_print_timers( stderr ); } _tim_shutdown(); flg_destroy(); dbg_destroy(); } int maa_version_major( void ) { return MAA_MAJOR; } int maa_version_minor( void ) { return MAA_MINOR; } int maa_version_teeny( void ) { return MAA_TEENY; } const char *maa_version( void ) { static char buffer[80]; sprintf( buffer, "Libmaa %d.%d.%d", MAA_MAJOR, MAA_MINOR, MAA_TEENY ); return buffer; } libmaa-1.4.4/maa/error.c0000644000175000017500000001261613457657444014743 0ustar cheusovcheusov/* error.c -- Error reporting routines for Khepera * Created: Wed Dec 21 12:55:00 1994 by faith@dict.org * Copyright 1994-1997, 2002 Rickard E. Faith (faith@dict.org) * Copyright 2002-2008 Aleksey Cheusov (vle@gmx.net) * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * \section{Error Reporting Routines} * * \intro Several error reporting routines are provided. These routines * are always used to print errors generated within the \khepera library, * and are available for the programmer as well. * */ #include "maaP.h" #include const char *_err_programName; /* \doc |err_set_program_name| records the value of |argv[0]| for the calling program. If this value is not "NULL", then it will be used when printing errors and warnings. */ void err_set_program_name( const char *programName ) { const char *pt =strrchr( programName, '/' ); if (pt) _err_programName = pt + 1; else _err_programName = programName; } /* \doc |err_program_name| returns the value of |programName| that was previously set with |err_set_program_name|. This value may be "NULL". */ const char *err_program_name( void ) { return _err_programName; } /* \doc |err_fatal| flushes "stdout", prints a fatal error report on "stderr", flushes "stderr" and "stdout", and calls |exit|. |routine| is the name of the routine in which the error took place. */ void err_fatal( const char *routine, const char *format, ... ) { va_list ap; fflush( stdout ); if (_err_programName) { if (routine) fprintf( stderr, "%s (%s): ", _err_programName, routine ); else fprintf( stderr, "%s: ", _err_programName ); } else { if (routine) fprintf( stderr, "%s: ", routine ); } va_start( ap, format ); vfprintf( stderr, format, ap ); log_error_va( routine, format, ap ); va_end( ap ); fflush( stderr ); fflush( stdout ); exit ( 1 ); } /* \doc |err_fatal_errno| flushes "stdout", prints a fatal error report on "stderr", prints the system error corresponding to |errno|, flushes "stderr" and "stdout", and calls |exit|. |routine| is the name of the routine in which the error took place. */ void err_fatal_errno( const char *routine, const char *format, ... ) { va_list ap; int errorno = errno; fflush( stdout ); if (_err_programName) { if (routine) fprintf( stderr, "%s (%s): ", _err_programName, routine ); else fprintf( stderr, "%s: ", _err_programName ); } else { if (routine) fprintf( stderr, "%s: ", routine ); } va_start( ap, format ); vfprintf( stderr, format, ap ); log_error_va( routine, format, ap ); va_end( ap ); fprintf( stderr, "%s: %s\n", routine, strerror( errorno ) ); log_error( routine, "%s: %s\n", routine, strerror( errorno ) ); fflush( stderr ); fflush( stdout ); exit( 1 ); } /* \doc |err_warning| flushes "stdout", prints a non-fatal warning on "stderr", and returns to the caller. |routine| is the name of the calling routine. */ void err_warning( const char *routine, const char *format, ... ) { va_list ap; fflush( stdout ); fflush( stderr ); if (_err_programName) { if (routine) fprintf( stderr, "%s (%s): ", _err_programName, routine ); else fprintf( stderr, "%s: ", _err_programName ); } else { if (routine) fprintf( stderr, "%s: ", routine ); } va_start( ap, format ); vfprintf( stderr, format, ap ); log_error_va( routine, format, ap ); va_end( ap ); } /* \doc |err_internal| flushes "stdout", prints the fatal error message, flushes "stderr" and "stdout", and calls |abort| so that a core dump is generated. */ void err_internal( const char *routine, const char *format, ... ) { va_list ap; fflush( stdout ); if (_err_programName) { if (routine) fprintf( stderr, "%s (%s): Internal error\n ", _err_programName, routine ); else fprintf( stderr, "%s: Internal error\n ", _err_programName ); } else { if (routine) fprintf( stderr, "%s: Internal error\n ", routine ); else fprintf( stderr, "Internal error\n " ); } va_start( ap, format ); vfprintf( stderr, format, ap ); log_error( routine, format, ap ); va_end( ap ); if (_err_programName) fprintf( stderr, "Aborting %s...\n", _err_programName ); else fprintf( stderr, "Aborting...\n" ); fflush( stderr ); fflush( stdout ); abort(); } libmaa-1.4.4/maa/source.c0000644000175000017500000003032613457657444015110 0ustar cheusovcheusov/* source.c -- Source code management for Libmaa * Created: Mon Dec 26 19:42:03 1994 by faith@dict.org * Copyright 1994-1998, 2002 Rickard E. Faith (faith@dict.org) * Copyright 2002-2008 Aleksey Cheusov (vle@gmx.net) * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * \section{Source Code Management} * * \intro Most of the source code management routines are designed to be * called from within a lexical analyzer. The routines support the storage * and retrieval of source code lines and source code token information. A * single, global, source code management object is supported. * * \textbf{This documentation is incomplete.} * * \textbf{These routines have not been fully implemented.} * */ #include "maaP.h" typedef struct source { const char *file; int line; int offset; int length; int index; } sourceType; #define INCREMENT 1000 static const char **Lines; static int Count; static int Used; static sourceType Info; static mem_String StringHeap; static mem_Object InfoHeap; /* \doc The |src_create| functions initializes the global source code management object. This routine should only be called once, if at all. If the other routines are used as expected, |src_create| will be called automatically when it is needed. */ void src_create( void ) { if (Lines) err_fatal( __func__, "Source manager already created\n" ); Lines = xmalloc( (Count = INCREMENT) * sizeof( char * ) ); StringHeap = mem_create_strings(); InfoHeap = mem_create_objects( sizeof( struct source ) ); } /* \doc |src_destroy| frees all memory associated with the global source code management object. */ void src_destroy( void ) { if (!Lines) return; mem_destroy_objects( InfoHeap ); mem_destroy_strings( StringHeap ); xfree( Lines ); /* terminal */ Lines = StringHeap = InfoHeap = NULL; } /* \doc |src_line| stores a |line| of length |len|. */ const char *src_line( const char *line, int len ) { char *pt; if (!Lines) src_create(); ++Info.line; Info.index = Used; Info.offset = 0; Lines[Used] = mem_strncpy( StringHeap, line, len ); for (pt = (char*)__UNCONST(Lines[Used]); *pt; pt++) if (*pt == '\t') *pt = ' '; PRINTF(MAA_SRC,("Line %d: %s",Used,Lines[Used])); if (++Used >= Count) Lines = xrealloc( Lines, (Count += INCREMENT) * sizeof( char * ) ); return Lines[ Used - 1 ]; } /* \doc |src_new_file| specifies that |filename| is the name of the current file being read by the lexer. */ void src_new_file( const char *filename ) { Info.file = str_find( filename ); } /* \doc |src_new_line| specifies that |line| is the number of the current line being read by the lexer. Line numbers start at 1. */ void src_new_line( int line ) { Info.line = line; } /* \doc |src_advance| is used to advance the token offset pointer |length| bytes. */ void src_advance( int length ) { Info.offset += length; } void src_cpp_line( const char *line, int length ) { arg_List args; char *tmp = alloca( length + 1 ); int lineno; strncpy( tmp, line, length ); tmp [ length ] = '\0'; args = arg_argify( tmp, 0 ); if ((lineno = atoi( arg_get( args, 1 ) )) > 0) --lineno; else lineno = 1; src_new_line( lineno ); /* FIXME! This is debugging cruft to be removed. */ if (arg_count( args ) == 2) { PRINTF(MAA_SRC,( "lineno %s\n", arg_get( args, 1 ) )); } else { PRINTF(MAA_SRC,( "lineno %s in %s\n", arg_get( args, 1 ), arg_get( args, 2 ) )); src_new_file( arg_get( args, 2 ) ); } arg_destroy( args ); } /* \doc |src_get| is used to get a |src_Type| object for the current token. This object contains file, line, offset, and length information which can be used to print parse error messages and provide detailed token tracking. */ src_Type src_get( int length ) { sourceType *new; if (!Lines) err_fatal( __func__, "Source manager does not exist\n" ); Info.length = length; new = mem_get_object( InfoHeap ); new->file = Info.file; new->line = Info.line; new->offset = Info.offset; new->length = Info.length; new->index = Info.index; /* Index into Lines array. */ if (dbg_test(MAA_SRC)) { printf( "%s:%d @ %d, %d; %d\n", new->file, new->line, new->offset, new->length, new->index ); } src_advance( length ); return new; } /* \doc |src_filename| returns the |file| associated with the specified |source| information. */ const char *src_filename( src_Type source ) { sourceType *s = (sourceType *)source; if (!Lines) err_fatal( __func__, "Source manager never created\n" ); return s ? s->file : ""; } /* \doc |src_linenumber| returns the |line| associated with the specified |source| information. */ int src_linenumber( src_Type source ) { sourceType *s = (sourceType *)source; if (!Lines) err_fatal( __func__, "Source manager never created\n" ); return s ? s->line : 0; } /* \doc |src_offset| returns the token |offset| associated with the specified |source| information. */ int src_offset( src_Type source ) { sourceType *s = (sourceType *)source; if (!Lines) err_fatal( __func__, "Source manager never created\n" ); return s ? s->offset : 0; } /* \doc |src_length| returns the token |length| associated with the specified |source| information. */ int src_length( src_Type source ) { sourceType *s = (sourceType *)source; if (!Lines) err_fatal( __func__, "Source manager never created\n" ); return s ? s->length : 0; } /* \doc |src_source_line| returns the full source line associated with the specified |source| information. */ const char *src_source_line( src_Type source ) { sourceType *s = (sourceType *)source; if (!Lines) err_fatal( __func__, "Source manager never created\n" ); return s ? Lines[ s->index ] : ""; } /* \doc |src_get_stats| returns the statistics associated with the source code manager. The |src_Stats| structure is shown in \grind{src_Stats}. */ src_Stats src_get_stats( void ) { src_Stats s = xmalloc( sizeof( struct src_Stats ) ); if (Lines) { mem_StringStats ms = mem_get_string_stats( StringHeap ); mem_ObjectStats mo = mem_get_object_stats( InfoHeap ); s->lines_used = Used; s->lines_allocated = Count; s->lines_bytes = ms->bytes; s->tokens_total = mo->total; s->tokens_reused = mo->reused; s->tokens_size = mo->size; xfree( ms ); /* rare */ xfree( mo ); /* rare */ } else { s->lines_used = 0; s->lines_allocated = 0; s->lines_bytes = 0; s->tokens_total = 0; s->tokens_reused = 0; s->tokens_size = 0; } return s; } /* \doc |src_print_stats| prints the statistics about the source code manager to the specified |stream|. If |stream| is "NULL", then "stdout" will be used. */ void src_print_stats( FILE *stream ) { FILE *str = stream ? stream : stdout; src_Stats s = src_get_stats(); fprintf( str, "Statistics for source manager:\n" ); fprintf( str, " %d lines using %d bytes (%d allocated)\n", s->lines_used, s->lines_bytes, s->lines_allocated ); fprintf( str, " %d tokens using %d bytes (%d reused)\n", s->tokens_total, s->tokens_total * s->tokens_size, s->tokens_reused ); xfree( s ); /* rare */ } static void _src_print_yyerror( FILE *str, const char *message ) { const char *pt; char buf[1024]; char *b; const char *concrete; assert( str ); if (!message) { fprintf( str, "(null)" ); return; } for (pt = message; *pt; pt++) { if (*pt == '`') { /* clean up character constants */ if (pt[1] == '`' && pt[2] && pt[3] == '\'' && pt[4] == '\'') { fprintf( str, "`%c'", pt[2] ); pt += 4; } else if (pt[1] == 'T' && pt[2] == '_') { /* replace symbols */ for (b = buf, ++pt; *pt && *pt != '\''; b++, pt++) *b = *pt; *b = '\0'; if ((concrete = prs_concrete( buf ))) fprintf( str, "`%s'", concrete ); else fprintf( str, "`%s'", buf ); } else putc( *pt, str ); } else putc( *pt, str ); } } /* \doc |src_print_line| prints a line of source code, as described by |source| to the specified |stream|. If |stream| is "NULL", then "stdout" will be used. */ void src_print_line( FILE *stream, src_Type source ) { sourceType *s = (sourceType *)source; FILE *str = stream ? stream : stdout; if (s) fprintf( str, "%s:%d: %s", s->file, s->line, Lines[ s->index ] ); else fprintf( str, "?:?: \n" ); } static void _src_print_error( FILE *str, sourceType *s, int fudge ) { int i; assert( str ); src_print_line( str, s ); if (s) { PRINTF(MAA_SRC,("s->offset = %d, fudge = %d, s->length = %d\n", s->offset, fudge, s->length )); fprintf( str, "%s:%d: ", s->file, s->line ); for (i = 0; i < s->offset - fudge; i++) putc( ' ', str ); for (i = 0; i < s->length; i++) putc( '^', str ); } else { fprintf( str, "?:?: " ); } putc( '\n', str ); } /* \doc |src_parse_error| will print the error |message| to the specified |stream|, followed by the offending line of source code, as specified by |source|. If |stream| is "NULL", then "stdout" will be used. It is assumed that |message| has the format of |yyerror| so that massaging of the string can be performed to make it more readable (token names are assumed to start with ``T\_'' and will be changed to more readable names). This massaging should be done by a user-defined function, since it is relatively specific to this author's coding conventions. */ void src_parse_error( FILE *stream, src_Type source, const char *message ) { sourceType *s = (sourceType *)source; FILE *str = stream ? stream : stdout; if (s) fprintf( str, "%s:%d: ", s->file, s->line ); else fprintf( str, "?:?: " ); _src_print_yyerror( str, message ); putc( '\n', str ); _src_print_error( str, s, 0 ); } /* \doc |src_print_error| will print an arbitrary error, specified as for |printf| by the |format| variable, to the specified |stream|, followed by the line of source code specified by |source|. If |stream| is "NULL", then "stdout" will be used. */ void src_print_error( FILE *str, src_Type source, const char *format, ... ) { va_list ap; sourceType *s = (sourceType *)source; fflush( str ); if (format) { if (s) fprintf( str, "%s:%d: ", s->file, s->line ); else fprintf( str, "?:?: " ); va_start( ap, format ); vfprintf( str, format, ap ); va_end( ap ); putc( '\n', str ); } _src_print_error( str, s, 0 ); } /* \doc |src_print_message| will just print a message labeled with a line. */ void src_print_message( FILE *str, src_Type source, const char *format, ... ) { va_list ap; sourceType *s = (sourceType *)source; fflush( str ); if (format) { if (s) fprintf( str, "%s:%d: ", s->file, s->line ); else fprintf( str, "?:?: " ); va_start( ap, format ); vfprintf( str, format, ap ); va_end( ap ); putc( '\n', str ); } } libmaa-1.4.4/maa/flags.c0000644000175000017500000001317213457657444014704 0ustar cheusovcheusov/* flags.c -- Flag support for Khepera * Created: Sat Mar 23 10:11:52 1996 by faith@dict.org * Copyright 1994-1997, 2002 Rickard E. Faith (faith@dict.org) * Copyright 2002-2008 Aleksey Cheusov (vle@gmx.net) * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * \section{Flag Support} * * \intro These routines provide low-level support for run-time program * flow control. The mechanism used is similar to that used for debugging * messages. A set of global flags are maintained using "#define" * statements. These flags are assumed to be 32-bit integers, the top two * bits of which are used to select one of four sets of debugging lags. * Each set, therefore, has 30 bits of flag information. For convenience, * each flag can be given a unique name, so that flags can be set easily * with command-line options. * */ #include "maaP.h" #define TEST(flags,var) (((flags)>>31) \ ? (((flags)>>30) \ ? ((var[3] & (flags)) << 2) \ : ((var[2] & (flags)) << 2)) \ : (((flags)>>30) \ ? ((var[1] & (flags)) << 2) \ : ((var[0] & (flags)) << 2))) static hsh_HashTable hash; static flg_Type setFlags[4]; static flg_Type usedFlags[4]; /* |_flg_exists| returns non-zero if |flag| has been associated with a name (using the |flg_register| function). */ static int _flg_exists( flg_Type flag ) { return TEST( flag, usedFlags ); } /* |flg_name| returns a pointer to the name that was associated with the |flag|. */ const char *flg_name( flg_Type flag ) { hsh_Position position; void *key; void *datum; HSH_ITERATE( hash, position, key, datum ) { if (flag == (flg_Type)datum) { HSH_ITERATE_END( hash ); return key; } } return "unknown flag"; } /* \doc |flg_register| is used to set up an asociated between a |flag| and a |name|. After this association is made, calls to |flg_set| can use |name| to set the global flag. */ void flg_register( flg_Type flag, const char *name ) { flg_Type tmp; for (tmp = flag & 0x3fffffff; tmp && !(tmp & 1); tmp >>= 1); if (!tmp || tmp >> 1) err_fatal( __func__, "Malformed flag (%lx):" " a single low-order bit must be set\n", flag ); if (!hash) hash = hsh_create( NULL, NULL ); if (_flg_exists( flag )) err_fatal( __func__, "The flag %lx has been used for \"%s\"" " and cannot be reused for \"%s\"\n", flag, flg_name( flag ), name ); hsh_insert( hash, name, (void *)flag ); } /* \doc |flg_set| sets the |name| flag. If |name| is ``none,'' then all flags are cleared. */ void flg_set( const char *name ) { flg_Type flag; if (!name) err_internal( __func__, "name is NULL\n" ); if (!hash) err_fatal( __func__, "No flag names registered\n" ); if (!strcmp( name, "none" )) { setFlags[0] = setFlags[1] = setFlags[2] = setFlags[3] = 0; return; } if (!strcmp( name, "all" )) { setFlags[0] = setFlags[1] = setFlags[2] = setFlags[3] = ~0; return; } if (!(flag = (flg_Type)hsh_retrieve( hash, name ))) { flag = 0; if ( (*name != '-' && *name != '+') || !(flag = (flg_Type) hsh_retrieve( hash, name+1 ))) { fprintf( stderr, "Valid flags are:\n" ); flg_list( stderr ); err_fatal( __func__, "\"%s\" is not a valid flag\n", name ); } else { if (flag){ if (*name == '+') setFlags[ flag >> 30 ] |= flag; else setFlags[ flag >> 30 ] &= ~flag; /* - */ } } } else { setFlags[ flag >> 30 ] |= flag; } } /* \doc This function tests the |flag|, returning non-zero if the |flag| is set, and zero otherwise. */ int flg_test( flg_Type flag ) { return TEST( flag, setFlags ); } /* \doc |flg_destroy| destroys the memory associated with the flag support routines. This routine should \emph{never} be called by the programmer: it is automatically called at program termination on systems that support the |atexit| or |on_exit| calls. */ void flg_destroy( void ) { if (hash) hsh_destroy( hash ); hash = NULL; setFlags[0] = setFlags[1] = setFlags[2] = setFlags[3] = 0; usedFlags[0] = usedFlags[1] = usedFlags[2] = usedFlags[3] = 0; } static int _flg_user( const void *key, const void *datum, void *arg ) { FILE *stream = (FILE *)arg; fprintf( stream, " %s\n", (char*) __UNCONST(key) ); return 0; } /* |flg_list| lists all of the valid flags to the specified |stream|. */ void flg_list( FILE *stream ) { hsh_iterate_arg( hash, _flg_user, stream ); } libmaa-1.4.4/maa/stack.c0000644000175000017500000000673313457657444014722 0ustar cheusovcheusov/* stack.c -- Stack routines for Khepera * Created: Wed Nov 9 19:40:00 1994 by faith@dict.org * Copyright 1994, 1995, 2002 Rickard E. Faith (faith@dict.org) * Copyright 2002-2008 Aleksey Cheusov (vle@gmx.net) * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * \section{Stack Routines} * * \intro The stack routines provide support for a general stack of * pointers to "void". Because of the simplicity of the stack object, no * statistics are maintained. (Althought the list routines can also be used * as a stack, the stack implemented here is more efficient.) * */ #include "maaP.h" typedef struct data { const void *datum; struct data *prev; } *dataType; typedef struct stack { struct data *data; } *stackType; /* \doc |stk_create| initializes a stack object. */ stk_Stack stk_create( void ) { stackType s; s = xmalloc( sizeof( struct stack ) ); s->data = NULL; return s; } /* \doc |stk_destroy| destroys all memory associated with the |stack|. The memory used by data is \emph{not} freed---this memory is the responsibility of the user. */ void stk_destroy( stk_Stack stack ) { while (!stk_isempty( stack )){ stk_pop( stack ); } xfree( stack ); /* terminal */ } /* \doc |stk_push| places |datum| on the top of the |stack|. */ void stk_push( stk_Stack stack, void *datum ) { stackType s = (stackType)stack; dataType d = (dataType)malloc( sizeof( struct data ) ); d->datum = datum; d->prev = s->data; s->data = d; } /* \doc |stk_pop| removes the top of the |stack| and returns the pointer. If the |stack| is empty, |stk_pop| returns "NULL". */ void *stk_pop( stk_Stack stack ) { stackType s = (stackType)stack; void *datum = NULL; if (s->data) { dataType old = s->data; datum = __UNCONST(old->datum); /* Discard const */ s->data = s->data->prev; free( old ); } return datum; } /* \doc |stk_isempty| return 1 if |stack| is empty, or 0 otherwise. */ int stk_isempty( stk_Stack stack ) { stackType s = (stackType)stack; if (s->data) { return 0; }else{ return 1; } } /* \doc |stk_top| returns a pointer to the datum on the top of the |stack|, but does \emph{not} remove this datum from the |stack|. If the |stack| is empty, |stk_pop| returns "NULL". */ void *stk_top( stk_Stack stack ) { stackType s = (stackType)stack; if (s->data) return __UNCONST(s->data->datum); /* Discard const */ return NULL; } libmaa-1.4.4/maa/parse-concrete.c0000644000175000017500000000340013457657444016513 0ustar cheusovcheusov/* parse-concrete.c -- Support for calling parsers from Libmaa, continued * Created: Mon Apr 24 17:40:51 1995 by faith@dict.org * Copyright 1995, 1997, 2002 Rickard E. Faith (faith@dict.org) * Copyright 2002-2008 Aleksey Cheusov (vle@gmx.net) * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "maaP.h" static hsh_HashTable _prs_hash; void prs_register_concrete( const char *symbol, const char *concrete ) { if (!_prs_hash) _prs_hash = hsh_create( NULL, NULL ); hsh_insert( _prs_hash, str_find( symbol ), str_find( concrete ) ); } const char *prs_concrete( const char *symbol ) { if (!_prs_hash) return NULL; return hsh_retrieve( _prs_hash, symbol ); } void _prs_shutdown( void ) { if (_prs_hash) hsh_destroy( _prs_hash ); } libmaa-1.4.4/maa/rnd.c0000644000175000017500000014563713457657444014407 0ustar cheusovcheusov/* rnd.c -- "Random" number generator for test programs * Created: Wed Sep 25 10:04:32 1996 by faith@dict.org * Copyright 1996, 2002 Rickard E. Faith (faith@dict.org) * Copyright 2002-2008 Aleksey Cheusov (vle@gmx.net) * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "maaP.h" #include #define MAXRND 5000 /* Random numbers are hard coded, since there is great variability in terms of what random(3) actually returns. */ static double rnd[MAXRND] = { 0.125341, 0.544604, 0.414346, 0.583974, 0.174296, 0.961711, 0.690130, 0.292579, 0.562515, 0.109384, 0.823356, 0.714925, 0.841857, 0.481093, 0.448740, 0.533222, 0.116015, 0.745627, 0.391775, 0.068052, 0.350539, 0.739208, 0.712224, 0.128878, 0.695183, 0.796589, 0.460657, 0.170030, 0.598239, 0.450458, 0.697441, 0.723580, 0.995062, 0.111787, 0.307554, 0.169358, 0.073498, 0.997683, 0.461937, 0.636013, 0.107068, 0.285293, 0.350938, 0.948924, 0.766386, 0.799678, 0.482146, 0.882401, 0.545306, 0.873921, 0.950452, 0.895845, 0.613129, 0.662676, 0.024722, 0.308312, 0.459265, 0.485379, 0.478342, 0.057504, 0.935837, 0.175782, 0.781084, 0.930899, 0.287569, 0.088638, 0.100257, 0.361067, 0.086321, 0.562194, 0.997080, 0.193389, 0.847487, 0.348018, 0.142314, 0.613873, 0.147696, 0.624459, 0.496274, 0.693002, 0.498380, 0.446726, 0.588847, 0.111509, 0.109403, 0.613569, 0.419821, 0.568668, 0.098948, 0.898162, 0.626172, 0.034785, 0.073945, 0.407257, 0.965684, 0.361514, 0.495895, 0.065940, 0.722581, 0.582216, 0.628134, 0.719660, 0.775606, 0.475621, 0.067678, 0.917919, 0.089494, 0.215375, 0.542379, 0.585768, 0.908377, 0.040759, 0.032494, 0.497224, 0.152267, 0.141897, 0.110793, 0.572088, 0.710564, 0.209741, 0.470251, 0.336737, 0.244526, 0.544195, 0.743994, 0.210210, 0.905709, 0.239889, 0.276150, 0.628290, 0.822105, 0.904284, 0.347950, 0.597711, 0.379905, 0.415628, 0.515630, 0.469399, 0.631003, 0.058008, 0.055166, 0.539380, 0.098767, 0.087660, 0.036604, 0.251035, 0.229557, 0.147397, 0.823123, 0.940121, 0.357138, 0.293373, 0.276858, 0.601664, 0.837569, 0.020852, 0.811873, 0.743278, 0.260741, 0.088024, 0.371568, 0.082846, 0.992308, 0.719518, 0.680556, 0.372213, 0.135147, 0.196186, 0.841612, 0.766150, 0.254195, 0.896778, 0.305530, 0.352962, 0.984438, 0.342134, 0.603997, 0.213995, 0.489531, 0.427119, 0.154117, 0.846668, 0.720493, 0.430975, 0.448332, 0.558062, 0.451827, 0.260206, 0.301340, 0.712567, 0.348229, 0.672908, 0.795413, 0.340537, 0.392427, 0.475970, 0.712750, 0.527573, 0.672156, 0.554361, 0.293723, 0.926351, 0.451140, 0.599253, 0.279313, 0.435578, 0.941387, 0.883309, 0.649573, 0.430918, 0.310429, 0.803690, 0.277586, 0.030922, 0.234665, 0.725918, 0.588984, 0.686492, 0.986124, 0.890324, 0.399059, 0.334353, 0.563232, 0.194472, 0.674890, 0.955659, 0.670442, 0.387640, 0.483232, 0.342598, 0.942001, 0.776955, 0.268949, 0.393141, 0.376209, 0.548261, 0.828719, 0.317596, 0.431571, 0.478292, 0.748514, 0.742000, 0.281982, 0.026100, 0.772922, 0.516647, 0.752018, 0.361905, 0.203138, 0.738142, 0.252229, 0.602197, 0.072494, 0.815461, 0.796669, 0.747384, 0.771120, 0.467111, 0.135024, 0.254352, 0.809709, 0.077025, 0.031307, 0.078658, 0.470166, 0.407516, 0.626919, 0.298884, 0.725112, 0.058490, 0.777176, 0.473626, 0.800490, 0.059158, 0.499725, 0.573411, 0.575805, 0.251743, 0.935317, 0.778943, 0.989885, 0.187546, 0.381140, 0.062380, 0.003007, 0.177810, 0.809764, 0.774127, 0.644921, 0.944788, 0.028479, 0.454630, 0.021813, 0.059786, 0.533287, 0.491978, 0.467302, 0.160206, 0.790862, 0.192414, 0.218696, 0.568039, 0.666039, 0.019186, 0.627197, 0.165765, 0.592598, 0.203001, 0.417508, 0.527914, 0.981944, 0.407393, 0.715460, 0.363084, 0.469773, 0.718467, 0.540894, 0.279537, 0.492594, 0.185815, 0.224324, 0.521073, 0.640444, 0.246137, 0.580859, 0.173731, 0.738115, 0.048161, 0.333938, 0.528978, 0.240575, 0.552634, 0.097016, 0.906614, 0.571820, 0.724213, 0.072379, 0.164418, 0.927214, 0.489887, 0.692332, 0.909158, 0.897280, 0.407792, 0.272242, 0.367053, 0.126260, 0.813136, 0.646590, 0.618854, 0.998951, 0.870914, 0.139927, 0.639395, 0.117051, 0.720786, 0.813126, 0.855166, 0.768946, 0.147064, 0.384144, 0.009521, 0.699698, 0.481161, 0.916135, 0.271518, 0.205374, 0.988514, 0.435936, 0.132588, 0.478401, 0.128268, 0.041746, 0.375681, 0.536060, 0.313988, 0.742733, 0.662320, 0.127124, 0.389323, 0.281173, 0.126074, 0.260237, 0.421100, 0.765469, 0.377288, 0.141885, 0.578596, 0.232455, 0.910832, 0.725659, 0.616599, 0.920353, 0.425357, 0.097760, 0.836488, 0.696876, 0.303133, 0.825002, 0.132811, 0.435721, 0.303403, 0.261079, 0.477466, 0.679083, 0.797139, 0.791454, 0.421817, 0.459459, 0.918578, 0.811140, 0.740632, 0.044653, 0.071377, 0.161732, 0.810122, 0.448665, 0.303618, 0.388718, 0.681120, 0.214450, 0.114377, 0.297719, 0.134803, 0.539735, 0.395478, 0.971291, 0.236610, 0.698611, 0.796293, 0.369421, 0.134332, 0.099696, 0.630500, 0.611798, 0.778779, 0.427640, 0.403253, 0.200596, 0.887099, 0.321831, 0.011736, 0.627731, 0.366484, 0.083113, 0.789464, 0.176606, 0.531778, 0.093081, 0.565323, 0.212898, 0.307531, 0.679701, 0.510617, 0.442334, 0.219435, 0.906095, 0.413625, 0.456045, 0.604706, 0.209919, 0.825466, 0.739038, 0.309614, 0.455967, 0.350836, 0.088394, 0.883607, 0.754089, 0.288990, 0.770706, 0.075920, 0.300725, 0.398437, 0.442404, 0.383838, 0.187901, 0.619010, 0.915616, 0.280982, 0.184334, 0.128514, 0.588513, 0.864034, 0.639130, 0.030847, 0.083469, 0.545225, 0.444473, 0.539514, 0.149931, 0.654391, 0.364981, 0.888969, 0.964006, 0.820948, 0.239806, 0.052399, 0.704554, 0.993895, 0.341389, 0.475260, 0.069815, 0.642114, 0.873697, 0.512219, 0.025952, 0.061597, 0.131229, 0.941568, 0.342579, 0.315563, 0.070082, 0.931093, 0.179597, 0.709212, 0.961940, 0.263066, 0.254437, 0.406413, 0.802581, 0.404368, 0.060804, 0.167561, 0.293338, 0.024810, 0.988509, 0.533143, 0.077209, 0.693063, 0.527038, 0.418598, 0.168323, 0.596853, 0.060712, 0.042020, 0.109073, 0.086664, 0.103617, 0.240302, 0.028233, 0.446197, 0.555865, 0.098315, 0.377289, 0.735462, 0.807527, 0.339229, 0.998528, 0.061964, 0.745642, 0.801109, 0.466333, 0.806446, 0.968670, 0.759670, 0.831256, 0.957179, 0.292814, 0.908465, 0.650242, 0.819852, 0.327063, 0.818565, 0.416705, 0.387775, 0.860585, 0.525778, 0.474440, 0.964203, 0.766080, 0.502672, 0.410399, 0.321945, 0.600987, 0.787689, 0.057407, 0.408514, 0.126918, 0.055936, 0.470478, 0.872560, 0.857044, 0.936811, 0.679006, 0.825714, 0.696482, 0.510262, 0.782893, 0.989295, 0.418728, 0.433136, 0.809147, 0.745791, 0.251701, 0.225853, 0.133566, 0.112287, 0.751631, 0.608006, 0.076489, 0.517711, 0.110679, 0.486889, 0.839656, 0.711666, 0.274578, 0.897063, 0.120180, 0.401496, 0.952999, 0.590658, 0.274056, 0.810043, 0.527469, 0.953062, 0.635758, 0.223951, 0.463325, 0.418651, 0.213246, 0.882052, 0.851787, 0.022393, 0.627843, 0.103488, 0.248246, 0.761409, 0.215774, 0.999877, 0.369416, 0.292264, 0.517587, 0.480094, 0.779153, 0.357243, 0.191760, 0.053730, 0.254307, 0.311939, 0.455226, 0.207305, 0.902597, 0.729282, 0.017348, 0.430066, 0.682344, 0.653106, 0.654017, 0.145668, 0.071757, 0.867263, 0.027721, 0.923544, 0.889656, 0.655564, 0.027032, 0.137902, 0.416973, 0.242806, 0.137778, 0.786389, 0.535070, 0.655366, 0.266483, 0.314223, 0.012609, 0.458243, 0.367953, 0.266916, 0.770182, 0.823179, 0.474221, 0.672779, 0.552460, 0.491569, 0.102845, 0.234804, 0.144675, 0.756862, 0.380473, 0.216432, 0.624124, 0.408194, 0.139976, 0.513780, 0.063757, 0.167008, 0.651682, 0.480731, 0.409814, 0.789461, 0.267120, 0.944884, 0.444827, 0.533603, 0.259106, 0.457436, 0.991845, 0.627059, 0.724351, 0.762027, 0.450238, 0.198572, 0.434806, 0.002698, 0.690141, 0.537651, 0.237503, 0.834817, 0.294513, 0.617976, 0.051249, 0.918637, 0.026169, 0.191226, 0.432417, 0.089927, 0.358234, 0.084100, 0.570657, 0.768047, 0.873560, 0.837777, 0.712931, 0.318387, 0.371379, 0.972038, 0.775823, 0.363225, 0.599097, 0.500174, 0.125252, 0.049335, 0.698746, 0.560058, 0.052033, 0.388887, 0.097709, 0.289536, 0.223704, 0.392221, 0.907512, 0.274954, 0.310858, 0.933681, 0.466179, 0.743275, 0.023608, 0.824413, 0.827375, 0.594265, 0.592460, 0.700935, 0.432042, 0.305392, 0.019322, 0.803421, 0.277429, 0.795145, 0.166646, 0.876526, 0.295319, 0.291897, 0.925861, 0.994065, 0.851955, 0.977895, 0.382952, 0.949663, 0.267431, 0.606657, 0.341884, 0.174943, 0.881610, 0.652742, 0.108624, 0.347790, 0.396018, 0.132231, 0.172202, 0.223393, 0.726496, 0.764663, 0.924328, 0.158538, 0.070054, 0.943650, 0.961959, 0.347483, 0.738795, 0.128604, 0.224010, 0.034114, 0.420502, 0.149871, 0.028179, 0.272457, 0.127766, 0.411132, 0.222120, 0.395197, 0.017788, 0.564005, 0.570139, 0.899399, 0.216747, 0.678763, 0.247188, 0.612765, 0.810995, 0.419391, 0.836157, 0.537491, 0.184053, 0.760485, 0.696029, 0.254107, 0.704135, 0.657987, 0.601591, 0.442931, 0.786592, 0.825600, 0.477045, 0.207093, 0.975471, 0.505224, 0.479550, 0.103237, 0.916356, 0.701670, 0.498434, 0.934144, 0.265675, 0.068573, 0.833543, 0.482421, 0.747336, 0.080731, 0.095186, 0.558331, 0.500122, 0.931343, 0.095822, 0.684175, 0.691828, 0.791850, 0.938282, 0.395964, 0.449837, 0.539873, 0.838894, 0.236429, 0.365474, 0.315939, 0.443523, 0.340945, 0.821163, 0.923073, 0.444182, 0.737519, 0.624743, 0.942616, 0.671663, 0.890417, 0.011189, 0.505206, 0.372839, 0.758526, 0.585937, 0.468025, 0.316856, 0.086058, 0.399368, 0.412678, 0.770234, 0.091196, 0.204528, 0.708516, 0.487160, 0.654366, 0.248389, 0.326054, 0.890795, 0.613863, 0.641993, 0.334317, 0.954808, 0.463156, 0.257390, 0.398990, 0.200675, 0.882132, 0.341606, 0.872337, 0.772549, 0.352795, 0.377543, 0.145388, 0.111321, 0.963479, 0.613413, 0.428177, 0.049538, 0.012781, 0.840856, 0.819771, 0.103977, 0.045384, 0.528287, 0.591137, 0.699749, 0.776677, 0.917191, 0.590544, 0.390539, 0.559184, 0.924861, 0.345347, 0.022340, 0.182251, 0.744338, 0.223014, 0.064384, 0.085944, 0.095352, 0.836933, 0.438739, 0.472894, 0.982321, 0.550060, 0.436374, 0.595734, 0.978237, 0.485912, 0.608514, 0.819093, 0.305683, 0.712491, 0.864477, 0.833971, 0.303628, 0.564226, 0.610647, 0.220819, 0.154770, 0.001187, 0.780003, 0.079632, 0.346534, 0.802343, 0.261883, 0.090872, 0.025357, 0.326267, 0.176815, 0.120709, 0.163200, 0.615554, 0.593603, 0.145521, 0.165614, 0.029977, 0.741255, 0.143852, 0.515888, 0.349769, 0.962945, 0.821571, 0.062261, 0.827421, 0.655542, 0.365889, 0.391647, 0.266189, 0.586708, 0.546417, 0.267376, 0.366711, 0.626049, 0.613910, 0.169054, 0.887932, 0.704782, 0.194411, 0.214199, 0.881597, 0.315120, 0.377398, 0.497151, 0.908723, 0.522919, 0.662765, 0.938700, 0.264174, 0.806617, 0.454588, 0.613943, 0.769562, 0.276160, 0.676204, 0.596983, 0.931702, 0.042092, 0.988631, 0.197891, 0.628800, 0.535048, 0.465267, 0.995512, 0.161097, 0.079177, 0.164566, 0.049029, 0.783958, 0.358977, 0.263227, 0.665555, 0.674097, 0.640626, 0.162706, 0.582820, 0.163545, 0.825472, 0.521520, 0.427719, 0.632089, 0.976108, 0.041662, 0.401651, 0.252268, 0.717865, 0.998634, 0.183970, 0.759958, 0.987265, 0.381861, 0.388758, 0.522313, 0.847128, 0.384270, 0.683410, 0.926305, 0.548835, 0.732439, 0.710263, 0.907812, 0.995666, 0.375818, 0.581909, 0.636292, 0.538525, 0.164729, 0.799837, 0.363996, 0.686248, 0.227555, 0.996085, 0.662356, 0.269217, 0.397736, 0.914624, 0.987083, 0.396371, 0.098594, 0.747041, 0.383635, 0.480455, 0.135799, 0.905948, 0.327583, 0.520069, 0.589358, 0.253888, 0.068904, 0.321796, 0.964151, 0.976716, 0.317462, 0.339969, 0.558625, 0.953754, 0.878494, 0.723354, 0.753591, 0.242490, 0.409602, 0.981146, 0.238576, 0.071959, 0.250363, 0.636312, 0.986583, 0.237446, 0.032682, 0.085177, 0.984486, 0.416318, 0.565633, 0.120285, 0.322266, 0.893216, 0.640354, 0.911623, 0.147104, 0.709258, 0.233420, 0.111255, 0.685975, 0.550882, 0.451224, 0.244600, 0.504636, 0.329718, 0.967954, 0.258227, 0.572208, 0.377557, 0.239373, 0.810783, 0.449515, 0.489736, 0.447095, 0.436099, 0.727182, 0.479778, 0.521276, 0.711668, 0.896095, 0.086909, 0.831953, 0.218361, 0.980125, 0.472307, 0.129984, 0.127228, 0.181566, 0.363404, 0.238483, 0.867541, 0.914286, 0.689707, 0.112141, 0.418922, 0.019424, 0.080095, 0.677149, 0.591632, 0.457652, 0.916522, 0.402415, 0.907167, 0.406257, 0.849510, 0.343266, 0.133439, 0.329288, 0.864542, 0.845107, 0.225383, 0.951450, 0.677060, 0.443744, 0.931575, 0.149367, 0.573728, 0.058803, 0.330933, 0.937132, 0.297286, 0.198474, 0.851418, 0.986993, 0.310615, 0.270341, 0.006417, 0.390710, 0.947489, 0.598049, 0.848362, 0.864011, 0.000464, 0.755529, 0.270268, 0.849975, 0.098795, 0.403707, 0.179263, 0.963337, 0.248814, 0.404646, 0.914787, 0.925874, 0.848390, 0.846363, 0.075241, 0.422118, 0.905166, 0.406174, 0.359250, 0.202452, 0.604648, 0.210669, 0.189444, 0.915263, 0.481009, 0.195861, 0.305974, 0.428499, 0.793910, 0.154336, 0.292509, 0.794374, 0.909866, 0.562778, 0.644349, 0.008661, 0.966485, 0.823611, 0.971998, 0.215299, 0.228257, 0.886785, 0.141173, 0.076647, 0.733148, 0.216414, 0.498765, 0.638314, 0.622588, 0.858015, 0.840765, 0.227237, 0.068684, 0.030210, 0.142500, 0.549693, 0.226071, 0.448474, 0.978191, 0.019981, 0.602810, 0.270701, 0.814355, 0.512676, 0.833479, 0.458704, 0.521337, 0.799963, 0.282315, 0.493334, 0.015262, 0.510572, 0.380120, 0.156435, 0.587219, 0.113268, 0.372849, 0.085984, 0.751581, 0.995437, 0.943999, 0.592346, 0.222673, 0.012682, 0.622556, 0.365173, 0.562375, 0.848627, 0.813647, 0.540566, 0.868608, 0.416457, 0.811267, 0.682963, 0.929133, 0.644746, 0.141667, 0.450470, 0.444709, 0.423982, 0.943804, 0.459972, 0.934554, 0.323924, 0.616407, 0.521773, 0.437191, 0.989255, 0.607757, 0.188772, 0.984692, 0.551755, 0.781119, 0.207365, 0.564438, 0.403675, 0.572539, 0.126813, 0.252302, 0.386186, 0.667379, 0.120910, 0.802643, 0.478647, 0.803873, 0.731776, 0.123393, 0.945540, 0.182246, 0.568102, 0.369523, 0.126050, 0.028074, 0.304077, 0.449973, 0.644480, 0.825851, 0.887165, 0.633736, 0.433607, 0.075937, 0.618428, 0.985363, 0.857056, 0.825793, 0.549801, 0.260731, 0.398332, 0.676614, 0.513033, 0.784518, 0.343993, 0.633943, 0.587161, 0.822640, 0.437816, 0.318937, 0.946032, 0.383356, 0.501183, 0.514134, 0.752879, 0.627232, 0.542208, 0.056956, 0.077206, 0.186689, 0.882807, 0.964370, 0.820424, 0.316414, 0.040307, 0.438852, 0.301777, 0.897363, 0.264645, 0.851578, 0.158094, 0.662977, 0.528191, 0.671126, 0.447495, 0.872184, 0.305069, 0.034656, 0.694824, 0.742885, 0.353593, 0.640856, 0.126242, 0.854776, 0.154990, 0.879121, 0.482008, 0.697199, 0.936077, 0.559214, 0.883887, 0.818884, 0.523584, 0.704312, 0.135298, 0.563891, 0.143163, 0.437075, 0.461254, 0.407809, 0.288653, 0.619347, 0.070786, 0.816845, 0.290474, 0.518281, 0.689029, 0.595543, 0.552937, 0.383853, 0.338428, 0.906530, 0.024709, 0.464670, 0.761305, 0.179699, 0.343791, 0.243313, 0.876898, 0.279868, 0.802527, 0.760785, 0.098752, 0.326110, 0.465097, 0.234050, 0.890001, 0.608260, 0.671126, 0.351255, 0.016069, 0.959779, 0.970602, 0.086854, 0.776623, 0.261076, 0.605135, 0.465652, 0.856619, 0.158072, 0.849505, 0.195047, 0.064601, 0.874213, 0.659717, 0.825906, 0.053913, 0.003508, 0.069219, 0.930810, 0.283376, 0.871746, 0.691595, 0.382127, 0.197857, 0.156692, 0.616177, 0.087858, 0.764952, 0.287303, 0.439113, 0.781021, 0.247082, 0.409715, 0.867875, 0.023705, 0.670791, 0.473010, 0.489358, 0.527410, 0.631082, 0.338862, 0.722458, 0.695683, 0.213076, 0.382175, 0.521589, 0.266988, 0.385683, 0.590809, 0.197799, 0.669058, 0.462555, 0.889394, 0.051185, 0.660412, 0.046086, 0.667363, 0.748269, 0.811038, 0.954666, 0.187382, 0.592059, 0.201748, 0.597097, 0.459935, 0.225453, 0.267888, 0.932945, 0.714811, 0.795298, 0.564027, 0.053674, 0.517756, 0.259710, 0.266750, 0.899930, 0.781300, 0.533738, 0.285613, 0.372108, 0.731537, 0.954671, 0.834663, 0.620931, 0.005857, 0.495075, 0.667017, 0.673220, 0.243344, 0.478056, 0.627886, 0.430726, 0.070115, 0.829634, 0.027823, 0.530049, 0.055087, 0.295710, 0.462995, 0.769898, 0.091009, 0.027022, 0.823572, 0.608764, 0.286732, 0.090321, 0.508695, 0.068031, 0.624059, 0.794308, 0.440140, 0.355596, 0.748979, 0.274803, 0.976527, 0.754836, 0.769878, 0.643544, 0.428055, 0.013222, 0.121600, 0.055941, 0.443948, 0.191715, 0.885574, 0.471771, 0.721764, 0.940661, 0.767481, 0.184759, 0.710559, 0.858490, 0.211780, 0.534131, 0.467254, 0.498512, 0.624453, 0.975948, 0.566543, 0.248512, 0.770256, 0.006683, 0.604109, 0.519235, 0.281486, 0.580636, 0.274071, 0.051363, 0.224180, 0.702126, 0.064585, 0.345780, 0.758066, 0.508533, 0.537494, 0.643640, 0.980304, 0.259258, 0.584302, 0.747785, 0.444017, 0.294861, 0.606274, 0.655797, 0.828992, 0.073528, 0.154309, 0.453445, 0.049477, 0.720852, 0.701958, 0.819733, 0.727535, 0.306066, 0.338968, 0.009020, 0.886702, 0.613039, 0.060383, 0.110881, 0.315164, 0.124969, 0.456661, 0.073231, 0.633502, 0.994155, 0.716871, 0.613806, 0.253413, 0.301173, 0.361590, 0.697430, 0.596034, 0.967865, 0.353227, 0.425026, 0.041393, 0.507536, 0.878472, 0.090870, 0.228388, 0.580429, 0.910603, 0.955923, 0.886495, 0.249571, 0.964943, 0.773197, 0.862609, 0.025326, 0.884078, 0.177774, 0.150295, 0.340740, 0.251004, 0.783797, 0.334895, 0.967875, 0.397603, 0.588308, 0.269048, 0.759193, 0.285738, 0.865082, 0.727058, 0.638966, 0.290108, 0.768451, 0.146502, 0.168580, 0.859321, 0.374890, 0.749009, 0.769923, 0.330813, 0.635504, 0.019494, 0.295756, 0.408701, 0.882103, 0.321082, 0.292780, 0.059877, 0.471377, 0.633519, 0.310881, 0.255174, 0.968414, 0.278756, 0.652777, 0.556722, 0.547804, 0.411970, 0.842460, 0.412886, 0.139028, 0.481426, 0.702994, 0.907479, 0.627928, 0.871574, 0.766799, 0.002819, 0.620583, 0.536723, 0.333632, 0.256087, 0.556216, 0.629388, 0.664788, 0.438320, 0.950471, 0.957568, 0.498196, 0.421848, 0.591087, 0.809077, 0.677022, 0.559500, 0.087833, 0.329799, 0.116222, 0.635638, 0.741768, 0.958683, 0.048524, 0.880796, 0.440109, 0.751519, 0.788275, 0.068037, 0.623093, 0.555074, 0.070856, 0.243676, 0.091797, 0.404488, 0.499763, 0.648013, 0.033876, 0.164551, 0.086333, 0.984347, 0.122118, 0.584529, 0.406195, 0.713205, 0.393606, 0.083217, 0.272705, 0.481440, 0.413015, 0.388927, 0.117077, 0.154784, 0.347610, 0.165601, 0.035580, 0.787718, 0.917120, 0.823855, 0.855756, 0.540213, 0.378929, 0.926612, 0.783888, 0.470725, 0.331100, 0.283651, 0.118739, 0.364976, 0.448202, 0.205071, 0.349322, 0.570320, 0.789601, 0.755517, 0.283525, 0.183207, 0.838734, 0.556230, 0.664646, 0.251749, 0.945157, 0.781723, 0.406532, 0.292767, 0.947325, 0.442112, 0.080485, 0.864445, 0.265967, 0.936241, 0.404658, 0.644895, 0.862852, 0.188546, 0.115621, 0.193952, 0.472197, 0.234360, 0.558928, 0.920399, 0.439431, 0.908250, 0.490719, 0.229032, 0.663767, 0.774244, 0.412238, 0.502501, 0.330474, 0.076884, 0.754249, 0.275631, 0.858608, 0.160782, 0.568397, 0.805933, 0.602894, 0.648883, 0.670378, 0.868861, 0.585123, 0.075036, 0.513756, 0.447976, 0.263582, 0.629377, 0.641927, 0.735779, 0.863737, 0.200855, 0.656178, 0.303168, 0.109105, 0.146898, 0.532200, 0.772872, 0.921142, 0.944438, 0.275373, 0.251615, 0.021322, 0.029622, 0.527246, 0.879930, 0.190404, 0.095643, 0.685863, 0.793299, 0.744526, 0.356241, 0.662160, 0.329649, 0.431276, 0.175916, 0.777625, 0.694858, 0.805293, 0.419552, 0.430638, 0.669030, 0.620407, 0.086816, 0.972198, 0.729513, 0.233714, 0.504398, 0.502385, 0.154855, 0.448836, 0.777758, 0.406470, 0.470158, 0.807380, 0.933716, 0.350088, 0.997784, 0.029360, 0.035951, 0.791083, 0.773886, 0.392192, 0.453243, 0.103535, 0.823468, 0.629159, 0.881160, 0.518327, 0.434452, 0.300712, 0.948964, 0.103482, 0.921119, 0.035781, 0.075680, 0.650632, 0.269494, 0.580078, 0.153017, 0.424350, 0.028914, 0.930775, 0.830820, 0.499072, 0.738155, 0.764536, 0.849160, 0.735939, 0.793896, 0.885111, 0.527022, 0.567782, 0.277303, 0.980265, 0.671316, 0.100771, 0.609423, 0.552476, 0.619098, 0.043875, 0.853188, 0.568062, 0.147357, 0.774307, 0.603843, 0.223038, 0.424939, 0.873337, 0.803116, 0.577956, 0.297687, 0.832030, 0.508731, 0.128507, 0.331102, 0.246885, 0.893044, 0.180262, 0.982825, 0.686940, 0.065374, 0.509847, 0.254721, 0.342677, 0.490112, 0.926038, 0.443448, 0.099535, 0.478513, 0.062546, 0.143410, 0.331701, 0.630608, 0.290767, 0.106008, 0.234451, 0.513805, 0.530948, 0.107789, 0.316921, 0.108903, 0.405476, 0.148951, 0.617634, 0.533983, 0.480053, 0.864519, 0.427026, 0.660316, 0.847344, 0.113966, 0.725689, 0.357191, 0.368687, 0.068366, 0.847302, 0.294725, 0.511814, 0.946837, 0.773238, 0.574359, 0.090247, 0.104940, 0.204968, 0.381014, 0.210948, 0.439419, 0.894819, 0.741896, 0.547208, 0.211740, 0.850799, 0.952683, 0.360691, 0.468433, 0.486666, 0.840744, 0.332952, 0.913692, 0.501060, 0.180296, 0.027658, 0.226749, 0.537487, 0.396346, 0.295115, 0.384789, 0.691070, 0.806928, 0.331626, 0.464309, 0.381287, 0.421873, 0.569248, 0.586255, 0.802887, 0.780196, 0.025674, 0.697706, 0.522092, 0.572882, 0.909446, 0.372891, 0.525566, 0.270137, 0.841324, 0.012232, 0.110881, 0.174276, 0.925924, 0.611941, 0.354573, 0.953582, 0.838690, 0.892059, 0.349928, 0.133805, 0.276848, 0.040998, 0.940733, 0.608474, 0.505307, 0.322020, 0.030346, 0.074556, 0.908275, 0.833233, 0.854752, 0.933950, 0.530939, 0.376844, 0.506832, 0.440385, 0.749735, 0.032398, 0.710522, 0.591059, 0.044629, 0.821403, 0.765336, 0.970554, 0.433345, 0.119908, 0.924136, 0.272035, 0.011968, 0.274064, 0.405840, 0.288815, 0.315063, 0.346572, 0.897289, 0.820370, 0.668593, 0.927635, 0.894925, 0.576868, 0.760868, 0.749677, 0.510818, 0.291807, 0.126521, 0.017650, 0.732192, 0.876256, 0.050048, 0.442714, 0.467315, 0.094677, 0.264117, 0.232651, 0.065231, 0.697462, 0.352560, 0.989367, 0.969497, 0.364527, 0.263431, 0.375337, 0.653342, 0.578493, 0.721909, 0.550631, 0.398863, 0.390502, 0.478267, 0.293788, 0.967370, 0.239135, 0.043465, 0.478188, 0.530942, 0.169986, 0.495838, 0.263134, 0.046243, 0.545885, 0.705848, 0.513558, 0.640563, 0.969965, 0.746209, 0.705793, 0.667428, 0.098769, 0.695160, 0.636925, 0.463296, 0.958590, 0.012262, 0.116638, 0.537083, 0.734171, 0.667270, 0.935946, 0.124673, 0.145536, 0.229734, 0.092043, 0.384671, 0.273200, 0.570231, 0.915613, 0.443186, 0.066068, 0.178747, 0.489429, 0.611954, 0.884595, 0.002987, 0.252516, 0.854560, 0.749196, 0.958310, 0.521987, 0.847965, 0.653469, 0.158912, 0.311261, 0.612059, 0.171174, 0.427899, 0.149143, 0.905345, 0.095169, 0.085089, 0.030018, 0.240705, 0.314824, 0.122060, 0.625377, 0.588023, 0.692291, 0.540990, 0.031209, 0.758360, 0.719736, 0.520638, 0.370313, 0.604331, 0.523624, 0.622830, 0.458891, 0.272820, 0.581140, 0.980878, 0.120785, 0.234609, 0.139790, 0.432046, 0.846668, 0.310964, 0.859945, 0.995811, 0.216309, 0.955114, 0.080900, 0.246326, 0.195819, 0.395724, 0.368387, 0.821196, 0.983747, 0.060678, 0.362186, 0.014956, 0.819037, 0.081922, 0.535594, 0.189351, 0.686253, 0.059218, 0.812181, 0.145144, 0.332039, 0.393320, 0.126022, 0.452824, 0.627929, 0.265812, 0.884870, 0.474597, 0.576776, 0.744815, 0.470408, 0.793085, 0.699929, 0.551308, 0.039411, 0.895748, 0.947032, 0.407798, 0.716944, 0.930778, 0.468475, 0.079130, 0.945734, 0.287513, 0.161052, 0.481328, 0.476863, 0.847305, 0.540546, 0.289044, 0.992449, 0.872585, 0.682364, 0.118471, 0.325408, 0.310293, 0.384283, 0.210278, 0.784889, 0.961059, 0.955093, 0.255297, 0.754144, 0.655021, 0.806605, 0.793556, 0.550769, 0.753637, 0.201353, 0.267713, 0.684415, 0.669829, 0.346843, 0.630150, 0.957341, 0.507894, 0.111478, 0.434204, 0.355199, 0.652024, 0.723248, 0.347647, 0.524609, 0.405612, 0.466118, 0.850017, 0.715904, 0.850401, 0.060295, 0.500794, 0.811461, 0.015388, 0.756091, 0.565605, 0.670409, 0.562696, 0.359161, 0.221178, 0.316333, 0.560514, 0.488891, 0.000748, 0.230343, 0.835734, 0.630898, 0.187684, 0.343628, 0.742376, 0.621888, 0.698827, 0.394400, 0.345137, 0.046474, 0.919008, 0.750748, 0.512592, 0.769025, 0.466653, 0.362994, 0.829321, 0.967447, 0.174454, 0.844709, 0.723538, 0.740059, 0.515118, 0.286234, 0.099220, 0.736296, 0.602567, 0.659734, 0.225187, 0.603316, 0.890076, 0.060921, 0.234214, 0.077761, 0.404549, 0.976590, 0.699649, 0.103376, 0.370989, 0.044785, 0.149850, 0.289997, 0.795534, 0.662443, 0.059023, 0.262187, 0.025436, 0.888343, 0.229633, 0.199891, 0.733052, 0.953171, 0.939950, 0.248170, 0.239405, 0.039170, 0.984466, 0.841972, 0.698903, 0.209653, 0.445288, 0.588980, 0.270575, 0.679502, 0.666740, 0.675124, 0.656091, 0.366389, 0.778500, 0.027081, 0.411175, 0.928350, 0.317078, 0.206709, 0.590793, 0.376101, 0.468895, 0.616229, 0.264444, 0.698528, 0.816119, 0.997496, 0.651699, 0.756069, 0.245666, 0.891104, 0.795239, 0.230132, 0.733076, 0.494142, 0.439786, 0.178364, 0.083122, 0.710360, 0.857866, 0.749863, 0.385484, 0.513957, 0.116252, 0.163984, 0.541038, 0.527427, 0.092334, 0.858116, 0.734136, 0.683126, 0.234217, 0.203031, 0.299355, 0.498661, 0.901559, 0.115474, 0.496157, 0.553258, 0.871544, 0.741823, 0.444362, 0.666783, 0.971956, 0.177438, 0.160925, 0.411741, 0.355802, 0.244047, 0.122101, 0.213668, 0.993910, 0.507585, 0.727626, 0.110162, 0.671569, 0.268664, 0.637589, 0.763903, 0.126780, 0.371725, 0.447029, 0.360996, 0.574755, 0.746384, 0.859657, 0.476314, 0.861858, 0.355814, 0.029572, 0.733402, 0.097637, 0.473934, 0.400185, 0.069593, 0.651372, 0.561110, 0.481334, 0.007175, 0.805157, 0.603435, 0.220843, 0.799067, 0.111021, 0.948469, 0.909229, 0.782590, 0.217133, 0.546818, 0.546493, 0.343913, 0.918543, 0.993522, 0.704909, 0.493299, 0.739905, 0.564566, 0.969613, 0.601764, 0.920380, 0.999185, 0.335166, 0.018017, 0.473119, 0.735351, 0.087610, 0.124492, 0.296460, 0.568944, 0.131666, 0.101617, 0.172380, 0.352509, 0.900685, 0.283401, 0.300978, 0.809914, 0.065991, 0.518111, 0.356732, 0.612483, 0.862024, 0.275276, 0.606005, 0.566933, 0.768574, 0.345910, 0.131499, 0.738187, 0.947674, 0.051879, 0.737372, 0.282840, 0.069896, 0.210491, 0.018191, 0.157507, 0.334983, 0.314651, 0.726451, 0.466649, 0.416269, 0.898831, 0.819159, 0.316953, 0.182232, 0.120137, 0.126867, 0.248222, 0.638248, 0.483600, 0.860706, 0.500272, 0.758875, 0.466711, 0.067205, 0.527449, 0.812621, 0.198704, 0.265636, 0.760296, 0.250583, 0.003008, 0.043136, 0.320479, 0.213500, 0.061327, 0.477986, 0.548483, 0.375978, 0.204437, 0.015132, 0.792247, 0.103268, 0.834291, 0.109200, 0.285500, 0.954428, 0.236067, 0.533722, 0.592677, 0.719667, 0.394428, 0.092949, 0.478543, 0.861139, 0.160154, 0.005992, 0.673760, 0.358858, 0.271628, 0.434056, 0.609441, 0.274637, 0.477192, 0.929920, 0.488137, 0.538519, 0.407906, 0.036620, 0.914497, 0.612343, 0.051752, 0.706743, 0.715611, 0.886043, 0.815944, 0.001111, 0.840471, 0.052011, 0.534833, 0.433147, 0.771678, 0.929261, 0.526096, 0.250221, 0.790400, 0.686250, 0.256213, 0.464161, 0.045108, 0.527841, 0.898216, 0.654549, 0.802478, 0.375408, 0.584469, 0.290615, 0.913927, 0.992375, 0.327234, 0.828423, 0.604718, 0.378986, 0.535167, 0.320329, 0.265029, 0.351110, 0.321440, 0.105500, 0.403121, 0.856274, 0.538647, 0.174800, 0.785535, 0.064743, 0.425020, 0.575935, 0.750994, 0.681233, 0.040096, 0.796102, 0.209074, 0.938312, 0.450650, 0.011552, 0.313720, 0.035119, 0.302167, 0.227647, 0.027494, 0.629402, 0.056071, 0.632213, 0.008388, 0.591237, 0.952542, 0.273417, 0.942348, 0.273983, 0.378916, 0.345469, 0.130256, 0.917563, 0.520269, 0.915791, 0.982307, 0.945289, 0.491726, 0.733300, 0.626522, 0.531822, 0.529402, 0.835597, 0.470134, 0.980052, 0.847149, 0.783855, 0.015172, 0.149316, 0.011502, 0.042666, 0.778718, 0.067573, 0.674879, 0.787106, 0.658810, 0.627421, 0.060522, 0.601158, 0.901404, 0.439439, 0.946627, 0.031660, 0.357002, 0.466896, 0.947451, 0.339309, 0.412185, 0.439178, 0.072609, 0.038707, 0.971000, 0.602011, 0.874304, 0.441134, 0.582063, 0.721453, 0.224989, 0.597235, 0.870769, 0.236491, 0.639901, 0.649487, 0.304063, 0.314780, 0.436593, 0.962873, 0.942202, 0.497115, 0.564031, 0.843605, 0.936554, 0.510658, 0.875266, 0.293556, 0.977554, 0.822717, 0.632864, 0.389739, 0.261895, 0.705474, 0.428446, 0.232894, 0.307485, 0.302750, 0.674029, 0.889548, 0.024203, 0.899017, 0.486783, 0.894972, 0.135508, 0.126685, 0.544459, 0.439571, 0.441465, 0.981052, 0.402445, 0.383666, 0.478168, 0.966476, 0.227272, 0.414722, 0.477134, 0.102537, 0.708277, 0.454688, 0.925254, 0.341142, 0.844427, 0.187149, 0.046615, 0.272873, 0.420043, 0.354100, 0.575623, 0.094072, 0.243648, 0.599826, 0.993089, 0.730431, 0.494798, 0.128598, 0.857116, 0.039258, 0.568169, 0.298580, 0.020310, 0.970614, 0.682247, 0.498478, 0.937089, 0.909519, 0.913199, 0.414224, 0.012056, 0.621477, 0.868912, 0.937310, 0.962618, 0.713339, 0.124459, 0.009234, 0.986212, 0.544503, 0.363334, 0.561835, 0.638575, 0.606982, 0.161661, 0.631664, 0.337413, 0.656459, 0.760261, 0.194528, 0.695717, 0.328430, 0.493109, 0.716027, 0.299044, 0.175356, 0.214505, 0.236133, 0.084874, 0.127705, 0.650357, 0.096931, 0.749181, 0.519269, 0.034241, 0.711800, 0.232607, 0.158700, 0.721034, 0.218819, 0.703203, 0.084367, 0.780655, 0.341777, 0.691349, 0.942316, 0.973441, 0.028762, 0.598775, 0.733702, 0.223290, 0.294492, 0.062133, 0.716399, 0.010520, 0.361177, 0.891754, 0.225025, 0.597310, 0.976629, 0.352730, 0.247667, 0.073559, 0.101911, 0.766936, 0.107800, 0.813711, 0.999543, 0.266500, 0.534744, 0.218363, 0.969703, 0.619112, 0.999017, 0.311480, 0.310461, 0.941333, 0.284921, 0.339222, 0.540109, 0.018624, 0.562513, 0.834601, 0.080756, 0.278911, 0.845121, 0.441933, 0.170666, 0.070146, 0.039243, 0.147295, 0.422875, 0.286910, 0.220854, 0.524786, 0.053846, 0.328654, 0.338497, 0.053389, 0.595155, 0.873241, 0.271752, 0.564858, 0.492352, 0.270769, 0.876338, 0.802813, 0.212102, 0.161259, 0.142036, 0.752211, 0.179882, 0.704548, 0.586812, 0.260639, 0.983460, 0.431933, 0.702572, 0.154125, 0.502078, 0.741815, 0.301420, 0.924953, 0.028725, 0.522274, 0.449739, 0.082571, 0.850929, 0.788236, 0.135960, 0.446083, 0.661477, 0.407712, 0.010941, 0.153829, 0.678481, 0.887279, 0.956642, 0.890583, 0.048538, 0.098678, 0.642794, 0.228420, 0.803226, 0.229606, 0.489059, 0.786685, 0.661539, 0.191631, 0.940811, 0.163617, 0.933446, 0.242231, 0.088571, 0.962171, 0.764505, 0.538310, 0.044742, 0.615433, 0.326546, 0.180702, 0.061517, 0.988022, 0.588413, 0.072458, 0.141851, 0.266894, 0.959737, 0.098494, 0.157478, 0.008274, 0.197171, 0.800272, 0.236694, 0.000397, 0.029879, 0.725753, 0.787083, 0.691418, 0.917384, 0.727894, 0.855035, 0.850830, 0.970124, 0.943606, 0.813001, 0.734629, 0.481916, 0.857742, 0.350063, 0.808462, 0.038444, 0.411580, 0.796484, 0.626857, 0.484037, 0.938336, 0.893751, 0.443774, 0.036829, 0.051229, 0.452048, 0.234000, 0.851501, 0.688742, 0.234398, 0.881380, 0.414496, 0.021480, 0.572798, 0.331880, 0.749374, 0.427833, 0.182710, 0.719498, 0.371438, 0.995710, 0.454128, 0.853354, 0.853452, 0.804191, 0.661816, 0.891896, 0.215770, 0.458300, 0.518753, 0.699808, 0.396635, 0.412505, 0.143582, 0.433465, 0.463734, 0.595630, 0.667465, 0.315235, 0.284372, 0.901863, 0.196615, 0.698868, 0.923343, 0.769413, 0.030748, 0.672717, 0.197246, 0.213457, 0.392216, 0.568684, 0.209168, 0.846343, 0.422038, 0.062620, 0.650534, 0.083854, 0.954516, 0.866304, 0.542154, 0.473269, 0.566112, 0.938789, 0.885774, 0.709694, 0.372254, 0.349508, 0.305323, 0.039719, 0.664743, 0.589695, 0.941582, 0.861358, 0.288563, 0.864925, 0.630771, 0.319311, 0.537642, 0.828017, 0.532768, 0.929857, 0.396701, 0.741936, 0.776201, 0.818739, 0.804556, 0.426735, 0.902593, 0.759072, 0.293039, 0.444747, 0.232341, 0.859151, 0.383536, 0.118115, 0.568845, 0.755790, 0.467623, 0.874168, 0.795509, 0.132366, 0.463863, 0.737091, 0.993724, 0.752426, 0.602015, 0.624496, 0.071737, 0.139657, 0.452512, 0.604505, 0.069515, 0.849213, 0.346441, 0.845716, 0.667952, 0.150997, 0.272451, 0.570546, 0.910069, 0.565490, 0.015293, 0.142410, 0.424641, 0.398829, 0.260526, 0.993486, 0.154620, 0.728149, 0.867654, 0.950129, 0.860515, 0.331517, 0.687219, 0.854239, 0.083943, 0.289235, 0.478735, 0.155680, 0.428892, 0.931247, 0.760185, 0.498407, 0.780461, 0.106625, 0.344122, 0.448413, 0.257622, 0.616573, 0.018959, 0.167690, 0.182063, 0.034252, 0.310101, 0.606704, 0.433081, 0.570626, 0.600190, 0.587700, 0.298775, 0.467844, 0.537829, 0.159290, 0.799362, 0.225049, 0.013529, 0.883305, 0.514283, 0.492263, 0.038985, 0.943175, 0.423511, 0.799169, 0.441582, 0.203971, 0.905794, 0.785704, 0.652384, 0.163416, 0.402276, 0.671343, 0.331106, 0.584339, 0.705594, 0.641207, 0.191043, 0.138675, 0.211833, 0.791233, 0.726376, 0.510608, 0.259077, 0.264205, 0.669897, 0.058439, 0.489253, 0.683426, 0.941744, 0.003537, 0.175689, 0.980728, 0.946712, 0.599200, 0.779898, 0.388294, 0.803171, 0.685692, 0.173997, 0.455555, 0.849108, 0.576274, 0.126898, 0.180215, 0.160613, 0.832492, 0.821422, 0.351656, 0.971168, 0.033255, 0.142889, 0.697543, 0.543863, 0.401966, 0.961748, 0.213760, 0.460405, 0.451002, 0.897186, 0.402148, 0.454538, 0.072875, 0.382877, 0.401250, 0.672075, 0.162774, 0.789544, 0.475246, 0.848467, 0.963541, 0.930801, 0.697575, 0.539815, 0.057699, 0.877790, 0.700428, 0.890192, 0.699212, 0.052083, 0.861359, 0.732467, 0.194972, 0.558902, 0.276329, 0.596938, 0.520651, 0.490089, 0.057343, 0.971652, 0.387275, 0.459491, 0.426190, 0.460150, 0.842368, 0.827441, 0.132226, 0.005142, 0.616984, 0.607472, 0.853609, 0.580525, 0.538273, 0.551184, 0.120340, 0.595973, 0.428973, 0.820768, 0.486165, 0.128185, 0.872851, 0.347524, 0.860652, 0.067823, 0.906426, 0.136981, 0.664761, 0.427077, 0.627070, 0.722104, 0.398729, 0.014346, 0.181595, 0.824919, 0.474496, 0.023963, 0.652360, 0.606722, 0.029105, 0.269344, 0.214194, 0.882713, 0.849869, 0.752467, 0.433897, 0.970210, 0.348440, 0.862870, 0.790977, 0.834605, 0.991055, 0.663829, 0.182128, 0.851707, 0.731652, 0.088555, 0.988688, 0.396413, 0.515631, 0.615758, 0.118517, 0.914360, 0.630104, 0.300112, 0.739279, 0.104600, 0.324075, 0.391639, 0.711322, 0.353179, 0.660983, 0.925516, 0.235892, 0.510853, 0.677983, 0.669789, 0.481062, 0.026423, 0.532659, 0.272040, 0.861027, 0.523715, 0.935868, 0.043156, 0.375422, 0.667520, 0.131710, 0.364110, 0.063933, 0.647341, 0.979868, 0.182451, 0.561701, 0.609972, 0.482563, 0.300981, 0.714572, 0.806637, 0.692620, 0.425894, 0.159817, 0.353603, 0.351410, 0.395709, 0.864456, 0.029393, 0.065498, 0.345518, 0.055815, 0.598158, 0.617558, 0.916843, 0.121872, 0.553426, 0.959998, 0.497294, 0.220946, 0.091708, 0.861404, 0.284879, 0.739050, 0.841273, 0.467330, 0.300751, 0.451245, 0.949893, 0.601732, 0.165818, 0.756530, 0.294352, 0.591712, 0.916347, 0.647955, 0.943122, 0.312056, 0.512410, 0.972514, 0.377554, 0.857928, 0.028330, 0.975712, 0.475486, 0.945172, 0.097584, 0.028912, 0.905171, 0.594879, 0.249858, 0.996879, 0.456283, 0.534737, 0.735928, 0.297556, 0.002067, 0.036680, 0.748801, 0.951960, 0.638411, 0.914619, 0.708490, 0.932763, 0.506331, 0.624837, 0.580718, 0.449453, 0.936893, 0.093128, 0.421967, 0.314447, 0.951056, 0.450297, 0.290159, 0.426542, 0.395469, 0.387744, 0.455454, 0.300640, 0.982623, 0.705311, 0.297519, 0.438906, 0.240048, 0.033447, 0.736462, 0.242115, 0.070127, 0.485263, 0.194075, 0.708538, 0.399881, 0.902565, 0.641301, 0.906212, 0.527402, 0.222019, 0.355665, 0.464296, 0.315147, 0.777632, 0.778743, 0.266203, 0.227929, 0.068902, 0.692745, 0.623398, 0.456646, 0.148199, 0.924038, 0.439269, 0.853510, 0.221557, 0.878175, 0.093558, 0.255004, 0.614636, 0.335674, 0.325131, 0.099899, 0.529749, 0.033669, 0.499780, 0.432314, 0.674970, 0.405993, 0.959717, 0.896989, 0.761657, 0.424012, 0.212136, 0.539289, 0.202755, 0.478340, 0.767218, 0.271658, 0.171085, 0.390616, 0.728304, 0.319284, 0.314654, 0.167573, 0.172795, 0.536211, 0.045748, 0.266353, 0.791214, 0.660384, 0.602027, 0.116345, 0.760283, 0.131775, 0.150014, 0.260064, 0.564089, 0.824984, 0.666056, 0.523806, 0.721974, 0.427713, 0.947818, 0.934110, 0.967003, 0.150573, 0.412450, 0.734220, 0.422231, 0.583535, 0.124836, 0.150535, 0.902819, 0.439490, 0.318108, 0.075614, 0.975701, 0.363855, 0.341967, 0.766915, 0.024239, 0.943993, 0.883260, 0.784523, 0.075769, 0.033274, 0.044586, 0.639858, 0.858259, 0.710642, 0.163664, 0.580232, 0.138356, 0.111482, 0.514342, 0.105358, 0.262055, 0.926792, 0.839579, 0.684286, 0.510327, 0.964415, 0.834821, 0.413146, 0.403905, 0.152928, 0.488760, 0.379606, 0.516784, 0.830726, 0.146521, 0.541023, 0.774720, 0.029781, 0.325546, 0.850488, 0.063056, 0.370132, 0.490346, 0.921314, 0.080774, 0.654010, 0.501547, 0.219130, 0.765492, 0.015889, 0.324488, 0.027547, 0.942681, 0.164067, 0.711834, 0.453007, 0.128481, 0.546654, 0.866153, 0.532386, 0.699583, 0.354913, 0.911992, 0.216367, 0.185640, 0.058513, 0.757390, 0.960359, 0.088294, 0.082935, 0.810847, 0.151350, 0.453067, 0.301194, 0.072664, 0.533841, 0.955204, 0.574211, 0.752971, 0.720696, 0.590099, 0.077459, 0.748244, 0.532780, 0.241525, 0.460077, 0.985787, 0.370007, 0.006731, 0.851940, 0.902393, 0.706314, 0.206853, 0.814386, 0.922681, 0.392493, 0.872898, 0.680071, 0.352852, 0.961193, 0.763006, 0.163700, 0.112542, 0.216073, 0.464893, 0.185206, 0.749915, 0.420097, 0.759417, 0.502886, 0.140793, 0.349516, 0.580345, 0.889037, 0.882296, 0.821870, 0.349114, 0.868083, 0.191877, 0.355845, 0.720023, 0.094270, 0.062160, 0.926876, 0.908656, 0.984840, 0.319369, 0.781554, 0.664911, 0.672221, 0.742747, 0.427917, 0.835921, 0.855289, 0.643991, 0.300814, 0.040495, 0.393905, 0.720911, 0.799912, 0.896791, 0.861705, 0.149428, 0.477136, 0.750741, 0.031724, 0.299006, 0.099855, 0.899807, 0.490882, 0.455700, 0.619830, 0.585153, 0.517860, 0.546706, 0.493809, 0.502700, 0.866075, 0.275363, 0.167612, 0.538297, 0.018110, 0.595529, 0.374218, 0.873399, 0.239520, 0.675032, 0.913894, 0.633425, 0.395943, 0.713806, 0.530216, 0.257648, 0.863234, 0.007352, 0.008389, 0.894958, 0.306358, 0.108245, 0.794765, 0.797240, 0.563945, 0.414594, 0.382393, 0.081805, 0.961301, 0.876201, 0.584505, 0.827376, 0.151564, 0.752117, 0.365673, 0.169674, 0.347646, 0.739890, 0.043073, 0.587166, 0.414922, 0.956967, 0.220591, 0.810866, 0.670773, 0.750808, 0.068514, 0.534007, 0.758159, 0.076903, 0.428965, 0.064517, 0.185148, 0.223730, 0.861757, 0.749093, 0.638325, 0.244150, 0.830898, 0.599625, 0.120351, 0.415403, 0.427001, 0.271915, 0.167520, 0.792674, 0.441589, 0.515167, 0.532564, 0.484662, 0.102332, 0.947487, 0.441628, 0.322924, 0.758353, 0.112401, 0.073731, 0.826866, 0.646408, 0.831891, 0.903770, 0.075373, 0.896408, 0.088918, 0.299104, 0.758165, 0.838011, 0.937428, 0.002315, 0.668909, 0.537053, 0.122666, 0.084312, 0.964054, 0.394581, 0.251833, 0.756728, 0.836170, 0.766999, 0.289292, 0.320831, 0.869332, 0.236779, 0.762460, 0.192256, 0.995132, 0.874861, 0.265987, 0.821998, 0.521269, 0.097878, 0.725768, 0.596642, 0.994285, 0.814686, 0.895746, 0.752450, 0.652697, 0.833174, 0.754765, 0.321606, 0.370227, 0.877430, 0.405918, 0.334281, 0.272011, 0.657751, 0.091009, 0.108181, 0.424750, 0.380302, 0.429013, 0.294082, 0.617081, 0.191472, 0.486338, 0.612212, 0.066333, 0.752325, 0.434210, 0.587601, 0.850202, 0.159978, 0.184244, 0.844487, 0.974664, 0.079989, 0.596938, 0.627361, 0.913163, 0.351702, 0.948966, 0.283390, 0.229133, 0.354884, 0.617671, 0.501144, 0.012635, 0.708680, 0.609325, 0.437385, 0.088982, 0.038337, 0.731468, 0.706062, 0.229810, 0.217805, 0.318274, 0.296142, 0.970130, 0.752485, 0.883744, 0.820332, 0.912463, 0.067987, 0.664820, 0.887127, 0.147976, 0.261757, 0.514487, 0.061139, 0.613459, 0.463453, 0.344529, 0.842592, 0.818338, 0.962200, 0.343736, 0.830973, 0.670880, 0.953061, 0.268358, 0.759862, 0.991398, 0.999826, 0.465925, 0.221208, 0.217631, 0.784199, 0.517350, 0.187761, 0.536684, 0.401094, 0.008093, 0.449146, 0.469081, 0.672913, 0.336273, 0.617057, 0.934670, 0.850760, 0.678196, 0.548130, 0.314213, 0.022726, 0.390722, 0.132551, 0.984926, 0.734457, 0.963524, 0.655806, 0.687518, 0.231882, 0.415668, 0.678917, 0.231707, 0.881593, 0.900125, 0.449338, 0.665792, 0.417475, 0.637100, 0.202476, 0.818568, 0.645193, 0.651622, 0.287649, 0.318106, 0.987895, 0.904706, 0.252776, 0.838655, 0.582902, 0.800905, 0.152868, 0.605628, 0.191627, 0.285419, 0.590554, 0.926084, 0.248943, 0.246360, 0.613603, 0.480824, 0.662028, 0.292519, 0.712532, 0.543621, 0.192644, 0.161870, 0.209414, 0.610118, 0.798970, 0.411889, 0.428686, 0.444163, 0.063512, 0.716335, 0.762269, 0.051407, 0.621041, 0.015045, 0.890061, 0.203944, 0.815950, 0.042930, 0.809571, 0.007577, 0.328349, 0.400125, 0.933661, 0.577292, 0.646485, 0.547264, 0.058116, 0.308513, 0.839783, 0.770648, 0.852134, 0.032427, 0.932518, 0.061548, 0.642545, 0.731488, 0.473437, 0.071232, 0.175651, 0.536949, 0.787567, 0.937920, 0.588355, 0.408608, 0.952965, 0.478417, 0.612552, 0.768915, 0.521346, 0.422123, 0.776492, 0.849695, 0.822248, 0.710154, 0.426987, 0.468732, 0.257418, 0.485103, 0.777245, 0.097201, 0.255751, 0.629379, 0.129628, 0.188270, 0.690927, 0.772173, 0.919758, 0.164364, 0.843404, 0.095410, 0.701313, 0.630971, 0.033330, 0.289668, 0.039579, 0.986295, 0.768084, 0.652131, 0.755210, 0.289431, 0.074254, 0.531702, 0.139126, 0.896502, 0.241856, 0.566113, 0.365234, 0.499273, 0.051216, 0.142480, 0.596474, 0.306967, 0.771859, 0.726102, 0.495237, 0.462786, 0.498274, 0.414995, 0.627150, 0.341679, 0.510404, 0.328463, 0.972650, 0.543734, 0.618131, 0.012229, 0.530029, 0.386215, 0.664360, 0.285238, 0.675645, 0.738614, 0.816940, 0.814771, 0.635116, 0.058796, 0.380884, 0.000351, 0.558069, 0.432100, 0.142830, 0.154543, 0.739067, 0.914690, 0.880644, 0.234303, 0.377476, 0.378919, 0.649298, 0.004626, 0.720598, 0.159702, 0.333089, 0.693247, 0.703436, 0.951220, 0.705477, 0.233464, 0.337435, 0.369837, 0.518703, 0.013080, 0.108452, 0.335643, 0.827851, 0.743568, 0.394438, 0.208735, 0.743919, 0.952507, 0.640835, 0.886749, 0.107050, 0.379901, 0.801439, 0.987694, 0.614205, 0.178915, 0.366613, 0.263502, 0.183541, 0.087211, 0.423204, 0.516630, 0.780458, 0.126640, 0.467849, 0.485935, 0.360105, 0.805284, 0.855772, 0.878807, 0.818364, 0.964224, 0.214450, 0.646215, 0.707791, 0.608888, 0.854950, 0.451710, 0.561395, 0.495785, 0.338459, 0.668445, 0.875686, 0.139898, 0.656139, 0.489891, 0.318813, 0.022753, 0.753393, 0.502353, 0.109963, 0.176598, 0.018983, 0.890421, 0.303238, 0.486832, 0.376356, 0.663342, 0.292116, 0.232128, 0.542150, 0.110480, 0.196352, 0.756599, 0.756695, 0.904143, 0.365488, 0.611645, 0.355854, 0.926883, 0.107430, 0.694313, 0.595328, 0.983117, 0.834211, 0.251467, 0.473008, 0.153024, 0.274220, 0.226401, 0.655377, 0.384183, 0.402999, 0.674360, 0.274605, 0.706237, 0.161192, 0.650961, 0.369579, 0.453308, 0.883089, 0.911729, 0.563788, 0.079441, 0.668328, 0.320483, 0.983585, 0.033816, 0.932129, 0.339438, 0.960698, 0.039559, 0.033751, 0.556026, 0.022676, 0.867962, 0.807494, 0.495684, 0.020986, 0.081713, 0.722085, 0.676363, 0.465896, 0.125084, 0.350723, 0.740501, 0.831320, 0.511915, 0.391462, 0.200899, 0.965224, 0.274551, 0.112628, 0.529012, 0.353993, 0.780956, 0.849495, 0.337577, 0.814772, 0.781624, 0.677016, 0.775470, 0.821183, 0.710767, 0.331496, 0.843859, 0.578729, 0.138990, 0.339543, 0.599715, 0.220703, 0.061628, 0.276079, 0.686600, 0.186712, 0.626802, 0.427101, 0.018032, 0.138717, 0.818563, 0.218931, 0.103940, 0.093114, 0.331559, 0.632952, 0.447107, 0.112515, 0.482448, 0.784684, 0.927287, 0.264072, 0.461700, 0.702757, 0.085255, 0.172467, 0.034253, 0.929114, 0.751196, 0.173243, 0.268657, 0.350912, 0.393946, 0.330285, 0.626990, 0.080546, 0.516996, 0.253792, 0.507647, 0.535028, 0.392508, 0.326210, 0.753959, 0.496449, 0.419324, 0.085519, 0.129401, 0.866431, 0.198034, 0.611848, 0.651115, 0.125320, 0.875920, 0.112814, 0.828077, 0.961175, 0.285281, 0.862330, 0.890289, 0.036478, 0.035573, 0.158945, 0.387389, 0.429519, 0.489230, 0.014379, 0.510065, 0.006226, 0.268171, 0.017712, 0.541254, 0.660680, 0.343922, 0.295214, 0.157128, 0.763246, 0.380732, 0.286529, 0.629677, 0.578766, 0.898378, 0.280791, 0.704086, 0.774298, 0.393606, 0.532164, 0.735473, 0.678887, 0.394494, 0.625761, 0.715365, 0.430067, 0.784707, 0.102754, 0.859586, 0.273937, 0.117133, 0.369652, 0.280163, 0.385305, 0.387364, 0.821417, 0.045984, 0.731286, 0.116631, 0.203113, 0.494532, 0.497363, 0.489642, 0.124209, 0.076129, 0.388020, 0.405000, 0.780216, 0.162318, 0.798606, 0.312379, 0.897791, 0.477493, 0.706873, 0.523552, 0.192858, 0.136940, 0.308259, 0.295612, 0.996526, 0.582195, 0.412745, 0.366178, 0.862358, 0.798050, 0.753542, 0.683776, 0.844034, 0.484828, 0.800406, 0.047146, 0.979361, 0.297770, 0.536789, 0.103570, 0.373899, 0.924808, 0.508570, 0.154114, 0.087126, 0.307176, 0.466493, 0.984917, 0.784670, 0.173366, 0.508469, 0.977528, 0.310306, 0.816728, 0.273139, 0.306832, 0.398923, 0.685884, 0.673010, 0.261281, 0.483934, 0.426552, 0.945057, 0.327968, 0.911380, 0.745463, 0.375114, 0.890740, 0.043233, 0.911902, 0.994310, 0.417132, 0.836711, 0.502880, 0.571246, 0.923837, 0.810057, 0.037739, 0.908754, 0.594726, 0.211106, 0.417223, 0.572254, 0.521412, 0.233951, 0.845393, 0.828244, 0.632874, 0.531277, 0.501254, 0.894155, 0.015211, 0.927805, 0.839212, 0.343179, 0.839185, 0.584676, 0.718293, 0.729925, 0.627909, 0.630195, 0.724235, 0.045041, 0.466906, 0.227116, 0.616287, 0.390743, 0.037172, 0.654026, 0.299498, 0.631898, 0.865132, 0.716721, 0.204152, 0.386543, 0.950672, 0.049545, 0.214787, 0.583546, 0.580822, 0.716041, 0.477701, 0.596034, 0.643846, 0.316914, 0.939212, 0.483031, 0.901590, 0.657505, 0.212956, 0.529499, 0.287700, 0.937191, 0.574539, 0.754606, 0.164307, 0.190826, 0.145349, 0.201479, 0.844852, 0.444847, 0.833377, 0.709983, 0.161568, 0.037529, 0.096526, 0.112240, 0.087075, 0.311314, 0.695785, 0.667897, 0.027354, 0.173487, 0.263931, 0.671200, 0.490400, 0.203143, 0.154230, 0.391990, 0.860648, 0.367186, 0.921488, 0.148347, 0.304377, 0.496028, 0.902953, 0.468684, 0.686853, 0.048303, 0.670163, 0.531705, 0.493150, 0.503540, 0.241688, 0.654718, 0.541069, 0.338214, 0.766957, 0.628144, 0.649528, 0.462743, 0.296041, 0.676882, 0.636229, 0.559972, 0.348082, 0.126630, 0.763114, 0.502312, 0.518620, 0.623762, 0.869499, 0.440108, 0.772109, 0.173876, 0.936136, 0.675063, 0.642560, 0.622989, 0.723365, 0.312722, 0.154694, 0.216515, 0.816262, 0.396382, 0.871233, 0.357332, 0.734596, 0.638190, 0.985476, 0.384124, 0.100933, 0.281517, 0.061006, 0.737162, 0.841489, 0.409088, 0.863792, 0.604603, 0.911401, 0.382412, 0.228365, 0.780899, 0.822520, 0.000474, 0.954775, 0.758655, 0.675537, 0.597335, 0.381645, 0.398902, 0.910057, 0.536338, 0.615417, 0.726320, 0.932720, 0.486650, 0.083651, 0.667316, 0.124839, 0.069127, 0.051441, 0.225772, 0.350644, 0.112447, 0.962934, 0.192133, 0.521535, 0.826726, 0.796736, 0.432936, 0.209137, 0.025101, 0.213835, 0.031657, 0.025575, 0.168610, 0.790313, 0.701112, 0.765945, 0.171957, 0.100014, 0.676002, 0.708296, 0.715431, 0.402322, 0.641016, 0.202080, 0.485973, 0.308332, 0.326920, 0.555101, 0.359773, 0.552692, 0.905745, 0.472220, 0.515626, 0.097878, 0.993755, 0.342351, 0.894614, 0.426691, 0.551489, 0.919714, 0.640526, 0.583146, 0.945289, 0.809136, 0.373458, 0.646401, 0.575081, 0.545416, 0.746415, 0.251083, 0.253711, 0.461845, 0.653405, 0.894727, 0.663926, 0.139379, 0.203059, 0.990845, 0.694479, 0.562832, 0.543537, 0.600224, 0.035051, 0.059162, 0.698102, 0.028806, 0.401514, 0.592716, 0.455497, 0.953003, 0.512430, 0.096022, 0.536149, 0.457719, 0.905158, 0.909607, 0.104120, 0.480239, 0.455023, 0.850534, 0.731323, 0.708734, 0.312380, 0.384728, 0.603461, 0.976305, 0.524107, 0.806520, 0.967151, 0.218586, 0.369351, 0.510688, 0.818811, 0.404402, 0.569850, 0.516913, 0.433208, 0.971364, 0.109629, 0.888705, 0.924367, 0.622059, 0.984727, 0.460515, 0.079778, 0.889886, 0.370123, 0.183898, 0.370125, 0.825145, 0.034432, 0.101448, 0.533879, 0.346812, 0.486176, 0.137340, 0.323118, 0.010283, 0.943859, 0.290268, 0.228869, 0.313210, 0.800956, 0.047679, 0.717613, 0.370806, 0.564592, 0.150821, 0.342170, 0.674221, 0.039526, 0.266537, 0.296280, 0.024253, 0.727052, 0.376058, 0.914139, 0.097175, 0.559956, 0.284264, 0.922320, 0.594388, 0.385711, 0.456199, 0.941200, 0.871887, 0.593539, 0.264318, 0.882170, 0.537398, 0.554586, 0.111038, 0.850608, 0.355542, 0.158718, 0.568221, 0.726348, 0.723310, 0.719042, 0.068518, 0.397531, 0.758568, 0.335054, 0.693811, 0.782821, 0.062107, 0.069868, 0.696959, 0.159281, 0.629824, 0.981223, 0.081601, 0.224212, 0.366934, 0.537800, 0.165412, 0.238822, 0.131339, 0.429729, 0.120991, 0.668737, 0.984315, 0.232030, 0.519345, 0.339857, 0.390747, 0.087565, 0.066204, 0.114057, 0.806607, 0.134722, 0.511588, 0.565175, 0.469777, 0.205399, 0.347995, 0.531883, 0.275268, 0.044955, 0.691165, 0.905091, 0.026178, 0.772766, 0.129303, 0.393112, 0.310566, 0.294715, 0.631933, 0.441905, 0.724444, 0.752925, 0.110641, 0.708759, 0.984954, 0.629986, 0.048616, 0.375702, 0.717551, 0.114820, 0.489759, 0.524158, 0.249542, 0.001348, 0.089333, 0.719319, 0.206747, 0.437328, 0.251202, 0.482014, 0.482282, 0.942367, 0.387106, 0.508460, 0.715133, 0.516409, 0.901572, 0.025699, 0.811124, 0.533505, 0.467604, 0.535568, 0.286430, 0.578245, 0.244327, 0.271384, 0.208231, 0.292943, 0.647086, 0.925782, 0.407763, 0.136845, 0.449941, 0.657305, 0.138193, 0.539273, 0.376625, 0.344940, 0.976601, 0.627827, 0.826954, 0.458884, 0.570194, 0.214059, 0.967344, 0.285327, 0.730468, 0.868916, 0.311026, 0.541592, 0.402421, 0.778630, 0.077160, 0.688851, 0.356875, 0.321487, 0.960236, 0.565106, 0.614429, 0.607322, 0.490889, 0.022192, 0.744167, 0.940829, 0.679498, 0.882360, 0.480103, 0.056123, 0.227300, 0.456704, 0.683950, 0.054254, 0.915587, 0.254144, 0.268313, 0.882931, 0.539471, 0.998782, 0.751847, 0.850497, 0.540374, 0.154268, 0.629126, 0.617534, 0.843119, 0.986001, 0.939020, 0.803355, 0.551107, 0.553450, 0.410677, 0.041996, 0.575642, 0.154845, 0.982825, 0.255140, 0.037205, 0.462928, 0.311263, 0.264505, 0.919631, 0.995212, 0.318759, 0.835219, 0.249356, 0.587072, 0.718150, 0.788827, 0.585853, 0.469996, 0.639323, 0.126227, 0.624264, 0.268449, 0.743761, 0.467384, 0.254451, 0.682781, 0.270739, 0.805558, 0.236231, 0.681416, 0.847554, 0.811873, 0.836260, 0.830379, 0.067013, 0.873465, 0.293307, 0.378276, 0.137970, 0.212939, 0.373489, 0.456729, 0.048158, 0.622845, 0.043801, 0.766307, 0.411671, 0.629654, 0.236304, 0.050995, 0.755881, 0.860568, 0.319444, 0.499642, 0.327952, 0.573895, 0.182423, 0.598690, 0.379453, 0.418653, 0.280106, 0.227007, 0.230526, 0.116366, 0.057386, 0.297540, 0.989831, 0.350694, 0.675816, 0.127801, 0.563633, 0.049304, 0.584530, 0.611790, 0.672149, 0.628331, 0.378097, 0.083820, 0.257985, 0.614401, 0.134815, 0.013866, 0.474969, 0.454259, 0.513507, 0.802921, 0.028154, 0.695930, 0.401611, 0.407607, 0.114583, 0.681717, 0.634614, 0.345109, 0.798083, 0.692000, 0.642649, 0.787915, 0.042694, 0.318465, 0.915716, 0.606327, 0.367769, 0.500246, 0.218117, 0.039918, 0.128577, 0.596214, 0.123738, 0.386561, 0.210616, 0.258553, 0.400427, 0.685585, 0.712813, 0.913934, 0.488506, 0.740967, 0.609864, 0.890117, 0.148574, 0.724447, 0.571834, 0.783188, 0.069556, 0.369918, 0.475188, 0.712205, 0.157832, 0.517882, 0.030670, 0.073549, 0.124209, 0.398439, 0.573795, 0.342326, 0.438356, 0.702371, 0.938540, 0.562095, 0.088933, 0.149156, 0.820648, 0.489360, 0.834741, 0.533461, 0.403294, 0.323247, 0.274427, 0.013158, 0.213364, 0.423001, 0.737604, 0.785198, 0.206189, 0.807160, 0.155116, 0.681377, 0.519365, 0.312949, 0.199259, 0.550035, 0.386497, 0.323467, 0.948473, 0.960292, 0.665793, 0.386830, 0.662663, 0.604333, 0.948924, 0.751596, }; static int randpt; extern void init_rand( void ); extern int get_rand( int ll, int ul ); void init_rand( void ) { randpt = 1; } int get_rand( int ll, int ul ) { double r = rnd[randpt++]; int val; if (randpt >= MAXRND) err_internal( __func__, "Ran out of random numbers (only %d available)\n", MAXRND ); val = floor( ll + r * (ul - ll) ); if (val > ul) err_internal( __func__, "%d > %d\n", val, ul ); if (val < ll) err_internal( __func__, "%d < %d\n", val, ll ); return val; } libmaa-1.4.4/maa/Makefile0000644000175000017500000000207613457657444015105 0ustar cheusovcheusov################################################## MKC_REQUIRE_PROGS += awk ################################################## WARNS ?= 4 WARNERR ?= yes LIB = maa INCS = maa.h SRCS = xmalloc.c \ hash.c set.c stack.c list.c error.c memory.c string.c \ debug.c flags.c maa.c prime.c bit.c timer.c \ arg.c pr.c sl.c base64.c base26.c source.c parse-concrete.c \ text.c log.c MKC_CHECK_SIZEOF = long MKC_CHECK_HEADERS = sys/resource.h alloca.h arg.o arg.os: ${.OBJDIR}/arggram.c arg.c ${.OBJDIR}/arggram.c: arggram.txt awk -f ${SRCDIR_maa}/arggram2c < ${SRCDIR_maa}/arggram.txt > $@ CFLAGS += -DMAA_MAJOR=${MAA_MAJOR} CFLAGS += -DMAA_MINOR=${MAA_MINOR} CFLAGS += -DMAA_TEENY=${MAA_TEENY} CPPFLAGS += -I. -I${.OBJDIR} #MAN = maa.1 #MKC_FEATURES = strlcpy strlcat CLEANFILES += arggram.c .PHONY: _manpages _manpages: ${MAN} .include "../Makefile.common" SHLIB_MAJOR = ${MAA_MAJOR} SHLIB_MINOR = ${MAA_MINOR} #SHLIB_TEENY = ${MAA_TEENY} EXPORT_SYMBOLS = export.sym ################################################## .include libmaa-1.4.4/maa/export.sym0000644000175000017500000000554713457657444015526 0ustar cheusovcheusovmaa_init maa_shutdown maa_version_major maa_version_minor maa_version_teeny maa_version xmalloc xcalloc xrealloc xfree xstrdup bit_set bit_clr bit_tst bit_cnt prm_is_prime prm_next_prime hsh_create hsh_destroy hsh_insert hsh_delete hsh_retrieve hsh_iterate hsh_iterate_arg hsh_get_stats hsh_print_stats hsh_string_hash hsh_pointer_hash hsh_string_compare hsh_pointer_compare hsh_key_strings hsh_init_position hsh_next_position hsh_get_position hsh_readonly set_create set_get_hash set_get_compare set_destroy set_insert set_delete set_member set_iterate set_iterate_arg set_add set_del set_union set_inter set_diff set_equal set_get_stats set_print_stats set_count set_init_position set_next_position set_get_position set_readonly stk_create stk_destroy stk_push stk_pop stk_top stk_isempty lst_create lst_destroy lst_append lst_push lst_pop lst_top lst_nth_get lst_nth_set lst_member lst_length lst_iterate lst_iterate_arg lst_truncate lst_truncate_position lst_init_position lst_last_position lst_next_position lst_nth_position lst_get_position lst_set_position lst_dump _lst_shutdown lst_total_allocated err_set_program_name err_program_name err_fatal err_fatal_errno err_warning err_internal mem_create_strings mem_destroy_strings mem_strcpy mem_strncpy mem_grow mem_finish mem_get_string_stats mem_print_string_stats mem_create_objects mem_destroy_objects mem_get_object mem_get_empty_object mem_free_object mem_get_object_stats mem_print_object_stats str_pool_create str_pool_destroy str_pool_exists str_pool_find str_pool_copy str_pool_copyn str_pool_grow str_pool_finish str_pool_get_stats str_pool_print_stats str_pool_init_position str_pool_next_position str_pool_get_position str_pool_iterate str_pool_iterate_arg str_exists str_find str_findn str_copy str_copyn str_grow str_finish str_unique str_destroy str_get_stats str_print_stats dbg_register _dbg_register dbg_destroy dbg_set dbg_set_flag dbg_unset_flag dbg_test dbg_list flg_register flg_destroy flg_set flg_test flg_list flg_name tim_start tim_stop tim_reset tim_get_real tim_get_user tim_get_system tim_print_timer tim_print_timers _tim_shutdown arg_create arg_destroy arg_add arg_addn arg_grow arg_finish arg_get arg_count arg_get_vector arg_argify pr_open pr_close_nowait pr_close pr_wait _pr_shutdown pr_spawn pr_readwrite pr_filter sl_create sl_destroy _sl_shutdown sl_insert sl_delete sl_find sl_iterate sl_iterate_arg _sl_dump txt_soundex txt_soundex2 b64_encode b64_decode b64_decode_buf b26_encode b26_decode src_create src_destroy src_line src_new_file src_new_line src_advance src_cpp_line src_get src_filename src_linenumber src_offset src_length src_source_line src_parse_error src_print_error src_print_message src_print_line src_get_stats src_print_stats prs_register_concrete prs_concrete _prs_shutdown log_syslog log_set_facility log_get_facility log_option log_file log_stream log_close log_error_va log_error log_info_va log_info libmaa-1.4.4/doc/0000755000175000017500000000000013457657444013447 5ustar cheusovcheusovlibmaa-1.4.4/doc/extract.pl0000644000175000017500000001615313457657444015464 0ustar cheusovcheusov#!/usr/local/bin/perl # This file is -*- perl -*- source. # Created: Wed Jan 4 13:04:37 1995 by faith@cs.unc.edu # Revised: Mon Dec 9 15:22:26 1996 by faith@cs.unc.edu # Public domain 1995 Rickard E. Faith (faith@cs.unc.edu) # # Special thanks to Nick Simicich (njs@scifi.gate.net) and Nicolai # Langfeldt (janl@ifi.uio.no), who where very patient while answering all # my stupid Perl questions. Any errors and stylistic problems in this code # are my fault, not theirs. # $oldfh = select(STDOUT); $| = 1; select($oldfh); ##@section = ( "section", "subsection", "subsubsection", "paragraph" ); ##@Section = ( "Section", "Subsection", "Subsubsection", "Paragraph" ); @section = ( "subsection", "subsubsection", "paragraph" ); @Section = ( "Subsection", "Subsubsection", "Paragraph" ); $defaultCurrent = 0; $current = $defaultCurrent; $figextension = ".eepicemu"; sub bf { local($tmp) = $_[0]; $tmp =~ s/_/\\_/g; $tmp =~ s/#/\\#/g; return "\\textbf{${tmp}}"; } sub tt { local($tmp) = $_[0]; $tmp =~ s/_/\\_/g; $tmp =~ s/#/\\#/g; return "\\emph{${tmp}}"; } sub figure { local($tmp) = $_[0]; "Figure~$tmp"; } foreach $file (@ARGV) { printf STDERR "Reading ${file}\n"; open (FILE, $file) || printf STDERR "Can't open $file: $!\n"; @lines = (@lines,); } @origlines = @lines; $state = 0; $endflag = 0; foreach $line (@lines) { if (!$state && $line =~ s/^.*\\section\{(.*)\}/$1/) { $current = $defaultCurrent; &print_header($line); $state = 3; next; } if ((!$state || $state == 3) && $line =~ s/^.*\\subsection\{(.*)\}/$1/) { $current = $defaultCurrent + 1; printf STDERR " * "; &print_header($line); $state = 3; next; } ++$current if ($line =~ s/\\bump\s//); --$current if ($line =~ s/\\unbump\s//); $state = 1 if ($line =~ s/\\doc\s//); $state = 3 if ($line =~ s/\\intro\s//); $state = 0 if ($line =~ s/\\endintro\s//); if ($state == 3) { local($result) = ($line =~ s/\*\///); $line =~ s/^\s*\*\s*//; push(@doc,$line); if ($result) { &print_doc(@doc); @doc = (); &dump_secondary("\n"); $state = 0; } } if ($state == 1) { $state = 2 if ($line =~ s/\*\///); push(@doc,$line); } elsif ($state == 2) { if ($endflag == 0 && $line !~ /^\s*{\s*$/) { $endflag = 1 if ($line =~ /^.*{\s*$/); $line =~ s/{//; push(@decl,$line); } else { &print_decl(@decl); @decl = (); &print_doc(@doc); @doc = (); &dump_secondary("\n"); $state = 0; $endflag = 0; } } } &dump_secondary("\n"); sub print_header { $_[0] =~ s/^\s*//; $_[0] =~ s/\s*$//; $_[0] =~ s/\s*\*\///; printf STDERR "Processing \"${_[0]}\"\n"; print "\n\\typeout{*** " . $Section[$current] . ": ${_[0]}}\n"; print "\\" . $section[$current] . "{${_[0]}}\n\n"; } sub print_decl { local($line); local($tmp); local($state) = 0; local(@input) = @_; foreach $line (@input) { if (!$state && $line =~ /\(/) { $tmp = $line; $tmp =~ s/^[^(]*[\s\*](\w+)\s*\(.*$/$1/; chop $tmp; printf STDERR " ${tmp}\n"; $tmp = &tt($tmp); print "\n\\typeout{*** " . $Section[$current+1] . ": ${tmp}}\n"; print "\\" . $section[$current+1] . "{${tmp}}\n\n"; print "\\begin{lgrind}\n"; &lgrindopen; $state = 1; } if ($state) { print LGOUT $line; } } close(LGOUT); print while (); close(LGIN); wait; print "\\end{lgrind}\n\\vspace{2ex}\n\n\\noindent "; } sub lgrindopen { # This code is based on code from njs@scifi.gate.net (Nick Simicich) local($pid) = 0; close(LGIN); # close(LGOUT); pipe(LGIN, LGINCH) || die "Can't pipe LGIN: $!"; pipe(LGOUTCH, LGOUT) || die "Can't pipe LGOUT: $!"; # Unbuffer the output pipes. $oldfh = select(LGINCH); $| = 1; select($oldfh); $oldfh = select(LGOUT); $| = 1; select($oldfh); if($pid = fork) { # parent close(LGINCH); close(LGOUTCH); return; } # Now in child close(LGOUT); open(STDIN, "<&LGOUTCH") || die "Can't dup STDIN: &!"; close(LGOUTCH); close(LGIN); open(STDOUT, ">&LGINCH") || die "can't open STDOUT: &!"; close(LGINCH); exec('lgrind','-i','-d','lgrindefs','-'); die "exec must have failed, or I wouldn't be here: $!"; } sub get_section { return $section[${_[0]}]; } sub print_doc { local($line); # print "\n\\subsubsection{Description}\n\n"; foreach $line (@_) { &dump_secondary($line); $line =~ s/\|([^|]*)\|/&tt($1)/ge; $line =~ s/\"([^"]*)\"/&bf($1)/ge; # " $line =~ s/\\val{([^{]*)}/&print_values($1)/ge; $line =~ s/\\fig{([^{]*)}{([^{]*)}/&do_figure($1,$2)/ge; $line =~ s/\\grind{([^{]*)}/&do_grind($1)/ge; $line =~ s/\\grindref{([^{]*)}/&figure("\\ref{$1}")/ge; # $line =~ s/\<([^>]*)\>/\\&get_section("$current+2"){$1}/ge; $line =~ s/^\s*\/\*\s*//; $line =~ s/^\s*//; $line =~ s/\s*$/\n/; print $line; } } sub print_values { local($target) = $_[0]; local($line); local($state) = 0; local($result) = ""; local($orig); foreach $orig (@lines) { $line = $orig; if ($state == 0) { if ($line =~ /^\w+\s+${target}\s*\[\]\s*=\s*/) { $state = 1; $line =~ s/^.*{//; } } if ($state) { if ($line =~ s/}.*$/\n/) { $state = 2; $line =~ s/,\s*0\s*$/\n/; } $line =~ s/^\s*//; $line =~ s/\s*$/ /; $result .= $line; } if ($state == 2) { $result =~ s/\s*$//; return $result; } } } sub dump_secondary { local($line) = $_[0]; if ($line =~ /^\s*\n$/ && $#secondary) { print @secondary; @secondary = (); } } sub do_grind { local($target) = $_[0]; local($tt_target) = $target; local($_target) = $target; local($line); local($state) = 0; $tt_target = &tt($tt_target); $_target =~ s/_//g; push(@secondary,"\n\\begin{figure}[hbtp]\n\\begin{center}\n\\leavevmode"); push(@secondary,"\n\\begin{lgrind}\n"); &lgrindopen; foreach $line (@origlines) { next if !length($line); next if (!$state && $line =~ /^extern\s/); $state = 1 if (!$state && $line =~ /^[^(]*[\s\*]${target}\s*\(/); $state = 2 if (!$state && $line =~ /^\s*typedef\s.*\s${target}/); print LGOUT $line if ($state); last if ($state == 1 && $line =~ /^\s*}\s*\n$/); last if ($state == 2 && $line =~ /^\s*}.*;\s*$/); } close(LGOUT); push(@secondary,$_) while (); close(LGIN); wait; push(@secondary,"\\end{lgrind}\n"); push(@secondary,"\n\\caption{${tt_target}}\n\\label{fig:${_target}}\n"); push(@secondary,"\\end{center}\n\\end{figure}\n\n"); return &figure("\\ref{fig:$_target}"); } sub do_figure { local($target) = $_[0]; local($caption) = $_[1]; local($_target) = $target; local($line); local($state) = 0; $_target =~ s/_//g; $_target =~ s/\..*$//; push(@secondary,"\n\\begin{figure}[hbtp]\n\\begin{center}\n\\leavevmode"); push(@secondary,"\\input{$target$figextension}\n"); push(@secondary,"\n\\caption{$caption}\n\\label{fig:${_target}}\n"); push(@secondary,"\\end{center}\n\\end{figure}\n\n"); return &figure("\\ref{fig:$_target}"); } libmaa-1.4.4/doc/lgrindefs0000644000175000017500000003073113457657444015353 0ustar cheusovcheusov# Database of program templates for lgrind # $Id: lgrindefs,v 1.1 1996/02/09 14:45:22 faith Exp $ a68:\ :oc:\ :cb=\|:ce=$:ab=/*:ae=*/:\ :sb=':se=':lb=":le=":\ :zb=@:ze=@:tb=%%:te=%%:mb=%\$:me=\$%:vb=%\|:ve=\|%:\ :kw=ascii block byte end equ globl text data word even long\ #else #endif #if #ifdef #ifndef #include #undef #define: asm:\ :oc:\ :cb=#:ce=$:ab=/*:ae=*/:\ :sb=':se=':lb=":le=":\ :zb=@:ze=@:tb=%%:te=%%:mb=%\$:me=\$%:vb=%\|:ve=\|%:\ :kw=ascii block byte end equ globl text data word even long\ #else #endif #if #ifdef #ifndef #include #undef #define else endif\ if ifdef ifndef include undef define: asm68:\ :pb=(^\d?.proc\d\p\d:\ :oc:\ :cb=;:ce=$:\ :sb=':se=':lb=":le=":\ :zb=@:ze=@:tb=%%:te=%%:mb=%\$:me=\$%:vb=%\|:ve=\|%:\ :kw=ascii block byte end equ include long proc word: C|c:\ :pb=^\d?*?\d?\p\d?\(\a?\)(\d|{):bb={:be=}:\ :cb=/*:ce=*/:sb=":se=\e":lb=':\ :le=\e':tl:\ :zb=@:ze=@:tb=%%:te=%%:mb=%\$:me=\$%:vb=%\|:ve=\|%:\ :kw=asm auto break case char const continue default do double else\ enum extern float for fortran goto if int long register return short\ sizeof static struct switch typedef union unsigned void while #define\ #else #endif #if #ifdef #ifndef #include #undef # define else endif\ if ifdef ifndef include undef\ #pragma #elif pragma elif\ #module #dictionary module dictionary\ variant_struct variant_union\ noshare readonly globaldef globalref globalvalue main_program: #Last couple of lines are partial ANSI, plus VAX-C specific C++|c++|CC:\ :pb=^\d?*?\d?\p\d?\(\a?\)(\d|{):bb={:be=}:\ :cb=/*:ce=*/:ab=//:ae=$:sb=":se=\e":lb=':\ :zb=@:ze=@:tb=%%:te=%%:mb=%\$:me=\$%:vb=%\|:ve=\|%:\ :le=\e':tl:\ :kw=asm auto break case char continue default do double else enum\ extern float for fortran goto if int long register return short\ sizeof static struct switch typedef union unsigned while void #define\ #else #endif #if #ifdef #ifndef #include #undef # define endif\ ifdef ifndef include undef defined\ class const delete friend inline new operator overload private\ protected public virtual: CSH|csh:\ :bb={:be=}:cb=#:ce=$:sb=":se=\e":lb=':\ :zb=@:ze=@:tb=%%:te=%%:mb=%\$:me=\$%:vb=%\|:ve=\|%:\ :le=\e':tl:\ :kw=alias alloc break breaksw case cd chdir continue default\ echo else end endif endsw exec exit foreach \ glob goto history if logout nice nohup onintr repeat set\ setenv shift source switch then time \ while umask unalias unset wait while @ env \ argv child home ignoreeof noclobber noglob \ nomatch path prompt shell status verbose : fortran|FORTRAN|f77|fc|f:\ :pb=(function|subroutine|program)\d\p\d?\(\a?\):\ :bb=(function|subroutine|program)\d\p\d?\(\a?\):be=^\dend:\ :cb=^c:\ :ce=$:\ :sb=':\ :se=':\ :oc:\ :zb=@:ze=@:tb=%%:te=%%:mb=%\$:me=\$%:vb=%\|:ve=\|%:\ :kw=call common complex continue dimension do double else elseif\ end endif equivalence format function\ goto if include integer \ parameter precision real return stop subroutine: Icon|icon|I:\ :pb=^\d?procedure\d\p\d?\(\a?\):\ :bb=(^\d?procedure\d\p\d?\(\a?\))|{:be=}|(^\d?end\d?$):\ :cb=#:ce=$:\ :zb=@:ze=@:tb=%%:te=%%:mb=%\$:me=\$%:vb=%\|:ve=\|%:\ :sb=":se=\e":lb=':le=\e':tl:\ :kw=break by case create default do dynamic else end every external\ fail global if initial local next not of procedure record\ repeat return static suspend then to until using while\ &ascii &clock &cset &date &dateline &errout &fail &host &input\ &lcase &level &main &null &output &pos &random &source &subject\ &time &trace &ucase &version: ISP|isp|i:\ :cb=!:ce=!|$:oc:\ :zb=@:ze=@:tb=%%:te=%%:mb=%\$:me=\$%:vb=%\|:ve=\|%:\ :kw=and begin decode define end eql eqv geq gtr if leave leq lss mod\ neq next not or otherwise repeat restart resume sr0 sr1 srd\ srr sl0 sl1 sld slr tst xor: ldl|LDL:\ :pb=^\p\::bb=\::be=;:cb=/*:ce=*/:sb=":se=\e":\ :zb=@:ze=@:tb=%%:te=%%:mb=%\$:me=\$%:vb=%\|:ve=\|%:\ :kw=constant functions grammar reswords tokens add1 addste\ car cdr check colno cond cons copy defun divide empty enter\ eq equal findattr firstchild ge getattr getfield gt hash label\ lambda lastchild le leftsibling lookone lookup lt minus name ne\ newnode nextcom nil null parent plus precnl prevcom prog progn\ quote reglob return rightsibling self set setattr setfield setq\ stjoin sub1 t times tnull tokno ttype: #Linda is just like C, with a couple of extra keywords. Note: The non- #blocking operations are included, as are the pre-defined VAX Linda-C macros. linda|l:\ :pb=^\d?*?\d?\p\d?\(\a?\)(\d|{):bb={:be=}:\ :cb=/*:ce=*/:sb=":se=\e":lb=':\ :zb=@:ze=@:tb=%%:te=%%:mb=%\$:me=\$%:vb=%\|:ve=\|%:\ :le=\e':tl:\ :kw=asm auto break case char continue default do double else enum\ extern float for fortran goto if int long register return short\ sizeof static struct switch typedef union unsigned void while #define\ #else #endif #if #ifdef #ifndef #include #undef # define else endif\ if ifdef ifndef include undef\ #pragma #elif pragma elif #line\ #module #dictionary module dictionary\ variant_struct variant_union\ noshare readonly globaldef globalref globalvalue main_program\ in inp rd rdp out eval newtype varying nchar\ $ARR $ARRAY $ARRAY_TYPE $MAKE_ARRAY\ $STR $STRING $STRING_TYPE $SET_DIM $MAKE_STRING\ #ttcontext ttcontext: # Use MFT (part of the MetaFontWare package) instead. mf|metafont:\ :bb={:be=}:cb=%:ce=$:\ :zb=@:ze=@:tb=%%:te=%%:mb=%\$:me=\$%:vb=%\|:ve=\|%:\ :kw=def if else fi for step until endfor\ input let end: # # This entry makes use of new capabilities added to support the description # of lisp-like languages (id, pl, and px). The set of keywords given is a # matter of taste. It would be reasonable to add all the wired functions to # the list. MLisp|ml|Emacs Mock Lisp:\ :cb=;:ce=$:lb=':le=\e':sb=":se=\e":bb=\(:be=\):\ :zb=@:ze=@:tb=%%:te=%%:mb=%\$:me=\$%:vb=%\|:ve=\|%:\ :id=_-$#@./,%&?!^*+~`|;<>'\::\ :kw=defun if progn while:pl:px=\d\(defun:pb=^\d\(\p($|(\d\a$)): model|mod|m:\ :pb=^\d(space\d\p\drep)|(\p\dis|inline|public\dbeginproc):\ :bb=\dbeginproc|space|case\d:be=\dendproc|end\d|;:\ :cb=\$:ce=\$|$:sb=":se=":lb=':le=\a|$:\ :kw=abs and array beginproc boolean by case cdnl char copied dispose\ div do dynamic else elsif end endproc entry external FALSE false\ fi file for formal fortran global if iff ift\ in integer include inline is lbnd\ max min mod new NIL nil noresult not notin od of or procedure public\ read readln readonly record recursive rem rep repeat res\ result return set\ space string subscript such then TRUE true type ubnd union until\ varies while width: modula2|mod2|m2:\ :pb=(^\d?(procedure|function|module)\d\p\d|\(|;|\:):\ :bb=\d(begin|case|for|if|loop|record|repeat|while|with)\d:\ :be=\dend|;:\ :cb={:ce=}:\ :ab=\(*:ae=*\):\ :zb=@:ze=@:tb=%%:te=%%:mb=%\$:me=\$%:vb=%\|:ve=\|%:\ :sb=":se=":\ :oc:\ :kw=and array begin by case const\ definition div do else elsif end exit export\ for from if implementation import in\ loop mod module not of or pointer procedure qualified\ record repeat return set then to type\ until var while with: pascal|pasc|p:\ :pb=(^\d?procedure|function|program\d\p\d|\(|;|\:)|(=\d?record\d):\ :bb=\dcase|begin\d:be=\dend|forward\d|;:\ :oc:\ :cb={:ce=}:ab=\(*:ae=*\):\ :zb=@:ze=@:tb=%%:te=%%:mb=%\$:me=\$%:vb=%\|:ve=\|%:\ :sb=':se=':lb=":le=":\ :kw=and array assert begin boolean case char const div do downto else\ end file for forward function goto if in integer label mod nil not\ of or packed procedure program record repeat set then to type\ until var while with oct hex external: #Perl definition; snarfed from the net PERL|perl|pl:\ :pb=^\d?sub\d\p(\d|{):\ :bb={:be=}:cb=\d#:ce=$:sb=":se=\e":lb=':le=\e':\ :zb=@:ze=@:tb=%%:te=%%:mb=%\$:me=\$%:vb=%\|:ve=\|%:\ :tl:\ :kw=if until while elsif else unless for foreach continue sub\ accept atan2 bind chdir chmod chop chown chroot close\ closedir connect cos crypt dbmclose dbmopen defined delete die\ do dump each eof eval exec exit exp fcntl fileno flock fork\ getc getlogin getpeername getpgrp getppid getpriority getpwnam\ getgrnam gethostbyname getnetbyname getprotobyname getpwuid getgrgid\ getservbyname gethostbyaddr getnetbyaddr getprotobynumber\ getservbyport getpwent getgrent gethostent getnetent getprotoent\ getservent setpwent setgrent sethostent setnetent setprotoent\ setservent endpwent endgrent endhostent endnetent endprotoent\ endservent getsockname getsockopt gmtime goto grep hex ioctl\ index int join keys kill last length link listen local localtime\ log lstat m mkdir next oct open opendir ord pack pop print printf\ push q qq rand read readdir readlink recv redo rename reset return\ reverse rewinddir rindex rmdir s seek seekdir select setpgrp send\ setpriority setsockopt shift shutdown sin sleep socket socketpair\ sort split sprintf sqrt srand stat study substr syscall system\ symlink tell telldir time times tr y umask undef unlink unpack\ unshift utime values vec wait wantarray warn write: prolog|PROLOG:\ :bb=\:-:be=.:cb=%:ce=$:ab=/*:ae=*/:\ :zb=@:ze=@:tb=%%:te=%%:mb=%\$:me=\$%:vb=%\|:ve=\|%:\ :sb=":se=\e":lb=':le=\e':oc:\ :kw=op mod abort ancestors arg ascii ask assert asserta assertz\ atom atomic char clause close concat consult ed ef em eof fail\ file findall write functor getc integer is length listing load name\ nl nonvar not numbervars op or pp prin print private prompt putc\ ratom read read_from_this_file rename repeat retract retractall\ save see seeing seen sh skip statistics subgoal_of system tab\ tell telling time told trace true unload untrace var write: ps|postscript:\ :oc:\ :cb=%:ce=$:\ :zb=@:ze=@:tb=%%:te=%%:mb=%\$:me=\$%:vb=%\|:ve=\|%:\ :sb=\(:se=\e\):\ :kw=forall array null dict begin end def store string \ exec if ifelse repeat for loop exit stop stopped quit \ start save restore gsave grestore grestoreall definefont \ newpath initgraphics erasepage showpage copypage initclip \ clip eoclip fill eofill stroke image imagemask: r|R|ratfor:\ :pb=^\d?program|subroutine|function|(integer|real|complex|character\dfunction)\d\p\d|\(:\ :bb={:be=}:cb=#:ce=$:sb=":se=":lb=':le=':oc:\ :zb=@:ze=@:tb=%%:te=%%:mb=%\$:me=\$%:vb=%\|:ve=\|%:\ :kw= break call case character common complex data default define\ dimension do else end equivalence external false for function go\ goto if implicit include integer logical next pause program read\ real repeat return rewind stop string subroutine switch true until\ while write: # # It's not obvious what constitutes a "procedure definition" in Russell. # This entry doesn't even try... russell|Russell:\ :zb=@:ze=@:tb=%%:te=%%:mb=%\$:me=\$%:vb=%\|:ve=\|%:\ :cb=\(*:ce=*\):kw=cand cor do od if fi else enum record prod union\ extend export hide with constants let use in ni val var func type\ field characters readonly:sb=":se=":lb=':le=': SH|sh:\ :bb={:be=}:cb=#:ce=$:sb=":se=\e":lb=':\ :zb=@:ze=@:tb=%%:te=%%:mb=%\$:me=\$%:vb=%\|:ve=\|%:\ :le=\e':tl:\ :kw=break case cd continue do done \ elif else esac eval exec exit export \ fi for if in then while until \ read readonly set shift test trap umask wait: SOURCE|source|src:\ :kw=: TEX|tex:\ :zb=@:ze=@:tb=%%:te=%%:mb=%\$:me=\$%:vb=%\|:ve=\|%:\ :bb={:be=}:cb=%:ce=$:kw=\\def: vmsasm:\ :pb=^\d?.entry\d\p(\d|,|$|;):\ :oc:\ :cb=;:ce=$:\ :zb=@:ze=@:tb=%%:te=%%:mb=%\$:me=\$%:vb=%\|:ve=\|%:\ :sb=(.ident|.asci(x|c|d|i|z))\d:se=$:\ :kw=.address .align .ascix .ascic .ascid .ascii .asciz \ .blkx .byte .cross .debug .default .d_floating .double \ .disable .enable .end .endc .endm .endr .entry .error \ .even .external .f_floating .float .g_floating .ident .if \ .if_x .iff .irp .irpc .library .link .list .long .macro \ .mask .mcall .mdelete .mexit .narg .nchr .nlist .nocross \ .noshow .ntype .octa .odd .opdef .packed .page .print \ .psect .quad .refn .repeat .restore_psect .save_psect \ .show .signed_byte .signed_word .subtitle .title .transfer \ .warn .weak .word: yacc|Yacc|y:\ :zb=@:ze=@:tb=%%:te=%%:mb=%\$:me=\$%:vb=%\|:ve=\|%:\ :cb=/*:ce=*/:sb=":se=\e":lb=':le=\e':tl:\ :kw=%{ %} %% %union %token %type\ #else #endif #if #ifdef #ifndef #include #undef #define else endif\ if ifdef ifndef include undef: proteus:\ :am::bb={:be=}:cb=--:ce=$:id=_:\ :cb=--:ce=$:\ :kw= boolean bool div do else false for forall function if in \ integer int lambda let om real return string then true type var \ while #define #else #endif #if #ifdef #ifndef #include #undef # \ define else endif if ifdef ifndef include undef #pragma #elif \ pragma elif:\ pb=function\d\p:sb=":se=\e":\ zb=@:ze=@:tb=%%:te=%%:mb=%\$:me=\$%:vb=%\|:ve=\|% libmaa-1.4.4/doc/refalpha.bst0000644000175000017500000004137613457657444015756 0ustar cheusovcheusov % BibTeX refdbms family % THIS FILE WAS AUTOMATICALLY GENERATED FROM: % $Header: /cvsroot/dict/dictd1/libmaa/doc/refalpha.bst,v 1.1 1996/02/25 22:04:10 faith Exp $ % Modifications copyright (C) 1989 John Wilkes, % Hewlett-Packard Company. % For BibTeX versions 0.99a or later, LaTeX version 2.09. % alpha style (sorted alphabetics) ENTRY { author booktitle conference conflocation edition editor journal key note number pages publisher reportnumber series title volume date } {} { label extra.label sort.label } INTEGERS { output.state before.all mid.sentence after.sentence after.block } INTEGERS {editor.used} FUNCTION {init.state.consts} { #0 'before.all := #1 'mid.sentence := #2 'after.sentence := #3 'after.block := } STRINGS { s t } FUNCTION {output.nonnull} { 's := output.state mid.sentence = { ", " * write$ } { output.state after.block = { add.period$ write$ newline$ "\newblock " write$ } { output.state before.all = 'write$ { add.period$ " " * write$ } if$ } if$ mid.sentence 'output.state := } if$ s } FUNCTION {output} { duplicate$ empty$ 'pop$ 'output.nonnull if$ } FUNCTION {output.check} { 't := duplicate$ empty$ { pop$ "empty " t * " in " * cite$ * warning$ } 'output.nonnull if$ } FUNCTION {output.bibitem} { newline$ "\bibitem[" write$ label write$ "]{" write$ cite$ write$ "}" write$ newline$ "" before.all 'output.state := #0 'editor.used := } FUNCTION {fin.entry} { add.period$ write$ newline$ } FUNCTION {new.block} { output.state before.all = 'skip$ { after.block 'output.state := } if$ } FUNCTION {new.sentence} { output.state after.block = 'skip$ { output.state before.all = 'skip$ { after.sentence 'output.state := } if$ } if$ } FUNCTION {not} { { #0 } { #1 } if$ } FUNCTION {and} { 'skip$ { pop$ #0 } if$ } FUNCTION {or} { { pop$ #1 } 'skip$ if$ } FUNCTION {new.block.checka} { empty$ 'skip$ 'new.block if$ } FUNCTION {new.block.checkb} { empty$ swap$ empty$ and 'skip$ 'new.block if$ } FUNCTION {new.sentence.checka} { empty$ 'skip$ 'new.sentence if$ } FUNCTION {new.sentence.checkb} { empty$ swap$ empty$ and 'skip$ 'new.sentence if$ } FUNCTION {either.or.check} { empty$ 'pop$ { "can't use both " swap$ * " fields in " * cite$ * warning$ } if$ } FUNCTION {empty.misc.check} { author empty$ title empty$ date empty$ note empty$ and and and key empty$ not and { "all relevant fields are empty in " cite$ * warning$ } 'skip$ if$ } FUNCTION {ignoring} { empty$ 'pop$ { "ignoring " swap$ * " in " * cite$ * warning$ } if$ } FUNCTION {field.or.null} { duplicate$ empty$ { pop$ "" } 'skip$ if$ } FUNCTION {emphasize} { duplicate$ empty$ { pop$ "" } { "{\em " swap$ * "}" * } if$ } FUNCTION {embolden} { duplicate$ empty$ { pop$ "" } { "{\bf " swap$ * "}" * } if$ } FUNCTION {tie.or.space.connect} { duplicate$ text.length$ #3 < { "~" } { " " } if$ swap$ * * } INTEGERS { nameptr namesleft numnames } FUNCTION {format.names} { 's := #1 'nameptr := s num.names$ 'numnames := numnames 'namesleft := { namesleft #0 > } { s nameptr "{ff~}{vv~}{ll}{, jj}" format.name$ 't := nameptr #1 > { namesleft #1 > { ", " * t * } { numnames #2 > { "," * } 'skip$ if$ t "others" = { " et~al." * } { " and " * t * } if$ } if$ } 't if$ nameptr #1 + 'nameptr := namesleft #1 - 'namesleft := } while$ } FUNCTION {format.authors} { author empty$ { "" } { author format.names } if$ } FUNCTION {format.editors} { editor empty$ editor.used or { "" } { editor format.names editor #-1 #1 substring$ ")" = 'skip$ { editor num.names$ #1 > { ", editors" * } { ", editor" * } if$ } if$ #1 'editor.used := } if$ } FUNCTION {format.date} { date empty$ { "" } { date } if$ } FUNCTION {format.title} { title empty$ { "" } 'title if$ } FUNCTION {format.btitle} { title emphasize } FUNCTION {format.bvolume} { volume empty$ { "" } { "volume" volume tie.or.space.connect number empty$ 'skip$ { ", number" number tie.or.space.connect * "volume+number and series+number" series either.or.check } if$ series empty$ 'skip$ { " of " * series * } if$ } if$ } FUNCTION {format.number.series} { volume empty$ { number empty$ { series field.or.null } { output.state mid.sentence = { "number" } { "Number" } if$ number tie.or.space.connect series empty$ { "there's a number but no series in " cite$ * warning$ } { " in " * series * } if$ } if$ } { "" } if$ } FUNCTION {format.edition} { edition empty$ { "" } { output.state mid.sentence = { edition #1 #1 substring$ "l" change.case$ edition #2 global.max$ substring$ * } 'skip$ if$ } if$ } INTEGERS { multiresult } FUNCTION {multi.page.check} { 't := #0 'multiresult := { multiresult not t empty$ not and } { t #1 #1 substring$ duplicate$ "-" = swap$ duplicate$ "," = swap$ "+" = or or { #1 'multiresult := } { t #2 global.max$ substring$ 't := } if$ } while$ multiresult } FUNCTION {format.pages} { pages empty$ { "" } { output.state mid.sentence = { "p" } { "P" } if$ pages multi.page.check { "ages" * pages tie.or.space.connect } { "age" * pages tie.or.space.connect } if$ } if$ } FUNCTION {format.vol.num.pages} { volume field.or.null embolden number empty$ 'skip$ { volume empty$ { number * } { "(" number * ")" * * } if$ } if$ pages empty$ 'skip$ { duplicate$ empty$ { pop$ format.pages } { ":" * pages * } if$ } if$ } FUNCTION {format.in.ed.title} { field.or.null editor empty$ { "In " } { duplicate$ empty$ { "In " format.editors * } { "In " format.editors * ", " * } if$ } if$ swap$ * } FUNCTION {format.conference} { conference field.or.null emphasize conflocation empty$ 'skip$ { " (" conflocation * ")" * * } if$ } FUNCTION {format.journal} { journal empty$ { "empty journal in " cite$ * warning$ } 'skip$ if$ format.editors output journal emphasize output format.vol.num.pages } FUNCTION {article} { output.bibitem format.authors "author" output.check new.block format.title "title" output.check new.block format.journal output publisher conference new.block.checkb format.conference output publisher output format.date "date" output.check new.block note output fin.entry "booktitle" booktitle ignoring "edition" edition ignoring "reportnumber" reportnumber ignoring "series" series ignoring } FUNCTION {book} { output.bibitem author empty$ { format.editors "author and editor" output.check } { format.authors output.nonnull series empty$ { "author and editor" editor either.or.check } 'skip$ if$ } if$ new.block format.btitle "title" output.check format.bvolume output format.number.series output format.editors output format.edition output publisher reportnumber new.block.checkb publisher "publisher" output.check reportnumber output format.date "date" output.check new.block note output fin.entry "booktitle" booktitle ignoring "conference" conference ignoring "conflocation" conflocation ignoring "journal" journal ignoring "pages" pages ignoring } FUNCTION {inbook} { output.bibitem format.authors "author" output.check new.block format.title "title" output.check new.block booktitle emphasize format.in.ed.title "booktitle" output.check format.bvolume output format.number.series output format.pages "pages" output.check format.edition output publisher reportnumber new.block.checkb publisher "publisher" output.check reportnumber output format.date "date" output.check new.block note output fin.entry "conference" conference ignoring "conflocation" conflocation ignoring "journal" journal ignoring } FUNCTION {inproceedings} { output.bibitem format.authors "author" output.check new.block format.title "title" output.check new.block format.conference "conference and location" output.check journal empty$ { format.bvolume output format.number.series output format.pages output format.editors output format.edition output } { new.block "Published as " output before.all 'output.state := format.journal output "series" series ignoring "edition" edition ignoring } if$ publisher reportnumber new.block.checkb publisher output reportnumber output format.date "date" output.check new.block note output fin.entry "booktitle" booktitle ignoring } FUNCTION {manual} { output.bibitem author empty$ editor empty$ and { publisher empty$ { "no author, editor or publisher in " cite$ * warning$ } { publisher output.nonnull } if$ } { author empty$ { format.editors output.nonnull } { format.authors output.nonnull } if$ } if$ new.block format.btitle "title" output.check reportnumber output format.edition output author empty$ editor empty$ and 'skip$ { publisher new.block.checka publisher output } if$ format.date "date" output.check new.block note output fin.entry "booktitle" booktitle ignoring "conference" conference ignoring "conflocation" conflocation ignoring "journal" journal ignoring "number" number ignoring "pages" pages ignoring "series" series ignoring } FUNCTION {misc} { output.bibitem format.authors output title new.block.checka format.title "title" output.check format.editors output format.edition output publisher reportnumber new.block.checkb publisher output reportnumber output format.date "date" output.check new.block note "public note" output.check fin.entry empty.misc.check "booktitle" booktitle ignoring "conference" conference ignoring "conflocation" conflocation ignoring "journal" journal ignoring "number" number ignoring "pages" pages ignoring "reportnumber" reportnumber ignoring "series" series ignoring "volume" volume ignoring } FUNCTION {phdthesis} { output.bibitem format.authors "author" output.check new.block format.btitle "title" output.check new.block reportnumber empty$ { "PhD thesis" output.nonnull } { "PhD thesis, published as " reportnumber * output.nonnull } if$ new.block publisher "publisher" output.check format.date "date" output.check new.block note output fin.entry "booktitle" booktitle ignoring "conference" conference ignoring "conflocation" conflocation ignoring "edition" edition ignoring "editor" editor ignoring "journal" journal ignoring "number" number ignoring "pages" pages ignoring "series" series ignoring "volume" volume ignoring } FUNCTION {proceedings} { output.bibitem author empty$ { format.editors "author and editor" output.check } { "author and editor" editor either.or.check format.authors output.nonnull } if$ format.btitle "title" output.check format.conference output journal empty$ { format.bvolume output format.number.series output "pages" pages ignoring } { new.block "Published as " output.nonnull before.all 'output.state := format.journal output "series" series ignoring } if$ publisher reportnumber new.block.checkb publisher output reportnumber output format.date "date" output.check new.block note output fin.entry "booktitle" booktitle ignoring "edition" edition ignoring } FUNCTION {techreport} { output.bibitem author empty$ { format.editors "author and editor" output.check } { format.authors output.nonnull "author and editor" editor either.or.check } if$ new.block format.title "title" output.check new.block reportnumber empty$ { "Technical report" } { reportnumber } if$ output.nonnull format.edition output new.block publisher "publisher" output.check format.date "date" output.check new.block note output fin.entry "booktitle" booktitle ignoring "conference" conference ignoring "conflocation" conflocation ignoring "journal" journal ignoring "number" number ignoring "pages" pages ignoring "series" series ignoring "volume" volume ignoring } FUNCTION {unpublished} { output.bibitem format.authors "author" output.check new.block format.title "title" output.check publisher reportnumber new.block.checkb publisher output reportnumber output format.date "date" output.check new.block note "note" output.check fin.entry "booktitle" booktitle ignoring "conference" conference ignoring "conflocation" conflocation ignoring "edition" edition ignoring "editor" editor ignoring "journal" journal ignoring "number" number ignoring "pages" pages ignoring "series" series ignoring "volume" volume ignoring } FUNCTION {default.type} { misc } READ FUNCTION {sortify} { purify$ "l" change.case$ } INTEGERS { len } FUNCTION {chop.word} { 's := 'len := s #1 len substring$ = { s len #1 + global.max$ substring$ } 's if$ } FUNCTION {calc.label} { key 'label := key sortify 'sort.label := } FUNCTION {sort.format.names} { 's := #1 'nameptr := "" s num.names$ 'numnames := numnames 'namesleft := { namesleft #0 > } { nameptr #1 > { " " * } 'skip$ if$ s nameptr "{vv{ } }{ll{ }}{ ff{ }}{ jj{ }}" format.name$ 't := nameptr numnames = t "others" = and { "et al" * } { t sortify * } if$ nameptr #1 + 'nameptr := namesleft #1 - 'namesleft := } while$ } FUNCTION {sort.format.title} { 't := "A " #2 "An " #3 "The " #4 t chop.word chop.word chop.word sortify #1 global.max$ substring$ } FUNCTION {author.sort} { author empty$ { key empty$ { "to sort, need author or key in " cite$ * warning$ "" } { key sortify } if$ } { author sort.format.names } if$ } FUNCTION {author.editor.sort} { author empty$ { editor empty$ { key empty$ { "to sort, need author, editor, or key in " cite$ * warning$ "" } { key sortify } if$ } { editor sort.format.names } if$ } { author sort.format.names } if$ } FUNCTION {author.publisher.sort} { author empty$ { publisher empty$ { key empty$ { "to sort, need author, publisher, or key in " cite$ * warning$ "" } { key sortify } if$ } { "The " #4 publisher chop.word sortify } if$ } { author sort.format.names } if$ } FUNCTION {editor.publisher.sort} { editor empty$ { publisher empty$ { key empty$ { "to sort, need editor, publisher, or key in " cite$ * warning$ "" } { key sortify } if$ } { "The " #4 publisher chop.word sortify } if$ } { editor sort.format.names } if$ } FUNCTION {presort} { calc.label sort.label " " * type$ "book" = type$ "inbook" = or 'author.editor.sort { type$ "proceedings" = 'editor.publisher.sort { type$ "manual" = 'author.publisher.sort 'author.sort if$ } if$ } if$ * " " * date field.or.null sortify * " " * title field.or.null sort.format.title * #1 entry.max$ substring$ 'sort.key$ := } ITERATE {presort} SORT STRINGS { longest.label last.sort.label next.extra } INTEGERS { longest.label.width last.extra.num } FUNCTION {initialize.longest.label} { "" 'longest.label := #0 int.to.chr$ 'last.sort.label := "" 'next.extra := #0 'longest.label.width := #0 'last.extra.num := } FUNCTION {forward.pass} { last.sort.label sort.label = { last.extra.num #1 + 'last.extra.num := last.extra.num int.to.chr$ 'extra.label := } { "a" chr.to.int$ 'last.extra.num := "" 'extra.label := sort.label 'last.sort.label := } if$ } FUNCTION {reverse.pass} { next.extra "b" = { "a" 'extra.label := } 'skip$ if$ label extra.label * 'label := label width$ longest.label.width > { label 'longest.label := label width$ 'longest.label.width := } 'skip$ if$ extra.label 'next.extra := } EXECUTE {initialize.longest.label} ITERATE {forward.pass} REVERSE {reverse.pass} FUNCTION {begin.bib} { preamble$ empty$ 'skip$ { preamble$ write$ newline$ } if$ longest.label width$ #0 > % Original had "9" for "0", { "12" 'longest.label := } % and used "123456789" here 'skip$ if$ "\begin{thebibliography}{" longest.label * "}" * write$ newline$ } EXECUTE {begin.bib} EXECUTE {init.state.consts} ITERATE {call.type$} FUNCTION {end.bib} { newline$ "\end{thebibliography}" write$ newline$ } EXECUTE {end.bib} libmaa-1.4.4/doc/libmaa.600dpi.ps0000644000175000017500000071017713457657444016256 0ustar cheusovcheusov%!PS-Adobe-2.0 %%Creator: dvipsk 5.55a Copyright 1986, 1994 Radical Eye Software %%Title: libmaa.dvi %%Pages: 39 %%PageOrder: Ascend %%BoundingBox: 0 0 612 792 %%EndComments %DVIPSCommandLine: dvips -D600 -o libmaa.600dpi.ps libmaa %DVIPSParameters: dpi=600, compressed, comments removed %DVIPSSource: TeX output 1997.05.21:0050 %%BeginProcSet: texc.pro /TeXDict 250 dict def TeXDict begin /N{def}def /B{bind def}N /S{exch}N /X{S N}B /TR{translate}N /isls false N /vsize 11 72 mul N /hsize 8.5 72 mul N /landplus90{false}def /@rigin{isls{[0 landplus90{1 -1}{-1 1} ifelse 0 0 0]concat}if 72 Resolution div 72 VResolution div neg scale isls{landplus90{VResolution 72 div vsize mul 0 exch}{Resolution -72 div hsize mul 0}ifelse TR}if Resolution VResolution vsize -72 div 1 add mul TR[matrix currentmatrix{dup dup round sub abs 0.00001 lt{round}if} forall round exch round exch]setmatrix}N /@landscape{/isls true N}B /@manualfeed{statusdict /manualfeed true put}B /@copies{/#copies X}B /FMat[1 0 0 -1 0 0]N /FBB[0 0 0 0]N /nn 0 N /IE 0 N /ctr 0 N /df-tail{ /nn 8 dict N nn begin /FontType 3 N /FontMatrix fntrx N /FontBBox FBB N string /base X array /BitMaps X /BuildChar{CharBuilder}N /Encoding IE N end dup{/foo setfont}2 array copy cvx N load 0 nn put /ctr 0 N[}B /df{ /sf 1 N /fntrx FMat N df-tail}B /dfs{div /sf X /fntrx[sf 0 0 sf neg 0 0] N df-tail}B /E{pop nn dup definefont setfont}B /ch-width{ch-data dup length 5 sub get}B /ch-height{ch-data dup length 4 sub get}B /ch-xoff{ 128 ch-data dup length 3 sub get sub}B /ch-yoff{ch-data dup length 2 sub get 127 sub}B /ch-dx{ch-data dup length 1 sub get}B /ch-image{ch-data dup type /stringtype ne{ctr get /ctr ctr 1 add N}if}B /id 0 N /rw 0 N /rc 0 N /gp 0 N /cp 0 N /G 0 N /sf 0 N /CharBuilder{save 3 1 roll S dup /base get 2 index get S /BitMaps get S get /ch-data X pop /ctr 0 N ch-dx 0 ch-xoff ch-yoff ch-height sub ch-xoff ch-width add ch-yoff setcachedevice ch-width ch-height true[1 0 0 -1 -.1 ch-xoff sub ch-yoff .1 sub]/id ch-image N /rw ch-width 7 add 8 idiv string N /rc 0 N /gp 0 N /cp 0 N{rc 0 ne{rc 1 sub /rc X rw}{G}ifelse}imagemask restore}B /G{{id gp get /gp gp 1 add N dup 18 mod S 18 idiv pl S get exec}loop}B /adv{cp add /cp X}B /chg{rw cp id gp 4 index getinterval putinterval dup gp add /gp X adv}B /nd{/cp 0 N rw exit}B /lsh{rw cp 2 copy get dup 0 eq{pop 1}{ dup 255 eq{pop 254}{dup dup add 255 and S 1 and or}ifelse}ifelse put 1 adv}B /rsh{rw cp 2 copy get dup 0 eq{pop 128}{dup 255 eq{pop 127}{dup 2 idiv S 128 and or}ifelse}ifelse put 1 adv}B /clr{rw cp 2 index string putinterval adv}B /set{rw cp fillstr 0 4 index getinterval putinterval adv}B /fillstr 18 string 0 1 17{2 copy 255 put pop}for N /pl[{adv 1 chg} {adv 1 chg nd}{1 add chg}{1 add chg nd}{adv lsh}{adv lsh nd}{adv rsh}{ adv rsh nd}{1 add adv}{/rc X nd}{1 add set}{1 add clr}{adv 2 chg}{adv 2 chg nd}{pop nd}]dup{bind pop}forall N /D{/cc X dup type /stringtype ne{] }if nn /base get cc ctr put nn /BitMaps get S ctr S sf 1 ne{dup dup length 1 sub dup 2 index S get sf div put}if put /ctr ctr 1 add N}B /I{ cc 1 add D}B /bop{userdict /bop-hook known{bop-hook}if /SI save N @rigin 0 0 moveto /V matrix currentmatrix dup 1 get dup mul exch 0 get dup mul add .99 lt{/QV}{/RV}ifelse load def pop pop}N /eop{SI restore showpage userdict /eop-hook known{eop-hook}if}N /@start{userdict /start-hook known{start-hook}if pop /VResolution X /Resolution X 1000 div /DVImag X /IE 256 array N 0 1 255{IE S 1 string dup 0 3 index put cvn put}for 65781.76 div /vsize X 65781.76 div /hsize X}N /p{show}N /RMat[1 0 0 -1 0 0]N /BDot 260 string N /rulex 0 N /ruley 0 N /v{/ruley X /rulex X V}B /V {}B /RV statusdict begin /product where{pop product dup length 7 ge{0 7 getinterval dup(Display)eq exch 0 4 getinterval(NeXT)eq or}{pop false} ifelse}{false}ifelse end{{gsave TR -.1 .1 TR 1 1 scale rulex ruley false RMat{BDot}imagemask grestore}}{{gsave TR -.1 .1 TR rulex ruley scale 1 1 false RMat{BDot}imagemask grestore}}ifelse B /QV{gsave newpath transform round exch round exch itransform moveto rulex 0 rlineto 0 ruley neg rlineto rulex neg 0 rlineto fill grestore}B /a{moveto}B /delta 0 N /tail {dup /delta X 0 rmoveto}B /M{S p delta add tail}B /b{S p tail}B /c{-4 M} B /d{-3 M}B /e{-2 M}B /f{-1 M}B /g{0 M}B /h{1 M}B /i{2 M}B /j{3 M}B /k{ 4 M}B /w{0 rmoveto}B /l{p -4 w}B /m{p -3 w}B /n{p -2 w}B /o{p -1 w}B /q{ p 1 w}B /r{p 2 w}B /s{p 3 w}B /t{p 4 w}B /x{0 S rmoveto}B /y{3 2 roll p a}B /bos{/SS save N}B /eos{SS restore}B end %%EndProcSet TeXDict begin 40258431 52099146 1000 600 600 (libmaa.dvi) @start /Fa 2 52 600 300 dfs[<123EEA4180EA80C012C01200A2EA0180EA03001204 EA08401230EA7F8012FF>10 13 126 140 28 50 D[<123E1241EA61801201EA0300121E EA0180EA00C0A212C0A2EA4180EA3E00>10 13 126 140 28 I E /Fb 2 113 600 300 dfs[18 2 125 135 52 0 D[<154015C0EC0180A2EC 0300A21406A25C5CA25CA25CA200305B12D838180180120C49C7FC120613066C5AA2EA01 98A2EA00F0A21360A2>26 30 127 129 54 112 D E /Fc 2 111 600 300 dfs[<130113031306A3130CA31318A31330A31360A213C0A3EA0180A3EA0300 A31206A25AA35AA35AA35AA35AA2>16 41 126 158 42 61 D[20 18 126 145 50 110 D E /Fd 3 51 df48 D<5A1207123F12C71207B3A5EAFFF80D1C7C9B15>II E /Fe 25 122 600 300 dfs[13 11 124 152 44 34 D[19 25 127 152 44 I[17 3 126 141 44 45 D[19 25 127 152 44 76 D[<387E07F038FF0FF8387F07F0381D81C0A313C1121C13E1A213611371A313311339 A21319131D130DA3EA7F07EAFF87EA7F03>21 25 128 152 44 78 D[17 25 126 152 44 83 D[<387F07F038FF8FF8387F07F0381C01C0B0380E0380A23807070013 FF6C5AEA00F8>21 25 128 152 44 85 D[<12C07EA21270A27EA27EA27EA27EA26C7EA2 6C7EA26C7EA21370A27FA27FA27FA27FA2EB0380A21301>17 32 126 156 44 92 D[19 18 126 145 44 97 D[<12FCA3121CA4137CEA 1DFEEA1FFFEB0780381E03C0EA1C01EB00E0A6EB01C0EA1E03381F0780EBFF00EA1DFEEA 0C78>19 25 127 152 44 I[<133FA31307A4EA03C7EA0FF748B4FCEA3C1F487EEA7007 12E0A6EA700F12786C5A381FFFE0EA0FF7EA07C7>19 25 127 152 44 100 D[17 18 126 145 44 I[<3803E3C03807F7E0EA0F FF381C1CC038380E00A56C5AEA0FF8485AEA1BE00038C7FC1218EA1FFC13FF4813803870 03C038E000E0A4387001C0EA7C07383FFF80380FFE00EA03F8>19 28 127 145 44 103 D[<1203EA0780A2EA0300C7FCA4EAFF80A31203ACEAFFFC13FE13 FC>15 26 124 153 44 105 D[<127E12FE127E120EA4EB7FE0A3EB0F00131E5B5B5B12 0F7F13BC131EEA0E0E7F1480387F87F0EAFFCFEA7F87>20 25 128 152 44 107 D[17 25 126 152 44 I[<38F9C38038FFEFC0EBFFE0EA3C78A2EA3870AA38FE7CF8A3>21 18 128 145 44 I[19 18 127 145 44 I[17 18 126 145 44 I[<387F0FC038FF3FE0EA7F 7F3807F040EBC0005BA290C7FCA8EA7FFC12FF127F>19 18 127 145 44 114 D[15 18 125 145 44 I[<12035AA4EA7FFFB5FCA20007C7FCA75BEB0380A3EB8700EA03FE6C5A6C5A>17 23 127 150 44 I[19 18 127 145 44 I[<387F1FC038FF9FE0387F1FC0381C0700A2EA0E0EA36C5AA4EA03B8 A3EA01F0A26C5A>19 18 127 145 44 I[<387F1FC038FF9FE0387F1FC0381C0700120E 130EA212075BA2EA039CA21398EA01B8A2EA00F0A35BA3485A1279127BEA7F8090C7FC12 3C>19 27 127 145 44 121 D E /Ff 8 117 600 300 dfs[<127C1218A45AA4EA6780 EA68C0EA7040EA606012C0A4EA80C0A2EA8180EAC1001246123C>11 23 124 150 32 98 D[<133E130CA41318A4EA03B0EA0C701218EA303013601260A3EAC0 C013C812401241EA62D0EA1C70>15 23 124 150 36 100 D[11 14 124 141 32 I[14 20 126 141 32 103 D[<1203120712061200A61218122C 124CA2128C1218A3123012321262126412241238>8 23 125 150 22 105 D[13 14 125 141 30 114 D[11 14 125 141 30 I[<1206A25AA4EAFF80EA1800A35AA45A 1261A2126212641238>9 20 125 147 24 I E /Fg 6 115 480 300 dfs[<39FFF00FF0390F0003C0150014025C5C5C1460148049C7FC13021307497E13 17EB23C0EB43E01381EB00F08014788080141F80EC078015C015E039FFF01FF8>29 28 125 155 56 75 D[<13201370A313B8A3EA011CA2EA031EEA020EA2487EEA07FFEA04 0738080380A2001813C01301123838FC07F8>21 21 127 148 40 97 D[19 21 127 148 37 101 D[<38FF8FF8381C01C0A9EA1FFFEA1C 01A938FF8FF8>21 21 127 148 40 104 D[18 21 127 148 37 112 D[22 21 127 148 40 114 D E /Fh 1 50 600 300 dfs[<1218127812981218AC12FF>8 16 125 143 30 49 D E /Fi 5 55 600 300 dfs[<120C121C12EC120CAFEAFFC0>10 19 125 146 34 49 D[<121FEA60C01360EAF07013301260EA0070A2136013C012011380 EA02005AEA08101210EA2020EA7FE012FF>12 19 126 146 34 I[ 14 19 127 146 34 I[12 19 126 146 34 53 D[12 19 126 146 34 I E /Fj 10 115 600 300 dfs[<39FFF00FF0390F0003C0150014025C5C5C1460148049C7FC1302130749 7E1317EB23C0EB43E01381EB00F08014788080141F80EC078015C015E039FFF01FF8>29 28 125 155 70 75 D[<13201370A313B8A3EA011CA2EA031EEA020EA2487EEA07FFEA04 0738080380A2001813C01301123838FC07F8>21 21 127 148 50 97 D[19 21 127 148 48 I[19 21 127 148 46 101 D[<38FF8FF8381C01C0A9EA1FFFEA1C01A938FF8FF8>21 21 127 148 50 104 D[9 21 127 148 26 I[17 21 127 148 42 108 D[<00FEEB0FE0001E140000171317A338138027A23811C047A33810E087A2 EB7107A3133AA2131CA2123839FE083FE0>27 21 127 148 62 I[18 21 127 148 46 112 D[22 21 127 148 50 114 D E /Fk 3 104 600 300 dfs[<1203A4EAC30CEAE31CEA7338EA1FE0EA0780A2EA1FE0EA7338EA E31CEAC30CEA0300A4>14 18 125 146 42 3 D[<133C13E0EA01C013801203AD13005A 121C12F0121C12077E1380AD120113C0EA00E0133C>14 41 125 158 42 102 D[<12F0121C12077E1380AD120113C0EA00E0133C13E0EA01C013801203AD 13005A121C12F0>14 41 125 158 42 I E /Fl 19 86 600 300 dfs[<12E0B3A212401200A512E0A3>3 29 123 156 26 33 D[10 42 125 158 32 40 D[<12E012707E7EA27EA27EA3EA0380A4EA01C0AEEA0380A4EA0700 A3120EA25AA25A5A5A>10 42 126 158 32 I[<1306ADB612E0A2D80006C7FCAD>27 28 126 151 64 43 D[<12E0A312601240A312C0>3 8 124 130 24 I[<12E0A3>3 3 124 130 24 46 D[16 29 126 155 42 48 D[16 28 126 155 42 50 D[16 29 126 155 42 I[<133C137C135C13DCA2EA019C1203A2EA071CA2120EA2121CA2 12381278127012F0B512C0A238001C00A7>18 27 127 154 42 I[17 28 127 154 42 I[<13F8EA03FCEA0704EA0E005A5AA25AA2EA71F0EAE7F8EA EFFCEAFC3CEAF81EEAF00E130712E0A51270A2130E1230EA381CEA1C38EA0FF0EA03E0> 16 29 126 155 42 I[16 27 126 154 42 I[16 29 126 155 42 I[16 29 126 155 42 I[<12E0A31200AC12E0A312601240 A312C0>3 23 124 145 24 59 D[<007FB512C0B612E0C9FCA8B612E06C14C0>27 12 126 143 64 61 D[<12F0B3A9B5FCA2>16 29 125 156 44 76 D[<00F01370B3A5007813E0A2383C01C0381E0380EA0F073807FE00EA01F8>20 30 124 156 58 85 D E /Fm 28 122 600 300 dfs[<9138FE07C0903901C71C709039 078F3CF0EC1F39010F137991380E78E002001300011E5BA40003B61280A23A003C01E000 A549485AA549485AA5484848C7FCA33871C70E38F9CF8E38FB8F9C00F3131838E70E3038 3C03C0>36 37 129 156 62 11 D[28 37 129 156 56 I[30 37 129 156 58 I[20 18 124 145 50 97 D[17 29 124 156 44 I[<13FCEA0383EA0F07381E0F80383E1F00EA3C0FEA7C0490C7FC5AA5EAF002EA7007EA 780EEA3838EA0FE0>17 18 124 145 44 I[21 29 124 156 50 I[<13FCEA0382EA0F03381E0180383E0300123CEA 7C06137CEAFFC000F8C7FCA41302EA7807EA380EEA1C38EA0FE0>17 18 124 145 44 I[22 37 129 156 34 I[20 26 126 145 44 I[21 29 125 156 50 I[<13E0EA01F0A213E0EA00C01300A7120FEA1380EA23C01263EA4780 12C71207EA0F00A3121E1320EA3C60A21340EA38C0EA1980EA0F00>12 30 125 157 30 I[<1303EB0780130FA2EB070090C7FCA71378EA018EEA030E1206131E 120C1200A25BA45BA45BA4EA71E012F95B485A48C7FC127C>17 38 129 157 30 I[20 29 126 156 44 I[10 29 125 156 24 I[<391E07E0FC393318718E3963A07A0FEBC07C00C7 137813801207A2390F00F01EA3ED3C20261E01E01360A2ED784016C03A3C03C039803A18 01801E00>35 18 125 145 78 I[<381E0FC0383318E03863A0F013C0EAC780A21207A2 380F01E0A3EB03C2001E13C6A2EB0784148C383C0398381801E0>23 18 125 145 54 I[<13FE3803C380380701C0001E13E0A2123C007C13F0A238F803E0A3 14C0130700F0138038780F00131E6C5AEA0FE0>20 18 124 145 50 I[<380783E0380CCC303818F838EBF03CEA31E0143E1201A23803C07CA31478380780 F814F0EB81E014C0380FC380EB3E0090C7FCA2121EA4B47EA2>23 26 127 145 50 I[18 26 124 145 44 I[18 18 125 145 42 I[16 18 125 145 40 I[12 26 125 153 32 I[<000F1360381180F0EA21C012 633843C1E012C3EA0781A2380F03C0A314C4380E078C121E120EEB0F9838071B903803E1 E0>22 18 125 145 52 I[<380F0380381187C0EA21C712631243EAC3C1EA0780A2380F 0180A3EB0300120E130213065B6C5AEA03E0>18 18 125 145 44 I[<000FEB60E0391180F1F0EA21C012633843C1E100C3EBE070D807811330A2390F03C0 60A31540000EEB80C01580EB0781000F140038070DC23801F07C>28 18 125 145 64 I[<3807C3803818EC60383078E0EA607913F312C03800F1C0EBF00048 5AA300311320387BC06012FB14C000F713803844C300EA387E>19 18 125 145 46 I[<000F1360381180F0EA31C012633843C1E012C3EA0781A2380F03C0 A4380E0780121E120E130F38071F00EA03EFEA000F130EEA3C1EEA7C1C5BEA7870EA30E0 EA1F80>20 26 125 145 46 I E /Fn 49 122 600 300 dfs[<13181330136013C01201 EA0380EA0700A2120E121E121C123CA35AA412F85AAB7E1278A47EA3121C121E120E7EA2 EA0380EA01C01200136013301318>13 49 123 164 44 40 D[<12C012607E7E121C7E7E A2EA038013C0120113E0A3EA00F0A413F81378AB13F813F0A4EA01E0A313C012031380EA 0700A2120E5A12185A5A5A>13 49 125 164 44 I[14 4 127 140 38 45 D[<1238127C12FEA3127C1238>7 7 124 134 32 I[<13FE3807FFC0380F83E0381F01F0383E00F8A248137CA312FC147EAD007C137CA3 6C13F8A2381F01F0380F83E03807FFC03800FE00>23 32 126 159 56 48 D[<13181378EA01F812FFA21201B3A7387FFFE0A2>19 32 124 159 56 I[21 32 125 159 56 I[<13FE3807FFC0380F07E0381E 03F0123FEB81F8A3EA1F0314F0120014E0EB07C0EB1F803801FE007F380007C0EB01F014 F8EB00FCA2003C13FE127EB4FCA314FCEA7E01007813F8381E07F0380FFFC03801FE00> 23 32 126 159 56 I[<14E013011303A21307130F131FA21337137713E7EA01C71387EA 03071207120E120C12181238127012E0B6FCA2380007E0A790B5FCA2>24 32 126 159 56 I[<00301320383E01E0383FFFC0148014005B13F8EA33C00030C7FCA4 EA31FCEA37FF383E0FC0383807E0EA3003000013F0A214F8A21238127C12FEA200FC13F0 A2387007E0003013C0383C1F80380FFF00EA03F8>21 32 125 159 56 I[23 32 126 159 56 I[<12601278387FFFFEA214 FC14F8A214F038E0006014C038C00180EB0300A2EA00065B131C131813381378A25BA312 01A31203A76C5A>23 34 125 161 56 I[<13FE3803FFC0380703E0380E00F05A147812 3C123E123F1380EBE0F0381FF9E0EBFFC06C13806C13C06C13E04813F0381E7FF8383C1F FCEA7807EB01FEEAF000143E141EA36C131C007813387E001F13F0380FFFC000011300> 23 32 126 159 56 I[23 32 126 159 56 I[<1470A214F8A3497EA2497EA3EB067FA2010C7F143FA2496C7EA201307F140F 01707FEB6007A201C07F90B5FC4880EB8001A2D803007F14004880000680A23AFFE007FF F8A2>37 34 126 161 84 65 D[34 34 126 161 80 I[ 33 34 125 161 80 I[37 34 126 161 86 I[32 34 126 161 74 I[30 34 126 161 70 I[38 34 125 161 88 I[39 34 126 161 88 I[29 34 126 161 68 76 D[48 34 126 161 106 I[39 34 126 161 88 I[32 34 126 161 76 80 D[39 34 126 161 84 82 D[<3801FE023807FF86381F01FE383C007E007C131E0078 130EA200F81306A27E1400B4FC13E06CB4FC14C06C13F06C13F86C13FC000313FEEA003F 1303EB007F143FA200C0131FA36C131EA26C133C12FCB413F838C7FFE000801380>24 34 125 161 62 I[<007FB61280A2397E03F80F00781407007014030060140100E015C0 A200C01400A400001500B3A248B512F0A2>34 34 126 161 78 I[24 22 126 149 54 97 D[ 26 35 126 162 62 I[21 22 126 149 50 I[26 35 126 162 62 I[<13FE3807FF80380F87C0381E01E0003E13F0EA7C0014F812FCA2B5 FCA200FCC7FCA3127CA2127E003E13186C1330380FC0703803FFC0C61300>21 22 126 149 52 I[<3801FE0F3907FFBF80380F87C7381F03E7391E01E000003E7FA500 1E5BEA1F03380F87C0EBFF80D809FEC7FC0018C8FCA2121C381FFFE06C13F86C13FE001F 7F383C003F48EB0F80481307A40078EB0F006C131E001F137C6CB45A000113C0>25 33 127 149 56 103 D[26 35 126 162 62 I[<121C123E127FA3123E121CC7FCA7B4FCA2121F B2EAFFE0A2>11 36 126 163 32 I[26 35 126 162 60 107 D[11 35 126 162 32 I[<3AFF07F007F090391FFC1FFC3A1F303E303E01401340496C487EA201001300 AE3BFFE0FFE0FFE0A2>43 22 126 149 96 I[<38FF07E0EB1FF8381F307CEB403CEB80 3EA21300AE39FFE1FFC0A2>26 22 126 149 62 I[<13FE3807FFC0380F83E0381E00F0 003E13F848137CA300FC137EA7007C137CA26C13F8381F01F0380F83E03807FFC03800FE 00>23 22 126 149 56 I[<38FF0FE0EB3FF8381FE07CEB803E497E1580A2EC0FC0A8EC 1F80A29038803F00EBC03EEBE0FCEB3FF8EB0FC090C8FCA8EAFFE0A2>26 32 126 149 62 I[ 19 22 126 149 46 114 D[17 22 126 149 44 I[<487EA41203A21207A2120F123FB5FCA2EA0F80ABEB8180A5EB 8300EA07C3EA03FEEA00F8>17 32 127 159 44 I[<38FF01FEA2381F003EAF147E14FE 380F81BE3907FF3FC0EA01FC>26 22 126 149 62 I[<39FFE07FC0A2390F801C006C6C 5A6C6C5AEBF0606C6C5A3800F980137F6DC7FC7F80497E1337EB63E0EBC1F03801C0F848 487E3807007E000E133E39FF80FFE0A2>27 22 127 149 60 120 D[<39FFE01FE0A2391F800700000F1306EBC00E0007130C13E000035BA26C6C5AA26C6C 5AA2EB7CC0A2137F6D5AA26DC7FCA2130EA2130CA25B1278EAFC3813305BEA69C0EA7F80 001FC8FC>27 32 127 149 60 I E /Fo 10 115 540 300 dfs[<39FFF00FF0390F0003 C0150014025C5C5C1460148049C7FC13021307497E1317EB23C0EB43E01381EB00F08014 788080141F80EC078015C015E039FFF01FF8>29 28 125 155 63 75 D[<13201370A313B8A3EA011CA2EA031EEA020EA2487EEA07FFEA040738080380A200 1813C01301123838FC07F8>21 21 127 148 45 97 D[19 21 127 148 43 I[19 21 127 148 41 101 D[<38FF8FF8381C01C0 A9EA1FFFEA1C01A938FF8FF8>21 21 127 148 45 104 D[9 21 127 148 23 I[17 21 127 148 38 108 D[<00FEEB0FE0001E140000171317A338138027A23811C047A338 10E087A2EB7107A3133AA2131CA2123839FE083FE0>27 21 127 148 56 I[18 21 127 148 41 112 D[22 21 127 148 45 114 D E /Fp 27 122 600 300 dfs[<126012F0A212701210A31220A21240A2>4 11 125 131 22 44 D[10 2 128 136 26 I[<126012F0A21260>4 4 125 131 22 I[<130CA3131EA2132F1327A2EB4380A3EB81C0A200017F1300A248B47E 38020070A2487FA3487FA2003C131EB4EBFFC0>26 26 127 153 58 65 D[16 26 126 153 42 83 D[<007FB5FC38701C0700401301A200C0148000801300A300001400 B13803FFE0>25 26 127 153 56 I[17 16 127 143 38 97 D[<12FC121CA913FCEA1D07381E0380381C01C0130014E0A6EB01C01480381E0300EA19 06EA10F8>19 26 128 153 42 I[14 16 127 143 34 I[<133F1307A9EA03E7EA0C17EA180F487E1270 12E0A6126012706C5AEA1C373807C7E0>19 26 127 153 42 I[14 16 127 143 34 I[13 26 128 153 24 I[17 24 127 143 38 I[<12FC121CA9137CEA1D87381E0380A2121CAB38FF9FF0>20 26 128 153 42 I[<1218123CA212181200A612FC121CAE12FF>8 26 128 153 20 I[<12FC121CB3A6EAFF80>9 26 128 153 20 108 D[<38FC7C1F391D8E6380391E0781C0A2001C1301AB39FF9FE7F8>29 16 127 143 64 I[20 16 128 143 42 I[16 16 127 143 38 I[19 23 128 143 42 I[14 16 128 143 30 114 D[12 16 127 143 30 I[<1208A41218A21238EAFFC0 EA3800A81320A41218EA1C40EA0780>11 23 127 150 30 I[<38FC1F80EA1C03AB1307 120CEA0E0B3803F3F0>20 16 128 143 42 I[<38FF0F80383C0700EA1C061304A26C5A A26C5AA3EA03A0A2EA01C0A36C5A>17 16 127 143 40 I[<39FE7F1F8039381C070000 3C1306381C0C04130E380E16081317A238072310149013A33803C1A014E0380180C0A3> 25 16 127 143 56 I[<38FF0F80383C0700EA1C061304A26C5AA26C5AA3EA03A0A2EA01 C0A36C5AA248C7FCA212E112E212E41278>17 23 127 143 40 121 D E /Fq 7 117 600 300 dfs[<1303497EA2497EA3EB1BE0A2EB3BF01331A2EB60F8A2 EBE0FCEBC07CA248487EEBFFFE487FEB001F4814800006130FA248EB07C039FF803FFCA2 >30 26 127 153 66 65 D[19 17 127 144 42 97 D[<12FCA2123CA713FE383F87 80383E01C0003C13E0EB00F0A214F8A514F0A2EB01E0003E13C0383B07803830FE00>21 26 126 153 50 I[17 17 127 144 40 I[14 17 126 144 36 114 D[14 17 127 144 34 I[<1206A4120EA2121EEA3FF012FFEA1E00A81318A5EA0F30EA03E0> 13 24 127 151 34 I E /Fr 47 122 600 300 dfs[<13FFEA0707120E121CA6B5FCEA 1C07AC387F1FC0>18 23 128 150 40 13 D[<120112021204120C1218A21230A2127012 60A312E0AA1260A312701230A21218A2120C120412021201>8 34 125 152 28 40 D[<12801240122012301218A2120CA2120E1206A31207AA1206A3120E 120CA21218A21230122012401280>8 34 126 152 28 I[<126012F0A212701210A21220 A21240A2>4 10 125 131 20 44 D[9 2 128 135 24 I[<126012F0A21260>4 4 125 131 20 I[15 21 127 148 36 48 D[<1206120E12FE120EB1EAFFE0>11 21 125 148 36 I[13 21 126 148 36 I[15 21 127 148 36 I[<1330A2137013F012011370120212041208121812101220124012C0 EAFFFEEA0070A5EA03FE>15 21 127 148 36 I[ 15 21 127 148 36 54 D[<1240EA7FFE13FC13F8EAC008EA80101320EA00401380A2EA 01005AA212021206A2120EA51204>15 22 126 149 36 I[15 21 127 148 36 I[15 21 127 148 36 I[<126012F0A212601200A6126012F0A212701210A21220A21240A2>4 20 125 141 20 59 D[<13101338A3135CA3138EA3EA0107A238020380A33807FFC0EA04 01A2380800E0A2001813F0123838FE03FE>23 23 127 150 52 65 D[20 23 126 150 50 67 D[20 23 127 150 46 70 D[11 23 127 150 26 73 D[19 23 127 150 44 76 D[<00FC13FE001E1338001F13101217EA1380EA11C0A2EA10E01370 1338A2131C130E130F1307EB0390EB01D0A2EB00F014701430123800FE1310>23 23 127 150 52 78 D[<13FCEA0303380E01C0381C00E048137000301330007013380060 131800E0131CA700701338A200301330003813706C13E0380E01C038030300EA00FC>22 23 126 150 54 I[20 23 127 150 48 I[24 23 127 150 52 82 D[15 23 126 150 40 I[16 14 127 141 36 97 D[<12F81238A8EA39F0EA3E0CEA38061307 7F1480A414005B1306EA361CEA21F0>17 23 127 150 40 I[13 14 127 141 32 I[<133E130EA8EA07CEEA1C3EEA300E1270126012E0A412601270EA301EEA182E3807 CF80>17 23 127 150 40 I[13 14 127 141 32 I[12 23 128 150 22 I[16 21 127 141 36 I[<12F81238A813F8EA3B1CEA3C0E1238AA38FE3F80>17 23 127 150 40 I[<12301278A212301200A512F81238AC12FE>7 23 127 150 20 I[<12F81238B3A312FE>7 23 127 150 20 108 D[<38F8F83E383B1CC7393C0F0380EA380EAA39FE3F8FE0>27 14 127 141 60 I[17 14 127 141 40 I[15 14 127 141 36 I[17 20 127 141 40 I[ 12 14 127 141 28 114 D[11 14 127 141 28 I[<1208A31218A21238EAFFC0EA38 00A71340A4EA1C80EA0F00>10 20 127 147 28 I[17 14 127 141 40 I[16 14 127 141 38 I[<38FEFE7C383838381410133C001C132013 4C381E4E60380ECE401387000713801303A200031300EA0201>22 14 127 141 50 I[16 20 127 141 38 121 D E /Fs 1 4 600 300 dfs[<120CA2EACCC012EDEA7F80EA0C00EA7F80EAEDC012CCEA0C00 A2>10 11 125 139 32 3 D E /Ft 52 123 600 300 dfs[<903801F03C9038071C4701 0C13C7EC19C690381C0180140313181338A2EC0700A20003B512F03900700700A3140EA2 13E0A35CA2EA01C0A35CA2EA0380A21430EB0070A248136038C630E038E638C038CC3180 D8781EC7FC>32 37 129 156 50 11 D[<14FE90380301801306EB0C03EB1C0191C7FC13 181338A43803FFFE3800700EA35CA213E0A25CA3EA01C01472A438038034141891C7FC90 C8FCA25A12C612E65A1278>25 37 129 156 46 I[<903801FEE0EB0707130E010C13C0 EB1C01A213189038380380A40003B5120038007007A3140EA213E0A25CA3EA01C01439A4 3803801A140C91C7FC90C8FCA25A12C612E65A1278>27 37 129 156 48 I[<136013C0A3EA3086EA388EEA1DB8EA0F60EA0380A2EA0DE0EA3B70EAE238EA C218EA0600A35A>15 18 120 158 42 42 D[<12181238127812381208A21210A2122012 40A21280>5 12 125 131 26 44 D[10 3 125 137 30 I[<133EEBE180380181C0EA03005A1206000E13E0120C001C13C0A2EA18011238A338 700380A43860070012E01306130EA2130C5BEA60385BEA30C0001FC7FC>19 29 124 155 42 48 D[<1304130C131813381378EA07B8EA0070A413E0A4EA01C0A4EA03 80A4EA0700A45AEAFFF0>14 28 123 155 42 I[<133EEB4180EB80C0EA0100000213E0 EA0440A21208A3381081C0A238110380000E1300EA00065B5B136013800003C7FC120448 13404813805AEB0100EA7F07EA43FEEA81FCEA8078>19 29 125 155 42 I[<1206120FA212061200AA1230127812F01260>8 18 124 145 26 58 D[<1418A21438A21478A214B8EB0138A2EB023C141C1304130C13081310A2 1320A2EB7FFCEBC01C1380EA0100141E0002130EA25A120C001C131EB4EBFFC0>26 29 126 156 62 65 D[<903803F02090381E0C6090383002E09038E003C03801C001EA03 8048C7FC000E1480121E121C123C15005AA35AA41404A35C12705C6C5B00185B6C485AD8 0706C7FCEA01F8>27 30 122 156 60 67 D[<48B512F038003C00013813301520A35BA2 14081500495AA21430EBFFF03801C020A439038040801400A2EC0100EA07005C14021406 000E133CB512FC>28 28 126 155 56 69 D[<48B512F038003C00013813301520A35BA2 14081500495AA21430EBFFF03801C020A448485A91C7FCA348C8FCA45AEAFFF0>28 28 126 155 54 I[<3A01FFC3FF803A003C00780001381370A4495BA449485AA390B5FC 3901C00380A4484848C7FCA43807000EA448131E39FFE1FFC0>33 28 126 155 62 72 D[16 28 125 155 32 I[<3801FFC038003C001338A45BA45BA4485AA438 038002A31404EA0700140C14181438000E13F0B5FC>23 28 126 155 52 76 D[39 28 126 155 74 I[33 28 126 155 62 I[26 30 122 156 64 I[<3801FFFE39003C038090383801C0 EC00E0A3EB7001A315C0EBE0031580EC0700141C3801FFF001C0C7FCA3485AA448C8FCA4 5AEAFFE0>27 28 126 155 56 I[22 30 125 156 46 83 D[<001FB512C0381C07013830 0E0000201480126012405B1280A2000014005BA45BA45BA4485AA41203EA7FFE>26 28 121 155 60 I[<397FF03FE0390F000700000E13061404A3485BA4485BA4485BA448 5BA35CA249C7FCEA60025B6C5AEA1830EA07C0>27 29 120 155 62 I[17 41 126 158 26 91 D[17 41 129 158 26 93 D[16 18 124 145 42 97 D[<123F1207A2120EA45AA4EA39E0EA3A18EA3C0C12381270130EA3EA E01CA31318133813301360EA60C0EA3180EA1E00>15 29 124 156 38 I[<13F8EA0304120EEA1C0EEA181CEA30001270A25AA51304EA60081310EA3060EA0F 80>15 18 124 145 38 I[19 29 124 156 42 I[<13F8EA0704120CEA1802EA38041230EA7008EA7FF0EAE000A5EA60 041308EA30101360EA0F80>15 18 124 145 38 I[20 37 129 156 26 I[18 26 126 145 38 I[18 29 126 156 42 I[9 28 124 155 26 I[<1303130713031300A71378138CEA010C1202 131C12041200A21338A41370A413E0A4EA01C0A2EAC180EAE30012C61278>16 36 129 155 26 I[18 29 126 156 38 I[9 29 125 156 22 I[<391C1E078039266318C0394683A0E0384703C0008E1380A212 0EA2391C0701C0A3EC0380D8380E1388A2EC0708151039701C032039300C01C0>29 18 124 145 68 I[18 18 124 145 46 I[<13F8EA030CEA0E06487E 1218123000701380A238E00700A3130EA25BEA60185BEA30E0EA0F80>17 18 124 145 42 I[<380387803804C860EBD03013E0EA09C014381201A238038070A314 60380700E014C0EB0180EB8300EA0E86137890C7FCA25AA45AB4FC>21 26 128 145 42 I[16 26 124 145 38 I[16 18 124 145 36 I[14 18 125 145 34 I[<12035AA3120EA4EAFFE0EA1C00A35AA45AA4EAE080A2EAE100A212661238>11 26 124 153 28 I[<381C0180EA2E03124EA2388E0700A2121CA2EA380EA438301C80A3 EA383C38184D00EA0F86>17 18 124 145 44 I[15 18 124 145 38 I[<381E0183382703871247148338870701A2120EA2381C0E02A31404EA180C13 1C1408EA1C1E380C26303807C3C0>24 18 124 145 56 I[<38038780380CC840380870 E012103820E0C014001200A2485AA4EA03811263EAE38212C5EA8584EA7878>19 18 126 145 38 I[<381C0180EA2E03124EA2388E0700A2121CA2EA380EA4EA301CA3EA 383CEA1878EA0FB8EA003813301370EAE0605BEA81800043C7FC123C>17 26 124 145 40 I[16 18 126 145 34 I E /Fu 84 125 600 300 dfs[26 29 128 156 48 11 D[<137E3801C180EA0301380703C0120EEB018090C7FCA5B512C0EA0E01B0387F 87F8>21 29 128 156 46 I[21 29 128 156 46 I[<90383F07E03901C09C18380380F0D80701133C000E13E0 0100131892C7FCA5B612FC390E00E01CB03A7FC7FCFF80>33 29 128 156 70 I[13 12 127 156 42 34 D[<126012F012F812681208A31210A2122012401280>5 12 124 156 24 39 D[<1380EA0100120212065AA25AA25AA35AA412E0AC1260A47EA37E A27EA27E12027EEA0080>9 42 124 158 32 I[<7E12407E12307EA27EA27EA37EA41380 AC1300A41206A35AA25AA25A12205A5A>9 42 126 158 32 I[<1306ADB612E0A2D80006 C7FCAD>27 28 126 151 64 43 D[<126012F0A212701210A41220A212401280>4 12 124 131 24 I[11 2 128 137 28 I[<126012F0A21260>4 4 124 131 24 I[<130113031306A3130CA31318A31330A31360A213C0A3EA0180A3EA03 00A31206A25AA35AA35AA35AA35AA2>16 41 126 158 42 I[16 29 126 155 42 I[<5A1207123F12C71207B3A5EAFFF8>13 28 124 155 42 I[16 28 126 155 42 I[ 16 29 126 155 42 I[<130CA2131C133CA2135C13DC139CEA011C120312021204120C12 08121012301220124012C0B512C038001C00A73801FFC0>18 28 127 155 42 I[16 29 126 155 42 I[<13F0EA030CEA0404EA0C0EEA181E1230130CEA7000A21260EAE3E0 EAE430EAE818EAF00C130EEAE0061307A51260A2EA7006EA300E130CEA1818EA0C30EA03 E0>16 29 126 155 42 I[<1240387FFF801400A2EA4002485AA25B485AA25B13601340 13C0A212015BA21203A41207A66CC7FC>17 29 126 155 42 I[16 29 126 155 42 I[ 16 29 126 155 42 I[<126012F0A212601200AA126012F0A21260>4 18 124 145 24 I[<126012F0A212601200AA126012F0A212701210A41220A212401280> 4 26 124 145 24 I[<007FB512C0B612E0C9FCA8B612E06C14C0>27 12 126 143 64 61 D[<1306A3130FA3EB1780A2EB37C01323A2EB43E01341A2EB80F0A3 38010078A2EBFFF83802003CA3487FA2000C131F80001E5BB4EBFFF0>28 29 127 156 62 65 D[25 28 127 155 58 I[<90381F8080EBE0613801801938070007000E13035A14015A00781300A2127000F014 00A8007014801278A212386CEB0100A26C13026C5B380180083800E030EB1FC0>25 30 126 156 60 I[27 28 126 155 64 I[24 28 126 155 56 I[22 28 126 155 54 I[<90381F8080EBE0613801801938 070007000E13035A14015A00781300A2127000F01400A6ECFFF0EC0F80007013071278A2 12387EA27E6C130B380180113800E06090381F8000>28 30 126 156 66 I[<39FFF0FFF0390F000F00AC90B5FCEB000FAD39FFF0FFF0>28 28 127 155 62 I[12 28 127 155 30 I[<3807FF8038007C00133CB3127012F8A21338EA7078EA4070EA30E0EA0F80>17 29 127 155 42 I[<39FFF01FE0390F000780EC060014045C5C5C5C5C49C7FC13021306 130FEB17801327EB43C0EB81E013016D7E1478A280143E141E80158015C039FFF03FF0> 28 28 127 155 64 I[21 28 126 155 52 I[33 28 126 155 76 I[28 28 127 155 62 I[27 30 126 156 64 I[23 28 126 155 56 I[27 37 126 156 64 I[28 29 126 155 62 I[<3807E080EA1C19EA30051303EA600112E01300A36C13007E127CEA 7FC0EA3FF8EA1FFEEA07FFC61380130FEB07C0130313011280A300C01380A238E00300EA D002EACC0CEA83F8>18 30 126 156 46 I[<007FB512C038700F010060130000401440 A200C014201280A300001400B1497E3803FFFC>27 28 127 155 60 I[<39FFF01FF0390F000380EC0100B3A26C1302138000035BEA01C03800E018EB7060 EB0F80>28 29 127 155 62 I[<39FFE00FF0391F0003C0EC01806C1400A238078002A2 13C000035BA2EBE00C00011308A26C6C5AA213F8EB7820A26D5AA36D5AA2131F6DC7FCA2 1306A3>28 29 127 155 62 I[<3AFFE1FFC0FF3A1F003E003C001E013C13186C6D1310 A32607801F1320A33A03C0278040A33A01E043C080A33A00F081E100A39038F900F30179 13F2A2017E137E013E137CA2013C133C011C1338A20118131801081310>40 29 127 155 86 I[<39FFF07FC0390FC01E003807800CEBC00800035B6C6C5A13F00000 5BEB7880137C013DC7FC133E7F7F80A2EB13C0EB23E01321EB40F0497E14783801007C00 027F141E0006131F001F148039FF807FF0>28 28 127 155 62 I[<39FFF003FC390F80 01E00007EB00C06D13800003EB01006D5A000113026C6C5A13F8EB7808EB7C18EB3C10EB 3E20131F6D5A14C06D5AABEB7FF8>30 28 128 155 62 I[<387FFFF0EA7C01007013E0 386003C0A238400780130F1400131E12005B137C13785BA2485A1203EBC010EA0780A2EA 0F00481330001E13205A14604813E0EAF803B5FC>20 28 126 155 50 I[<12FEA212C0B3B312FEA2>7 41 124 158 24 I[13 12 122 156 42 I[<12FEA21206B3B312FE A2>7 41 128 158 24 I[<12E0A4>3 4 124 156 24 95 D[18 18 126 145 42 97 D[<12FC121CAA137CEA1D87381E0180381C00C014E014601470A614 6014E014C0381E018038190700EA10FC>20 29 127 156 46 I[15 18 127 145 36 I[20 29 127 156 46 I[15 18 127 145 36 I[<13F8EA018CEA071E1206EA0E0C1300A6EAFFE0EA0E00B0EA7FE0> 15 29 128 156 26 I[18 28 127 146 42 I[<12FC121CAA137C1387EA1D03001E 1380121CAD38FF9FF0>20 29 127 156 46 I[<1218123CA21218C7FCA712FC121CB0EA FF80>9 29 127 156 24 I[<13C0EA01E0A2EA00C01300A7EA07E01200B3A21260EAF0C0 12F1EA6180EA3E00>11 37 131 156 26 I[<12FC121CAAEB0FE0EB0780EB06005B1310 5B5B13E0121DEA1E70EA1C781338133C131C7F130F148038FF9FE0>19 29 127 156 44 I[<12FC121CB3A9EAFF80>9 29 127 156 24 I[<39FC7E07E0391C83 8838391D019018001EEBE01C001C13C0AD3AFF8FF8FF80>33 18 127 145 72 I[20 18 127 145 46 I[18 18 127 145 42 I[ 20 26 127 145 46 I[<3803E080EA0E19EA1805EA3807EA7003A212E0A61270A2EA3807 1218EA0E1BEA03E3EA0003A7EB1FF0>20 26 127 145 44 I[13 18 127 145 32 I[13 18 127 145 32 I[<1204A4120CA2121C123CEAFFE0EA1C00A91310A5120CEA0E20EA03 C0>12 26 127 153 32 I[<38FC1F80EA1C03AD1307120CEA0E1B3803E3F0>20 18 127 145 46 I[<38FF07E0383C0380381C0100A2EA0E02A2EA0F06EA0704A2EA0388 A213C8EA01D0A2EA00E0A31340>19 18 127 145 44 I[<39FF3FC7E0393C0703C0001C EB01801500130B000E1382A21311000713C4A213203803A0E8A2EBC06800011370A2EB80 3000001320>27 18 127 145 60 I[<38FF0FE0381E0700EA1C06EA0E046C5AEA039013 B0EA01E012007F12011338EA021C1204EA0C0E487E003C138038FE1FF0>20 18 127 145 44 I[<38FF07E0383C0380381C0100A2EA0E02A2EA0F06EA0704A2EA0388 A213C8EA01D0A2EA00E0A31340A25BA212F000F1C7FC12F312661238>19 26 127 145 44 I[14 18 127 145 36 I[20 1 128 139 42 I[41 1 128 139 84 I E /Fv 43 122 600 300 dfs[25 29 128 156 54 12 D[<903801C070A349485AA490380701C0A490380E0380B71280A27E26001C07C7FCEB38 0EA5495A007FB61280B7FCA22600E038C7FC48485AA448485AA4380701C0A3>33 37 125 156 80 35 D[<13201340EA0180120313001206120E5AA2123C1238A21278A312 F85AA97E1278A31238A2123C121CA27E12067E13801201EA00401320>11 41 124 158 38 40 D[<7E12401230123812187E120E7EA213801203A213C0A313E01201 A9120313C0A31380A212071300A2120E120C5A1238123012405A>11 41 125 158 38 I[<127812FCA41278>6 6 125 133 26 46 D[19 27 126 154 48 48 D[<1360EA01E0120F12FF12F31203B3A2387FFF80A2> 17 27 125 154 48 I[19 27 126 154 48 I[19 27 126 154 48 I[21 27 127 154 48 I[<38380180383FFF005B5B5B13C00030C7FCA4EA31F8EA361E38380F 80EA3007000013C014E0A3127812F8A214C012F038600F8038381F00EA1FFEEA07F0>19 27 126 154 48 I[<137EEA03FF38078180380F03C0EA1E07123C387C03800078C7FCA2 12F813F8EAFB0E38FA0780EAFC0314C000F813E0A41278A214C0123CEB0780381E0F00EA 07FEEA03F8>19 27 126 154 48 I[<1260387FFFE0A214C01480A238E00300EAC0065B 5BC65AA25B13E0A212015B1203A41207A66C5A>19 28 125 155 48 I[19 27 126 154 48 I[19 27 126 154 48 I[31 28 126 155 72 65 D[25 28 126 155 60 70 D[24 28 126 155 58 76 D[40 28 126 155 90 I[<39FFE003FFA2390FF000307FEA0DFCEA0C FE137E7FEB1F8014C0EB0FE0EB07F01303EB01F814FCEB00FE147F143FEC1FB015F0140F 1407140314011400A2D8FFC013701530>32 28 126 155 74 I[<007FB512E0A238781F 81007013800060146000E0147000C01430A400001400B03807FFFEA2>28 28 126 155 66 84 D[<39FFFC03FFA2390FC00030B3120715606C6C13E03901F001C039 00FC078090387FFE00EB0FF8>32 28 126 155 74 I[21 18 127 145 46 97 D[23 29 127 156 54 I[17 18 126 145 42 I[23 29 126 156 54 I[19 18 127 145 44 I[<137F3801E3803803C7C0EA0787120FEB8380EB8000A5EAFFF8A2EA 0F80AEEA7FF0A2>18 29 128 156 30 I[<3803F0F0380E1F38EA3C0F38380730007813 80A400381300EA3C0FEA1E1CEA33F00030C7FCA3EA3FFF14C06C13E014F0387801F838F0 0078A300701370007813F0381E03C03807FF00>21 27 127 145 48 I[24 29 127 156 54 I[<121E123FA4121EC7FCA6127FA2121FAEEAFFC0A2>10 30 127 157 28 I[11 29 127 156 28 108 D[<39FF0FC07E903831E18F3A1F40F20780D980FC13C0A2EB00F8AB3AFFE7FF3F F8A2>37 18 127 145 80 I[<38FF0FC0EB31E0381F40F0EB80F8A21300AB38FFE7FFA2> 24 18 127 145 54 I[21 18 127 145 48 I[<38FF3F80EBE1E0381F80F0EB0078147C143C143EA6143C147C1478EB80F0EBC1E0 EB3F0090C7FCA6EAFFE0A2>23 26 127 145 54 I[17 18 127 145 40 114 D[14 18 126 145 38 I[<1203A45AA25AA2EA3FFC12FFEA1F00A9130CA4EA0F08EA0798EA03 F0>14 26 127 153 38 I[<38FF07F8A2EA1F00AC1301120F380786FFEA01F8>24 18 127 145 54 I[<38FFC1FCA2381F00601380000F13C0A23807C180A23803E300A213 F7EA01F613FE6C5AA21378A21330>22 18 127 145 50 I[<39FF8FF8FEA2391F03E030 A3390F87F06013869038C6F8E03907CC78C0A23903FC7D80EBF83D143F3901F01F00A200 00131EEBE00EA2>31 18 127 145 68 I[<38FFC1FCA2381F00601380000F13C0A23807 C180A23803E300A213F7EA01F613FE6C5AA21378A21330A25B1270EAF8E05BEAF9800073 C7FC123E>22 26 127 145 50 121 D E /Fw 17 118 720 300 dfs[<13181378EA01F812FFA21201B3A7387FFFE0A2>19 32 124 159 67 49 D[<1470A214F8A3497EA2497EA3EB067FA2010C7F143FA2496C7EA201307F 140F01707FEB6007A201C07F90B5FC4880EB8001A2D803007F14004880000680A23AFFE0 07FFF8A2>37 34 126 161 101 65 D[33 34 125 161 96 67 D[30 34 126 161 84 70 D[48 34 126 161 127 77 D[39 34 126 161 101 82 D[24 22 126 149 65 97 D[21 22 126 149 60 99 D[<13FE3807FF80380F87C0381E01E0003E13F0EA7C0014F812FCA2 B5FCA200FCC7FCA3127CA2127E003E13186C1330380FC0703803FFC0C61300>21 22 126 149 62 101 D[20 35 128 162 41 I[<121C123E127FA3123E121CC7FCA7 B4FCA2121FB2EAFFE0A2>11 36 126 163 38 105 D[<38FF07E0EB1FF8381F307CEB40 3CEB803EA21300AE39FFE1FFC0A2>26 22 126 149 74 110 D[<13FE3807FFC0380F83 E0381E00F0003E13F848137CA300FC137EA7007C137CA26C13F8381F01F0380F83E03807 FFC03800FE00>23 22 126 149 67 I[19 22 126 149 55 114 D[17 22 126 149 53 I[<487EA41203A21207A2120F123FB5FCA2 EA0F80ABEB8180A5EB8300EA07C3EA03FEEA00F8>17 32 127 159 53 I[<38FF01FEA2381F003EAF147E14FE380F81BE3907FF3FC0EA01FC>26 22 126 149 74 I E /Fx 8 119 600 300 dfs[<127012F8A31270>5 5 124 132 28 58 D[<90B512C090380F0078151C81011E130F811680A249EB0F00A315 1E495B5D15E0EC0380D9FFFCC7FCEBF0076E7E8148486C7EA44848485AA44848485A1680 A29138038100120F39FFF801C6C81278>33 35 125 161 74 82 D[<137EEA038138070080120E5A5A38780100EA7006EAFFF800F0C7FCA25AA41480A238 700300EA3004EA1838EA0FC0>17 21 125 148 46 101 D[<13E0A21201EA00C01300A9 121E1223EA4380A21283EA8700A21207120EA35AA3EA38201340127013801230EA310012 1E>11 34 126 161 34 105 D[<383C07C038461860384720303887403813801300A200 0E1370A44813E0A2EB01C014C1003813C2EB03821484130100701388383000F0>24 21 126 148 58 110 D[<133EEBC180380380C0380700E0120E4813F0123CA25AA338F0 01E0A214C0130300701380EB07001306EA381C6C5AEA07E0>20 21 126 148 46 I[<137E138138030080EA0201EA0603140090C7FC120713F0EA03FC6CB4FC EA003FEB07801303127000F01300A2EAE002EA4004EA3018EA0FE0>17 21 126 148 46 115 D[<001E13E0EA2301384381F01380008313701430EA8700000713 20120EA3481340A21480A2EB0100A21302EA0C04EA0618EA03E0>20 21 126 148 48 118 D E /Fy 1 4 600 300 dfs[<1202A3EAC218EAF278EA3AE0EA0F 80A2EA3AE0EAF278EAC218EA0200A3>13 14 126 142 36 3 D E /Fz 43 122 600 300 dfs[13 2 128 139 32 45 D[<127012F8A31270>5 5 124 132 28 I[19 34 126 160 48 48 D[<13801203120F12F31203B3A9EA07C0EAFFFE>15 33 124 160 48 I[19 33 126 160 48 I[19 34 126 160 48 I[<1303A25BA25B1317A2132713671347138712011307120212061204 1208A212101220A2124012C0B512F838000700A7EB0F80EB7FF0>21 33 127 160 48 I[<137EEA01C138030080380601C0EA0C03121C381801800038C7FCA2 12781270A2EAF0F8EAF30CEAF4067F00F81380EB01C012F014E0A51270A3003813C0A238 180380001C1300EA0C06EA070CEA01F0>19 34 126 160 48 54 D[<12401260387FFFE014C0A23840008038C0010012801302A2485A5BA25B5BA2136013 4013C0A21201A25B1203A41207A76CC7FC>19 35 125 161 48 I[19 34 126 160 48 57 D[<127012F8A312701200AB127012F8A31270>5 21 124 148 28 I[<497EA3497EA3EB05E0A2EB09F01308A2EB1078A3497EA3497EA2EB C01F497EA248B51280EB0007A20002EB03C0A348EB01E0A348EB00F0121C003EEB01F839 FF800FFF>32 35 126 162 74 65 D[<903807E0109038381830EBE0063901C001703903 8000F048C7FC000E1470121E001C1430123CA2007C14101278A200F81400A81278151012 7C123CA2001C1420121E000E14407E6C6C13803901C001003800E002EB381CEB07E0>28 36 125 162 70 67 D[31 34 126 161 74 I[29 34 126 161 66 I[27 34 126 161 64 I[<39FFFC3FFF390FC003F039078001E0AE90B5FCEB8001AF390FC003F039FFFC 3FFF>32 34 126 161 74 72 D[40 34 126 161 90 77 D[<39FF8007FF3907C000F81570D805E01320EA04F0A21378137C133C7F131F7FEB07 80A2EB03C0EB01E0A2EB00F014F81478143C143E141E140FA2EC07A0EC03E0A21401A214 00000E1460121FD8FFE01320>32 34 126 161 74 I[33 35 126 161 72 82 D[<3803F020380C0C60EA1802383001E0EA70000060136012E0A21420A36C1300A21278 127FEA3FF0EA1FFE6C7E0003138038003FC0EB07E01301EB00F0A214707EA46C1360A26C 13C07E38C8018038C60700EA81FC>20 36 125 162 54 I[<007FB512F8397807807800 60141800401408A300C0140C00801404A400001400B3A3497E3801FFFE>30 34 126 161 70 I[<39FFFC07FF390FC000F86C4813701520B3A5000314407FA2000114 806C7E9038600100EB3006EB1C08EB03F0>32 35 126 161 74 I[<3BFFF03FFC03FE3B 1F8007E000F86C486C48137017206E7ED807801540A24A7E2603C0021480A39039E00478 0100011600A2EC083CD800F01402A2EC101E01785CA2EC200F013C5CA20260138890391E 400790A216D090391F8003F0010F5CA2EC00016D5CA20106130001025C>47 35 127 161 100 87 D[21 21 126 148 48 97 D[18 21 126 148 44 99 D[<14E0130F13011300ABEA01F8EA0704EA0C02EA1C01EA38001278127012F0A7 127012781238EA1801EA0C0238070CF03801F0FE>23 35 126 162 54 I[19 21 127 148 44 I[<133E13E33801C780EA0387130748C7FCA9EAFFF80007C7FCB27FEA7FF0>17 35 128 162 30 I[<120E12FE121E120EABEB1F80EB60C0EB80E0380F0070A2120EAF38 FFE7FF>24 35 127 162 54 104 D[<121C123EA3121CC7FCA8120E127E121E120EB1EA FFC0>10 34 127 161 28 I[<120E12FE121E120EABEB03FCEB01F014C01480EB02005B 5B5B133813F8EA0F1CEA0E1E130E7F1480EB03C0130114E0EB00F014F838FFE3FE>23 35 127 162 52 107 D[<120E12FE121E120EB3ADEAFFE0>11 35 127 162 28 I[<390E1FC07F3AFE60E183803A1E807201C03A0F003C00E0A2000E1338AF 3AFFE3FF8FFE>39 21 127 148 84 I[<380E1F8038FE60C0381E80E0380F0070A2120E AF38FFE7FF>24 21 127 148 54 I[21 21 127 148 48 I[23 31 127 148 54 I[16 21 127 148 38 114 D[14 21 126 148 38 I[<1202A41206A3120E121E123EEAFFFCEA0E00AB1304A6EA07081203 EA01F0>14 31 127 158 38 I[<000E137038FE07F0EA1E00000E1370AD14F0A2380601 70380382783800FC7F>24 21 127 148 54 I[<38FF80FE381E00781430000E1320A26C 1340A2EB80C000031380A23801C100A2EA00E2A31374A21338A31310>23 21 127 148 52 I[<38FF80FE381E00781430000E1320A26C1340A2EB80C000031380A2 3801C100A2EA00E2A31374A21338A31310A25BA35B12F05B12F10043C7FC123C>23 31 127 148 52 121 D E /FA 14 118 600 300 dfs[<127812FCA212FEA2127A1202A5 1204A31208A212101220A21240>7 20 122 177 36 39 D[35 49 125 176 82 76 D[53 49 124 176 122 I[42 50 124 176 100 85 D[<13FE380303C0380C00E00010137080003C133C00 3E131C141EA21208C7FCA3EB0FFEEBFC1EEA03E0EA0F80EA1F00123E123C127C481404A3 143EA21278007C135E6CEB8F08390F0307F03903FC03E0>30 31 125 158 66 97 D[33 50 126 177 74 I[25 31 126 158 58 101 D[<120FEA1F80A4EA0F00C7FCABEA0780127FA2120F1207B3A6EA 0FC0EAFFF8A2>13 48 126 175 36 105 D[14 50 126 177 36 108 D[<260780FEEB1FC03BFF83078060F0903A8C03C180 783B0F9001E2003CD807A013E4DA00F47F01C013F8A2495BB3A2486C486C133F3CFFFC1F FF83FFF0A2>52 31 126 158 112 I[<380780FE39FF83078090388C03C0390F9001E0EA 07A06E7E13C0A25BB3A2486C487E3AFFFC1FFF80A2>33 31 126 158 74 I[<380783E038FF8418EB887CEA0F90EA07A01438EBC000A35BB3487EEAFFFEA2 >22 31 126 158 50 114 D[<3801FC10380E0330381800F048137048133012E01410A3 7E6C1300127EEA3FF06CB4FC6C13C0000313E038003FF0EB01F813006C133CA2141C7EA2 7E14186C1338143000CC136038C301C03880FE00>22 31 126 158 52 I[33 31 126 158 74 117 D E end %%EndProlog %%BeginSetup %%Feature: *Resolution 600dpi TeXDict begin %%EndSetup %%Page: 1 1 1 0 bop 1507 872 a FA(Libmaa)41 b(User's)i(Man)l(ual)1803 1112 y Fz(Ric)m(k)-5 b(ard)31 b(E.)h(F)-8 b(aith)2512 1076 y Fy(\003)1445 1229 y Fz(Departmen)m(t)30 b(of)j(Computer)e (Science)1223 1345 y(Univ)m(ersit)m(y)e(of)34 b(North)e(Carolina)i(at)f (Chap)s(el)f(Hill)1948 1539 y(TR96-009)1377 1655 y(DRAFT:)f(W)-8 b(ed)33 b(Ma)m(y)f(21)i(00:49:39)h(1997)1859 1755 y Fx(R)q(ev)t(ision) 25 b Fz(:)i(1)p Fx(:)p Fz(2)515 2237 y Fw(Con)l(ten)l(ts)515 2420 y Fv(1)76 b(F)-8 b(unctions)2704 b(7)639 2519 y Fu(1.1)83 b(General)28 b(Supp)r(ort)72 b(.)41 b(.)f(.)h(.)f(.)h(.)f(.)h (.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.) f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)163 b(7)830 2619 y(1.1.1)92 b Ft(maa)p 1253 2619 26 4 v 31 w(init)34 b Fu(.)41 b(.)g(.)f(.)h(.)f(.) h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h (.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)163 b(7)639 2719 y(1.2)83 b(Argumen)n(t)27 b(List)g(Routines)52 b(.)41 b(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h (.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)163 b(7)830 2818 y(1.2.1)92 b Ft(ar)l(g)p 1213 2818 V 30 w(cr)l(e)l(ate)54 b Fu(.)41 b(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f (.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)163 b(7)830 2918 y(1.2.2)92 b Ft(ar)l(g)p 1213 2918 V 30 w(destr)l(oy)75 b Fu(.)40 b(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f (.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.) h(.)f(.)163 b(7)830 3018 y(1.2.3)92 b Ft(ar)l(g)p 1213 3018 V 30 w(add)75 b Fu(.)41 b(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h (.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.) f(.)h(.)f(.)h(.)f(.)163 b(7)830 3117 y(1.2.4)92 b Ft(ar)l(g)p 1213 3117 V 30 w(addn)29 b Fu(.)41 b(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.) f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h (.)g(.)f(.)h(.)f(.)h(.)f(.)163 b(7)830 3217 y(1.2.5)92 b Ft(ar)l(g)p 1213 3217 V 30 w(gr)l(ow)33 b Fu(.)41 b(.)g(.)f(.)h(.)f (.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.) h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)163 b(7)830 3316 y(1.2.6)92 b Ft(ar)l(g)p 1213 3316 V 30 w(\014nish)72 b Fu(.)41 b(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f (.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)163 b(8)830 3416 y(1.2.7)92 b Ft(ar)l(g)p 1213 3416 V 30 w(get)33 b Fu(.)40 b(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.) h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h (.)f(.)h(.)f(.)163 b(8)830 3516 y(1.2.8)92 b Ft(ar)l(g)p 1213 3516 V 30 w(c)l(ount)72 b Fu(.)41 b(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.) f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h (.)g(.)f(.)h(.)f(.)h(.)f(.)163 b(8)830 3615 y(1.2.9)92 b Ft(ar)l(g)p 1213 3615 V 30 w(get)p 1347 3615 V 30 w(ve)l(ctor)45 b Fu(.)c(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.) h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)163 b(8)830 3715 y(1.2.10)50 b Ft(ar)l(g)p 1213 3715 V 30 w(ar)l(gify)62 b Fu(.)41 b(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h (.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.) f(.)h(.)f(.)163 b(8)639 3815 y(1.3)83 b(Base-26)29 b(Routines)45 b(.)c(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h (.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)163 b(8)639 3914 y(1.4)83 b(Base-64)29 b(Routines)45 b(.)c(.)f(.)h(.)f(.)h (.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.) f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)163 b(8)639 4014 y(1.5)83 b(Bit)28 b(manipulation)21 b(routines)58 b(.)40 b(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f (.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)163 b(9)830 4113 y(1.5.1)92 b Ft(bit)p 1193 4113 V 30 w(set)57 b Fu(.)40 b(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f (.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)163 b(9)830 4213 y(1.5.2)92 b Ft(bit)p 1193 4213 V 30 w(clr)61 b Fu(.)40 b(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h (.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.) f(.)163 b(9)830 4313 y(1.5.3)92 b Ft(bit)p 1193 4313 V 30 w(tst)67 b Fu(.)40 b(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h (.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.) f(.)h(.)f(.)h(.)f(.)163 b(9)830 4412 y(1.5.4)92 b Ft(bit)p 1193 4412 V 30 w(cnt)45 b Fu(.)40 b(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g (.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.) h(.)g(.)f(.)h(.)f(.)h(.)f(.)163 b(9)639 4512 y(1.6)83 b(Debugging)26 b(Supp)r(ort)33 b(.)40 b(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h (.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.) f(.)h(.)f(.)h(.)f(.)163 b(9)830 4612 y(1.6.1)92 b Ft(db)l(g)p 1215 4612 V 31 w(r)l(e)l(gister)62 b Fu(.)40 b(.)h(.)f(.)h(.)f(.)h(.)g (.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.) h(.)g(.)f(.)h(.)f(.)h(.)f(.)163 b(9)p 515 4681 1314 4 v 606 4734 a Fs(\003)642 4758 y Fr(Cra)n(y)16 b(F)-6 b(ello)n(w;)18 b(supp)r(orted)11 b(b)n(y)16 b(ARP)-6 b(A)19 b(via)c(ONR)k(con)n(tract)12 b(N00014-92-C-0182)o(,)g(b)n(y)k (Rome)e(Labs)i(con)n(tract)c(F30602-)515 4837 y(94-C-0037,)j(and)h(b)n (y)i(a)g(Cra)n(y)g(F)-6 b(ello)n(wship)15 b(from)h(Cra)n(y)i(Researc)n (h,)d(Inc.)28 b(and)16 b(NCSC)21 b(\(North)c(Carolina)e(Sup)r(ercomp)o (u)o(tin)o(g)515 4915 y(Cen)n(ter\)..)2136 5255 y Fu(1)p eop %%Page: 2 2 2 1 bop 830 523 a Fu(1.6.2)92 b Ft(db)l(g)p 1215 523 26 4 v 31 w(set)34 b Fu(.)40 b(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f (.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.) g(.)f(.)h(.)f(.)h(.)f(.)122 b(10)830 623 y(1.6.3)92 b Ft(db)l(g)p 1215 623 V 31 w(set)p 1346 623 V 30 w(\015ag)70 b Fu(.)40 b(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h (.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(10)830 722 y(1.6.4)92 b Ft(db)l(g)p 1215 722 V 31 w(unset)p 1436 722 V 32 w(\015ag)42 b Fu(.)f(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h (.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.) f(.)h(.)f(.)122 b(10)830 822 y(1.6.5)92 b Ft(db)l(g)p 1215 822 V 31 w(test)70 b Fu(.)41 b(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f (.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.) g(.)f(.)h(.)f(.)h(.)f(.)122 b(10)830 922 y(1.6.6)92 b Ft(db)l(g)p 1215 922 V 31 w(destr)l(oy)72 b Fu(.)40 b(.)h(.)f(.)h(.)f (.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.) h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(10)639 1021 y(1.7)83 b(Error)29 b(Rep)r(orting)f(Routines)62 b(.)40 b(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f (.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(10)830 1121 y(1.7.1)92 b Ft(err)p 1211 1121 V 29 w(set)p 1340 1121 V 30 w(pr)l(o)l(gr)l(am)p 1662 1121 V 29 w(name)76 b Fu(.)41 b(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f (.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(10)830 1220 y(1.7.2)92 b Ft(err)p 1211 1220 V 29 w(pr)l(o)l(gr)l(am)p 1532 1220 V 29 w(name)77 b Fu(.)40 b(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.) g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f (.)122 b(10)830 1320 y(1.7.3)92 b Ft(err)p 1211 1320 V 29 w(fatal)44 b Fu(.)d(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.) h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h (.)f(.)h(.)f(.)122 b(11)830 1420 y(1.7.4)92 b Ft(err)p 1211 1420 V 29 w(fatal)p 1400 1420 V 29 w(errno)76 b Fu(.)40 b(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h (.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(11)830 1519 y(1.7.5)92 b Ft(err)p 1211 1519 V 29 w(warning)44 b Fu(.)c(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.) f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(11)830 1619 y(1.7.6)92 b Ft(err)p 1211 1619 V 29 w(internal)50 b Fu(.)40 b(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h (.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(11)639 1719 y(1.8)83 b(Flag)26 b(Supp)r(ort)65 b(.)40 b(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f (.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(11)830 1818 y(1.8.1)92 b Ft(\015g)p 1187 1818 V 31 w(r)l(e)l(gister)e Fu(.)40 b(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.) f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f (.)h(.)f(.)122 b(11)830 1918 y(1.8.2)92 b Ft(\015g)p 1187 1918 V 31 w(set)62 b Fu(.)40 b(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g (.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.) h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(11)830 2017 y(1.8.3)92 b Ft(\015g)p 1187 2017 V 31 w(test)34 b Fu(.)40 b(.)h(.)g(.)f(.)h(.)f (.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.) h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(12)830 2117 y(1.8.4)92 b Ft(\015g)p 1187 2117 V 31 w(destr)l(oy)35 b Fu(.)41 b(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f (.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(12)639 2217 y(1.9)83 b(Hash)29 b(T)-7 b(able)27 b(Routines)44 b(.)d(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h (.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(12)830 2316 y(1.9.1)92 b Ft(hsh)p 1219 2316 V 31 w(cr)l(e)l(ate)47 b Fu(.)41 b(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f (.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(12)830 2416 y(1.9.2)92 b Ft(hsh)p 1219 2416 V 31 w(destr)l(oy)68 b Fu(.)40 b(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h (.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(12)830 2516 y(1.9.3)92 b Ft(hsh)p 1219 2516 V 31 w(insert)51 b Fu(.)41 b(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f (.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(14)830 2615 y(1.9.4)92 b Ft(hsh)p 1219 2615 V 31 w(delete)53 b Fu(.)41 b(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f (.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(14)830 2715 y(1.9.5)92 b Ft(hsh)p 1219 2715 V 31 w(r)l(etrieve)50 b Fu(.)40 b(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h (.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(14)830 2814 y(1.9.6)92 b Ft(hsh)p 1219 2814 V 31 w(iter)l(ate)27 b Fu(.)41 b(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f (.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(14)830 2914 y(1.9.7)92 b Ft(hsh)p 1219 2914 V 31 w(iter)l(ate)p 1482 2914 V 29 w(ar)l(g)80 b Fu(.)40 b(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h (.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.) f(.)h(.)f(.)122 b(14)830 3014 y(1.9.8)92 b Ft(hsh)p 1219 3014 V 31 w(get)p 1354 3014 V 31 w(stats)87 b Fu(.)41 b(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g (.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(15)830 3113 y(1.9.9)92 b Ft(hsh)p 1219 3113 V 31 w(print)p 1428 3113 V 30 w(stats)79 b Fu(.)40 b(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h (.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.) f(.)h(.)f(.)122 b(15)830 3213 y(1.9.10)50 b Ft(hsh)p 1219 3213 V 31 w(init)p 1376 3213 V 30 w(p)l(osition)79 b Fu(.)41 b(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g (.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(15)830 3313 y(1.9.11)50 b Ft(hsh)p 1219 3313 V 31 w(next)p 1400 3313 V 32 w(p)l(osition)j Fu(.)41 b(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.) f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f (.)h(.)f(.)122 b(16)830 3412 y(1.9.12)50 b Ft(hsh)p 1219 3412 V 31 w(get)p 1354 3412 V 31 w(p)l(osition)36 b Fu(.)k(.)h(.)f(.)h (.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.) f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(16)830 3512 y(1.9.13)50 b Ft(hsh)p 1219 3512 V 31 w(r)l(e)l(adonly)88 b Fu(.)41 b(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g (.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(16)639 3611 y(1.10)41 b(List)28 b(Routines)57 b(.)40 b(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f (.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(16)830 3711 y(1.10.1)50 b Ft(lst)p 1185 3711 V 29 w(cr)l(e)l(ate)83 b Fu(.)41 b(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f (.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(16)830 3811 y(1.10.2)50 b Ft(lst)p 1185 3811 V 29 w(destr)l(oy)39 b Fu(.)i(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.) h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(16)830 3910 y(1.10.3)50 b Ft(lst)p 1185 3910 V 29 w(app)l(end)d Fu(.)41 b(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f (.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(16)830 4010 y(1.10.4)50 b Ft(lst)p 1185 4010 V 29 w(push)68 b Fu(.)41 b(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g (.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.) 122 b(17)830 4110 y(1.10.5)50 b Ft(lst)p 1185 4110 V 29 w(p)l(op)44 b Fu(.)c(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f (.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.) h(.)f(.)h(.)f(.)122 b(17)830 4209 y(1.10.6)50 b Ft(lst)p 1185 4209 V 29 w(top)k Fu(.)40 b(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.) f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h (.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(17)830 4309 y(1.10.7)50 b Ft(lst)p 1185 4309 V 29 w(nth)p 1330 4309 V 31 w(get)44 b Fu(.)d(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.) h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(17)830 4408 y(1.10.8)50 b Ft(lst)p 1185 4408 V 29 w(nth)p 1330 4408 V 31 w(set)e Fu(.)41 b(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.) f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f (.)h(.)f(.)h(.)f(.)122 b(17)830 4508 y(1.10.9)50 b Ft(lst)p 1185 4508 V 29 w(memb)l(er)78 b Fu(.)40 b(.)h(.)f(.)h(.)f(.)h(.)g(.)f (.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.) g(.)f(.)h(.)f(.)h(.)f(.)122 b(17)830 4608 y(1.10.10)8 b Ft(lst)p 1185 4608 V 29 w(length)81 b Fu(.)41 b(.)f(.)h(.)f(.)h(.)f (.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.) h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(17)830 4707 y(1.10.11)8 b Ft(lst)p 1185 4707 V 29 w(trunc)l(ate)64 b Fu(.)40 b(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h (.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(18)830 4807 y(1.10.12)8 b Ft(lst)p 1185 4807 V 29 w(trunc)l(ate)p 1510 4807 V 31 w(p)l(osition)73 b Fu(.)41 b(.)g(.)f(.)h(.)f(.)h(.)f(.)h (.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.) f(.)122 b(18)830 4907 y(1.10.13)8 b Ft(lst)p 1185 4907 V 29 w(iter)l(ate)63 b Fu(.)41 b(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.) f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f (.)h(.)f(.)h(.)f(.)122 b(18)830 5006 y(1.10.14)8 b Ft(lst)p 1185 5006 V 29 w(iter)l(ate)p 1446 5006 V 29 w(ar)l(g)51 b Fu(.)41 b(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f (.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(18)2136 5255 y(2)p eop %%Page: 3 3 3 2 bop 830 523 a Fu(1.10.15)8 b Ft(lst)p 1185 523 26 4 v 29 w(init)p 1340 523 V 30 w(p)l(osition)51 b Fu(.)40 b(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f (.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(18)830 623 y(1.10.16)8 b Ft(lst)p 1185 623 V 29 w(last)p 1340 623 V 30 w(p)l(osition)51 b Fu(.)40 b(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h (.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.) f(.)h(.)f(.)122 b(18)830 722 y(1.10.17)8 b Ft(lst)p 1185 722 V 29 w(next)p 1364 722 V 32 w(p)l(osition)89 b Fu(.)41 b(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h (.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(19)830 822 y(1.10.18)8 b Ft(lst)p 1185 822 V 29 w(nth)p 1330 822 V 31 w(p)l(osition)60 b Fu(.)40 b(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h (.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.) f(.)h(.)f(.)122 b(19)830 922 y(1.10.19)8 b Ft(lst)p 1185 922 V 29 w(get)p 1318 922 V 31 w(p)l(osition)72 b Fu(.)40 b(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f (.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(19)830 1021 y(1.10.20)8 b Ft(lst)p 1185 1021 V 29 w(set)p 1314 1021 V 30 w(p)l(osition)77 b Fu(.)40 b(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h (.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.) f(.)h(.)f(.)122 b(19)830 1121 y(1.10.21)p 1101 1121 V 38 w Ft(lst)p 1215 1121 V 30 w(dump)p 1441 1121 V 32 w(no)l(de)66 b Fu(.)40 b(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.) f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(19)639 1220 y(1.11)41 b(Memory)26 b(Managemen)n(t)f(Routines)50 b(.)40 b(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.) f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(19)830 1320 y(1.11.1)50 b Ft(mem)p 1275 1320 V 30 w(cr)l(e)l(ate)p 1517 1320 V 30 w(strings)43 b Fu(.)d(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h (.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(19)830 1420 y(1.11.2)50 b Ft(mem)p 1275 1420 V 30 w(destr)l(oy)p 1561 1420 V 31 w(strings)62 b Fu(.)41 b(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g (.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.) 122 b(20)830 1519 y(1.11.3)50 b Ft(mem)p 1275 1519 V 30 w(str)l(cpy)55 b Fu(.)40 b(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h (.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.) f(.)h(.)f(.)122 b(20)830 1619 y(1.11.4)50 b Ft(mem)p 1275 1619 V 30 w(strncpy)69 b Fu(.)41 b(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f (.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.) h(.)f(.)h(.)f(.)122 b(20)830 1719 y(1.11.5)50 b Ft(mem)p 1275 1719 V 30 w(gr)l(ow)36 b Fu(.)41 b(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f (.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.) g(.)f(.)h(.)f(.)h(.)f(.)122 b(20)830 1818 y(1.11.6)50 b Ft(mem)p 1275 1818 V 30 w(\014nish)75 b Fu(.)40 b(.)h(.)f(.)h(.)f(.)h (.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.) f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(20)830 1918 y(1.11.7)50 b Ft(mem)p 1275 1918 V 30 w(get)p 1409 1918 V 31 w(string)p 1648 1918 V 29 w(stats)j Fu(.)41 b(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f (.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(20)830 2017 y(1.11.8)50 b Ft(mem)p 1275 2017 V 30 w(print)p 1483 2017 V 30 w(string)p 1721 2017 V 30 w(stats)44 b Fu(.)d(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h (.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(20)830 2117 y(1.11.9)50 b Ft(mem)p 1275 2117 V 30 w(cr)l(e)l(ate)p 1517 2117 V 30 w(obje)l(cts)45 b Fu(.)40 b(.)h(.)g(.)f(.)h(.)f(.)h(.)f (.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.) h(.)f(.)122 b(21)830 2217 y(1.11.10)8 b Ft(mem)p 1275 2217 V 30 w(destr)l(oy)p 1561 2217 V 31 w(obje)l(cts)64 b Fu(.)41 b(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h (.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(21)830 2316 y(1.11.11)8 b Ft(mem)p 1275 2316 V 30 w(get)p 1409 2316 V 31 w(obje)l(ct)57 b Fu(.)40 b(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.) f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f (.)h(.)f(.)122 b(21)830 2416 y(1.11.12)8 b Ft(mem)p 1275 2416 V 30 w(get)p 1409 2416 V 31 w(empty)p 1656 2416 V 31 w(obje)l(ct)68 b Fu(.)41 b(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f (.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(21)830 2516 y(1.11.13)8 b Ft(mem)p 1275 2516 V 30 w(fr)l(e)l(e)p 1435 2516 V 29 w(obje)l(ct)33 b Fu(.)40 b(.)h(.)f(.)h(.)g(.)f(.)h(.)f (.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.) h(.)f(.)h(.)f(.)122 b(21)830 2615 y(1.11.14)8 b Ft(mem)p 1275 2615 V 30 w(get)p 1409 2615 V 31 w(obje)l(ct)p 1646 2615 V 30 w(stats)54 b Fu(.)41 b(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.) h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(22)830 2715 y(1.11.15)8 b Ft(mem)p 1275 2715 V 30 w(print)p 1483 2715 V 30 w(obje)l(ct)p 1719 2715 V 30 w(stats)46 b Fu(.)41 b(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f (.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(22)639 2814 y(1.12)41 b(P)n(arsing)28 b(\(and)f(Lexing\))h(Supp)r(ort)37 b(.)k(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h (.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(22)830 2914 y(1.12.1)50 b Ft(prs)p 1213 2914 V 30 w(set)p 1343 2914 V 30 w(debug)65 b Fu(.)41 b(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h (.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.) f(.)122 b(22)830 3014 y(1.12.2)50 b Ft(prs)p 1213 3014 V 30 w(set)p 1343 3014 V 30 w(cpp)p 1495 3014 V 32 w(options)45 b Fu(.)40 b(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f (.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(22)830 3113 y(1.12.3)50 b Ft(prs)p 1213 3113 V 30 w(\014le)31 b Fu(.)40 b(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h (.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.) f(.)122 b(22)830 3213 y(1.12.4)50 b Ft(prs)p 1213 3213 V 30 w(\014le)p 1349 3213 V 30 w(no)l(cpp)j Fu(.)41 b(.)f(.)h(.)f(.)h (.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.) f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(23)830 3313 y(1.12.5)50 b Ft(prs)p 1213 3313 V 30 w(str)l(e)l(am)28 b Fu(.)41 b(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f (.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(23)830 3412 y(1.12.6)50 b Ft(prs)p 1213 3412 V 30 w(make)p 1429 3412 V 31 w(inte)l(ger)61 b Fu(.)41 b(.)f(.)h(.)g(.)f(.)h(.)f(.)h (.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.) f(.)h(.)f(.)122 b(23)830 3512 y(1.12.7)50 b Ft(prs)p 1213 3512 V 30 w(make)p 1429 3512 V 31 w(double)81 b Fu(.)41 b(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g (.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(23)639 3611 y(1.13)41 b(Pro)r(cess)32 b(Managemen)n(t)26 b(Routines)77 b(.)40 b(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f (.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(23)639 3711 y(1.14)41 b(Prime)26 b(Num)n(b)r(er)h(Routines)45 b(.)c(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f (.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(23)830 3811 y(1.14.1)50 b Ft(prm)p 1247 3811 V 30 w(is)p 1337 3811 V 30 w(prime)61 b Fu(.)41 b(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.) f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f (.)h(.)f(.)122 b(23)830 3910 y(1.14.2)50 b Ft(prm)p 1247 3910 V 30 w(next)p 1427 3910 V 31 w(prime)35 b Fu(.)40 b(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f (.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(24)639 4010 y(1.15)41 b(Set)29 b(Routines)82 b(.)40 b(.)h(.)g(.)f(.)h(.)f(.)h (.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.) f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(24)830 4110 y(1.15.1)50 b Ft(set)p 1201 4110 V 30 w(cr)l(e)l(ate)66 b Fu(.)41 b(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f (.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(24)830 4209 y(1.15.2)50 b Ft(set)p 1201 4209 V 30 w(destr)l(oy)87 b Fu(.)40 b(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h (.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(24)830 4309 y(1.15.3)50 b Ft(set)p 1201 4309 V 30 w(insert)70 b Fu(.)41 b(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f (.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(25)830 4408 y(1.15.4)50 b Ft(set)p 1201 4408 V 30 w(delete)72 b Fu(.)41 b(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f (.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(25)830 4508 y(1.15.5)50 b Ft(set)p 1201 4508 V 30 w(memb)l(er)61 b Fu(.)40 b(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h (.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(25)830 4608 y(1.15.6)50 b Ft(set)p 1201 4608 V 30 w(iter)l(ate)c Fu(.)41 b(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f (.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(25)830 4707 y(1.15.7)50 b Ft(set)p 1201 4707 V 30 w(iter)l(ate)p 1463 4707 V 29 w(ar)l(g)34 b Fu(.)41 b(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f (.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.) h(.)f(.)h(.)f(.)122 b(25)830 4807 y(1.15.8)50 b Ft(set)p 1201 4807 V 30 w(init)p 1357 4807 V 30 w(p)l(osition)34 b Fu(.)40 b(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h (.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(25)830 4907 y(1.15.9)50 b Ft(set)p 1201 4907 V 30 w(next)p 1381 4907 V 32 w(p)l(osition)72 b Fu(.)41 b(.)f(.)h(.)g(.)f(.)h(.)f(.)h (.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.) f(.)h(.)f(.)122 b(26)830 5006 y(1.15.10)8 b Ft(set)p 1201 5006 V 30 w(get)p 1335 5006 V 31 w(p)l(osition)55 b Fu(.)40 b(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h (.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(26)2136 5255 y(3)p eop %%Page: 4 4 4 3 bop 830 523 a Fu(1.15.11)8 b Ft(set)p 1201 523 26 4 v 30 w(r)l(e)l(adonly)43 b Fu(.)d(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f (.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.) h(.)f(.)h(.)f(.)122 b(26)830 623 y(1.15.12)8 b Ft(set)p 1201 623 V 30 w(union)74 b Fu(.)41 b(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.) h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g (.)f(.)h(.)f(.)h(.)f(.)122 b(26)830 722 y(1.15.13)8 b Ft(set)p 1201 722 V 30 w(inter)39 b Fu(.)i(.)g(.)f(.)h(.)f(.)h(.)f(.)h (.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.) f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(26)830 822 y(1.15.14)8 b Ft(set)p 1201 822 V 30 w(di\013)95 b Fu(.)41 b(.)g(.)f(.)h(.)f(.)h(.) f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f (.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(26)830 922 y(1.15.15)8 b Ft(set)p 1201 922 V 30 w(e)l(qual)33 b Fu(.)41 b(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g (.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.) 122 b(27)830 1021 y(1.15.16)8 b Ft(set)p 1201 1021 V 30 w(get)p 1335 1021 V 31 w(stats)42 b Fu(.)e(.)h(.)f(.)h(.)f(.)h(.)g (.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.) h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(27)830 1121 y(1.15.17)8 b Ft(set)p 1201 1121 V 30 w(print)p 1409 1121 V 30 w(stats)33 b Fu(.)41 b(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f (.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(27)639 1220 y(1.16)41 b(Skip)27 b(List)h(Routines)64 b(.)40 b(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.) f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(27)830 1320 y(1.16.1)50 b Ft(sl)p 1157 1320 V 30 w(cr)l(e)l(ate)45 b Fu(.)c(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.) f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(28)830 1420 y(1.16.2)50 b Ft(sl)p 1157 1420 V 30 w(destr)l(oy)66 b Fu(.)41 b(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f (.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(28)830 1519 y(1.16.3)p 1101 1519 V 80 w Ft(sl)p 1187 1519 V 30 w(shutdown)87 b Fu(.)41 b(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h (.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.) f(.)h(.)f(.)122 b(28)830 1619 y(1.16.4)50 b Ft(sl)p 1157 1619 V 30 w(insert)f Fu(.)41 b(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h (.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.) f(.)h(.)f(.)h(.)f(.)122 b(28)830 1719 y(1.16.5)50 b Ft(sl)p 1157 1719 V 30 w(delete)h Fu(.)41 b(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f (.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.) g(.)f(.)h(.)f(.)h(.)f(.)122 b(28)830 1818 y(1.16.6)50 b Ft(sl)p 1157 1818 V 30 w(\014nd)59 b Fu(.)40 b(.)h(.)g(.)f(.)h(.)f(.) h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h (.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(29)830 1918 y(1.16.7)50 b Ft(sl)p 1157 1918 V 30 w(iter)l(ate)25 b Fu(.)41 b(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g (.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.) 122 b(29)830 2017 y(1.16.8)50 b Ft(sl)p 1157 2017 V 30 w(iter)l(ate)p 1419 2017 V 28 w(ar)l(g)79 b Fu(.)41 b(.)f(.)h(.)f(.)h (.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.) f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(29)830 2117 y(1.16.9)p 1101 2117 V 80 w Ft(sl)p 1187 2117 V 30 w(dump)31 b Fu(.)41 b(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h (.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(29)639 2217 y(1.17)41 b(Source)30 b(Co)r(de)e(Managemen)n(t)47 b(.)40 b(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.) h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(29)830 2316 y(1.17.1)50 b Ft(sr)l(c)p 1205 2316 V 29 w(cr)l(e)l(ate)63 b Fu(.)41 b(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f (.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(29)830 2416 y(1.17.2)50 b Ft(sr)l(c)p 1205 2416 V 29 w(destr)l(oy)84 b Fu(.)40 b(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f (.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.) h(.)f(.)122 b(29)830 2516 y(1.17.3)50 b Ft(sr)l(c)p 1205 2516 V 29 w(line)78 b Fu(.)41 b(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h (.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.) f(.)h(.)f(.)h(.)f(.)122 b(30)830 2615 y(1.17.4)50 b Ft(sr)l(c)p 1205 2615 V 29 w(new)p 1374 2615 V 31 w(\014le)63 b Fu(.)40 b(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h (.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(30)830 2715 y(1.17.5)50 b Ft(sr)l(c)p 1205 2715 V 29 w(new)p 1374 2715 V 31 w(line)37 b Fu(.)j(.)h(.)f(.)h(.)f(.)h(.)g(.)f (.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.) g(.)f(.)h(.)f(.)h(.)f(.)122 b(30)830 2814 y(1.17.6)50 b Ft(sr)l(c)p 1205 2814 V 29 w(advanc)l(e)58 b Fu(.)40 b(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h (.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(30)830 2914 y(1.17.7)50 b Ft(sr)l(c)p 1205 2914 V 29 w(get)42 b Fu(.)e(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h (.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.) f(.)h(.)f(.)122 b(30)830 3014 y(1.17.8)50 b Ft(sr)l(c)p 1205 3014 V 29 w(\014lename)40 b Fu(.)g(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h (.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.) f(.)h(.)f(.)h(.)f(.)122 b(30)830 3113 y(1.17.9)50 b Ft(sr)l(c)p 1205 3113 V 29 w(linenumb)l(er)71 b Fu(.)40 b(.)h(.)f(.)h(.)g(.)f(.)h (.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.) f(.)h(.)f(.)h(.)f(.)122 b(30)830 3213 y(1.17.10)8 b Ft(sr)l(c)p 1205 3213 V 29 w(o\013set)83 b Fu(.)41 b(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.) f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h (.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(30)830 3313 y(1.17.11)8 b Ft(sr)l(c)p 1205 3313 V 29 w(length)61 b Fu(.)41 b(.)f(.)h(.)f(.)h(.) f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f (.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(31)830 3412 y(1.17.12)8 b Ft(sr)l(c)p 1205 3412 V 29 w(sour)l(c)l(e)p 1458 3412 V 31 w(line)82 b Fu(.)40 b(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.) f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f (.)h(.)f(.)122 b(31)830 3512 y(1.17.13)8 b Ft(sr)l(c)p 1205 3512 V 29 w(get)p 1338 3512 V 31 w(stats)39 b Fu(.)h(.)h(.)f(.)h (.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.) f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(31)830 3611 y(1.17.14)8 b Ft(sr)l(c)p 1205 3611 V 29 w(print)p 1412 3611 V 30 w(stats)30 b Fu(.)41 b(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f (.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.) h(.)f(.)h(.)f(.)122 b(31)830 3711 y(1.17.15)8 b Ft(sr)l(c)p 1205 3711 V 29 w(print)p 1412 3711 V 30 w(line)64 b Fu(.)41 b(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g (.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(31)830 3811 y(1.17.16)8 b Ft(sr)l(c)p 1205 3811 V 29 w(p)l(arse)p 1422 3811 V 31 w(err)l(or)66 b Fu(.)40 b(.)h(.)f(.)h(.)g (.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.) h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(32)830 3910 y(1.17.17)8 b Ft(sr)l(c)p 1205 3910 V 29 w(print)p 1412 3910 V 30 w(err)l(or)77 b Fu(.)40 b(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g (.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.) 122 b(32)830 4010 y(1.17.18)8 b Ft(sr)l(c)p 1205 4010 V 29 w(print)p 1412 4010 V 30 w(message)33 b Fu(.)41 b(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h (.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(32)639 4110 y(1.18)41 b(Stac)n(k)28 b(Routines)63 b(.)41 b(.)g(.)f(.)h(.)f(.)h (.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.) f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(32)830 4209 y(1.18.1)50 b Ft(stk)p 1201 4209 V 30 w(cr)l(e)l(ate)66 b Fu(.)41 b(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f (.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(32)830 4309 y(1.18.2)50 b Ft(stk)p 1201 4309 V 30 w(destr)l(oy)87 b Fu(.)40 b(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h (.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(32)830 4408 y(1.18.3)50 b Ft(stk)p 1201 4408 V 30 w(push)h Fu(.)41 b(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g (.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.) 122 b(32)830 4508 y(1.18.4)50 b Ft(stk)p 1201 4508 V 30 w(p)l(op)91 b Fu(.)41 b(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f (.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.) h(.)f(.)h(.)f(.)122 b(33)830 4608 y(1.18.5)50 b Ft(stk)p 1201 4608 V 30 w(top)37 b Fu(.)j(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.) f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h (.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(33)639 4707 y(1.19)41 b(String)28 b(P)n(o)r(ol)e(Routines)43 b(.)e(.)f(.)h(.)f(.)h(.)g(.)f(.) h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g (.)f(.)h(.)f(.)h(.)f(.)122 b(33)830 4807 y(1.19.1)50 b Ft(str)p 1199 4807 V 29 w(p)l(o)l(ol)p 1368 4807 V 31 w(cr)l(e)l(ate)27 b Fu(.)41 b(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.) f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f (.)h(.)f(.)122 b(33)830 4907 y(1.19.2)50 b Ft(str)p 1199 4907 V 29 w(p)l(o)l(ol)p 1368 4907 V 31 w(destr)l(oy)e Fu(.)40 b(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h (.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(33)830 5006 y(1.19.3)50 b Ft(str)p 1199 5006 V 29 w(p)l(o)l(ol)p 1368 5006 V 31 w(exists)41 b Fu(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h (.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.) f(.)h(.)f(.)122 b(33)2136 5255 y(4)p eop %%Page: 5 5 5 4 bop 830 523 a Fu(1.19.4)50 b Ft(str)p 1199 523 26 4 v 29 w(p)l(o)l(ol)p 1368 523 V 31 w(\014nd)41 b Fu(.)f(.)h(.)f(.)h(.) f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f (.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(33)830 623 y(1.19.5)50 b Ft(str)p 1199 623 V 29 w(p)l(o)l(ol)p 1368 623 V 31 w(c)l(opy)81 b Fu(.)41 b(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h (.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.) f(.)h(.)f(.)122 b(34)830 722 y(1.19.6)50 b Ft(str)p 1199 722 V 29 w(p)l(o)l(ol)p 1368 722 V 31 w(c)l(opyn)35 b Fu(.)41 b(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f (.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(34)830 822 y(1.19.7)50 b Ft(str)p 1199 822 V 29 w(p)l(o)l(ol)p 1368 822 V 31 w(gr)l(ow)71 b Fu(.)41 b(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f (.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.) h(.)f(.)h(.)f(.)122 b(34)830 922 y(1.19.8)50 b Ft(str)p 1199 922 V 29 w(p)l(o)l(ol)p 1368 922 V 31 w(\014nish)45 b Fu(.)c(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.) h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(34)830 1021 y(1.19.9)50 b Ft(str)p 1199 1021 V 29 w(p)l(o)l(ol)p 1368 1021 V 31 w(get)p 1503 1021 V 30 w(stats)68 b Fu(.)41 b(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h (.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(34)830 1121 y(1.19.10)8 b Ft(str)p 1199 1121 V 29 w(p)l(o)l(ol)p 1368 1121 V 31 w(print)p 1577 1121 V 29 w(stats)60 b Fu(.)40 b(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f (.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(34)830 1220 y(1.19.11)8 b Ft(str)p 1199 1220 V 29 w(exists)83 b Fu(.)41 b(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f (.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(35)830 1320 y(1.19.12)8 b Ft(str)p 1199 1320 V 29 w(\014nd)82 b Fu(.)41 b(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g (.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.) 122 b(35)830 1420 y(1.19.13)8 b Ft(str)p 1199 1420 V 29 w(\014ndn)36 b Fu(.)41 b(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f (.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.) h(.)f(.)h(.)f(.)122 b(35)830 1519 y(1.19.14)8 b Ft(str)p 1199 1519 V 29 w(c)l(opy)58 b Fu(.)41 b(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g (.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.) h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(35)830 1619 y(1.19.15)8 b Ft(str)p 1199 1619 V 29 w(c)l(opyn)77 b Fu(.)41 b(.)f(.)h(.)f(.)h(.)f (.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.) h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(35)830 1719 y(1.19.16)8 b Ft(str)p 1199 1719 V 29 w(gr)l(ow)48 b Fu(.)41 b(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g (.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.) 122 b(36)830 1818 y(1.19.17)8 b Ft(str)p 1199 1818 V 29 w(\014nish)87 b Fu(.)41 b(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.) h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h (.)f(.)h(.)f(.)122 b(36)830 1918 y(1.19.18)8 b Ft(str)p 1199 1918 V 29 w(unique)45 b Fu(.)c(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h (.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.) f(.)h(.)f(.)h(.)f(.)122 b(36)830 2017 y(1.19.19)8 b Ft(str)p 1199 2017 V 29 w(destr)l(oy)90 b Fu(.)40 b(.)h(.)f(.)h(.)f(.)h(.)g(.)f (.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.) g(.)f(.)h(.)f(.)h(.)f(.)122 b(36)830 2117 y(1.19.20)8 b Ft(str)p 1199 2117 V 29 w(get)p 1332 2117 V 30 w(stats)46 b Fu(.)40 b(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h (.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(36)830 2217 y(1.19.21)8 b Ft(str)p 1199 2217 V 29 w(print)p 1406 2217 V 30 w(stats)36 b Fu(.)41 b(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f (.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.) h(.)f(.)h(.)f(.)122 b(36)830 2316 y(1.19.22)8 b Ft(txt)p 1195 2316 V 30 w(soundex)65 b Fu(.)40 b(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h (.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.) f(.)h(.)f(.)h(.)f(.)122 b(37)639 2416 y(1.20)41 b(Timer)26 b(Supp)r(ort)67 b(.)41 b(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.) h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h (.)f(.)h(.)f(.)122 b(37)830 2516 y(1.20.1)50 b Ft(tim)p 1223 2516 V 29 w(start)89 b Fu(.)41 b(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f (.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.) g(.)f(.)h(.)f(.)h(.)f(.)122 b(37)830 2615 y(1.20.2)50 b Ft(tim)p 1223 2615 V 29 w(stop)c Fu(.)41 b(.)g(.)f(.)h(.)f(.)h(.)f(.) h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h (.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(37)830 2715 y(1.20.3)50 b Ft(tim)p 1223 2715 V 29 w(r)l(eset)87 b Fu(.)41 b(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f (.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(37)830 2814 y(1.20.4)50 b Ft(tim)p 1223 2814 V 29 w(get)p 1356 2814 V 31 w(r)l(e)l(al)57 b Fu(.)40 b(.)h(.)f(.)h(.)f(.)h(.)g(.)f (.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.) g(.)f(.)h(.)f(.)h(.)f(.)122 b(37)830 2914 y(1.20.5)50 b Ft(tim)p 1223 2914 V 29 w(get)p 1356 2914 V 31 w(user)35 b Fu(.)40 b(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h (.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(37)830 3014 y(1.20.6)50 b Ft(tim)p 1223 3014 V 29 w(get)p 1356 3014 V 31 w(system)74 b Fu(.)40 b(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h (.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.) f(.)h(.)f(.)122 b(38)830 3113 y(1.20.7)50 b Ft(tim)p 1223 3113 V 29 w(print)p 1430 3113 V 30 w(timer)d Fu(.)40 b(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f (.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)122 b(38)830 3213 y(1.20.8)50 b Ft(tim)p 1223 3213 V 29 w(print)p 1430 3213 V 30 w(timers)77 b Fu(.)41 b(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f (.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.) h(.)f(.)122 b(38)830 3313 y(1.20.9)p 1101 3313 V 80 w Ft(tim)p 1253 3313 V 30 w(shutdown)86 b Fu(.)40 b(.)h(.)f(.)h(.)g(.)f (.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.) g(.)f(.)h(.)f(.)h(.)f(.)122 b(38)515 3495 y Fv(A)52 b(Maa)2883 b(39)2136 5255 y Fu(5)p eop %%Page: 6 6 6 5 bop 1988 523 a Fq(Abstract)837 653 y Fp(The)28 b Fo(libmaa)g Fp(library)k(pro)n(vides)e(man)n(y)f(lo)n(w-lev)n(el)i (data)d(structures)h(whic)n(h)g(are)e(helpful)32 b(for)722 745 y(writing)h(compilers,)g(includin)q(g)j(hash)31 b(tables,)h(sets,)e (lists,)j(debugging)h(supp)r(ort,)e(and)f(memory)722 836 y(managemen)n(t.)55 b(Although)35 b Fo(libmaa)e Fp(w)n(as)f (designed)k(and)d(implemen)n(ted)k(as)32 b(a)g(foundation)37 b(for)722 927 y(the)27 b Fo(Khepera)i Fp(T)-6 b(ransformation)29 b(System,)e(the)g(data)g(structures)h(are)e(generally)31 b(applicabl)q(e)h(to)722 1018 y(a)26 b(wide)i(range)f(of)e(programming) 30 b(problems.)837 1110 y(The)25 b(memory)g(managemen)n(t)i(routines)h (are)d(esp)r(ecially)31 b(helpful)d(for)c(impro)n(ving)30 b(the)25 b(p)r(erfor-)722 1201 y(mance)i(of)f(memory-in)n(tensiv)n(e)31 b(application)q(s.)2136 5255 y Fu(6)p eop %%Page: 7 7 7 6 bop 515 523 a Fw(1)134 b(F)-11 b(unctions)515 721 y Fn(1.1)111 b(General)35 b(Supp)s(ort)515 875 y Fv(1.1.1)95 b Fm(maa)p 990 875 30 4 v 34 w(init)722 1028 y Fv(v)m(oid)42 b Ft(maa)p 1098 1028 V 35 w(init)8 b Fl(\()43 b Fv(const)f(c)m(har)h Fk(\003)p Ft(pr)l(o)l(gr)l(amName)48 b Fl(\))515 1199 y Ft(maa)p 672 1199 26 4 v 31 w(init)41 b Fu(should)33 b(b)r(e)i(called)e(at)g(the)i(start)f(of)39 b Fv(main\(\))p Fu(,)30 b(and)j(serv)n(es)k(to)c(initialize)e(debugging)h(and)515 1299 y(other)d(supp)r(ort)g(for)e Fj(libmaa)p Fu(.)515 1531 y Fn(1.2)111 b(Argumen)m(t)34 b(List)i(Routines)515 1684 y Fu(Argumen)n(t)31 b(lists)j(are)g(v)n(ectors)h(of)d(p)r(oin)n (ters)j(to)d(strings)j(\(e.g.,)d(the)i(standard)h Ft(char)f(**ar)l(gv)9 b Fu(\).)53 b(These)515 1784 y(routines)29 b(manage)24 b(the)29 b(e\016cien)n(t)g(creation,)e(manipulation,)21 b(and)27 b(deletion)h(of)e(these)31 b(sorts)e(of)e(lists.)515 2000 y Fv(1.2.1)95 b Fm(ar)-5 b(g)p 943 2000 30 4 v 35 w(cr)g(e)g(ate)722 2153 y Ft(ar)l(g)p 839 2153 V 34 w(List)51 b(ar)l(g)p 1176 2153 V 34 w(cr)l(e)l(ate)6 b Fl(\()43 b Fv(v)m(oid)f Fl(\))515 2324 y Fu(Create)29 b(an)f Ft(ar)l(g)p 1015 2324 26 4 v 30 w(List)34 b Fu(ob)5 b(ject.)515 2540 y Fv(1.2.2)95 b Fm(ar)-5 b(g)p 943 2540 30 4 v 35 w(destr)g(oy)722 2693 y Fv(v)m(oid)42 b Ft(ar)l(g)p 1058 2693 V 34 w(destr)l(oy)7 b Fl(\()44 b Ft(ar)l(g)p 1543 2693 V 34 w(List)51 b(ar)l(g)f Fl(\))515 2864 y Fu(F)-7 b(ree)30 b(all)25 b(memory)e(asso)r(ciated)29 b(with)e Ft(ar)l(g)p Fu(,)g(including)e(the)k(memory)23 b(used)30 b(for)d(the)i(strings.)515 3080 y Fv(1.2.3)95 b Fm(ar)-5 b(g)p 943 3080 V 35 w(add)722 3233 y Ft(ar)l(g)p 839 3233 V 34 w(List)51 b(ar)l(g)p 1176 3233 V 34 w(add)9 b Fl(\()45 b Ft(ar)l(g)p 1534 3233 V 34 w(List)51 b(ar)l(g)p Fl(,)42 b Fv(const)f(c)m(har)i Fk(\003)p Ft(string)50 b Fl(\))515 3404 y Fu(Add)28 b Ft(string)34 b Fu(as)28 b(the)h(next)g(item)c(in)h Ft(ar)l(g)p Fu(.)515 3620 y Fv(1.2.4)95 b Fm(ar)-5 b(g)p 943 3620 V 35 w(addn)722 3774 y Ft(ar)l(g)p 839 3774 V 34 w(List)51 b(ar)l(g)p 1176 3774 V 34 w(addn)6 b Fl(\()46 b Ft(ar)l(g)p 1578 3774 V 35 w(List)k(ar)l(g)p Fl(,)42 b Fv(const)g(c)m(har)h Fk(\003)p Ft(string)p Fl(,)e Fv(in)m(t)g Ft(length)50 b Fl(\))515 3945 y Fu(Add)28 b Ft(length)34 b Fu(c)n(haracters)d(of)26 b Ft(string)34 b Fu(as)28 b(the)h(next)f(item)d(in)i Ft(ar)l(g)p Fu(.)35 b(A)28 b(terminating)d Fv(NULL)i Fu(is)g(added)h(to)515 4044 y(the)h(copied)f Ft(string)p Fu(.)515 4260 y Fv(1.2.5)95 b Fm(ar)-5 b(g)p 943 4260 V 35 w(gr)g(ow)722 4413 y Fv(v)m(oid)42 b Ft(ar)l(g)p 1058 4413 V 34 w(gr)l(ow)9 b Fl(\()42 b Ft(ar)l(g)p 1455 4413 V 35 w(List)50 b(ar)l(g)p Fl(,)42 b Fv(const)g(c)m(har)h Fk(\003)p Ft(string)p Fl(,)e Fv(in)m(t)g Ft(length)50 b Fl(\))515 4584 y Fu(Gro)n(w)23 b(the)j(next)f(item)d(of)h Ft(ar)l(g)31 b Fu(with)24 b Ft(length)31 b Fu(c)n(haracters)d(of)23 b Ft(string)p Fu(.)34 b(Sev)n(eral)25 b(calls)e(to)i Ft(ar)l(g)p 3339 4584 26 4 v 29 w(gr)l(ow)32 b Fu(should)515 4684 y(b)r(e)i(follo)n(w)n(ed)d(b)n(y)i(a)f(single)h(call)f(to)h Ft(ar)l(g)p 1774 4684 V 30 w(\014nish)41 b Fu(without)33 b(an)n(y)f(in)n(terv)n(ening)h(calls)g(to)g(other)i(functions)515 4784 y(whic)n(h)27 b(mo)r(dify)c Ft(ar)l(g)p Fu(.)2136 5255 y(7)p eop %%Page: 8 8 8 7 bop 515 523 a Fv(1.2.6)95 b Fm(ar)-5 b(g)p 943 523 30 4 v 35 w(\014nish)722 676 y Ft(ar)l(g)p 839 676 V 34 w(List)51 b(ar)l(g)p 1176 676 V 34 w(\014nish)6 b Fl(\()46 b Ft(ar)l(g)p 1600 676 V 34 w(List)k(ar)l(g)h Fl(\))515 847 y Fu(Finish)27 b(the)i(gro)n(wth)e(of)g(the)i(next)f (item)d(in)i Ft(ar)l(g)35 b Fu(started)30 b(b)n(y)d Ft(ar)l(g)p 2561 847 26 4 v 30 w(gr)l(ow)p Fu(.)515 1063 y Fv(1.2.7)95 b Fm(ar)-5 b(g)p 943 1063 30 4 v 35 w(get)722 1216 y Fv(const)42 b(c)m(har)h Fk(\003)p Ft(ar)l(g)p 1365 1216 V 34 w(get)8 b Fl(\()43 b Ft(ar)l(g)p 1698 1216 V 35 w(List)50 b(ar)l(g)p Fl(,)42 b Fv(in)m(t)f Ft(item)49 b Fl(\))515 1388 y Fu(Return)28 b Ft(item)34 b Fu(from)24 b Ft(ar)l(g)p Fu(.)35 b Ft(ar)l(g)g Fu(is)27 b(0-based.)515 1603 y Fv(1.2.8)95 b Fm(ar)-5 b(g)p 943 1603 V 35 w(c)g(ount)722 1757 y Fv(in)m(t)41 b Ft(ar)l(g)p 997 1757 V 34 w(c)l(ount)8 b Fl(\()45 b Ft(ar)l(g)p 1422 1757 V 34 w(List)51 b(ar)l(g)f Fl(\))515 1928 y Fu(Return)28 b(the)h(n)n(um)n(b)r(er)e(of)f(items)g (in)h Ft(ar)l(g)p Fu(.)515 2144 y Fv(1.2.9)95 b Fm(ar)-5 b(g)p 943 2144 V 35 w(get)p 1098 2144 V 35 w(ve)g(ctor)722 2297 y Fv(v)m(oid)42 b Ft(ar)l(g)p 1058 2297 V 34 w(get)p 1196 2297 V 35 w(ve)l(ctor)9 b Fl(\()43 b Ft(ar)l(g)p 1643 2297 V 34 w(List)51 b(ar)l(g)p Fl(,)42 b Fv(in)m(t)e Fk(\003)p Ft(ar)l(gc)p Fl(,)i Fv(c)m(har)h Fk(\003\003\003)p Ft(ar)l(gv)51 b Fl(\))515 2468 y Fu(Get)24 b(an)g Ft(ar)l(gc)k Fu(and)c Ft(ar)l(gv)32 b Fu(from)21 b Ft(ar)l(g)p Fu(.)34 b(These)27 b(are)d(suitable)g(for)g(use)h(in)f(calls)f(to)h Ft(exe)l(c)p Fu(.)35 b(The)25 b Ft(ar)l(gc)5 b Fu(+1)24 b(item)515 2568 y(in)j Ft(ar)l(gv)36 b Fu(is)27 b Fv(NULL)p Fu(.)515 2783 y Fv(1.2.10)95 b Fm(ar)-5 b(g)p 991 2783 V 35 w(ar)g(gify)722 2937 y Ft(ar)l(g)p 839 2937 V 34 w(List)51 b(ar)l(g)p 1176 2937 V 34 w(ar)l(gify)7 b Fl(\()43 b Fv(const)f(c)m(har)h Fk(\003)p Ft(string)p Fl(,)e Fv(in)m(t)f Ft(quoteStyle)51 b Fl(\))515 3108 y Fu(Break)24 b(up)g Ft(string)29 b Fu(in)n(to)22 b(argumen)n(ts,)g(placing)f(them)h(as)h (items)e(in)i Ft(ar)l(g)p Fu(.)33 b(Items)23 b(within)e(single)i(or)g (double)515 3207 y(quotes)35 b(ma)n(y)29 b(con)n(tain)k(spaces.)56 b(The)35 b(quotes)g(are)f(stripp)r(ed)i(as)e(in)e(shell)i(argumen)n(t)d (pro)r(cessing.)56 b(In)515 3307 y(this)28 b(v)n(ersion,)f(bac)n (kslash)h(is)f Fv(not)f Fu(a)h(sp)r(ecial)h(quoting)e(c)n(haracter.)515 3539 y Fn(1.3)111 b(Base-26)36 b(Routines)515 3693 y Fu(These)30 b(routines)f(p)r(erform)d(enco)r(ding)i(and)f(deco)r (dingusing)h(the)g(26)f(lo)n(w)n(ercase)i(c)n(haracters,)h(a-z.)36 b(This)515 3792 y(is)27 b(sometimes)d(useful)k(for)f(generating)i (unique)e(iden)n(ti\014ers)j(that)e(do)f(not)g(con)n(tain)g(n)n(um)n(b) r(ers.)515 4025 y Fn(1.4)111 b(Base-64)36 b(Routines)515 4178 y Fu(These)27 b(routines)e(use)i(the)e(64-c)n(haracter)h(subset)i (of)23 b(In)n(ternational)g(Alphab)r(et)i(IA5)g(discussed)i(in)d(RF)n (C)515 4277 y(1421)h(\(prin)n(teable)k(enco)r(ding\))f(and)g(RF)n(C)e (1522)g(\(base64)i(MIME\).)639 4377 y(V)-7 b(alue)30 b(Enco)r(ding)f(V)-7 b(alue)30 b(Enco)r(ding)f(V)-7 b(alue)30 b(Enco)r(ding)g(V)-7 b(alue)29 b(Enco)r(ding)h(0)f(A)g(17)g(R)g(34)f(i) h(51)f(z)i(1)515 4477 y(B)e(18)e(S)h(35)f(j)g(52)g(0)h(2)f(C)h(19)g(T)g (36)f(k)g(53)h(1)f(3)h(D)f(20)g(U)h(37)f(l)h(54)f(2)g(4)h(E)g(21)f(V)i (38)e(m)e(55)i(3)h(5)f(F)h(22)f(W)h(39)f(n)515 4576 y(56)f(4)h(6)g(G)f (23)h(X)g(40)f(o)h(57)g(5)f(7)h(H)h(24)e(Y)i(41)e(p)i(58)e(6)h(8)g(I)g (25)f(Z)i(42)f(q)g(59)f(7)h(9)g(J)h(26)e(a)h(43)f(r)i(60)e(8)h(10)g(K)h (27)e(b)515 4676 y(44)i(s)i(61)e(9)h(11)f(L)h(28)f(c)i(45)f(t)g(62)f(+) i(12)e(M)i(29)e(d)h(46)f(u)i(63)e(/)h(13)f(N)h(30)f(e)j(47)d(v)h(14)f (O)i(31)e(f)h(48)f(w)h(\(pad\))g(=)515 4776 y(15)e(P)j(32)d(g)h(49)g(x) h(16)e(Q)j(33)d(h)i(50)f(y)2136 5255 y(8)p eop %%Page: 9 9 9 8 bop 515 523 a Fn(1.5)111 b(Bit)36 b(manipulation)e(routines)515 676 y Fu(These)c(are)f(a)e(set)i(of)e(simple)e(routine)j(to)f (manipulate)d(bits)k(in)f(an)g(in)n(teger.)515 892 y Fv(1.5.1)95 b Fm(bit)p 918 892 30 4 v 35 w(set)p 727 1045 V 762 1045 V 792 1045 a Ft(inline)p 1001 1045 V 1035 1045 V 113 w Fv(v)m(oid)41 b Ft(bit)p 1424 1045 V 34 w(set)8 b Fl(\()44 b Fv(unsigned)37 b(long)42 b Fk(\003)p Ft(\015ags)p Fl(,)i Fv(in)m(t)c Ft(bit)51 b Fl(\))515 1216 y Fu(Set)29 b Ft(bit)34 b Fu(in)27 b Ft(\015ags)p Fu(.)515 1432 y Fv(1.5.2)95 b Fm(bit)p 918 1432 V 35 w(clr)p 727 1585 V 762 1585 V 792 1585 a Ft(inline)p 1001 1585 V 1035 1585 V 113 w Fv(v)m(oid)41 b Ft(bit)p 1424 1585 V 34 w(clr)9 b Fl(\()43 b Fv(unsigned)37 b(long)42 b Fk(\003)p Ft(\015ags)p Fl(,)i Fv(in)m(t)c Ft(bit)51 b Fl(\))515 1757 y Fu(Clear)27 b Ft(bit)35 b Fu(in)27 b Ft(\015ags)p Fu(.)515 1972 y Fv(1.5.3)95 b Fm(bit)p 918 1972 V 35 w(tst)p 727 2126 V 762 2126 V 792 2126 a Ft(inline)p 1001 2126 V 1035 2126 V 113 w Fv(in)m(t)40 b Ft(bit)p 1363 2126 V 34 w(tst)8 b Fl(\()43 b Fv(unsigned)38 b(long)k Fk(\003)p Ft(\015ags)p Fl(,)h Fv(in)m(t)e Ft(bit)50 b Fl(\))515 2297 y Fu(T)-7 b(est)29 b Ft(bit)35 b Fu(in)27 b Ft(\015ags)p Fu(,)h(returning)h(non-zero)g(if)d(the)j(bit)e(is)h(set) h(and)f(zero)h(if)d(the)j(bit)e(is)h(clear.)515 2513 y Fv(1.5.4)95 b Fm(bit)p 918 2513 V 35 w(cnt)p 727 2666 V 762 2666 V 792 2666 a Ft(inline)p 1001 2666 V 1035 2666 V 113 w Fv(in)m(t)40 b Ft(bit)p 1363 2666 V 34 w(cnt)8 b Fl(\()45 b Fv(unsigned)37 b(long)42 b Fk(\003)p Ft(\015ags)51 b Fl(\))515 2837 y Fu(Return)28 b(a)g(coun)n(t)g(of)f(the)i(n)n(um)n(b) r(er)d(of)g(bits)i(set)i(in)d Ft(\015ags)p Fu(.)515 3069 y Fn(1.6)111 b(Debugging)36 b(Supp)s(ort)515 3223 y Fu(These)30 b(routines)f(pro)n(vide)f(lo)n(w-lev)n(el)d(supp)r(ort)30 b(for)d(run-time)f(debugging)h(messages.)37 b(A)28 b(set)h(of)e(global) 515 3322 y(\015ags)40 b(are)h(main)n(tained)35 b(using)41 b Fv(#de\014ne)c Fu(statemen)n(ts.)73 b(These)43 b(\015ags)d(are)h (assumed)f(to)f(b)r(e)j(32-bit)515 3422 y(in)n(tegers,)37 b(the)f(top)f(t)n(w)n(o)e(bits)i(of)f(whic)n(h)g(are)i(used)h(to)d (select)k(one)d(of)e(four)i(sets)i(of)c(debugging)h(lags.)515 3521 y(Eac)n(h)25 b(set,)i(therefore,)g(has)e(30)f(bits)h(of)f(\015ag)f (information.)30 b(The)25 b(last)g(set)h(\(i.e.,)d(when)j(the)g(top)f (t)n(w)n(o)f(bits)515 3621 y(are)33 b(b)r(oth)g(set\))h(is)e(reserv)n (ed)37 b(for)31 b(in)n(ternal)h(use)i(b)n(y)e(the)i Fj(Khepera)h Fu(library)-7 b(.)48 b(F)-7 b(or)33 b(con)n(v)n(enience,)i(eac)n(h)515 3721 y(\015ag)24 b(can)h(b)r(e)h(giv)n(en)f(a)f(unique)h(name,)d(so)j (that)h(\015ags)e(can)i(b)r(e)g(set)h(easily)d(with)g(command-li)o(ne)c (options.)515 3937 y Fv(1.6.1)95 b Fm(db)-5 b(g)p 945 3937 V 35 w(r)g(e)g(gister)722 4090 y Fv(v)m(oid)42 b Ft(db)l(g)p 1060 4090 V 35 w(r)l(e)l(gister)9 b Fl(\()41 b Ft(db)l(g)p 1557 4090 V 36 w(T)-6 b(yp)l(e)49 b(\015ag)p Fl(,)44 b Fv(const)e(c)m(har)h Fk(\003)p Ft(name)50 b Fl(\))515 4261 y Ft(db)l(g)p 634 4261 26 4 v 31 w(r)l(e)l(gister)29 b Fu(is)22 b(used)j(to)d(set)j(up)e(an)f(aso)r(ciated)h(b)r(et)n(w)n (een)j(a)c Ft(\015ag)32 b Fu(and)22 b(a)g Ft(name)p Fu(.)36 b(After)24 b(this)f(asso)r(ciation)515 4360 y(is)30 b(made,)f(calls)h (to)g Ft(db)l(g)p 1261 4360 V 31 w(set)39 b Fu(can)31 b(use)i Ft(name)38 b Fu(to)30 b(set)j(the)f(global)c(debugging)i (\015ag.)44 b(Both)31 b(of)f(the)i(high)515 4460 y(bits)22 b(cannot)h(b)r(e)g(set)h(sim)n(ultaneously|these)c(\015ags)i(are)h (reserv)n(ed)j(for)c(in)n(ternal)f(use)j(b)n(y)e(the)h Fj(Khepera)515 4560 y Fu(library)-7 b(.)776 4530 y Fi(1)p 515 4629 1314 4 v 607 4683 a Fh(1)642 4706 y Fr(F)h(or)22 b(in)n(ternal)c Fg(Khepera)25 b Fr(library)19 b(use,)p 1714 4706 22 4 v 47 w Ff(db)l(g)p 1836 4706 V 29 w(r)l(e)l(gister)32 b Fr(can)20 b(b)r(e)i(used)f(to)g(register)e(\015ags)i(whic)n(h)g(ha)n (v)n(e)f(b)r(oth)h(high)f(bits)515 4785 y(set.)2136 5255 y Fu(9)p eop %%Page: 10 10 10 9 bop 515 523 a Fv(1.6.2)95 b Fm(db)-5 b(g)p 945 523 30 4 v 35 w(set)722 676 y Fv(v)m(oid)42 b Ft(db)l(g)p 1060 676 V 35 w(set)8 b Fl(\()44 b Fv(const)d(c)m(har)i Fk(\003)p Ft(name)51 b Fl(\))515 847 y Ft(db)l(g)p 634 847 26 4 v 31 w(set)35 b Fu(sets)30 b(the)f Ft(name)36 b Fu(\015ag.)f(If)27 b Ft(name)35 b Fu(is)27 b(\\none,")g(then)i(all)c (\015ags)j(are)g(cleared.)515 1063 y Fv(1.6.3)95 b Fm(db)-5 b(g)p 945 1063 30 4 v 35 w(set)p 1096 1063 V 36 w(\015ag)722 1216 y Fv(v)m(oid)42 b Ft(db)l(g)p 1060 1216 V 35 w(set)p 1195 1216 V 35 w(\015ag)7 b Fl(\()45 b Ft(db)l(g)p 1556 1216 V 36 w(T)-6 b(yp)l(e)49 b(\015ag)k Fl(\))515 1388 y Fu(Used)29 b(to)f(set)i(the)f(\015ag)d(using)i(the)h(prede\014ned)i (macro)25 b(instead)k(of)d(the)j(string)f(name.)515 1603 y Fv(1.6.4)95 b Fm(db)-5 b(g)p 945 1603 V 35 w(unset)p 1202 1603 V 36 w(\015ag)722 1757 y Fv(v)m(oid)42 b Ft(db)l(g)p 1060 1757 V 35 w(unset)p 1285 1757 V 36 w(\015ag)7 b Fl(\()46 b Ft(db)l(g)p 1648 1757 V 35 w(T)-6 b(yp)l(e)50 b(\015ag)i Fl(\))515 1928 y Fu(Used)29 b(to)f(unset)i(the)f(\015ag)e (using)g(the)i(prede\014ned)i(macro)26 b(instead)i(of)f(the)i(string)e (name.)515 2144 y Fv(1.6.5)95 b Fm(db)-5 b(g)p 945 2144 V 35 w(test)p 727 2297 V 762 2297 V 792 2297 a Ft(inline)p 1001 2297 V 1035 2297 V 113 w Fv(in)m(t)40 b Ft(db)l(g)p 1385 2297 V 36 w(test)8 b Fl(\()43 b Ft(db)l(g)p 1746 2297 V 35 w(T)-6 b(yp)l(e)50 b(\015ag)i Fl(\))515 2468 y Fu(Thsi)24 b(inlined)f(function)i(tests)i(the)f Ft(\015ag)p Fu(,)g(returning)g(non-zero)g(if)d(the)j Ft(\015ag)33 b Fu(is)25 b(set,)h(and)e(zero)j(otherwise.)515 2684 y Fv(1.6.6)95 b Fm(db)-5 b(g)p 945 2684 V 35 w(destr)g(oy)722 2837 y Fv(v)m(oid)42 b Ft(db)l(g)p 1060 2837 V 35 w(destr)l(oy)7 b Fl(\()44 b Fv(v)m(oid)e Fl(\))515 3008 y Ft(db)l(g)p 634 3008 26 4 v 31 w(destr)l(oy)i Fu(destro)n(ys)c(the)f(memory)32 b(asso)r(ciated)39 b(with)e(the)h(debugging)f(supp)r(ort)i(routines.)66 b(This)515 3108 y(routine)32 b(should)g Ft(never)41 b Fu(b)r(e)33 b(called)f(b)n(y)g(the)h(programmer:)40 b(it)31 b(is)h(automatically)26 b(called)31 b(at)h(program)515 3207 y(termination)24 b(on)j(systems)h(that)g(supp)r(ort)i(the)f Ft(atexit)35 b Fu(or)28 b Ft(on)p 2451 3207 V 31 w(exit)36 b Fu(calls.)515 3440 y Fn(1.7)111 b(Error)36 b(Rep)s(orting)g(Routines) 515 3593 y Fu(Sev)n(eral)22 b(error)j(rep)r(orting)e(routines)g(are)g (pro)n(vided.)34 b(These)25 b(routines)e(are)g(alw)n(a)n(ys)d(used)k (to)e(prin)n(t)g(errors)515 3693 y(generated)30 b(within)c(the)j Fj(Khepera)i Fu(library)-7 b(,)25 b(and)j(are)g(a)n(v)-5 b(ailable)25 b(for)i(the)i(programmer)23 b(as)28 b(w)n(ell.)515 3908 y Fv(1.7.1)95 b Fm(err)p 940 3908 30 4 v 35 w(set)p 1091 3908 V 36 w(pr)-5 b(o)g(gr)g(am)p 1468 3908 V 33 w(name)722 4062 y Fv(v)m(oid)42 b Ft(err)p 1056 4062 V 33 w(set)p 1189 4062 V 34 w(pr)l(o)l(gr)l(am)p 1515 4062 V 34 w(name)6 b Fl(\()45 b Fv(const)d(c)m(har)h Fk(\003)p Ft(pr)l(o)l(gr)l(amName)48 b Fl(\))515 4233 y Ft(err)p 630 4233 26 4 v 28 w(set)p 758 4233 V 31 w(pr)l(o)l(gr)l(am) p 1081 4233 V 29 w(name)37 b Fu(records)c(the)f(v)-5 b(alue)29 b(of)g Ft(ar)l(gv[0])38 b Fu(for)29 b(the)i(calling)c (program.)40 b(If)29 b(this)h(v)-5 b(alue)30 b(is)515 4332 y(not)d Fv(NULL)p Fu(,)f(then)j(it)e(will)e(b)r(e)k(used)h(when)e (prin)n(ting)f(errors)j(and)d(w)n(arnings.)515 4548 y Fv(1.7.2)95 b Fm(err)p 940 4548 30 4 v 35 w(pr)-5 b(o)g(gr)g(am)p 1316 4548 V 33 w(name)722 4701 y Fv(const)42 b(c)m(har)h Fk(\003)p Ft(err)p 1363 4701 V 33 w(pr)l(o)l(gr)l(am)p 1688 4701 V 33 w(name)6 b Fl(\()45 b Fv(v)m(oid)d Fl(\))515 4873 y Ft(err)p 630 4873 26 4 v 28 w(pr)l(o)l(gr)l(am)p 950 4873 V 30 w(name)26 b Fu(returns)21 b(the)f(v)-5 b(alue)18 b(of)g Ft(pr)l(o)l(gr)l(amName)23 b Fu(that)c(w)n(as)f (previously)g(set)j(with)d Ft(err)p 3547 4873 V 28 w(set)p 3675 4873 V 31 w(pr)l(o)l(gr)l(am)p 3998 4873 V 29 w(name)p Fu(.)p 4240 4889 42 74 v 515 4972 a(This)27 b(v)-5 b(alue)28 b(ma)n(y)c(b)r(e)29 b Fv(NULL)p Fu(.)2115 5255 y(10)p eop %%Page: 11 11 11 10 bop 515 523 a Fv(1.7.3)95 b Fm(err)p 940 523 30 4 v 35 w(fatal)722 676 y Fv(v)m(oid)42 b Ft(err)p 1056 676 V 33 w(fatal)9 b Fl(\()42 b Fv(const)g(c)m(har)h Fk(\003)p Ft(r)l(outine)p Fl(,)f Fv(const)g(c)m(har)h Fk(\003)p Ft(format)p Fl(,)e(.)13 b(.)g(.)42 b(\))515 847 y Ft(err)p 630 847 26 4 v 28 w(fatal)36 b Fu(\015ushes)30 b Fv(stdout)p Fu(,)22 b(prin)n(ts)28 b(a)f(fatal)f(error)j(rep)r(ort)h (on)d Fv(stderr)p Fu(,)c(\015ushes)30 b Fv(stderr)24 b Fu(and)j Fv(stdout)p Fu(,)515 947 y(and)g(calls)g Ft(exit)p Fu(.)36 b Ft(r)l(outine)d Fu(is)28 b(the)h(name)c(of)i(the)i(routine)f (in)f(whic)n(h)g(the)i(error)h(to)r(ok)d(place.)515 1159 y Fv(1.7.4)95 b Fm(err)p 940 1159 30 4 v 35 w(fatal)p 1165 1159 V 34 w(errno)722 1312 y Fv(v)m(oid)42 b Ft(err)p 1056 1312 V 33 w(fatal)p 1249 1312 V 34 w(errno)5 b Fl(\()43 b Fv(const)f(c)m(har)h Fk(\003)p Ft(r)l(outine)p Fl(,)f Fv(const)f(c)m(har)j Fk(\003)p Ft(format)p Fl(,)d(.)12 b(.)h(.)43 b(\))515 1483 y Ft(err)p 630 1483 26 4 v 28 w(fatal)p 818 1483 V 30 w(errno)27 b Fu(\015ushes)f Fv(stdout)p Fu(,)18 b(prin)n(ts)24 b(a)e(fatal)e(error)25 b(rep)r(ort)g(on)d Fv(stderr)p Fu(,)d(prin)n(ts)24 b(the)g(system)e(error)515 1583 y(corresp)r(onding)32 b(to)d Ft(errno)p Fu(,)g(\015ushes)k Fv(stderr)26 b Fu(and)j Fv(stdout)p Fu(,)d(and)j(calls)h Ft(exit)p Fu(.)42 b Ft(r)l(outine)36 b Fu(is)29 b(the)j(name)27 b(of)515 1683 y(the)i(routine)f(in)f(whic)n(h)g(the)i(error)h(to)r(ok)d (place.)515 1894 y Fv(1.7.5)95 b Fm(err)p 940 1894 30 4 v 35 w(warning)722 2048 y Fv(v)m(oid)42 b Ft(err)p 1056 2048 V 33 w(warning)7 b Fl(\()44 b Fv(const)d(c)m(har)i Fk(\003)p Ft(r)l(outine)p Fl(,)f Fv(const)g(c)m(har)h Fk(\003)p Ft(format)p Fl(,)e(.)13 b(.)g(.)42 b(\))515 2219 y Ft(err)p 630 2219 26 4 v 28 w(warning)30 b Fu(\015ushes)25 b Fv(stdout)p Fu(,)18 b(prin)n(ts)23 b(a)f(non-fatal)e(w)n(arning)h(on) h Fv(stderr)p Fu(,)c(and)k(returns)k(to)c(the)i(caller.)515 2318 y Ft(r)l(outine)33 b Fu(is)28 b(the)h(name)c(of)i(the)i(calling)c (routine.)515 2530 y Fv(1.7.6)95 b Fm(err)p 940 2530 30 4 v 35 w(internal)722 2684 y Fv(v)m(oid)42 b Ft(err)p 1056 2684 V 33 w(internal)9 b Fl(\()43 b Fv(const)e(c)m(har)i Fk(\003)p Ft(r)l(outine)p Fl(,)f Fv(const)g(c)m(har)h Fk(\003)p Ft(format)p Fl(,)e(.)13 b(.)g(.)42 b(\))515 2855 y Ft(err)p 630 2855 26 4 v 28 w(internal)33 b Fu(\015ushes)27 b Fv(stdout)p Fu(,)20 b(prin)n(ts)25 b(the)h(fatal)d(error)j(message,)e (\015ushes)j Fv(stderr)21 b Fu(and)j Fv(stdout)p Fu(,)c(and)515 2954 y(calls)27 b Ft(ab)l(ort)35 b Fu(so)28 b(that)f(a)h(core)h(dump)c (is)j(generated.)515 3183 y Fn(1.8)111 b(Flag)37 b(Supp)s(ort)515 3336 y Fu(These)23 b(routines)f(pro)n(vide)e(lo)n(w-lev)n(el)e(supp)r (ort)23 b(for)d(run-time)e(program)g(\015o)n(w)i(con)n(trol.)33 b(The)22 b(mec)n(hanism)515 3436 y(used)33 b(is)f(similar)27 b(to)k(that)h(used)i(for)d(debugging)g(messages.)48 b(A)32 b(set)i(of)d(global)d(\015ags)k(are)g(main)n(tained)515 3535 y(using)c Fv(#de\014ne)23 b Fu(statemen)n(ts.)36 b(These)30 b(\015ags)d(are)h(assumed)f(to)g(b)r(e)h(32-bit)e(in)n (tegers,)i(the)g(top)f(t)n(w)n(o)g(bits)515 3635 y(of)i(whic)n(h)i(are) h(used)h(to)d(select)k(one)d(of)f(four)g(sets)k(of)c(debugging)g(lags.) 44 b(Eac)n(h)31 b(set,)i(therefore,)h(has)d(30)515 3734 y(bits)i(of)g(\015ag)f(information.)47 b(F)-7 b(or)34 b(con)n(v)n(enience,)i(eac)n(h)f(\015ag)d(can)i(b)r(e)h(giv)n(en)d(a)h (unique)h(name,)d(so)j(that)515 3834 y(\015ags)27 b(can)i(b)r(e)g(set)g (easily)e(with)g(command-l)o(i)o(ne)c(options.)515 4046 y Fv(1.8.1)95 b Fm(\015g)p 914 4046 30 4 v 36 w(r)-5 b(e)g(gister)722 4199 y Fv(v)m(oid)42 b Ft(\015g)p 1032 4199 V 36 w(r)l(e)l(gister)9 b Fl(\()41 b Ft(\015g)p 1502 4199 V 35 w(T)-6 b(yp)l(e)50 b(\015ag)p Fl(,)44 b Fv(const)e(c)m(har)h Fk(\003)p Ft(name)50 b Fl(\))515 4370 y Ft(\015g)p 606 4370 26 4 v 31 w(r)l(e)l(gister)31 b Fu(is)24 b(used)i(to)f(set)h(up)f(an)f(aso)r(ciated)h(b)r(et)n(w)n (een)j(a)c Ft(\015ag)33 b Fu(and)24 b(a)g Ft(name)p Fu(.)36 b(After)26 b(this)f(asso)r(ciation)515 4470 y(is)i(made,)e(calls)i(to)g Ft(\015g)p 1220 4470 V 32 w(set)35 b Fu(can)28 b(use)i Ft(name)35 b Fu(to)27 b(set)j(the)f(global)24 b(\015ag.)515 4682 y Fv(1.8.2)95 b Fm(\015g)p 914 4682 30 4 v 36 w(set)722 4835 y Fv(v)m(oid)42 b Ft(\015g)p 1032 4835 V 36 w(set)8 b Fl(\()43 b Fv(const)f(c)m(har)h Fk(\003)p Ft(name)50 b Fl(\))515 5006 y Ft(\015g)p 606 5006 26 4 v 31 w(set)36 b Fu(sets)30 b(the)f Ft(name)35 b Fu(\015ag.)g(If)27 b Ft(name)35 b Fu(is)28 b(\\none,")e(then)j(all)d(\015ags)h(are)i (cleared.)2115 5255 y(11)p eop %%Page: 12 12 12 11 bop 515 523 a Fv(1.8.3)95 b Fm(\015g)p 914 523 30 4 v 36 w(test)p 727 676 V 762 676 V 792 676 a Ft(inline)p 1001 676 V 1035 676 V 113 w Fv(in)m(t)40 b Ft(\015g)p 1357 676 V 36 w(test)8 b Fl(\()43 b Ft(\015g)p 1690 676 V 36 w(T)-6 b(yp)l(e)50 b(\015ag)i Fl(\))515 847 y Fu(Thsi)24 b(inlined)f(function)i(tests)i(the)f Ft(\015ag)p Fu(,)g(returning)g (non-zero)g(if)d(the)j Ft(\015ag)33 b Fu(is)25 b(set,)h(and)e(zero)j (otherwise.)515 1063 y Fv(1.8.4)95 b Fm(\015g)p 914 1063 V 36 w(destr)-5 b(oy)722 1216 y Fv(v)m(oid)42 b Ft(\015g)p 1032 1216 V 36 w(destr)l(oy)7 b Fl(\()44 b Fv(v)m(oid)d Fl(\))515 1388 y Ft(\015g)p 606 1388 26 4 v 31 w(destr)l(oy)h Fu(destro)n(ys)c(the)e(memory)31 b(asso)r(ciated)36 b(with)f(the)i (\015ag)d(supp)r(ort)j(routines.)59 b(This)35 b(routine)515 1487 y(should)19 b Ft(never)28 b Fu(b)r(e)21 b(called)d(b)n(y)h(the)i (programmer:)27 b(it)18 b(is)i(automatically)13 b(called)18 b(at)h(program)d(termination)515 1587 y(on)27 b(systems)h(that)g(supp)r (ort)h(the)g Ft(atexit)36 b Fu(or)27 b Ft(on)p 1998 1587 V 32 w(exit)35 b Fu(calls.)515 1819 y Fn(1.9)111 b(Hash)38 b(T)-9 b(able)36 b(Routines)515 1972 y Fu(Generic)31 b(hash)f(table)f(supp)r(ort)i(is)f(pro)n(vided)f(for)g(storing)g (generic)j(data)d(asso)r(ciated)i(with)e(k)n(eys.)42 b(The)515 2072 y(hash)27 b(table)g(has)g(prime)e(length,)h(with)g (self-organizing)f(link)n(ed)g(lists)i([Kn)n(uth73)o(,)f(pp.)g(398{9])e (used)29 b(for)515 2172 y(collision)f(resolution.)46 b(The)33 b(hash)e(table)h(automatically)25 b(gro)n(ws)31 b(as)g(necessary)36 b(to)31 b(preserv)n(e)k(e\016cien)n(t)515 2271 y(access.)515 2487 y Fv(1.9.1)95 b Fm(hsh)p 952 2487 30 4 v 34 w(cr)-5 b(e)g(ate)722 2640 y Ft(hsh)p 845 2640 V 36 w(HashT)f(able)49 b(hsh)p 1422 2640 V 36 w(cr)l(e)l(ate)6 b Fl(\()43 b Fv(unsigned)38 b(long)k Fl(\()p Fk(\003)p Ft(hash)6 b Fl(\)\()45 b Fv(const)d(v)m(oid)f Fk(\003)i Fl(\),)1856 2740 y Fv(in)m(t)d Fl(\()p Fk(\003)p Ft(c)l(omp)l(ar)l(e)6 b Fl(\)\()44 b Fv(const)e(v)m(oid)f Fk(\003)p Fl(,)2553 2840 y Fv(const)h(v)m(oid)f Fk(\003)i Fl(\))h(\))515 3011 y Fu(The)26 b Ft(hsh)p 806 3011 26 4 v 31 w(cr)l(e)l(ate)31 b Fu(function)25 b(initilizes)e(a)i(generic)i (hash)f(table.)35 b(Keys)27 b(and)e(data)g(are)h(p)r(oin)n(ters)h(to)e Fv(v)m(oid)p Fu(.)639 3110 y(The)i(in)n(ternal)d(represen)n(tation)29 b(of)24 b(the)j(hash)f(table)f(will)d(gro)n(w)j(automatically)19 b(when)27 b(an)e(insertion)515 3210 y(is)i(p)r(erformed)g(and)h(the)h (table)e(is)h(more)e(than)h(half)f(full.)639 3310 y(The)j Ft(hash)35 b Fu(function)27 b(should)g(tak)n(e)h(a)f(p)r(oin)n(ter)h (to)g(a)f Ft(key)36 b Fu(and)27 b(return)j(an)d Fv(unsigned)f(in)m(t)p Fu(.)33 b(If)27 b Ft(hash)515 3409 y Fu(is)35 b Fv(NULL)p Fu(,)e(then)k(the)f Ft(key)43 b Fu(is)35 b(assumed)g(to)g(b)r(e)h(a)f (p)r(oin)n(ter)h(to)f(a)g(n)n(ull-terminated)c(string,)37 b(and)e(the)515 3509 y(function)d(sho)n(wn)g(in)g(Figure)h(1)f(will)e (b)r(e)k(used)g(for)e Ft(hash)40 b Fu(\(the)34 b(algorithm)27 b(for)32 b(this)h(function)f(is)g(from)515 3609 y([Aho88)n(,)26 b(p.)h(435]\).)639 3708 y(The)h Ft(c)l(omp)l(ar)l(e)33 b Fu(function)27 b(should)g(tak)n(e)g(a)g(pair)f(of)g(p)r(oin)n(ters)i (to)f(k)n(eys)h(and)f(return)i(zero)g(if)d(the)i(k)n(eys)515 3808 y(are)39 b(equal)f(and)g(non-zero)i(if)d(the)i(k)n(eys)h(are)f (not)g(equal.)67 b(If)38 b Ft(c)l(omp)l(ar)l(e)45 b Fu(is)38 b Fv(NULL)p Fu(,)e(then)k(the)g(k)n(eys)515 3907 y(are)32 b(assumed)e(to)i(p)r(oin)n(t)e(to)h(n)n(ull-terminated)d(strings,)k (and)f(the)h Ft(str)l(cmp)k Fu(function)31 b(will)d(b)r(e)k(used)i(for) 515 4007 y Ft(c)l(omp)l(ar)l(e)p Fu(.)639 4107 y(Additionally)-7 b(,)23 b(the)29 b Ft(hsh)p 1401 4107 V 31 w(p)l(ointer)p 1686 4107 V 30 w(hash)35 b Fu(and)27 b Ft(hsh)p 2190 4107 V 32 w(p)l(ointer)p 2476 4107 V 30 w(c)l(omp)l(ar)l(e)33 b Fu(functions)28 b(are)g(a)n(v)-5 b(ailable)24 b(and)515 4206 y(can)33 b(b)r(e)h(used)h(to)e(treat)h(the)g Ft(value)40 b Fu(of)31 b(the)j Fv(v)m(oid)d Fu(p)r(oin)n(ter)j(as)f(the)h(k)n(ey)-7 b(.)52 b(These)35 b(functions)e(are)h(often)515 4306 y(useful)28 b(for)f(main)n(taini)o(ng)22 b(sets)30 b(of)d(ob)5 b(jects.)515 4522 y Fv(1.9.2)95 b Fm(hsh)p 952 4522 30 4 v 34 w(destr)-5 b(oy)722 4675 y Fv(v)m(oid)42 b Ft(hsh)p 1064 4675 V 36 w(destr)l(oy)7 b Fl(\()43 b Ft(hsh)p 1556 4675 V 36 w(HashT)-6 b(able)49 b(table)h Fl(\))515 4846 y Ft(hsh)p 638 4846 26 4 v 31 w(destr)l(oy)35 b Fu(frees)30 b(all)25 b(of)i(the)i(memory)23 b(asso)r(ciated)29 b(with)e(the)i(hash) f(table.)2115 5255 y(12)p eop %%Page: 13 13 13 12 bop 722 1673 a Fv(unsigned)38 b(long)k Ft(hsh)p 1477 1673 30 4 v 35 w(string)p 1720 1673 V 34 w(hash)6 b Fl(\()45 b Fv(const)d(v)m(oid)g Fk(\003)p Ft(key)51 b Fl(\))722 1773 y Fk(f)853 1872 y Fv(const)42 b(c)m(har)479 b Fk(\003)p Ft(pt)51 b Fl(=)44 b(\()p Fv(const)e(c)m(har)h Fk(\003)p Fl(\))p Ft(key)7 b Fl(;)853 1972 y Fv(unsigned)37 b(long)348 b Ft(h)94 b Fl(=)44 b(0;)853 2071 y Fv(static)d(const)h(c)m (har)173 b Fk(\003)p Ft(pr)l(ev)p 1935 2071 V 34 w(pt)52 b Fl(=)44 b Ft(NULL)p Fl(;)853 2171 y Fv(static)d(unsigned)c(long)42 b Ft(pr)l(ev)p 1910 2171 V 35 w(h)50 b Fl(=)44 b(0;)853 2370 y Fv(if)50 b Fl(\(!)p Ft(pt)8 b Fl(\))984 2470 y Ft(err)p 1099 2470 V 33 w(internal)h Fl(\()p 1500 2470 V 1534 2470 V 112 w Ft(FUNCTION)p 2025 2470 V 2058 2470 V 67 w Fl(,)43 b Fe("String-valued)38 b(keys)k(may)g(not)h(be)f (NULL\\n")f Fl(\);)p 3909 2491 42 84 v 3830 2570 a Fd(1)r(0)853 2669 y Fv(if)50 b Fl(\()p Ft(pr)l(ev)p 1148 2669 30 4 v 35 w(pt)i Fl(==)44 b Ft(pt)8 b Fl(\))44 b Fv(return)39 b Ft(pr)l(ev)p 2090 2669 V 35 w(h)6 b Fl(;)853 2868 y Fv(while)40 b Fl(\()p Fk(\003)p Ft(pt)8 b Fl(\))44 b Fk(f)984 2968 y Ft(h)50 b Fl(+=)45 b Fk(\003)p Ft(pt)8 b Fl(++;)722 3068 y Fe(#)p Fv(if)50 b Fl(0)984 3167 y Ft(h)g Fk(\003)p Fl(=)44 b(65599L;)613 b Fc(=)p Fk(\003)27 b Fu(prime)e(near)k(2)2690 3137 y Fi(16)2787 3167 y Fk(\003)p Fc(=)722 3267 y Fe(#)p Fv(else)984 3392 y Ft(h)50 b Fk(\003)p Fl(=)44 b(2654435789U;)389 b Fc(=)p Fk(\003)27 b Fu(prime)e(near)2658 3311 y Fb(p)p 2712 3311 34 3 v 48 x Fi(5)p Fb(\000)p Fi(1)p 2658 3373 173 4 v 2728 3421 a(2)2840 3392 y Fu(2)2882 3362 y Fi(32)2980 3392 y Fk(\003)p Fc(=)722 3492 y Fe(#)p Fv(endif)853 3591 y Fk(g)2935 b Fd(2)r(0)1698 3774 y Fu(Figure)28 b(1:)35 b Ft(hsh)p 2184 3774 26 4 v 32 w(string)p 2424 3774 V 29 w(hash)2115 5255 y Fu(13)p eop %%Page: 14 14 14 13 bop 639 523 a Fu(The)32 b(memory)26 b(used)33 b(b)n(y)e(k)n(eys)h (and)f(data)f(is)h Ft(not)40 b Fu(freed|this)32 b(memory)26 b(is)31 b(the)h(resp)r(onsibilit)n(y)e(of)515 623 y(the)25 b(user.)37 b(Ho)n(w)n(ev)n(er,)25 b(a)f(call)f(to)h Ft(hsh)p 1652 623 26 4 v 31 w(iter)l(ate)29 b Fu(can)c(b)r(e)g(used)h(to)e(free) i(this)f(memory)19 b Ft(imme)l(diately)30 b Fu(b)r(efore)515 722 y(a)d(call)f(to)i Ft(hsh)p 961 722 V 31 w(destr)l(oy)p Fu(.)515 938 y Fv(1.9.3)95 b Fm(hsh)p 952 938 30 4 v 34 w(insert)722 1091 y Fv(in)m(t)41 b Ft(hsh)p 1003 1091 V 36 w(insert)8 b Fl(\()42 b Ft(hsh)p 1447 1091 V 36 w(HashT)-6 b(able)49 b(table)p Fl(,)1420 1191 y Fv(const)41 b(v)m(oid)h Fk(\003)p Ft(key)p Fl(,)1420 1291 y Fv(const)f(v)m(oid)h Fk(\003)p Ft(datum)50 b Fl(\))515 1462 y Ft(hsh)p 638 1462 26 4 v 31 w(insert)32 b Fu(inserts)27 b(a)e(new)h Ft(key)33 b Fu(in)n(to)24 b(the)i Ft(table)p Fu(.)35 b(If)24 b(the)j(insertion)e(is)g(successful,)j(zero)f(is)e(returned.)39 b(If)515 1561 y(the)29 b Ft(key)36 b Fu(already)28 b(exists,)g(1)g(is)g (returned.)40 b(Hence,)31 b(the)e(w)n(a)n(y)e(to)g(c)n(hange)i(the)h Ft(datum)35 b Fu(asso)r(ciated)30 b(with)515 1661 y(a)d Ft(key)36 b Fu(is)27 b(\014rst)i(to)f(call)e Ft(hsh)p 1367 1661 V 32 w(delete)p Fu(.)639 1761 y(If)31 b(the)h(in)n(ternal)e (represen)n(tation)35 b(of)30 b(the)i(hash)g(table)f(b)r(ecomes)g(more) e(than)j(half)d(full,)f(its)j(size)i(is)515 1860 y(increased)k (automatically)-8 b(.)50 b(A)n(t)34 b(presen)n(t,)k(this)d(requires)h (that)f(all)c(of)i(the)j(k)n(ey)e(p)r(oin)n(ters)h(are)g(copied)515 1960 y(in)n(to)28 b(a)h(new)i(table.)42 b(Rehashing)29 b(is)h(not)f(required,)j(ho)n(w)n(ev)n(er,)e(since)h(the)g(hash)g(v)-5 b(alues)30 b(are)h(stored)h(for)515 2059 y(eac)n(h)d(k)n(ey)-7 b(.)515 2275 y Fv(1.9.4)95 b Fm(hsh)p 952 2275 30 4 v 34 w(delete)722 2429 y Fv(in)m(t)41 b Ft(hsh)p 1003 2429 V 36 w(delete)6 b Fl(\()43 b Ft(hsh)p 1444 2429 V 36 w(HashT)-6 b(able)49 b(table)p Fl(,)43 b Fv(const)e(v)m(oid)h Fk(\003)p Ft(key)51 b Fl(\))515 2600 y Ft(hsh)p 638 2600 26 4 v 31 w(delete)35 b Fu(remo)n(v)n(es)29 b(a)f Ft(key)38 b Fu(and)29 b(the)h(asso)r(ciated)h(datum)c(from)e(the)31 b Ft(table)p Fu(.)40 b(Zero)31 b(is)e(returned)k(if)28 b(the)515 2699 y Ft(key)35 b Fu(w)n(as)28 b(presen)n(t.)39 b(Otherwise,)30 b(1)d(is)h(returned.)515 2915 y Fv(1.9.5)95 b Fm(hsh)p 952 2915 30 4 v 34 w(r)-5 b(etrieve)722 3068 y Fv(const)42 b(v)m(oid)g Fk(\003)p Ft(hsh)p 1368 3068 V 35 w(r)l(etrieve)6 b Fl(\()41 b Ft(hsh)p 1874 3068 V 36 w(HashT)-6 b(able)49 b(table)p Fl(,)1856 3168 y Fv(const)41 b(v)m(oid)h Fk(\003)p Ft(key)51 b Fl(\))515 3339 y Ft(hsh)p 638 3339 26 4 v 31 w(r)l(etrieve)27 b Fu(retriev)n(es)g(the)d(datum)d(asso)r(ciated)k(with)d(a)h Ft(key)p Fu(.)35 b(If)23 b(the)h Ft(key)32 b Fu(is)23 b(not)g(presen)n(t)j(in)d(the)h Ft(table)p Fu(,)515 3439 y(then)29 b Fv(NULL)e Fu(is)g(returned.)515 3654 y Fv(1.9.6)95 b Fm(hsh)p 952 3654 30 4 v 34 w(iter)-5 b(ate)722 3808 y Fv(in)m(t)41 b Ft(hsh)p 1003 3808 V 36 w(iter)l(ate)6 b Fl(\()42 b Ft(hsh)p 1469 3808 V 35 w(HashT)-6 b(able)50 b(table)p Fl(,)1463 3907 y Fv(in)m(t)41 b Fl(\()p Fk(\003)p Ft(iter)l(ator)9 b Fl(\)\()41 b Fv(const)h(v)m(oid)f Fk(\003)p Ft(key)p Fl(,)2204 4007 y Fv(const)h(v)m(oid)f Fk(\003)p Ft(datum)51 b Fl(\))44 b(\))515 4178 y Ft(hsh)p 638 4178 26 4 v 31 w(iter)l(ate)29 b Fu(is)23 b(used)j(to)e(iterate)i (a)d(function)h(o)n(v)n(er)g(ev)n(ery)h(v)-5 b(alue)24 b(in)f(the)j Ft(table)p Fu(.)34 b(The)25 b(function,)e Ft(iter)l(ator)p Fu(,)515 4278 y(is)j(passed)j(the)f Ft(key)35 b Fu(and)27 b Ft(datum)34 b Fu(pair)26 b(for)g(eac)n(h)i(en)n (try)g(in)e(the)i(table.)36 b(If)26 b Ft(iter)l(ator)33 b Fu(returns)d(a)d(non-zero)515 4377 y(v)-5 b(alue,)25 b(the)i(iterations)f(stop,)g(and)g Ft(hsh)p 1745 4377 V 31 w(iter)l(ate)31 b Fu(returns)e(non-zero.)36 b(Note)27 b(that)f(the)i(k)n(eys)f(are)g(in)e(some)515 4477 y(arbitrary)g(order,) h(and)e(that)i(this)f(order)h(ma)n(y)21 b(c)n(hange)26 b(b)r(et)n(w)n(een)i(t)n(w)n(o)c(successiv)n(e)29 b(calls)c(to)f Ft(hsh)p 3519 4477 V 32 w(iter)l(ate)p Fu(.)515 4693 y Fv(1.9.7)95 b Fm(hsh)p 952 4693 30 4 v 34 w(iter)-5 b(ate)p 1255 4693 V 34 w(ar)g(g)722 4846 y Fv(in)m(t)41 b Ft(hsh)p 1003 4846 V 36 w(iter)l(ate)p 1271 4846 V 33 w(ar)l(g)7 b Fl(\()43 b Ft(hsh)p 1616 4846 V 36 w(HashT)-6 b(able)49 b(table)p Fl(,)1638 4946 y Fv(in)m(t)40 b Fl(\()p Fk(\003)p Ft(iter)l(ator)9 b Fl(\)\()42 b Fv(const)f(v)m(oid)h Fk(\003)p Ft(key)p Fl(,)2115 5255 y Fu(14)p eop %%Page: 15 15 15 14 bop 2379 523 a Fv(const)41 b(v)m(oid)h Fk(\003)p Ft(datum)p Fl(,)2379 623 y Fv(v)m(oid)f Fk(\003)p Ft(ar)l(g)50 b Fl(\),)1638 722 y Fv(v)m(oid)41 b Fk(\003)p Ft(ar)l(g)50 b Fl(\))515 893 y Ft(hsh)p 638 893 26 4 v 31 w(iter)l(ate)p 901 893 V 29 w(ar)l(g)42 b Fu(is)35 b(used)j(to)d(iterate)i(a)e (function)g(o)n(v)n(er)h(ev)n(ery)h(v)-5 b(alue)35 b(in)g(the)i Ft(table)p Fu(.)59 b(The)36 b(function,)515 993 y Ft(iter)l(ator)p Fu(,)29 b(is)i(passed)j(the)f Ft(key)40 b Fu(and)31 b Ft(datum)39 b Fu(pair)31 b(for)g(eac)n(h)h(en)n(try)h(in)e(the)i (table.)48 b(If)31 b Ft(iter)l(ator)38 b Fu(returns)515 1093 y(a)28 b(non-zero)i(v)-5 b(alue,)28 b(the)h(iterations)g(stop,)g (and)f Ft(hsh)p 2166 1093 V 32 w(iter)l(ate)33 b Fu(returns)e (non-zero.)41 b(Note)29 b(that)g(the)h(k)n(eys)515 1192 y(are)i(in)f(some)e(arbitrary)j(order,)h(and)e(that)g(this)h(order)h (ma)n(y)28 b(c)n(hange)k(b)r(et)n(w)n(een)i(t)n(w)n(o)d(successiv)n(e) 36 b(calls)515 1292 y(to)27 b Ft(hsh)p 739 1292 V 32 w(iter)l(ate)p Fu(.)515 1508 y Fv(1.9.8)95 b Fm(hsh)p 952 1508 30 4 v 34 w(get)p 1106 1508 V 36 w(stats)722 1661 y Ft(hsh)p 845 1661 V 36 w(Stats)51 b(hsh)p 1228 1661 V 35 w(get)p 1367 1661 V 35 w(stats)7 b Fl(\()43 b Ft(hsh)p 1768 1661 V 36 w(HashT)-6 b(able)49 b(table)h Fl(\))515 1832 y Ft(hsh)p 638 1832 26 4 v 31 w(get)p 773 1832 V 31 w(stats)26 b Fu(returns)e(statistics)e(ab)r(out)e(the)i Ft(table)p Fu(.)33 b(The)22 b Ft(hsh)p 2489 1832 V 31 w(Stats)27 b Fu(structure)e(is)20 b(sho)n(wn)h(in)f(Figure)g(2.)722 2047 y Fv(t)m(yp)s(edef)49 b(struct)41 b Ft(hsh)p 1499 2047 30 4 v 35 w(Stats)51 b Fk(f)853 2147 y Fv(unsigned)37 b(long)42 b Ft(size)6 b Fl(;)515 b Fc(=)p Fk(\003)26 b Fu(Size)j(of)e(table)g Fk(\003)p Fc(=)853 2247 y Fv(unsigned)37 b(long)42 b Ft(r)l(esizings)7 b Fl(;)338 b Fc(=)p Fk(\003)26 b Fu(Num)n(b)r(er)h(of)g(resizings)i Fk(\003)p Fc(=)853 2346 y Fv(unsigned)37 b(long)42 b Ft(entries)7 b Fl(;)400 b Fc(=)p Fk(\003)26 b Fu(T)-7 b(otal)26 b(en)n(tries)k(in)d(table)h Fk(\003)p Fc(=)853 2446 y Fv(unsigned)37 b(long)42 b Ft(buckets)p 1747 2446 V 36 w(use)l(d)9 b Fl(;)196 b Fc(=)p Fk(\003)26 b Fu(Num)n(b)r(er)h(of)g(hash)h(buc)n(k)n(ets)i(in)d (use)i Fk(\003)p Fc(=)853 2546 y Fv(unsigned)37 b(long)42 b Ft(singletons)7 b Fl(;)292 b Fc(=)p Fk(\003)26 b Fu(Num)n(b)r(er)h (of)g(length)g(one)i(lists)e Fk(\003)p Fc(=)853 2645 y Fv(unsigned)37 b(long)42 b Ft(maximum)p 1843 2645 V 36 w(length)6 b Fl(;)43 b Fc(=)p Fk(\003)27 b Fu(Maxim)n(um)20 b(list)27 b(length)h Fk(\003)p Fc(=)853 2844 y Fv(unsigned)37 b(long)42 b Ft(r)l(etrievals)7 b Fl(;)312 b Fc(=)p Fk(\003)26 b Fu(T)-7 b(otal)26 b(n)n(um)n(b)r(er)h(of)f(retriev)-5 b(als)30 b Fk(\003)p Fc(=)853 2944 y Fv(unsigned)37 b(long)42 b Ft(hits)7 b Fl(;)516 b Fc(=)p Fk(\003)26 b Fu(Num)n(b)r(er)h(of)g (retriev)-5 b(als)29 b(from)24 b(top)k(of)e(a)i(list)e Fk(\003)p Fc(=)55 b Fd(1)r(0)853 3044 y Fv(unsigned)37 b(long)42 b Ft(misses)7 b Fl(;)412 b Fc(=)p Fk(\003)26 b Fu(Num)n(b)r(er)h(of)g(unsuccessful)k(retriev)-5 b(als)30 b Fk(\003)p Fc(=)722 3143 y Fk(g)43 b(\003)p Ft(hsh)p 972 3143 V 36 w(Stats)7 b Fl(;)1808 3326 y Fu(Figure)28 b(2:)35 b Ft(hsh)p 2294 3326 26 4 v 32 w(Stats)515 3724 y Fv(1.9.9)95 b Fm(hsh)p 952 3724 30 4 v 34 w(print)p 1194 3724 V 34 w(stats)722 3878 y Fv(v)m(oid)42 b Ft(hsh)p 1064 3878 V 36 w(print)p 1278 3878 V 33 w(stats)7 b Fl(\()44 b Ft(hsh)p 1678 3878 V 35 w(HashT)-6 b(able)50 b(table)p Fl(,)42 b Ft(FILE)54 b Fk(\003)p Ft(str)l(e)l(am)48 b Fl(\))515 4049 y Ft(hsh)p 638 4049 26 4 v 31 w(print)p 847 4049 V 30 w(stats)38 b Fu(prin)n(ts)32 b(the)g(statistics)i(for)c Ft(table)38 b Fu(on)31 b(the)i(sp)r(eci\014ed)h Ft(str)l(e)l(am)p Fu(.)46 b(If)31 b Ft(str)l(e)l(am)37 b Fu(is)31 b Fv(NULL)p Fu(,)515 4148 y(then)e Fv(stdout)23 b Fu(will)i(b)r(e)k(used.)515 4364 y Fv(1.9.10)95 b Fm(hsh)p 1000 4364 30 4 v 34 w(init)p 1180 4364 V 34 w(p)-5 b(osition)722 4517 y Ft(hsh)p 845 4517 V 36 w(Position)50 b(hsh)p 1349 4517 V 36 w(init)p 1511 4517 V 34 w(p)l(osition)6 b Fl(\()44 b Ft(hsh)p 2027 4517 V 36 w(HashT)-6 b(able)49 b(table)h Fl(\))515 4689 y Ft(hsh)p 638 4689 26 4 v 31 w(init)p 795 4689 V 30 w(p)l(osition)29 b Fu(returns)c(a)d(p)r(osition)f(mark)n(er)f(for) i(some)e(arbitary)i(\014rst)i(elemen)n(t)d(in)h(the)h(table.)34 b(This)515 4788 y(mark)n(er)26 b(can)i(b)r(e)h(used)g(with)e Ft(hsh)p 1563 4788 V 32 w(next)p 1745 4788 V 31 w(p)l(osition)35 b Fu(and)27 b Ft(hsh)p 2372 4788 V 31 w(get)p 2507 4788 V 31 w(p)l(osition)p Fu(.)2115 5255 y(15)p eop %%Page: 16 16 16 15 bop 515 523 a Fv(1.9.11)95 b Fm(hsh)p 1000 523 30 4 v 34 w(next)p 1210 523 V 36 w(p)-5 b(osition)722 676 y Ft(hsh)p 845 676 V 36 w(Position)50 b(hsh)p 1349 676 V 36 w(next)p 1535 676 V 36 w(p)l(osition)6 b Fl(\()44 b Ft(hsh)p 2053 676 V 36 w(HashT)-6 b(able)49 b(table)p Fl(,)42 b Ft(hsh)p 2864 676 V 36 w(Position)50 b(p)l(osition)g Fl(\))515 847 y Ft(hsh)p 638 847 26 4 v 31 w(next)p 819 847 V 32 w(p)l(osition)31 b Fu(returns)e(a)c(p)r(osition)e(mark)n(er)h (for)g(the)j(next)f(elemen)n(t)f(in)f(the)i(table.)35 b(Elemen)n(ts)25 b(are)515 947 y(in)i(arbitrary)g(order)i(based)g(on)f (their)g(p)r(ositions)f(in)g(the)i(hash)f(table.)515 1163 y Fv(1.9.12)95 b Fm(hsh)p 1000 1163 30 4 v 34 w(get)p 1154 1163 V 36 w(p)-5 b(osition)722 1316 y Fv(v)m(oid)42 b Fk(\003)p Ft(hsh)p 1106 1316 V 35 w(get)p 1245 1316 V 35 w(p)l(osition)6 b Fl(\()44 b Ft(hsh)p 1762 1316 V 36 w(Position)50 b(p)l(osition)p Fl(,)43 b Fv(v)m(oid)f Fk(\003\003)p Ft(key)50 b Fl(\))515 1487 y Ft(hsh)p 638 1487 26 4 v 31 w(get)p 773 1487 V 31 w(p)l(osition)33 b Fu(returns)d(the)e(datum)c(asso)r(ciated)29 b(with)d(the)i Ft(p)l(osition)33 b Fu(mark)n(er,)24 b(or)j Fv(NULL)f Fu(if)f(there)515 1587 y(is)31 b(no)f(suc)n(h)j(datum.)43 b Ft(key)c Fu(is)31 b(set)i(to)e(the)h(k)n(ey)f(asso)r(ciated)i(with)d (this)h(datum,)e(or)i Fv(NULL)f Fu(is)g(there)k(is)515 1686 y(no)27 b(suc)n(h)i(datum.)515 1902 y Fv(1.9.13)95 b Fm(hsh)p 1000 1902 30 4 v 34 w(r)-5 b(e)g(adonly)722 2055 y Fv(in)m(t)41 b Ft(hsh)p 1003 2055 V 36 w(r)l(e)l(adonly)7 b Fl(\()44 b Ft(hsh)p 1540 2055 V 36 w(HashT)-6 b(able)49 b(table)p Fl(,)42 b Fv(in)m(t)f Ft(\015ag)52 b Fl(\))515 2227 y Ft(hsh)p 638 2227 26 4 v 31 w(r)l(e)l(adonly)34 b Fu(sets)29 b(the)e Ft(r)l(e)l(adonly)34 b Fu(\015ag)25 b(for)h(the)h Ft(table)32 b Fu(to)26 b Ft(\015ag)p Fu(.)37 b Ft(\015ag)e Fu(should)26 b(b)r(e)h(0)f(or)g(1.)35 b(The)27 b(v)-5 b(alue)26 b(of)515 2326 y(the)33 b(previous)f(\015ag)e(is)i (returned.)51 b(When)32 b(a)f(hash)h(table)f(is)g(mark)n(ed)f(as)h (readonly)-7 b(,)32 b(self-organization)515 2426 y(of)g(the)j(buc)n(k)n (et-o)n(v)n(er\015o)n(w)f(lists)f(will)e(not)i(tak)n(e)h(place,)h(and)e (an)n(y)f(attempt)h(to)g(mo)r(dify)c(the)34 b(list)f(\(e.g.,)515 2525 y(insertion)28 b(or)f(deletion\))h(will)d(result)k(in)e(an)h (error.)515 2758 y Fn(1.10)111 b(List)36 b(Routines)515 2911 y Fu(The)42 b(list)f(routines)h(pro)n(vide)g(supp)r(ort)h(for)e(a) g(general)g(link)n(ed)g(list)f(con)n(tain)n(ting)g(ob)5 b(jects)42 b(that)g(are)515 3011 y(p)r(oin)n(ters)32 b(to)f Fv(v)m(oid)p Fu(.)45 b(The)32 b(list)e(can)i(b)r(e)h(view)n(ed)e (as)h(a)f(stac)n(k)h(or)f(queue)i({)e(data)f(can)i(b)r(e)h(added)f(to)f (the)515 3110 y(head)d(or)h(the)g(tail,)c(but)k(can)f(only)f(b)r(e)i (remo)n(v)n(ed)d(from)f(the)k(head)g(\(this)g(data)e(structure)33 b(is)27 b(sometimes)515 3210 y(called)g(a)g(\\qstac)n(k"\).)36 b(\(If)28 b(only)e(a)h(stac)n(k)i(is)e(needed,)j(the)f(stac)n(k)f (routines)h(are)g(more)d(e\016cien)n(t.\))515 3426 y Fv(1.10.1)95 b Fm(lst)p 956 3426 30 4 v 37 w(cr)-5 b(e)g(ate)722 3579 y Ft(lst)p 811 3579 V 34 w(List)50 b(lst)p 1119 3579 V 34 w(cr)l(e)l(ate)6 b Fl(\()43 b Fv(v)m(oid)f Fl(\))515 3750 y Ft(lst)p 604 3750 26 4 v 29 w(cr)l(e)l(ate)33 b Fu(initializes)25 b(a)j(list)f(ob)5 b(ject.)515 3966 y Fv(1.10.2)95 b Fm(lst)p 956 3966 30 4 v 37 w(destr)-5 b(oy)722 4119 y Fv(v)m(oid)42 b Ft(lst)p 1030 4119 V 33 w(destr)l(oy)7 b Fl(\()44 b Ft(lst)p 1486 4119 V 34 w(List)50 b(list)g Fl(\))515 4290 y Ft(lst)p 604 4290 26 4 v 29 w(destr)l(oy)37 b Fu(destro)n(ys)c(all)27 b(memory)f(asso)r (ciated)31 b(with)f(the)h Ft(list)p Fu(.)42 b(The)31 b(memory)25 b(used)32 b(b)n(y)e(data)f(is)h Ft(not)515 4390 y Fu(freed|this)e(memory)23 b(is)28 b(the)h(resp)r(onsibilit)n(y)e (of)f(the)j(user.)515 4606 y Fv(1.10.3)95 b Fm(lst)p 956 4606 30 4 v 37 w(app)-5 b(end)722 4759 y Fv(v)m(oid)42 b Ft(lst)p 1030 4759 V 33 w(app)l(end)9 b Fl(\()46 b Ft(lst)p 1482 4759 V 34 w(List)k(list)p Fl(,)41 b Fv(const)h(v)m(oid)f Fk(\003)p Ft(datum)51 b Fl(\))515 4930 y Ft(lst)p 604 4930 26 4 v 29 w(app)l(end)39 b Fu(app)r(ends)29 b Ft(datum)35 b Fu(on)28 b(the)h Ft(list)p Fu(.)2115 5255 y(16)p eop %%Page: 17 17 17 16 bop 515 523 a Fv(1.10.4)95 b Fm(lst)p 956 523 30 4 v 37 w(push)722 676 y Fv(v)m(oid)42 b Ft(lst)p 1030 676 V 33 w(push)6 b Fl(\()46 b Ft(lst)p 1393 676 V 34 w(List)k(list)p Fl(,)41 b Fv(const)h(v)m(oid)f Fk(\003)p Ft(datum)51 b Fl(\))515 847 y Ft(lst)p 604 847 26 4 v 29 w(push)35 b Fu(prep)r(ends)d Ft(datum)j Fu(on)27 b(the)i Ft(list)p Fu(.)515 1063 y Fv(1.10.5)95 b Fm(lst)p 956 1063 30 4 v 37 w(p)-5 b(op)722 1216 y Fv(v)m(oid)42 b Fk(\003)p Ft(lst)p 1072 1216 V 33 w(p)l(op)5 b Fl(\()45 b Ft(lst)p 1393 1216 V 34 w(List)50 b(list)g Fl(\))515 1388 y Ft(lst)p 604 1388 26 4 v 29 w(p)l(op)40 b Fu(remo)n(v)n(es)33 b(the)j(\014rst)f(datum)d(on)h(the)i Ft(list)41 b Fu(and)33 b(returns)38 b(the)d(p)r(oin)n(ter.)55 b(If)34 b(the)h Ft(list)40 b Fu(is)34 b(empt)n(y)-7 b(,)515 1487 y Ft(lst)p 604 1487 V 29 w(p)l(op)34 b Fu(returns)d Fv(NULL)p Fu(.)515 1703 y Fv(1.10.6)95 b Fm(lst)p 956 1703 30 4 v 37 w(top)722 1856 y Fv(v)m(oid)42 b Fk(\003)p Ft(lst)p 1072 1856 V 33 w(top)5 b Fl(\()45 b Ft(lst)p 1383 1856 V 33 w(List)51 b(list)e Fl(\))515 2027 y Ft(lst)p 604 2027 26 4 v 29 w(top)41 b Fu(returns)e(a)d(p)r(oin)n(ter)g(to)f(the)i(datum)c(that)j (is)g(the)h(\014rst)g(elemen)n(t)e(of)g(the)i Ft(list)p Fu(,)e(but)h(do)r(es)h Ft(not)515 2127 y Fu(remo)n(v)n(e)26 b(this)i(datum)c(from)h(the)k Ft(list)p Fu(.)34 b(If)27 b(the)i Ft(list)34 b Fu(is)27 b(empt)n(y)-7 b(,)25 b Ft(lst)p 2543 2127 V 29 w(top)34 b Fu(returns)c Fv(NULL)p Fu(.)515 2343 y Fv(1.10.7)95 b Fm(lst)p 956 2343 30 4 v 37 w(nth)p 1129 2343 V 34 w(get)722 2496 y Fv(v)m(oid)42 b Fk(\003)p Ft(lst)p 1072 2496 V 33 w(nth)p 1221 2496 V 35 w(get)8 b Fl(\()44 b Ft(lst)p 1528 2496 V 34 w(List)50 b(list)p Fl(,)41 b Fv(unsigned)d(in)m(t)i Ft(n)51 b Fl(\))515 2667 y Ft(lst)p 604 2667 26 4 v 29 w(nth)p 749 2667 V 31 w(get)42 b Fu(returns)c(a)33 b(p)r(oin)n(ter)i(to)f(the)i Fc(n)p Fu(-th)e(datum)d(in)i(the)j Ft(list)p Fu(,)d(or)h Fv(NULL)f Fu(if)g(the)j Fc(n)p Fu(th)e(elemen)n(t)515 2767 y(do)r(es)29 b(not)f(exist.)515 2983 y Fv(1.10.8)95 b Fm(lst)p 956 2983 30 4 v 37 w(nth)p 1129 2983 V 34 w(set)722 3136 y Fv(v)m(oid)42 b Ft(lst)p 1030 3136 V 33 w(nth)p 1179 3136 V 36 w(set)8 b Fl(\()43 b Ft(lst)p 1482 3136 V 34 w(List)50 b(list)p Fl(,)41 b Fv(unsigned)d(in)m(t)i Ft(n)p Fl(,)k Fv(const)d(v)m(oid)h Fk(\003)p Ft(datum)50 b Fl(\))515 3307 y Ft(lst)p 604 3307 26 4 v 29 w(nth)p 749 3307 V 31 w(set)38 b Fu(lo)r(cates)32 b(the)g Fc(n)p Fu(-th)f(datum)d(in)h(the)j Ft(list)37 b Fu(and)30 b(replaces)j(that)e (datum)d(with)i Ft(datum)p Fu(.)46 b(If)30 b(the)515 3407 y Fc(n)p Fu(th)22 b(elemen)n(t)g(do)r(es)h(not)g(exist,)g(the)g (program)c(will)h(halt)h(with)h(an)g(error.)36 b(\(I.e.,)21 b(it)h(is)g(the)i(programmer's)515 3506 y(resp)r(onsibilit)n(y)j(to)g (c)n(hec)n(k)j Ft(lst)p 1440 3506 V 29 w(length)k Fu(and)28 b(only)e(pass)j(v)-5 b(alid)25 b(v)-5 b(alues)29 b(of)d Ft(n)p Fu(.\))515 3722 y Fv(1.10.9)95 b Fm(lst)p 956 3722 30 4 v 37 w(memb)-5 b(er)722 3875 y Fv(in)m(t)41 b Ft(lst)p 969 3875 V 33 w(memb)l(er)9 b Fl(\()43 b Ft(lst)p 1452 3875 V 34 w(List)50 b(list)p Fl(,)41 b Fv(const)h(v)m(oid)g Fk(\003)p Ft(datum)50 b Fl(\))515 4046 y Ft(lst)p 604 4046 26 4 v 29 w(memb)l(er)38 b Fu(returns)32 b(non-zero)f(if)d(the)j (p)r(oin)n(ter)f(to)f Ft(datum)37 b Fu(is)29 b(also)f(a)h(p)r(oin)n (ter)h(on)f(the)i(list,)d(and)h(zero)515 4146 y(otherwise.)37 b(Note)27 b(that)f(only)e(p)r(oin)n(ters)j(are)g(compared,)d(so)i(iden) n(tical)f(copies)i(of)e(data)g(structures)31 b(will)515 4246 y(b)r(e)e(view)n(ed)f(as)g(non-equal.)515 4461 y Fv(1.10.10)95 b Fm(lst)p 1004 4461 30 4 v 36 w(length)722 4615 y Fv(unsigned)38 b(in)m(t)i Ft(lst)p 1380 4615 V 34 w(length)6 b Fl(\()44 b Ft(lst)p 1794 4615 V 34 w(List)50 b(list)g Fl(\))515 4786 y Ft(lst)p 604 4786 26 4 v 29 w(length)34 b Fu(returns)d(the)e(n)n(um)n(b)r(er)e(of)f(elemen)n(ts)i (in)e(the)j(list.)2115 5255 y(17)p eop %%Page: 18 18 18 17 bop 515 523 a Fv(1.10.11)95 b Fm(lst)p 1004 523 30 4 v 36 w(trunc)-5 b(ate)722 676 y Fv(v)m(oid)42 b Ft(lst)p 1030 676 V 33 w(trunc)l(ate)6 b Fl(\()45 b Ft(lst)p 1526 676 V 33 w(List)51 b(list)p Fl(,)40 b Fv(unsigned)e(in)m(t)j Ft(length)50 b Fl(\))515 847 y Ft(lst)p 604 847 26 4 v 29 w(trunc)l(ate)31 b Fu(truncates)e(a)c(list)f(to)h Ft(length)32 b Fu(elemen)n(ts.)j(If)25 b(the)h(list)f(is)g(not)g (longer)g(than)g Ft(length)p Fu(,)g(nothing)515 947 y(it)i(done.)515 1163 y Fv(1.10.12)95 b Fm(lst)p 1004 1163 30 4 v 36 w(trunc)-5 b(ate)p 1385 1163 V 34 w(p)g(osition)722 1316 y Fv(v)m(oid)42 b Ft(lst)p 1030 1316 V 33 w(trunc)l(ate)p 1359 1316 V 35 w(p)l(osition)6 b Fl(\()45 b Ft(lst)p 1843 1316 V 33 w(List)51 b(list)p Fl(,)41 b Ft(lst)p 2326 1316 V 33 w(Position)50 b(p)l(osition)h Fl(\))515 1487 y Ft(lst)p 604 1487 26 4 v 29 w(trunc)l(ate)p 929 1487 V 31 w(p)l(osition)45 b Fu(truncates)d(a)d(list)f(b)r(ey)n(ond)i Ft(p)l(osition)45 b Fu(\(i.e.,)40 b Ft(p)l(osition)45 b Fu(is)39 b(alw)n(a)n(ys)e(left)i (in)f(the)515 1587 y(list.)43 b(If)30 b Ft(p)l(ostition)36 b Fu(is)30 b Fv(NULL)p Fu(,)f(then)j(the)f(list)f(is)g(emptied.)43 b(This)30 b(con)n(v)n(en)n(tion)g(is)g(useful)h(when)g(using)515 1686 y Ft(lst)p 604 1686 V 29 w(last)p 759 1686 V 30 w(p)l(ostition)j Fu(to)27 b(get)h(a)g(mark)n(er)d(allo)n(wing)f(an)j (older)h(state)h(of)e(a)g(list)g(to)g(b)r(e)i(restored.)515 1902 y Fv(1.10.13)95 b Fm(lst)p 1004 1902 30 4 v 36 w(iter)-5 b(ate)722 2055 y Fv(in)m(t)41 b Ft(lst)p 969 2055 V 33 w(iter)l(ate)6 b Fl(\()43 b Ft(lst)p 1399 2055 V 33 w(List)51 b(list)p Fl(,)41 b Fv(in)m(t)f Fl(\()p Fk(\003)p Ft(iter)l(ator)9 b Fl(\)\()42 b Fv(const)f(v)m(oid)h Fk(\003)p Ft(datum)50 b Fl(\))44 b(\))515 2227 y Ft(lst)p 604 2227 26 4 v 29 w(iter)l(ate)29 b Fu(is)24 b(used)i(to)e(iterate)i(a)d(function)h(o)n (v)n(er)h(ev)n(ery)g(elemen)n(t)f(in)f(the)j Ft(list)p Fu(.)33 b(The)25 b(function,)e Ft(iter)l(ator)p Fu(,)515 2326 y(is)g(passed)j(a)e(p)r(oin)n(ter)g(to)g(eac)n(h)h(elemen)n(t.)34 b(If)23 b Ft(iter)l(ator)30 b Fu(returns)d(a)d(non-zero)h(v)-5 b(alue,)23 b(the)i(iterations)f(stop,)515 2426 y(and)j Ft(lst)p 765 2426 V 29 w(iter)l(ate)33 b Fu(returns.)515 2642 y Fv(1.10.14)95 b Fm(lst)p 1004 2642 30 4 v 36 w(iter)-5 b(ate)p 1309 2642 V 34 w(ar)g(g)722 2795 y Fv(in)m(t)41 b Ft(lst)p 969 2795 V 33 w(iter)l(ate)p 1234 2795 V 33 w(ar)l(g)7 b Fl(\()44 b Ft(lst)p 1546 2795 V 34 w(List)50 b(list)p Fl(,)1638 2895 y Fv(in)m(t)40 b Fl(\()p Fk(\003)p Ft(iter)l(ator)9 b Fl(\)\()42 b Fv(const)f(v)m(oid)h Fk(\003)p Ft(datum)p Fl(,)h Fv(v)m(oid)e Fk(\003)p Ft(ar)l(g)50 b Fl(\),)1638 2994 y Fv(v)m(oid)41 b Fk(\003)p Ft(ar)l(g)50 b Fl(\))515 3165 y Ft(lst)p 604 3165 26 4 v 29 w(iter)l(ate)p 865 3165 V 29 w(ar)l(g)42 b Fu(is)36 b(used)h(to)f(iterate)h(a)e (function)h(o)n(v)n(er)f(ev)n(ery)j(elemen)n(t)c(in)h(the)i Ft(list)p Fu(.)59 b(The)36 b(function,)515 3265 y Ft(iter)l(ator)p Fu(,)j(is)h(passed)h(a)f(p)r(oin)n(ter)g(to)g(eac)n(h)g(elemen)n(t.)72 b(If)39 b Ft(iter)l(ator)46 b Fu(returns)d(a)c(non-zero)i(v)-5 b(alue,)42 b(the)515 3365 y(iterations)27 b(stop,)h(and)f Ft(lst)p 1338 3365 V 30 w(iter)l(ate)32 b Fu(returns.)515 3580 y Fv(1.10.15)95 b Fm(lst)p 1004 3580 30 4 v 36 w(init)p 1186 3580 V 35 w(p)-5 b(osition)722 3734 y Ft(lst)p 811 3734 V 34 w(Position)50 b(lst)p 1279 3734 V 34 w(init)p 1439 3734 V 34 w(p)l(osition)6 b Fl(\()44 b Ft(lst)p 1921 3734 V 34 w(List)50 b(list)g Fl(\))515 3905 y Ft(lst)p 604 3905 26 4 v 29 w(init)p 759 3905 V 30 w(p)l(osition)32 b Fu(returns)d(a)c(p)r(osition)f(mark)n(er)g(for)g(the)j(head)f(of)f (the)i(list.)34 b(This)26 b(mark)n(er)d(can)j(b)r(e)h(used)515 4004 y(with)g Ft(lst)p 793 4004 V 29 w(next)p 972 4004 V 32 w(p)l(osition)34 b Fu(and)27 b Ft(lst)p 1565 4004 V 30 w(get)p 1699 4004 V 30 w(p)l(osition)p Fu(.)515 4220 y Fv(1.10.16)95 b Fm(lst)p 1004 4220 30 4 v 36 w(last)p 1186 4220 V 36 w(p)-5 b(osition)722 4373 y Ft(lst)p 811 4373 V 34 w(Position)50 b(lst)p 1279 4373 V 34 w(last)p 1439 4373 V 34 w(p)l(osition)6 b Fl(\()44 b Ft(lst)p 1921 4373 V 34 w(List)50 b(list)g Fl(\))515 4544 y Ft(lst)p 604 4544 26 4 v 29 w(last)p 759 4544 V 30 w(p)l(osition)35 b Fu(returns)d(a)d(p)r(osition)e(mark)n(er)g(for)h(the)j(tail)26 b(of)i(the)i(list.)39 b(This)29 b(mark)n(er)e(can)i(b)r(e)h(used)515 4644 y(with)d Ft(lst)p 793 4644 V 29 w(trunc)l(ate)p 1118 4644 V 31 w(p)l(osition)34 b Fu(to)27 b(restore)k(a)d(previous)g (state)h(of)e(the)i(list.)2115 5255 y(18)p eop %%Page: 19 19 19 18 bop 515 523 a Fv(1.10.17)95 b Fm(lst)p 1004 523 30 4 v 36 w(next)p 1216 523 V 36 w(p)-5 b(osition)722 676 y Ft(lst)p 811 676 V 34 w(Position)50 b(lst)p 1279 676 V 34 w(next)p 1463 676 V 35 w(p)l(osition)6 b Fl(\()45 b Ft(lst)p 1947 676 V 33 w(Position)51 b(p)l(osition)f Fl(\))515 847 y Ft(lst)p 604 847 26 4 v 29 w(next)p 783 847 V 32 w(p)l(osition)43 b Fu(returns)e(a)36 b(p)r(osition)g(mark)n (er)f(for)i(the)h(elemen)n(t)e(after)i(the)g(elemen)n(t)f(mark)n(ed)d (b)n(y)515 947 y Ft(p)l(osition)p Fu(,)27 b(or)g Fv(NULL)g Fu(if)f Ft(p)l(osition)34 b Fu(is)28 b(the)h(last)e(elemen)n(t)g(in)g (the)i(list.)515 1163 y Fv(1.10.18)95 b Fm(lst)p 1004 1163 30 4 v 36 w(nth)p 1176 1163 V 35 w(p)-5 b(osition)722 1316 y Ft(lst)p 811 1316 V 34 w(Position)50 b(lst)p 1279 1316 V 34 w(nth)p 1429 1316 V 35 w(p)l(osition)6 b Fl(\()45 b Ft(lst)p 1913 1316 V 33 w(List)51 b(list)p Fl(,)40 b Fv(unsigned)e(in)m(t)j Ft(n)50 b Fl(\))515 1487 y Ft(lst)p 604 1487 26 4 v 29 w(nth)p 749 1487 V 31 w(p)l(osition)37 b Fu(returns)c(a)c(p)r(osition)g(mark)n(er)f(for)i(the)h Fc(n)p Fu(th)f(elemen)n(t)f(in)g(the)j(list,)c(or)i Fv(NULL)f Fu(if)g(the)515 1587 y Fc(n)p Fu(th)f(elemen)n(t)e(do)r(es)k(not)d (exist.)515 1803 y Fv(1.10.19)95 b Fm(lst)p 1004 1803 30 4 v 36 w(get)p 1160 1803 V 36 w(p)-5 b(osition)722 1956 y Fv(v)m(oid)42 b Fk(\003)p Ft(lst)p 1072 1956 V 33 w(get)p 1209 1956 V 35 w(p)l(osition)6 b Fl(\()44 b Ft(lst)p 1692 1956 V 34 w(Position)50 b(p)l(osition)g Fl(\))515 2127 y Ft(lst)p 604 2127 26 4 v 29 w(get)p 737 2127 V 31 w(p)l(osition)36 b Fu(returns)d(the)e(datum)c(asso)r (ciated)k(with)f(the)h Ft(p)l(osition)36 b Fu(mark)n(er,)27 b(or)j Fv(NULL)f Fu(if)f(there)515 2227 y(is)f(no)h(suc)n(h)h(elemen)n (t.)515 2442 y Fv(1.10.20)95 b Fm(lst)p 1004 2442 30 4 v 36 w(set)p 1156 2442 V 36 w(p)-5 b(osition)722 2596 y Fv(v)m(oid)42 b Ft(lst)p 1030 2596 V 33 w(set)p 1163 2596 V 35 w(p)l(osition)6 b Fl(\()44 b Ft(lst)p 1646 2596 V 34 w(Position)50 b(p)l(osition)p Fl(,)43 b Fv(const)f(v)m(oid)f Fk(\003)p Ft(datum)51 b Fl(\))515 2767 y Ft(lst)p 604 2767 26 4 v 29 w(set)p 733 2767 V 30 w(p)l(osition)35 b Fu(sets)30 b(the)f Ft(datum)35 b Fu(asso)r(ciated)29 b(with)e(the)i Ft(p)l(osition)34 b Fu(mark)n(er.)515 2983 y Fv(1.10.21)p 908 2983 30 4 v 130 w Fm(lst)p 1039 2983 V 37 w(dump)p 1306 2983 V 33 w(no)-5 b(de)722 3136 y Fv(static)41 b(in)m(t)p 1156 3136 V 76 w Ft(lst)p 1275 3136 V 33 w(dump)p 1504 3136 V 36 w(no)l(de)6 b Fl(\()46 b Fv(const)41 b(v)m(oid)h Fk(\003)p Ft(datum)50 b Fl(\))515 3307 y Ft(lst)p 604 3307 26 4 v 29 w(dump)34 b Fu(prin)n(ts)28 b(eac)n(h)h Ft(datum)35 b Fu(on)28 b(the)h(list)d(in)h(hex)515 3539 y Fn(1.11)111 b(Memory)33 b(Managemen)m(t)i(Routines)515 3693 y Fu(The)26 b(memory)21 b(managemen)n(t)g(routines)27 b(pro)n(vide)e(simple)e(supp)r(ort)28 b(for)d(string)h(ob)5 b(ject)26 b(storage.)36 b(These)515 3792 y(routines)28 b(are)f(generally)f(used)j(as)e(building)d(blo)r(c)n(ks)j(b)n(y)f (other)i(parts)g(of)d(the)j Fj(Khepera)i Fu(library)25 b(\(e.g.,)515 3892 y(string)j(p)r(o)r(ols)f(and)g(abstract)j(syn)n(tax) e(trees\).)515 4108 y Fv(1.11.1)95 b Fm(mem)p 1060 4108 30 4 v 37 w(cr)-5 b(e)g(ate)p 1343 4108 V 34 w(strings)722 4261 y Ft(mem)p 901 4261 V 35 w(String)51 b(mem)p 1381 4261 V 34 w(cr)l(e)l(ate)p 1627 4261 V 34 w(strings)7 b Fl(\()43 b Fv(v)m(oid)e Fl(\))515 4432 y Ft(mem)p 694 4432 26 4 v 30 w(cr)l(e)l(ate)p 936 4432 V 30 w(strings)33 b Fu(creates)f(a)27 b(memory)c(ob)5 b(ject)28 b(for)f(storing)g (strings.)2115 5255 y(19)p eop %%Page: 20 20 20 19 bop 515 523 a Fv(1.11.2)95 b Fm(mem)p 1060 523 30 4 v 37 w(destr)-5 b(oy)p 1396 523 V 34 w(strings)722 676 y Fv(v)m(oid)42 b Ft(mem)p 1120 676 V 35 w(destr)l(oy)p 1411 676 V 34 w(strings)7 b Fl(\()43 b Ft(mem)p 1943 676 V 34 w(String)51 b(info)e Fl(\))515 847 y Ft(mem)p 694 847 26 4 v 30 w(destr)l(oy)p 980 847 V 30 w(strings)43 b Fu(destro)n(ys)c(the)f(memory)32 b(ob)5 b(ject)37 b(returned)j(from) 34 b Ft(mem)p 3096 847 V 30 w(cr)l(e)l(ate)p 3338 847 V 30 w(strings)p Fu(.)62 b(All)515 947 y(memory)25 b(if)k(freed,)j (including)c(that)j(used)h(for)e(the)h(strings.)45 b(Therefore,)33 b(an)n(y)d(p)r(oin)n(ters)h(to)f(strings)i(in)515 1047 y(the)d(table)e(will)e(b)r(e)k(left)e(dangling.)515 1262 y Fv(1.11.3)95 b Fm(mem)p 1060 1262 30 4 v 37 w(str)-5 b(cpy)722 1416 y Fv(const)42 b(c)m(har)h Fk(\003)p Ft(mem)p 1427 1416 V 34 w(str)l(cpy)7 b Fl(\()44 b Ft(mem)p 1932 1416 V 35 w(String)50 b(info)p Fl(,)43 b Fv(const)e(c)m(har)i Fk(\003)p Ft(string)50 b Fl(\))515 1587 y Ft(mem)p 694 1587 26 4 v 30 w(str)l(cpy)35 b Fu(copies)28 b(a)g Ft(string)33 b Fu(in)n(to)27 b(the)i(memory)23 b(ob)5 b(ject)28 b(p)r(oin)n(ted)g (to)f(b)n(y)h Ft(info)p Fu(.)515 1803 y Fv(1.11.4)95 b Fm(mem)p 1060 1803 30 4 v 37 w(strncpy)722 1956 y Fv(const)42 b(c)m(har)h Fk(\003)p Ft(mem)p 1427 1956 V 34 w(strncpy)7 b Fl(\()45 b Ft(mem)p 1983 1956 V 34 w(String)51 b(info)p Fl(,)1812 2055 y Fv(const)42 b(c)m(har)h Fk(\003)p Ft(string)p Fl(,)e Fv(in)m(t)f Ft(len)50 b Fl(\))515 2227 y Ft(mem)p 694 2227 26 4 v 30 w(strncpy)36 b Fu(copies)30 b Ft(len)35 b Fu(b)n(ytes)30 b(of)e Ft(string)35 b Fu(in)n(to)27 b(the)j(memory)24 b(ob)5 b(ject)29 b(p)r(oin)n(ted)g(to)f(b)n(y)g Ft(info)p Fu(.)39 b(A)29 b(n)n(ull)515 2326 y(is)e(added)i(to)e(the)i (end)g(of)e(the)h(copied)h(sequence.)515 2542 y Fv(1.11.5)95 b Fm(mem)p 1060 2542 30 4 v 37 w(gr)-5 b(ow)722 2695 y Fv(v)m(oid)42 b Ft(mem)p 1120 2695 V 35 w(gr)l(ow)9 b Fl(\()42 b Ft(mem)p 1580 2695 V 35 w(String)50 b(info)p Fl(,)43 b Fv(const)f(c)m(har)h Fk(\003)p Ft(string)p Fl(,)e Fv(in)m(t)f Ft(len)50 b Fl(\))515 2866 y Ft(mem)p 694 2866 26 4 v 30 w(gr)l(ow)28 b Fu(copies)22 b Ft(len)28 b Fu(of)19 b Ft(string)27 b Fu(on)n(to)20 b(the)i(top)e(of)g(the)i (memory)16 b(ob)5 b(ject)21 b(p)r(oin)n(ted)g(to)f(b)n(y)h Ft(info)p Fu(.)33 b(Sev)n(eral)515 2966 y(calls)21 b(to)h Ft(mem)p 969 2966 V 30 w(gr)l(ow)30 b Fu(should)22 b(b)r(e)h(follo)n(w) n(ed)c(b)n(y)i(a)h(single)f(call)g(to)h Ft(mem)p 2692 2966 V 30 w(\014nish)30 b Fu(without)21 b(an)n(y)g(in)n(terv)n(ening) 515 3066 y(calls)27 b(to)g(other)i(functions)f(whic)n(h)g(mo)r(dify)23 b Ft(info)p Fu(.)515 3281 y Fv(1.11.6)95 b Fm(mem)p 1060 3281 30 4 v 37 w(\014nish)722 3435 y Fv(const)42 b(c)m(har)h Fk(\003)p Ft(mem)p 1427 3435 V 34 w(\014nish)6 b Fl(\()46 b Ft(mem)p 1913 3435 V 35 w(String)k(info)f Fl(\))515 3606 y Ft(mem)p 694 3606 26 4 v 30 w(\014nish)36 b Fu(\014nishes)29 b(the)g(gro)n(wth)e(of)g(the)i(ob)5 b(ject)28 b(p)r(erformed)f(b)n(y)h Ft(mem)p 2843 3606 V 30 w(gr)l(ow)p Fu(.)515 3822 y Fv(1.11.7)95 b Fm(mem)p 1060 3822 30 4 v 37 w(get)p 1217 3822 V 35 w(string)p 1494 3822 V 35 w(stats)722 3975 y Ft(mem)p 901 3975 V 35 w(StringStats)50 b(mem)p 1558 3975 V 35 w(get)p 1697 3975 V 35 w(string)p 1940 3975 V 33 w(stats)7 b Fl(\()44 b Ft(mem)p 2396 3975 V 34 w(String)51 b(info)e Fl(\))515 4146 y Ft(mem)p 694 4146 26 4 v 30 w(get)p 828 4146 V 31 w(string)p 1067 4146 V 29 w(stats)39 b Fu(returns)d(statistics)e(ab)r(out)e(the)h(memory)28 b(ob)5 b(ject)33 b(p)r(oin)n(ted)g(to)f(b)n(y)g Ft(info)p Fu(.)50 b(The)515 4246 y Ft(mem)p 694 4246 V 30 w(StringStats)35 b Fu(structure)d(is)27 b(sho)n(wn)h(in)f(Figure)h(3.)515 4461 y Fv(1.11.8)95 b Fm(mem)p 1060 4461 30 4 v 37 w(print)p 1305 4461 V 33 w(string)p 1580 4461 V 35 w(stats)722 4615 y Fv(v)m(oid)42 b Ft(mem)p 1120 4615 V 35 w(print)p 1333 4615 V 34 w(string)p 1575 4615 V 33 w(stats)7 b Fl(\()43 b Ft(mem)p 2030 4615 V 35 w(String)51 b(info)p Fl(,)42 b Ft(FILE)55 b Fk(\003)p Ft(str)l(e)l(am)48 b Fl(\))515 4786 y Ft(mem)p 694 4786 26 4 v 30 w(print)p 902 4786 V 30 w(string)p 1140 4786 V 29 w(stats)30 b Fu(prin)n(ts)24 b(the)h(statistics)g(for)d(the)j(memory)18 b(ob)5 b(ject)24 b(p)r(oin)n(ted)g(to)f(b)n(y)g Ft(info)29 b Fu(on)23 b(the)515 4885 y(sp)r(eci\014ed)31 b Ft(str)l(e)l(am)p Fu(.)j(If)27 b Ft(str)l(e)l(am)33 b Fu(is)27 b Fv(NULL)p Fu(,)f(then)j Fv(stdout)24 b Fu(will)g(b)r(e)29 b(used.)2115 5255 y(20)p eop %%Page: 21 21 21 20 bop 722 540 a Fv(t)m(yp)s(edef)49 b(struct)41 b Ft(mem)p 1555 540 30 4 v 34 w(StringStats)51 b Fk(f)853 639 y Fv(in)m(t)41 b Ft(c)l(ount)8 b Fl(;)880 b Fc(=)p Fk(\003)27 b Fu(Num)n(b)r(er)g(of)f(strings)j(or)e(ob)5 b(jects)30 b Fk(\003)p Fc(=)853 739 y Fv(in)m(t)41 b Ft(bytes)7 b Fl(;)897 b Fc(=)p Fk(\003)27 b Fu(Num)n(b)r(er)g(of)f(b)n (ytes)j(allo)r(cated)e Fk(\003)p Fc(=)722 839 y Fk(g)43 b(\003)p Ft(mem)p 1028 839 V 35 w(StringStats)7 b Fl(;)1671 1021 y Fu(Figure)28 b(3:)35 b Ft(mem)p 2213 1021 26 4 v 31 w(StringStats)515 1369 y Fv(1.11.9)95 b Fm(mem)p 1060 1369 30 4 v 37 w(cr)-5 b(e)g(ate)p 1343 1369 V 34 w(obje)g(cts)722 1523 y Ft(mem)p 901 1523 V 35 w(Obje)l(ct)51 b(mem)p 1389 1523 V 34 w(cr)l(e)l(ate)p 1635 1523 V 34 w(obje)l(cts)7 b Fl(\()44 b Fv(in)m(t)c Ft(size)50 b Fl(\))515 1694 y Ft(mem)p 694 1694 26 4 v 30 w(cr)l(e)l(ate)p 936 1694 V 30 w(obje)l(cts)34 b Fu(creates)e(a)27 b(memory)c(storage)28 b(ob)5 b(ject)29 b(for)e(ob)5 b(ject)28 b(of)f Ft(size)33 b Fu(b)n(ytes.)515 1910 y Fv(1.11.10)95 b Fm(mem)p 1108 1910 30 4 v 36 w(destr)-5 b(oy)p 1443 1910 V 35 w(obje)g(cts)722 2063 y Fv(v)m(oid)42 b Ft(mem)p 1120 2063 V 35 w(destr)l(oy)p 1411 2063 V 34 w(obje)l(cts)7 b Fl(\()44 b Ft(mem)p 1942 2063 V 34 w(Obje)l(ct)51 b(info)e Fl(\))515 2234 y Ft(mem)p 694 2234 26 4 v 30 w(destr)l(oy)p 980 2234 V 30 w(obje)l(cts)44 b Fu(destro)n(ys)39 b(the)f(memory)32 b(ob)5 b(ject)38 b(returned)i(from)34 b Ft(mem)p 3096 2234 V 31 w(cr)l(e)l(ate)p 3339 2234 V 29 w(obje)l(cts)p Fu(.)64 b(All)515 2334 y(memory)32 b(if)j(freed,)40 b(including)35 b(that)i(used)i(for)d(the)i (ob)5 b(ject.)65 b(Therefore,)41 b(an)n(y)36 b(p)r(oin)n(ters)i(to)f (ob)5 b(jects)515 2433 y(stored)29 b(b)n(y)f Ft(info)33 b Fu(will)25 b(b)r(e)k(left)e(dangling.)515 2649 y Fv(1.11.11)95 b Fm(mem)p 1108 2649 30 4 v 36 w(get)p 1264 2649 V 36 w(obje)-5 b(ct)722 2802 y Fv(v)m(oid)42 b Fk(\003)p Ft(mem)p 1162 2802 V 34 w(get)p 1300 2802 V 35 w(obje)l(ct)8 b Fl(\()44 b Ft(mem)p 1799 2802 V 34 w(Obje)l(ct)51 b(info)e Fl(\))515 2973 y Ft(mem)p 694 2973 26 4 v 30 w(get)p 828 2973 V 31 w(obje)l(ct)39 b Fu(returns)34 b(a)d(p)r(oin)n(ter)h(to)g (a)e(blo)r(c)n(k)h(of)g(memory)26 b(whic)n(h)31 b(is)h Ft(size)37 b Fu(b)n(ytes)c(long)c(\(as)j(sp)r(ec-)515 3073 y(i\014ed)i(in)f(the)j(call)c(to)i Ft(mem)p 1399 3073 V 30 w(cr)l(e)l(ate)p 1641 3073 V 30 w(obje)l(cts)7 b Fu(\).)55 b(This)34 b(blo)r(c)n(k)f(is)h(either)i(newly)e(allo)r (cated)f(memory)-7 b(,)30 b(or)515 3173 y(is)35 b(memory)c(whic)n(h)36 b(w)n(as)g(previously)g(allo)r(cated)f(b)n(y)g Ft(mem)p 2418 3173 V 31 w(get)p 2553 3173 V 30 w(obje)l(ct)44 b Fu(and)35 b(subsequen)n(tly)k(freed)e(b)n(y)515 3272 y Ft(mem)p 694 3272 V 30 w(fr)l(e)l(e)p 854 3272 V 29 w(obje)l(ct)p Fu(.)515 3488 y Fv(1.11.12)95 b Fm(mem)p 1108 3488 30 4 v 36 w(get)p 1264 3488 V 36 w(empty)p 1550 3488 V 36 w(obje)-5 b(ct)722 3641 y Fv(v)m(oid)42 b Fk(\003)p Ft(mem)p 1162 3641 V 34 w(get)p 1300 3641 V 35 w(empty)p 1551 3641 V 35 w(obje)l(ct)8 b Fl(\()44 b Ft(mem)p 2050 3641 V 34 w(Obje)l(ct)51 b(info)e Fl(\))515 3812 y Ft(mem)p 694 3812 26 4 v 30 w(get)p 828 3812 V 31 w(empty)p 1075 3812 V 31 w(obje)l(ct)41 b Fu(is)34 b(exactly)h(lik)n(e)d Ft(mem)p 2068 3812 V 31 w(get)p 2203 3812 V 30 w(obje)l(ct)p Fu(,)j(except)i(the)e(memory)29 b(asso)r(ciated)36 b(with)515 3912 y(the)29 b(ob)5 b(ject)28 b(is)g(set)h(to)f(all)d(zeros.)515 4128 y Fv(1.11.13)95 b Fm(mem)p 1108 4128 30 4 v 36 w(fr)-5 b(e)g(e)p 1298 4128 V 35 w(obje)g(ct)722 4281 y Fv(v)m(oid)42 b Ft(mem)p 1120 4281 V 35 w(fr)l(e)l(e)p 1285 4281 V 33 w(obje)l(ct)8 b Fl(\()43 b Ft(mem)p 1781 4281 V 35 w(Obje)l(ct)51 b(info)p Fl(,)42 b Fv(v)m(oid)g Fk(\003)p Ft(obj)55 b Fl(\))515 4452 y Ft(mem)p 694 4452 26 4 v 30 w(fr)l(e)l(e)p 854 4452 V 29 w(obje)l(ct)28 b Fu(\\frees")22 b(the)g(ob)5 b(ject,)21 b Ft(obj)p Fu(,)g(whic)n(h)g(w)n(as)f(previously)g(obtained) g(from)d Ft(mem)p 3410 4452 V 31 w(get)p 3545 4452 V 30 w(obje)l(ct)p Fu(.)515 4552 y(The)22 b(memory)16 b(asso)r(ciated)22 b(with)f(the)h(ob)5 b(ject)21 b(is)g(not)g(actually)e(freed,)k(but)f (the)g(ob)5 b(ject)22 b(p)r(oin)n(ter)f(is)g(stored)515 4651 y(on)27 b(a)g(stac)n(k,)h(and)f(is)h(a)n(v)-5 b(ailable)24 b(for)j(subsequen)n(t)k(calls)c(to)h Ft(mem)p 2539 4651 V 30 w(get)p 2673 4651 V 31 w(obje)l(ct)p Fu(.)2115 5255 y(21)p eop %%Page: 22 22 22 21 bop 515 523 a Fv(1.11.14)95 b Fm(mem)p 1108 523 30 4 v 36 w(get)p 1264 523 V 36 w(obje)-5 b(ct)p 1539 523 V 35 w(stats)722 676 y Ft(mem)p 901 676 V 35 w(Obje)l(ctStats)50 b(mem)p 1566 676 V 34 w(get)p 1704 676 V 35 w(obje)l(ct)p 1945 676 V 35 w(stats)7 b Fl(\()43 b Ft(mem)p 2402 676 V 35 w(Obje)l(ct)50 b(info)f Fl(\))515 847 y Ft(mem)p 694 847 26 4 v 30 w(get)p 828 847 V 31 w(obje)l(ct)p 1065 847 V 30 w(stats)39 b Fu(returns)d(statistics)e(ab)r(out)e(the)i (memory)27 b(ob)5 b(ject)34 b(p)r(oin)n(ted)e(to)g(b)n(y)h Ft(info)p Fu(.)50 b(The)515 947 y Ft(mem)p 694 947 V 30 w(Obje)l(ctStats)34 b Fu(structure)e(is)c(sho)n(wn)f(in)g(Figure)h (4.)722 1162 y Fv(t)m(yp)s(edef)49 b(struct)41 b Ft(mem)p 1555 1162 30 4 v 34 w(Obje)l(ctStats)50 b Fk(f)853 1262 y Fv(in)m(t)41 b Ft(total)9 b Fl(;)911 b Fc(=)p Fk(\003)27 b Fu(T)-7 b(otal)26 b(ob)5 b(jects)29 b(requested)j Fk(\003)p Fc(=)853 1362 y Fv(in)m(t)41 b Ft(use)l(d)9 b Fl(;)919 b Fc(=)p Fk(\003)27 b Fu(T)-7 b(otal)26 b(curren)n(tly)j(in)e(use)j Fk(\003)p Fc(=)853 1461 y Fv(in)m(t)41 b Ft(r)l(euse)l(d)9 b Fl(;)849 b Fc(=)p Fk(\003)27 b Fu(T)-7 b(otal)26 b(reused)31 b Fk(\003)p Fc(=)853 1561 y Fv(in)m(t)41 b Ft(size)6 b Fl(;)944 b Fc(=)p Fk(\003)27 b Fu(Size)h(of)f(eac)n(h)i(ob)5 b(ject)28 b Fk(\003)p Fc(=)722 1661 y Fk(g)43 b(\003)p Ft(mem)p 1028 1661 V 35 w(Obje)l(ctStats)7 b Fl(;)1667 1843 y Fu(Figure)28 b(4:)35 b Ft(mem)p 2209 1843 26 4 v 31 w(Obje)l(ctStats)515 2242 y Fv(1.11.15)95 b Fm(mem)p 1108 2242 30 4 v 36 w(print)p 1352 2242 V 34 w(obje)-5 b(ct)p 1625 2242 V 34 w(stats)722 2395 y Fv(v)m(oid)42 b Ft(mem)p 1120 2395 V 35 w(print)p 1333 2395 V 34 w(obje)l(ct)p 1573 2395 V 34 w(stats)7 b Fl(\()43 b Ft(mem)p 2029 2395 V 35 w(Obje)l(ct)51 b(info)p Fl(,)42 b Ft(FILE)55 b Fk(\003)p Ft(str)l(e)l(am)48 b Fl(\))515 2566 y Ft(mem)p 694 2566 26 4 v 30 w(print)p 902 2566 V 30 w(obje)l(ct)p 1138 2566 V 30 w(stats)30 b Fu(prin)n(ts)24 b(the)h(statistics)g(for)e(the)h (memory)19 b(ob)5 b(ject)24 b(p)r(oin)n(ted)g(to)f(b)n(y)g Ft(info)29 b Fu(on)23 b(the)515 2666 y(sp)r(eci\014ed)31 b Ft(str)l(e)l(am)p Fu(.)j(If)27 b Ft(str)l(e)l(am)33 b Fu(is)27 b Fv(NULL)p Fu(,)f(then)j Fv(stdout)24 b Fu(will)g(b)r(e)29 b(used.)515 2898 y Fn(1.12)111 b(P)m(arsing)38 b(\(and)g(Lexing\))c (Supp)s(ort)515 3051 y Fv(1.12.1)95 b Fm(prs)p 992 3051 30 4 v 35 w(set)p 1143 3051 V 36 w(debug)722 3205 y Fv(v)m(oid)42 b Ft(prs)p 1058 3205 V 34 w(set)p 1192 3205 V 35 w(debug)7 b Fl(\()45 b Fv(in)m(t)c Ft(debug)p 1869 3205 V 36 w(\015ag)53 b Fl(\))515 3376 y Ft(prs)p 632 3376 26 4 v 30 w(set)p 762 3376 V 30 w(debug)37 b Fu(sp)r(eci\014es)31 b(the)e(v)-5 b(alue)27 b(of)g Ft(yyerr)l(or)35 b Fu(that)28 b Ft(prs)p 2393 3376 V 29 w(\014le)34 b Fu(will)25 b(use.)515 3591 y Fv(1.12.2)95 b Fm(prs)p 992 3591 30 4 v 35 w(set)p 1143 3591 V 36 w(cpp)p 1323 3591 V 33 w(options)722 3745 y Fv(v)m(oid)42 b Ft(prs)p 1058 3745 V 34 w(set)p 1192 3745 V 35 w(cpp)p 1349 3745 V 35 w(options)7 b Fl(\()45 b Fv(const)d(c)m(har)h Fk(\003)p Ft(cpp)p 2376 3745 V 35 w(options)52 b Fl(\))515 3916 y Ft(prs)p 632 3916 26 4 v 30 w(set)p 762 3916 V 30 w(cpp)p 914 3916 V 32 w(options)39 b Fu(sets)34 b(the)f(options)f(for)f Ft(cpp)38 b Fu(to)31 b Ft(cpp)p 2372 3916 V 32 w(options)p Fu(,)i(ensuring)f (that)g Ft(prs)p 3353 3916 V 30 w(\014le)38 b Fu(will)29 b(use)515 4015 y Ft(cpp)34 b Fu(as)28 b(a)f(\014lter.)37 b(If)27 b Ft(cpp)p 1283 4015 V 31 w(options)36 b Fu(is)27 b Fv(NULL)p Fu(,)f(then)j Ft(cpp)34 b Fu(will)25 b(not)i(b)r(e)i(used)h (at)e(a)f(\014lter.)515 4231 y Fv(1.12.3)95 b Fm(prs)p 992 4231 30 4 v 35 w(\014le)722 4384 y Fv(v)m(oid)42 b Ft(prs)p 1058 4384 V 34 w(\014le)6 b Fl(\()44 b Fv(const)e(c)m(har)h Fk(\003)p Ft(\014lename)51 b Fl(\))515 4556 y Ft(prs)p 632 4556 26 4 v 30 w(\014le)34 b Fu(calls)28 b(op)r(ens)i Ft(\014lename)36 b Fu(for)28 b(input,)g(sets)j Ft(yyerr)l(or)k Fu(to)28 b(the)i(v)-5 b(alue)28 b(sp)r(eci\014ed)k(b)n(y)c Ft(prs)p 3419 4556 V 30 w(set)p 3549 4556 V 30 w(debug)p Fu(,)515 4655 y(and)f(calls)g Ft(yyp)l(arse)p Fu(,)g(p)r(erhaps)j (using)e Ft(cpp)33 b Fu(as)28 b(an)g(input)f(\014lter.)639 4755 y(A)39 b(similar)34 b(function)k(should)h(deal)f(with)g(m)n (ultiple)c(parsers)42 b(in)c(the)i(same)d(program,)h(but)h(this)515 4854 y(has)31 b(not)h(b)r(een)h(implemen)n(ted.)42 b(Also,)31 b(either)i(this)f(function)f(or)g(another)h(function)f(should)g(start)h (an)515 4954 y(in)n(teractiv)n(e)c(parse)i(session.)2115 5255 y(22)p eop %%Page: 23 23 23 22 bop 515 523 a Fv(1.12.4)95 b Fm(prs)p 992 523 30 4 v 35 w(\014le)p 1151 523 V 36 w(no)-5 b(cpp)722 676 y Fv(v)m(oid)42 b Ft(prs)p 1058 676 V 34 w(\014le)p 1198 676 V 35 w(no)l(cpp)5 b Fl(\()46 b Fv(const)c(c)m(har)h Fk(\003)p Ft(\014lename)50 b Fl(\))515 847 y Ft(prs)p 632 847 26 4 v 30 w(\014le)p 768 847 V 30 w(no)l(cpp)26 b Fu(calls)18 b(op)r(ens)i Ft(\014lename)26 b Fu(for)18 b(input,)h(sets)i Ft(yyerr)l(or)k Fu(to)18 b(the)i(v)-5 b(alue)18 b(sp)r(eci\014ed)k(b)n(y)c Ft(prs)p 3528 847 V 30 w(set)p 3658 847 V 30 w(debug)p Fu(,)p 3907 864 42 74 v 515 947 a(and)27 b(calls)g Ft(yyp)l(arse)p Fu(.)639 1047 y(A)39 b(similar)34 b(function)k(should)h(deal)f(with)g(m)n (ultiple)c(parsers)42 b(in)c(the)i(same)d(program,)h(but)h(this)515 1146 y(has)31 b(not)h(b)r(een)h(implemen)n(ted.)42 b(Also,)31 b(either)i(this)f(function)f(or)g(another)h(function)f(should)g(start)h (an)515 1246 y(in)n(teractiv)n(e)c(parse)i(session.)515 1462 y Fv(1.12.5)95 b Fm(prs)p 992 1462 30 4 v 35 w(str)-5 b(e)g(am)722 1615 y Fv(v)m(oid)42 b Ft(prs)p 1058 1615 V 34 w(str)l(e)l(am)6 b Fl(\()43 b Ft(FILE)54 b Fk(\003)p Ft(str)p Fl(,)41 b Fv(const)g(c)m(har)i Fk(\003)p Ft(name)51 b Fl(\))515 1786 y Ft(prs)p 632 1786 26 4 v 30 w(str)l(e)l(am)32 b Fu(parses)f(an)c(already)g(op)r(ened)j(stream)c(called)i Ft(name)p Fu(.)515 2002 y Fv(1.12.6)95 b Fm(prs)p 992 2002 30 4 v 35 w(make)p 1243 2002 V 35 w(inte)-5 b(ger)722 2155 y Fv(in)m(t)41 b Ft(prs)p 997 2155 V 34 w(make)p 1217 2155 V 36 w(inte)l(ger)9 b Fl(\()42 b Fv(const)g(c)m(har)h Fk(\003)p Ft(string)p Fl(,)e Fv(in)m(t)g Ft(length)50 b Fl(\))515 2326 y Ft(prs)p 632 2326 26 4 v 30 w(make)p 848 2326 V 31 w(inte)l(ger)35 b Fu(con)n(v)n(erts)30 b(a)d Ft(string)33 b Fu(of)27 b(sp)r(eci\014ed)j Ft(length)k Fu(to)27 b(an)g(in)n(teger.)37 b(This)28 b(function)e(is)i(useful)515 2426 y(in)f(scanners)k(that)d(do)f(not)h Fv(NULL)p Fu(-terminate)d Ft(yytext)p Fu(.)515 2642 y Fv(1.12.7)95 b Fm(prs)p 992 2642 30 4 v 35 w(make)p 1243 2642 V 35 w(double)722 2795 y Fv(double)39 b Ft(prs)p 1160 2795 V 34 w(make)p 1380 2795 V 36 w(double)6 b Fl(\()45 b Fv(const)c(c)m(har)j Fk(\003)p Ft(string)p Fl(,)d Fv(in)m(t)f Ft(length)50 b Fl(\))515 2966 y Ft(prs)p 632 2966 26 4 v 30 w(make)p 848 2966 V 31 w(double)33 b Fu(con)n(v)n(erts)28 b(a)d Ft(string)32 b Fu(of)24 b(sp)r(eci\014ed)29 b Ft(length)k Fu(to)25 b(a)g(double.)36 b(This)25 b(function)g(is)h(useful)g(in)515 3066 y(scanners)31 b(that)d(do)f(not)h Fv(NULL)p Fu(-terminate)d Ft(yytext)p Fu(.)515 3298 y Fn(1.13)111 b(Pro)s(cess)37 b(Managemen)m(t)e(Routines)515 3451 y Fu(The)30 b(pro)r(cess)j (managemen)n(t)24 b(routines)30 b(are)g(designed)h(to)e(facilitate)e (the)j(creation)g(and)f(managemen)n(t)515 3551 y(of)20 b(c)n(hild)g(pro)r(cesses,)28 b(copro)r(cesses,)f(and)21 b(asso)r(ciated)i(pip)r(elines)f(and)f(I/O.)g(Some)e(supp)r(ort)k(for)e (daemons)515 3651 y(and)27 b(so)r(c)n(k)n(et)j(connections)g(is)d(also) g(pro)n(vided.)515 3883 y Fn(1.14)111 b(Prime)33 b(Num)m(b)s(er)h (Routines)515 4036 y Fu(These)j(routines)g(are)e(used)i(to)e(\014nd)g (the)i(next)f(larger)f(prime)e(n)n(um)n(b)r(er)g(for)h(expansion)h(of)f (the)i(hash)515 4136 y(tables)25 b(used)h(b)n(y)f(the)h(hash)f(and)f (set)j(routines.)36 b(These)27 b(routines)f(are)f(only)f(useful)h(for)f (32-bit)e(unsigned)515 4235 y(v)-5 b(alues.)515 4451 y Fv(1.14.1)95 b Fm(prm)p 1030 4451 30 4 v 35 w(is)p 1135 4451 V 35 w(prime)722 4604 y Fv(in)m(t)41 b Ft(prm)p 1031 4604 V 34 w(is)p 1125 4604 V 34 w(prime)6 b Fl(\()43 b Fv(unsigned)38 b(in)m(t)i Ft(value)51 b Fl(\))515 4776 y Ft(prm)p 666 4776 26 4 v 30 w(is)p 756 4776 V 30 w(prime)26 b Fu(returns)e(1)d(if)f Ft(value)28 b Fu(is)21 b(prime;)f(0)h (otherwise.)35 b(Primalit)n(y)16 b(is)21 b(determined)h(b)n(y)f (testings)h(all)515 4875 y(o)r(dd)27 b(divisors)g(less)h(than)g(the)g (square)h(ro)r(ot)e(of)f Ft(value)p Fu(.)37 b(F)-7 b(or)27 b(32-bit)e(in)n(tegers,)j(this)g(ma)n(y)23 b(mean)i(that)i(w)n(e)515 4986 y(will)f(test)31 b(ab)r(out)1085 4905 y Fb(p)p 1139 4905 179 3 v 48 x Fi(2)1173 4937 y Fa(32)1233 4953 y Fb(\000)p Fi(1)p 1085 4967 234 4 v 1185 5015 a(2)1353 4986 y Fu(=)26 b(32768)h(o)r(dd)i(v)-5 b(alues)29 b(instead)h(of)e(the) i(6542)d(primes)h(that)h(w)n(ould)f(actually)2115 5255 y(23)p eop %%Page: 24 24 24 23 bop 515 523 a Fu(need)29 b(to)e(b)r(e)i(tested.)39 b(\(A)27 b(table)h(of)e(pre-computed)h(primes)f(using)h(less)i(than)e (26kB)g(of)f(memory)c(could)515 623 y(b)r(e)29 b(used)g(to)f(reco)n(v)n (er)i(this)e(factor)g(of)e(5)h(p)r(erformance)h(loss.\))515 838 y Fv(1.14.2)95 b Fm(prm)p 1030 838 30 4 v 35 w(next)p 1241 838 V 36 w(prime)722 992 y Fv(unsigned)38 b(long)k Ft(prm)p 1505 992 V 34 w(next)p 1689 992 V 36 w(prime)6 b Fl(\()43 b Fv(unsigned)37 b(in)m(t)k Ft(start)50 b Fl(\))515 1163 y Ft(prm)p 666 1163 26 4 v 30 w(next)p 846 1163 V 31 w(prime)33 b Fu(returns)e(the)e(smallest)c(o)r(dd)j (prime)d(greater)30 b(than)e(or)g(equal)f(to)g Ft(start)p Fu(.)515 1395 y Fn(1.15)111 b(Set)36 b(Routines)515 1548 y Fu(The)f(set)h(implemen)n(tatio)o(n)29 b(is)34 b(similar)29 b(to)34 b(the)i(hash)f(table)f(implem)o(en)n(tation,)29 b(except)37 b(that)d(the)i(set)515 1648 y(ob)5 b(ject)27 b(do)r(es)g(not)g(asso)r(ciate)g(a)f Ft(datum)33 b Fu(with)26 b(a)g Ft(key)p Fu(.)36 b(F)-7 b(or)26 b(sets,)j(k)n(eys)e(are)g(called) f(elemen)n(ts.)35 b(All)25 b(of)g(the)515 1748 y(hash)i(table)f (functions)h(are)h(supp)r(orted,)g(with)e(the)i(addition)c(of)i(a)g (mem)n(b)r(ership)d(test)29 b(and)d(sev)n(eral)i(set)515 1847 y(op)r(erations.)639 1947 y(The)22 b(underlying)f(data)g (structure)k(is)c(a)g(hash)g(table)g(of)f(prime)f(length,)j(with)e (self-organizing)f(link)n(ed)515 2047 y(lists)25 b([Kn)n(uth73)o(,)f (pp.)g(398{9])e(used)k(for)f(collision)d(resolution.)34 b(The)26 b(hash)g(table)e(automatically)19 b(gro)n(ws)515 2146 y(as)28 b(necessary)k(to)27 b(preserv)n(e)32 b(e\016cien)n(t)c (access.)515 2362 y Fv(1.15.1)95 b Fm(set)p 976 2362 30 4 v 36 w(cr)-5 b(e)g(ate)722 2515 y Ft(set)p 827 2515 V 35 w(Set)52 b(set)p 1126 2515 V 34 w(cr)l(e)l(ate)6 b Fl(\()43 b Ft(set)p 1553 2515 V 35 w(HashF)-6 b(unction)52 b(hash)p Fl(,)44 b Ft(set)p 2466 2515 V 34 w(Comp)l(ar)l(eF)-6 b(unction)51 b(c)l(omp)l(ar)l(e)f Fl(\))515 2686 y Fu(The)28 b Ft(set)p 790 2686 26 4 v 31 w(cr)l(e)l(ate)33 b Fu(function)27 b(initilizes)f(a)h(set)j(ob)5 b(ject.)36 b(Elemen)n(ts)27 b(are)i(p)r(oin)n(ters)g(to)e Fv(v)m(oid)p Fu(.)639 2786 y(The)42 b(in)n(ternal)f(represen)n(tation)j(of)c(the)i(set)h(will)c (gro)n(w)h(automatically)35 b(when)42 b(an)f(insertion)g(is)515 2886 y(p)r(erformed)27 b(and)g(the)i(table)f(is)f(more)f(than)i(half)e (full.)639 2985 y(The)g Ft(hash)32 b Fu(function)24 b(should)g(tak)n(e) h(a)f(p)r(oin)n(ter)h(to)f(a)g Ft(elem)31 b Fu(and)24 b(return)j(an)d Fv(unsigned)e(in)m(t)p Fu(.)32 b(If)24 b Ft(hash)515 3085 y Fu(is)32 b Fv(NULL)p Fu(,)e(then)k(the)f Ft(elem)38 b Fu(is)33 b(assumed)e(to)h(b)r(e)i(a)e(p)r(oin)n(ter)g(to)g (a)g(n)n(ull-terminated)d(string,)k(and)f(the)515 3185 y(function)27 b(sho)n(wn)h(in)f(Figure)h(1)f(will)e(b)r(e)k(used)g(for) e Ft(hash)p Fu(.)639 3284 y(The)j Ft(c)l(omp)l(ar)l(e)35 b Fu(function)28 b(should)g(tak)n(e)h(a)g(pair)f(of)f(p)r(oin)n(ters)j (to)f(elemen)n(ts)f(and)h(return)i(zero)g(if)c(the)515 3384 y(elemen)n(ts)32 b(are)i(the)f(same)e(and)i(non-zero)g(if)e(they)j (are)g(di\013eren)n(t.)52 b(If)32 b Ft(c)l(omp)l(ar)l(e)39 b Fu(is)32 b Fv(NULL)p Fu(,)f(then)j(the)515 3483 y(elemen)n(ts)29 b(are)i(assumed)e(to)h(p)r(oin)n(t)f(to)g(n)n(ull-terminated)e (strings,)j(and)g(the)h Ft(str)l(cmp)i Fu(function)d(will)d(b)r(e)515 3583 y(used)i(for)e Ft(c)l(omp)l(ar)l(e)p Fu(.)639 3683 y(Additionally)-7 b(,)23 b(the)29 b Ft(hsh)p 1401 3683 V 31 w(p)l(ointer)p 1686 3683 V 30 w(hash)35 b Fu(and)27 b Ft(hsh)p 2190 3683 V 32 w(p)l(ointer)p 2476 3683 V 30 w(c)l(omp)l(ar)l(e)33 b Fu(functions)28 b(are)g(a)n(v)-5 b(ailable)24 b(and)515 3782 y(can)g(b)r(e)h(used)g(to)f(treat)h(the)g Ft(value)30 b Fu(of)23 b(the)i Fv(v)m(oid)c Fu(p)r(oin)n(ter)k(as)f (the)g(elemen)n(t.)34 b(These)26 b(functions)e(are)h(often)515 3882 y(useful)j(for)f(main)n(taini)o(ng)22 b(sets)30 b(of)d(ob)5 b(jects.)515 4098 y Fv(1.15.2)95 b Fm(set)p 976 4098 30 4 v 36 w(destr)-5 b(oy)722 4251 y Fv(v)m(oid)42 b Ft(set)p 1046 4251 V 34 w(destr)l(oy)7 b Fl(\()44 b Ft(set)p 1519 4251 V 35 w(Set)52 b(set)f Fl(\))515 4422 y Ft(set)p 620 4422 26 4 v 30 w(destr)l(oy)35 b Fu(frees)30 b(all)25 b(of)i(the)i(memory)22 b(asso)r(ciated)30 b(with)d(the)i(set)g (ob)5 b(ject.)639 4522 y(The)36 b(memory)31 b(used)37 b(b)n(y)e(elemen)n(ts)g(is)g Ft(not)43 b Fu(freed|this)37 b(memory)30 b(is)35 b(the)h(resp)r(onsibilit)n(y)f(of)f(the)515 4621 y(user.)46 b(Ho)n(w)n(ev)n(er,)31 b(a)e(call)g(to)h Ft(set)p 1527 4621 V 30 w(iter)l(ate)35 b Fu(can)c(b)r(e)g(used)h(to)f (free)g(this)g(memory)25 b Ft(imme)l(diately)37 b Fu(b)r(efore)31 b(a)515 4721 y(call)26 b(to)h Ft(set)p 873 4721 V 31 w(destr)l(oy)p Fu(.)2115 5255 y(24)p eop %%Page: 25 25 25 24 bop 515 523 a Fv(1.15.3)95 b Fm(set)p 976 523 30 4 v 36 w(insert)722 676 y Fv(in)m(t)41 b Ft(set)p 985 676 V 34 w(insert)8 b Fl(\()43 b Ft(set)p 1410 676 V 35 w(Set)51 b(set)p Fl(,)43 b Fv(const)e(v)m(oid)h Fk(\003)p Ft(elem)49 b Fl(\))515 847 y Ft(set)p 620 847 26 4 v 30 w(insert)34 b Fu(inserts)d(a)c(new)i Ft(elem)k Fu(in)n(to)27 b(the)i Ft(set)p Fu(.)36 b(If)27 b(the)i(insertion)f(is)f(successful,)k (zero)e(is)f(returned.)40 b(If)515 947 y(the)29 b Ft(elem)k Fu(already)27 b(exists,)i(1)e(is)g(returned.)639 1047 y(If)e(the)h(in)n(ternal)f(represen)n(tation)j(of)c(the)j(set)g(b)r (ecomes)f(more)d(than)i(half)f(full,)e(its)j(size)i(is)e(increased)515 1146 y(automatically)-7 b(.)56 b(A)n(t)36 b(presen)n(t,)41 b(this)c(requires)i(that)e(all)d(of)h(the)j(elemen)n(t)d(p)r(oin)n (ters)j(are)f(copied)g(in)n(to)515 1246 y(a)32 b(new)j(set.)54 b(Rehashing)32 b(is)h(not)g(required,)j(ho)n(w)n(ev)n(er,)e(since)h (the)g(hash)e(v)-5 b(alues)34 b(are)g(stored)h(for)e(eac)n(h)515 1346 y(elemen)n(t.)515 1561 y Fv(1.15.4)95 b Fm(set)p 976 1561 30 4 v 36 w(delete)722 1715 y Fv(in)m(t)41 b Ft(set)p 985 1715 V 34 w(delete)6 b Fl(\()44 b Ft(set)p 1407 1715 V 35 w(Set)52 b(set)p Fl(,)42 b Fv(const)g(v)m(oid)f Fk(\003)p Ft(elem)49 b Fl(\))515 1886 y Ft(set)p 620 1886 26 4 v 30 w(delete)25 b Fu(remo)n(v)n(es)19 b(an)g Ft(elem)25 b Fu(from)16 b(the)21 b Ft(set)p Fu(.)32 b(Zero)21 b(is)f(returned)i(if)c(the)j Ft(elem)k Fu(w)n(as)19 b(presen)n(t.)37 b(Otherwise,)515 1985 y(1)27 b(is)g(returned.)515 2201 y Fv(1.15.5)95 b Fm(set)p 976 2201 30 4 v 36 w(memb)-5 b(er)722 2354 y Fv(in)m(t)41 b Ft(set)p 985 2354 V 34 w(memb)l(er)9 b Fl(\()43 b Ft(set)p 1485 2354 V 35 w(Set)52 b(set)p Fl(,)42 b Fv(const)g(v)m(oid)f Fk(\003)p Ft(elem)49 b Fl(\))515 2525 y Ft(set)p 620 2525 26 4 v 30 w(memb)l(er)36 b Fu(returns)31 b(1)c(if)f Ft(elem)33 b Fu(is)28 b(in)f Ft(set)p Fu(.)35 b(Otherwise,)30 b(zero)g(is)d(returned.)515 2741 y Fv(1.15.6)95 b Fm(set)p 976 2741 30 4 v 36 w(iter)-5 b(ate)722 2895 y Fv(in)m(t)41 b Ft(set)p 985 2895 V 34 w(iter)l(ate)6 b Fl(\()43 b Ft(set)p 1432 2895 V 34 w(Set)52 b(set)p Fl(,)1463 2994 y Fv(in)m(t)41 b Fl(\()p Fk(\003)p Ft(iter)l(ator)9 b Fl(\)\()41 b Fv(const)h(v)m(oid)f Fk(\003)p Ft(elem)49 b Fl(\))44 b(\))515 3165 y Ft(set)p 620 3165 26 4 v 30 w(iter)l(ate)30 b Fu(is)25 b(used)i(to)f(iterate)h (a)e(function)g(o)n(v)n(er)g(ev)n(ery)i Ft(elem)32 b Fu(in)24 b(the)j Ft(set)p Fu(.)35 b(The)26 b(function,)f Ft(iter)l(ator)p Fu(,)d(is)515 3265 y(passed)33 b(eac)n(h)f Ft(elem)p Fu(.)45 b(If)30 b Ft(iter)l(ator)38 b Fu(returns)c(a)c (non-zero)j(v)-5 b(alue,)30 b(the)i(iterations)f(stop,)h(and)f Ft(set)p 3544 3265 V 30 w(iter)l(ate)515 3365 y Fu(returns.)37 b(Note)23 b(that)f(the)h(elemen)n(ts)f(are)g(in)f(some)g(arbitrary)g (order,)j(and)e(that)g(this)g(order)h(ma)n(y)18 b(c)n(hange)515 3464 y(b)r(et)n(w)n(een)30 b(t)n(w)n(o)d(successiv)n(e)32 b(calls)27 b(to)h Ft(set)p 1768 3464 V 30 w(iter)l(ate)p Fu(.)515 3680 y Fv(1.15.7)95 b Fm(set)p 976 3680 30 4 v 36 w(iter)-5 b(ate)p 1281 3680 V 34 w(ar)g(g)722 3833 y Fv(in)m(t)41 b Ft(set)p 985 3833 V 34 w(iter)l(ate)p 1251 3833 V 33 w(ar)l(g)7 b Fl(\()44 b Ft(set)p 1579 3833 V 35 w(Set)51 b(set)p Fl(,)1638 3933 y Fv(in)m(t)40 b Fl(\()p Fk(\003)p Ft(iter)l(ator)9 b Fl(\)\()42 b Fv(const)f(v)m(oid) h Fk(\003)p Ft(elem)p Fl(,)f Fv(v)m(oid)h Fk(\003)p Ft(ar)l(g)50 b Fl(\),)1638 4032 y Fv(v)m(oid)41 b Fk(\003)p Ft(ar)l(g)50 b Fl(\))515 4204 y Ft(set)p 620 4204 26 4 v 30 w(iter)l(ate)p 882 4204 V 29 w(ar)l(g)28 b Fu(is)21 b(used)i(to)d(iterate)j(a)e (function)f(o)n(v)n(er)h(ev)n(ery)i Ft(elem)k Fu(in)20 b(the)j Ft(set)p Fu(.)33 b(The)22 b(function,)f Ft(iter)l(ator)p Fu(,)515 4303 y(is)k(passed)i(eac)n(h)f Ft(elem)p Fu(.)35 b(If)24 b Ft(iter)l(ator)32 b Fu(returns)c(a)d(non-zero)h(v)-5 b(alue,)25 b(the)h(iterations)f(stop,)h(and)f Ft(set)p 3544 4303 V 30 w(iter)l(ate)515 4403 y Fu(returns.)37 b(Note)23 b(that)f(the)h(elemen)n(ts)f(are)g(in)f(some)g(arbitrary)g (order,)j(and)e(that)g(this)g(order)h(ma)n(y)18 b(c)n(hange)515 4502 y(b)r(et)n(w)n(een)30 b(t)n(w)n(o)d(successiv)n(e)32 b(calls)27 b(to)h Ft(set)p 1768 4502 V 30 w(iter)l(ate)p Fu(.)515 4718 y Fv(1.15.8)95 b Fm(set)p 976 4718 30 4 v 36 w(init)p 1158 4718 V 34 w(p)-5 b(osition)722 4871 y Ft(set)p 827 4871 V 35 w(Position)50 b(set)p 1312 4871 V 35 w(init)p 1473 4871 V 34 w(p)l(osition)6 b Fl(\()44 b Ft(set)p 1971 4871 V 34 w(Set)52 b(set)g Fl(\))2115 5255 y Fu(25)p eop %%Page: 26 26 26 25 bop 515 523 a Ft(set)p 620 523 26 4 v 30 w(init)p 776 523 V 30 w(p)l(osition)36 b Fu(returns)d(a)c(p)r(osition)f(mark)n (er)g(for)h(some)f(arbitary)h(\014rst)j(elemen)n(t)c(in)h(the)i(set.)44 b(This)515 623 y(mark)n(er)26 b(can)i(b)r(e)h(used)g(with)e Ft(set)p 1545 623 V 31 w(next)p 1726 623 V 31 w(p)l(osition)34 b Fu(and)28 b Ft(set)p 2335 623 V 30 w(get)p 2469 623 V 31 w(p)l(osition)p Fu(.)515 838 y Fv(1.15.9)95 b Fm(set)p 976 838 30 4 v 36 w(next)p 1188 838 V 36 w(p)-5 b(osition)722 992 y Ft(set)p 827 992 V 35 w(Position)50 b(set)p 1312 992 V 35 w(next)p 1497 992 V 35 w(p)l(osition)6 b Fl(\()45 b Ft(set)p 1997 992 V 34 w(Set)52 b(set)p Fl(,)43 b Ft(set)p 2462 992 V 34 w(Position)50 b(p)l(osition)g Fl(\))515 1163 y Ft(set)p 620 1163 26 4 v 30 w(next)p 800 1163 V 32 w(p)l(osition)31 b Fu(returns)e(a)c(p)r(osition)f(mark)n(er)g(for) h(the)h(next)h(elemen)n(t)d(in)h(the)i(set.)37 b(Elemen)n(ts)24 b(are)j(in)515 1262 y(arbitrary)g(order)j(based)f(on)e(their)h(p)r (ositions)g(in)e(the)j(hash)g(table.)515 1478 y Fv(1.15.10)95 b Fm(set)p 1024 1478 30 4 v 36 w(get)p 1180 1478 V 36 w(p)-5 b(osition)722 1631 y Fv(v)m(oid)42 b Fk(\003)p Ft(set)p 1088 1631 V 34 w(get)p 1226 1631 V 35 w(p)l(osition)6 b Fl(\()44 b Ft(set)p 1725 1631 V 35 w(Position)50 b(p)l(osition)g Fl(\))515 1803 y Ft(set)p 620 1803 26 4 v 30 w(get)p 754 1803 V 31 w(p)l(osition)31 b Fu(returns)d(the)e(elemen)n(t)d(asso)r (ciated)k(with)d(the)i Ft(p)l(osition)31 b Fu(mark)n(er,)23 b(or)h Fv(NULL)g Fu(if)f(there)515 1902 y(is)k(no)h(suc)n(h)h(elemen)n (t.)515 2118 y Fv(1.15.11)95 b Fm(set)p 1024 2118 30 4 v 36 w(r)-5 b(e)g(adonly)722 2271 y Fv(in)m(t)41 b Ft(set)p 985 2271 V 34 w(r)l(e)l(adonly)7 b Fl(\()45 b Ft(set)p 1503 2271 V 34 w(Set)52 b(set)p Fl(,)43 b Fv(in)m(t)d Ft(\015ag)53 b Fl(\))515 2442 y Ft(set)p 620 2442 26 4 v 30 w(r)l(e)l(adonly)38 b Fu(sets)33 b(the)f Ft(r)l(e)l(adonly)38 b Fu(\015ag)29 b(for)h(the)i Ft(set)38 b Fu(to)30 b Ft(\015ag)p Fu(.)46 b Ft(\015ag)39 b Fu(should)30 b(b)r(e)i(0)d(or)i(1.)44 b(The)31 b(v)-5 b(alue)30 b(of)515 2542 y(the)k(previous)h(\015ag)d(is)h(returned.)57 b(When)34 b(a)f(set)i(is)e(mark)n(ed)e(as)j(readonly)-7 b(,)34 b(self-organization)c(of)j(the)515 2642 y(buc)n(k)n(et-o)n(v)n(er\015o) n(w)27 b(lists)f(will)e(not)i(tak)n(e)h(place,)f(and)h(an)n(y)e (attempt)g(to)i(mo)r(dify)22 b(the)27 b(list)f(\(e.g.,)f(insertion)515 2741 y(or)i(deletion\))h(will)d(result)k(in)e(an)h(error.)515 2957 y Fv(1.15.12)95 b Fm(set)p 1024 2957 30 4 v 36 w(union)722 3110 y Ft(set)p 827 3110 V 35 w(Set)52 b(set)p 1126 3110 V 34 w(union)6 b Fl(\()46 b Ft(set)p 1548 3110 V 35 w(Set)52 b(set1)p Fl(,)42 b Ft(set)p 2055 3110 V 35 w(Set)52 b(set2)j Fl(\))515 3281 y Ft(set)p 620 3281 26 4 v 30 w(union)35 b Fu(returns)30 b(a)c(new)i(set)h(whic)n(h)d(is)h(the)h(union)e(of)g Ft(set1)38 b Fu(and)26 b Ft(set2)p Fu(.)36 b(Only)27 b(p)r(oin)n(ters)h(to)e(elemen)n(ts)515 3381 y(are)33 b(copied,)g Ft(not)41 b Fu(the)34 b(data)e(p)r(oin)n(ted)h(\(this)f (has)h(memory)28 b(managemen)n(t)f(implications\).)45 b(The)34 b Ft(hash)515 3481 y Fu(and)27 b Ft(c)l(omp)l(ar)l(e)34 b Fu(functions)28 b(m)n(ust)e(b)r(e)j(iden)n(tical)d(for)h(the)i(t)n(w) n(o)e(sets.)515 3696 y Fv(1.15.13)95 b Fm(set)p 1024 3696 30 4 v 36 w(inter)722 3850 y Ft(set)p 827 3850 V 35 w(Set)52 b(set)p 1126 3850 V 34 w(inter)9 b Fl(\()43 b Ft(set)p 1518 3850 V 34 w(Set)52 b(set1)p Fl(,)43 b Ft(set)p 2025 3850 V 35 w(Set)52 b(set2)j Fl(\))515 4021 y Ft(set)p 620 4021 26 4 v 30 w(inter)44 b Fu(returns)39 b(a)d(new)g(set)i(whic)n(h)e(is)g(the)h(in)n(tersection)h(of)d Ft(set1)48 b Fu(and)35 b Ft(set2)p Fu(.)61 b(Only)36 b(p)r(oin)n(ters)h(to)515 4120 y(elemen)n(ts)f(are)h(copied,)h Ft(not)45 b Fu(the)38 b(data)d(p)r(oin)n(ted)i(\(this)g(has)f(memory)c (managemen)n(t)f(implications\).)515 4220 y(The)d Ft(hash)36 b Fu(and)27 b Ft(c)l(omp)l(ar)l(e)34 b Fu(functions)28 b(m)n(ust)e(b)r(e)j(iden)n(tical)d(for)h(the)i(t)n(w)n(o)e(sets.)515 4436 y Fv(1.15.14)95 b Fm(set)p 1024 4436 30 4 v 36 w(di\013)722 4589 y Ft(set)p 827 4589 V 35 w(Set)52 b(set)p 1126 4589 V 34 w(di\013)19 b Fl(\()44 b Ft(set)p 1473 4589 V 34 w(Set)52 b(set1)p Fl(,)43 b Ft(set)p 1980 4589 V 34 w(Set)52 b(set2)j Fl(\))515 4760 y Ft(set)p 620 4760 26 4 v 30 w(di\013)46 b Fu(returns)32 b(a)27 b(new)i(set)h(whic)n(h)e(is)g(the)h (di\013erence)j(resulting)c(from)d(remo)n(ving)f(ev)n(ery)30 b(elemen)n(t)d(in)515 4860 y Ft(set2)38 b Fu(from)23 b(the)28 b(elemen)n(ts)e(in)g Ft(set1)p Fu(.)35 b(Only)27 b(p)r(oin)n(ters)g(to)g(elemen)n(ts)f(are)h(copied,)g Ft(not)35 b Fu(the)28 b(data)e(p)r(oin)n(ted)2115 5255 y(26)p eop %%Page: 27 27 27 26 bop 515 523 a Fu(\(this)36 b(has)f(memory)c(managemen)n(t)f (implications\).)54 b(The)36 b Ft(hash)43 b Fu(and)35 b Ft(c)l(omp)l(ar)l(e)42 b Fu(functions)35 b(m)n(ust)f(b)r(e)515 623 y(iden)n(tical)26 b(for)h(the)i(t)n(w)n(o)e(sets.)515 838 y Fv(1.15.15)95 b Fm(set)p 1024 838 30 4 v 36 w(e)-5 b(qual)722 992 y Fv(in)m(t)41 b Ft(set)p 985 992 V 34 w(e)l(qual)9 b Fl(\()44 b Ft(set)p 1384 992 V 35 w(Set)52 b(set1)p Fl(,)42 b Ft(set)p 1891 992 V 35 w(Set)52 b(set2)j Fl(\))515 1163 y Ft(set)p 620 1163 26 4 v 30 w(e)l(qual)41 b Fu(returns)35 b(non-zero)e(if)e Ft(set1)43 b Fu(and)32 b Ft(set2)43 b Fu(con)n(tain)32 b(the)h(same)d(n)n(um)n(b)r(er)h(of)g (elemen)n(ts,)h(and)f(all)515 1262 y(of)25 b(the)k(elemen)n(ts)d(in)g Ft(set1)38 b Fu(are)28 b(also)e(in)g Ft(set2)p Fu(.)36 b(The)27 b Ft(hash)35 b Fu(and)26 b Ft(c)l(omp)l(ar)l(e)33 b Fu(functions)27 b(m)n(ust)e(b)r(e)j(iden)n(tical)515 1362 y(for)f(the)i(t)n(w)n(o)e(sets.)515 1578 y Fv(1.15.16)95 b Fm(set)p 1024 1578 30 4 v 36 w(get)p 1180 1578 V 36 w(stats)722 1731 y Ft(set)p 827 1731 V 35 w(Stats)50 b(set)p 1190 1731 V 35 w(get)p 1329 1731 V 35 w(stats)7 b Fl(\()43 b Ft(set)p 1712 1731 V 34 w(Set)52 b(set)f Fl(\))515 1902 y Ft(set)p 620 1902 26 4 v 30 w(get)p 754 1902 V 31 w(stats)33 b Fu(returns)e(statistics)f(ab)r(out)d(the)i Ft(set)p Fu(.)36 b(The)29 b Ft(set)p 2430 1902 V 30 w(Stats)35 b Fu(structure)d(is)27 b(sho)n(wn)h(in)f(Figure)h(5.)722 2118 y Fv(t)m(yp)s(edef)49 b(struct)41 b Ft(set)p 1481 2118 30 4 v 34 w(Stats)7 b Fk(f)853 2217 y Fv(unsigned)37 b(long)42 b Ft(size)6 b Fl(;)515 b Fc(=)p Fk(\003)26 b Fu(Size)j(of)e(table)g Fk(\003)p Fc(=)853 2317 y Fv(unsigned)37 b(long)42 b Ft(r)l(esizings)7 b Fl(;)338 b Fc(=)p Fk(\003)26 b Fu(Num)n(b)r(er)h(of)g(resizings)i Fk(\003)p Fc(=)853 2417 y Fv(unsigned)37 b(long)42 b Ft(entries)7 b Fl(;)400 b Fc(=)p Fk(\003)26 b Fu(T)-7 b(otal)26 b(en)n(tries)k(in)d(table)h Fk(\003)p Fc(=)853 2516 y Fv(unsigned)37 b(long)42 b Ft(buckets)p 1747 2516 V 36 w(use)l(d)9 b Fl(;)196 b Fc(=)p Fk(\003)26 b Fu(Num)n(b)r(er)h(of)g(hash)h(buc)n(k)n(ets)i(in)d (use)i Fk(\003)p Fc(=)853 2616 y Fv(unsigned)37 b(long)42 b Ft(singletons)7 b Fl(;)292 b Fc(=)p Fk(\003)26 b Fu(Num)n(b)r(er)h (of)g(length)g(one)i(lists)e Fk(\003)p Fc(=)853 2715 y Fv(unsigned)37 b(long)42 b Ft(maximum)p 1843 2715 V 36 w(length)6 b Fl(;)43 b Fc(=)p Fk(\003)27 b Fu(Maxim)n(um)20 b(list)27 b(length)h Fk(\003)p Fc(=)853 2915 y Fv(unsigned)37 b(long)42 b Ft(r)l(etrievals)7 b Fl(;)312 b Fc(=)p Fk(\003)26 b Fu(T)-7 b(otal)26 b(n)n(um)n(b)r(er)h(of)f(retriev)-5 b(als)30 b Fk(\003)p Fc(=)853 3014 y Fv(unsigned)37 b(long)42 b Ft(hits)7 b Fl(;)516 b Fc(=)p Fk(\003)26 b Fu(Num)n(b)r(er)h(of)g (retriev)-5 b(als)29 b(from)24 b(top)k(of)e(a)i(list)e Fk(\003)p Fc(=)55 b Fd(1)r(0)853 3114 y Fv(unsigned)37 b(long)42 b Ft(misses)7 b Fl(;)412 b Fc(=)p Fk(\003)26 b Fu(Num)n(b)r(er)h(of)g(unsuccessful)k(retriev)-5 b(als)30 b Fk(\003)p Fc(=)722 3214 y Fk(g)43 b(\003)p Ft(set)p 954 3214 V 34 w(Stats)7 b Fl(;)1817 3396 y Fu(Figure)28 b(5:)36 b Ft(set)p 2286 3396 26 4 v 30 w(Stats)515 3795 y Fv(1.15.17)95 b Fm(set)p 1024 3795 30 4 v 36 w(print)p 1268 3795 V 33 w(stats)722 3948 y Fv(v)m(oid)42 b Ft(set)p 1046 3948 V 34 w(print)p 1258 3948 V 34 w(stats)7 b Fl(\()44 b Ft(set)p 1641 3948 V 34 w(Set)52 b(set)p Fl(,)42 b Ft(FILE)55 b Fk(\003)p Ft(str)l(e)l(am)48 b Fl(\))515 4119 y Ft(set)p 620 4119 26 4 v 30 w(print)p 828 4119 V 30 w(stats)30 b Fu(prin)n(ts)25 b(the)g(statistics)h(for)e Ft(set)32 b Fu(on)23 b(the)j(sp)r(eci\014ed)h Ft(str)l(e)l(am)p Fu(.)34 b(If)23 b Ft(str)l(e)l(am)29 b Fu(is)24 b Fv(NULL)p Fu(,)f(then)515 4219 y Fv(stdout)g Fu(will)i(b)r(e)k(used.)515 4451 y Fn(1.16)111 b(Skip)36 b(List)g(Routines)515 4604 y Fu(Skip)25 b(list)h(supp)r(ort)i(is)e(pro)n(vided)g(as)g(an)g (alternativ)n(e)g(to)g(balanced)h(trees.)39 b(Skip)25 b(lists)h(ha)n(v)n(e)g(the)i(adv)-5 b(an-)515 4704 y(tage)27 b(that)h(an)f(inorder)h(w)n(alk)d(through)j(the)g(list)f(is)g(p)r (ossible)h(in)e(the)j(face)f(of)e(additions)g(and)h(deletions)515 4804 y(from)c(the)29 b(list.)35 b(Balanced)28 b(tree,)h(algorithms,)22 b(in)k(con)n(trast,)i(mak)n(e)c(this)k(sort)g(of)e(tra)n(v)n(ersal)h (imp)r(ossible)515 4903 y(b)r(ecause)k(of)26 b(the)j(rotations)f(that)g (are)g(necessary)k(for)27 b(the)i(balancing.)2115 5255 y(27)p eop %%Page: 28 28 28 27 bop 639 523 a Fu(F)-7 b(or)24 b(these)j(lists,)d(the)h Ft(key)32 b Fu(is)24 b(deriv)-5 b(able)24 b(from)c(the)25 b Ft(datum)32 b Fu(that)24 b(is)f(stored)j(in)d(the)j(list.)33 b(This)24 b(mak)n(es)515 623 y(it)f(p)r(ossible)i(for)f(the)i(actualy)d (k)n(eys)j(to)e(c)n(hange,)h(as)f(long)f(as)i(the)g(ordering)g(of)e (the)j(data)e(sta)n(y)g(the)i(same.)515 722 y(This)h(is)h(essen)n(tial) g(for)g(the)h(use)g(of)e(skip)g(lists)h(for)f Fj(Khepera)j Fu(trees.)639 822 y(This)24 b(co)r(de)h(is)e(deriv)n(ed)i(from)20 b([Pugh90)n(])j(and)g(from)d(a)j(skip)h(list)e(implemen)n(tatio)o(n)c (b)n(y)23 b(Lars)h(Nyland.)515 1038 y Fv(1.16.1)95 b Fm(sl)p 924 1038 30 4 v 37 w(cr)-5 b(e)g(ate)722 1191 y Ft(sl)p 783 1191 V 34 w(List)51 b(sl)p 1064 1191 V 34 w(cr)l(e)l(ate)6 b Fl(\()43 b Fv(in)m(t)e Fl(\()p Fk(\003)p Ft(c)l(omp)l(ar)l(e)6 b Fl(\)\()44 b Fv(const)d(v)m(oid)h Fk(\003)p Ft(key1)p Fl(,)h Fv(const)f(v)m(oid)f Fk(\003)p Ft(key2)56 b Fl(\),)1550 1291 y Fv(const)42 b(v)m(oid)g Fk(\003)p Fl(\()p Fk(\003)p Ft(key)7 b Fl(\)\()44 b Fv(const)e(v)m(oid) f Fk(\003)p Ft(datum)51 b Fl(\),)1550 1390 y Fv(const)42 b(c)m(har)h Fk(\003)p Fl(\()p Fk(\003)p Ft(print)8 b Fl(\)\()43 b Fv(const)e(v)m(oid)h Fk(\003)p Ft(datum)50 b Fl(\))44 b(\))515 1561 y Ft(sl)p 576 1561 26 4 v 29 w(cr)l(e)l(ate)h Fu(initializes)37 b(a)i(skip)g(list.)69 b(The)41 b Ft(c)l(omp)l(ar)l(e)k Fu(function)39 b(returns)j(-1,)e(0,)h (or)e(1)g(dep)r(ending)h(on)515 1661 y(the)33 b(ordering)e(of)g Ft(key1)44 b Fu(and)31 b Ft(key2)p Fu(.)48 b(The)33 b Ft(key)39 b Fu(function)31 b(con)n(v)n(erts)j(a)d Ft(datum)39 b Fu(in)n(to)30 b(a)h Ft(key)p Fu(.)48 b(The)33 b Ft(print)515 1761 y Fu(function)24 b(returns)29 b(a)24 b(string)i(represen)n(tation) i(of)c Ft(datum)p Fu(,)i(and)f(is)g(allo)n(w)n(ed)d(to)j(alw)n(a)n(ys)e (return)28 b(a)c(p)r(oin)n(ter)515 1860 y(to)j(the)i(same)d(static)j (bu\013er.)639 1960 y Ft(c)l(omp)l(ar)l(e)35 b Fu(m)n(ust)27 b(b)r(e)j(pro)n(vided.)39 b(If)28 b Ft(key)36 b Fu(is)29 b(not)f(pro)n(vided,)g(then)i Ft(datum)36 b Fu(will)26 b(b)r(e)k(used)h(as)e(the)h(k)n(ey)-7 b(.)515 2059 y(If)27 b Ft(print)34 b Fu(is)28 b(not)g(pro)n(vided,)e(then)j(the)g Ft(datum)35 b Fu(p)r(oin)n(ter)28 b(will)d(b)r(e)k(prin)n(ted)g(when)f (necessary)-7 b(.)515 2275 y Fv(1.16.2)95 b Fm(sl)p 924 2275 30 4 v 37 w(destr)-5 b(oy)722 2429 y Fv(v)m(oid)42 b Ft(sl)p 1002 2429 V 34 w(destr)l(oy)7 b Fl(\()44 b Ft(sl)p 1431 2429 V 34 w(List)50 b(list)g Fl(\))515 2600 y Ft(sl)p 576 2600 26 4 v 29 w(destr)l(oy)34 b Fu(remo)n(v)n(es)26 b(all)f(of)h(the)i(memory)22 b(asso)r(ciated)28 b(with)f(the)h(main)n (tenance)d(of)h(the)i(sp)r(eci\014ed)i(skip)515 2699 y Ft(list)p Fu(.)44 b(The)32 b(p)r(oin)n(ter)g(to)f(the)h (user-de\014ned)j Ft(datum)k Fu(is)31 b Fv(not)e Fu(freed)j({)f(this)g (is)g(the)i(resp)r(onsibilit)n(y)d(of)g(the)515 2799 y(user.)515 3015 y Fv(1.16.3)p 860 3015 30 4 v 131 w Fm(sl)p 960 3015 V 36 w(shutdown)722 3168 y Fv(v)m(oid)p 946 3168 V 77 w Ft(sl)p 1037 3168 V 34 w(shutdown)6 b Fl(\()45 b Fv(v)m(oid)d Fl(\))p 520 3339 26 4 v 545 3339 a Ft(sl)p 606 3339 V 30 w(shutdown)32 b Fu(is)23 b(used)j(to)e(free)h (the)h(in)n(ternal)d(data)g(structures)29 b(used)d(b)n(y)e(the)h(skip)f (list)f(pac)n(k)-5 b(age.)35 b(Since)515 3439 y(it)27 b(is)g(called)g(automatically)22 b(b)n(y)28 b Fj(libmaa)p Fu(,)h(it)e(should)g(not)h(b)r(e)h(called)e(explicitly)f(b)n(y)h(the)i (user.)515 3654 y Fv(1.16.4)95 b Fm(sl)p 924 3654 30 4 v 37 w(insert)722 3808 y Fv(v)m(oid)42 b Ft(sl)p 1002 3808 V 34 w(insert)8 b Fl(\()42 b Ft(sl)p 1382 3808 V 34 w(List)51 b(list)p Fl(,)41 b Fv(const)g(v)m(oid)h Fk(\003)p Ft(datum)50 b Fl(\))515 3979 y Fu(Insert)30 b Ft(datum)35 b Fu(in)n(to)26 b Ft(list)p Fu(.)515 4195 y Fv(1.16.5)95 b Fm(sl)p 924 4195 V 37 w(delete)722 4348 y Fv(v)m(oid)42 b Ft(sl)p 1002 4348 V 34 w(delete)6 b Fl(\()44 b Ft(sl)p 1380 4348 V 34 w(List)50 b(list)p Fl(,)41 b Fv(const)h(v)m(oid)f Fk(\003)p Ft(datum)51 b Fl(\))515 4519 y Fu(Delete)29 b Ft(datum)35 b Fu(from)24 b Ft(list)p Fu(.)2115 5255 y(28)p eop %%Page: 29 29 29 28 bop 515 523 a Fv(1.16.6)95 b Fm(sl)p 924 523 30 4 v 37 w(\014nd)722 676 y Fv(const)42 b(v)m(oid)g Fk(\003)p Ft(sl)p 1306 676 V 33 w(\014nd)9 b Fl(\()45 b Ft(sl)p 1615 676 V 34 w(List)51 b(list)p Fl(,)41 b Fv(const)g(v)m(oid)h Fk(\003)p Ft(key)51 b Fl(\))515 847 y Fu(Find)25 b(the)j(datum)23 b(in)i Ft(list)32 b Fu(that)27 b(has)f(an)g(asso)r(ciated)i(v)-5 b(alue)25 b(of)g Ft(key)p Fu(.)37 b(Return)27 b(that)f(datum)d(\(a)j(p) r(oin)n(ter\),)515 947 y(or)h Fv(NULL)g Fu(if)f(the)j Ft(key)36 b Fu(is)27 b(not)h(found.)515 1159 y Fv(1.16.7)95 b Fm(sl)p 924 1159 V 37 w(iter)-5 b(ate)722 1312 y Fv(in)m(t)41 b Ft(sl)p 941 1312 V 34 w(iter)l(ate)6 b Fl(\()42 b Ft(sl)p 1343 1312 V 34 w(List)51 b(list)p Fl(,)41 b Ft(sl)p 1799 1312 V 33 w(Iter)l(ator)51 b(f)61 b Fl(\))515 1483 y Fu(Iterate)42 b Ft(f)56 b Fu(o)n(v)n(er)40 b(ev)n(ery)h(datum)36 b(in)j Ft(list)p Fu(.)69 b(If)39 b Ft(f)56 b Fu(returns)43 b(non-zero,)g(then)d(ab)r(ort)g(the)h(remainder)d(of)515 1583 y(the)31 b(iteration.)41 b(Iterations)30 b(are)h(designed)g(to)e (do)h(something)d(appropriate)j(in)e(the)j(face)g(of)d(arbitrary)515 1683 y(insertions)g(and)g(deletions)g(p)r(erformed)f(b)n(y)h Ft(f)p Fu(.)515 1894 y Fv(1.16.8)95 b Fm(sl)p 924 1894 V 37 w(iter)-5 b(ate)p 1230 1894 V 34 w(ar)g(g)722 2048 y Fv(in)m(t)41 b Ft(sl)p 941 2048 V 34 w(iter)l(ate)p 1207 2048 V 33 w(ar)l(g)7 b Fl(\()43 b Ft(sl)p 1490 2048 V 34 w(List)51 b(list)p Fl(,)41 b Ft(sl)p 1946 2048 V 34 w(Iter)l(atorA)n(r)l(g)47 b(f)p Fl(,)42 b Fv(v)m(oid)g Fk(\003)p Ft(ar)l(g)50 b Fl(\))515 2219 y Fu(Iterate)42 b Ft(f)56 b Fu(o)n(v)n(er)40 b(ev)n(ery)h(datum)36 b(in)j Ft(list)p Fu(.)69 b(If)39 b Ft(f)56 b Fu(returns)43 b(non-zero,)g(then) d(ab)r(ort)g(the)h(remainder)d(of)515 2318 y(the)31 b(iteration.)41 b(Iterations)30 b(are)h(designed)g(to)e(do)h(something)d(appropriate)j (in)e(the)j(face)g(of)d(arbitrary)515 2418 y(insertions)g(and)g (deletions)g(p)r(erformed)f(b)n(y)h Ft(f)p Fu(.)515 2630 y Fv(1.16.9)p 860 2630 V 131 w Fm(sl)p 960 2630 V 36 w(dump)722 2783 y Fv(v)m(oid)p 946 2783 V 77 w Ft(sl)p 1037 2783 V 34 w(dump)5 b Fl(\()45 b Ft(sl)p 1405 2783 V 34 w(List)51 b(list)e Fl(\))515 2954 y Fu(Dump)24 b(the)29 b(in)n(ternal)e(data)g(structures)33 b(asso)r(ciated)c(with)f Ft(list)p Fu(.)34 b(This)27 b(is)h(purely)g(for)f(debugging.)515 3183 y Fn(1.17)111 b(Source)37 b(Co)s(de)h(Managemen)m(t)515 3336 y Fu(Most)22 b(of)e(the)j(source)h(co)r(de)g(managem)o(en)n(t)17 b(routines)23 b(are)f(designed)h(to)f(b)r(e)g(called)f(from)e(within)h (a)h(lexical)515 3436 y(analyzer.)54 b(The)35 b(routines)g(supp)r(ort)g (the)g(storage)g(and)e(retriev)-5 b(al)35 b(of)d(source)37 b(co)r(de)e(lines)f(and)f(source)515 3535 y(co)r(de)c(tok)n(en)f (information.)i(A)e(single,)e(global,)e(source)30 b(co)r(de)g (managemen)n(t)22 b(ob)5 b(ject)29 b(is)e(supp)r(orted.)639 3635 y Fv(This)j(do)s(cumen)m(tatio)o(n)25 b(is)30 b(incomplete.)639 3734 y(These)h(routines)26 b(ha)m(v)m(e)32 b(not)e(b)s(een)f(fully)e (implemen)m(t)o(ed)o(.)515 3946 y(1.17.1)95 b Fm(sr)-5 b(c)p 981 3946 V 36 w(cr)g(e)g(ate)722 4100 y Fv(v)m(oid)42 b Ft(sr)l(c)p 1050 4100 V 34 w(cr)l(e)l(ate)6 b Fl(\()43 b Fv(v)m(oid)e Fl(\))515 4271 y Fu(The)24 b Ft(sr)l(c)p 790 4271 26 4 v 30 w(cr)l(e)l(ate)k Fu(functions)c(initializes)d(the)k (global)20 b(source)26 b(co)r(de)g(managem)o(en)n(t)19 b(ob)5 b(ject.)35 b(This)23 b(routine)515 4370 y(should)30 b(only)e(b)r(e)k(called)e(once,)h(if)e(at)h(all.)41 b(If)30 b(the)h(other)h(routines)f(are)h(used)g(as)e(exp)r(ected,)k Ft(sr)l(c)p 3563 4370 V 30 w(cr)l(e)l(ate)515 4470 y Fu(will)25 b(b)r(e)k(called)e(automatically)21 b(when)29 b(it)e(is)h(needed.)515 4682 y Fv(1.17.2)95 b Fm(sr)-5 b(c)p 981 4682 30 4 v 36 w(destr)g(oy)722 4835 y Fv(v)m(oid)42 b Ft(sr)l(c)p 1050 4835 V 34 w(destr)l(oy)7 b Fl(\()43 b Fv(v)m(oid)f Fl(\))515 5006 y Ft(sr)l(c)p 624 5006 26 4 v 29 w(destr)l(oy)35 b Fu(frees)30 b(all)25 b(memory)e(asso)r (ciated)29 b(with)e(the)i(global)c(source)30 b(co)r(de)g(managemen)n(t) 22 b(ob)5 b(ject.)2115 5255 y(29)p eop %%Page: 30 30 30 29 bop 515 523 a Fv(1.17.3)95 b Fm(sr)-5 b(c)p 981 523 30 4 v 36 w(line)722 676 y Fv(const)42 b(c)m(har)h Fk(\003)p Ft(sr)l(c)p 1357 676 V 33 w(line)6 b Fl(\()44 b Fv(const)d(c)m(har)j Fk(\003)p Ft(line)p Fl(,)d Fv(in)m(t)g Ft(len)50 b Fl(\))515 847 y Ft(sr)l(c)p 624 847 26 4 v 29 w(line)34 b Fu(stores)c(a)d Ft(line)34 b Fu(of)26 b(length)i Ft(len)p Fu(.)515 1063 y Fv(1.17.4)95 b Fm(sr)-5 b(c)p 981 1063 30 4 v 36 w(new)p 1179 1063 V 35 w(\014le)722 1216 y Fv(v)m(oid)42 b Ft(sr)l(c)p 1050 1216 V 34 w(new)p 1224 1216 V 34 w(\014le)6 b Fl(\()45 b Fv(const)c(c)m(har)i Fk(\003)p Ft(\014lename)51 b Fl(\))515 1388 y Ft(sr)l(c)p 624 1388 26 4 v 29 w(new)p 793 1388 V 31 w(\014le)34 b Fu(sp)r(eci\014es)d(that)d Ft(\014lename)35 b Fu(is)28 b(the)h(name)c(of)i(the)i(curren)n(t)h(\014le)e(b)r(eing)g(read)h(b)n (y)e(the)i(lexer.)515 1603 y Fv(1.17.5)95 b Fm(sr)-5 b(c)p 981 1603 30 4 v 36 w(new)p 1179 1603 V 35 w(line)722 1757 y Fv(v)m(oid)42 b Ft(sr)l(c)p 1050 1757 V 34 w(new)p 1224 1757 V 34 w(line)6 b Fl(\()44 b Fv(in)m(t)d Ft(line)49 b Fl(\))515 1928 y Ft(sr)l(c)p 624 1928 26 4 v 29 w(new)p 793 1928 V 31 w(line)38 b Fu(sp)r(eci\014es)e(that)d Ft(line)39 b Fu(is)32 b(the)i(n)n(um)n(b)r(er)d(of)g(the)j(curren)n(t)i (line)c(b)r(eing)g(read)i(b)n(y)e(the)i(lexer.)515 2027 y(Line)27 b(n)n(um)n(b)r(ers)g(start)i(at)f(1.)515 2243 y Fv(1.17.6)95 b Fm(sr)-5 b(c)p 981 2243 30 4 v 36 w(advanc)g(e)722 2396 y Fv(v)m(oid)42 b Ft(sr)l(c)p 1050 2396 V 34 w(advanc)l(e)6 b Fl(\()46 b Fv(in)m(t)41 b Ft(length)50 b Fl(\))515 2568 y Ft(sr)l(c)p 624 2568 26 4 v 29 w(advanc)l(e)36 b Fu(is)28 b(used)h(to)f(adv)-5 b(ance)29 b(the)g(tok)n(en)f(o\013set)h (p)r(oin)n(ter)g Ft(length)34 b Fu(b)n(ytes.)515 2783 y Fv(1.17.7)95 b Fm(sr)-5 b(c)p 981 2783 30 4 v 36 w(get)722 2937 y Ft(sr)l(c)p 831 2937 V 34 w(T)f(yp)l(e)50 b(sr)l(c)p 1189 2937 V 33 w(get)8 b Fl(\()44 b Fv(in)m(t)d Ft(length)50 b Fl(\))515 3108 y Ft(sr)l(c)p 624 3108 26 4 v 29 w(get)32 b Fu(is)24 b(used)i(to)e(get)h(a)f Ft(sr)l(c)p 1458 3108 V 30 w(T)-6 b(yp)l(e)30 b Fu(ob)5 b(ject)25 b(for)e(the)j(curren)n(t)h (tok)n(en.)35 b(This)25 b(ob)5 b(ject)25 b(con)n(tains)f(\014le,)g (line,)515 3207 y(o\013set,)j(and)f(length)f(information)c(whic)n(h)k (can)i(b)r(e)g(used)h(to)d(prin)n(t)h(parse)i(error)f(messages)g(and)e (pro)n(vide)515 3307 y(detailed)i(tok)n(en)h(trac)n(king.)515 3523 y Fv(1.17.8)95 b Fm(sr)-5 b(c)p 981 3523 30 4 v 36 w(\014lename)722 3676 y Fv(const)42 b(c)m(har)h Fk(\003)p Ft(sr)l(c)p 1357 3676 V 33 w(\014lename)6 b Fl(\()46 b Ft(sr)l(c)p 1878 3676 V 33 w(T)-6 b(yp)l(e)50 b(sour)l(c)l(e)g Fl(\))515 3847 y Ft(sr)l(c)p 624 3847 26 4 v 29 w(\014lename)35 b Fu(returns)c(the)e Ft(\014le)34 b Fu(asso)r(ciated)c(with)d(the)i(sp) r(eci\014ed)h Ft(sour)l(c)l(e)k Fu(information.)515 4063 y Fv(1.17.9)95 b Fm(sr)-5 b(c)p 981 4063 30 4 v 36 w(linenumb)g(er)722 4216 y Fv(in)m(t)41 b Ft(sr)l(c)p 989 4216 V 34 w(linenumb)l(er)9 b Fl(\()43 b Ft(sr)l(c)p 1609 4216 V 34 w(T)-6 b(yp)l(e)49 b(sour)l(c)l(e)h Fl(\))515 4387 y Ft(sr)l(c)p 624 4387 26 4 v 29 w(linenumb)l(er)37 b Fu(returns)30 b(the)f Ft(line)34 b Fu(asso)r(ciated)29 b(with)e(the)i(sp)r(eci\014ed)i Ft(sour)l(c)l(e)j Fu(information.)515 4603 y Fv(1.17.10)95 b Fm(sr)-5 b(c)p 1029 4603 30 4 v 36 w(o\013set)722 4756 y Fv(in)m(t)41 b Ft(sr)l(c)p 989 4756 V 34 w(o\013set)8 b Fl(\()44 b Ft(sr)l(c)p 1403 4756 V 34 w(T)-6 b(yp)l(e)50 b(sour)l(c)l(e)f Fl(\))515 4927 y Ft(sr)l(c)p 624 4927 26 4 v 29 w(o\013set)37 b Fu(returns)31 b(the)e(tok)n(en)f Ft(o\013set)36 b Fu(asso)r(ciated)30 b(with)d(the)i(sp)r(eci\014ed)i Ft(sour)l(c)l(e)i Fu(information.)2115 5255 y(30)p eop %%Page: 31 31 31 30 bop 515 523 a Fv(1.17.11)95 b Fm(sr)-5 b(c)p 1029 523 30 4 v 36 w(length)722 676 y Fv(in)m(t)41 b Ft(sr)l(c)p 989 676 V 34 w(length)6 b Fl(\()44 b Ft(sr)l(c)p 1423 676 V 34 w(T)-6 b(yp)l(e)49 b(sour)l(c)l(e)h Fl(\))515 847 y Ft(sr)l(c)p 624 847 26 4 v 29 w(length)35 b Fu(returns)30 b(the)f(tok)n(en)f Ft(length)35 b Fu(asso)r(ciated)29 b(with)e(the)i(sp)r(eci\014ed)i Ft(sour)l(c)l(e)j Fu(information.)515 1063 y Fv(1.17.12)95 b Fm(sr)-5 b(c)p 1029 1063 30 4 v 36 w(sour)g(c)g(e)p 1327 1063 V 34 w(line)722 1216 y Fv(const)42 b(c)m(har)h Fk(\003)p Ft(sr)l(c)p 1357 1216 V 33 w(sour)l(c)l(e)p 1614 1216 V 35 w(line)6 b Fl(\()44 b Ft(sr)l(c)p 1967 1216 V 33 w(T)-6 b(yp)l(e)50 b(sour)l(c)l(e)f Fl(\))515 1388 y Ft(sr)l(c)p 624 1388 26 4 v 29 w(sour)l(c)l(e)p 877 1388 V 31 w(line)31 b Fu(returns)e(the)e(full)d(source)k(line)d(asso)r(ciated)i(with)f(the)h (sp)r(eci\014ed)i Ft(sour)l(c)l(e)j Fu(information.)515 1603 y Fv(1.17.13)95 b Fm(sr)-5 b(c)p 1029 1603 30 4 v 36 w(get)p 1185 1603 V 35 w(stats)722 1757 y Ft(sr)l(c)p 831 1757 V 34 w(Stats)51 b(sr)l(c)p 1198 1757 V 33 w(get)p 1335 1757 V 35 w(stats)7 b Fl(\()43 b Fv(v)m(oid)f Fl(\))515 1928 y Ft(sr)l(c)p 624 1928 26 4 v 29 w(get)p 757 1928 V 31 w(stats)35 b Fu(returns)d(the)e(statistics)g(asso)r(ciated)h(with) d(the)i(source)h(co)r(de)g(manager.)37 b(The)29 b Ft(sr)l(c)p 3596 1928 V 30 w(Stats)515 2027 y Fu(structure)j(is)27 b(sho)n(wn)h(in)f(Figure)h(6.)722 2243 y Fv(t)m(yp)s(edef)49 b(struct)41 b Ft(sr)l(c)p 1485 2243 30 4 v 33 w(Stats)51 b Fk(f)853 2342 y Fv(in)m(t)41 b Ft(lines)p 1182 2342 V 34 w(use)l(d)9 b Fl(;)719 b Fc(=)p Fk(\003)27 b Fu(Lines)h(used)i Fk(\003)p Fc(=)853 2442 y Fv(in)m(t)41 b Ft(lines)p 1182 2442 V 34 w(al)t(lo)l(c)l(ate)l(d)9 b Fl(;)565 b Fc(=)p Fk(\003)27 b Fu(Lines)h(allo)r(cated)f Fk(\003)p Fc(=)853 2542 y Fv(in)m(t)41 b Ft(lines)p 1182 2542 V 34 w(bytes)7 b Fl(;)697 b Fc(=)p Fk(\003)27 b Fu(Bytes)j(required)g(to)d(store)j (lines)d Fk(\003)p Fc(=)853 2641 y Fv(in)m(t)41 b Ft(tokens)p 1242 2641 V 35 w(total)9 b Fl(;)650 b Fc(=)p Fk(\003)27 b Fu(T)-7 b(ok)n(ens)28 b(used)i Fk(\003)p Fc(=)853 2741 y Fv(in)m(t)41 b Ft(tokens)p 1242 2741 V 35 w(r)l(euse)l(d)9 b Fl(;)588 b Fc(=)p Fk(\003)27 b Fu(T)-7 b(ok)n(ens)28 b(reused)j Fk(\003)p Fc(=)853 2841 y Fv(in)m(t)41 b Ft(tokens)p 1242 2841 V 35 w(size)6 b Fl(;)683 b Fc(=)p Fk(\003)27 b Fu(Size)h(of)f(a)g(tok)n(en)h(information)22 b(ob)5 b(ject)28 b Fk(\003)p Fc(=)722 2940 y Fk(g)43 b(\003)p Ft(sr)l(c)p 958 2940 V 34 w(Stats)7 b Fl(;)1816 3123 y Fu(Figure)28 b(6:)35 b Ft(sr)l(c)p 2288 3123 26 4 v 30 w(Stats)515 3521 y Fv(1.17.14)95 b Fm(sr)-5 b(c)p 1029 3521 30 4 v 36 w(print)p 1273 3521 V 33 w(stats)722 3674 y Fv(v)m(oid)42 b Ft(sr)l(c)p 1050 3674 V 34 w(print)p 1262 3674 V 34 w(stats)7 b Fl(\()43 b Ft(FILE)54 b Fk(\003)p Ft(str)l(e)l(am)48 b Fl(\))515 3846 y Ft(sr)l(c)p 624 3846 26 4 v 29 w(print)p 831 3846 V 30 w(stats)35 b Fu(prin)n(ts)29 b(the)h(statistics)h(ab)r(out)d(the)i(source)i(co)r(de)e(manager)c(to)i (the)i(sp)r(eci\014ed)i Ft(str)l(e)l(am)p Fu(.)515 3945 y(If)27 b Ft(str)l(e)l(am)32 b Fu(is)c Fv(NULL)p Fu(,)e(then)j Fv(stdout)23 b Fu(will)i(b)r(e)k(used.)515 4161 y Fv(1.17.15)95 b Fm(sr)-5 b(c)p 1029 4161 30 4 v 36 w(print)p 1273 4161 V 33 w(line)722 4314 y Fv(v)m(oid)42 b Ft(sr)l(c)p 1050 4314 V 34 w(print)p 1262 4314 V 34 w(line)6 b Fl(\()43 b Ft(FILE)54 b Fk(\003)p Ft(str)l(e)l(am)p Fl(,)41 b Ft(sr)l(c)p 2206 4314 V 34 w(T)-6 b(yp)l(e)49 b(sour)l(c)l(e)h Fl(\))515 4485 y Ft(sr)l(c)p 624 4485 26 4 v 29 w(print)p 831 4485 V 30 w(line)32 b Fu(prin)n(ts)26 b(a)g(line)f(of)g(source)k (co)r(de,)e(as)f(describ)r(ed)k(b)n(y)25 b Ft(sour)l(c)l(e)32 b Fu(to)26 b(the)h(sp)r(eci\014ed)j Ft(str)l(e)l(am)p Fu(.)k(If)515 4585 y Ft(str)l(e)l(am)e Fu(is)c Fv(NULL)p Fu(,)e(then)j Fv(stdout)23 b Fu(will)i(b)r(e)k(used.)2115 5255 y(31)p eop %%Page: 32 32 32 31 bop 515 523 a Fv(1.17.16)95 b Fm(sr)-5 b(c)p 1029 523 30 4 v 36 w(p)g(arse)p 1286 523 V 34 w(err)g(or)722 676 y Fv(v)m(oid)42 b Ft(sr)l(c)p 1050 676 V 34 w(p)l(arse)p 1272 676 V 34 w(err)l(or)9 b Fl(\()41 b Ft(FILE)55 b Fk(\003)p Ft(str)l(e)l(am)p Fl(,)40 b Ft(sr)l(c)p 2269 676 V 34 w(T)-6 b(yp)l(e)50 b(sour)l(c)l(e)p Fl(,)42 b Fv(const)g(c)m(har)h Fk(\003)p Ft(message)50 b Fl(\))515 847 y Ft(sr)l(c)p 624 847 26 4 v 29 w(p)l(arse)p 841 847 V 31 w(err)l(or)26 b Fu(will)17 b(prin)n(t)j(the)i(error)g Ft(message)27 b Fu(to)20 b(the)h(sp)r(eci\014ed)j Ft(str)l(e)l(am)p Fu(,)19 b(follo)n(w)n(ed)e(b)n(y)j(the)h(o\013ending)515 947 y(line)27 b(of)f(source)k(co)r(de,)f(as)f(sp)r(eci\014ed)j(b)n(y)c Ft(sour)l(c)l(e)p Fu(.)36 b(If)27 b Ft(str)l(e)l(am)32 b Fu(is)c Fv(NULL)p Fu(,)e(then)j Fv(stdout)23 b Fu(will)i(b)r(e)k (used.)639 1047 y(It)23 b(is)f(assumed)g(that)g Ft(message)30 b Fu(has)22 b(the)i(format)19 b(of)i Ft(yyerr)l(or)29 b Fu(so)23 b(that)g(massaging)18 b(of)j(the)j(string)e(can)515 1146 y(b)r(e)30 b(p)r(erformed)f(to)g(mak)n(e)e(it)h(more)g(readable)i (\(tok)n(en)g(names)e(are)i(assumed)e(to)i(start)g(with)f(\\T)p 3570 1146 25 4 v 29 w(")g(and)515 1246 y(will)21 b(b)r(e)26 b(c)n(hanged)f(to)e(more)g(readable)i(names\).)33 b(This)24 b(massaging)c(should)k(b)r(e)h(done)g(b)n(y)f(a)g(user-de\014ned)515 1346 y(function,)i(since)j(it)e(is)h(relativ)n(ely)e(sp)r(eci\014c)31 b(to)c(this)h(author's)g(co)r(ding)f(con)n(v)n(en)n(tions.)515 1561 y Fv(1.17.17)95 b Fm(sr)-5 b(c)p 1029 1561 30 4 v 36 w(print)p 1273 1561 V 33 w(err)g(or)722 1715 y Fv(v)m(oid)42 b Ft(sr)l(c)p 1050 1715 V 34 w(print)p 1262 1715 V 34 w(err)l(or)9 b Fl(\()41 b Ft(FILE)54 b Fk(\003)p Ft(str)p Fl(,)41 b Ft(sr)l(c)p 2119 1715 V 33 w(T)-6 b(yp)l(e)50 b(sour)l(c)l(e)p Fl(,)42 b Fv(const)g(c)m(har)h Fk(\003)p Ft(format)p Fl(,)e(.)13 b(.)g(.)43 b(\))515 1886 y Ft(sr)l(c)p 624 1886 26 4 v 29 w(print)p 831 1886 V 30 w(err)l(or)35 b Fu(will)26 b(prin)n(t)i(an)h(arbitrary)f(error,)i(sp)r(eci\014ed)i (as)d(for)f Ft(printf)45 b Fu(b)n(y)29 b(the)h Ft(format)35 b Fu(v)-5 b(ariable,)515 1985 y(to)27 b(the)i(sp)r(eci\014ed)i Ft(str)l(e)l(am)p Fu(,)25 b(follo)n(w)n(ed)f(b)n(y)k(the)g(line)f(of)g (source)j(co)r(de)f(sp)r(eci\014ed)i(b)n(y)c Ft(sour)l(c)l(e)p Fu(.)36 b(If)27 b Ft(str)l(e)l(am)32 b Fu(is)515 2085 y Fv(NULL)p Fu(,)25 b(then)30 b Fv(stdout)23 b Fu(will)i(b)r(e)k(used.) 515 2301 y Fv(1.17.18)95 b Fm(sr)-5 b(c)p 1029 2301 30 4 v 36 w(print)p 1273 2301 V 33 w(message)722 2454 y Fv(v)m(oid)42 b Ft(sr)l(c)p 1050 2454 V 34 w(print)p 1262 2454 V 34 w(message)6 b Fl(\()44 b Ft(FILE)55 b Fk(\003)p Ft(str)p Fl(,)40 b Ft(sr)l(c)p 2227 2454 V 34 w(T)-6 b(yp)l(e)50 b(sour)l(c)l(e)p Fl(,)42 b Fv(const)g(c)m(har)h Fk(\003)p Ft(format)p Fl(,)e(.)13 b(.)g(.)42 b(\))515 2625 y Ft(sr)l(c)p 624 2625 26 4 v 29 w(print)p 831 2625 V 30 w(message)35 b Fu(will)24 b(just)29 b(prin)n(t)e(a)g(message)g (lab)r(eled)h(with)f(a)g(line.)515 2858 y Fn(1.18)111 b(Stac)m(k)37 b(Routines)515 3011 y Fu(The)29 b(stac)n(k)g(routines)g (pro)n(vide)f(supp)r(ort)i(for)d(a)h(general)g(stac)n(k)h(of)e(p)r(oin) n(ters)j(to)e Fv(v)m(oid)p Fu(.)35 b(Because)d(of)27 b(the)515 3110 y(simplicit)n(y)19 b(of)24 b(the)i(stac)n(k)f(ob)5 b(ject,)25 b(no)f(statistics)i(are)g(main)n(tained.)k(\(Although)n(t)24 b(the)i(list)e(routines)h(can)515 3210 y(also)h(b)r(e)j(used)h(as)e(a)f (stac)n(k,)h(the)h(stac)n(k)f(implemen)n(ted)23 b(here)31 b(is)c(more)f(e\016cien)n(t.\))515 3426 y Fv(1.18.1)95 b Fm(stk)p 976 3426 30 4 v 36 w(cr)-5 b(e)g(ate)722 3579 y Ft(stk)p 827 3579 V 35 w(Stack)53 b(stk)p 1207 3579 V 35 w(cr)l(e)l(ate)6 b Fl(\()43 b Fv(v)m(oid)f Fl(\))515 3750 y Ft(stk)p 620 3750 26 4 v 30 w(cr)l(e)l(ate)33 b Fu(initializes)25 b(a)j(stac)n(k)g(ob)5 b(ject.)515 3966 y Fv(1.18.2)95 b Fm(stk)p 976 3966 30 4 v 36 w(destr)-5 b(oy)722 4119 y Fv(v)m(oid)42 b Ft(stk)p 1046 4119 V 34 w(destr)l(oy)7 b Fl(\()44 b Ft(stk)p 1519 4119 V 35 w(Stack)53 b(stack)g Fl(\))515 4290 y Ft(stk)p 620 4290 26 4 v 30 w(destr)l(oy)31 b Fu(destro)n(ys)26 b(all)c(memory)d(asso)r (ciated)25 b(with)f(the)h Ft(stack)p Fu(.)35 b(The)25 b(memory)19 b(used)26 b(b)n(y)d(data)h(is)f Ft(not)515 4390 y Fu(freed|this)28 b(memory)23 b(is)28 b(the)h(resp)r(onsibilit)n (y)e(of)f(the)j(user.)515 4606 y Fv(1.18.3)95 b Fm(stk)p 976 4606 30 4 v 36 w(push)722 4759 y Fv(v)m(oid)42 b Ft(stk)p 1046 4759 V 34 w(push)6 b Fl(\()46 b Ft(stk)p 1426 4759 V 35 w(Stack)53 b(stack)p Fl(,)43 b Fv(v)m(oid)f Fk(\003)p Ft(datum)50 b Fl(\))515 4930 y Ft(stk)p 620 4930 26 4 v 30 w(push)35 b Fu(places)29 b Ft(datum)35 b Fu(on)28 b(the)h(top)e(of)g(the)i Ft(stack)p Fu(.)2115 5255 y(32)p eop %%Page: 33 33 33 32 bop 515 523 a Fv(1.18.4)95 b Fm(stk)p 976 523 30 4 v 36 w(p)-5 b(op)722 676 y Fv(v)m(oid)42 b Fk(\003)p Ft(stk)p 1088 676 V 34 w(p)l(op)5 b Fl(\()45 b Ft(stk)p 1426 676 V 35 w(Stack)53 b(stack)g Fl(\))515 847 y Ft(stk)p 620 847 26 4 v 30 w(p)l(op)32 b Fu(remo)n(v)n(es)26 b(the)h(top)f(of)f (the)j Ft(stack)35 b Fu(and)26 b(returns)j(the)f(p)r(oin)n(ter.)36 b(If)25 b(the)j Ft(stack)35 b Fu(is)26 b(empt)n(y)-7 b(,)24 b Ft(stk)p 3651 847 V 30 w(p)l(op)515 947 y Fu(returns)31 b Fv(NULL)p Fu(.)515 1163 y Fv(1.18.5)95 b Fm(stk)p 976 1163 30 4 v 36 w(top)722 1316 y Fv(v)m(oid)42 b Fk(\003)p Ft(stk)p 1088 1316 V 34 w(top)5 b Fl(\()45 b Ft(stk)p 1416 1316 V 34 w(Stack)54 b(stack)e Fl(\))515 1487 y Ft(stk)p 620 1487 26 4 v 30 w(top)38 b Fu(returns)d(a)c(p)r(oin)n(ter)i (to)f(the)h(datum)c(on)j(the)h(top)f(of)f(the)i Ft(stack)p Fu(,)g(but)f(do)r(es)i Ft(not)41 b Fu(remo)n(v)n(e)30 b(this)515 1587 y(datum)25 b(from)f(the)29 b Ft(stack)p Fu(.)36 b(If)27 b(the)i Ft(stack)37 b Fu(is)28 b(empt)n(y)-7 b(,)24 b Ft(stk)p 2258 1587 V 31 w(p)l(op)34 b Fu(returns)d Fv(NULL)p Fu(.)515 1819 y Fn(1.19)111 b(String)36 b(P)m(o)s(ol)i (Routines)515 1972 y Fu(These)e(routines)e(pro)n(vide)g(supp)r(ort)h (for)d(string)i(p)r(o)r(ol)e(ob)5 b(jects.)55 b(In)33 b(general,)i(only)d(the)i Ft(str)p 3463 1972 V 29 w(\014nd)44 b Fu(and)515 2072 y Ft(str)p 618 2072 V 29 w(\014ndn)27 b Fu(functions)19 b(will)d(b)r(e)k(used.)35 b(This)18 b(function)h(tak)n(es)g(a)f(p)r(oin)n(ter)h(to)g(a)f(n)n (ull-terminated)d(string)k(and)515 2172 y(returns)35 b(a)d(p)r(oin)n(ter)h(to)f(another)i(n)n(ull-terminated)29 b(string)k(whic)n(h)f(con)n(tains)g(the)i(same)d(information.)515 2271 y(The)c(p)r(oin)n(ter)f(returned)j(will)23 b(b)r(e)k(iden)n(tical) e(for)g(all)e(iden)n(tical)i(strings.)36 b(Memory)24 b(for)h(string)h(storage)h(is)515 2371 y(automatically)19 b(reclaimed)25 b(at)g(program)e(termination)f(on)k(systems)g(that)g (supp)r(ort)i Ft(atexit)34 b Fu(or)26 b Ft(on)p 3620 2371 V 31 w(exit)p Fu(.)515 2587 y Fv(1.19.1)95 b Fm(str)p 974 2587 30 4 v 36 w(p)-5 b(o)g(ol)p 1174 2587 V 33 w(cr)g(e)g(ate)722 2740 y Ft(str)p 825 2740 V 34 w(Po)l(ol)52 b(str)p 1167 2740 V 33 w(p)l(o)l(ol)p 1340 2740 V 35 w(cr)l(e)l(ate)6 b Fl(\()43 b Fv(v)m(oid)f Fl(\))515 2911 y Ft(str)p 618 2911 26 4 v 29 w(p)l(o)l(ol)p 787 2911 V 30 w(cr)l(e)l(ate)33 b Fu(initialized)25 b(a)i(string)h(p)r(o)r(ol)f(ob)5 b(ject.)515 3127 y Fv(1.19.2)95 b Fm(str)p 974 3127 30 4 v 36 w(p)-5 b(o)g(ol)p 1174 3127 V 33 w(destr)g(oy)722 3280 y Fv(v)m(oid)42 b Ft(str)p 1044 3280 V 33 w(p)l(o)l(ol)p 1217 3280 V 35 w(destr)l(oy)7 b Fl(\()44 b Ft(str)p 1689 3280 V 33 w(Po)l(ol)53 b(p)l(o)l(ol)f Fl(\))515 3451 y Ft(str)p 618 3451 26 4 v 29 w(p)l(o)l(ol)p 787 3451 V 30 w(destr)l(oy)35 b Fu(destro)n(ys)30 b(the)f(string)f(p)r(o)r(ol)e (ob)5 b(ject,)28 b Ft(p)l(o)l(ol)p Fu(,)f(and)g(all)e(memory)e(asso)r (ciated)30 b(with)d(it.)515 3667 y Fv(1.19.3)95 b Fm(str)p 974 3667 30 4 v 36 w(p)-5 b(o)g(ol)p 1174 3667 V 33 w(exists)722 3820 y Fv(in)m(t)41 b Ft(str)p 983 3820 V 33 w(p)l(o)l(ol)p 1156 3820 V 35 w(exists)7 b Fl(\()43 b Ft(str)p 1569 3820 V 34 w(Po)l(ol)52 b(p)l(o)l(ol)p Fl(,)43 b Fv(const)e(c)m(har)i Fk(\003)p Ft(s)50 b Fl(\))515 3991 y Ft(str)p 618 3991 26 4 v 29 w(p)l(o)l(ol)p 787 3991 V 30 w(exists)35 b Fu(returns)30 b(non-zero)f(if)d(the)j(string,)e Ft(s)p Fu(,)g(is)h(already)f(in)g(the)i(string)e(p)r(o)r(ol,)f Ft(p)l(o)l(ol)p Fu(.)515 4207 y Fv(1.19.4)95 b Fm(str)p 974 4207 30 4 v 36 w(p)-5 b(o)g(ol)p 1174 4207 V 33 w(\014nd)722 4360 y Fv(const)42 b(c)m(har)h Fk(\003)p Ft(str)p 1351 4360 V 33 w(p)l(o)l(ol)p 1524 4360 V 35 w(\014nd)9 b Fl(\()45 b Ft(str)p 1877 4360 V 33 w(Po)l(ol)53 b(p)l(o)l(ol)p Fl(,)42 b Fv(const)g(c)m(har)h Fk(\003)p Ft(s)50 b Fl(\))515 4532 y Ft(str)p 618 4532 26 4 v 29 w(p)l(o)l(ol)p 787 4532 V 30 w(\014nd)41 b Fu(lo)r(oks)30 b(up)g(the)i(string,)f Ft(s)p Fu(,)f(in)f(the)j(memory)26 b(asso)r(ciated)32 b(with)e(the)h(string)g(p)r(o)r(ol)e(ob)5 b(ject,)515 4631 y Ft(p)l(o)l(ol)p Fu(.)35 b(If)24 b(the)i(string)e(is)h(found,)e (a)i(p)r(oin)n(ter)g(to)f(the)i(previously)e(stored)j(string)e(is)f (returned.)39 b(Otherwise,)515 4731 y(the)28 b(string)g(is)f(copied)h (in)n(to)d(string)j(p)r(o)r(ol)e(memory)-7 b(,)21 b(and)27 b(a)g(p)r(oin)n(ter)h(to)f(the)h(newly)g(allo)r(cated)e(memory)515 4830 y(is)h(returned.)2115 5255 y(33)p eop %%Page: 34 34 34 33 bop 515 523 a Fv(1.19.5)95 b Fm(str)p 974 523 30 4 v 36 w(p)-5 b(o)g(ol)p 1174 523 V 33 w(c)g(opy)722 676 y Fv(const)42 b(c)m(har)h Fk(\003)p Ft(str)p 1351 676 V 33 w(p)l(o)l(ol)p 1524 676 V 35 w(c)l(opy)7 b Fl(\()45 b Ft(str)p 1899 676 V 33 w(Po)l(ol)53 b(p)l(o)l(ol)p Fl(,)42 b Fv(const)g(c)m(har)h Fk(\003)p Ft(s)50 b Fl(\))515 847 y Ft(str)p 618 847 26 4 v 29 w(p)l(o)l(ol)p 787 847 V 30 w(c)l(opy)31 b Fu(returns)26 b(a)c(cop)n(y)h(of)e(the)j(string,)f Ft(s)p Fu(,)g(using)f(memory)17 b(from)j(the)j(string)g(p)r(o)r(ol)f (ob)5 b(ject,)23 b Ft(p)l(o)l(ol)p Fu(.)515 947 y(This)k(can)h(b)r(e)g (used)h(for)e(data)f(that)i(is)f(kno)n(wn)f(to)h(b)r(e)i(unique.)36 b(No)27 b(c)n(hec)n(ks)j(are)e(made)d(for)h(uniqueness,)515 1047 y(ho)n(w)n(ev)n(er;)h(and)h(a)f(p)r(oin)n(ter)h(to)g(the)h(string) e(is)h(not)g(placed)g(in)f(the)i(hash)f(table.)515 1262 y Fv(1.19.6)95 b Fm(str)p 974 1262 30 4 v 36 w(p)-5 b(o)g(ol)p 1174 1262 V 33 w(c)g(opyn)722 1416 y Fv(const)42 b(c)m(har)h Fk(\003)p Ft(str)p 1351 1416 V 33 w(p)l(o)l(ol)p 1524 1416 V 35 w(c)l(opyn)6 b Fl(\()46 b Ft(str)p 1945 1416 V 33 w(Po)l(ol)52 b(p)l(o)l(ol)p Fl(,)43 b Fv(const)f(c)m(har)h Fk(\003)p Ft(s)p Fl(,)f Fv(in)m(t)f Ft(length)50 b Fl(\))515 1587 y Ft(str)p 618 1587 26 4 v 29 w(p)l(o)l(ol)p 787 1587 V 30 w(c)l(opyn)41 b Fu(returns)36 b(a)c(cop)n(y)h(of)e(the)j (string,)f Ft(s)p Fu(,)g(using)f(memory)c(from)h(the)34 b(string)f(p)r(o)r(ol)e(ob)5 b(ject,)515 1686 y Ft(p)l(o)l(ol)p Fu(.)34 b(The)25 b(string)f(will)d(b)r(e)k Ft(length)31 b Fu(b)n(ytes)25 b(long,)d(and)i(will)c(b)r(e)26 b Fv(NULL)c Fu(terminated.)34 b(This)24 b(can)g(b)r(e)h(used)515 1786 y(for)30 b(data)h(that)g(is)g(kno)n(wn)f(to)h(b)r(e)i(unique.)46 b(No)31 b(c)n(hec)n(ks)j(are)e(made)d(for)h(uniqueness,)k(ho)n(w)n(ev)n (er;)f(and)d(a)515 1886 y(p)r(oin)n(ter)e(to)f(the)i(string)f(is)g(not) f(placed)i(in)e(the)i(hash)f(table.)515 2101 y Fv(1.19.7)95 b Fm(str)p 974 2101 30 4 v 36 w(p)-5 b(o)g(ol)p 1174 2101 V 33 w(gr)g(ow)722 2255 y Fv(v)m(oid)42 b Ft(str)p 1044 2255 V 33 w(p)l(o)l(ol)p 1217 2255 V 35 w(gr)l(ow)9 b Fl(\()42 b Ft(str)p 1601 2255 V 34 w(Po)l(ol)52 b(p)l(o)l(ol)p Fl(,)43 b Fv(const)e(c)m(har)i Fk(\003)p Ft(s)p Fl(,)g Fv(in)m(t)d Ft(length)50 b Fl(\))515 2426 y Ft(str)p 618 2426 26 4 v 29 w(p)l(o)l(ol)p 787 2426 V 30 w(gr)l(ow)41 b Fu(will)30 b(gro)n(w)j(a)g(string)g(in)g(the)h(sp)r(eci\014ed)i Ft(p)l(o)l(ol)42 b Fu(un)n(til)32 b Ft(str)p 2784 2426 V 29 w(p)l(o)l(ol)p 2953 2426 V 31 w(\014nish)40 b Fu(is)33 b(called.)53 b(There)515 2525 y(m)n(ust)33 b(not)j(b)r(e)h(an)n(y)e (other)i(calls)e(to)g(mo)r(dify)c(the)37 b(sp)r(eci\014ed)i(string)d Ft(p)l(o)l(ol)44 b Fu(b)r(et)n(w)n(een)39 b(the)e(\014rst)g(call)d(to) 515 2625 y Ft(str)p 618 2625 V 29 w(p)l(o)l(ol)p 787 2625 V 30 w(gr)l(ow)i Fu(and)27 b(the)i(call)d(to)i Ft(str)p 1677 2625 V 29 w(p)l(o)l(ol)p 1846 2625 V 30 w(\014nish)p Fu(.)515 2841 y Fv(1.19.8)95 b Fm(str)p 974 2841 30 4 v 36 w(p)-5 b(o)g(ol)p 1174 2841 V 33 w(\014nish)722 2994 y Fv(const)42 b(c)m(har)h Fk(\003)p Ft(str)p 1351 2994 V 33 w(p)l(o)l(ol)p 1524 2994 V 35 w(\014nish)6 b Fl(\()45 b Ft(str)p 1934 2994 V 33 w(Po)l(ol)53 b(p)l(o)l(ol)f Fl(\))515 3165 y Ft(str)p 618 3165 26 4 v 29 w(p)l(o)l(ol)p 787 3165 V 30 w(\014nish)31 b Fu(will)21 b(\014nish)j(the)h(gro)n(wth)e (of)f(a)h(string)h(p)r(erformed)f(b)n(y)g(m)n(ultiple)c(calls)j(to)i Ft(str)p 3415 3165 V 29 w(p)l(o)l(ol)p 3584 3165 V 30 w(gr)l(ow)p Fu(.)515 3265 y(The)g(string)f(will)e(b)r(e)j(n)n(ull)d (terminated)i(and)f(will)f(b)r(e)j(en)n(tered)j(in)n(to)22 b(the)i(sp)r(eci\014ed)j(string)c Ft(p)l(o)l(ol)p Fu(.)35 b(Calls)21 b(to)515 3365 y Ft(str)p 618 3365 V 29 w(p)l(o)l(ol)p 787 3365 V 30 w(gr)l(ow)32 b Fu(follo)n(ws)22 b(b)n(y)i(a)g(call)f(to)h Ft(str)p 1810 3365 V 30 w(p)l(o)l(ol)p 1980 3365 V 30 w(\014nish)32 b Fu(is)25 b(equiv)-5 b(alen)n(t)24 b(to)g(a)g(single)g (call)f(to)h Ft(str)p 3445 3365 V 30 w(p)l(o)l(ol)p 3615 3365 V 30 w(\014nd)p Fu(.)515 3580 y Fv(1.19.9)95 b Fm(str)p 974 3580 30 4 v 36 w(p)-5 b(o)g(ol)p 1174 3580 V 33 w(get)p 1327 3580 V 36 w(stats)722 3734 y Ft(str)p 825 3734 V 34 w(Stats)50 b(str)p 1185 3734 V 34 w(p)l(o)l(ol)p 1359 3734 V 34 w(get)p 1497 3734 V 35 w(stats)7 b Fl(\()43 b Ft(str)p 1878 3734 V 34 w(Po)l(ol)52 b(p)l(o)l(ol)g Fl(\))515 3905 y Ft(str)p 618 3905 26 4 v 29 w(p)l(o)l(ol)p 787 3905 V 30 w(get)p 921 3905 V 31 w(stats)36 b Fu(returns)d (statistics)f(ab)r(out)e(the)h(sp)r(eci\014ed)i(string)e Ft(p)l(o)l(ol)p Fu(.)43 b(The)30 b Ft(str)p 3231 3905 V 30 w(Stats)37 b Fu(structure)515 4004 y(is)27 b(sho)n(wn)h(in)f (Figure)h(7.)515 4220 y Fv(1.19.10)95 b Fm(str)p 1022 4220 30 4 v 35 w(p)-5 b(o)g(ol)p 1221 4220 V 34 w(print)p 1463 4220 V 33 w(stats)722 4373 y Fv(v)m(oid)42 b Ft(str)p 1044 4373 V 33 w(p)l(o)l(ol)p 1217 4373 V 35 w(print)p 1430 4373 V 34 w(stats)7 b Fl(\()43 b Ft(str)p 1810 4373 V 34 w(Po)l(ol)52 b(p)l(o)l(ol)p Fl(,)43 b Ft(FILE)54 b Fk(\003)p Ft(str)l(e)l(am)48 b Fl(\))515 4544 y Ft(str)p 618 4544 26 4 v 29 w(p)l(o)l(ol)p 787 4544 V 30 w(print)p 995 4544 V 30 w(stats)32 b Fu(prin)n(ts)27 b(the)g(statistics)h(for)e (the)h(sp)r(eci\014ed)i(string)d Ft(p)l(o)l(ol)35 b Fu(on)26 b(the)h(sp)r(eci\014ed)i Ft(str)l(e)l(am)p Fu(.)515 4644 y(If)e Ft(str)l(e)l(am)32 b Fu(is)c Fv(NULL)p Fu(,)e(then)j Fv(stdout)23 b Fu(will)i(b)r(e)k(used.)2115 5255 y(34)p eop %%Page: 35 35 35 34 bop 722 540 a Fv(t)m(yp)s(edef)49 b(struct)41 b Ft(str)p 1479 540 30 4 v 33 w(Stats)50 b Fk(f)853 639 y Fv(in)m(t)41 b Ft(c)l(ount)8 b Fl(;)880 b Fc(=)p Fk(\003)27 b Fu(Num)n(b)r(er)g(of)f(strings)j(created)i Fk(\003)p Fc(=)853 739 y Fv(in)m(t)41 b Ft(bytes)7 b Fl(;)897 b Fc(=)p Fk(\003)27 b Fu(Num)n(b)r(er)g(of)f(b)n(ytes)j(allo)r(cated)e Fk(\003)p Fc(=)853 839 y Fv(in)m(t)41 b Ft(r)l(etrievals)7 b Fl(;)741 b Fc(=)p Fk(\003)27 b Fu(T)-7 b(otal)26 b(n)n(um)n(b)r(er)g (of)h(retriev)-5 b(als)29 b Fk(\003)p Fc(=)853 938 y Fv(in)m(t)41 b Ft(hits)7 b Fl(;)945 b Fc(=)p Fk(\003)27 b Fu(Num)n(b)r(er)g(of)f(retriev)-5 b(als)29 b(from)c(top)i(of)g(a)g (list)g Fk(\003)p Fc(=)853 1038 y Fv(in)m(t)41 b Ft(misses)7 b Fl(;)841 b Fc(=)p Fk(\003)27 b Fu(Num)n(b)r(er)g(of)f(unsuccessful)32 b(retriev)-5 b(als)29 b Fk(\003)p Fc(=)722 1137 y Fk(g)43 b(\003)p Ft(str)p 952 1137 V 33 w(Stats)7 b Fl(;)1819 1320 y Fu(Figure)28 b(7:)36 b Ft(str)p 2286 1320 26 4 v 29 w(Stats)515 1668 y Fv(1.19.11)95 b Fm(str)p 1022 1668 30 4 v 35 w(exists)722 1822 y Fv(in)m(t)41 b Ft(str)p 983 1822 V 33 w(exists)7 b Fl(\()44 b Fv(const)d(c)m(har)i Fk(\003)p Ft(s)50 b Fl(\))515 1993 y Ft(str)p 618 1993 26 4 v 29 w(exists)34 b Fu(acts)29 b(lik)n(e)d Ft(str)p 1300 1993 V 29 w(p)l(o)l(ol)p 1469 1993 V 31 w(exists)p Fu(,)g(except)31 b(the)e(global)24 b(string)k(p)r(o)r(ol)f(is)g(used.) 515 2208 y Fv(1.19.12)95 b Fm(str)p 1022 2208 30 4 v 35 w(\014nd)722 2362 y Fv(const)42 b(c)m(har)h Fk(\003)p Ft(str)p 1351 2362 V 33 w(\014nd)9 b Fl(\()45 b Fv(const)d(c)m(har)h Fk(\003)p Ft(s)50 b Fl(\))515 2533 y Ft(str)p 618 2533 26 4 v 29 w(\014nd)c Fu(acts)36 b(lik)n(e)e Ft(str)p 1263 2533 V 29 w(p)l(o)l(ol)p 1432 2533 V 31 w(\014nd)p Fu(,)k(except)g(the)f(global)32 b(string)k(p)r(o)r(ol)e(is)h(used.)61 b(If)35 b(the)i(global)32 b(string)515 2632 y(p)r(o)r(ol)27 b(has)j(not)e(b)r(een)j(initialized,)26 b(it)i(will)e(b)r(e)k (initialized)c(automatically)-7 b(.)33 b(F)-7 b(urther,)31 b(on)e(systems)g(that)515 2732 y(supp)r(ort)g Ft(atexit)35 b Fu(or)28 b Ft(on)p 1252 2732 V 32 w(exit)p Fu(,)e Ft(str)p 1562 2732 V 29 w(destr)l(oy)35 b Fu(will)25 b(b)r(e)k(called)e (automatically)22 b(at)27 b(program)e(termination.)515 2948 y Fv(1.19.13)95 b Fm(str)p 1022 2948 30 4 v 35 w(\014ndn)722 3101 y Fv(const)42 b(c)m(har)h Fk(\003)p Ft(str)p 1351 3101 V 33 w(\014ndn)6 b Fl(\()47 b Fv(const)41 b(c)m(har)i Fk(\003)p Ft(s)p Fl(,)f Fv(in)m(t)f Ft(length)50 b Fl(\))515 3272 y Ft(str)p 618 3272 26 4 v 29 w(\014ndn)39 b Fu(acts)31 b(lik)n(e)e Ft(str)p 1292 3272 V 29 w(\014nd)p Fu(,)j(except)h(that)d (the)i(length)e(of)f(the)j(string)e(is)g(sp)r(eci\014ed,)j(and)d(the)i (string)515 3372 y(do)r(es)d(not)f(ha)n(v)n(e)f(to)g(b)r(e)i Fv(NULL)e Fu(terminated.)515 3588 y Fv(1.19.14)95 b Fm(str)p 1022 3588 30 4 v 35 w(c)-5 b(opy)722 3741 y Fv(const)42 b(c)m(har)h Fk(\003)p Ft(str)p 1351 3741 V 33 w(c)l(opy)7 b Fl(\()45 b Fv(const)d(c)m(har)h Fk(\003)p Ft(s)50 b Fl(\))515 3912 y Ft(str)p 618 3912 26 4 v 29 w(c)l(opy)41 b Fu(acts)34 b(lik)n(e)d Ft(str)p 1277 3912 V 29 w(p)l(o)l(ol)p 1446 3912 V 31 w(c)l(opy)p Fu(,)j(except)h(the)f(global)29 b(string)k(p)r(o)r(ol)f(is)g(used.)53 b(If)32 b(the)h(global)d(string) 515 4012 y(p)r(o)r(ol)d(has)j(not)e(b)r(een)j(initialized,)26 b(it)i(will)e(b)r(e)k(initialized)c(automatically)-7 b(.)33 b(F)-7 b(urther,)31 b(on)e(systems)g(that)515 4111 y(supp)r(ort)g Ft(atexit)35 b Fu(or)28 b Ft(on)p 1252 4111 V 32 w(exit)p Fu(,)e Ft(str)p 1562 4111 V 29 w(destr)l(oy)35 b Fu(will)25 b(b)r(e)k(called)e(automatically)22 b(at)27 b(program)e(termination.)515 4327 y Fv(1.19.15)95 b Fm(str)p 1022 4327 30 4 v 35 w(c)-5 b(opyn)722 4480 y Fv(const)42 b(c)m(har)h Fk(\003)p Ft(str)p 1351 4480 V 33 w(c)l(opyn)6 b Fl(\()46 b Fv(const)41 b(c)m(har)j Fk(\003)p Ft(s)p Fl(,)e Fv(in)m(t)e Ft(length)51 b Fl(\))515 4651 y Ft(str)p 618 4651 26 4 v 29 w(c)l(opyn)35 b Fu(acts)29 b(lik)n(e)c Ft(str)p 1306 4651 V 30 w(c)l(opy)p Fu(,)i(except)j(that)d (the)i(length)e(of)f(the)j(string)e(is)g(sp)r(eci\014ed,)i(and)e(the)i (string)515 4751 y(do)r(es)g(not)f(ha)n(v)n(e)f(to)g(b)r(e)i Fv(NULL)e Fu(terminated.)2115 5255 y(35)p eop %%Page: 36 36 36 35 bop 515 523 a Fv(1.19.16)95 b Fm(str)p 1022 523 30 4 v 35 w(gr)-5 b(ow)722 676 y Fv(v)m(oid)42 b Ft(str)p 1044 676 V 33 w(gr)l(ow)9 b Fl(\()43 b Fv(const)e(c)m(har)i Fk(\003)p Ft(s)p Fl(,)f Fv(in)m(t)f Ft(length)50 b Fl(\))515 847 y Ft(str)p 618 847 26 4 v 29 w(gr)l(ow)38 b Fu(will)27 b(gro)n(w)j(a)g(string)g(un)n(til)f Ft(str)p 1823 847 V 29 w(\014nish)38 b Fu(is)30 b(called.)44 b(There)33 b(m)n(ust)28 b(not)j(b)r(e)g(an)n(y)f(other)i(calls)d(to)515 947 y(mo)r(dify)23 b(the)29 b(global)24 b(string)k(p)r(o)r(ol)f(b)r(et) n(w)n(een)j(the)f(\014rst)h(call)c(to)h Ft(str)p 2593 947 V 29 w(gr)l(ow)35 b Fu(and)28 b(the)h(call)d(to)i Ft(str)p 3482 947 V 29 w(\014nish)p Fu(.)515 1163 y Fv(1.19.17)95 b Fm(str)p 1022 1163 30 4 v 35 w(\014nish)722 1316 y Fv(const)42 b(c)m(har)h Fk(\003)p Ft(str)p 1351 1316 V 33 w(\014nish)6 b Fl(\()45 b Fv(v)m(oid)d Fl(\))515 1487 y Ft(str)p 618 1487 26 4 v 29 w(\014nish)g Fu(will)31 b(\014nish)k(the)g(gro)n(wth)f(of)g(a)f(string)i(p)r(erformed)f(b)n(y)g (m)n(ultiple)c(calls)j(to)h Ft(str)p 3385 1487 V 29 w(gr)l(ow)p Fu(.)55 b(The)515 1587 y(string)30 b(will)d(b)r(e)k(n)n(ull)d (terminated)h(and)g(will)e(b)r(e)k(en)n(tered)j(in)n(to)28 b(the)j(global)c(string)j(p)r(o)r(ol)f(tables.)43 b(Calls)515 1686 y(to)27 b Ft(str)p 719 1686 V 29 w(gr)l(ow)35 b Fu(follo)n(ws)25 b(b)n(y)i(a)h(call)e(to)h Ft(str)p 1760 1686 V 29 w(\014nish)36 b Fu(is)27 b(equiv)-5 b(alen)n(t)27 b(to)h(a)f(single)g(call)f(to)i Ft(str)p 3250 1686 V 29 w(\014ndn)p Fu(.)515 1902 y Fv(1.19.18)95 b Fm(str)p 1022 1902 30 4 v 35 w(unique)722 2055 y Fv(const)42 b(c)m(har)h Fk(\003)p Ft(str)p 1351 2055 V 33 w(unique)6 b Fl(\()46 b Fv(const)41 b(c)m(har)i Fk(\003)p Ft(pr)l(e\014x)54 b Fl(\))515 2227 y Ft(str)p 618 2227 26 4 v 29 w(unique)38 b Fu(returns)c(a)d(unique)g(string)g(with)f(the)i(giv)n(en)e(pre\014x.) 46 b(This)31 b(is)g(not)f(the)i(most)d(prett)n(y)j(w)n(a)n(y)515 2326 y(to)25 b(generate)k(unique)d(strings,)h(and)e(should)h(b)r(e)h (impro)n(v)n(ed.)32 b(The)27 b(string)f(is)g(placed)h(in)e(the)i (string)f(p)r(o)r(ol)515 2426 y(and)h(do)r(es)i(not)f(need)i(to)d(b)r (e)i(freed.)515 2642 y Fv(1.19.19)95 b Fm(str)p 1022 2642 30 4 v 35 w(destr)-5 b(oy)722 2795 y Fv(v)m(oid)42 b Ft(str)p 1044 2795 V 33 w(destr)l(oy)7 b Fl(\()44 b Fv(v)m(oid)e Fl(\))515 2966 y Ft(str)p 618 2966 26 4 v 29 w(destr)l(oy)27 b Fu(frees)c(all)17 b(of)i(the)j(memory)15 b(asso)r(ciated)22 b(with)e(the)h(global)c(string)k(p)r(o)r(ol.)32 b(Since)21 b(this)f(function)515 3066 y(is)30 b(called)g(automatically) 25 b(at)30 b(program)e(termination)f(on)j(systems)h(that)g(supp)r(ort)i Ft(atexit)38 b Fu(or)31 b Ft(on)p 3620 3066 V 31 w(exit)p Fu(,)515 3165 y(there)f(should)d(b)r(e)j(no)d(need)j(to)d(call)f(this)i (function)f(explicitly)-7 b(.)639 3265 y(If)32 b(this)g(function)f(is)h (called)g(explicitly)-7 b(,)30 b(the)k(next)f(call)d(to)i Ft(str)p 2635 3265 V 29 w(\014nd)43 b Fu(will)29 b(re-initialize)h(the) j(global)515 3365 y(string)28 b(p)r(o)r(ol.)515 3580 y Fv(1.19.20)95 b Fm(str)p 1022 3580 30 4 v 35 w(get)p 1177 3580 V 36 w(stats)722 3734 y Ft(str)p 825 3734 V 34 w(Stats)50 b(str)p 1185 3734 V 34 w(get)p 1323 3734 V 34 w(stats)7 b Fl(\()44 b Fv(v)m(oid)d Fl(\))515 3905 y Ft(str)p 618 3905 26 4 v 29 w(get)p 751 3905 V 30 w(stats)29 b Fu(returns)c(statistics)f(ab)r(out)e(the)h(global)c(string)j(p)r(o)r (ol.)33 b(The)23 b Ft(str)p 2915 3905 V 29 w(Stats)29 b Fu(structure)e(is)22 b(sho)n(wn)515 4004 y(in)27 b(Figure)h(7.)515 4220 y Fv(1.19.21)95 b Fm(str)p 1022 4220 30 4 v 35 w(print)p 1265 4220 V 34 w(stats)722 4373 y Fv(v)m(oid)42 b Ft(str)p 1044 4373 V 33 w(print)p 1255 4373 V 34 w(stats)7 b Fl(\()43 b Ft(FILE)55 b Fk(\003)p Ft(str)l(e)l(am)48 b Fl(\))515 4544 y Ft(str)p 618 4544 26 4 v 29 w(print)p 825 4544 V 30 w(stats)43 b Fu(prin)n(ts)38 b(the)g(statistics)h(for)d(the)i (global)c(string)k(p)r(o)r(ol)e(on)g(the)j(sp)r(eci\014ed)h Ft(str)l(e)l(am)p Fu(.)63 b(If)515 4644 y Ft(str)l(e)l(am)32 b Fu(is)c Fv(NULL)p Fu(,)e(then)j Fv(stdout)23 b Fu(will)i(b)r(e)k (used.)2115 5255 y(36)p eop %%Page: 37 37 37 36 bop 515 523 a Fv(1.19.22)95 b Fm(txt)p 1018 523 30 4 v 36 w(soundex)722 676 y Fv(const)42 b(c)m(har)h Fk(\003)p Ft(txt)p 1347 676 V 34 w(soundex)10 b Fl(\()47 b Fv(const)41 b(c)m(har)i Fk(\003)p Ft(string)50 b Fl(\))515 847 y Fu(Giv)n(en)26 b(a)h(string,)g(return)j(\(in)e(a)f Ft(static)k Fu(bu\013er\),)e(the)g(Soundex)g(v)-5 b(alue)27 b(for)g(the)i(string.)639 947 y(The)40 b(basic)g(algorithm)34 b(for)39 b(the)h(soundex)h(routine)e(is)g(from)d(Donald)h(E.)i(Kn)n (uth's)h(THE)g(AR)-7 b(T)515 1047 y(OF)33 b(COMPUTER)h(PR)n(OGRAMMING,) c(V)-7 b(olume)29 b(3:)46 b(Sorting)32 b(and)g(Searc)n(hing)h (\(Addison-W)-7 b(esley)515 1146 y(Publishing)34 b(Co.,)h(1973,)f (pages)j(391)d(and)h(392\).)58 b(Kn)n(uth)37 b(notes)g(that)f(the)g (metho)r(d)e(w)n(as)i(originally)515 1246 y(describ)r(ed)i(b)n(y)d (Margaret)h(K.)f(Odell)f(and)h(Rob)r(ert)h(C.)e(Russell)h([US)f(P)n (aten)n(ts)j(1261167)32 b(\(1918\))h(and)515 1346 y(1435663)24 b(\(1922\)].)515 1578 y Fn(1.20)111 b(Timer)33 b(Supp)s(ort)515 1731 y Fu(These)21 b(routines)f(pro)n(vide)f(access)j(to)d(a)f (microsecond-resolution)g(time)e(that)j(can)h(b)r(e)g(used)h(for)d (pro\014ling.)515 1947 y Fv(1.20.1)95 b Fm(tim)p 1000 1947 V 35 w(start)722 2100 y Fv(v)m(oid)42 b Ft(tim)p 1068 2100 V 34 w(start)8 b Fl(\()42 b Fv(const)g(c)m(har)h Fk(\003)p Ft(name)50 b Fl(\))515 2271 y Fu(Start)28 b(the)h(named)d (timer.)515 2487 y Fv(1.20.2)95 b Fm(tim)p 1000 2487 V 35 w(stop)722 2640 y Fv(v)m(oid)42 b Ft(tim)p 1068 2640 V 34 w(stop)5 b Fl(\()44 b Fv(const)e(c)m(har)h Fk(\003)p Ft(name)50 b Fl(\))515 2812 y Fu(Stop)27 b(the)i(named)d (timer.)515 3027 y Fv(1.20.3)95 b Fm(tim)p 1000 3027 V 35 w(r)-5 b(eset)722 3181 y Fv(v)m(oid)42 b Ft(tim)p 1068 3181 V 34 w(r)l(eset)8 b Fl(\()42 b Fv(const)g(c)m(har)h Fk(\003)p Ft(name)50 b Fl(\))515 3352 y Fu(Reset)29 b(the)g(named)d (timer)f(to)j(zero)h(elapsed)g(time.)34 b(Use)29 b Ft(tim)p 2450 3352 26 4 v 30 w(start)34 b Fu(to)28 b(reset)j(the)e(start)g (time.)515 3567 y Fv(1.20.4)95 b Fm(tim)p 1000 3567 30 4 v 35 w(get)p 1155 3567 V 36 w(r)-5 b(e)g(al)722 3721 y Fv(double)39 b Ft(tim)p 1170 3721 V 34 w(get)p 1308 3721 V 35 w(r)l(e)l(al)9 b Fl(\()41 b Fv(const)h(c)m(har)h Fk(\003)p Ft(name)51 b Fl(\))515 3892 y Fu(Get)29 b(the)h(w)n(all)d (time)f(in)i(seconds)k(from)26 b(the)k(named)d(timer.)37 b(The)30 b(return)i(v)-5 b(alue)28 b(is)h(a)g Ft(double)36 b Fu(and)29 b(has)515 3991 y(microsecond)e(resolution)g(if)g(the)h (curren)n(t)j(system)d(pro)n(vides)g(that)g(accuracy)h(\(most)d (don't\).)515 4207 y Fv(1.20.5)95 b Fm(tim)p 1000 4207 V 35 w(get)p 1155 4207 V 36 w(user)722 4360 y Fv(double)39 b Ft(tim)p 1170 4360 V 34 w(get)p 1308 4360 V 35 w(user)9 b Fl(\()43 b Fv(const)f(c)m(har)h Fk(\003)p Ft(name)50 b Fl(\))515 4532 y Fu(Get)28 b(the)h(n)n(um)n(b)r(er)d(of)h(seconds)j (of)d(user)j(CPU)e(time.)2115 5255 y(37)p eop %%Page: 38 38 38 37 bop 515 523 a Fv(1.20.6)95 b Fm(tim)p 1000 523 30 4 v 35 w(get)p 1155 523 V 36 w(system)722 676 y Fv(double)39 b Ft(tim)p 1170 676 V 34 w(get)p 1308 676 V 35 w(system)6 b Fl(\()44 b Fv(const)d(c)m(har)i Fk(\003)p Ft(name)51 b Fl(\))515 847 y Fu(Get)28 b(the)h(n)n(um)n(b)r(er)d(of)h(seconds)j (of)d(system)g(CPU)i(time.)515 1063 y Fv(1.20.7)95 b Fm(tim)p 1000 1063 V 35 w(print)p 1243 1063 V 34 w(timer)722 1216 y Fv(v)m(oid)42 b Ft(tim)p 1068 1216 V 34 w(print)p 1280 1216 V 34 w(timer)9 b Fl(\()42 b Ft(FILE)54 b Fk(\003)p Ft(str)p Fl(,)40 b Fv(const)i(c)m(har)h Fk(\003)p Ft(name)51 b Fl(\))515 1388 y Fu(Prin)n(t)28 b(the)h(named)c(timer)h(v)-5 b(alues)28 b(to)f Ft(str)p Fu(.)35 b(The)29 b(format)24 b(is)j(similar)c(to)k Fv(time\(1\))p Fu(.)515 1603 y Fv(1.20.8)95 b Fm(tim)p 1000 1603 V 35 w(print)p 1243 1603 V 34 w(timers)722 1757 y Fv(v)m(oid)42 b Ft(tim)p 1068 1757 V 34 w(print)p 1280 1757 V 34 w(timers)7 b Fl(\()41 b Ft(FILE)55 b Fk(\003)p Ft(str)50 b Fl(\))515 1928 y Fu(Prin)n(t)28 b(all)d(the)k(timers)d(to)i Ft(str)p Fu(.)34 b(The)29 b(order)g(is)f(arbitary)-7 b(.)515 2144 y Fv(1.20.9)p 860 2144 V 131 w Fm(tim)p 1036 2144 V 35 w(shutdown)722 2297 y Fv(v)m(oid)p 946 2297 V 77 w Ft(tim)p 1103 2297 V 33 w(shutdown)6 b Fl(\()46 b Fv(v)m(oid)c Fl(\))515 2468 y Fu(F)-7 b(ree)21 b(all)16 b(memory)e(asso)r(ciated)21 b(with)d(the)i(timers.)31 b(This)19 b(function)f(is)h(called)f (automatically)13 b(at)18 b(program)515 2568 y(termination.)32 b(There)e(should)e(nev)n(er)h(b)r(e)g(a)f(need)h(to)f(call)e(this)i (function)f(in)g(user-lev)n(el)i(co)r(de.)2115 5255 y(38)p eop %%Page: 39 39 39 38 bop 515 523 a Fw(A)135 b(Maa)515 705 y Fu(When)23 b(Khep)r(er)9 b(_)-32 b(a)25 b(rose)g(up)f(out)f(of)f(the)i(w)n(atery)g (ab)n(yss)g(of)e(Nu,)h(he)h(created)j(Maa)22 b(as)h(a)g(foundation)e (up)r(on)515 805 y(whic)n(h)27 b(to)h(create)i(ev)n(erything)f(else)g ([Budge04,)d(pp.)h(295{8].)515 1079 y Fw(References)515 1261 y Fu([Aho88])38 b(Alfred)32 b(V.)e(Aho,)h(Ra)n(vi)e(Sethi,)j(and)e (Je\013rey)35 b(D.)30 b(Ullman.)41 b Ft(Compilers:)i(Principles,)32 b(T)-6 b(e)l(ch-)685 1361 y(niques,)31 b(and)g(T)-6 b(o)l(ols)p Fu(.)35 b(Addison-W)-7 b(esley)g(,)27 b(Reading,)e(MA,)i(1988.)515 1527 y([Budge04])40 b(E.)22 b(A.)h(W)-7 b(allis)19 b(Budge.)30 b Ft(The)25 b(go)l(ds)h(of)g(the)f(Egyptians)i(or)e(studies)g(in)h (Egyptian)g(mytholo)l(gy)p Fu(,)685 1626 y(v)n(olume)e(2.)36 b(Do)n(v)n(er)27 b(Publications,)f(1969.)515 1792 y([Kn)n(uth73])39 b(Donald)33 b(E.)i(Kn)n(uth.)60 b Ft(Sorting)37 b(and)h(Se)l(ar)l (ching)p Fu(,)f(v)n(olume)32 b(3)j(of)f(The)j(Art)f(of)e(Computer)685 1892 y(Programming.)29 b(Addison-W)-7 b(esley)g(,)28 b(Reading,)d(MA,)i(1973.)515 2058 y([Pugh90])39 b(William)21 b(Pugh.)39 b(Skip)28 b(lists:)38 b(a)28 b(probabilistic)f(alternativ)n (e)h(to)h(balanced)g(trees.)42 b Ft(Commu-)685 2158 y(nic)l(ations)31 b(of)e(the)h(A)n(CM)p Fu(,)c Fv(33)p Fu(\(6\):668{76,)d(June)29 b(1990.)2115 5255 y(39)p eop %%Trailer end userdict /end-hook known{end-hook}if %%EOF libmaa-1.4.4/doc/NEWS0000644000175000017500000001234013457657444014146 0ustar cheusovcheusov======================================================================== Version 1.4.4, by Aleksey Cheusov, Tue, 23 Apr 2019 21:50:34 +0300 Fix compilation failure using gcc-8. Thanks to Robert Luberda! ======================================================================== Version 1.4.3, by Aleksey Cheusov, Fri, 15 Feb 2019 21:09:58 +0300 Fix parallel build ======================================================================== Version 1.4.2, by Aleksey Cheusov, Wed, 7 Mar 2018 1:10:37 +0300 Fix build failure on SunOS-5.11 (alloca) ======================================================================== Version 1.4.1, by Aleksey Cheusov, Tue, 27 Feb 2018 20:47:19 +0300 License has been changed from LGPL to MIT, permitted by Rik Faith, original author of this library. Build system changed from autoshit to mk-configure. Library version/soname was bumped from 3 to 4. I cannot guarantee that mk-configure and libtool build shared library the same way. Tests were added for stk_*, mem_* and prm_* functions. stk_isempty function was added. stk_* and other was reimplemented without obstack functions (glibc extension). ======================================================================== Version 1.3.2, by Aleksey Cheusov, Sun, 22 Jul 2012 17:44:37 +0300 Build failure on cygwin was fixed (sf.net bug #3398121) __inline__ directives were removed ======================================================================== Version 1.3.1, by Aleksey Cheusov, Sat, 22 Oct 2011 12:31:47 +0300 Build failure with gcc-4.6 was fixed. Thanks to Andrey N. Oktyabrski for the report. ======================================================================== Version 1.3.0, by Aleksey Cheusov, Sun, 10 Apr 2011 17:44:10 +0300 Only maa's symbols are exported from libmaa shared library (export.sym). 'libtool -export-symbols' is used for this to work. | DUE TO THIS IN ORDER TO AVOID POTENTIAL ABI INCOMPATIBILITIES, I'VE INCREASED MAJOR VERSION OF THE SHARED LIBRARY. FIXED: when both stream/file and syslog logging facilities are enabled, log_info() and other logging functions segfault on NetBSD-5.1/x86_64. va_copy magic was needed to fix this problem. It is assumed that strchr(3) is always available (no autoconf check). The same for unistd.h header file. CFLAGS set by user may override default -Wall -Werror set for GCC. Fix for warning messages produced by SunPro compiler (integer overflow detected: op "<<") -c flag was added to INSTALL_DATA invocation FIXED: compilation error on CentOS-5.4 FIXED: "make test" failed on OpenBSD-3.8. This system defines intptr_t in inttypes.h, not in stdint.h ======================================================================== Version 1.2.0, by Aleksey Cheusov, Wed, 18 Nov 2009 23:12:09 +0200 For better conformance with POSIX/SUS xmalloc, xrealloc and xcalloc functions take 'size_t' args, not 'unsigned int'. Due to change in API a major shared library number is bumped from 1 to 2 New trivial test for log.c fix for sltest.c: on OpenBSD intptr_t is defined in stdint.h Makefile.in: GNU make is not required anymore, bsd make is enough ======================================================================== Version 1.1.1, by Aleksey Cheusov, Sat, 31 Jan 2009 21:42:36 +0200 Makefile and configure fixes and clean-ups: LDFLAGS/LIBS passed to configure script are used to build library and test utilities Other minor clean-ups fixed: sf.net bug #2473314, test utility sltest.c failed under bigendian platforms. ======================================================================== Version 1.1.0, by Aleksey Cheusov, Sun, 7 Dec 2008 16:14:32 +0200 lots of code clean-ups MAA_TEENY constant added. Now libmaa has version 1.1.0, new maa_version_teeny function returns MAA_TEENY REMOVED: XTRAHEADERS, TARGETLIBS, RPATHFLAGS configure variables. Also removed are --with-purify, --with-insure, --with-efence, --with-checker, --with-local-dmalloc, --with-dmalloc, --with-gprof, --with-prof, --with-cflags and --with-cc options. Use standard CC, CFLAGS, CPPFLAGS, LDFLAGS and LIBS variables for configuring. compilation error on ALTlinux fixed: on latest glibc's write(2) is marked as WUR , i.e. return value MUST be checked, otherwise warnigns (errors with -Werror) are generated. target 'tests' renamed to 'test', target 'tests-update' renamed to 'test-update' Hash_table statistics is removed from settest.c and hashtest.c regression tests. This is because regression tests fail under 64-platforms. sltest.c (regression test): compilation failure on Linux/x86-64 fixed avoid using strdup(3), it is not portable (fails under Interix without -D_ALL_SOURCE). Another compilation fixes for Interix avoid using bcopy(3), use standard memcpy(3) instead -Werror is used instead of -pedantic (for gcc only) If at least one selftest fails (target 'test'), an exit status of 'make test' is 1. 'make test' now works correctly if it is run from external obj/ directory no '-g' hardcode for !gcc compilers no '-g -O' for gcc ======================================================================== Previous versions (1997-2008) were a part of dictd tarball libmaa-1.4.4/doc/libmaa.tex0000644000175000017500000001277613457657444015433 0ustar cheusovcheusov% user.tex -- User Manual for Libmaa % Created: Tue Jan 3 11:07:54 1995 by faith@cs.unc.edu % Revised: Wed May 21 00:49:39 1997 by faith@acm.org % Copyright 1995, 1997 Rickard E. Faith (faith@acm.org) % % Permission is hereby granted, free of charge, to any person obtaining % a copy of this software and associated documentation files (the % "Software"), to deal in the Software without restriction, including % without limitation the rights to use, copy, modify, merge, publish, % distribute, sublicense, and/or sell copies of the Software, and to % permit persons to whom the Software is furnished to do so, subject to % the following conditions: % % The above copyright notice and this permission notice shall be % included in all copies or substantial portions of the Software. % % THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, % EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF % MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND % NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE % LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION % OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION % WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. % % $Id: libmaa.tex,v 1.3 1997/05/21 05:01:33 faith Exp $ % \def\FileCreated{Tue Jan 3 11:07:54 1995} \def\FileRevised{Wed May 21 00:49:39 1997} \documentclass[draft]{article} \usepackage{xspace} %\usepackage{program} \usepackage{verbatim} \usepackage{lgrind} \usepackage{epic} \usepackage{eepicemu} %\usepackage{outline} \usepackage{ifthen} \addtolength{\textwidth}{0.7in} \addtolength{\evensidemargin}{-0.7in} \DeclareFontShape{OT1}{cmtt}{bx}{n}{ <5><6><7><8>cmbtt8 <9>cmbtt9 <10><10.95><12><14.4><17.28><20.74><24.88>cmbtt10 }{} \DeclareFontShape{OT1}{cmr}{bx}{sc}{ <5><6><7><8><9><10><10.95><12> <14.4><17.28><20.74><24.88> cmbcsc10 }{} \newcommand{\prog}[1]{\texttt{#1}\xspace} \newcommand{\system}[1]{\textsc{#1}\xspace} %\newcommand{\keyword}[1]{\texttt{#1}\xspace} \newcommand{\figref}[1]{Fig.~\ref{#1}\xspace} \newcommand{\libmaa}{\textsc{libmaa}\xspace} \newcommand{\khepera}{\textsc{Khepera}\xspace} \newcommand{\kheperalong}{\textsc{Khepera} Transformation System\xspace} \newcommand{\Khepera}{Kheper\.a\xspace} \newcommand{\Ra}{R\=a\xspace} \newcommand{\Maa}{Maa\xspace} % systems \newcommand{\refine}{\system{Refine}} \newcommand{\dtre}{\system{dtre3}} \newcommand{\eli}{\system{Eli}} \newcommand{\cocktail}{\system{Cocktail}} \newcommand{\txl}{\system{txl}} \newcommand{\ZAP}{\system{zap}} \newcommand{\dialect}{\system{Dialect}} \newcommand{\pccts}{\system{pccts}} \newcommand{\sorcerer}{\system{Sorcerer}} \newcommand{\trans}{\system{Trans}} \newcommand{\sagepp}{\system{Sage}$++$} % programs \newcommand{\texinfo}{\TeX{}Info} \newcommand{\info}{\prog{info}} \newcommand{\yacc}{\prog{yacc}} \newcommand{\byacc}{\prog{byacc}} \newcommand{\bison}{\prog{bison}} \newcommand{\make}{\prog{make}} \newcommand{\lex}{\prog{lex}} \newcommand{\mpl}{\prog{mpl}} \newcommand{\pvm}{\prog{pmv}} \newcommand{\mpi}{\prog{mpi}} \newcommand{\pthreads}{\prog{pthreads}} % Misc \newcommand{\LISP}{\textsc{Lisp}\xspace} \newcommand{\proteus}{\textsc{Proteus}\xspace} \newcommand{\unix}{\textsc{Unix}\xspace} \newcommand{\AST}{\textsc{ast}\xspace} \newcommand{\cse}{\textsc{cse}\xspace} \newcommand{\postscript}{\textsc{PostScript}\xspace} \newcommand{\nesl}{\textsc{Nesl}\xspace} \newcommand{\fortran}{\textsc{Fortran}\xspace} \newcommand{\hpf}{\textsc{HPF}\xspace} \newcommand{\maspar}{\textsc{MasPar}\xspace} \newcommand{\keyword}[1]{\mbox{\normalshape\bf #1}} \newcommand{\INT}{\keyword{int}\ } \newcommand{\FLOAT}{\keyword{float}\ } \newcommand{\DOUBLE}{\keyword{double}\ } \newcommand{\CHAR}{\keyword{char}\ } \newcommand{\CONST}{\keyword{const}\ } \newcommand{\UNSIGNED}{\keyword{unsigned}\ } \newcommand{\VOID}{\keyword{void}\ } \newcommand{\RETURN}{\keyword{return}\ } \newcommand{\CBEGIN}{\{\ \qtab} \newcommand{\CEND}{\untab\}} \usepackage{fancybox} \newenvironment{Module}% {\rule{0pt}{5.25ex}% \begin{Sbox}\rule[-2ex]{0pt}{5ex}\begin{minipage}{6.75em}\begin{center}}% {\end{center}\end{minipage}\end{Sbox}\fbox{\TheSbox}} \newenvironment{Comment}{\begin{minipage}{4.4em}\begin{center}}% {\end{center}\end{minipage}} \begin{document} \bibliographystyle{refalpha} \title{Libmaa User's Manual} \author{Rickard E. Faith\thanks{Cray Fellow; supported by ARPA via ONR contract N00014-92-C-0182, by Rome Labs contract F30602-94-C-0037, and by a Cray Fellowship from Cray Research, Inc. and NCSC (North Carolina Supercomputing Center)..} \\ Department of Computer Science \\ University of North Carolina at Chapel Hill} \date{TR96-009 \\ DRAFT: \FileRevised \\ $Revision: 1.3 $} \maketitle\tableofcontents \clearpage \begin{abstract} The \libmaa library provides many low-level data structures which are helpful for writing compilers, including hash tables, sets, lists, debugging support, and memory management. Although \libmaa was designed and implemented as a foundation for the \kheperalong, the data structures are generally applicable to a wide range of programming problems. The memory management routines are especially helpful for improving the performance of memory-intensive applications. \end{abstract} \clearpage \section{Functions} \input general.tex \clearpage \appendix \section{\Maa} When \Khepera rose up out of the watery abyss of Nu, he created \Maa as a foundation upon which to create everything else \cite[pp.~295--8]{faith:Budge04b}. \bibliography{libmaa} \end{document} libmaa-1.4.4/doc/libmaa.bib0000644000175000017500000000231613457657444015354 0ustar cheusovcheusov@BOOK{faith:Aho88, AUTHOR = "Alfred V. {Aho} and Ravi {Sethi} and Jeffrey D. {Ullman}", TITLE = "Compilers: Principles, Techniques, and Tools", DATE = "1988", PUBLISHER = "Addison-Wesley, Reading, MA", SUBMITTER = "faith@proteus (Sun Jan 8 20:39:54 1995)", KEY = "Aho88"} @BOOK{faith:Budge04b, AUTHOR = "E. A. Wallis {Budge}", TITLE = "The gods of the Egyptians or studies in Egyptian mythology", VOLUME = "2", DATE = "1969", PUBLISHER = "Dover Publications", SUBMITTER = "faith@proteus (Sun Nov 19 11:03:09 1995)", KEY = "Budge04"} @BOOK{faith:Knuth73c, AUTHOR = "Donald E. {Knuth}", TITLE = "Sorting and Searching", DATE = "1973", PUBLISHER = "Addison-Wesley, Reading, MA", SERIES = "The Art of Computer Programming", VOLUME = "3", SUBMITTER = "faith@proteus (Sun Jan 8 20:30:28 1995)", KEY = "Knuth73"} @ARTICLE{faith:Pugh90, AUTHOR = "William {Pugh}", TITLE = "Skip lists: a probabilistic alternative to balanced trees", JOURNAL = "Communications of the ACM", VOLUME = "33", NUMBER = "6", DATE = "June 1990", PAGES = "668--76", SUBMITTER = "faith@proteus (Sun Feb 25 15:26:48 1996)", KEY = "Pugh90"} libmaa-1.4.4/doc/LICENSE0000644000175000017500000000215513457657444014457 0ustar cheusovcheusovCopyright (c) 1995-2002 Rik Faith Copyright (c) 2002-2018 Aleksey Cheusov Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. libmaa-1.4.4/doc/Makefile0000644000175000017500000000502613457657444015112 0ustar cheusovcheusov# Makefile -- Makefile for libmaa documentation # Created: Sun Jan 8 21:44:38 1995 by faith@cs.unc.edu # Revised: Wed May 21 00:56:52 1997 by faith@acm.org # Tue Nov 14 22:28:59 2017 by vle@gmx.net # Copyright 1995, 1996, 1997 Rickard E. Faith (faith@acm.org) # Copyright 2017 Aleksey Cheusov (vle@gmx.net) # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, # distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so, subject to # the following conditions: # # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. .SUFFIXES: .bib .bbl LATEX ?= latex PERL ?= perl FIG2DEV ?= fig2dev DVIPS ?= dvips REFBIBTEX ?= refbibtex BIBTEX ?= bibtex LIBMAA_SOURCES != echo ../maa/*.c ../maa/*.h FIGS = SLIDEFIGS = TEMPORARIES = general.tex FILES = libmaa.600dpi.ps ../README NEWS LICENSE FILESDIR = ${DOCDIR} libmaa.dvi: libmaa.tex ${TEMPORARIES} ${FIGS} #all: libmaa.dvi libmaa.bib: libmaa.tex if ${REFBIBTEX} -j libmaa.tex ${TEMPORARIES} > $@.tmp; then \ touch $@; \ fi cmp -s $@ $@.tmp || mv $@.tmp $@ -rm -f $@.tmp general.tex: ${LIBMAA_SOURCES} ${PERL} extract.pl ${LIBMAA_SOURCES} > general.tex .dvi.ps: if fgrep 'LANDSCAPE MODE' ${<:H}.log > /dev/null; then \ ${DVIPS} -t landscape -o $@ ${<:H}; \ else \ ${DVIPS} -o $@ ${<:H}; \ fi .tex.stamp: test -f $*.stamp || cp $*.aux $*.stamp || touch $*.stamp ${LATEX} $* cmp -s $*.stamp $*.aux || cp $*.aux $*.stamp libmaa.dvi: libmaa.bbl libmaa.tex if fgrep 'LaTeX Warning: Label' libmaa.log>/dev/null; then ${LATEX} libmaa.tex; fi if fgrep 'LaTeX Warning: Label' libmaa.log>/dev/null; then ${LATEX} libmaa.tex; fi if fgrep 'LaTeX Warning: Label' libmaa.log>/dev/null; then ${LATEX} libmaa.tex; fi .bib.bbl: ${BIBTEX} $< .include libmaa-1.4.4/Makefile.common0000644000175000017500000000014213457657444015626 0ustar cheusovcheusovMAA_MAJOR = 4 MAA_MINOR = 0 MAA_TEENY = 0 DOCDIR ?= ${DATADIR}/doc/libmaa VERSION = 1.4.4 libmaa-1.4.4/mk/0000755000175000017500000000000013457657444013311 5ustar cheusovcheusovlibmaa-1.4.4/mk/test.mk0000644000175000017500000000055513457657444014626 0ustar cheusovcheusov.PHONY : test_output do_all do_test do_test: post_all test_output: @set -e; \ LD_LIBRARY_PATH=${OBJDIR_maa}; \ export LD_LIBRARY_PATH; \ ${TEST_PROG:U${.OBJDIR}/${PROG}} ${TEST_PROG_ARGS} |\ awk ' \ /^version: / { gsub(/[0-9]+/, "999") } \ { sub(/ at [^ ]+$$/, " at 0xF00DBEAF") } \ { print }' CLEANFILES += check_mkc_err_msg .include libmaa-1.4.4/Makefile0000644000175000017500000000076113457657444014346 0ustar cheusovcheusov################################################## tests = arg base basics bit debug hash list log memstr memobj \ prime pr prm set sl string stack .for d in ${tests} LIBDEPS += maa:tests/${d} SUBPRJ += tests/${d}:test test-tests/${d}: all-tests/${d} .endfor SUBPRJ += doc NODEPS = install-tests/*:* ################################################## MKC_REQD = 0.29.1 ################################################## .include "Makefile.common" .include