Mercurial > repo
comparison interps/c-intercal/inst/include/ick-0.29/yuk.h @ 996:859f9b4339e6
<Gregor> tar xf egobot.tar.xz
author | HackBot |
---|---|
date | Sun, 09 Dec 2012 19:30:08 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
995:6883f5911eb7 | 996:859f9b4339e6 |
---|---|
1 /* yuk.h - header file for yuk.c and debugging versions of ick-wrap.c */ | |
2 /* Copyright (C) Alex Smith 2006. See yuk.c for copyright conditions. | |
3 This file is GPL'd, and so can be freely redistributed but has | |
4 absolutely no warranty. */ | |
5 | |
6 #define YUK(t,u) yukline(t,u) | |
7 #define YUKTERM yukterm() | |
8 | |
9 #define YUKEND 5 | |
10 | |
11 /*@-exportlocal@*/ /* because these are used by generated programs */ | |
12 extern void yukline(int,int); | |
13 extern void yukterm(void); | |
14 | |
15 extern int ick_abstained[]; | |
16 extern int yukopts; | |
17 extern int ick_lineno; | |
18 extern int yuklines; | |
19 extern int yukcommands; | |
20 /*@-incondefs@*/ /* because it's a different textlines to the one in ick.h */ | |
21 extern char *textlines[]; | |
22 /*@=incondefs@*/ | |
23 extern int lineofaboff[]; | |
24 extern char *yukexplain[]; | |
25 | |
26 extern int yukloop; | |
27 /*@=exportlocal@*/ | |
28 | |
29 /* Defines that change the functions used for profiling. */ | |
30 | |
31 /* Define the following to the timing function you want for profiling, or leave | |
32 it undef to use the value computed by config.sh. */ | |
33 #undef YPTIMERTYPE | |
34 /* 0 to use clock(), 1 to use gettimeofday() and long, | |
35 2 to use gettimeofday() and long long, 3 to use gethrtime() | |
36 4 to use times(), 5 to use clock_gettime */ | |
37 /* Note: On many systems, 0's resolution is too low to produce any output | |
38 1 and 2 produce the same output; use 2 if your system can handle | |
39 long long because the overflow is dealt with more simply. | |
40 3 is a system-specific function. If there are more system-specific | |
41 functions around that return more accurate times than the others | |
42 used here, it would improve the profiler on those systems. | |
43 According to the DJGPP documentation, it's impossible to get times | |
44 with decent accuracy under DOS. DJGPP implements timer types 0, 1, | |
45 and 2, so it will 'work' with the default value of 2, but the results | |
46 you get will be basically meaningless as the base information can't | |
47 be accurately obtained (the resolution is slightly worse than 50ms, | |
48 which is far too slow for profiling). */ | |
49 #ifndef YPTIMERTIME | |
50 # ifdef HAVE_GETHRTIME | |
51 # define YPTIMERTYPE 3 | |
52 # else | |
53 # if defined(HAVE_CLOCK_GETTIME) && SIZEOF_LONG_LONG_INT + 0 > 0 | |
54 # define YPTIMERTYPE 5 | |
55 # else | |
56 # ifdef HAVE_GETTIMEOFDAY | |
57 /* Allow for an erroneous blank value for SIZEOF_LONG_LONG_INT. */ | |
58 # if SIZEOF_LONG_LONG_INT + 0 > 0 | |
59 # define YPTIMERTYPE 2 | |
60 # else | |
61 # define YPTIMERTYPE 1 | |
62 # endif | |
63 # else | |
64 # define YPTIMERTYPE 0 | |
65 # endif | |
66 # endif | |
67 # endif | |
68 #endif | |
69 | |
70 | |
71 #if YPTIMERTYPE == 0 | |
72 #define YPTIMERTFORMAT "lu" | |
73 #define YPCOUNTERTFORMAT "lu" | |
74 #define YPTIMERTFORMATD "6" YPTIMERTFORMAT | |
75 #define YPTIMERSCALE CLOCKS_PER_SEC | |
76 #define YPGETTIME clock() | |
77 typedef unsigned long yptimer; | |
78 typedef unsigned long ypcounter; | |
79 | |
80 #elif YPTIMERTYPE == 1 | |
81 #define YPTIMERTFORMAT "lu" | |
82 #define YPCOUNTERTFORMAT "lu" | |
83 #define YPTIMERTFORMATD "6" YPTIMERTFORMAT | |
84 #define YPTIMERSCALE 1000000LU | |
85 #define YPGETTIME yukgettimeofday() | |
86 typedef unsigned long yptimer; | |
87 typedef unsigned long ypcounter; | |
88 | |
89 #elif YPTIMERTYPE == 2 | |
90 #define YPTIMERTFORMAT "llu" | |
91 #define YPCOUNTERTFORMAT "lu" | |
92 #define YPTIMERTFORMATD "6" YPTIMERTFORMAT | |
93 #define YPTIMERSCALE 1000000LU | |
94 #define YPGETTIME yukgettimeofday() | |
95 typedef unsigned long long yptimer; | |
96 typedef unsigned long ypcounter; | |
97 | |
98 #elif YPTIMERTYPE == 3 | |
99 #define YPTIMERTFORMAT "llu" | |
100 #define YPCOUNTERTFORMAT "lu" | |
101 #define YPTIMERTFORMATD "9" YPTIMERTFORMAT | |
102 #define YPTIMERSCALE 1000000000LLU | |
103 #define YPGETTIME gethrtime() | |
104 typedef unsigned long long yptimer; | |
105 typedef unsigned long ypcounter; | |
106 | |
107 #elif YPTIMERTYPE == 4 | |
108 #define YPTIMERTFORMAT "lu" | |
109 #define YPCOUNTERTFORMAT "lu" | |
110 #define YPTIMERTFORMATD "6" YPTIMERTFORMAT | |
111 #define YPTIMERSCALE CLK_TCK | |
112 #define YPGETTIME yuktimes() | |
113 typedef unsigned long yptimer; | |
114 typedef unsigned long ypcounter; | |
115 | |
116 #elif YPTIMERTYPE == 5 | |
117 #define YPTIMERTFORMAT "llu" | |
118 #define YPCOUNTERTFORMAT "lu" | |
119 #define YPTIMERTFORMATD "9" YPTIMERTFORMAT | |
120 #define YPTIMERSCALE 1000000000LLU | |
121 #define YPGETTIME yukclock_gettime() | |
122 typedef unsigned long long yptimer; | |
123 typedef unsigned long ypcounter; | |
124 | |
125 #else | |
126 #error Invalid YPTIMERTYPE in yuk.h | |
127 | |
128 #endif /* YPTIMERTYPE cases */ | |
129 | |
130 extern yptimer ypexectime[]; | |
131 extern ypcounter ypexecount[]; | |
132 extern ypcounter ypabscount[]; | |
133 | |
134 typedef struct yukvar_tag | |
135 { | |
136 int vartype; | |
137 int extername; | |
138 int intername; | |
139 } yukvar; | |
140 | |
141 extern yukvar yukvars[]; | |
142 | |
143 /*@-exportlocal@*/ /* this needs to be global */ | |
144 extern char** globalargv; | |
145 extern int globalargc; | |
146 /*@=exportlocal@*/ | |
147 | |
148 /* Give our own definition of sig_atomic_t for systems that don't have | |
149 it. char ought to be atomic, on most systems (especially as we don't | |
150 touch anything but the bottom byte). */ | |
151 #if SIZEOF_SIG_ATOMIC_T + 0 == 0 | |
152 #undef sig_atomic_t | |
153 typedef char sig_atomic_t | |
154 #endif |