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

C++ enif_make_tuple3函数代码示例

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

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



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

示例1: utc_to_datetime

static ERL_NIF_TERM
utc_to_datetime(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]) {
  if(argc != 1) {
    return enif_make_badarg(env);
  }
  unsigned int utc;
  if(!enif_get_uint(env, argv[0], &utc)) {
    return enif_make_badarg(env);
  }

  time_t now = utc;
  struct tm result;
  gmtime_r(&now, &result);
  return enif_make_tuple2(env,
    enif_make_tuple3(env,
      enif_make_int(env, result.tm_year + 1900),
      enif_make_int(env, result.tm_mon + 1),
      enif_make_int(env, result.tm_mday)
    ),
    enif_make_tuple3(env,
      enif_make_int(env, result.tm_hour),
      enif_make_int(env, result.tm_min),
      enif_make_int(env, result.tm_sec)
    )
  );
}
开发者ID:maxlapshin,项目名称:io_libc,代码行数:26,代码来源:io_libc.c


示例2: nif_scheduler_declineOffer

static ERL_NIF_TERM
nif_scheduler_declineOffer(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]){

    ErlNifBinary offerId_binary;
    ErlNifBinary filters_binary;

    state_ptr state = (state_ptr) enif_priv_data(env);
    
    if(state->initilised == 0 ) 
    {
        return enif_make_tuple2(env, 
            enif_make_atom(env, "state_error"), 
            enif_make_atom(env, "scheduler_not_inited"));
    }
    if (!enif_inspect_binary(env, argv[0], &offerId_binary)) 
    {
        return enif_make_tuple3(env, 
                    enif_make_atom(env, "argument_error"), 
                    enif_make_atom(env, "invalid_or_corrupted_parameter"),
                    enif_make_atom(env, "offer_id"));
    }
    if (!enif_inspect_binary(env, argv[1], &filters_binary)) 
    {
        return enif_make_tuple3(env, 
                    enif_make_atom(env, "argument_error"), 
                    enif_make_atom(env, "invalid_or_corrupted_parameter"),
                    enif_make_atom(env, "filters"));
    }

    SchedulerDriverStatus status = scheduler_declineOffer( state->scheduler_state, &offerId_binary, &filters_binary );

    return get_return_value_from_status(env, status);
}
开发者ID:nqn,项目名称:erlang-mesos,代码行数:33,代码来源:scheduler.c


示例3: send_blob_thread

