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] - Diff between revs 27 and 174

Only display areas with differences | Details | Blame | View Log

Rev 27 Rev 174
/***********************************************************************
/***********************************************************************
 
 
util.h - memory allocation, error reporting, and other mundane stuff
util.h - memory allocation, error reporting, and other mundane stuff
 
 
Copyright (C) 1991 Dean Rubine
Copyright (C) 1991 Dean Rubine
 
 
This program is free software; you can redistribute it and/or modify
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License. See ../COPYING for
it under the terms of the GNU General Public License. See ../COPYING for
the full agreement.
the full agreement.
 
 
**********************************************************************/
**********************************************************************/
 
 
/*
/*
 * General utility functionss
 * General utility functionss
 *
 *
 * Mostly for dealing with mundane issues such as:
 * Mostly for dealing with mundane issues such as:
 *      Memory allocation
 *      Memory allocation
 *      Error handling
 *      Error handling
 */
 */
 
 
/*
/*
 * General allocation macro
 * General allocation macro
 *
 *
 * Example:
 * Example:
 *      struct list *s; s = allocate(4, struct list)
 *      struct list *s; s = allocate(4, struct list)
 * returns space for an array of 4 list structures.
 * returns space for an array of 4 list structures.
 * Allocate will die if there is no more memory
 * Allocate will die if there is no more memory
 */
 */
 
 
#define allocate(n, type)       \
#define allocate(n, type)       \
        ((type *) myalloc(n, sizeof(type), "type"))
        ((type *) myalloc(n, sizeof(type), "type"))
 
 
/*
/*
 * Functions
 * Functions
 */
 */
 
 
#define STREQ(a,b)      ( ! strcmp(a,b) )
#define STREQ(a,b)      ( ! strcmp(a,b) )
 
 
char    *myalloc();     /* Do not call this function directly */
char    *myalloc();     /* Do not call this function directly */
char    *scopy();       /* allocates memory for a string */
char    *scopy();       /* allocates memory for a string */
void    debug();        /* printf on stderr -
void    debug();        /* printf on stderr -
                           setting DebugFlag = 0 turns off debugging */
                           setting DebugFlag = 0 turns off debugging */
void    error();        /* printf on stderr, then dies */
void    error();        /* printf on stderr, then dies */
int     ucstrcmp();     /* strcmp, upper case = lower case */
int     ucstrcmp();     /* strcmp, upper case = lower case */
char    *tempstring();  /* returns a pointer to space that will reused soon */
char    *tempstring();  /* returns a pointer to space that will reused soon */
 
 
/*
/*
   this is the wrong place for all of this, but got chosen since
   this is the wrong place for all of this, but got chosen since
   every file includes this one
   every file includes this one
 */
 */
 
 
#ifdef unix
#ifdef unix
#       define GRAPHICS         /* only GDEV on unix machines */
#       define GRAPHICS         /* only GDEV on unix machines */
#endif
#endif
 
 
#ifndef unix
#ifndef unix
 
 
/* various BSD to lattice C name changes */
/* various BSD to lattice C name changes */
 
 
#ifdef __ECOS
#ifdef __ECOS
extern char *strdup(char *);
extern char *strdup(char *);
#else
#else
#define bcopy   movmem
#define bcopy   movmem
#endif
#endif
#define index   strchr
#define index   strchr
#define rindex  strrchr
#define rindex  strrchr
 
 
#endif
#endif
 
 

powered by: WebSVN 2.1.0

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