home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / GCC / GERLIB_DEV08B.LHA / gerlib / libg++ / gperf / src / main.cc < prev    next >
Encoding:
C/C++ Source or Header  |  1993-12-12  |  2.7 KB  |  96 lines

  1. /*
  2. gcc b:/startup/crt0.o b:/amiga/normal/build_argc_argv.o bool-array.o main.o new.o options.o gen-perf.o hash-table.o iterator.o key-list.o read-line.o std-err.o version.o list-node.o -nostdlib -lgpp -lger -lamiga -o gperf
  3. /src/gperf -p -j 1 -o -a -C -g -k1,4,$ <gplus.gperf
  4. */
  5. /* Driver program for the Gen_Perf hash function generator
  6.    Copyright (C) 1989 Free Software Foundation, Inc.
  7.    written by Douglas C. Schmidt (schmidt@ics.uci.edu)
  8.  
  9. This file is part of GNU GPERF.
  10.  
  11. GNU GPERF is free software; you can redistribute it and/or modify
  12. it under the terms of the GNU General Public License as published by
  13. the Free Software Foundation; either version 1, or (at your option)
  14. any later version.
  15.  
  16. GNU GPERF is distributed in the hope that it will be useful,
  17. but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  19. GNU General Public License for more details.
  20.  
  21. You should have received a copy of the GNU General Public License
  22. along with GNU GPERF; see the file COPYING.  If not, write to
  23. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  24.  
  25. /* Simple driver program for the Gen_Perf.hash function generator.
  26.    Most of the hard work is done in class Gen_Perf and its class methods. */
  27.  
  28. #ifdef amiga
  29. #define NEED_STDOUT
  30. #include "use_standard_argc_argv.h"
  31. #undef GLOBAL
  32. #endif
  33.  
  34. #include <_G_config.h>
  35. #include <sys/types.h>
  36. #if defined(COUNT_TIME) || _G_HAVE_SYS_RESOURCE
  37. #include <sys/time.h>
  38. #endif
  39. #ifdef COUNT_TIME
  40. #include <time.h>
  41. #endif
  42.  
  43. #if _G_HAVE_SYS_RESOURCE
  44. #include <sys/resource.h>
  45. #endif
  46. #include <stdio.h>
  47. #include "std-err.h"
  48. #include "options.h"
  49. #include "gen-perf.h"
  50. #include "trace.h"
  51.  
  52.  
  53. int
  54. main (int argc, char *argv[])
  55. {
  56.   T (Trace t ("main");)
  57.  
  58. #ifdef COUNT_TIME
  59.   struct tm *tm;
  60.   time_t     clock; 
  61.  
  62.   time (&clock);
  63.   tm = localtime (&clock);
  64.   printf ("/* starting time is %d:%02d:%02d */\n", tm->tm_hour, tm->tm_min, tm->tm_sec);
  65. #endif
  66.  
  67. #if defined(RLIMIT_STACK) && _G_HAVE_SYS_RESOURCE
  68.   /* Get rid of any avoidable limit on stack size.  */
  69.   {
  70.     struct rlimit rlim;
  71.  
  72.     /* Set the stack limit huge so that alloca does not fail. */
  73.     getrlimit (RLIMIT_STACK, &rlim);
  74.     rlim.rlim_cur = rlim.rlim_max;
  75.     setrlimit (RLIMIT_STACK, &rlim);
  76.   }
  77. #endif /* RLIMIT_STACK */
  78.  
  79.   /* Sets the Options. */
  80.   option (argc, argv);
  81.  
  82.   /* Initializes the key word list. */
  83.   Gen_Perf generate_table;
  84.  
  85.   /* Generates and prints the Gen_Perf hash table.
  86.      Don't use exit here, it skips the destructors. */
  87.   int status = generate_table ();
  88.  
  89. #ifdef COUNT_TIME
  90.   time (&clock);
  91.   tm = localtime (&clock);
  92.   printf ("/* ending time is %d:%02d:%02d */\n", tm->tm_hour, tm->tm_min, tm->tm_sec);
  93. #endif
  94.   return status;
  95. }
  96.