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

C++ driver_mk_atom函数代码示例

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

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



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

示例1: output

static void output(ErlDrvData drv_data,
		   char *buf, ErlDrvSizeT len)
{
    Otp9302Data *data = (Otp9302Data *) drv_data;
    ErlDrvTermData td_port = driver_mk_port(data->port);
    ErlDrvTermData td_receiver = driver_caller(data->port);
    ErlDrvTermData td_job = driver_mk_atom("job");
    unsigned int key = (unsigned int) (ErlDrvSInt) data->port;
    long id[5];
    Otp9302AsyncData *ad[5];
    int i;

    for (i = 0; i < sizeof(ad)/sizeof(ad[0]); i++) {
	ad[i] = driver_alloc(sizeof(Otp9302AsyncData));
	if (!ad[i])
	    abort();

	ad[i]->smp = data->smp;
	ad[i]->port = data->port;
	ad[i]->block = 0;
	ad[i]->refc = 1;
	ad[i]->term_data.port = td_port;
	ad[i]->term_data.receiver = td_receiver;
	ad[i]->term_data.msg = td_job;
	ad[i]->msgq = &data->msgq;
    }
    ad[0]->block = 1;
    ad[0]->term_data.msg = driver_mk_atom("block");
    ad[2]->term_data.msg = driver_mk_atom("cancel");
    ad[4]->term_data.msg = driver_mk_atom("end_of_jobs");
    for (i = 0; i < sizeof(id)/sizeof(id[0]); i++)
	id[i] = driver_async(data->port, &key, async_invoke, ad[i], driver_free);
    if (id[2] > 0)
	driver_async_cancel(id[2]);
}
开发者ID:caox,项目名称:otp,代码行数:35,代码来源:otp_9302_drv.c


示例2: process

static void process(ErlDrvData handle, ErlIOVec *ev) {
    baberl_drv_t* driver_data = (baberl_drv_t*) handle;
    ErlDrvBinary* args = ev->binv[1];
    char *data = args->orig_bytes;
    char *from_encoding, *to_encoding, *text;
    converted_text_t cv;

    from_encoding = read_string(&data);
    to_encoding = read_string(&data);
    text = read_string(&data);

    cv.error = 0;
    convert_text(from_encoding, to_encoding, text, strlen(text), &cv);

    if (cv.error == 0) {
        ErlDrvTermData spec[] = {ERL_DRV_ATOM, driver_mk_atom("ok"),
                                 ERL_DRV_BUF2BINARY, cv.text, cv.text_size,
                                 ERL_DRV_TUPLE, 2
                                };
        driver_output_term(driver_data->port, spec, sizeof(spec) / sizeof(spec[0]));
    }
    else {
        ErlDrvTermData spec[] = {ERL_DRV_ATOM, driver_mk_atom("error"),
                                 ERL_DRV_ATOM, driver_mk_atom("iconv_coding"),
                                 ERL_DRV_TUPLE, 2
                                };
        driver_output_term(driver_data->port, spec, sizeof(spec) / sizeof(spec[0]));
    }

    driver_free(from_encoding);
    driver_free(to_encoding);
    driver_free(text);
    driver_free(cv.text);
}
开发者ID:kevsmith,项目名称:baberl,代码行数:34,代码来源:baberl_drv.c


示例3: fill_passwd

static void
fill_passwd (ErlDrvTermData *data, struct passwd *pwd,
             char **name,
             char **passwd)
{
  char *pw_name = pwd->pw_name;
  char *pw_passwd = pwd->pw_passwd;

  size_t len_name = strlen (pw_name);
  size_t len_passwd = strlen (pw_passwd);

  if (name)
    {
      *name = (char *) driver_alloc (sizeof (char) * (len_name + 1));
      memcpy (*name, pw_name, sizeof (char) * (len_name + 1));

      pw_name = *name;
    }

  if (passwd)
    {
      *passwd = (char *) driver_alloc (sizeof (char *) * (len_passwd + 1));
      memcpy (*passwd, pw_passwd, sizeof (char) * (len_passwd + 1));

      pw_passwd = *passwd;
    }

  *data++ = ERL_DRV_ATOM;
  *data++ = driver_mk_atom ("pw_name");
  *data++ = ERL_DRV_STRING;
  *data++ = (ErlDrvTermData) pw_name;
  *data++ = strlen (pwd->pw_name);
  *data++ = ERL_DRV_TUPLE;
  *data++ = 2;

  *data++ = ERL_DRV_ATOM;
  *data++ = driver_mk_atom ("pw_passwd");
  *data++ = ERL_DRV_STRING;
  *data++ = (ErlDrvTermData) pw_passwd;
  *data++ = strlen (pwd->pw_name);
  *data++ = ERL_DRV_TUPLE;
  *data++ = 2;

  *data++ = ERL_DRV_ATOM;
  *data++ = driver_mk_atom ("pw_uid");
  *data++ = ERL_DRV_UINT;
  *data++ = pwd->pw_uid;
  *data++ = ERL_DRV_TUPLE;
  *data++ = 2;

  *data++ = ERL_DRV_ATOM;
  *data++ = driver_mk_atom ("pw_gid");
  *data++ = ERL_DRV_UINT;
  *data++ = pwd->pw_gid;
  *data++ = ERL_DRV_TUPLE;
  *data++ = 2;
  
  *data++ = ERL_DRV_TUPLE;
  *data++ = 4;
}
开发者ID:chinnurtb,项目名称:erlang-pwd,代码行数:60,代码来源:pwd_drv.c


