This is Utilities.h in view mode; [Download] [Up]
//---------------------------------------------------------------------------------------
// Utilities.h created by erik on Mon 20-Jan-1997
// This code is part of the Alexandra Newsreader Project. For copyright details see
// GNU public license version 2 or above. No warranties implied. Use at own risk.
// More information can be found at <http://www.object-factory.com/Alexandra>.
// @(#)$Id: Utilities.h,v 1.5 1998/05/20 11:38:44 erik Exp $
//---------------------------------------------------------------------------------------
#if NeXT && NS_TARGET_MAJOR < 4
# import <foundation/foundation.h>
# import <ansi/ansi.h>
# import <appkit/nextstd.h>
# import "LFCompatibility.h"
# define LITTLE_FOUNDATION
# define LOG(T) NXLogError([(T) cString])
#else
# import <Foundation/Foundation.h>
# ifdef OF_COMMON
# import "oflog.h"
# define LOG(T) OFLog(LOG_INFO, self, (T))
# else
# define LOG(T) NSLog((T))
# endif
#endif
//---------------------------------------------------------------------------------------
// Constants
//---------------------------------------------------------------------------------------
#define LF '\x0A'
#define CR '\x0D'
#define TAB '\x09'
#define SPACE '\x20'
#define EQUALS '\x3D'
#define QMARK '\x3F'
#define UNDERSCORE '\x5F'
#define COLON ':'
#define DOUBLEQUOTE @"\""
//---------------------------------------------------------------------------------------
// Macros
//---------------------------------------------------------------------------------------
static __inline__ unsigned int umin(unsigned int a, unsigned int b)
{
return (a < b) ? a : b;
}
static __inline__ unsigned int udivroundup(unsigned int a, unsigned int b)
{
return (a / b) + ((a % b > 0) ? 1 : 0);
}
static __inline__ BOOL iscrlf(char c)
{
return (c == CR) || (c == LF);
}
static __inline__ BOOL iswhitespace(char c)
{
return (c == SPACE) || (c == TAB);
}
static __inline__ const char *skipnewline(const char *ptr, const char *limit)
{
if(*ptr == CR)
ptr += 1;
if((ptr < limit) && (*ptr == LF))
ptr += 1;
return ptr;
}
static __inline__ const char *skiptonewline(const char *ptr, const char *limit)
{
while(iscrlf(*ptr) == NO)
{
ptr += 1;
if(ptr == limit)
return NULL;
}
return ptr;
}
static __inline__ const char *skipspace(const char *ptr, const char *limit)
{
while(iswhitespace(*ptr) == YES)
{
ptr += 1;
if(ptr == limit)
return NULL;
}
return ptr;
}
//---------------------------------------------------------------------------------------
// DEBUGGING
//---------------------------------------------------------------------------------------
#ifdef METHOD_TRACE
#define TRACE_IN fprintf(stderr, "-> %s 0x%p %s\n", object_getClassName(isa), (void *)self, sel_getName(_cmd));
#else
#define TRACE_IN
#endif
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.