Ejemplo n.º 1
0
////////////////////////////////////////////////////////////////////////////////
// dofun()
//
// This function calls the function in gGunctionTable that is indexed by
// the ADS function code.
//
static int
dofun()
{
    struct resbuf *rb;
    AvErrorCode retval;
    unsigned short func;

    // Reload Render.arx if it has been unloaded
    //
    if (! acrxServiceDictionary->at(RENDER_SERVICES))
    {
        retval = av_loadlib();
        if (retval != AvRetNorm) {
            acdbFail("Library initialization failed.\n");
            return RTERROR;
        }
    }

    func = (unsigned short)ads_getfuncode();
    if (func >= ELEMENTS(gFunctionTable))
    {
        acdbFail("Received nonexistent function code.");
        return RTERROR;
    }

    rb =  acedGetArgs();

    // AVLib: here, we call av_initialize, which issues
    // the "renderupdate" command
    //
    av_initialize();

    retval = (*gFunctionTable[func].fptr)(rb);

    acutRelRb(rb);

    if (retval == AvRetNorm)
        return RTNORM;
    else
        return RTERROR;
}
Ejemplo n.º 2
0
int ads_perror()
{
    struct resbuf *argl, errval;

    argl = ads_getargs();
    if (ads_getfuncode() != 0)      /* This is the ONLY function here */
        return RSRSLT;
    if (ads_getvar("ERRNO", &errval) == RTERROR)
        return RSRSLT;
    if ((errval.resval.rint < 1) || (errval.resval.rint > ELEMENTS(errmsg)
#ifdef MAX_OL_ERRNO
		|| errval.resval.rint > MAX_OL_ERRNO
#endif
		))
        return RSRSLT;
    if (argl && argl->restype == RTSTR && strlen(argl->resval.rstring))
        ads_printf("%s: ", argl->resval.rstring);
    ads_printf("%s\n", errmsg[errval.resval.rint - 1]);
    ads_relrb(argl);
    ads_retvoid();
    return RSRSLT;
}