• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ enif_get_tuple函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中enif_get_tuple函数的典型用法代码示例。如果您正苦于以下问题:C++ enif_get_tuple函数的具体用法?C++ enif_get_tuple怎么用?C++ enif_get_tuple使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了enif_get_tuple函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: do_write

static ERL_NIF_TERM do_write(ErlNifEnv *env, int argc, const ERL_NIF_TERM argv[]) {
  static PortMidiStream ** stream;

  ErlNifResourceType* streamType = (ErlNifResourceType*)enif_priv_data(env);
  if(!enif_get_resource(env, argv[0], streamType, (PortMidiStream **) &stream)) {
    return enif_make_badarg(env);
  }

  ERL_NIF_TERM erlMessages = argv[1];
  const ERL_NIF_TERM * erlEvent;
  const ERL_NIF_TERM * erlMessage;
  ERL_NIF_TERM erlTuple;

  unsigned int numOfMessages;
  int tupleSize;
  enif_get_list_length(env, erlMessages, &numOfMessages);

  PmEvent events[numOfMessages];
  long int status, note, velocity, timestamp;

  for(unsigned int i = 0; i < numOfMessages; i++) {
    enif_get_list_cell(env, erlMessages, &erlTuple, &erlMessages);
    enif_get_tuple(env, erlTuple, &tupleSize, &erlEvent);

    enif_get_tuple(env, erlEvent[0], &tupleSize, &erlMessage);
    enif_get_long(env, erlMessage[0], &status);
    enif_get_long(env, erlMessage[1], &note);
    enif_get_long(env, erlMessage[2], &velocity);

    enif_get_long(env, erlEvent[1], &timestamp);

    PmEvent event;
    event.message = Pm_Message(status, note, velocity);
    event.timestamp = timestamp;

    events[i] = event;
  }

  PmError writeError;
  writeError = Pm_Write(*stream, events, numOfMessages);

  if (writeError == pmNoError) {
    return enif_make_atom(env, "ok");
  }

  const char * writeErrorMsg;
  writeErrorMsg = Pm_GetErrorText(writeError);

  return enif_make_tuple2(
    env,
    enif_make_atom(env, "error"),
    enif_make_string(env, writeErrorMsg, ERL_NIF_LATIN1)
  );
}
开发者ID:lucidstack,项目名称:ex-portmidi,代码行数:54,代码来源:portmidi_out.c


示例2: lookat

static ERL_NIF_TERM lookat(ErlNifEnv *env, int argc, const ERL_NIF_TERM argv[])
{
			int arity;
			const ERL_NIF_TERM *eye,*center,*up;
			ERL_NIF_TERM d[16];

			if(!enif_get_tuple(env,argv[0],&arity,&eye)) {
							return enif_make_badarg(env);
			}
			if(arity!=3) {
							return enif_make_badarg(env);
			}

			if(!enif_get_tuple(env,argv[1],&arity,&center)) {
							return enif_make_badarg(env);
			}
			if(arity!=3) {
							return enif_make_badarg(env);
			}

			if(!enif_get_tuple(env,argv[2],&arity,&up)) {
							return enif_make_badarg(env);
			}
			if(arity != 3) {
							return enif_make_badarg(env);
			}

			glm::dvec3 veye;
			if(!(enif_get_double(env,eye[0],&veye.x) && 
					 enif_get_double(env,eye[1],&veye.y) &&	
					 enif_get_double(env,eye[2],&veye.z))) {
							return enif_make_badarg(env);
			}

			glm::dvec3 vcenter;
			if(!(enif_get_double(env,center[0],&vcenter.x) && 
					 enif_get_double(env,center[1],&vcenter.y) &&	
					 enif_get_double(env,center[2],&vcenter.z))) {
							return enif_make_badarg(env);
			}

			glm::dvec3 vup;
			if(!(enif_get_double(env,up[0],&vup.x) && 
					 enif_get_double(env,up[1],&vup.y) &&	
					 enif_get_double(env,up[2],&vup.z))) {
							return enif_make_badarg(env);
			}

			glm::dmat4 m = glm::lookAt(veye,vcenter,vup);
			const double *pSource = (const double*)glm::value_ptr(m);
			for(int i =0; i<16;++i) 
							d[i] = enif_make_double(env,pSource[i]);
			return enif_make_tuple_from_array(env,d,16);
}
开发者ID:wot123,项目名称:erlglm,代码行数:54,代码来源:erlglm.cpp


