URL
https://opencores.org/ocsvn/or1k/or1k/trunk
Subversion Repositories or1k
Compare Revisions
- This comparison shows the changes necessary to convert path
/or1k/tags/stable_0_1_0/or1ksim/port
- from Rev 1357 to Rev 1765
- ↔ Reverse comparison
Rev 1357 → Rev 1765
/strndup.c
0,0 → 1,27
|
#include "config.h" |
#include "port.h" |
|
#include <string.h> |
|
#if !defined(HAVE_STRNDUP) |
|
/* Taken from glibc */ |
char * |
strndup (const char *s, size_t n) |
{ |
char *new; |
size_t len = strlen (s); |
if (len>n) |
len=n; |
|
new = (char *) malloc (len + 1); |
|
if (new == NULL) |
return NULL; |
|
new[len] = '\0'; |
return (char *) memcpy (new, s, len); |
} |
|
#endif |
/isblank.c
0,0 → 1,16
|
#include "config.h" |
|
#include "port.h" |
|
#ifndef HAVE_ISBLANK |
/* |
*isblank() is a GNU extension |
*not available on Solaris, for example |
*/ |
int isblank(int c) |
{ |
return (c==' ') || (c=='\t'); |
} |
#endif |
|
/Makefile.am
0,0 → 1,22
# Makefile -- Makefile for cpu architecture independent simulation |
# Copyright (C) 1999 Damjan Lampret, lampret@opencores.org |
# |
# This file is part of OpenRISC 1000 Architectural Simulator. |
# |
# This program is free software; you can redistribute it and/or modify |
# it under the terms of the GNU General Public License as published by |
# the Free Software Foundation; either version 2 of the License, or |
# (at your option) any later version. |
# |
# This program is distributed in the hope that it will be useful, |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
# GNU General Public License for more details. |
# |
# You should have received a copy of the GNU General Public License |
# along with this program; if not, write to the Free Software |
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
# |
|
noinst_LIBRARIES = libport.a |
libport_a_SOURCES = strndup.c isblank.c |
/port.h
0,0 → 1,108
#ifndef __STRNDUP__ |
#define __STRNDUP__ |
|
#include <stdlib.h> |
|
#if !defined(HAVE_STRNDUP) |
char * strndup (const char *s, size_t n); |
#endif |
|
#endif |
|
#ifndef HAS_ISBLANK |
int isblank(int c); |
#endif |
|
#ifndef PRIx32 |
# if SIZEOF_INT == 4 |
# define PRIx32 "x" |
# elif SIZEOF_LONG == 4 |
# define PRIx32 "lx" |
# endif |
#endif |
|
#ifndef PRIx16 |
# if SIZEOF_SHORT == 2 |
# define PRIx16 "hx" |
# else |
# define PRIx16 "x" |
# endif |
#endif |
|
#ifndef PRIx8 |
# if SIZEOF_CHAR == 1 |
# define PRIx8 "hhx" |
# else |
# define PRIx8 "x" |
# endif |
#endif |
|
#ifndef PRIi32 |
# if SIZEOF_INT == 4 |
# define PRIi32 "i" |
# elif SIZEOF_LONG == 4 |
# define PRIi32 "li" |
# endif |
#endif |
|
#ifndef PRId32 |
# if SIZEOF_INT == 4 |
# define PRId32 "d" |
# elif SIZEOF_LONG == 4 |
# define PRId32 "ld" |
# endif |
#endif |
|
#ifndef UINT32_C |
# if SIZEOF_INT == 4 |
# define UINT32_C(c) c |
# elif SIZEOF_LONG == 4 |
# define UINT32_C(c) c l |
# endif |
#endif |
|
#ifndef HAVE_UINT32_T |
# if SIZEOF_INT == 4 |
typedef unsigned int uint32_t; |
# elif SIZEOF_LONG == 4 |
typedef unsigned long uint32_t; |
# else |
# error "Can't find a 32-bit type" |
# endif |
#endif |
|
#ifndef HAVE_INT32_T |
# if SIZEOF_INT == 4 |
typedef signed int int32_t; |
# elif SIZEOF_LONG == 4 |
typedef signed long int32_t; |
# endif |
#endif |
|
#ifndef HAVE_UINT16_T |
# if SIZEOF_SHORT == 2 |
typedef unsigned short uint16_t; |
# else |
# error "Can't find a 16-bit type" |
# endif |
#endif |
|
#ifndef HAVE_INT16_T |
# if SIZEOF_SHORT == 2 |
typedef signed short int16_t; |
# endif |
#endif |
|
#ifndef HAVE_UINT8_T |
# if SIZEOF_CHAR == 1 |
typedef unsigned char uint8_t; |
# else |
# error "Can't find a 8-bit type" |
# endif |
#endif |
|
#ifndef HAVE_INT8_T |
# if SIZEOF_CHAR == 1 |
typedef signed char int8_t; |
# endif |
#endif |