~ubuntu-branches/ubuntu/trusty/libcdk5/trusty

« back to all changes in this revision

Viewing changes to man/cdk_util.3

  • Committer: Bazaar Package Importer
  • Author(s): John Goerzen
  • Date: 2007-06-06 03:54:31 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20070606035431-ba4gdvw0h6ybffsu
Tags: 5.0.20060507-1
* New upstream release.
* Fixed header patching.  Patch from Robert Schiele.
  Closes: #402978, #416336.
* Update widget count in description.  Closes: #294709.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
'\" t
2
 
.\" $Id: cdk_util.3,v 1.4 2005/04/24 18:10:50 tom Exp $
 
2
.\" $Id: cdk_util.3,v 1.6 2005/12/28 18:35:31 tom Exp $
 
3
.de XX
 
4
..
3
5
.TH cdk_util 3
4
6
.SH NAME
5
 
Beep,
6
 
CDKallocStrings,
7
 
CDKcountStrings,
8
 
CDKfreeChtypes,
9
 
CDKfreeStrings,
10
 
CDKgetDirectoryContents,
11
 
CDKreadFile,
12
 
CDKsplitString,
13
 
alignxy,
14
 
baseName,
15
 
ceilCDK,
16
 
char2Chtype,
17
 
char2DisplayType,
18
 
checkForLink,
19
 
chlen,
20
 
chstrncpy,
21
 
chtype2Char,
22
 
chtype2String,
23
 
cleanChar,
24
 
cleanChtype,
25
 
cmpStrChstr,
26
 
copyChar,
27
 
copyChtype,
28
 
deleteCursesWindow,
29
 
dirName,
30
 
eraseCursesWindow,
31
 
floorCDK,
32
 
freeChar,
33
 
freeCharList,
34
 
freeChtype,
35
 
freeChtypeList,
36
 
getListIndex,
37
 
getString,
38
 
intlen,
39
 
justifyString,
40
 
mode2Char,
41
 
mode2Filetype,
42
 
moveCursesWindow,
43
 
popupDialog,
44
 
popupLabel,
45
 
popupLabelAttrib,
46
 
searchList,
47
 
selectFile,
48
 
setWidgetDimension,
49
 
sortList,
50
 
stripWhiteSpace,
51
 
viewFile,
52
 
viewInfo \- Cdk utility functions
 
7
.XX CDKgetDirectoryContents
 
8
.XX CDKreadFile
 
9
.XX alignxy
 
10
.XX char2Chtype
 
11
.XX char2DisplayType
 
12
.XX checkForLink
 
13
.XX chtype2String
 
14
.XX deleteCursesWindow
 
15
.XX eraseCursesWindow
 
16
.XX getListIndex
 
17
.XX getString
 
18
.XX justifyString
 
19
.XX mode2Filetype
 
20
.XX moveCursesWindow
 
21
.XX popupDialog
 
22
.XX popupLabel
 
23
.XX popupLabelAttrib
 
24
.XX selectFile
 
25
.XX setWidgetDimension
 
26
.XX stripWhiteSpace
 
27
.XX viewFile
 
28
.XX viewInfo
 
29
cdk_util \- Cdk utility functions
53
30
.SH SYNOPSIS
54
31
.LP
55
32
.B cc
60
37
#include <cdk.h>
61
38
.nf
62
39
.TP 15
63
 
.B "void Beep(void);"
64
 
.TP 15
65
 
.B "unsigned CDKallocStrings("
66
 
.BI "char ***" "list"/,
67
 
.BI "char *" "item"/,
68
 
.BI "unsigned " "length"/,
69
 
.BI "unsigned " "used"/);
70
 
.TP 15
71
 
.B "unsigned CDKcountStrings("
72
 
.BI "char **" list");
73
 
.TP 15
74
 
.B "void CDKfreeChtypes("
75
 
.BI "chtype **" "list");
76
 
.TP 15
77
 
.B "void CDKfreeStrings("
78
 
.BI "char **" "list");
79
 
.TP 15
80
40
.B "int CDKgetDirectoryContents ("
81
41
.BI "char *" "directory",
82
42
.BI "char ***" "list");
85
45
.BI "char *" "filename",
86
46
.BI "char ***" "info");
87
47
.TP 15
88
 
