File: api_env.html

package info (click to toggle)
unadf 0.7.11a-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,660 kB
  • sloc: ansic: 5,455; cpp: 404; makefile: 127; sh: 78
file content (187 lines) | stat: -rw-r--r-- 4,243 bytes parent folder | download | duplicates (7)
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
<HTML>
<HEAD><TITLE> Environment </TITLE></HEAD>

<BODY>

<H1 ALIGN=CENTER>the Environment API</H1>


<HR>
<H1>Typical usage</H1>


<PRE>
#include"adflib.h"


void MyVer(char *msg)
{
    fprintf(stderr,"Verbose [%s]\n",msg);
}


int main()
{
    BOOL boolPr = TRUE;

    adfEnvInitDefault();

    /* to use the dir cache blocks, default is FALSE */
    adfChgEnvProp(PR_USEDIRC, (void*)&boolPr);      // optional
	
    /* to override the verbose callback */
    adfChgEnvProp(PR_VFCT, MyVer);                  // optional

    adfEnvCleanUp();
}
</PRE>



<HR>

<P ALIGN=CENTER><FONT SIZE=+2> adfEnvInitDefault() </FONT></P>

<H2>Syntax</H2>

<B>void</B> adfEnvInitDefault()

<H2>Description</H2>

Initialise the library data structures and default values.
Must be done before any other call to the library.
<P>
There is 4 callback functions which can be (and must be) overridden,
the library must not write anything to the console.
<UL>
<LI>The verbose messages redirection,
<LI>the warning messages redirection,
<LI>the error messages redirection (must stop the library)
<LI>The notification callback : when the current directory has changed.
<LI>The progress bar : this function is called with an int first set to 0.
 Then the value increases up to 100. It can be used to display a progress bar.
</UL>
By default, those functions write a message to stderr.
<P>
Another environment property is the ability to use or not the dir cache
blocks to get the content of a directory. By default, it is not used.
<P>
See <B>adfChgEnvProp()</B> to learn how to change those properties.


<H2>Internals</H2>

<OL>
<LI>Set the default values
<LI>Prints the library version with the verbose callback.
<LI>Allocate the native functions structure
<LI>Calls adfInitNativeFct()
</OL>

<HR>
<P ALIGN=CENTER><FONT SIZE=+2> adfChgEnvProp() </FONT></P>

<H2>Syntax</H2>

<B>void</B> adfChgEnvProp(<B>int</B> propertyName, <B>void*</B> new value)


<H2>Description</H2>

Change the default or lastest value of one of the environment property.
The new value has the <B>void*</B>, this is the only way to transmit it
for several types. A cast is made depending of the property name inside 
adfChgEnvProp().
<P>
Here's the list of the properties, and their types :
<UL>
<LI>PR_VFCT, displays verbose messages, (void(*)(char*))
<LI>PR_WFCT, displays warning messages, (void(*)(char*))
<LI>PR_EFCT, displays error messages, (void(*)(char*))
</UL>
<UL>
<LI>PR_NOTFCT, directory object change notification, (void(*)(SECTNUM,int))
<LI>PR_USE_NOTFCT, toggle on/off (default=off=false), BOOL
</UL>
<UL>
<LI>PR_PROGBAR, progress bar, (void(*)(int))
<LI>PR_USE_PROGBAR, use progress bar (default=off), BOOL<BR>
The functions that support 'progress bar' are : adfCreateFlop(),
adfCreateHd(), adfCreateHdFile().
</UL>
<UL>
<LI>PR_RWACCESS, read (BOOL=false) or write (BOOL=true) operation, logical block and physical sector accessed, (void(*)(SECTNUM,SECTNUM,BOOL))
<LI>PR_USE_RWACCESS, use rwaccess (default=off), BOOL
</UL>

<UL>
<LI>PR_USEDIRC, use dircache blocks, BOOL (default=off).
</UL>

For the non pointer types (int with PR_USEDIRC), you have to use a temporary variable.

To override successfully a function, the easiest is to reuse the default function
located in adf_env.c, and to change it for your needs.

<P>

<HR>
<P ALIGN=CENTER><FONT SIZE=+2> adfEnvCleanUp() </FONT></P>

<H2>Syntax</H2>

<B>void</B> adfEnvCleanUp()


<H2>Description</H2>

Cleans up the environment.

<H2>Internals</H2>

Frees the native functions structure.

<HR>

<P ALIGN=CENTER><FONT SIZE=+2> adfEnvCleanUp()  : Obsolete </FONT></P>

<H2>Syntax</H2>
<B>void</B> adfSetEnvFct( <B>void(*eFct)(char*)</B> error, <B>void(*wFct)(char*)</B> warning, <B>void(*vFct)(char*)</B> verbose, <B>void(*notFct)(SECTNUM,int)</B> notify )

<P>
Obsolete : use adfChgEnvProp() instead.
<P>

<HR>

<P ALIGN=CENTER><FONT SIZE=+2> adfGetVersionNumber() </FONT></P>

<H2>Syntax</H2>

<B>char*</B> adfGetVersionNumber()

<H2>Description</H2>

Returns the current numeric ADFlib version.

<P>


<HR>

<P ALIGN=CENTER><FONT SIZE=+2> adfGetVersionDate() </FONT></P>

<H2>Syntax</H2>

<B>char*</B> adfGetVersionDate()

<H2>Description</H2>

Returns the date of the ADFlib current version.

<P>


</BODY>

</HTML>