source: to-imperative/trunk/runtime/pxx_common.cc @ 145

Last change on this file since 145 was 145, checked in by orlov, 18 years ago

* empty log message *

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 761 bytes
Line 
1// $Source$
2// $Revision: 145 $
3// $Date: 2002-08-29 04:02:53 +0000 (Thu, 29 Aug 2002) $
4
5#include "pxx_common.hh"
6
7#include <stdarg.h>
8#include <stdlib.h>
9
10namespace pxx
11{
12
13void (*terminate) ( int _error_code ) = null;
14
15void fatal( char* _fmt, ... )
16{
17  va_list ap;
18  va_start( ap, _fmt );
19  vfprintf( stderr, _fmt, ap );
20  fprintf( stderr, "\n" );
21  va_end( ap );
22  if( terminate != null ) (*terminate)( -1 );
23  else exit( -1 );
24}
25
26size_t page_size ;
27size_t orders[256] ;
28size_t rounds[ROUNDS_SIZE] ;
29
30class Init
31{
32
33public:
34
35  Init()
36  {
37    page_size = getpagesize();
38    orders[0] = 1;
39    for( unsigned i = 1; i < 256; i++ )
40    {
41      orders[i] = 0;
42      for( unsigned s = i; s; s >>= 1, orders[i]++ );
43    }
44    for( unsigned i = 0; i < ROUNDS_SIZE; i++ )
45      rounds[i] = 1 << i;
46  }
47
48};
49
50Init init;
51
52}
Note: See TracBrowser for help on using the repository browser.