示例4: dthread_lib_init

void dthread_lib_init()
{
    dterm_lib_init();
    am_data = driver_mk_atom("data");
    am_ok = driver_mk_atom("ok");
    am_error = driver_mk_atom("error");
}
开发者ID:relabsoss,项目名称:uart,代码行数:7,代码来源:dthread.c


示例5: unkown

// Unkown Command
static void unkown(bdb_drv_t *bdb_drv, ErlIOVec *ev) {
  // Return {error, unkown_command}
  ErlDrvTermData spec[] = {ERL_DRV_ATOM, driver_mk_atom("error"),
			   ERL_DRV_ATOM, driver_mk_atom("uknown_command"),
			   ERL_DRV_TUPLE, 2};
  driver_output_term(bdb_drv->port, spec, sizeof(spec) / sizeof(spec[0]));
}
开发者ID:mattwilliamson,项目名称:erl_bdb,代码行数:8,代码来源:bdb_drv.c


示例6: send_geometry

void send_geometry(GEOSCommand *command, GEOSGeometry *geom) {
	//GEOSContextHandle_t context = command->driver_data->handle;
	//int type = GEOSGeomTypeId_r(context, geom);

	if(geom == NULL) {

		ErlDrvTermData spec[] = {ERL_DRV_ATOM, driver_mk_atom("ok"),
			   ERL_DRV_ATOM, driver_mk_atom("ggeom"),
			   ERL_DRV_ATOM, driver_mk_atom("empty"),
			   ERL_DRV_TUPLE, 2,
			   ERL_DRV_TUPLE, 2};

		driver_output_term(command->driver_data->port, spec, sizeof(spec) / sizeof(spec[0]));

		return;
	}
	ErlDrvTermData spec[] = {ERL_DRV_ATOM, driver_mk_atom("ok"),
			   ERL_DRV_ATOM, driver_mk_atom("ggeom"),
			 //  ERL_DRV_INT, (ErlDrvTermData) type,
			   ERL_DRV_INT, (ErlDrvTermData) geom,
			   ERL_DRV_TUPLE, 2,
			   ERL_DRV_TUPLE, 2};

  	driver_output_term(command->driver_data->port, spec, sizeof(spec) / sizeof(spec[0]));
}
开发者ID:alepharchives,项目名称:erlgeo,代码行数:25,代码来源:erl_geos_util.c


示例7: erl_luam_maybe_atom

void
erl_luam_maybe_atom(lua_drv_t *driver_data, char *buf, int index)
{
  long i;
  int is_atom;
  char *atom;
  ei_decode_long(buf, &index, &i);

  lua_getglobal(driver_data->L, "erlang");
  lua_getfield(driver_data->L, -1, "t_atom");
  lua_getmetatable(driver_data->L, -3);
  is_atom = lua_rawequal(driver_data->L, -1, -2);
  lua_pop(driver_data->L, 3);

  if (is_atom) {
      atom = (char*)lua_touserdata(driver_data->L, i);
      ErlDrvTermData spec[] = {
          ERL_DRV_ATOM, ATOM_OK,
            ERL_DRV_ATOM, ATOM_OK,
            ERL_DRV_ATOM, driver_mk_atom(atom),
            ERL_DRV_TUPLE,  2,
          ERL_DRV_TUPLE, 2
      };
      erl_drv_output_term(driver_data->drvport, spec, sizeof(spec) / sizeof(spec[0]));
  } else {
      ErlDrvTermData spec[] = {
          ERL_DRV_ATOM, ATOM_OK,
          ERL_DRV_ATOM, driver_mk_atom("false"),
          ERL_DRV_TUPLE, 2
      };
      erl_drv_output_term(driver_data->drvport, spec, sizeof(spec) / sizeof(spec[0]));
  }
}
开发者ID:cjimison,项目名称:erlualib,代码行数:33,代码来源:commands.c


