1: #include "src/rplexternals.h"
2: #include "motif.h"
3:
4: declareExternalFunction(XtRemoveCallback)
5: declareObject(widget);
6: declareObject(callback);
7: declareObject(callbackFromList);
8: declareDaisyChain(current);
9: declareDaisyChain(previous);
10: declareDaisyChain(next);
11:
12: HEADER
13: declareHelpString("Remove callback from a widget\n"
14: " 2: widget\n"
15: " 1: callback\n");
16: numberOfArguments(2);
17: FUNCTION
18: if (initializationDone eq true) then
19: pullFromStack(callback, external);
20: returnOnError(freeObject(callback));
21:
22: pullFromStack(widget, external);
23: returnOnError(freeObject(callback); freeObject(widget));
24:
25: ifIsExternal(widget, WIDGET) then
26: orElse
27: executionError("Type mismatch error");
28: returnOnError(freeObject(callback); freeObject(widget));
29: endIf
30:
31: ifIsExternal(callback, CALLBACK) then
32: orElse
33: executionError("Type mismatch error");
34: returnOnError(freeObject(callback); freeObject(widget));
35: endIf
36:
37: current = lCallbacks;
38: nullify(previous);
39:
40: repeatWhile(not nullified(current))
41: callbackFromList = fetchElementFromDaisyChain(current);
42:
43: if ((((sXtCallback *) objectContainer(callbackFromList))->widget
44: eq target((Widget *) objectContainer(widget))) and
45: (callback eq callbackFromList)) then
46: break;
47: endIf
48:
49: previous = current;
50: nextElementOfDaisyChain(current);
51: endWhile
52:
53: if (nullified(current)) then
54: executionError("Callback not found");
55: returnOnError(freeObject(callback); freeObject(widget));
56: endIf
57:
58: if (callbackFromList eq fetchElementFromDaisyChain(lCallbacks)) then
59: next = current;
60: nextElementOfDaisyChain(next);
61: lCallbacks = next;
62:
63: freeObject(callbackFromList);
64: free(current);
65: orElse
66: previous->next = current->next;
67:
68: freeObject(callbackFromList);
69: free(current);
70: endIf
71: orElse
72: executionError("Application not initialized");
73: returnOnError();
74: endIf
75: END
76: endExternalFunction
77:
78: // vim: ts=4
CVSweb interface <joel.bertrand@systella.fr>