.B "char **CDKsplitString("
89
 
.BI "char *" "string",
90
 
.BI "int " "separator");
91
 
.TP 15
92
48
.B "void alignxy ("
93
49
.BI "WINDOW *" "window",
94
50
.BI "int *" "xpos",
96
52
.BI "int " "boxWidth",
97
53
.BI "int " "boxHeight");
98
54
.TP 15
99
 
.B "char *baseName ("
100
 
.BI "char *" "filename");
101
 
.TP 15
102
 
.B "int ceilCDK("
103
 
.BI "double" "value");
104
 
.TP 15
105
55
.B "chtype *char2Chtype ("
106
56
.BI "char *" "string",
107
57
.BI "int *" "length",
114
64
.BI "char *" "line",
115
65
.BI "char *" "filename");
116
66
.TP 15
117
 
.B "int chlen ("
118
 
.BI "chtype *" "string");
119
 
.TP 15
120
 
.B "void chstrncpy(
121
 
.BI "char *" "dest",
122
 
.BI "chtype *" "src",
123
 
.BI "int " "maxcount");
124
 
.TP 15
125
 
.B "char *chtype2Char ("
126
 
.BI "chtype *" "string");
127
 
.TP 15
128
67
.B "char *chtype2String (
129
68
.BI "chtype *" "string");
130
69
.TP 15
131
 
.B "void cleanChar ("
132
 
.BI "char *" "string",
133
 
.BI "int " "length",
134
 
.BI "char " "character");
135
 
.TP 15
136
 
.B "void cleanChtype ("
137
 
.BI "chtype *" "string",
138
 
.BI "int " "length",
139
 
.BI "chtype" "character");
140
 
.TP 15
141
 
.B "int cmpStrChstr("
142
 
.BI "char *" "str",
143
 
.BI "chtype *" "chstr");
144
 
.TP 15
145
 
.B "char *copyChar ("
146
 
.BI "char *" "string");
147
 
.TP 15
148
 
.B "chtype *copyChtype ("
149
 
.BI "chtype *" "string");
150
 
.TP 15
151
70
.B "void deleteCursesWindow ("
152
71
.BI "WINDOW *" "window");
153
72
.TP 15
154
 
.B "char *dirName ("
155
 
.BI "char *" "filename");
156
 
.TP 15
157
73
.B "void eraseCursesWindow ("
158
74
.BI "WINDOW *" "window");
159
75
.TP 15
160
 
.B "int floorCDK("
161
 
.BI "double " "value");
162
 
.TP 15
163
 
.B "void freeChar ("
164
 
.BI "char *" "string");
165
 
.TP 15
166
 
.B "void freeCharList ("
167
 
.BI "char **" "list",
168
 
.BI "unsigned " "size");
169
 
.TP 15
170
 
.B "void freeChtype (
171
 
.BI "chtype *" "string");
172
 
.TP 15
173
 
.B void freeChtypeList ("
174
 
.BI "chtype **" "list",
175
 
.BI "unsigned " "size");
176
 
.TP 15
177
76
.B "int getListIndex ("
178
77
.BI "CDKSCREEN *" "screen",
179
78
.BI "char *" "title",
187
86
.BI "char *" "label",
188
87
.BI "char *" "init");
189
88
.TP 15
190
 
.B "int intlen ("
191
 
.BI "int " "value");
192
 
.TP 15
193
89
.B "int justifyString ("
194
90
.BI "int " "fieldWidth",
195
91
.BI "int " "mesglen",
196
92
.BI "int " "justify");
197
93
.TP 15
198
 
.B "int mode2Char ("
199
 
.BI "char *" "string",
200
 
.BI "mode_t " "fileMode");
201
 
.TP 15
202
94
.B "int mode2Filetype ("
203
95
.BI "mode_t " "fileMode");
204
96
.TP 15
225
117
.BI "int " "count",
226
118
.BI "chtype " "attribute");
227
119
.TP 15
228
 
.B "int searchList ("
229
 
.BI "char **" "list",
230
 
.BI "int " "listSize",
231
 
.BI "char *" "pattern");
232
 