示例8: emonk_start

static ErlDrvData
emonk_start(ErlDrvPort port, char *cmd)
{
    uint rt_max, gc_max, gc_last, ctx;
    emonk_drv_t* drv = NULL;
    ErlDrvData ret = ERL_DRV_ERROR_GENERAL;
    emonk_settings_t settings;
    
    if(parse_settings(cmd, &settings) < 0)
    {
        ret = ERL_DRV_ERROR_BADARG;
        goto error;
    }
    
    drv = (emonk_drv_t*) driver_alloc(sizeof(emonk_drv_t));
    if(drv == NULL) goto error;

    drv->port = port;
    drv->ok = driver_mk_atom("ok");
    drv->error = driver_mk_atom("error");
    drv->undefined = driver_mk_atom("undefined");
    drv->bad_cmd = driver_mk_atom("bad_command");
    
    drv->vm = init_vm(&settings);
    if(drv->vm == NULL) goto error;
    
    return (ErlDrvData) drv;

error:
    if(drv != NULL) driver_free(drv);
    return ret;
}
开发者ID:kocolosk,项目名称:emonk,代码行数:32,代码来源:emonk_drv.c


示例9: gl_dispatch

void gl_dispatch(int op, char *bp,ErlDrvTermData caller,WXEBinRef *bins[]){
  if(caller != gl_active) {
    wxGLCanvas * current = glc[caller];
    if(current) { gl_active = caller; current->SetCurrent();}
    else {
      ErlDrvTermData rt[] = // Error msg
	{ERL_DRV_ATOM, driver_mk_atom((char *) "_egl_error_"),
	 ERL_DRV_INT,  op,
	 ERL_DRV_ATOM, driver_mk_atom((char *) "no_gl_context"),
	 ERL_DRV_TUPLE,3};
      driver_send_term(WXE_DRV_PORT,caller,rt,8);
      return ;
    }
  };
  char * bs[3];
  int bs_sz[3];
  for(int i=0; i<3; i++) {
    if(bins[i]) {
      bs[i] = bins[i]->base;
      bs_sz[i] = bins[i]->size;
    }
    else 
      bs[i] = NULL;
  }
  wxe_gl_dispatch(op, bp, WXE_DRV_PORT, caller, bs, bs_sz);
}
开发者ID:Andy-Richards,项目名称:otp,代码行数:26,代码来源:wxe_gl.cpp


示例10: testcase_printf

void
testcase_printf(TestCaseState_t *tcs, char *frmt, ...)
{
    InternalTestCaseState_t *itcs = (InternalTestCaseState_t *) tcs;
    ErlDrvTermData msg[12];
    va_list va;
    va_start(va, frmt);
#if HAVE_VSNPRINTF
    vsnprintf(itcs->comment_buf, COMMENT_BUF_SZ, frmt, va);
#else
    vsprintf(itcs->comment_buf, frmt, va);
#endif
    va_end(va);

    msg[0] = ERL_DRV_ATOM;
    msg[1] = (ErlDrvTermData) driver_mk_atom("print");

    msg[2] = ERL_DRV_PORT;
    msg[3] = itcs->port_id;

    msg[4] = ERL_DRV_ATOM;
    msg[5] = driver_mk_atom(itcs->visible.testcase_name);

    msg[6] = ERL_DRV_STRING;
    msg[7] = (ErlDrvTermData) itcs->comment_buf;
    msg[8] = (ErlDrvTermData) strlen(itcs->comment_buf);

    msg[9] = ERL_DRV_TUPLE;
    msg[10] = (ErlDrvTermData) 4;

    erl_drv_output_term(itcs->port_id, msg, 11);
}
开发者ID:NaughtyCode,项目名称:otp,代码行数:32,代码来源:testcase_driver.c


示例11: erl_send_error

