Exemple #1
0
void mrb_fltk_widget_class_init( mrb_state *mrb ) {
  ARENA_SAVE;

  struct RClass *mrb_fltk_module = mrb_module_get( mrb, "FLTK" );

  DEFINE_CLASS( widget, Widget, mrb->object_class );

  DEFINE_INSTANCE_METHOD( widget, activate, MRB_ARGS_NONE() );
  DEFINE_INSTANCE_METHOD_ACCESSOR( widget, align );
  DEFINE_INSTANCE_METHOD_ACCESSOR( widget, box );
  DEFINE_INSTANCE_METHOD( widget, callback, MRB_ARGS_OPT( 1 ) );
  DEFINE_INSTANCE_METHOD( widget, deactivate, MRB_ARGS_NONE() );
  DEFINE_INSTANCE_METHOD_ACCESSOR( widget, height );
  DEFINE_INSTANCE_METHOD( widget, hide, MRB_ARGS_NONE() );
  DEFINE_INSTANCE_METHOD_ACCESSOR( widget, label );
  DEFINE_INSTANCE_METHOD_ACCESSOR( widget, label_font );
  DEFINE_INSTANCE_METHOD_ACCESSOR( widget, label_size );
  DEFINE_INSTANCE_METHOD( widget, parent, MRB_ARGS_NONE() );
  DEFINE_INSTANCE_METHOD( widget, redraw, MRB_ARGS_NONE() );
  DEFINE_INSTANCE_METHOD( widget, show, MRB_ARGS_NONE() );
  DEFINE_INSTANCE_METHOD( widget, take_focus, MRB_ARGS_NONE() );
  DEFINE_INSTANCE_METHOD_ACCESSOR( widget, tooltip );
  DEFINE_INSTANCE_METHOD_ACCESSOR( widget, type );
  mrb_define_method( mrb, mrb_fltk_widget, "visible?", mrb_fltk_widget_visible_instance_method, MRB_ARGS_NONE() ); // TODO: DEFINE_INSTANCE_QUERY_METHOD macro
  DEFINE_INSTANCE_METHOD_ACCESSOR( widget, when );
  DEFINE_INSTANCE_METHOD_ACCESSOR( widget, width );
  DEFINE_INSTANCE_METHOD_ACCESSOR( widget, x );
  DEFINE_INSTANCE_METHOD_ACCESSOR( widget, y );

  // mrb_define_method( mrb, mrb_fltk_widget_class, "image", mrb_fltk_widget_image_getter_instance_method, MRB_ARGS_NONE() );
  // mrb_define_method( mrb, mrb_fltk_widget_class, "image=", mrb_fltk_widget_image_setter_instance_method, MRB_ARGS_REQ( 1 ) );

  ARENA_RESTORE;
}
Exemple #2
0
void
mrb_fltk_group_class_init( mrb_state *mrb ) {
  ARENA_SAVE;

  DEFINE_CLASS( group, "Group", mrb_fltk_widget_class );
  DEFINE_GROUP_INSTANCE_METHODS( group );

  ARENA_RESTORE;
}
Exemple #3
0
void mrb_fltk_input_class_init( mrb_state *mrb ) {
  ARENA_SAVE;

  struct RClass *mrb_fltk_module = mrb_module_get( mrb, "FLTK" );
  struct RClass *mrb_fltk_widget_class = mrb_class_get_under( mrb, mrb_fltk_module, "Widget" );

  DEFINE_CLASS( input, Input, mrb_fltk_widget_class );

  DEFINE_INSTANCE_METHOD( input, initialize, ARGS_ANY() );
  DEFINE_INSTANCE_METHOD_ACCESSOR( input, value );

  ARENA_RESTORE;
}
void mrb_fltk_native_file_chooser_class_init( mrb_state *mrb ) {
  ARENA_SAVE;

  struct RClass *mrb_fltk_module = mrb_module_get( mrb, "FLTK" );

  DEFINE_CLASS( native_file_chooser, NativeFileChooser, mrb->object_class );

  // enum Fl_Native_File_Chooser::Option
  DEFINE_FIXNUM_CONSTANT( NO_OPTIONS, Fl_Native_File_Chooser::NO_OPTIONS, mrb_fltk_native_file_chooser );         // no options enabled
  DEFINE_FIXNUM_CONSTANT( SAVEAS_CONFIRM, Fl_Native_File_Chooser::SAVEAS_CONFIRM, mrb_fltk_native_file_chooser ); // Show native 'Save As' overwrite confirm dialog (if supported)
  DEFINE_FIXNUM_CONSTANT( NEW_FOLDER, Fl_Native_File_Chooser::NEW_FOLDER, mrb_fltk_native_file_chooser );         // Show 'New Folder' icon (if supported)
  DEFINE_FIXNUM_CONSTANT( PREVIEW, Fl_Native_File_Chooser::PREVIEW, mrb_fltk_native_file_chooser );               // enable preview mode

  // enum Fl_Native_File_Chooser::Type
  DEFINE_FIXNUM_CONSTANT( BROWSE_FILE, Fl_Native_File_Chooser::BROWSE_FILE, mrb_fltk_native_file_chooser );                       // browse files (lets user choose one file)
  DEFINE_FIXNUM_CONSTANT( BROWSE_DIRECTORY, Fl_Native_File_Chooser::BROWSE_DIRECTORY, mrb_fltk_native_file_chooser );             // browse directories (lets user choose one directory)
  DEFINE_FIXNUM_CONSTANT( BROWSE_MULTI_FILE, Fl_Native_File_Chooser::BROWSE_MULTI_FILE, mrb_fltk_native_file_chooser );           // browse files (lets user choose multiple files)
  DEFINE_FIXNUM_CONSTANT( BROWSE_MULTI_DIRECTORY, Fl_Native_File_Chooser::BROWSE_MULTI_DIRECTORY, mrb_fltk_native_file_chooser ); // browse directories (lets user choose multiple directories)
  DEFINE_FIXNUM_CONSTANT( BROWSE_SAVE_FILE, Fl_Native_File_Chooser::BROWSE_SAVE_FILE, mrb_fltk_native_file_chooser );             // browse to save a file
  DEFINE_FIXNUM_CONSTANT( BROWSE_SAVE_DIRECTORY, Fl_Native_File_Chooser::BROWSE_SAVE_DIRECTORY, mrb_fltk_native_file_chooser );   // browse to save a directory

  DEFINE_INSTANCE_METHOD( native_file_chooser, initialize, MRB_ARGS_OPT( 1 ) );
  DEFINE_INSTANCE_METHOD_GETTER( native_file_chooser, count );
  DEFINE_INSTANCE_METHOD_ACCESSOR( native_file_chooser, directory );
  DEFINE_INSTANCE_METHOD_GETTER( native_file_chooser, error_message );
  DEFINE_INSTANCE_METHOD( native_file_chooser, filename, MRB_ARGS_OPT( 1 ) );
  DEFINE_INSTANCE_METHOD_ACCESSOR( native_file_chooser, filter );
  DEFINE_INSTANCE_METHOD_ACCESSOR( native_file_chooser, filter_value );
  DEFINE_INSTANCE_METHOD_GETTER( native_file_chooser, filters );
  DEFINE_INSTANCE_METHOD_ACCESSOR( native_file_chooser, options );
  DEFINE_INSTANCE_METHOD_ACCESSOR( native_file_chooser, preset_file );
  DEFINE_INSTANCE_METHOD_GETTER( native_file_chooser, show );
  DEFINE_INSTANCE_METHOD_ACCESSOR( native_file_chooser, title );
  DEFINE_INSTANCE_METHOD_ACCESSOR( native_file_chooser, type );

  ARENA_RESTORE;
}
Exemple #5
0
        return (code < 0 ? code : 0);
    } else
        return e_Range;
}