static ERL_NIF_TERM send_blob_thread(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
{
    union { void* vp; struct make_term_info* p; }mti;
    ERL_NIF_TERM copy;
    if (!enif_get_resource(env, argv[0], msgenv_resource_type, &mti.vp)
	|| !enif_get_local_pid(env,argv[1], &mti.p->to_pid)) {
	return enif_make_badarg(env);
    }
    copy = enif_make_copy(env, mti.p->blob);

    mti.p->send_it = enif_is_identical(argv[2],atom_join);
    if (enif_thread_create("nif_SUITE:send_from_thread", &mti.p->tid,
			   threaded_sender, mti.p, NULL) != 0) {
	return enif_make_badarg(env);
    }
    if (enif_is_identical(argv[2],atom_join)) {
	int err = enif_thread_join(mti.p->tid, NULL);
	assert(err == 0);
	return enif_make_tuple3(env, atom_ok, enif_make_int(env, mti.p->send_res), copy);
    }
    else {
	enif_keep_resource(mti.vp);
	return enif_make_tuple2(env, atom_ok, copy);
    }
}
开发者ID:cristiangreco,项目名称:otp,代码行数:25,代码来源:nif_SUITE.c


示例4: nif_sendmsg

    static ERL_NIF_TERM
nif_sendmsg(ErlNifEnv *env, int argc, const ERL_NIF_TERM argv[])
{
    int s = -1;
    ErlNifBinary msg = {0};
    int flags = 0;

    ssize_t n = 0;

    if (!enif_get_int(env, argv[0], &s))
        return enif_make_badarg(env);

    if (!enif_inspect_binary(env, argv[1], &msg))
        return enif_make_badarg(env);

    if (!enif_get_int(env, argv[2], &flags))
        return enif_make_badarg(env);

    if (msg.size != sizeof(struct msghdr))
        return enif_make_badarg(env);

    /* Make the binary mutable */
    if (!enif_realloc_binary(&msg, msg.size))
        return error_tuple(env, ENOMEM);

    n = sendmsg(s, (const struct msghdr *)msg.data, flags);

    if (n < 0)
        return error_tuple(env, errno);

    return enif_make_tuple3(env,
            atom_ok,
            enif_make_ulong(env, n),
            enif_make_binary(env, &msg));
}
开发者ID:ExaServe,项目名称:procket,代码行数:35,代码来源:procket.c


示例5: update_callback

void
update_callback(void *arg, int sqlite_operation_type, char const *sqlite_database, char const *sqlite_table, sqlite3_int64 sqlite_rowid)
{
    esqlite_connection *db = (esqlite_connection *)arg;
    esqlite_command *cmd = NULL;
    ERL_NIF_TERM type, table, rowid;
    cmd = command_create();

    if(db == NULL)
        return;

    if(!cmd)
	    return;

    rowid = enif_make_int64(cmd->env, sqlite_rowid);
    table = enif_make_string(cmd->env, sqlite_table, ERL_NIF_LATIN1);

    switch(sqlite_operation_type) {
        case SQLITE_INSERT:
            type = make_atom(cmd->env, "insert");
            break;
        case SQLITE_DELETE:
            type = make_atom(cmd->env, "delete");
            break;
        case SQLITE_UPDATE:
            type = make_atom(cmd->env, "update");
            break;
        default:
            return;
    }
    cmd->type = cmd_notification;
    cmd->arg = enif_make_tuple3(cmd->env, type, table, rowid);
    push_command(cmd->env, db, cmd);
}
开发者ID:mmzeeman,项目名称:esqlite,代码行数:34,代码来源:esqlite3_nif.c


示例6: zdoor_cb

static struct zdoor_result *
zdoor_cb(struct zdoor_cookie *cookie, char *argp, size_t argp_sz)
{
	struct door *d;
	struct req *r;
	ErlNifEnv *env = enif_alloc_env();

	/* we kept the struct door in the biscuit */
	d = (struct door *)cookie->zdc_biscuit;

	/* this request */
	r = req_alloc();

	/* take the rlist lock first, then the req lock */
	enif_rwlock_rwlock(d->rlock);
	enif_mutex_lock(r->lock);

	req_insert(d, r);

	enif_rwlock_rwunlock(d->rlock);

	/* make the request into a binary term to put it into enif_send() */
	ErlNifBinary bin;
	enif_alloc_binary(argp_sz, &bin);
	memcpy(bin.data, argp, argp_sz);
	ERL_NIF_TERM binTerm = enif_make_binary(env, &bin);

	/* send a message back to the session owner */
	enif_send(NULL, &d->owner, env,
		enif_make_tuple3(env,
			enif_make_atom(env, "zdoor"),
			enif_make_resource(env, r),
			binTerm));

	/* now wait until the request has been replied to */
	enif_cond_wait(r->cond, r->lock);

	/* convert the reply into a zdoor_result */
	/* we have to use naked malloc() since libzdoor will use free() */
	struct zdoor_result *res = malloc(sizeof(struct zdoor_result));
	res->zdr_size = r->replen;
	res->zdr_data = r->rep;

	r->rep = NULL;
	r->replen = 0;

	/* yes, we have to unlock and re-lock to avoid lock inversion here */
	enif_mutex_unlock(r->lock);

	/* remove and free the struct req */
	enif_rwlock_rwlock(d->rlock);
	enif_mutex_lock(r->lock);
	req_remove(d, r);
	enif_rwlock_rwunlock(d->rlock);
	req_free(r);

	enif_free_env(env);

	return res;
}
开发者ID:arekinath,项目名称:erlzdoor,代码行数:60,代码来源:jobs.c


示例7: pwrite_nif_impl

static ERL_NIF_TERM pwrite_nif_impl(efile_data_t *d, ErlNifEnv *env, int argc, const ERL_NIF_TERM argv[]) {
    ErlNifIOVec vec, *input = &vec;
    Sint64 bytes_written, offset;
    ERL_NIF_TERM tail;

    if(argc != 2 || !enif_is_number(env, argv[0])
                 || !enif_inspect_iovec(env, 64, argv[1], &tail, &input)) {
        return enif_make_badarg(env);
    }

    if(!enif_get_int64(env, argv[0], &offset) || offset < 0) {
        return posix_error_to_tuple(env, EINVAL);
    }

    bytes_written = efile_pwritev(d, offset, input->iov, input->iovcnt);

    if(bytes_written < 0) {
        return posix_error_to_tuple(env, d->posix_errno);
    }

    if(!enif_is_empty_list(env, tail)) {
        ASSERT(bytes_written > 0);
        return enif_make_tuple3(env, am_continue,
            enif_make_int64(env, bytes_written), tail);
    }

    return am_ok;
}
开发者ID:cypherfox,项目名称:otp,代码行数:28,代码来源:prim_file_nif.c


示例8: ewpcap_error

void
ewpcap_error(EWPCAP_STATE *ep, char *msg)
{
    int rv = 0;

    if (ep->p == NULL)
        return;

    /* {ewpcap_error, Ref, Error} */
    rv = enif_send(
             NULL,
             &ep->pid,
             ep->env,
             enif_make_tuple3(ep->env,
                              atom_ewpcap_error,
                              enif_make_copy(ep->env, ep->ref),
                              enif_make_string(ep->env, msg, ERL_NIF_LATIN1)
                             )
         );

    if (!rv)
        pcap_breakloop(ep->p);

    enif_clear_env(ep->env);
}
开发者ID:hfeeki,项目名称:ewpcap,代码行数:25,代码来源:ewpcap.c


示例9: _reading_thread

static void*
_reading_thread (void* arg)
{
  CAN_handle* handle  = arg;
  ErlNifEnv*  env     = enif_alloc_env();
  //ERL_NIF_TERM device =   enif_make_int(env, handle->device);
  handle->threaded = 1;
  while (handle->threaded)
    {
      int status;
      ERL_NIF_TERM msg = _receive_can_messages(env, handle, handle->chunk_size, handle->timeout);
      if (!enif_get_int(env, msg, &status))
        {
          enif_send(env, &handle->receiver, env, enif_make_tuple3(env, can_atom, handle->devpath_bin, msg));
          enif_clear_env(env);
        }
      else if (status == 0)
        {
          enif_clear_env(env);
        }
      else break;
    }
  enif_free_env(env);
  return 0;
}
开发者ID:qoocku,项目名称:erleos,代码行数:25,代码来源:CAN_nif.c


示例10: 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


示例11: update

//key, incr, ttl, timestamp
static ERL_NIF_TERM update(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]) {

    int ttl=0, timestamp=0, incr=0, next=0;
    CHECK(enif_get_string(env, argv[0], keybuff, KEY_MAX_LEN, ERL_NIF_LATIN1));
    CHECK(enif_get_int(env, argv[1], &incr));
    CHECK(enif_get_int(env, argv[2], &ttl));
    CHECK(enif_get_int(env, argv[3], &timestamp));

    metronome_item * item = find_in_hash(keybuff, timestamp);
    item->ttl = ttl;

    if(item->timestamp + ttl > timestamp) {
        item->value += incr;
        next = item->timestamp + ttl - timestamp;
    } else {
        item->value = incr;
        item->timestamp = timestamp;
        next = ttl;
    }

    //
    return enif_make_tuple3(env,
                            enif_make_atom(env, "ok"),
                            enif_make_int(env, item->value),
                            enif_make_int(env, next)
                           );
}
开发者ID:flaboy,项目名称:metronome,代码行数:28,代码来源:metronome.c


