Initial import of the CDE 2.1.30 sources from the Open Group.
This commit is contained in:
57
cde/lib/DtSvc/include/codelibs/boolean.h
Normal file
57
cde/lib/DtSvc/include/codelibs/boolean.h
Normal file
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* File: boolean.h $XConsortium: boolean.h /main/3 1995/10/26 16:10:48 rswiston $
|
||||
*
|
||||
* (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
* (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
* (c) Copyright 1993, 1994 Novell, Inc.
|
||||
*/
|
||||
|
||||
#ifndef __BOOLEAN_H_
|
||||
#define __BOOLEAN_H_
|
||||
|
||||
#if defined(__aix)
|
||||
#undef NULL
|
||||
#define NULL 0
|
||||
#endif
|
||||
|
||||
#if defined(SVR4)
|
||||
#include <sys/types.h>
|
||||
|
||||
#if defined(sun) && defined(_XOPEN_SOURCE)
|
||||
#ifndef B_TRUE
|
||||
#define B_TRUE _B_TRUE
|
||||
#endif
|
||||
#ifndef B_FALSE
|
||||
#define B_FALSE _B_FALSE
|
||||
#endif
|
||||
#endif /* sun && _XOPEN_SOURCE */
|
||||
|
||||
#ifndef boolean
|
||||
typedef boolean_t boolean;
|
||||
#endif
|
||||
|
||||
#ifndef TRUE
|
||||
#define TRUE B_TRUE
|
||||
#endif
|
||||
|
||||
#ifndef FALSE
|
||||
#define FALSE B_FALSE
|
||||
#endif
|
||||
#endif /* SVR4 */
|
||||
|
||||
|
||||
#if !defined(SVR4)
|
||||
#ifndef TRUE
|
||||
#define TRUE 1
|
||||
#endif
|
||||
|
||||
#ifndef FALSE
|
||||
#define FALSE 0
|
||||
#endif
|
||||
|
||||
#ifndef boolean
|
||||
typedef int boolean;
|
||||
#endif
|
||||
#endif /* ! SVR4 */
|
||||
#endif /* __BOOLEAN_H_ */
|
||||
197
cde/lib/DtSvc/include/codelibs/dynarray.h
Normal file
197
cde/lib/DtSvc/include/codelibs/dynarray.h
Normal file
@@ -0,0 +1,197 @@
|
||||
/*
|
||||
* $TOG: dynarray.h /main/5 1999/10/15 17:22:58 mgreess $
|
||||
*
|
||||
* (c) Copyright 1996 Digital Equipment Corporation.
|
||||
* (c) Copyright 1993,1994,1996 Hewlett-Packard Company.
|
||||
* (c) Copyright 1993,1994,1996 International Business Machines Corp.
|
||||
* (c) Copyright 1993,1994,1996 Sun Microsystems, Inc.
|
||||
* (c) Copyright 1993,1994,1996 Novell, Inc.
|
||||
* (c) Copyright 1996 FUJITSU LIMITED.
|
||||
* (c) Copyright 1996 Hitachi.
|
||||
*/
|
||||
/* Handle dynamic arrays of arbitrary type and range. */
|
||||
|
||||
#ifndef __DYNARRAY_H_
|
||||
#define __DYNARRAY_H_
|
||||
|
||||
#include <generic.h>
|
||||
#if defined(USL) || defined(__uxp__) || defined(__osf__) || defined(sun)
|
||||
#define _DELETE_ARRAY(sz) delete[]
|
||||
#else
|
||||
#define _DELETE_ARRAY(sz) delete[(sz)]
|
||||
#endif
|
||||
|
||||
|
||||
// this is used to create an ARRAY of a TYPE
|
||||
#define declare_array(ARRAY, TYPE, BUMP) \
|
||||
class ARRAY \
|
||||
{ \
|
||||
long len; \
|
||||
long max; \
|
||||
TYPE *arr; \
|
||||
protected: \
|
||||
TYPE &bumpsize(long); \
|
||||
public: \
|
||||
ARRAY() { arr = 0; max = len = 0; } \
|
||||
ARRAY(long siz) \
|
||||
{ arr = 0; max = len = 0; if (siz > 0) bumpsize(siz-1); } \
|
||||
ARRAY(const ARRAY &); \
|
||||
~ARRAY() { _DELETE_ARRAY(max) arr; } \
|
||||
ARRAY &operator=(const ARRAY &); \
|
||||
long size() const { return len; } \
|
||||
void reset(long l = 0) { bumpsize(l); len = l; } \
|
||||
TYPE &operator[](long e) \
|
||||
{ if (e < len) return arr[e]; else return bumpsize(e); } \
|
||||
TYPE &elt(long e) const { return arr[e]; } \
|
||||
TYPE &end() { return bumpsize(len); } \
|
||||
TYPE *getarr() const { return arr; } \
|
||||
TYPE *operator()() const { return arr; } \
|
||||
};
|
||||
|
||||
// this implements an ARRAY of a TYPE
|
||||
// - this must be done once and only once in the user code
|
||||
// printf("0x%X: max=%d len=%d elt=%d\n", this, max, len, elt);
|
||||
#define implement_array(ARRAY, TYPE, BUMP) \
|
||||
TYPE &ARRAY::bumpsize(long elt) \
|
||||
{ \
|
||||
if (elt < 0) \
|
||||
elt = 0; \
|
||||
if (elt >= max) \
|
||||
{ \
|
||||
if (max <= 0) \
|
||||
max = 1; \
|
||||
long omax = max; \
|
||||
TYPE *narr = new TYPE[max = elt + (omax > BUMP ? BUMP : omax)]; \
|
||||
for (long i = 0; i < len; i++) \
|
||||
narr[i] = arr[i]; \
|
||||
_DELETE_ARRAY(omax) arr; \
|
||||
arr = narr; \
|
||||
} \
|
||||
if (elt >= len) \
|
||||
len = elt + 1; \
|
||||
return arr[elt]; \
|
||||
} \
|
||||
ARRAY &ARRAY::operator=(const ARRAY &a) \
|
||||
{ \
|
||||
if (&a == this) \
|
||||
return *this; \
|
||||
if (a.len > len) \
|
||||
bumpsize(a.len); \
|
||||
len = a.len; \
|
||||
for (long i = 0; i < len; i++) \
|
||||
arr[i] = a.arr[i]; \
|
||||
return *this; \
|
||||
} \
|
||||
ARRAY::ARRAY(const ARRAY &t) \
|
||||
{ \
|
||||
arr = 0; \
|
||||
max = len = 0; \
|
||||
*this = t; \
|
||||
}
|
||||
|
||||
// the user can also use these to define an array of any type
|
||||
#define darray(TYPE) name2(TYPE,array)
|
||||
#define darraydeclare(TYPE) declare_array(darray(TYPE), TYPE, 1024)
|
||||
#define darrayimplement(TYPE) implement_array(darray(TYPE), TYPE, 1024)
|
||||
#define darraydeclare2(TYPE,BUMP) declare_array(darray(TYPE), TYPE, BUMP)
|
||||
#define darrayimplement2(TYPE,BUMP) implement_array(darray(TYPE), TYPE, BUMP)
|
||||
|
||||
|
||||
// this is used to define a DYNARRAY of a TYPE
|
||||
#define declare_dynarray(DYNARRAY, TYPE) \
|
||||
class DYNARRAY \
|
||||
{ \
|
||||
long low; \
|
||||
long high; \
|
||||
long min; \
|
||||
long max; \
|
||||
unsigned bump; \
|
||||
TYPE *arr; \
|
||||
TYPE *aptr; \
|
||||
void init(long, long, unsigned); \
|
||||
void chsize(long, long); \
|
||||
public: \
|
||||
DYNARRAY(long l, long s = 0, unsigned b = 1024) { init(l, s, b); } \
|
||||
DYNARRAY() { init(0, 0, 1024); } \
|
||||
DYNARRAY(const DYNARRAY &t) \
|
||||
{ init(t.high - t.low + 1, t.low, t.bump); *this = t; } \
|
||||
~DYNARRAY() { _DELETE_ARRAY(max - min + 1) arr; } \
|
||||
DYNARRAY &operator=(const DYNARRAY &); \
|
||||
long size() const { return high - low + 1; } \
|
||||
void reset(long len = 0, long st = 0) \
|
||||
{ chsize(st, st + len - 1); high = st + len - 1; low = st; } \
|
||||
long smallest() const { return low; } \
|
||||
long largest() const { return high; } \
|
||||
TYPE &operator[](long e) \
|
||||
{ if (e <= low || e >= high) chsize(e,e); return aptr[e]; } \
|
||||
TYPE &elt(long e) const { return aptr[e]; } \
|
||||
TYPE &end() { return (*this)[largest() + 1]; } \
|
||||
TYPE *getarr() const { return aptr; } \
|
||||
TYPE *operator()() const { return aptr; } \
|
||||
};
|
||||
|
||||
// this creates the code needed for a DYNARRAY of TYPE
|
||||
// - this must be done once and only once in the user code
|
||||
#define implement_dynarray(DYNARRAY, TYPE) \
|
||||
void DYNARRAY::init(long len, long start, unsigned bmp) \
|
||||
{ \
|
||||
if (len < 0) \
|
||||
len = 0; \
|
||||
high = start + len - 1; \
|
||||
low = start; \
|
||||
max = high; \
|
||||
min = low; \
|
||||
bump = bmp > 0 ? bmp : 1024; \
|
||||
if (max < min) \
|
||||
max = min; \
|
||||
arr = new TYPE[max - min + 1]; \
|
||||
aptr = arr - min; \
|
||||
} \
|
||||
void DYNARRAY::chsize(long lelt, long helt) \
|
||||
{ \
|
||||
long nlow = lelt < low ? lelt : low; \
|
||||
long nhigh = helt > high ? helt : high; \
|
||||
if (nlow <= min || nhigh >= max) \
|
||||
{ \
|
||||
long nmin = nlow < min ? nlow : min; \
|
||||
long nmax = nhigh > max ? nhigh : max; \
|
||||
long m = max - min + 1; \
|
||||
long nm = nmax - nmin + 1 + (m > bump ? bump : m); \
|
||||
long nl = nhigh - nlow + 1; \
|
||||
TYPE *narr = new TYPE[nm]; \
|
||||
TYPE *naptr = narr - nmin; \
|
||||
for (long i = low; i <= high; i++) \
|
||||
naptr[i] = aptr[i]; \
|
||||
_DELETE_ARRAY(m) arr; \
|
||||
arr = narr; \
|
||||
aptr = naptr; \
|
||||
min = nmin; \
|
||||
max = nmax; \
|
||||
} \
|
||||
high = nhigh; \
|
||||
low = nlow; \
|
||||
} \
|
||||
DYNARRAY &DYNARRAY::operator=(const DYNARRAY &a) \
|
||||
{ \
|
||||
if (&a == this) \
|
||||
return *this; \
|
||||
if (a.low < low || a.high > high) \
|
||||
chsize(a.low, a.high); \
|
||||
low = a.low; \
|
||||
high = a.high; \
|
||||
for (long i = a.low; i <= a.high; i++) \
|
||||
aptr[i] = a.aptr[i]; \
|
||||
bump = a.bump; \
|
||||
return *this; \
|
||||
}
|
||||
|
||||
// the user can also use these to define arrays of any type
|
||||
#define dynarray(TYPE) name2(TYPE,dynarray)
|
||||
#define dynarraydeclare(TYPE) declare_dynarray(dynarray(TYPE), TYPE)
|
||||
#define dynarrayimplement(TYPE) implement_dynarray(dynarray(TYPE), TYPE)
|
||||
|
||||
// Predefined dynarrays for most common uses
|
||||
/* declare_array(Charbuf, char, 256) */
|
||||
|
||||
|
||||
#endif /* __DYNARRAY_H_ */
|
||||
47
cde/lib/DtSvc/include/codelibs/exception.h
Normal file
47
cde/lib/DtSvc/include/codelibs/exception.h
Normal file
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* File: exception.h $XConsortium: exception.h /main/3 1995/10/26 16:12:07 rswiston $
|
||||
*
|
||||
* (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
* (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
* (c) Copyright 1993, 1994 Novell, Inc.
|
||||
*/
|
||||
/* C++ exception handler package */
|
||||
|
||||
#ifndef __EXCEPTION_H_
|
||||
#define __EXCEPTION_H_
|
||||
|
||||
#include <stddef.h>
|
||||
#include <setjmp.h>
|
||||
|
||||
|
||||
typedef const char *const Exception;
|
||||
|
||||
class _Exception
|
||||
{
|
||||
char raised, accepted;
|
||||
_Exception *prev;
|
||||
public:
|
||||
const char *val;
|
||||
jmp_buf buf;
|
||||
|
||||
_Exception();
|
||||
~_Exception();
|
||||
int accept(Exception val);
|
||||
int recover();
|
||||
void raise(Exception val);
|
||||
};
|
||||
extern _Exception *_curr_exception;
|
||||
extern void _raise_exception(Exception val);
|
||||
|
||||
#define TRY _Exception _new_exception; if (setjmp(_new_exception.buf) == 0)
|
||||
#define RECOVER else if (_new_exception.recover())
|
||||
#define HANDLE(val) else if (_new_exception.accept(val))
|
||||
#define RAISE(val) _raise_exception(val)
|
||||
#define EXCEPTION (_curr_exception != NULL ? _curr_exception->val : NULL)
|
||||
|
||||
|
||||
#endif /* __EXCEPTION_H_ */
|
||||
/*
|
||||
@(#)REV: 2.18 90/12/13
|
||||
*/
|
||||
62
cde/lib/DtSvc/include/codelibs/mbstring.h
Normal file
62
cde/lib/DtSvc/include/codelibs/mbstring.h
Normal file
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* File: mbstring.h $XConsortium: mbstring.h /main/3 1995/10/26 16:12:25 rswiston $
|
||||
*
|
||||
* (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
* (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
* (c) Copyright 1993, 1994 Novell, Inc.
|
||||
*/
|
||||
|
||||
#ifndef __MBSTRING_H_
|
||||
#define __MBSTRING_H_
|
||||
|
||||
#if defined(USL) || defined(__uxp__)
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#ifdef apollo
|
||||
#define _NEED_WCHAR_T
|
||||
#include <sys/stdtypes.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#if defined __cplusplus || defined __STDC__
|
||||
|
||||
#ifdef __cplusplus2_1
|
||||
extern char *_mb_schr(char *str, wchar_t ch);
|
||||
extern char *_mb_srchr(char *str, wchar_t ch);
|
||||
#else /* __cplusplus2_1 */
|
||||
extern char *_mb_schr(const char *str, wchar_t ch);
|
||||
extern char *_mb_srchr(const char *str, wchar_t ch);
|
||||
#endif /* __cplusplus2_1 */
|
||||
|
||||
#else /* defined __cplusplus || defined __STDC__ */
|
||||
|
||||
extern char *_mb_schr();
|
||||
extern char *_mb_srchr();
|
||||
|
||||
#endif /* defined __cplusplus || defined __STDC__ */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
#ifdef __cplusplus2_1
|
||||
inline const char *_mb_schr(const char *str, wchar_t ch)
|
||||
{
|
||||
return (const char *)_mb_schr((char *)str, ch);
|
||||
}
|
||||
|
||||
inline const char *_mb_srchr(const char *str, wchar_t ch)
|
||||
{
|
||||
return (const char *)_mb_srchr((char *)str, ch);
|
||||
}
|
||||
#endif /* __cplusplus2_1 */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __MBSTRING_H_ */
|
||||
62
cde/lib/DtSvc/include/codelibs/nl_hack.h
Normal file
62
cde/lib/DtSvc/include/codelibs/nl_hack.h
Normal file
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* $XConsortium: nl_hack.h /main/5 1996/11/15 18:12:32 drk $
|
||||
*
|
||||
* (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
* (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
* (c) Copyright 1993, 1994 Novell, Inc.
|
||||
*/
|
||||
|
||||
#ifndef __NL_HACK_H_
|
||||
#define __NL_HACK_H_
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
#ifdef NO_NLS16
|
||||
|
||||
# define ADVANCE(p) (++(p))
|
||||
# define CHARAT(p) (*(unsigned char *)(p))
|
||||
# define CHARADV(p) (*(unsigned char *)(p)++)
|
||||
# define WCHAR(c, p) (*(unsigned char *)(p) = c)
|
||||
# define WCHARADV(c, p) (*(unsigned char *)(p)++ = c)
|
||||
|
||||
#else
|
||||
|
||||
# include <locale.h>
|
||||
# include <stdlib.h>
|
||||
|
||||
/* These two globals are needed for the following macros to work.
|
||||
* The definitions are neither "extern" nor "static". This keeps both
|
||||
* C and C++ from complaining about unused variables, keeps the linker
|
||||
* from complaining about multiply-defined symbols, and creates only a
|
||||
* single instance of each var per program (rather than one per *.o).
|
||||
* This is also why both variables are uninitialized arrays.
|
||||
*
|
||||
* These macros imitate the original HP NLS16 equivalents so that rest
|
||||
* of the Codelibs code does not need to be modified. The original
|
||||
* definitions are below within the "#ifdef NLS16" section.
|
||||
*
|
||||
* The original HP NLS16 assumes 2 byte multi-byte characters. It is
|
||||
* generalized for all multi-byte characters.
|
||||
*/
|
||||
|
||||
/* wchar_t __nlh_char[1]; */
|
||||
|
||||
# define __NLH_WIDTH(p) (mblen(p, MB_CUR_MAX) > 1 ? mblen(p, MB_CUR_MAX) : 1)
|
||||
# define __NLH_CHAR(p) \
|
||||
(mbtowc(__nlh_char, p, MB_CUR_MAX) < 0 ? *p : __nlh_char[0])
|
||||
|
||||
# define ADVANCE(p) ((p) += __NLH_WIDTH(p))
|
||||
|
||||
# define CHARAT(p) (__NLH_CHAR(p))
|
||||
|
||||
# define CHARADV(p) (__NLH_CHAR(p), \
|
||||
(p) += __NLH_WIDTH(p), __nlh_char[0])
|
||||
|
||||
# define WCHAR(c, p) (wctomb(p, (wchar_t)c), c)
|
||||
|
||||
# define WCHARADV(c, p) (WCHAR(c, p), ADVANCE(p))
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* __NL_HACK_H_ */
|
||||
41
cde/lib/DtSvc/include/codelibs/pathutils.h
Normal file
41
cde/lib/DtSvc/include/codelibs/pathutils.h
Normal file
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* $XConsortium: pathutils.h /main/4 1996/05/08 11:21:09 drk $
|
||||
*
|
||||
* (c) Copyright 1996 Digital Equipment Corporation.
|
||||
* (c) Copyright 1993,1994,1996 Hewlett-Packard Company.
|
||||
* (c) Copyright 1993,1994,1996 International Business Machines Corp.
|
||||
* (c) Copyright 1993,1994,1996 Sun Microsystems, Inc.
|
||||
* (c) Copyright 1993,1994,1996 Novell, Inc.
|
||||
* (c) Copyright 1996 FUJITSU LIMITED.
|
||||
* (c) Copyright 1996 Hitachi.
|
||||
*/
|
||||
|
||||
#ifndef __PATHUTILS_H_
|
||||
#define __PATHUTILS_H_
|
||||
|
||||
#include <stddef.h>
|
||||
#include <codelibs/boolean.h>
|
||||
|
||||
#ifndef MAXPATHLEN
|
||||
#define MAXPATHLEN 1024
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern char *pathcollapse(const char *src,
|
||||
char *dst = NULL,
|
||||
boolean show_dir = FALSE);
|
||||
#elif defined(__STDC__)
|
||||
extern char *pathcollapse(const char *src, char *dst, boolean show_dir);
|
||||
#else /* old-style C */
|
||||
extern char *pathcollapse();
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __PATHUTILS_H_ */
|
||||
59
cde/lib/DtSvc/include/codelibs/privbuf.h
Normal file
59
cde/lib/DtSvc/include/codelibs/privbuf.h
Normal file
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* $TOG: privbuf.h /main/5 1999/10/15 17:23:22 mgreess $
|
||||
*
|
||||
* (c) Copyright 1996 Digital Equipment Corporation.
|
||||
* (c) Copyright 1993,1994,1996 Hewlett-Packard Company.
|
||||
* (c) Copyright 1993,1994,1996 International Business Machines Corp.
|
||||
* (c) Copyright 1993,1994,1996 Sun Microsystems, Inc.
|
||||
* (c) Copyright 1993,1994,1996 Novell, Inc.
|
||||
* (c) Copyright 1996 FUJITSU LIMITED.
|
||||
* (c) Copyright 1996 Hitachi.
|
||||
*/
|
||||
#ifndef __PRIVBUF_H_
|
||||
#define __PRIVBUF_H_
|
||||
|
||||
#ifdef DOMAIN_ALLOW_MALLOC_OVERRIDE
|
||||
#include "/usr/include/apollo/shlib.h"
|
||||
#endif
|
||||
#ifdef apollo
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
typedef void (*privbuf_func)(void *v);
|
||||
|
||||
#ifdef __PRIVATE_
|
||||
// this is only for internal library routines needing dynamic buffers:
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#if defined(__osf__) || defined(sun)
|
||||
// The DEC C++ compiler rejects valid inline declarations, claiming
|
||||
// they have both internal and external linkage.
|
||||
#else
|
||||
inline static void *operator new(size_t size) { return malloc((unsigned)size); }
|
||||
inline static void operator delete(void *p) { if (p) free((char*)p); }
|
||||
#endif
|
||||
|
||||
#include <codelibs/dynarray.h>
|
||||
declare_array(privbuf_charbuf, char, 128)
|
||||
declare_array(privbuf_strvec, char*, 128)
|
||||
struct privbuf_buffer
|
||||
{
|
||||
privbuf_func func;
|
||||
privbuf_charbuf buf;
|
||||
privbuf_strvec vec;
|
||||
};
|
||||
extern void privbuf_freeprivbuf(void *buf);
|
||||
extern privbuf_buffer *privbuf_allocprivbuf();
|
||||
#undef __PRIVATE_
|
||||
#endif /* __PRIVATE_ */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
void privbuf_release(void **var);
|
||||
}
|
||||
#else
|
||||
extern void privbuf_release();
|
||||
#endif
|
||||
|
||||
#endif /* __PRIVBUF_H_ */
|
||||
34
cde/lib/DtSvc/include/codelibs/shellutils.h
Normal file
34
cde/lib/DtSvc/include/codelibs/shellutils.h
Normal file
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* File: shellutils.h $XConsortium: shellutils.h /main/3 1995/10/26 16:13:31 rswiston $
|
||||
*
|
||||
* (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
* (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
* (c) Copyright 1993, 1994 Novell, Inc.
|
||||
*/
|
||||
|
||||
#ifndef __SHELLUTILS_H_
|
||||
#define __SHELLUTILS_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
char const *const *shellscan(char const *str, int *argc = (int *)0,
|
||||
unsigned opts = 0);
|
||||
}
|
||||
#else
|
||||
extern char **shellscan();
|
||||
#endif
|
||||
|
||||
#define SHX_NOGLOB 0x0001
|
||||
#define SHX_NOTILDE 0x0002
|
||||
#define SHX_NOVARS 0x0004
|
||||
#define SHX_NOQUOTES 0x0008
|
||||
#define SHX_NOSPACE 0x0010
|
||||
#define SHX_NOMETA 0x0020
|
||||
#define SHX_NOCMD 0x0040
|
||||
#define SHX_COMPLETE 0x0080
|
||||
|
||||
#define SHX_NOGRAVE 0x0040 /* Obsolete, use NOCMD */
|
||||
|
||||
#endif /* __SHELLUTILS_H_ */
|
||||
147
cde/lib/DtSvc/include/codelibs/stringx.h
Normal file
147
cde/lib/DtSvc/include/codelibs/stringx.h
Normal file
@@ -0,0 +1,147 @@
|
||||
/*
|
||||
* File: stringx.h $TOG: stringx.h /main/5 1999/10/15 17:23:52 mgreess $
|
||||
*
|
||||
* (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
* (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
* (c) Copyright 1993, 1994 Novell, Inc.
|
||||
*/
|
||||
|
||||
#ifndef __STRINGX_H_
|
||||
#define __STRINGX_H_
|
||||
|
||||
#ifdef DOMAIN_ALLOW_MALLOC_OVERRIDE
|
||||
#include "/usr/include/apollo/shlib.h"
|
||||
#endif
|
||||
#ifdef apollo
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
#include <codelibs/boolean.h>
|
||||
|
||||
#define streq(a,b) (strcmp(a,b) == 0)
|
||||
|
||||
/* private buffer variables */
|
||||
extern void *_strsep_privbuf;
|
||||
extern void *_strcmbn_privbuf;
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
#if defined(__cplusplus) || defined(__STDC__)
|
||||
#if !defined(__osf__) && !defined(sun)
|
||||
/* The DEC C++ compiler rejects this, claiming it has both */
|
||||
/* internal and external linkage. */
|
||||
char *strnew(size_t len);
|
||||
void strfree(const char *s);
|
||||
#endif
|
||||
char *strstrx(char *s1, const char *s2);
|
||||
char *strrstrx(char *s1, const char *s2);
|
||||
int strwcmp(const char *pattern, const char *str);
|
||||
int strwcmpi(const char *pattern, const char *str);
|
||||
char *strwpat(const char *pattern);
|
||||
char *strend(const char *str);
|
||||
|
||||
unsigned strhash(const char *key);
|
||||
unsigned strhashi(const char *key);
|
||||
|
||||
char *strupper(char *str);
|
||||
char *strlower(char *str);
|
||||
|
||||
#ifdef __cplusplus
|
||||
char *strtokx(char *&ptr, const char *sep);
|
||||
# if !defined(__osf__) && !defined(linux)
|
||||
char **strsep(const char *str, const char *sep,
|
||||
boolean whsp = TRUE, int *num = NULL);
|
||||
# if !defined(__osf__)
|
||||
const char *strcmbn(const char **vec, const char *sep = " ");
|
||||
# endif
|
||||
# endif
|
||||
|
||||
#else /* __STDC__ */
|
||||
char *strtokx(char **ptr, const char *sep);
|
||||
# if !defined(linux)
|
||||
char **strsep(const char *str, const char *sep,
|
||||
boolean whsp, int *num);
|
||||
#endif
|
||||
#ifndef __osf__
|
||||
const char *strcmbn(const char **vec, const char *sep);
|
||||
#endif
|
||||
|
||||
#endif /* __STDC__ */
|
||||
|
||||
|
||||
#ifdef __OBSOLETE
|
||||
size_t nl_strlen(const char *str); /* __OBSOLETE */
|
||||
int strcharsize(const char *str); /* __OBSOLETE */
|
||||
#endif /* __OBSOLETE */
|
||||
|
||||
#else /* C */
|
||||
|
||||
extern void strfree();
|
||||
extern char *strstrx(), strrstrx();
|
||||
extern int strwcmp(), strwcmpi();
|
||||
extern char *strwpat();
|
||||
extern char *strend();
|
||||
extern char *strtokx();
|
||||
|
||||
extern unsigned strhash();
|
||||
extern unsigned strhashi();
|
||||
|
||||
extern char *strupper(), *strlower();
|
||||
|
||||
|
||||
#ifdef __OBSOLETE
|
||||
extern int strcharsize(); /* __OBSOLETE */
|
||||
extern size_t nl_strlen(); /* __OBSOLETE */
|
||||
#endif /* __OBSOLETE */
|
||||
|
||||
#endif /* C */
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
|
||||
#if defined(apollo) || defined(__aix) || defined(USL) || defined(__uxp__) || defined(__osf__)
|
||||
#include <stdlib.h>
|
||||
#else
|
||||
#include <malloc.h>
|
||||
#endif /* apollo */
|
||||
|
||||
inline char *strnew(size_t len) { return (char*)malloc(len + 1); }
|
||||
#if defined(sun) || defined(__sun) || defined(USL) || defined(__uxp__)
|
||||
inline void strfree(const char *s)
|
||||
{ if (s != NULL) free((char *)s); }
|
||||
#else
|
||||
inline void strfree(const char *s)
|
||||
#if defined(__hpux) || defined(__osf__)
|
||||
{ if (s != NULL) free((void *)s); }
|
||||
#else
|
||||
{ if (s != NULL) free((const void *)s); }
|
||||
#endif /* __hpux */
|
||||
#endif
|
||||
#if defined(bsd)
|
||||
inline char *strdup(const char *s)
|
||||
{ return strcpy((char*)malloc(strlen(s) + 1), s); }
|
||||
#endif
|
||||
|
||||
/* private buffer funcs - we use inlines to handle default args properly */
|
||||
|
||||
#else /* C || __STDC__ */
|
||||
|
||||
#define strnew(len) ((char*)malloc((len) + 1))
|
||||
|
||||
#define strbld strblds
|
||||
|
||||
/* macros for funcs that work on top of privbuf versions */
|
||||
|
||||
/* for backward compatibility only - __OBSOLETE */
|
||||
#ifdef __OBSOLETE
|
||||
#define strpos strstrx /* __OBSOLETE */
|
||||
#define strrpos strrstrx /* __OBSOLETE */
|
||||
#endif /* __OBSOLETE */
|
||||
|
||||
#endif /* C || __STDC__ */
|
||||
|
||||
#endif /* __STRINGX_H_ */
|
||||
Reference in New Issue
Block a user