void erl_send_error(GEOSCommand *command, char *atom) {
	
	ErlDrvTermData spec[] = {ERL_DRV_ATOM, driver_mk_atom("error"),
                           ERL_DRV_ATOM, driver_mk_atom(atom),
                           ERL_DRV_TUPLE, 2}; 
	driver_output_term(command->driver_data->port, spec, sizeof(spec) / sizeof(spec[0]));

}
开发者ID:alepharchives,项目名称:erlgeo,代码行数:8,代码来源:erl_geos_util.c


示例12: del

// Delete a record from the database
static void del(bdb_drv_t *bdb_drv, ErlIOVec *ev) {
  ErlDrvBinary* data = ev->binv[1];
  char *bytes = data->orig_bytes;
  char *key_bytes = bytes+1;
  
  DB *db = bdb_drv->db;
  DBT key;
  int status;
  
  bzero(&key, sizeof(DBT));
    
  key.data = key_bytes;
  key.size = KEY_SIZE;
  
  status = db->del(db, NULL, &key, 0);
  db->sync(db, 0);
  
  if(status == 0) {
  	// Delete went OK, return atom 'ok'
    ErlDrvTermData spec[] = {ERL_DRV_ATOM, driver_mk_atom("ok")};
    
    driver_output_term(bdb_drv->port, spec, sizeof(spec) / sizeof(spec[0]));
    
  } else {
  	// There was an error
    char *error_reason;

    switch(status) {
    case DB_NOTFOUND:
      error_reason = "not_found";
      break;
    case DB_LOCK_DEADLOCK:
      error_reason = "deadlock";
      break;
    case DB_SECONDARY_BAD:
      error_reason = "bad_secondary_index";
      break;
    case EINVAL:
      error_reason = "bad_flag";
      break;
    case EACCES:
      error_reason = "readonly";
      break;
    case DB_RUNRECOVERY:
      error_reason = "run_recovery";
      break;
    default:
      error_reason = "unknown";
    }
    
    // Return tuple {error, Reason}
    ErlDrvTermData spec[] = {ERL_DRV_ATOM, driver_mk_atom("error"),
			     ERL_DRV_ATOM, driver_mk_atom(error_reason),
			     ERL_DRV_TUPLE, 2};

    driver_output_term(bdb_drv->port, spec, sizeof(spec) / sizeof(spec[0]));
  }
}
开发者ID:mattwilliamson,项目名称:erl_bdb,代码行数:59,代码来源:bdb_drv.c


示例13: start

static ErlDrvData start(ErlDrvPort port, char *cmd) {
  spidermonkey_drv_t *retval = (spidermonkey_drv_t*) driver_alloc(sizeof(spidermonkey_drv_t));
  retval->port = port;
  retval->shutdown = 0;
  retval->atom_ok = driver_mk_atom((char *) "ok");
  retval->atom_error = driver_mk_atom((char *) "error");
  retval->atom_unknown_cmd = driver_mk_atom((char *) "unknown_command");
  return (ErlDrvData) retval;
}
开发者ID:jonte,项目名称:erlang_js,代码行数:9,代码来源:spidermonkey_drv.c


示例14: send_txn_tstat

static void send_txn_tstat(ErlDrvPort port, ErlDrvTermData pid, DB_TXN_ACTIVE *tasp)
{
    char *name = tasp->name ? tasp->name : "<null>";
    int name_len = strlen(name);
    char tid_str[32];
    char *status_str;
    switch (tasp->status)
    {
        case TXN_ABORTED:
            status_str = "aborted";
            break;
        case TXN_COMMITTED:
            status_str = "committed";
            break;
        case TXN_PREPARED:
            status_str = "prepared";
            break;
        case TXN_RUNNING:
            status_str = "running";
            break;
        default:
            status_str = "undefined";
            break;
    }

    int tid_str_len = snprintf(tid_str, sizeof(tid_str), "%lu", (unsigned long) tasp->tid);

    ErlDrvTermData response[] = {
        ERL_DRV_ATOM, driver_mk_atom("txn"),
        STATS_TUPLE(tasp, txnid),               /* Transaction ID */
        STATS_TUPLE(tasp, parentid),            /* Transaction ID of parent */
        STATS_TUPLE(tasp, pid),                 /* Process owning txn ID - pid_t */
            ERL_DRV_ATOM, driver_mk_atom("tid"),/* OSX has 32-bit ints in erlang, so return as */
            ERL_DRV_STRING, (ErlDrvTermData) tid_str, tid_str_len, /* a string */
        ERL_DRV_TUPLE, 2,
        STATS_LSN_TUPLE(tasp, lsn),             /* LSN when transaction began */
        STATS_LSN_TUPLE(tasp, read_lsn),        /* Read LSN for MVCC */
        STATS_TUPLE(tasp, mvcc_ref),            /* MVCC reference count */

        // Start of list
            ERL_DRV_ATOM, driver_mk_atom("status"),
            ERL_DRV_ATOM, driver_mk_atom(status_str),
        ERL_DRV_TUPLE, 2,

            ERL_DRV_ATOM, driver_mk_atom("name"),
            ERL_DRV_STRING, (ErlDrvTermData) name, name_len,
        ERL_DRV_TUPLE, 2,


        // End of list
        ERL_DRV_NIL,
        ERL_DRV_LIST, 9+1,
        ERL_DRV_TUPLE, 2
    };
    driver_send_term(port, pid, response, sizeof(response) / sizeof(response[0]));
}
开发者ID:gburd,项目名称:bdberl,代码行数:56,代码来源:bdberl_stats.c


