File: common.H

package info (click to toggle)
tela 1.28-2
  • links: PTS
  • area: main
  • in suites: slink
  • size: 6,596 kB
  • ctags: 5,519
  • sloc: ansic: 14,013; cpp: 13,376; lex: 1,651; fortran: 1,048; yacc: 834; sh: 715; makefile: 464
file content (61 lines) | stat: -rw-r--r-- 2,476 bytes parent folder | download
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
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
52
53
54
55
56
57
58
59
60
61
/*
 * This file is part of tela the Tensor Language.
 * Copyright (c) 1994-1996 Pekka Janhunen
 */

#ifdef __GNUC__
#  pragma interface
#endif
// Common definitions for Tela kernel

#ifndef COMMON_H

struct global {
#if SLOW_FLOATING_POINT_MATH
	static int nops;		// Accumulates number of operations involved when executing current instruction
#else
	static double nops;		// Accumulates number of operations involved when executing current instruction
#endif
	static int lineno;		// Keeps track of source line number when parsing
	static int NTprg;		// Total number of Tprg objects in the system
	static int NTobject;	// Total number of Tobject's in the system
	static int interrupted;	// Nonzero after Control-C of Control-G hit by user
	static int debugging;	// Nonzero after Control-G hit by user
	static char *argv0;		// Name of the program (argv[0] from main())
    static ostream* ctfile;	// Points to output C-tela file when compiling (usually null)
	static size_t memuse;	// Sum of the sizes of allocated memory blocks (using operator new), or 0 if not available
	static size_t memalloc;	// memuse + fragmentation overhead, or 0 if not available
	static unsigned int Nalloc;		// Number of allocated blocks, or 0 if not available
	static unsigned int Nmem;		// Total number of new operator calls, or 0 if not available
	static unsigned int FLlen;		// Freelist length
#if !HAVE_RUSAGE && HAVE_SYS_PROCFS_H
	static int procfd;				// File descriptor to open /proc/$$ file (used in CPUSeconds())
#endif
};

struct flags {		// Various flags controlled from command line
	static int verbose;
	static int echo;
	static int batch;
	static int silent;
	static int checkRO;		// nonzero if check agains modification of input arguments is done
	static int debugquery;	// nonzero if pressing Control-C causes a query whether to enter debug level
};

extern void SetHardInterruptHandler();		// from tela.C
extern void SetSoftInterruptHandler();		// from tela.C
extern void SetControlGInterruptHandler();	// from tela.C

/* Wrap very time consuming calls with CATCH_INTERRUPTS, for example
   the Level-3 BLAS routines so they can be interrupted by the user
   by hitting Control-C. Code wrapped with CATHC_INTERRUPTS should
   not have any new/delete/malloc/free calls. It should only contain
   straightforward code that can be interrupted at any point. */
#define CATCH_INTERRUPTS(code)\
    SetHardInterruptHandler();\
	code;\
	SetSoftInterruptHandler()

#define COMMON_H

#endif