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

Subversion Repositories openrisc

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /openrisc/trunk/rtos/rtems/c/src/libmisc/dumpbuf
    from Rev 30 to Rev 173
    Reverse comparison

Rev 30 → Rev 173

/dumpbuf.c
0,0 → 1,75
/*
* COPYRIGHT (c) 1997.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may in
* the file LICENSE in this distribution or at
* http://www.OARcorp.com/rtems/license.html.
*
* $Id: dumpbuf.c,v 1.2 2001-09-27 12:01:42 chris Exp $
*/
 
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <rtems/dumpbuf.h>
/*
* Put the body below Dump_Buffer so it won't get inlined.
*/
 
static inline void Dump_Line(
unsigned char *buffer,
int length
);
 
void Dump_Buffer(
unsigned char *buffer,
int length
)
{
int i, mod, max;
if ( !length ) return;
mod = length % 16;
max = length - mod;
for ( i=0 ; i<max ; i+=16 )
Dump_Line( &buffer[ i ], 16 );
if ( mod )
Dump_Line( &buffer[ max ], mod );
}
 
static inline void Dump_Line(
unsigned char *buffer,
int length
)
{
int i;
char line_buffer[120];
line_buffer[0] = '\0';
for( i=0 ; i<length ; i++ )
sprintf( line_buffer, "%s%02x ", line_buffer, buffer[ i ] );
for( ; i<16 ; i++ )
strcat( line_buffer, " " );
strcat( line_buffer, "|" );
for( i=0 ; i<length ; i++ )
sprintf( line_buffer, "%s%c", line_buffer,
isprint( buffer[ i ] ) ? buffer[ i ] : '.' );
for( ; i<16 ; i++ )
strcat( line_buffer, " " );
strcat( line_buffer, "|\n" );
printf( line_buffer );
}
/dumpbuf.h
0,0 → 1,21
/*
* COPYRIGHT (c) 1997.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may in
* the file LICENSE in this distribution or at
* http://www.OARcorp.com/rtems/license.html.
*
* $Id: dumpbuf.h,v 1.2 2001-09-27 12:01:42 chris Exp $
*/
 
#ifndef __DUMP_BUFFER_h
#define __DUMP_BUFFER_h
 
void Dump_Buffer(
unsigned char *buffer,
int length
);
 
#endif
/* end of include file */
/Makefile.am
0,0 → 1,41
##
## $Id: Makefile.am,v 1.2 2001-09-27 12:01:42 chris Exp $
##
 
AUTOMAKE_OPTIONS = foreign 1.4
 
LIBNAME = libdumpbuf-tmp
LIB = $(ARCH)/$(LIBNAME).a
 
C_FILES = dumpbuf.c
C_O_FILES = $(C_FILES:%.c=$(ARCH)/%.o)
 
H_FILES = dumpbuf.h
 
OBJS = $(C_O_FILES)
 
include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
include $(top_srcdir)/../../../automake/lib.am
 
$(PROJECT_INCLUDE)/rtems:
@$(mkinstalldirs) $@
$(PROJECT_INCLUDE)/rtems/%.h: %.h
$(INSTALL_DATA) $< $@
 
#
# (OPTIONAL) Add local stuff here using +=
#
 
$(LIB): $(OBJS)
$(make-library)
 
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems \
$(H_FILES:%=$(PROJECT_INCLUDE)/rtems/%)
 
all-local: $(ARCH) $(PREINSTALL_FILES) $(OBJS) $(LIB)
 
.PRECIOUS: $(LIB)
 
EXTRA_DIST = dumpbuf.c dumpbuf.h
 
include $(top_srcdir)/../../../automake/local.am

powered by: WebSVN 2.1.0

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