.TP 15
233
120
.B "char *selectFile ("
234
121
.BI "CDKSCREEN *" "screen",
235
122
.BI "char *" "title");
239
126
.BI "int " "proposedDim",
240
127
.BI "int " "adjustment");
241
128
.TP 15
242
 
.B "void sortList ("
243
 
.BI "char *" "list" [],
244
 
.BI "int " "length");
245
 
.TP 15
246
129
.B "void stripWhiteSpace ("
247
130
.BI "EStripType " "stripType",
248
131
.BI "char *" "string");
264
147
.BI "boolean " "interpret");
265
148
.fi
266
149
.SH DESCRIPTION
 
150
These are utility functions that one may use to initialize,
 
151
build or customize widgets.
267
152
.
268
153
.SH AVAILABLE FUNCTIONS
269
154
.TP 5
270
 
.B Beep
271
 
This beeps at the user.
272
 
The standard curses beep() does not
273
 
flush the stream, so it will only beep until a force is made.
274
 
This forces a flush after issuing the beep command.
275
 
.TP 5
276
 
.B CDKallocStrings
277
 
Add a new string \fIitem\fP to a \fIlist\fP.
278
 
Keep a null pointer on the end so one may use
279
 
\fBCDKfreeStrings()\fP to deallocate the whole list.
280
 
The caller is responsible for updating the \fIlength\fP of the list.
281
 
The return value is the updated number of chars \fIused\fP.
282
 
.TP 5
283
 
.B CDKcountStrings
284
 
Count the number of items in a null-terminated \fIlist\fP of character strings.
285
 
Return the count.
286
 
.TP 5
287
 
.B CDKfreeChtypes
288
 
Free a \fIlist\fP of chtype-strings which is terminated by a null pointer.
289
 
.TP 5
290
 
.B CDKfreeStrings
291
 
Free a \fIlist\fP of character strings which is terminated by a null pointer.
292
 
.TP 5
293
155
.B CDKgetDirectoryContents
294
 
Open the given \fIdirectory\fP and reads in the contents.
295
 
Store result in \fIlist\fP and return the number of elements found.
 
156
opens and reads the contents of the given directory, filling
 
157
the array \fBlist\fR with the sorted contents of the directory.
 
158
If the directory cannot be opened then it returns a value of -1.
296
159
.TP 5
297
160
.B CDKreadFile
298
161
Read the file \fIfilename\fP,
299
162
load the contents into a dynamically allocated array,
300
 
storing its address via \fIinfo\fP
301
 
and return the number of lines read.
302
 
.TP 5
303
 
.B CDKsplitString
304
 
Split the \fIstring\fP at each occurrence of \fIseparator\fP,
305
 
returning a pointer to a dynamically allocated array of the pieces.
306
 
The original \fIstring\fP is unmodified.
 
163
storing its address via \fIinfo\fP.
 
164
It returns the number of lines
 
165
read if the file could be opened, -1 otherwise.
307
166
.TP 5
308
167
.B alignxy
309
168
Aligns a box on the given \fIwindow\fP with the height and width given.
314
173
\fIboxHeight\fP,
315
174
parameters.
316
175
.TP 5
317
 
.B baseName
318
 
Return the basename of the given \fIfilename\fP.
319
 
The result should be freed by the caller.
320
 
.TP 5
321
 
.B ceilCDK
322
 
Return an integer like the math library \fBceil()\fP, which returns a double.
323
 
.TP 5
324
176
.B char2Chtype
325
177
Translate a character \fIstring\fP with embedded format markers
 
178
(e.g., "</X/Y>Blah Blah")
326
179
to a null-terminated array of chtype's.
327
180
The length of the array is stored via the \fIlength\fP parameter.
328
 
The alignment (LEFT, CENTER, RIGHT) is stored via the \fIalign\fP parameter.
 
181
The \fBalign\fR parameter contains justification information
 
182
(LEFT, CENTER, RIGHT).
 
183
The caller is responsible for freeing the result.
329
184
.TP 5
330
185
.B char2DisplayType
331
186
Lookup the given name in \fIstring\fP and return the equivalent display type.
341
196
buffer (which must hold at least CDK_PATHMAX characters).
342
197
Return nonzero if a filename is extracted.
343
198
.TP 5
344
 
