Пример #1
0
// Check if our Base API handles a property.
// In this case we handle "penAPI" and "version".
// Version shouldn't even be required here according to the Wacom docs,
// but it seems that the demos do expect it.
bool BaseHasProperty(NPObject *obj, NPIdentifier name)
{
  if (IS_IDENTIFIER("penAPI") ||
      IS_IDENTIFIER("version"))
    return true;

  return false;
}
Пример #2
0
// Provide the appropriate value to JS.
bool BaseGetProperty(NPObject *obj, NPIdentifier name, NPVariant *result)
{
  if (IS_IDENTIFIER("penAPI")) {
    // The main part of the API is defined in the PenAPIObject.
    // Retain and return this object.
    NPObject *penObj = g_api.penAPI;
    g_netscapeFuncs->retainobject(penObj);
    OBJECT_TO_NPVARIANT(penObj, *result);
    return true;
  }

  if (IS_IDENTIFIER("version")) {
    // Return the PLUGIN_VERSION.
    STRINGN_TO_NPVARIANT(strdup(PLUGIN_VERSION), sizeof(PLUGIN_VERSION), *result);
    return true;
  }

  return false;
}
Пример #3
0
/**
 * Sets or replaces the object into the variable
 */
static void si_set_object(t_snode *node, t_object *dst_obj) {
    t_object *src_obj = NULL;

    if (! IS_IDENTIFIER(node)) {
        saffire_error("Trying to set an object to a non-variable");
    }

    // Decrease source object reference count (if any object is present)
    if (HAS_IDENTIFIER_OBJ(node)) {
        src_obj = si_get_object(node);
        if (src_obj != dst_obj) {
            // Only decrease when they are not equal (ie: when changing objects)
            object_dec_ref(src_obj);
        }
    }

    // Add or replace the object
    si_create_var_in_context(node->data.id.id, NULL, dst_obj, CTX_CREATE_OR_UPDATE);

    if (src_obj != dst_obj) {
        // Only increase when they are not equal (ie: when changed)
        object_inc_ref(dst_obj);
    }
}
Пример #4
0
int identifierp(int x){
	if(IS_IDENTIFIER(x))
    	return(1);
    else
    	return(0);
}