Jspice3
misc.h File Reference
#include <stdio.h>
#include <ctype.h>
#include <string.h>
Include dependency graph for misc.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define BSIZE_SP   512
 
#define EXIT_NORMAL   0
 
#define EXIT_BAD   1
 
#define eq(a, b)   (!strcmp((a), (b)))
 
#define isalphanum(c)   (isalpha(c) || isdigit(c))
 
#define hexnum(c)
 
#define tfree(x)   (txfree((char*)x), x = 0)
 
#define alloc(TYPE)   ((TYPE *) tmalloc(sizeof(TYPE)))
 
#define false   0
 
#define true   1
 

Functions

char * tmalloc ()
 
char * trealloc ()
 
void txfree ()
 
void * htab_init ()
 
void htab_add ()
 
void htab_delete ()
 
void * htab_get ()
 
void htab_free ()
 
void htab_print ()
 
void * htab_wl ()
 
void * htab_list ()
 
int htab_empty ()
 
char * smktemp ()
 
char * fixxp2 ()
 
char * ecvt_n ()
 
char * printnum ()
 
int prefix ()
 
char * copy ()
 
int substring ()
 
void appendc ()
 
int scannum ()
 
int cieq ()
 
int ciprefix ()
 
void strtolower ()
 
char * gettok ()
 
int copytok ()
 
void advtok ()
 
char * datestring ()
 
void timedeff ()
 
double seconds ()
 

Macro Definition Documentation

#define alloc (   TYPE)    ((TYPE *) tmalloc(sizeof(TYPE)))

Definition at line 40 of file misc.h.

#define BSIZE_SP   512

Definition at line 19 of file misc.h.

#define eq (   a,
 
)    (!strcmp((a), (b)))

Definition at line 29 of file misc.h.

#define EXIT_BAD   1

Definition at line 26 of file misc.h.

#define EXIT_NORMAL   0

Definition at line 25 of file misc.h.

#define false   0

Definition at line 147 of file misc.h.

#define hexnum (   c)
Value:
((((c) >= '0') && ((c) <= '9')) ? ((c) - '0') : ((((c) >= \
'a') && ((c) <= 'f')) ? ((c) - 'a' + 10) : ((((c) >= 'A') && \
((c) <= 'F')) ? ((c) - 'A' + 10) : 0)))
static double c
Definition: vectors.c:16
Definition: cddefs.h:177

Definition at line 31 of file misc.h.

#define isalphanum (   c)    (isalpha(c) || isdigit(c))

Definition at line 30 of file misc.h.

#define tfree (   x)    (txfree((char*)x), x = 0)

Definition at line 36 of file misc.h.

#define true   1

Definition at line 148 of file misc.h.

Function Documentation

void advtok ( )
void appendc ( )
int cieq ( )
int ciprefix ( )
char* copy ( )
int copytok ( )
char* datestring ( )

Definition at line 37 of file time.c.

39 {
40 
41 #if defined(HAVE_GETTIMEOFDAY) || defined(HAVE_TIMES)
42  struct tm *tp;
43  static char tbuf[40];
44  char *ap;
45  int i;
46 #ifdef HAVE_GETTIMEOFDAY
47  struct timeval tv;
48  struct timezone tz;
49 
50  (void) gettimeofday(&tv, &tz);
51  tp = localtime(&tv.tv_sec);
52  ap = asctime(tp);
53 #else
54  long tloc;
55 
56  time(&tloc);
57  tp = localtime(&tloc);
58  ap = asctime(tp);
59 #endif
60 
61  strcpy(tbuf,ap);
62  i = strlen(tbuf);
63  tbuf[i - 1] = '\0';
64  return (tbuf);
65 
66 #else
67 
68  return ("today");
69 
70 #endif
71 }
char * strcpy()
char* ecvt_n ( )
char* fixxp2 ( )
char* gettok ( )
void htab_add ( )
void htab_delete ( )
int htab_empty ( )
void htab_free ( )
void* htab_get ( )
void* htab_init ( )

Definition at line 27 of file hash.c.

28 {
29  hashlist **h;
30 
31  h = (hashlist **)tmalloc(HTAB_SIZE * sizeof(hashlist*));
32  return ((void*)h);
33 }
char * tmalloc()
#define HTAB_SIZE
Definition: hash.c:11
void* htab_list ( )
void htab_print ( )
void* htab_wl ( )
int prefix ( )
char* printnum ( )
int scannum ( )
double seconds ( )

Definition at line 103 of file time.c.

105 {
106 #ifdef MSDOS
107  unsigned long tics = (unsigned long)dos_tics();
108  return ((double) tics*0.054945); /* 1/18.2 */
109 #else
110 #ifdef HAVE_GETTIMEOFDAY
111  struct timeval tv;
112  struct timezone tz;
113 
114  (void) gettimeofday(&tv, &tz);
115  return
116  (tv.tv_sec + (double) tv.tv_usec / 1000000.0);
117 #else
118 #ifdef HAVE_FTIME
119  struct timeb timenow;
120  int sec, msec;
121 
122  ftime(&timenow);
123  timediff(&timenow, &timebegin, &sec, &msec);
124  return (sec + (double) msec / 1000.0);
125 #else
126 #ifdef HAVE_VMSHACK
127  return ((double)clock()/(double)CLK_TCK);
128 #else /* unknown */
129  /* don't know how to do this in general. */
130  return (-1.0); /* Obvious error condition */
131 #endif /* !VMS */
132 #endif /* !FTIME */
133 #endif /* !BSD */
134 #endif /* DOS */
135 
136 }
char* smktemp ( )
void strtolower ( )
int substring ( )
void timedeff ( )
char* tmalloc ( )
char* trealloc ( )
void txfree ( )