示例12: nif_scheduler_reconcileTasks

static ERL_NIF_TERM
nif_scheduler_reconcileTasks(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
{
    unsigned int length ;

    state_ptr state = (state_ptr) enif_priv_data(env);
    
    if(state->initilised == 0 ) 
    {
        return enif_make_tuple2(env, 
            enif_make_atom(env, "state_error"), 
            enif_make_atom(env, "scheduler_not_inited"));
    }

    if(!enif_is_list(env, argv[0])) 
    {
        return enif_make_tuple3(env, 
                    enif_make_atom(env, "argument_error"), 
                    enif_make_atom(env, "invalid_or_corrupted_parameter"),
                    enif_make_atom(env, "task_status_array"));
    };

    if(!enif_get_list_length(env, argv[0], &length))
    {
        return enif_make_tuple3(env, 
                    enif_make_atom(env, "argument_error"), 
                    enif_make_atom(env, "invalid_or_corrupted_parameter"),
                    enif_make_atom(env, "task_status_array"));

    }
    
    ErlNifBinary binary_arr[length];
    if(!inspect_array_of_binary_objects(env, argv[0], &binary_arr ))
    {
        return enif_make_tuple3(env, 
                    enif_make_atom(env, "argument_error"), 
                    enif_make_atom(env, "invalid_or_corrupted_parameter"),
                    enif_make_atom(env, "task_status_array"));
    }   

    BinaryNifArray binaryNifArrayHolder ;
    binaryNifArrayHolder.length = length;
    binaryNifArrayHolder.obj = &binary_arr[0];

    SchedulerDriverStatus status =  scheduler_reconcileTasks( state->scheduler_state, &binaryNifArrayHolder);
    return get_return_value_from_status(env, status);
}
开发者ID:nqn,项目名称:erlang-mesos,代码行数:47,代码来源:scheduler.c


示例13: _load

static ERL_NIF_TERM _load(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]){
	UNUSED(argc);

	ErlNifBinary in,out;
	struct jpeg_decompress_struct cinfo;
	struct error_mgr jerr;
	unsigned int width, height;

	enif_inspect_binary(env,argv[0],&in);

	cinfo.err = jpeg_std_error(&jerr.pub);
	jerr.pub.error_exit = error_exit;
	if (setjmp(jerr.setjmp_buffer)) {
		jpeg_destroy_decompress(&cinfo);
		return -1;
	}

	jpeg_create_decompress(&cinfo);

	jpeg_mem_src(&cinfo, in.data, in.size);
	jpeg_read_header (&cinfo, TRUE);

	width = cinfo.image_width;
	height = cinfo.image_height;

	enif_alloc_binary(width*height*3,&out);

	cinfo.do_block_smoothing = TRUE;
	cinfo.do_fancy_upsampling = TRUE;
	cinfo.out_color_space = JCS_RGB;

	jpeg_start_decompress(&cinfo);

	JSAMPROW rowp[1];
	unsigned long location = 0;

	rowp[0] = (unsigned char*) malloc(cinfo.output_width*cinfo.num_components);

	unsigned int i = 0;
	while (cinfo.output_scanline < cinfo.output_height){
		jpeg_read_scanlines(&cinfo, rowp, 1);
		for( i=0; i<cinfo.image_width*cinfo.num_components;i++)
			out.data[location++] = rowp[0][i];
	}

	free(rowp[0]);

	jpeg_finish_decompress (&cinfo);
	jpeg_destroy_decompress (&cinfo);

	return	enif_make_tuple2(env,
				enif_make_atom(env,"ok"),
				enif_make_tuple3(env,
					enif_make_int(env,width),
					enif_make_int(env,height),
					enif_make_binary(env, &out)
				)
			);
}
开发者ID:DAOCUONG,项目名称:evercam-media,代码行数:59,代码来源:lib_elixir_motiondetection.c


