dmake: do not set MAKEFLAGS=k
[unleashed/tickless.git] / usr / src / common / ficl / callback.c
blobfffcf729a8f638338bf6f13b51490fec12ed16b5
1 #include "ficl.h"
3 extern ficlSystem *ficlSystemGlobal;
5 /*
6 * f i c l C a l l b a c k T e x t O u t
7 * Feeds text to the vm's output callback
8 */
9 void
10 ficlCallbackTextOut(ficlCallback *callback, char *text)
12 ficlOutputFunction textOut = NULL;
14 if (callback != NULL) {
15 if (callback->textOut != NULL)
16 textOut = callback->textOut;
17 else if ((callback->system != NULL) &&
18 (callback != &(callback->system->callback))) {
19 ficlCallbackTextOut(&(callback->system->callback),
20 text);
21 return;
25 if ((textOut == NULL) && (ficlSystemGlobal != NULL)) {
26 callback = &(ficlSystemGlobal->callback);
27 textOut = callback->textOut;
30 if (textOut == NULL)
31 textOut = ficlCallbackDefaultTextOut;
33 (textOut)(callback, text);
37 * f i c l C a l l b a c k E r r o r O u t
38 * Feeds text to the vm's error output callback
40 void
41 ficlCallbackErrorOut(ficlCallback *callback, char *text)
43 ficlOutputFunction errorOut = NULL;
45 if (callback != NULL) {
46 if (callback->errorOut != NULL)
47 errorOut = callback->errorOut;
48 else if ((callback->system != NULL) &&
49 (callback != &(callback->system->callback))) {
50 ficlCallbackErrorOut(&(callback->system->callback),
51 text);
52 return;
56 if ((errorOut == NULL) && (ficlSystemGlobal != NULL)) {
57 callback = &(ficlSystemGlobal->callback);
58 errorOut = callback->errorOut;
61 if (errorOut == NULL) {
62 ficlCallbackTextOut(callback, text);
63 return;
66 (errorOut)(callback, text);