.B chlen
345
 
Returns the length of the (null-terminated) \fIstring\fP of chtype's.
346
 
.TP 5
347
 
.B chstrncpy
348
 
Extract the characters from a null-terminated array of chtype's \fIsrc\fP.
349
 
The size of the destination \fIdest\fP is given in \fImaxcount\fP.
350
 
.TP 5
351
 
.B chtype2Char
352
 
Extract the characters from a null-terminated array of chtype's \fIstring\fP.
353
 
A dynamically allocated string is returned.
354
 
.TP 5
355
199
.B chtype2String
356
200
Extract the characters and formatting information
357
201
from a null-terminated array of chtype's \fIstring\fP.
358
202
A dynamically allocated string is returned.
359
203
.TP 5
360
 
.B cleanChar
361
 
Set the characters in \fIstring\fP to the given \fIcharacter\fP.
362
 
The length of \fIstring\fP is given by \fIlength\fP.
363
 
.TP 5
364
 
.B cleanChtype
365
 
Set the chtype's in \fIstring\fP to the given \fIcharacter\fP.
366
 
The length of \fIstring\fP is given by \fIlength\fP.
367
 
.TP 5
368
 
.B cmpStrChstr
369
 
Compare a char string \fIstr\fP to a chtype string \fIchstr\fP.
370
 
Return -1, 0 or 1 according to whether \fIstr\fP is less than, equal to
371
 
to greater than \fIchstr\fP.
372
 
.TP 5
373
 
.B copyChar
374
 
Copy the given character string (like strdup).
375
 
.TP 5
376
 
.B copyChtype,
377
 
Copy the given chtype string (analogous to strdup).
378
 
.TP 5
379
204
.B deleteCursesWindow
380
205
Safely delete a given window,
381
206
i.e., first check if the \fIwindow\fP parameter is nonnull.
382
207
.TP 5
383
 
.B dirName
384
 
Returns the directory for the given \fIfilename\fP,
385
 
i.e., the part before the * last slash.
386
 
The return value should be freed by the caller.
387
 
.TP 5
388
208
.B eraseCursesWindow
389
209
Safely erase a given window,
390
210
i.e., first check if the \fIwindow\fP parameter is nonnull.
391
211
.TP 5
392
 
.B floorCDK
393
 
Return an integer like the math function floor(), which returns a double.
394
 
.TP 5
395
 
.B freeChar
396
 
Free the memory used by the given \fIstring\fP.
397
 
.TP 5
398
 
.B freeCharList
399
 
Free the memory used by the given \fIlist\fP of strings.
400
 
The number of strings to free is given by \fIsize\fP.
401
 
.TP 5
402
 
.B freeChtype
403
 
Free frees the memory used by the given chtype \fIstring\fP.
404
 
.TP 5
405
 
.B freeChtypeList
406
 
Free the memory used by the given \fIlist\fP of chtype strings.
407
 
The number of strings to free is given by \fIsize\fP.
408
 
.TP 5
409
212
.B getListIndex
410
213
Display a scrollable list of strings in a dialog,
411
214
allow the user to select one.
415
218
If \fInumbers\fP is true, the displayed list items will be numbered.
416
219
.TP 5
417
220
.B getString
418
 
Display a simple dialog containing a prompt \fIlabel\fP and
419
 
initial value \fIinit\fP for the user's response.
420
 
Return the response string.
421
 
.TP 5
422
 
.B intlen
423
 
Return the number of characters which are required to represent the given
424
 
integer \fIvalue\fP.
 
221
pops up an entry widget with a title supplied by the value
 
222
of the \fBtitle\fR parameter, a label supplied by the \fBlabel\fR parameter,
 
223
and an initial value supplied by the \fBinitialValue\fR parameter.
 
224
It returns
 
225
a pointer to the value typed in or NULL if the widget was exited early.
425
226
.TP 5
426
227
.B justifyString
427
228
Given a string length \fImesglen\fP,
429
230
and a justification type \fIjustify\fP,
430
231
return the number of characters by which to shift the string.
431
232
.TP 5
432
 
.B mode2Char
433
 
Given a file protection mode \fIfileMode\fP,
434
 