示例14: make_term_tuple

static ERL_NIF_TERM make_term_tuple(struct make_term_info* mti, int n)
{
    ERL_NIF_TERM t[3];
    t[0] = pull_term(mti);
    t[1] = pull_term(mti);
    t[2] = pull_term(mti);
    return enif_make_tuple3(mti->dst_env, t[0], t[1], t[2]);	      
}
开发者ID:cristiangreco,项目名称:otp,代码行数:8,代码来源:nif_SUITE.c


示例15: geef_library_version

ERL_NIF_TERM geef_library_version(ErlNifEnv *env, int argc, const ERL_NIF_TERM argv[])
{
	int major, minor, rev;

	git_libgit2_version(&major, &minor, &rev);

	return enif_make_tuple3(env, enif_make_int(env, major), enif_make_int(env, minor), enif_make_int(env, rev));
}
开发者ID:CODECOMMUNITY,项目名称:geef,代码行数:8,代码来源:library.c


示例16: binary_to_msg

/*-----------------------------------------------------------------------------------------------------------------------*/
static ERL_NIF_TERM binary_to_msg(ErlNifEnv* env, int32_t argc, ERL_NIF_TERM const argv[])
{
   ERL_NIF_TERM parser_res;
   ParserRes* parser = NULL;
   ERL_NIF_TERM res = get_parser(env, argv[0], &parser_res, &parser);
   if (res != ok_atom)
   {
      return res;
   }
   int32_t delimiter = 0;
   if (!enif_get_int(env, argv[1], &delimiter) || delimiter <= 0 || delimiter >= 255)
   {
      return make_error(env, FIX_FAILED, "Wrong delimiter.");
   }
   ErlNifBinary bin;
   if (!enif_inspect_binary(env, argv[2], &bin))
   {
      return make_error(env, FIX_FAILED, "Wrong binary.");
   }
   char const* stop = NULL;
   FIXError* error = NULL;
   pthread_rwlock_wrlock(&parser->lock);
   FIXMsg* fix_msg = fix_parser_str_to_msg(parser->ptr, (char const*)bin.data, bin.size, delimiter, &stop, &error);
   pthread_rwlock_unlock(&parser->lock);
   if (!fix_msg)
   {
      ERL_NIF_TERM ret = make_parser_error(env, fix_error_get_code(error), fix_error_get_text(error));
      fix_error_free(error);
      return ret;
   }
   MsgRes* msg_res = (MsgRes*)enif_alloc_resource(message_res, sizeof(MsgRes));
   msg_res->msg = fix_msg;
   msg_res->lock = &parser->lock;
   ERL_NIF_TERM msg_term = enif_make_resource(env, msg_res);
   enif_release_resource(msg_res);
   uint32_t pos = stop - (char const*)bin.data + 1;
   char const* msgType = fix_msg_get_type(fix_msg);
   return enif_make_tuple3(
         env,
         ok_atom,
         enif_make_tuple3(env,
            msg_atom,
            enif_make_string(env, msgType, ERL_NIF_LATIN1),
            enif_make_tuple2(env, parser_res, msg_term)),
         enif_make_sub_binary(env, argv[2], pos, bin.size - pos));
}
开发者ID:dmitryme,项目名称:fix_engine,代码行数:47,代码来源:fix_parser_nifs.c


