-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlibc_h.rpgle
202 lines (192 loc) · 8.12 KB
/
libc_h.rpgle
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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
/if not defined(QUSEC)
/define QUSEC
/copy QSYSINC/QRPGLESRC,QUSEC
/endif
/if not defined (LIBC)
/define LIBC
*-------------------------------------------------------------------------
* Prototypes for C-Functions
*-------------------------------------------------------------------------
*
* string functions
*
D strtok PR * extproc('strtok')
D i_string * value options(*string)
D i_token * value options(*string)
*
D strlen PR 10U 0 extproc('strlen')
D string * value
*
D strcmp PR 10I 0 extproc('strcmp')
D string1 * value
D string2 * value
*
D strncmp PR 10I 0 extproc('strncmp')
D string1 * value
D string2 * value
D count 10I 0 value
*
D strcmpi PR 10I 0 extproc('strcmpi')
D string1 * value
D string2 * value
*
D strcasecmp PR 10I 0 extproc('strcasecmp')
D string1 * value
D string2 * value
*
D strncasecmp PR 10I 0 extproc('strncasecmp')
D string1 * value
D string2 * value
D count 10I 0 value
*
D strstr PR * extproc('strstr')
D string1 * value
D string2 * value
*
D strcspn PR 10I 0 extproc('strcspn')
D string1 * value
D string2 * value
*
D requestControlBlockLower...
D DS qualified
D type 10I 0 inz(0)
D ccsid 10I 0 inz(0)
D case 10I 0 inz(0)
D res1 10A inz(*ALLX'00')
*
D requestControlBlockUpper...
D DS qualified
D type 10I 0 inz(1)
D ccsid 10I 0 inz(0)
D case 10I 0 inz(0)
D res1 10A inz(*ALLX'00')
*
D caseConvert PR extproc('QlgConvertCase')
D reqContBlock const
D likeds(requestControlBlockUpper)
D input 1024A const options(*varsize)
D output 1024A options(*varsize)
D len 10I 0 const
D errorcode likeds(QUSEC) options(*varsize)
*
* memory functions
*
D memcpy PR * extproc('memcpy')
D dest * value
D source * value
D count 10U 0 value
*
D memset PR * extproc('memset')
D i_pDest * value
D i_char 10I 0 value
D i_count 10U 0 value
*
D memmove PR * extproc('memmove')
D pMemDest * value
D pMemSrc * value
D memSize 10U 0 value
*
D memcmp PR 10I 0 extproc('memcmp')
D pBuf1 * value
D pBuf2 * value
D count 10U 0 value
*
D memicmp PR 10I 0 extproc('__memicmp')
D pBuf1 * value
D pBuf2 * value
D count 10U 0 value
*
* math functions
*
D ceiling PR 8F extproc('ceil')
D value 8F value
*
D floor PR 8F extproc('floor')
D value 8F value
*
* other functions
*
D tmpnam PR * extproc('tmpnam')
D buffer 39A options(*omit)
*
D tmpnamIFS PR * extproc('_C_IFS_tmpnam')
D buffer 39A options(*omit)
*
D system PR 10I 0 extproc('system')
D command * value options(*string)
*
D srand PR extproc('srand')
D i_seed 10U 0 value
*
D rand PR 10I 0 extproc('rand')
*
D qsort PR * extproc('qsort')
D memPtr * value
D numElem 10U 0 value
D width 10U 0 value
D pSortFunc * value procptr
*
D bsearch PR * extproc('bsearch')
D keyPtr * value
D memPtr * value
D numElem 10U 0 value
D width 10U 0 value
D pSearchFnc * value procptr
*
* error handling
*
D errno PR * extproc('__errno')
*
D strerr PR * extproc('strerror')
D errnum 10I 0 value
* for backwards compatibility
D strerror PR * extproc('strerror')
D errnum 10I 0 value
/endif
/if not defined(FCNTL_PROTOTYPE)
*
* fcntl() commands
*
D F_DUPFD C 0
D F_GETFL C 6
D F_SETFL C 7
D F_GETOWN C 8
D F_SETOWN C 9
*
* fcntl() flags
*
D O_NONBLOCK C 128
D O_NDELAY C 128
D FNDELAY C 128
D FASYNC C 512
*--------------------------------------------------------------------
* fcntl()--Change Descriptor Attributes
*
* int fcntl(int descriptor, int command, ...)
*
* The third parameter (when used with sockets) is also an
* integer passed by value.. it specifies an argument for
* some of the commands.
*
* commands supported in sockets are:
* F_GETFL -- Return the status flags for the descriptor
* F_SETFL -- Set status flags for the descriptor
* (Arg =)status flags (ORed) to set.
* (the commands below arent terribly useful in RPG)
* F_DUPFD -- Duplicate the descriptor
* (Arg =)minimum value that new descriptor can be
* F_GETOWN -- Return the process ID or group ID that's
* set to receive SIGIO & SIGURG
* F_SETOWN -- Set the process ID or group ID that's
* to receive SIGIO & SIGURG
* (Arg =)process ID (or neg value for group ID)
*
* returns -1 upon error.
* successful values are command-specific.
*--------------------------------------------------------------------
D fcntl PR 10I 0 extproc('fcntl')
D socketDesc 10I 0 value
D command 10I 0 value
D arg 10I 0 value options(*nopass)
/define FCNTL_PROTOTYPE 2000648
/endif