File: defstr.h

package info (click to toggle)
yorick 1.4-14
  • links: PTS
  • area: main
  • in suites: potato
  • size: 5,948 kB
  • ctags: 6,609
  • sloc: ansic: 63,898; yacc: 889; makefile: 605; sh: 65; lisp: 60; fortran: 19
file content (79 lines) | stat: -rw-r--r-- 2,804 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/*
    DEFSTR.H
    Declare functions for string manipulation.

    $Id: defstr.h,v 1.1 1993/08/27 18:32:09 munro Exp $

    Duplicates declarations in ANSI <string.h> header (which is not
    present on Suns), and adds custom functions StrSave, StrAlloc, and
    StrFree which make use of the block allocator defined in defmem.c.
    (Note that size_t is assumed to be long here...)
 */
/*    Copyright (c) 1994.  The Regents of the University of California.
                    All rights reserved.  */

#ifndef DEFSTR_H
#define DEFSTR_H

/* first come function definitions from <string.h> */

#ifdef STDC_HEADERS
#include <string.h>

#else

#ifndef SIZE_T_TYPE
#define SIZE_T_TYPE unsigned long
#endif

#ifdef BSD_STRCHR
#define strchr index
#define strrchr indexr
#endif

extern char *strcpy(char *s, const char *t);
extern char *strncpy(char *s, const char *t, SIZE_T_TYPE n);
extern char *strcat(char *s, const char *t);
extern char *strncat(char *s, const char *t, SIZE_T_TYPE n);
extern int strcmp(const char *s, const char *t);
extern int strncmp(const char *s, const char *t, SIZE_T_TYPE n);
extern char *strchr(const char *s, int c);
extern char *strrchr(const char *s, int c);
extern SIZE_T_TYPE strspn(const char *s, const char *t);
extern SIZE_T_TYPE strcspn(const char *s, const char *t);
extern char *strpbrk(const char *s, const char *t);
extern char *strstr(const char *s, const char *t);
extern SIZE_T_TYPE strlen(const char *s);
extern char *strerror(int n);
extern char *strtok(char *s, const char *t);

extern void *memcpy(void *s, const void *t, SIZE_T_TYPE n);
extern void *memmove(void *s, const void *t, SIZE_T_TYPE n);
extern int memcmp(const void *s, const void *t, SIZE_T_TYPE n);
extern void *memchr(const void *s, int c, SIZE_T_TYPE n);
extern void *memset(void *s, int c, SIZE_T_TYPE n);
#endif

/* next come string functions from <stdlib.h> */

extern long strtol(const char *s, char **endp, int base);
extern unsigned long strtoul(const char *s, char **endp, int base);
extern double strtod(const char *s, char **endp);

/* Yorick specific higher-level string functions properly handle
   0 char*s, and automatically do appropriate memory management.
   Memory management uses fast block allocators for <64 character
   strings.  */

extern char *StrAlloc(long n);          /* returns * to n+1 new chars */
extern void StrFree(char *s);           /* releases StrSave/Alloc string */

/* The Cpy operations return 0 iff s==0 */
extern char *StrCpy(const char *s);
extern char *StrNCpy(const char *s, long n);
/* The Cat operations ALWAYS return a copy -- 0 iff both s==0 && t==0.
   If t==0, same as StrCpy(s); if s==0, StrCpy(t) or StrNCpy(t, n).  */
extern char *StrCat(const char *s, const char *t);
extern char *StrNCat(const char *s, const char *t, long n);

#endif