示例15: send_pointer

void send_pointer(GEOSCommand *command, char *name, void *pointer) {

  ErlDrvTermData spec[] = {ERL_DRV_ATOM, driver_mk_atom("ok"),
			   ERL_DRV_ATOM, driver_mk_atom(name),
                           ERL_DRV_INT, (ErlDrvTermData) pointer,
                           ERL_DRV_TUPLE, 2,
                           ERL_DRV_TUPLE, 2}; 

  driver_output_term(command->driver_data->port, spec, sizeof(spec) / sizeof(spec[0]));

}
开发者ID:alepharchives,项目名称:erlgeo,代码行数:11,代码来源:erl_geos_util.c


示例16: start

// Driver Start
static ErlDrvData start(ErlDrvPort port, char* cmd) {
  sqlite3_drv_t* retval = (sqlite3_drv_t*) driver_alloc(sizeof(sqlite3_drv_t));
  struct sqlite3 *db = NULL;
  int status = 0;
  char *db_name;

  retval->log = fopen(LOG_PATH, "a+");
  if (!retval->log) {
    fprintf(stderr, "Can't create log file\n");
  }

  fprintf(retval->log,
          "--- Start erlang-sqlite3 driver\nCommand line: [%s]\n", cmd);

  db_name = strstr(cmd, " ");
  if (!db_name) {
    fprintf(retval->log,
            "ERROR: DB name should be passed at command line\n");
    db_name = DB_PATH;
  } else {
    ++db_name; // move to first character after ' '
  }

  // Create and open the database
  sqlite3_open(db_name, &db);
  status = sqlite3_errcode(db);

  if (status != SQLITE_OK) {
    fprintf(retval->log, "ERROR: Unable to open file: %s because %s\n\n",
            db_name, sqlite3_errmsg(db));
  } else {
    fprintf(retval->log, "Opened file %s\n", db_name);
  }

  // Set the state for the driver
  retval->port = port;
  retval->db = db;
  retval->key = 42;
  // FIXME Any way to get canonical path to the DB?
  // We need to ensure equal keys for different paths to the same file
  retval->async_handle = 0;
  retval->prepared_stmts = NULL;
  retval->prepared_count = 0;
  retval->prepared_alloc = 0;

  retval->atom_blob = driver_mk_atom("blob");
  retval->atom_error = driver_mk_atom("error");
  retval->atom_columns = driver_mk_atom("columns");
  retval->atom_rows = driver_mk_atom("rows");
  retval->atom_null = driver_mk_atom("null");
  retval->atom_rowid = driver_mk_atom("rowid");
  retval->atom_ok = driver_mk_atom("ok");
  retval->atom_done = driver_mk_atom("done");
  retval->atom_unknown_cmd = driver_mk_atom("unknown_command");

  fflush(retval->log);
  return (ErlDrvData) retval;
}
开发者ID:mwpark,项目名称:sqlite-erlang,代码行数:59,代码来源:sqlite3_drv.c


示例17: return_error_tuple

