#include "src/rplexternals.h" #include "motif.h" declareExternalFunction(XtRemoveCallback) declareObject(widget); declareObject(callback); declareObject(callbackFromList); declareDaisyChain(current); declareDaisyChain(previous); declareDaisyChain(next); HEADER declareHelpString("Remove callback from a widget\n" " 2: widget\n" " 1: callback\n"); numberOfArguments(2); FUNCTION if (initializationDone eq true) then pullFromStack(callback, external); returnOnError(freeObject(callback)); pullFromStack(widget, external); returnOnError(freeObject(callback); freeObject(widget)); ifIsExternal(widget, WIDGET) then orElse executionError("Type mismatch error"); returnOnError(freeObject(callback); freeObject(widget)); endIf ifIsExternal(callback, CALLBACK) then orElse executionError("Type mismatch error"); returnOnError(freeObject(callback); freeObject(widget)); endIf current = lCallbacks; nullify(previous); repeatWhile(not nullified(current)) callbackFromList = fetchElementFromDaisyChain(current); if ((((sXtCallback *) objectContainer(callbackFromList))->widget eq target((Widget *) objectContainer(widget))) and (callback eq callbackFromList)) then break; endIf previous = current; nextElementOfDaisyChain(current); endWhile if (nullified(current)) then executionError("Callback not found"); returnOnError(freeObject(callback); freeObject(widget)); endIf if (callbackFromList eq fetchElementFromDaisyChain(lCallbacks)) then next = current; nextElementOfDaisyChain(next); lCallbacks = next; freeObject(callbackFromList); free(current); orElse previous->next = current->next; freeObject(callbackFromList); free(current); endIf orElse executionError("Application not initialized"); returnOnError(); endIf END endExternalFunction // vim: ts=4