home *** CD-ROM | disk | FTP | other *** search
/ GEMini Atari / GEMini_Atari_CD-ROM_Walnut_Creek_December_1993.iso / zip / gnu / gperf.lzh / GPERF / MAIN.CC < prev    next >
C/C++ Source or Header  |  1993-07-30  |  2KB  |  75 lines

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