static void return_error_tuple(bdb_drv_t* pdrv, char* err_msg) {

    ErlDrvTermData spec[] = {   ERL_DRV_ATOM, driver_mk_atom("error"),
                                ERL_DRV_ATOM, driver_mk_atom(err_msg),
                                ERL_DRV_TUPLE, 2};

#if ((ERL_DRV_EXTENDED_MAJOR_VERSION == 1) || ((ERL_DRV_EXTENDED_MAJOR_VERSION == 2) && (ERL_DRV_EXTENDED_MINOR_VERSION == 0)))
    driver_output_term(pdrv->port, spec, sizeof(spec) / sizeof(spec[0]));
#else
    ErlDrvTermData mkport = driver_mk_port(pdrv->port);
    erl_drv_output_term(mkport, spec, sizeof(spec) / sizeof(spec[0]));
#endif

}
开发者ID:miranetworks,项目名称:core_bdb_port_driver,代码行数:14,代码来源:kvs_bdb_drv.c


示例18: reformat

void reformat(ErlDrvPort port, char* buf, int len)
{
    yajl_handle hand;
    /* generator config */
    yajl_gen_config conf = { 1, "  " };
	yajl_gen g;
    yajl_status stat;
    /* allow comments */
    yajl_parser_config cfg = { 1, 1 };

    g = yajl_gen_alloc(&conf, NULL);

    /* ok.  open file.  let's read and parse */
    hand = yajl_alloc(&callbacks, &cfg, NULL, (void *) g);
    
    /* read file data, pass to parser */
    stat = yajl_parse(hand, (unsigned char*) buf, len);

    if (stat != yajl_status_ok &&
        stat != yajl_status_insufficient_data)
    {
        char* err = (char*) yajl_get_error(hand, 1, (unsigned char*) buf, len);
        int len = strlen(err);

        ErlDrvTermData msg[] = {
            ERL_DRV_ATOM, driver_mk_atom("error"), 
            ERL_DRV_BUF2BINARY, (ErlDrvTermData) err, (ErlDrvUInt) len,
            ERL_DRV_TUPLE, 2
        };

        driver_send_term(port, driver_caller(port), msg, sizeof(msg) / sizeof(msg[0]));
    } else {
        const unsigned char* json;
        unsigned int len;
        yajl_gen_get_buf(g, &json, &len);

        ErlDrvTermData msg[] = {
            ERL_DRV_ATOM, driver_mk_atom("ok"),
            ERL_DRV_BUF2BINARY, (ErlDrvTermData) json, (ErlDrvUInt) len,
            ERL_DRV_TUPLE, 2
        };

        driver_send_term(port, driver_caller(port), msg, sizeof(msg) / sizeof(msg[0]));

        yajl_gen_clear(g);
    }

    yajl_gen_free(g);
    yajl_free(hand);
}
开发者ID:dizzyd,项目名称:eep0018,代码行数:50,代码来源:json_formatter.c


示例19: process_unkown

static void process_unkown(bdb_drv_t *bdb_drv, ErlIOVec *ev) {
  // Return {error, unkown_command}
  ErlDrvTermData spec[] = {ERL_DRV_ATOM, driver_mk_atom("error"),
               ERL_DRV_ATOM, driver_mk_atom("uknown_command"),
               ERL_DRV_TUPLE, 2};

#if ((ERL_DRV_EXTENDED_MAJOR_VERSION == 1) || ((ERL_DRV_EXTENDED_MAJOR_VERSION == 2) && (ERL_DRV_EXTENDED_MINOR_VERSION == 0)))
    driver_output_term(bdb_drv->port, spec, sizeof(spec) / sizeof(spec[0]));
#else
    ErlDrvTermData mkport = driver_mk_port(bdb_drv->port);
    erl_drv_output_term(mkport, spec, sizeof(spec) / sizeof(spec[0]));
#endif

}
开发者ID:miranetworks,项目名称:core_bdb_port_driver,代码行数:14,代码来源:kvs_bdb_drv.c


示例20: send_caller

void
send_caller(ErlDrvData drv_data, char *func)
{
    int res;
    ErlDrvPort port = (ErlDrvPort) drv_data;
    ErlDrvTermData msg[] = {
        ERL_DRV_ATOM,	driver_mk_atom("caller"),
        ERL_DRV_PORT,	driver_mk_port(port),
        ERL_DRV_ATOM,	driver_mk_atom(func),
        ERL_DRV_PID,	driver_caller(port),
        ERL_DRV_TUPLE,	(ErlDrvTermData) 4
    };
    res = erl_drv_output_term(driver_mk_port(port), msg, sizeof(msg)/sizeof(ErlDrvTermData));
    if (res <= 0)
        driver_failure_atom(port, "erl_drv_output_term failed");
}
开发者ID:shijiang1130,项目名称:otp,代码行数:16,代码来源:caller_drv.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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