示例3: x509_parse_subject

static int x509_parse_subject(ErlNifEnv* env, ERL_NIF_TERM subject_tuple, int *num_subject_entries, x509_subject_entry **subject_entries){
  int num_subject_tuple;
  unsigned num_subject_terms;
  ERL_NIF_TERM head, tail;
  int pair_arity;
  char *name;
  char *value;
  char *subject_string = NULL;
  const ERL_NIF_TERM* pair;
  int idx;
  x509_subject_entry* se;
  unsigned value_len;
  const ERL_NIF_TERM* subject_terms;

  *subject_entries = NULL;
  *num_subject_entries = 0;

  /* make sure this is a tuple with first term 'subject' */
  if(!enif_get_tuple(env, subject_tuple, &num_subject_tuple, &subject_terms) ||
     !atom_to_string(env, subject_terms[0], &subject_string) ||
     strncmp(subject_string, SUBJECT_STR, subject_strlen)) {
    if(subject_string) free(subject_string);
    return 0;
  }
  free(subject_string);

  /* create room for the x509_subject_entry structs */
  if(!enif_get_list_length(env, subject_terms[1], &num_subject_terms) || 
     (NULL == (se = (x509_subject_entry*)malloc(num_subject_terms * sizeof(x509_subject_entry))))) return 0;

  /* get the first entry and prime the pump for walking the rest */
  if(!enif_get_list_cell(env, subject_terms[1], &head, &tail) || 
     !enif_get_tuple(env, head, &pair_arity, &pair) ||
     pair_arity!=2) { return 0; }

  for(idx=0; idx<num_subject_terms; idx++){
    atom_to_string(env, pair[0], &name);

    enif_get_list_length(env, pair[1], &value_len);
    value = (char*)malloc(value_len+1);
    enif_get_string(env, pair[1], value, value_len+1, ERL_NIF_LATIN1);
    (se+idx)->name = name;
    (se+idx)->value = value;

    if(!enif_get_list_cell(env, tail, &head, &tail) || 
       !enif_get_tuple(env, head, &pair_arity, &pair) ||
       pair_arity!=2) { break; }
  }

  *num_subject_entries = num_subject_terms;
  *subject_entries = se;
  return 1;
}
开发者ID:chef,项目名称:chef_certgen,代码行数:53,代码来源:chef_certgen.c


示例4: macros

static ERL_NIF_TERM macros(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
{
    const ERL_NIF_TERM* a;
    ERL_NIF_TERM lists, tuples;
    int arity;
    if (!enif_get_tuple(env, argv[0], &arity, &a) || arity != 9) {
	return enif_make_badarg(env);
    }
    
    lists = enif_make_list(env,9,
			   enif_make_list1(env,a[0]),
			   enif_make_list2(env,a[0],a[1]),
			   enif_make_list3(env,a[0],a[1],a[2]),
			   enif_make_list4(env,a[0],a[1],a[2],a[3]),
			   enif_make_list5(env,a[0],a[1],a[2],a[3],a[4]),
			   enif_make_list6(env,a[0],a[1],a[2],a[3],a[4],a[5]),
			   enif_make_list7(env,a[0],a[1],a[2],a[3],a[4],a[5],a[6]),
			   enif_make_list8(env,a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7]),
			   enif_make_list9(env,a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8]));
    tuples = enif_make_list(env,9,
			    enif_make_tuple1(env,a[0]),
			    enif_make_tuple2(env,a[0],a[1]),
			    enif_make_tuple3(env,a[0],a[1],a[2]),
			    enif_make_tuple4(env,a[0],a[1],a[2],a[3]),
			    enif_make_tuple5(env,a[0],a[1],a[2],a[3],a[4]),
			    enif_make_tuple6(env,a[0],a[1],a[2],a[3],a[4],a[5]),
			    enif_make_tuple7(env,a[0],a[1],a[2],a[3],a[4],a[5],a[6]),
			    enif_make_tuple8(env,a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7]),
			    enif_make_tuple9(env,a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8]));
    return enif_make_tuple2(env,lists,tuples);
}
开发者ID:cristiangreco,项目名称:otp,代码行数:31,代码来源:nif_SUITE.c


示例5: match_tuple