store a printable version of the permissions in \fIstring\fP.
435
 
Return the corresponding permissions data,
436
 
i.e., ignoring the file-type bits.
437
 
.TP 5
438
233
.B mode2Filetype
439
234
Given a file protection mode \fIfileMode\fP,
440
235
return ignoring the file-type bits,
444
239
Move a given \fIwindow\fP by the amounts in \fIxdiff\fP and \fIydiff\fP.
445
240
.TP 5
446
241
.B popupDialog
447
 
Display a simple dialog with
448
 
a list of \fImesgCount\fP message strings \fImesg\fP.
449
 
At the bottom of the dialog, display \fIbuttonCount\fP buttons.
 
242
creates a quick pop-up dialog box.
 
243
Pass in the message in the
 
244
\fBmesg\fR parameter, the size of the message in the \fBmesgCount\fR parameter,
 
245
the button labels in the \fBbuttons\fR parameter and the number of buttons in
 
246
the \fBbuttonCount\fR parameter.
 
247
The dialog box will be centered on the screen.
450
248
.TP 5
451
249
.B popupLabel
452
 
Display a simple dialog with
453
 
a list of \fIcount\fP message strings \fImesg\fP.
 
250
creates a quick pop-up label widget.
 
251
The message and the size of
 
252
the message are passed in via the \fBmesg\fR and \fBcount\fR parameters respectively.
 
253
The label widget waits until the user hits a character and is centered
 
254
on the screen.
454
255
.TP 5
455
256
.B popupLabelAttrib
456
257
Display a simple dialog with
457
258
a list of \fIcount\fP message strings \fImesg\fP.
458
259
Use the given \fIattribute\fP for the background of the dialog.
459
260
.TP 5
460
 
.B searchList
461
 
Search the given \fIlist\fP of \fIlistSize\fP strings
462
 
for a subset of a word \fIpattern\fP in the given list.
463
 
Return the index in the list if it is found, or -1 if not found.
464
 
.TP 5
465
261
.B selectFile
466
262
Display a file-selection dialog.
467
263
Return the selected filename, or null if none is selected.
494
290
Otherwise, the return value will be \fIproposedDim\fP.
495
291
.RE
496
292
.TP 5
497
 
.B sortList
498
 
This is a wrapper for qsort,
499
 
used to sort the \fIlist\fP of strings.
500
 
The number of strings in \fIlist\fP is given by \fIlength\fP.
501
 
.TP 5
502
293
.B stripWhiteSpace
503
294
Strip whitespace from the front and/or back of the given \fIstring\fP.
504
295
The \fIstripType\fP parameter controls the type of stripping done:
508
299
Read the file specified by \fIfilename\fP and display it in a CDKVIEWER window.
509
300
The \fItitle\fP, \fIbuttons\fP and \fIbuttonCount\fP are applied to the
510
301
CDKVIEWER window.
 
302
The viewer shows
 
303
the contents of the file supplied by the \fBfilename\fR value.
 
304
The buttons on
 
305
the file viewer are supplied by the \fBbuttons\fR parameter.
 
306
It returns the index of the button selected,
 
307
or -1 if the file does not exist or if the widget was exited early.
 
308
.LP
 
309
.TS
 
310
center tab(/) allbox;
 
311
l l
 
312
l l
 
313
lw15 lw35 .
 
314
\fBStrip_Type/Result\fR
 
315
=
 
316
vFRONT/T{
 
317
This tells the function to remove
 
318
all of the white space from the
 
319
front of the given string.
 
320
T}
 
321
vBACK/T{
 
322
This tells the function to remove
 
323
all of the white space from the
 
324
back of the given string.
 
325
T}
 
326
vBOTH/T{
 
327
This tells the function to remove
 
328
all of the white space from both
 
329
the front and the back of the given string.
 
330
T}
 
331
.TE
511
332
.TP 5
512
333
.B viewInfo
513
334
Display the list of strings in \fIinfo\fP in a CDKVIEWER window.
518
339
.SH SEE ALSO
519
340
cdk_dialog (3),
520
341
cdk_display (3),
521
 
cdk_position (3).
 
342
cdk_position (3),
 
343
cdk_misc (3).