OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [packages/] [services/] [gfx/] [mw/] [v2_0/] [src/] [demos/] [nxscribble/] [util.h] - Blame information for rev 174

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 27 unneback
/***********************************************************************
2
 
3
util.h - memory allocation, error reporting, and other mundane stuff
4
 
5
Copyright (C) 1991 Dean Rubine
6
 
7
This program is free software; you can redistribute it and/or modify
8
it under the terms of the GNU General Public License. See ../COPYING for
9
the full agreement.
10
 
11
**********************************************************************/
12
 
13
/*
14
 * General utility functionss
15
 *
16
 * Mostly for dealing with mundane issues such as:
17
 *      Memory allocation
18
 *      Error handling
19
 */
20
 
21
/*
22
 * General allocation macro
23
 *
24
 * Example:
25
 *      struct list *s; s = allocate(4, struct list)
26
 * returns space for an array of 4 list structures.
27
 * Allocate will die if there is no more memory
28
 */
29
 
30
#define allocate(n, type)       \
31
        ((type *) myalloc(n, sizeof(type), "type"))
32
 
33
/*
34
 * Functions
35
 */
36
 
37
#define STREQ(a,b)      ( ! strcmp(a,b) )
38
 
39
char    *myalloc();     /* Do not call this function directly */
40
char    *scopy();       /* allocates memory for a string */
41
void    debug();        /* printf on stderr -
42
                           setting DebugFlag = 0 turns off debugging */
43
void    error();        /* printf on stderr, then dies */
44
int     ucstrcmp();     /* strcmp, upper case = lower case */
45
char    *tempstring();  /* returns a pointer to space that will reused soon */
46
 
47
/*
48
   this is the wrong place for all of this, but got chosen since
49
   every file includes this one
50
 */
51
 
52
#ifdef unix
53
#       define GRAPHICS         /* only GDEV on unix machines */
54
#endif
55
 
56
#ifndef unix
57
 
58
/* various BSD to lattice C name changes */
59
 
60
#ifdef __ECOS
61
extern char *strdup(char *);
62
#else
63
#define bcopy   movmem
64
#endif
65
#define index   strchr
66
#define rindex  strrchr
67
 
68
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.