static inline int
match_tuple(ErlNifEnv* env, ERL_NIF_TERM term, State *st){ 
  const ERL_NIF_TERM *tuple;
  int arity;
  if(!enif_get_tuple(env, term, &arity, &tuple))
    return 0;
  if(arity > 0){ 
    if(enif_is_atom(env, tuple[0])){
      if(arity == 2){
	if(enif_is_identical(tuple[0], st->priv->am_struct)){
	  //struct
	  return match_proplist(env, tuple[1], st);
	}else   if(enif_is_identical(tuple[0], st->priv->am_json)){
	  //json
	  return  match_json(env, tuple[1], st);
	}
      }
      //records
      if(st->records){
	return match_record(env, arity, tuple, st);
      }
    }
    if(arity == 1){
      //eep18
      return (match_proplist(env, tuple[0], st));
    }
  }
  return 0;  
}
开发者ID:dixel,项目名称:jsonx,代码行数:29,代码来源:encoder.c


示例6: get_transform

static btTransform get_transform(ErlNifEnv *env, const ERL_NIF_TERM arg) {
    double x,y,z,w;
    const ERL_NIF_TERM *tuple;
    int arity;
    enif_get_tuple(env, arg, &arity, &tuple);
    return btTransform(get_quaternion(env,tuple[0]),get_vector(env,tuple[1]));
}
开发者ID:BigDwarf,项目名称:ennui,代码行数:7,代码来源:bullet.cpp


示例7: do_load_info

static void do_load_info(ErlNifEnv* env, ERL_NIF_TERM load_info, int* retvalp)
{
    NifModPrivData* data = priv_data(env);
    ERL_NIF_TERM head, tail;
    unsigned ix;

    for (ix=0; ix<RT_MAX; ix++) {
	data->rt_arr[ix] = NULL;
    }
    for (head = load_info; enif_get_list_cell(env, head, &head, &tail);
	  head = tail) {
	const ERL_NIF_TERM* arr;
	int arity;

	CHECK(enif_get_tuple(env, head, &arity, &arr));
	switch (arity) {
	case 6:
	    open_resource_type(env, arr);
	    break;
	case 2:
	    CHECK(arr[0] == am_return);
	    CHECK(enif_get_int(env, arr[1], retvalp));
	    break;
	default:
	    CHECK(0);
	}
    }    
    CHECK(enif_is_empty_list(env, head));
}
开发者ID:0x00evil,项目名称:otp,代码行数:29,代码来源:nif_mod.c


示例8: mem_read