/*
 * Initialization
 */
  static int
pcpage_do_registration(
    pcl_parser_state_t *pcl_parser_state,
    gs_memory_t *   pmem    /* ignored */
)
{
    /* Register commands */
    DEFINE_CLASS('&')
    {
        'l', 'A',
        PCL_COMMAND( "Page Size",
                     set_page_size,
                     pca_neg_ok | pca_big_ignore
                     )
    },
    {
        'l', 'H',
        PCL_COMMAND( "Paper Source",
                     set_paper_source,
                     pca_neg_ok | pca_big_ignore
                     )
    },
    {
Exemple #6
0
        if (code >= 0)
            pcl_home_cursor(pcs);
        return (code < 0 ? code : 0);
    } else
        return e_Range;
}

/*
 * Initialization
 */
static int
pcpage_do_registration(pcl_parser_state_t * pcl_parser_state, gs_memory_t * pmem        /* ignored */
    )
{
    /* Register commands */
    DEFINE_CLASS('&') {
        'l', 'A',
            PCL_COMMAND("Page Size",
                        set_page_size, pca_neg_ok | pca_big_ignore)
    }, {
        'l', 'H',
            PCL_COMMAND("Paper Source",
                        set_paper_source, pca_neg_ok | pca_big_ignore)
    }, {
        'l', 'U',
            PCL_COMMAND("Left Offset Registration",
                        set_left_offset_registration,
                        pca_neg_ok | pca_big_ignore)
    }, {
        'l', 'Z',
            PCL_COMMAND("Top Offset Registration",
Exemple #7
0
dllfunctions *DLLInitialize(hostfunctions *thost) {
#endif
	int problem = 0;

	// Checks if the passed function was received:
	#define checksanity(func, funcname) \
		if (!host->func) { \
			fprintf(stderr, "bmgame:  %s was not received from the host!\n", funcname); \
			problem = -1;\
		}

	// Grab the host functions structure:
	host = thost;
	if (host == NULL) {
		fprintf(stderr, "hwgame:  Did not receive host functions thru GetGameAPI!\n");
		return NULL;
	};

	// Sanity check!
	problem = 0;
	// Are we connected to the engine (devmode == 0) or the editor (devmode == 1)?
	if (host->devmode == 1) {
		// Connected to the map editor:
		// All we need are drawing functions:
		checksanity(put_sprite, "put_sprite()");
		checksanity(put_sprite_hflip, "put_sprite_hflip()");
		checksanity(put_sprite_vflip, "put_sprite_vflip()");
		checksanity(put_sprite_hvflip, "put_sprite_hvflip()");
	} else {
		// Connected to the game engine:
		checksanity(put_sprite, "put_sprite()");
		checksanity(put_sprite_hflip, "put_sprite_hflip()");
		checksanity(put_sprite_vflip, "put_sprite_vflip()");
		checksanity(put_sprite_hvflip, "put_sprite_hvflip()");
		checksanity(put_bgtile, "put_bgtile()");

		checksanity(Draw2x2BGTile, "Draw2x2BGTile()");

		checksanity(e_spawn, "e_spawn()");
		checksanity(e_spawnat, "e_spawnat()");
		checksanity(e_spawnatmap, "e_spawnatmap()");
		checksanity(e_findfirst, "e_findfirst()");
		checksanity(e_findnext, "e_findnext()");
		checksanity(e_kill, "e_kill()");
		checksanity(e_damage, "e_damage()");
		checksanity(control_switch, "control_switch()");
		checksanity(gettileat, "gettileat()");
		checksanity(settileat, "settileat()");

		checksanity(wrap_map_coord_x, "wrap_map_coord_x()");
		checksanity(wrap_map_coord_y, "wrap_map_coord_y()");

		checksanity(LoadLevel, "LoadLevel()");

		checksanity(sndPrecache, "sndPrecache()");
		checksanity(sndFree, "sndFree()");
		checksanity(sndPlay, "sndPlay()");
		checksanity(sndSetVolume, "sndSetVolume()");
		checksanity(sndIsPlaying, "sndIsPlaying()");
		checksanity(sndStop, "sndStop()");

		// Pointers to the original variables:
		checksanity(map, "map structure");

		// Entities:
		checksanity(player, "player variable");
		checksanity(world, "world variable");

		// Game state variables:
		checksanity(screen_mx, "screen_mx variable");
		checksanity(screen_my, "screen_my variable");
		checksanity(old_screen_mx, "old_screen_mx variable");
		checksanity(old_screen_my, "old_screen_my variable");
		checksanity(screen_w, "screen_w variable");
		checksanity(screen_h, "screen_h variable");
		checksanity(scroll_left, "scroll_left variable");
		checksanity(scroll_right, "scroll_right variable");
		checksanity(scroll_top, "scroll_top variable");
		checksanity(scroll_bottom, "scroll_bottom variable");
		checksanity(quit, "quit variable");
		checksanity(game_paused, "game_paused variable");

		player = host->player;
	}

	// Return NULL if any of the above sanity checks failed:
	if (problem == -1) return NULL;

	// First, load the common DLL for common entities, so that we don't re-code them:
	common = GetGameAPI ("game/common", host, &common_library);
	if (common == NULL) {
		fprintf(stderr, "Error loading common dll!\n");
		return NULL;
	}

	game = (dllfunctions *)calloc(sizeof(dllfunctions), 1);
	// Send our functions and variables back:
	game->class_properties = calloc(sizeof(class_properties_t) * NUM_CLASSES, 1);
	if (game->class_properties == NULL) {
		fprintf(stderr, "Could not allocate memory for class_properties!\n");
		return NULL;
	}
	game->spawnflags = malloc(sizeof(Uint32) * NUM_CLASSES);
	if (game->spawnflags == NULL) {
		fprintf(stderr, "Could not allocate memory for spawnflags!\n");
		return NULL;
	}
	memset(game->class_properties, 0, sizeof(class_properties_t) * NUM_CLASSES);
	memset(game->spawnflags, 0, sizeof(Uint32) * NUM_CLASSES);

	#define DEFINE_CLASS(class, props, flags) \
		game->class_properties[class] = &props; \
		game->spawnflags[class] = flags;

	// Copy all common entities over to our list that we will return:
	memcpy(game->class_properties, common->class_properties, sizeof(class_properties_t) * common->numclasses);
	memcpy(game->spawnflags, common->spawnflags, sizeof(Uint32) * common->numclasses);

///---Do not change this line!! It is used by scripts to add new entities!!---
	DEFINE_CLASS(CLASS_KEYHOLEL, ClassProperties_KeyholeL, SPAWNFLAG_MAPSPAWNABLE)
	DEFINE_CLASS(CLASS_KEYHOLER, ClassProperties_KeyholeR, SPAWNFLAG_MAPSPAWNABLE)

	game->numclasses = NUM_CLASSES;
	game->init = init;
	game->pre_render = common->pre_render;
	game->post_render = common->post_render;

	return game;
};
Exemple #8
0
int JPy_InitGlobalVars(JNIEnv* jenv)
{
    if (JPy_Comparable_JClass != NULL) {
        return 0;
    }

    DEFINE_CLASS(JPy_Comparable_JClass, "java/lang/Comparable");
    DEFINE_METHOD(JPy_Comparable_CompareTo_MID, JPy_Comparable_JClass, "compareTo", "(Ljava/lang/Object;)I");

    DEFINE_CLASS(JPy_Object_JClass, "java/lang/Object");
    DEFINE_METHOD(JPy_Object_ToString_MID, JPy_Object_JClass, "toString", "()Ljava/lang/String;");
    DEFINE_METHOD(JPy_Object_HashCode_MID, JPy_Object_JClass, "hashCode", "()I");
    DEFINE_METHOD(JPy_Object_Equals_MID, JPy_Object_JClass, "equals", "(Ljava/lang/Object;)Z");

    DEFINE_CLASS(JPy_Class_JClass, "java/lang/Class");
    DEFINE_METHOD(JPy_Class_GetName_MID, JPy_Class_JClass, "getName", "()Ljava/lang/String;");
    DEFINE_METHOD(JPy_Class_GetDeclaredConstructors_MID, JPy_Class_JClass, "getDeclaredConstructors", "()[Ljava/lang/reflect/Constructor;");
    DEFINE_METHOD(JPy_Class_GetDeclaredMethods_MID, JPy_Class_JClass, "getDeclaredMethods", "()[Ljava/lang/reflect/Method;");
    DEFINE_METHOD(JPy_Class_GetDeclaredFields_MID, JPy_Class_JClass, "getDeclaredFields", "()[Ljava/lang/reflect/Field;");
    DEFINE_METHOD(JPy_Class_GetMethods_MID, JPy_Class_JClass, "getMethods", "()[Ljava/lang/reflect/Method;");
    DEFINE_METHOD(JPy_Class_GetFields_MID, JPy_Class_JClass, "getFields", "()[Ljava/lang/reflect/Field;");
    DEFINE_METHOD(JPy_Class_GetComponentType_MID, JPy_Class_JClass, "getComponentType", "()Ljava/lang/Class;");
    DEFINE_METHOD(JPy_Class_IsPrimitive_MID, JPy_Class_JClass, "isPrimitive", "()Z");
    DEFINE_METHOD(JPy_Class_IsInterface_MID, JPy_Class_JClass, "isInterface", "()Z");

    DEFINE_CLASS(JPy_Constructor_JClass, "java/lang/reflect/Constructor");
    DEFINE_METHOD(JPy_Constructor_GetModifiers_MID, JPy_Constructor_JClass, "getModifiers", "()I");
    DEFINE_METHOD(JPy_Constructor_GetParameterTypes_MID, JPy_Constructor_JClass, "getParameterTypes", "()[Ljava/lang/Class;");

    DEFINE_CLASS(JPy_Field_JClass, "java/lang/reflect/Field");
    DEFINE_METHOD(JPy_Field_GetName_MID, JPy_Field_JClass, "getName", "()Ljava/lang/String;");
    DEFINE_METHOD(JPy_Field_GetModifiers_MID, JPy_Field_JClass, "getModifiers", "()I");
    DEFINE_METHOD(JPy_Field_GetType_MID, JPy_Field_JClass, "getType", "()Ljava/lang/Class;");

    DEFINE_CLASS(JPy_Method_JClass, "java/lang/reflect/Method");
    DEFINE_METHOD(JPy_Method_GetName_MID, JPy_Method_JClass, "getName", "()Ljava/lang/String;");
    DEFINE_METHOD(JPy_Method_GetModifiers_MID, JPy_Method_JClass, "getModifiers", "()I");
    DEFINE_METHOD(JPy_Method_GetParameterTypes_MID, JPy_Method_JClass, "getParameterTypes", "()[Ljava/lang/Class;");
    DEFINE_METHOD(JPy_Method_GetReturnType_MID, JPy_Method_JClass, "getReturnType", "()Ljava/lang/Class;");

    DEFINE_CLASS(JPy_RuntimeException_JClass, "java/lang/RuntimeException");

    DEFINE_CLASS(JPy_Boolean_JClass, "java/lang/Boolean");
    DEFINE_METHOD(JPy_Boolean_Init_MID, JPy_Boolean_JClass, "<init>", "(Z)V");
    DEFINE_METHOD(JPy_Boolean_BooleanValue_MID, JPy_Boolean_JClass, "booleanValue", "()Z");

    DEFINE_CLASS(JPy_Character_JClass, "java/lang/Character");
    DEFINE_METHOD(JPy_Character_Init_MID, JPy_Character_JClass, "<init>", "(C)V");
    DEFINE_METHOD(JPy_Character_CharValue_MID, JPy_Character_JClass, "charValue", "()C");

    DEFINE_CLASS(JPy_Byte_JClass, "java/lang/Byte");
    DEFINE_METHOD(JPy_Byte_Init_MID, JPy_Byte_JClass, "<init>", "(B)V");

    DEFINE_CLASS(JPy_Short_JClass, "java/lang/Short");
    DEFINE_METHOD(JPy_Short_Init_MID, JPy_Short_JClass, "<init>", "(S)V");

    DEFINE_CLASS(JPy_Integer_JClass, "java/lang/Integer");
    DEFINE_METHOD(JPy_Integer_Init_MID, JPy_Integer_JClass, "<init>", "(I)V");

    DEFINE_CLASS(JPy_Long_JClass, "java/lang/Long");
    DEFINE_METHOD(JPy_Long_Init_MID, JPy_Long_JClass, "<init>", "(J)V");

    DEFINE_CLASS(JPy_Float_JClass, "java/lang/Float");
    DEFINE_METHOD(JPy_Float_Init_MID, JPy_Float_JClass, "<init>", "(F)V");

    DEFINE_CLASS(JPy_Double_JClass, "java/lang/Double");
    DEFINE_METHOD(JPy_Double_Init_MID, JPy_Double_JClass, "<init>", "(D)V");

    DEFINE_CLASS(JPy_Number_JClass, "java/lang/Number");
    DEFINE_METHOD(JPy_Number_IntValue_MID, JPy_Number_JClass, "intValue", "()I");
    DEFINE_METHOD(JPy_Number_LongValue_MID , JPy_Number_JClass, "longValue", "()J");
    DEFINE_METHOD(JPy_Number_DoubleValue_MID, JPy_Number_JClass, "doubleValue", "()D");

    DEFINE_CLASS(JPy_Void_JClass, "java/lang/Void");

    DEFINE_CLASS(JPy_String_JClass, "java/lang/String");

    // Non-Object types: Primitive types and void.
    DEFINE_NON_OBJECT_TYPE(JPy_JBoolean, JPy_Boolean_JClass);
    DEFINE_NON_OBJECT_TYPE(JPy_JChar, JPy_Character_JClass);
    DEFINE_NON_OBJECT_TYPE(JPy_JByte, JPy_Byte_JClass);
    DEFINE_NON_OBJECT_TYPE(JPy_JShort, JPy_Short_JClass);
    DEFINE_NON_OBJECT_TYPE(JPy_JInt, JPy_Integer_JClass);
    DEFINE_NON_OBJECT_TYPE(JPy_JLong, JPy_Long_JClass);
    DEFINE_NON_OBJECT_TYPE(JPy_JFloat, JPy_Float_JClass);
    DEFINE_NON_OBJECT_TYPE(JPy_JDouble, JPy_Double_JClass);
    DEFINE_NON_OBJECT_TYPE(JPy_JVoid, JPy_Void_JClass);
    // The Java root object. Make sure, JPy_JObject is the first object type to be initialized.
    DEFINE_OBJECT_TYPE(JPy_JObject, JPy_Object_JClass);
    // Immediately after JPy_JObject, we define JPy_JClass. From now on JType_AddClassAttribute() works.
    DEFINE_OBJECT_TYPE(JPy_JClass, JPy_Class_JClass);
    // Primitive-Wrapper Objects.
    DEFINE_OBJECT_TYPE(JPy_JBooleanObj, JPy_Boolean_JClass);
    DEFINE_OBJECT_TYPE(JPy_JCharacterObj, JPy_Character_JClass);
    DEFINE_OBJECT_TYPE(JPy_JByteObj, JPy_Byte_JClass);
    DEFINE_OBJECT_TYPE(JPy_JShortObj, JPy_Short_JClass);
    DEFINE_OBJECT_TYPE(JPy_JIntegerObj, JPy_Integer_JClass);
    DEFINE_OBJECT_TYPE(JPy_JLongObj, JPy_Long_JClass);
    DEFINE_OBJECT_TYPE(JPy_JFloatObj, JPy_Float_JClass);
    DEFINE_OBJECT_TYPE(JPy_JDoubleObj, JPy_Double_JClass);
    // Other objects.
    DEFINE_OBJECT_TYPE(JPy_JString, JPy_String_JClass);

    // JType_AddClassAttribute is actually called from within JType_GetType(), but not for
    // JPy_JObject and JPy_JClass for an obvious reason. So we do it now:
    JType_AddClassAttribute(jenv, JPy_JObject);
    JType_AddClassAttribute(jenv, JPy_JClass);

    if (initGlobalPyObjectVars(jenv) < 0) {
        JPy_DIAG_PRINT(JPy_DIAG_F_ALL, "JPy_InitGlobalVars: JPy_JPyObject=%p, JPy_JPyModule=%p\n", JPy_JPyObject, JPy_JPyModule);
    }

    return 0;
}
        return 0;
    if (i > 1)
        return 0;
    pcs->pp_mode = i;
    return 0;
}

/*
 * Initialization
 */
static int
pccprint_do_registration(pcl_parser_state_t * pcl_parser_state,
                         gs_memory_t * pmem)
{
    /* Register commands */
    DEFINE_CLASS('*') {
        'l', 'O',
            PCL_COMMAND("Logical Operation",
                        pcl_logical_operation,
                        pca_neg_ok | pca_big_error | pca_in_rtl |
                        pca_raster_graphics)
    }, {
        'l', 'R',
            PCL_COMMAND("Pixel Placement",
                        pcl_pixel_placement,
                        pca_neg_ok | pca_big_ignore | pca_in_rtl |
                        pca_raster_graphics)
    }, END_CLASS return 0;
}

static void
Exemple #10
0
ZEND_END_ARG_INFO()

// methods
static zend_function_entry tf_buffer_methods[] = {
    PHP_ME(TensorFlow_Buffer, __construct, arginfo_tf_buffer___construct, ZEND_ACC_PUBLIC)
    PHP_ME(TensorFlow_Buffer, __destruct,  NULL,                          ZEND_ACC_PUBLIC)
    PHP_ME(TensorFlow_Buffer, __toString,  NULL,                          ZEND_ACC_PUBLIC)
    PHP_FE_END
};

CA_OBJECT_CREATE(buffer, t_tf_buffer, t_tf_buffer_object, oh_TF_Buffer)
CA_OBJECT_FREE(buffer, t_tf_buffer, t_tf_buffer_object)

void define_tf_buffer_class()
{
    DEFINE_CLASS(Buffer, buffer, ce_TF_Buffer, oh_TF_Buffer)
}

// extern TF_Buffer* TF_NewBufferFromString(const void* proto, size_t proto_len);
// extern TF_Buffer* TF_NewBuffer();
static PHP_METHOD(TensorFlow_Buffer, __construct)
{
    // arguments
    zend_string* buffer;

    ZEND_PARSE_PARAMETERS_START(0, 1)
        Z_PARAM_OPTIONAL
        Z_PARAM_STR(buffer)
    ZEND_PARSE_PARAMETERS_END();

    // this
Exemple #11
0
	return e_Range;

    /* Currently we can't take any advantage of this.... */
    return 0;
}

/* ---------------- Initialization ---------------- */
  static int
rtmisc_do_registration(
    pcl_parser_state_t *pcl_parser_state,
    gs_memory_t *   mem
)
{
    /* Register commands */
    /* Chapter 4 */
    DEFINE_CLASS('%')
    /* Chapter 18 */
    {
        0, 'B',
        PCL_COMMAND( "Enter HP-GL/2 Mode",
                     rtl_enter_hpgl_mode,
		     pca_neg_ok | pca_big_ok | pca_in_rtl
                     )
    },
    {
        0, 'A',
	PCL_COMMAND( "Enter PCL Mode",
                     rtl_enter_pcl_mode,
		     pca_neg_ok | pca_big_ok | pca_in_rtl
                     )
    },
                    arginfo_tf_operation_description_setAttrBool, ZEND_ACC_PUBLIC)
    PHP_ME(TensorFlow_OperationDescription, setAttrBoolList,
                    arginfo_tf_operation_description_setAttrBoolList, ZEND_ACC_PUBLIC)
    PHP_ME(TensorFlow_OperationDescription, setAttrType,
                    arginfo_tf_operation_description_setAttrType, ZEND_ACC_PUBLIC)
    PHP_ME(TensorFlow_OperationDescription, setAttrTypeList,
                    arginfo_tf_operation_description_setAttrTypeList, ZEND_ACC_PUBLIC)
    PHP_FE_END
};

CA_OBJECT_CREATE(operation_description, t_tf_operation_description, t_tf_operation_description_object, oh_TF_OperationDescription)
CA_OBJECT_FREE(operation_description, t_tf_operation_description, t_tf_operation_description_object)

void define_tf_operation_description_class()
{
    DEFINE_CLASS(OperationDescription, operation_description, ce_TF_OperationDescription, oh_TF_OperationDescription)
}

// extern TF_OperationDescription* TF_NewOperation(TF_Graph* graph,
//         const char* op_type, const char* oper_name);
static PHP_METHOD(TensorFlow_OperationDescription, __construct)
{
    zval *graph;
    zend_string *operatorType;
    zend_string *operatorName;

    ZEND_PARSE_PARAMETERS_START(3, 3)
        Z_PARAM_OBJECT_OF_CLASS_EX(graph, ce_TF_Graph, 0, 1) // last 1 is call by ref.
        Z_PARAM_STR(operatorType)
        Z_PARAM_STR(operatorName)
    ZEND_PARSE_PARAMETERS_END();