Jspice3
Main Page
Data Structures
Files
File List
Globals
misc.h
Go to the documentation of this file.
1
/***************************************************************************
2
JSPICE3 adaptation of Spice3e2 - Copyright (c) Stephen R. Whiteley 1992
3
Copyright 1990 Regents of the University of California. All rights reserved.
4
Authors: 1985 Wayne A. Christopher
5
1992 Stephen R. Whiteley
6
****************************************************************************/
7
8
#ifndef MISC_H
9
#define MISC_H
10
11
#include <stdio.h>
12
#include <ctype.h>
13
#include <string.h>
14
#ifdef HAVE_UNISTD_H
15
#include <unistd.h>
16
#endif
17
18
19
#define BSIZE_SP 512
20
21
#ifdef HAVE_EXIT1
22
#define EXIT_NORMAL 1
23
#define EXIT_BAD 0
24
#else
25
#define EXIT_NORMAL 0
26
#define EXIT_BAD 1
27
#endif
28
29
#define eq(a,b) (!strcmp((a), (b)))
30
#define isalphanum(c) (isalpha(c) || isdigit(c))
31
#define hexnum(c) ((((c) >= '0') && ((c) <= '9')) ? ((c) - '0') : ((((c) >= \
32
'a') && ((c) <= 'f')) ? ((c) - 'a' + 10) : ((((c) >= 'A') && \
33
((c) <= 'F')) ? ((c) - 'A' + 10) : 0)))
34
35
#ifndef tfree
36
#define tfree(x) (txfree((char*)x), x = 0)
37
#endif
38
39
#ifndef alloc
40
#define alloc(TYPE) ((TYPE *) tmalloc(sizeof(TYPE)))
41
#endif
42
43
/* alloc.c */
44
#ifdef __STDC__
45
extern
char
*
tmalloc
(
int
);
46
extern
char
*
trealloc
(
char
*,
int
);
47
extern
void
txfree
(
char
*);
48
#else
49
extern
char
*
tmalloc
();
50
extern
char
*
trealloc
();
51
extern
void
txfree
();
52
#endif
53
54
/* hash.c */
55
#ifdef __STDC__
56
extern
void
*
htab_init
(
void
);
57
extern
void
htab_add
(
char
*,
void
*,
void
*);
58
extern
void
htab_delete
(
char
*,
void
*);
59
extern
void
*
htab_get
(
char
*,
void
*);
60
extern
void
htab_free
(
void
*,
int
);
61
extern
void
htab_print
(
void
*,
char
*);
62
extern
void
*
htab_wl
(
void
*);
63
extern
void
*
htab_list
(
void
*);
64
extern
int
htab_empty
(
void
*);
65
#else
66
extern
void
*
htab_init
();
67
extern
void
htab_add
();
68
extern
void
htab_delete
();
69
extern
void
*
htab_get
();
70
extern
void
htab_free
();
71
extern
void
htab_print
();
72
extern
void
*
htab_wl
();
73
extern
void
*
htab_list
();
74
extern
int
htab_empty
();
75
#endif
76
77
/* libfuncs.c */
78
#ifdef __STDC__
79
extern
char
*
smktemp
(
char
*);
80
#else
81
extern
char
*
smktemp
();
82
#endif
83
84
/* printnum.c */
85
#ifdef __STDC__
86
extern
char
*
fixxp2
(
char
*);
87
extern
char
*
ecvt_n
(
double
,
int
);
88
extern
char
*
printnum
(
double
);
89
#else
90
extern
char
*
fixxp2
();
91
extern
char
*
ecvt_n
();
92
extern
char
*
printnum
();
93
#endif
94
95
/* string.c */
96
#ifdef __STDC__
97
extern
int
prefix
(
char
*,
char
*);
98
extern
char
*
copy
(
char
*);
99
extern
int
substring
(
char
*,
char
*);
100
extern
void
appendc
(
char
*,
int
);
101
extern
int
scannum
(
char
*);
102
extern
int
cieq
(
char
*,
char
*);
103
extern
int
ciprefix
(
char
*,
char
*);
104
extern
void
strtolower
(
char
*);
105
extern
char
*
gettok
(
char
**);
106
extern
int
copytok
(
char
*,
char
**);
107
extern
int
copytok1
(
char
*,
char
**);
108
extern
void
advtok
(
char
**);
109
#else
110
extern
int
prefix
();
111
extern
char
*
copy
();
112
extern
int
substring
();
113
extern
void
appendc
();
114
extern
int
scannum
();
115
extern
int
cieq
();
116
extern
int
ciprefix
();
117
extern
void
strtolower
();
118
extern
char
*
gettok
();
119
extern
int
copytok
();
120
extern
int
copytok
();
121
extern
void
advtok
();
122
#endif
123
124
/* time.c */
125
#ifdef __STDC__
126
extern
char
*
datestring
(
void
);
127
extern
void
timedeff
();
128
extern
double
seconds
(
void
);
129
#else
130
extern
char
*
datestring
();
131
extern
void
timedeff
();
132
extern
double
seconds
();
133
#endif
134
135
136
/* Externs from libc */
137
138
#ifdef STDC_HEADERS
139
140
#ifndef STDLIB_IS_INCLUDED
141
#define STDLIB_IS_INCLUDED
142
#include <stdlib.h>
143
#endif
144
145
#endif
146
147
#define false 0
148
#define true 1
149
150
#ifdef HAVE_DOSDIRS
151
152
typedef
int
*DIR;
153
struct
direct {
154
int
d_reclen;
155
short
d_ino;
156
short
d_namelen;
157
char
d_name[20];
158
};
159
160
#ifdef __STDC__
161
extern
DIR *opendir(
char
*);
162
extern
struct
direct *readdir(DIR *);
163
#else
164
extern
DIR *opendir( );
165
extern
struct
direct *readdir( );
166
#endif
167
168
#endif
169
170
#endif
/* MISC_H */
gettok
char * gettok()
ciprefix
int ciprefix()
copytok1
int copytok1(char *dst, char **s)
Definition:
string.c:241
cieq
int cieq()
printnum
char * printnum()
htab_delete
void htab_delete()
appendc
void appendc()
datestring
char * datestring()
Definition:
time.c:37
scannum
int scannum()
copy
char * copy()
htab_wl
void * htab_wl()
htab_init
void * htab_init()
Definition:
hash.c:27
ecvt_n
char * ecvt_n()
substring
int substring()
htab_empty
int htab_empty()
htab_free
void htab_free()
strtolower
void strtolower()
smktemp
char * smktemp()
advtok
void advtok()
seconds
double seconds()
Definition:
time.c:103
txfree
void txfree()
htab_print
void htab_print()
htab_add
void htab_add()
htab_get
void * htab_get()
timedeff
void timedeff()
fixxp2
char * fixxp2()
prefix
int prefix()
copytok
int copytok()
trealloc
char * trealloc()
htab_list
void * htab_list()
tmalloc
char * tmalloc()
src
include
misc.h
Generated by
1.8.11