File: util.h

package info (click to toggle)
robodoc 4.99.34-3
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 1,468 kB
  • ctags: 1,009
  • sloc: ansic: 14,040; sh: 3,635; makefile: 163; perl: 155
file content (162 lines) | stat: -rw-r--r-- 3,655 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
#ifndef ROBODOC_UTIL_H
#define ROBODOC_UTIL_H

/* TODO all the functions that operate
 on headers should be in headers.h */

#include "headers.h"
#include "document.h"

typedef int         (
    *TCompare )         (
    void *,
    void * );


void                RB_SetCurrentFile(
    char *filename );
char               *RB_GetCurrentFile(
     );

char               *RB_FilePart(
    char * );
void                RB_Analyse_Defaults_File(
    void );

void                RB_Slow_Sort(
    void );
void                RB_Reverse_List(
    void );
void                RB_Insert_In_List(
    struct RB_header **,
    struct RB_header * );
void                RB_Remove_From_List(
    struct RB_header **,
    struct RB_header * );
struct RB_header   *RB_Alloc_Header(
    void );
void                RB_Free_Header(
    struct RB_header * );
char               *RB_StrDup(
    char * );
char               *RB_StrDupLen(
    char *str,
    size_t length );
char               *RB_CookStr(
    char * );
void                RB_Say(
    char *,
    long mode,
    ... );
void                RB_Warning_Full(
    char *arg_filename,
    int arg_line_number,
    char *arg_format,
    ... );
void                RB_Warning(
    char *format,
    ... );
void                RB_Panic(
    char *,
    ... );
int                 RB_Str_Case_Cmp(
    char *s,
    char *t );
void                RB_TimeStamp(
    FILE *f );
char               *RB_Skip_Whitespace(
    char *buf );

void               *RB_Calloc(
    size_t count,
    size_t size );
void               *RB_Malloc(
    size_t size );
void                RB_Free(
    void *p );
void                RB_FputcLatin1ToUtf8(
    FILE *fp,
    int c );
void                RB_CopyFile(
    char *sourceFileName,
    char *destinationFileName );
int                 RB_Match(
    char *target,
    char *wildcard_expression );
void                RB_QuickSort(
    void **array,
    int left,
    int right,
    TCompare f );
void                RB_StripCR(
    char *line );
int                 Stat_Path(
    char required,
    char *path );

char               *ExpandTab(
    char *line );

int                 RB_ContainsNL(
    char *line );
char               *RB_ReadWholeLine(
    FILE *file,
    char *buf,
    int *arg_readChars );
void                RB_FreeLineBuffer(
     );
char               *Path_2_Win32Path(
    char *path );

void               *RB_malloc(
    size_t bytes );
void                Make_crc32_table(
    void );
unsigned long       RB_crc32(
    unsigned char *buf,
    unsigned int len,
    unsigned long crc32 );

char               *RB_Get_Saved_CWD(
    void );
void                RB_Change_To_Docdir(
    struct RB_Document *document );
void                RB_Change_Back_To_CWD(
    void );
FILE               *Open_Pipe(
    char *pipe_name );
void                Close_Pipe(
    FILE *arg_pipe );


void                _RB_Mem_Check(
    void *ptr,
    const char *fname,
    const char *funcname,
    int linenum );



int utf8_isalnum(unsigned int arg_c);
int utf8_isalpha(unsigned int arg_c);
int utf8_iscntrl(unsigned int arg_c);
int utf8_isdigit(unsigned int arg_c);
int utf8_isgraph(unsigned int arg_c);
int utf8_islower(unsigned int arg_c);
int utf8_isprint(unsigned int arg_c);
int utf8_ispunct(unsigned int arg_c);
int utf8_isspace(unsigned int arg_c);
int utf8_isxdigit(unsigned int arg_c);


/****f* Utilities/RB_Mem_Check
 * FUNCTION
 *   Check for memory allocation failures.
 * SOURCE
 */

#define RB_Mem_Check(ptr) if (!ptr) RB_Panic("%s:%s:%d: Out of memory!\n", __FILE__, __FUNCTION__, __LINE__)

/*******/

#endif /* ROBODOC_UTIL_H */