示例17: make_error

/*-----------------------------------------------------------------------------------------------------------------------*/
static ERL_NIF_TERM make_error(ErlNifEnv* env, int32_t errCode, char const* errorMsg, ...)
{
   va_list ap;
   va_start(ap, errorMsg);
   char text[1024];
   vsnprintf(text, sizeof(text), errorMsg, ap);
   return enif_make_tuple3(env, error_atom, enif_make_int(env, errCode), enif_make_string(env, text, ERL_NIF_LATIN1));
}
开发者ID:dmitryme,项目名称:fix_engine,代码行数:9,代码来源:fix_parser_nifs.c


示例18: _receive_can_messages

static ERL_NIF_TERM
_receive_can_messages (ErlNifEnv* env,
                        CAN_handle* handle,
                        unsigned int chunk_size,
                        long timeout)
{
  int length         = 0,
      i              = 0,
      chunks         = 0;
  ERL_NIF_TERM *list, result;
  canmsg_t     buffer[sizeof(canmsg_t) * BUFFER_LIMIT];
  do {
    int status = _wait_for_input(handle, timeout);
    if (status == 0) break;
    if (status == -1)
      {
        result = enif_make_int(env, errno);
        goto end;
      }
    length = read(handle->device, &buffer[chunks], sizeof(canmsg_t) * chunk_size);
    if (length < 0) break;
    chunks += length / sizeof(canmsg_t) ;
  } while (length > 0 && chunks <= BUFFER_LIMIT && chunks < chunk_size);
  if (chunks > 0)
    {
    if (handle->raw)
      {
        void* data = enif_make_new_binary(env, chunks * sizeof(canmsg_t), &result);
        memcpy(data, buffer, chunks * sizeof(canmsg_t));
      }
    else
      {
      list = enif_alloc(sizeof(ERL_NIF_TERM) * chunks);
      // rewrite canmsgs to list of tuples
      for (i = 0; i < chunks; i++)
        {
        canmsg_t* can_msg = buffer + i;
        ERL_NIF_TERM bin;
        void* data = enif_make_new_binary(env, can_msg->length, &bin);
        memcpy(data, can_msg->data, can_msg->length);
        list[i] = enif_make_tuple3(env,
                                   enif_make_int(env, can_msg->id),
                                   enif_make_tuple2(env,
                                                    enif_make_long(env, can_msg->timestamp.tv_sec),
                                                    enif_make_long(env, can_msg->timestamp.tv_usec)),
                                   bin);
        }
      result = enif_make_list_from_array(env, list, chunks);
      enif_free(list);
      }
    }
  else if (length == 0)
    result = enif_make_int(env, 0);
  else
    result = enif_make_int(env, errno);
end:
  return result;
}
开发者ID:qoocku,项目名称:erleos,代码行数:58,代码来源:CAN_nif.c