static ERL_NIF_TERM
mem_read(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
{
  unsigned int err, l, i, tmp;
  char element;
  int ar;
  char* ptr;
  ERL_NIF_TERM list, head, *tpl;


  err = enif_get_tuple(env, argv[0], &ar, (const ERL_NIF_TERM**)(&tpl));
  if (err) {
    err = nifty_get_ptr(env, tpl[0], (ptr_t*)&ptr);
  }
  if (!err) {
    goto error;
  }

  err = enif_get_uint(env, argv[1], &l);
  if (!err) {
    goto error;
  }

  list = enif_make_list(env, 0);

  for (i=0;i<l;i++) {
    element = (char)*(ptr+(l-1)-i);
    tmp = element & 0xff;
    head = enif_make_uint(env, tmp);
    list = enif_make_list_cell(env, head, list);
  }
  return list;
 error:
  return enif_make_badarg(env);
}
开发者ID:276361270,项目名称:nifty,代码行数:35,代码来源:nifty.c


示例9: make_attrs

static int make_attrs(ErlNifEnv* env, struct buf *rbuf, ERL_NIF_TERM attrs)
{
  ErlNifBinary name, data;
  ERL_NIF_TERM head, tail;
  const ERL_NIF_TERM *tuple;
  int arity, ret = 1;
  
  while (enif_get_list_cell(env, attrs, &head, &tail)) {
    if (enif_get_tuple(env, head, &arity, &tuple)) {
      if (arity == 2) {
	if (enif_inspect_iolist_as_binary(env, tuple[0], &name) &&
	    enif_inspect_iolist_as_binary(env, tuple[1], &data)) {
	  buf_add_char(env, rbuf, ' ');
	  buf_add_str(env, rbuf, (char *)name.data, name.size);
	  buf_add_str(env, rbuf, "='", 2);
	  crypt(env, rbuf, data.data, data.size);
	  buf_add_char(env, rbuf, '\'');
	  attrs = tail;
	} else {
	  ret = 0;
	  break;
	};
      } else {
	ret = 0;
	break;
      };
    } else {
      ret = 0;
      break;
    };
  };
  
  return ret;
}
开发者ID:James1133,项目名称:ejabberd,代码行数:34,代码来源:xml.c


示例10: parse_histogram_option

ERL_NIF_TERM parse_histogram_option(ErlNifEnv* env, ERL_NIF_TERM item, 
                                    histogram_handle& handle)
{
    int arity;
    const ERL_NIF_TERM* option;
    if (enif_get_tuple(env, item, &arity, &option))
    {
        if (option[0] == ATOM_SIZE)
        {
            unsigned long sample_size;
            if (enif_get_ulong(env, option[1], &sample_size))
            {
                handle.size = sample_size;
            }
        }
        if (option[0] == ATOM_WINDOW_WIDTH)
        {
            unsigned long window_width;
            if (enif_get_ulong(env, option[1], &window_width))
            {
                handle.width = window_width;
            }
        }
    }
    return ATOM_OK;
}
开发者ID:basho,项目名称:basho_metrics,代码行数:26,代码来源:basho_metrics_nifs.cpp


示例11: mem_write_binary

static ERL_NIF_TERM
mem_write_binary(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
{
  unsigned int err;
  int ar;
  unsigned char* ptr;
  ERL_NIF_TERM *tpl;
  ErlNifBinary bin;

  if (!enif_inspect_binary(env, argv[0], &bin)) {
    goto error;
  }

  err = enif_get_tuple(env, argv[1], &ar, (const ERL_NIF_TERM**)(&tpl));
  if (err) {
    err = nifty_get_ptr(env, tpl[0], (ptr_t*)&ptr);
  }
  if (!err) {
    goto error;
  }

  memcpy(ptr, bin.data, bin.size);

  return argv[1];

 error:
  return enif_make_badarg(env);
}
开发者ID:276361270,项目名称:nifty,代码行数:28,代码来源:nifty.c


示例12: h5screate_simple

// creates a new simple dataspace and opens it for access
ERL_NIF_TERM h5screate_simple(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
{
  hid_t dataspace_id;
  ERL_NIF_TERM ret;
  const ERL_NIF_TERM *terms;
  int rank; // number of dimensions of dataspace
  hsize_t* dimsf; // array specifiying the size of each dimension
  int arity;

  // parse arguments
  check(argc == 2, "Incorrent number of arguments");
  check(enif_get_int(env, argv[0], &rank ), "Can't get rank from argv");
  check(enif_get_tuple(env, argv[1], &arity, &terms), "Can't get terms from argv");
  // make sure that rank is matching arity
  check(rank <= 2, "does not support > 2 dimensions");

  // allocate array of size rank
  dimsf = (hsize_t*) malloc(arity * sizeof(hsize_t));
  check(!convert_nif_to_hsize_array(env, arity, terms, dimsf), "can't convert dims arr");

  // create a new file using default properties
  dataspace_id = H5Screate_simple(rank, dimsf, NULL);
  check(dataspace_id > 0, "Failed to create dataspace.");

  // cleanup
  free(dimsf);
  ret = enif_make_int(env, dataspace_id);
  return enif_make_tuple2(env, ATOM_OK, ret);

 error:
  if(dataspace_id) H5Sclose(dataspace_id);
  if(dimsf) free(dimsf);
  return error_tuple(env, "Can not create dataspace");
};
开发者ID:Olivier-Boudeville,项目名称:erlhdf5,代码行数:35,代码来源:erlh5s.c


示例13: decode_command_call_into_process

int decode_command_call_into_process(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[], process_t **ptr)
{
    // Instantiate a new process
    if (pm_new_process(ptr))
        return -1;

    process_t *process = *ptr;
    const ERL_NIF_TERM* big_tuple;
    int arity = 2;
    // Get the outer tuple
    if(!enif_get_tuple(env, argv[0], &arity, &big_tuple)) return -1;

    // The first command is a string
    char command[MAX_BUFFER_SZ], key[MAX_BUFFER_SZ], value[MAX_BUFFER_SZ];
    memset(&command, '\0', sizeof(command));

    // Get the command
    if (enif_get_string(env, big_tuple[0], command, sizeof(command), ERL_NIF_LATIN1) < 0) return -1;
    pm_malloc_and_set_attribute(&process->command, command);

    // The second element of the tuple is a list of options
    const ERL_NIF_TERM* tuple;
    ERL_NIF_TERM head, tail, list = big_tuple[1];

    // int enif_get_tuple(ErlNifEnv* env, ERL_NIF_TERM term, int* arity, const ERL_NIF_TERM** array)
    while(enif_get_list_cell(env, list, &head, &tail)) {
        // Get the tuple
        if(!enif_get_tuple(env, head, &arity, &tuple)) return -1;
        // First element is an atom
        if (!enif_get_atom(env, tuple[0], key, sizeof(key))) return -2;
        if (enif_get_string(env, tuple[1], value, sizeof(value), ERL_NIF_LATIN1) < 0) return -3;
        if (!strcmp(key, "do_before")) {
            // Do before
            pm_malloc_and_set_attribute(&process->before, value);
        } else if (!strcmp(key, "do_after")) {
            pm_malloc_and_set_attribute(&process->after, value);
        } else if (!strcmp(key, "cd")) {
            pm_malloc_and_set_attribute(&process->cd, value);
        } else if (!strcmp(key, "env")) {
            pm_add_env(&process, value);
        } else if (!strcmp(key, "nice")) {
            process->nice = atoi(value);
        }
        list = tail;
    }
    return 0;
}
开发者ID:bharad,项目名称:babysitter,代码行数:47,代码来源:nif_decode.c


示例14: rotate

static ERL_NIF_TERM rotate(ErlNifEnv *env, int argc, const ERL_NIF_TERM argv[])
{
				double angle;
				int arity;
				const ERL_NIF_TERM *t,*v;
				double dm[16]; 
				ERL_NIF_TERM d[16];

				if(!enif_get_tuple(env,argv[0],&arity,&t)) {
								return enif_make_badarg(env);
				}
				if(arity!=16) {
								return enif_make_badarg(env);
				}

				for(int i=0; i<16; ++i) {
								enif_get_double(env,t[i],&dm[i]);
				}

				glm::dmat4 matrix = glm::make_mat4(dm);

				if(!enif_get_double(env,argv[1],&angle)) {
								return enif_make_badarg(env);
				}

				if(!enif_get_tuple(env,argv[2],&arity,&v)) {
								return enif_make_badarg(env);
				}
				if(arity != 3) {
								return enif_make_badarg(env);
				}

				glm::dvec3 axis;

			  if(!(enif_get_double(env,v[0],&axis.x) && enif_get_double(env,v[1],&axis.y) &&	enif_get_double(env,v[2],&axis.z))) {
								return enif_make_badarg(env);
				}

				glm::dmat4 rotation = glm::rotate(matrix,angle,axis);
				
				const double *pSource = (const double*)glm::value_ptr(rotation);
				for(int i =0; i<16; ++i) {
							d[i] = enif_make_double(env,pSource[i]);
				}
				return enif_make_tuple_from_array(env,d,16);
}
开发者ID:wot123,项目名称:erlglm,代码行数:46,代码来源:erlglm.cpp


示例15: trace_garbage_collection

static ERL_NIF_TERM trace_garbage_collection(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
{
    lttng_decl_procbuf(pid);
    ERL_NIF_TERM gci, tup;
    const ERL_NIF_TERM *vals;
    int arity;
    unsigned long ohbsz, nhbsz, size;

    ASSERT(argc == 6);

    /* Assume gc info order does not change */
    gci = argv[3];

    /* get reclaimed or need */
    enif_get_list_cell(env, gci, &tup, &gci);
    enif_get_tuple(env, tup, &arity, &vals);
    ASSERT(arity == 2);
    enif_get_ulong(env, vals[1], &size);

    /* get old heap block size */
    enif_get_list_cell(env, gci, &tup, &gci);
    enif_get_tuple(env, tup, &arity, &vals);
    ASSERT(arity == 2);
    ASSERT(vals[0] == atom_old_heap_block_size);
    enif_get_ulong(env, vals[1], &ohbsz);

    /* get new heap block size */
    enif_get_list_cell(env, gci, &tup, &gci);
    enif_get_tuple(env, tup, &arity, &vals);
    ASSERT(arity == 2);
    ASSERT(vals[0] == atom_heap_block_size);
    enif_get_ulong(env, vals[1], &nhbsz);

    lttng_pid_to_str(argv[2], pid);

    if (argv[0] == atom_gc_minor_start) {
        LTTNG4(gc_minor_start, pid, size, nhbsz, ohbsz);
    } else if (argv[0] == atom_gc_minor_end) {
        LTTNG4(gc_minor_end, pid, size, nhbsz, ohbsz);
    } else if (argv[0] == atom_gc_major_start) {
        LTTNG4(gc_major_start, pid, size, nhbsz, ohbsz);
    } else if (argv[0] == atom_gc_major_end) {
        LTTNG4(gc_major_end, pid, size, nhbsz, ohbsz);
    }
    return atom_ok;
}
开发者ID:RoadRunnr,项目名称:otp,代码行数:46,代码来源:dyntrace.c


示例16: do_offset

inline static ERL_NIF_TERM do_offset(ErlNifEnv* env, 
    UCalendar* cal,
    date_fun_ptr fun,
    const ERL_NIF_TERM in) 
{
    UCalendarDateFields field;
    UErrorCode status = U_ZERO_ERROR;

    ERL_NIF_TERM head, tail;
    ERL_NIF_TERM* tuple;
    unsigned int count, i;
    int32_t len, offset; 

    char    value[ATOM_LEN];
    int     parsed_value;
    
    
    i = 0;
    if (!enif_get_list_length(env, in, &count)) 
        return enif_make_badarg(env);

    tail = in;

    while (enif_get_list_cell(env, tail, &head, &tail)) {

        if (enif_get_tuple(env, head, &len, (const ERL_NIF_TERM**) &tuple)
            && (len == 2)) { 

            /* Set an attribute start */

            if (!(enif_get_atom(env, tuple[0], (char*) value, 
                        ATOM_LEN, ERL_NIF_LATIN1) 
               && enif_get_int(env, tuple[1], &offset))) 
                goto bad_elem;
                
            parsed_value = parseCalendarDateField(value);
            if ((parsed_value == -1)) 
                goto bad_elem;

            field = (UCalendarDateFields) parsed_value;
 
            fun(cal, field, offset, &status);

            if (U_FAILURE(status))
                goto bad_elem;
            
            /* Set an attribute end */

        } else 
            goto bad_elem;
    }


    return calendar_to_double(env, (const UCalendar*) cal);

    bad_elem:
        return list_element_error(env, in, i);
}
开发者ID:djui,项目名称:i18n,代码行数:58,代码来源:i18n_date.cpp


示例17: get_vector

static btVector3 get_vector(ErlNifEnv *env, const ERL_NIF_TERM arg) {
    double x,y,z;
    const ERL_NIF_TERM *tuple;
    int arity;
    enif_get_tuple(env, arg, &arity, &tuple);
    enif_get_double(env, tuple[0], &x);
    enif_get_double(env, tuple[1], &y);
    enif_get_double(env, tuple[2], &z);
    return btVector3(x,y,z);
}
开发者ID:BigDwarf,项目名称:ennui,代码行数:10,代码来源:bullet.cpp


示例18: do_set

    void do_set(robin_q_handle *handle, ERL_NIF_TERM value) {
        const ERL_NIF_TERM *elements_tuple;
        int elements_size;
        ERL_NIF_TERM elements_term = enif_make_copy(handle->env, value);
        enif_get_tuple(handle->env, elements_term, &elements_size, &elements_tuple);

        handle->size        = elements_size;
        handle->elements    = elements_tuple;
        handle->index       = 0;
    }
开发者ID:AnakinSong,项目名称:robin_q,代码行数:10,代码来源:robin_q.cpp


示例19: get_quaternion

static btQuaternion get_quaternion(ErlNifEnv *env, const ERL_NIF_TERM arg) {
    double x,y,z,w;
    const ERL_NIF_TERM *tuple;
    int arity;
    enif_get_tuple(env, arg, &arity, &tuple);
    enif_get_double(env, tuple[0], &x);
    enif_get_double(env, tuple[1], &y);
    enif_get_double(env, tuple[2], &z);
    enif_get_double(env, tuple[3], &w);
    return btQuaternion(x,y,z,w);
}
开发者ID:BigDwarf,项目名称:ennui,代码行数:11,代码来源:bullet.cpp


示例20: tuple_2_list_and_tuple

static ERL_NIF_TERM tuple_2_list_and_tuple(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
{
    const ERL_NIF_TERM* arr;
    int arity;
    if (!enif_get_tuple(env,argv[0],&arity,&arr)) {
	return enif_make_badarg(env);
    }
    return enif_make_tuple2(env, 
			    enif_make_list_from_array(env, arr, arity),
			    enif_make_tuple_from_array(env, arr, arity));
}
开发者ID:cristiangreco,项目名称:otp,代码行数:11,代码来源:nif_SUITE.c



注:本文中的enif_get_tuple函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ enif_make_badarg函数代码示例发布时间:2022-05-30
下一篇:
C++ enif_get_resource函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap