Ejemplo n.º 1
0
Archivo: graph.c Proyecto: ged/redleaf
/*
 * call-seq:
 *   Redleaf::Graph.new()          -> graph
 *   Redleaf::Graph.new( store )   -> graph
 *
 * Create a new Redleaf::Graph object. If the optional +store+ object is
 * given, it is used as the backing store for the graph. If none is specified
 * a new Redleaf::MemoryHashStore is used.
 *
 */
static VALUE
rleaf_redleaf_graph_initialize( int argc, VALUE *argv, VALUE self ) {
	if ( !check_graph(self) ) {
		rleaf_GRAPH *graph;
		VALUE store = Qnil;

		/* Default the store if one isn't given */
		if ( rb_scan_args(argc, argv, "01", &store) == 0 ) {
			rleaf_log_with_context( self, "debug", "Creating a new default store for graph 0x%x", self );
			store = rb_class_new_instance( 0, NULL, DEFAULT_STORE_CLASS );
		}

		if ( !IsStore(store) )
			rb_raise( rb_eTypeError, "wrong argument type %s (expected a Redleaf::Store)",
				rb_obj_classname(store) );

		DATA_PTR( self ) = graph = rleaf_graph_alloc( store );

	} else {
		rb_raise( rleaf_eRedleafError,
				  "Cannot re-initialize a graph once it's been created." );
	}

	return self;
}
Ejemplo n.º 2
0
 // メモリ
 bool IsMem(int code)
 {
     return IsLoad(code) || IsStore(code);
 }
Ejemplo n.º 3
0
	bool command::IsUserStore(){
		return (IsStore(ArrayOfCommand[1]) && IsMark(ArrayOfCommand[2])&& JumlahString == 1);
	}