示例19: nif_scheduler_sendFrameworkMessage

static ERL_NIF_TERM
nif_scheduler_sendFrameworkMessage(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]){

    ErlNifBinary executorId_binary;
    ErlNifBinary slaveId_binary;
    char data[MAXBUFLEN];

    state_ptr state = (state_ptr) enif_priv_data(env);
    
    if(state->initilised == 0 ) 
    {
        return enif_make_tuple2(env, 
            enif_make_atom(env, "state_error"), 
            enif_make_atom(env, "scheduler_not_inited"));
    }
    if (!enif_inspect_binary(env, argv[0], &executorId_binary)) 
    {
                return enif_make_tuple3(env, 
                    enif_make_atom(env, "argument_error"), 
                    enif_make_atom(env, "invalid_or_corrupted_parameter"),
                    enif_make_atom(env, "executor_id"));
    }
    if (!enif_inspect_binary(env, argv[1], &slaveId_binary)) 
    {
                return enif_make_tuple3(env, 
                    enif_make_atom(env, "argument_error"), 
                    enif_make_atom(env, "invalid_or_corrupted_parameter"),
                    enif_make_atom(env, "slave_id"));
    }
    //REVIEW : buffer length
    if(!enif_get_string(env, argv[2], data , MAXBUFLEN, ERL_NIF_LATIN1 ))
    {
        return enif_make_tuple3(env, 
                    enif_make_atom(env, "argument_error"), 
                    enif_make_atom(env, "invalid_or_corrupted_parameter"),
                    enif_make_atom(env, "data"));
    }

    SchedulerDriverStatus status = scheduler_sendFrameworkMessage( state->scheduler_state , 
                                                                        &executorId_binary, 
                                                                        &slaveId_binary, 
                                                                        data);
    return get_return_value_from_status(env, status);
}
开发者ID:nqn,项目名称:erlang-mesos,代码行数:44,代码来源:scheduler.c


示例20: vm_set_error

void
vm_set_error(vm_ptr vm, ENBINARY mesg, ENBINARY src, unsigned int line)
{
    ENTERM tmesg = enif_make_binary(vm->curr_job->env, &mesg);
    ENTERM tsrc = enif_make_binary(vm->curr_job->env, &src);
    ENTERM tline = enif_make_int(vm->curr_job->env, line);

    vm->curr_job->error = enif_make_tuple3(
            vm->curr_job->env, tmesg, tsrc, tline
    );
}
开发者ID:alepharchives,项目名称:emonk,代码行数:11,代码来源:vm.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ enif_realloc_binary函数代码示例发布时间:2022-05-30
下一篇:
C++ enif_make_tuple2函数代码示例发布时间: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