Hello, 
I've tried to use message handling but got a segmentation fault when
running the processor. 
Thanks for your help.

Here is what I've done:

[...my overloaded handle...]

MH_ERROR MtxMessageHandlerError (void *ptrUserData, SablotHandle Handle,
                                 MH_ERROR code, MH_LEVEL level, char
**pptrFields)
{
    printf (">>>> Handler called\n");
}

[...and the call to Sablotron...]

    SablotHandle ptrProc;
    SablotCreateProcessor (&ptrProc);
    void *ptrData;

    MessageHandler *ptrNewHandler;
    MessageHandler *ptrMsgHandler =
((Processor*)ptrProc)->getMessageHandler (&ptrData);

    ptrNewHandler = (MessageHandler*) malloc (sizeof (MessageHandler));

    // Keep current makeCode and log if they are present

    if (ptrMsgHandler) {
        ptrNewHandler->makeCode = (*ptrMsgHandler).makeCode;
        ptrNewHandler->log = (*ptrMsgHandler).log;
    }

    // set error handler to our internal handler
    
    ptrNewHandler->error = &MtxMessageHandlerError;
    
    // The following call returns 0

    SablotRegHandler ((void *)ptrProc, HLR_MESSAGE, ptrNewHandler,
this);

    // following call creates a segmentation fault if there is a
processing mistake

    Res = SablotRunProcessor (ptrProc, 
                        (char *) "arg:/_stylesheet",
                        (char *) "arg:/_xmlinput",
                        (char *) "arg:/_output",
                        pptrParamsStr, pptrArgums);


Pavel Hlavnicka wrote:
> 
> All you need is set the messages handler. (SablotRegHandler & Co.)
> 
> Contact me if you meet technical problems.
> 
> Pavel
> 
> Raphael Chauvel wrote:
> 
> > I need some error handling functions from the C/C++ interface. I found
> > the following:
> >
> > const char *SablotGetErrorURI(SablotSituation S);
> > int SablotGetErrorLine(SablotSituation S);
> > const char *SablotGetErrorMsg(SablotSituation S);
> >
> > but they are not implemented.
> > Is there a way I can get the error message?
> >
> >
> 
> --
> Pavel Hlavnicka
> Ginger Alliance
> www.gingerall.com

-- 

Raphael Chauvel
Project Leader
Metrix Systems

15, Traverse des Brucs 
F - 06560 Sophia Antipolis 
Tel:      +33 4 92 38 13 44
Fax:      +33 4 92 38 13 01 
mailto:[EMAIL PROTECTED]

Reply via email to