本文整理汇总了C++中IOSYMBOL函数的典型用法代码示例。如果您正苦于以下问题:C++ IOSYMBOL函数的具体用法?C++ IOSYMBOL怎么用?C++ IOSYMBOL使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IOSYMBOL函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: getenv
IoObject *IoUser_protoName(IoUser *self, IoObject *locals, IoMessage *m)
{
/*doc User name
Returns the current user's name.
*/
char *userName = (char *)getlogin();
if (userName == NULL)
{
userName = getenv("LOGNAME");
}
if (userName == NULL)
{
return IONIL(self);
}
return IOSYMBOL(userName);
}
开发者ID:Akiyah,项目名称:io,代码行数:20,代码来源:IoUser.c
示例2: IO_METHOD
IO_METHOD(IoObject, tokensForString)
{
/*doc Compiler tokensForString(aString)
Returns a list of token objects lexed from the input string.
*/
IoSymbol *text = IoMessage_locals_seqArgAt_(m, locals, 0);
IoList *tokensList = IoList_new(IOSTATE);
IoLexer *lexer = IoLexer_new();
IoSymbol *name = IOSYMBOL("name");
IoSymbol *line = IOSYMBOL("line");
IoSymbol *character = IOSYMBOL("character");
IoSymbol *type = IOSYMBOL("type");
IoLexer_string_(lexer, CSTRING(text));
IoLexer_lex(lexer);
if (IoLexer_errorToken(lexer))
{
IoSymbol *errorString = IOSYMBOL(IoLexer_errorDescription(lexer));
IoLexer_free(lexer);
IoState_error_(IOSTATE, NULL, "compile error: %s", CSTRING(errorString));
}
else
{
IoToken *t;
while ((t = IoLexer_pop(lexer)))
{
IoObject *tokenObject = IoObject_new(IOSTATE);
IoObject_setSlot_to_(tokenObject, name, IOSYMBOL(IoToken_name(t)));
IoObject_setSlot_to_(tokenObject, line, IONUMBER(IoToken_lineNumber(t)));
IoObject_setSlot_to_(tokenObject, character, IONUMBER(IoToken_charNumber(t)));
IoObject_setSlot_to_(tokenObject, type, IOSYMBOL(IoToken_typeName(t)));
IoList_rawAppend_(tokensList, tokenObject);
}
}
IoLexer_free(lexer);
return tokensList;
}
开发者ID:doublec,项目名称:io,代码行数:44,代码来源:IoCompiler.c
示例3: av_codec_next
IoObject *IoAVCodec_encodeCodecNames(IoAVCodec *self, IoObject *locals, IoMessage *m)
{
/*doc AVCodec encodeCodecNames
Returns a list of strings with the names of the encode codecs.
*/
AVCodec *p = av_codec_next(NULL);
IoList *names = IoList_new(IOSTATE);
while (p)
{
if (p->encode)
{
IoList_rawAppend_(names, IOSYMBOL(p->name));
}
p = av_codec_next(p);
}
return names;
}
开发者ID:BMeph,项目名称:io,代码行数:21,代码来源:IoAVCodec.c
示例4: IoMySQL_close
IoObject* IoMySQL_close(IoObject* self, IoObject* locals, IoMessage* m) {
/*#io
docSlot("close",
"Closes a previously opened connection.")
*/
if(DATA(self)->connected)
mysql_close(&DATA(self)->connection);
IoObject_removeSlot_(self, IOSYMBOL("host"));
IoObject_removeSlot_(self, IOSYMBOL("user"));
IoObject_removeSlot_(self, IOSYMBOL("password"));
IoObject_removeSlot_(self, IOSYMBOL("database"));
IoObject_removeSlot_(self, IOSYMBOL("port"));
IoObject_removeSlot_(self, IOSYMBOL("socket"));
IoObject_removeSlot_(self, IOSYMBOL("usingSSL"));
return self;
}
开发者ID:cdcarter,项目名称:io,代码行数:19,代码来源:IoMySQL.c
示例5: IoList_new
IoObject *IoAVCodec_decodeCodecNames(IoAVCodec *self, IoObject *locals, IoMessage *m)
{
/*doc AVCodec decodeCodecNames
Returns a list of strings with the names of the decode codecs.
*/
AVCodec *p = first_avcodec;
IoList *names = IoList_new(IOSTATE);
while (p)
{
if (p->decode)
{
IoList_rawAppend_(names, IOSYMBOL(p->name));
}
p = p->next;
}
return names;
}
开发者ID:josip,项目名称:io,代码行数:21,代码来源:IoAVCodec.c
示例6: onXmppConnect
/*** Loudmouth callbacks ***/
void onXmppConnect(LmConnection *connection, int success, void* data) {
IoObject *self = data;
IoMessage *m;
if(success == 1) {
m = IoMessage_newWithName_label_(IOSTATE, IOSYMBOL("handleConnect"), IOSYMBOL("Loudmouth"));
IoMessage_locals_performOn_(m, self, self);
lm_connection_authenticate(
connection,
CSTRING(IoObject_getSlot_(self, IOSYMBOL("username"))),
CSTRING(IoObject_getSlot_(self, IOSYMBOL("password"))),
CSTRING(IoObject_getSlot_(self, IOSYMBOL("resource"))),
onXmppAuth, data, NULL, NULL
);
} else {
m = IoMessage_newWithName_label_(IOSTATE, IOSYMBOL("handleConnectFailure"), IOSYMBOL("Loudmouth"));
IoMessage_locals_performOn_(m, self, self);
}
}
开发者ID:ADTSH,项目名称:io,代码行数:20,代码来源:IoLoudmouth.c
示例7: IoObject_getSlot_
IoObject *IoTokyoCabinetPrefixCursor_last(IoObject *self, IoObject *locals, IoMessage *m)
{
/*doc TokyoCabinetPrefixCursor last
Move cursor to last record. Returns self
*/
IoSeq *prefix = IoObject_getSlot_(self, IOSYMBOL("prefix"));
IOASSERT(ISSEQ(prefix), "prefix must be a sequence");
IOASSERT(TokyoCabinetPrefixCursor(self), "invalid TokyoCabinetPrefixCursor");
{
UArray *p = UArray_clone(IoSeq_rawUArray(prefix));
UArray_appendCString_(p, " "); // space preceeds .
tcbdbcurjump(TokyoCabinetPrefixCursor(self), (const void *)UArray_bytes(p), (int)UArray_size(p));
UArray_free(p);
}
return IOBOOL(self, IoTokyoCabinetPrefixCursor_keyBeginsWithPrefix_(self, prefix));
}
开发者ID:ADTSH,项目名称:io,代码行数:21,代码来源:IoTokyoCabinetPrefixCursor.c
示例8: IoObject_new
IoEditLine *IoEditLine_proto(void *state)
{
IoMethodTable methodTable[] = {
{"hasEditLib", IoEditLine_hasEditLib},
{"readLine", IoEditLine_readLine},
{"addHistory", IoEditLine_addHistory},
{NULL, NULL},
};
IoObject *self = IoObject_new(state);
IoObject_tag_(self, IoEditLine_newTag(state));
/* Make sure editline returns characters in the multi-byte charset
of the locale */
setlocale(LC_CTYPE, "");
IoObject_setDataPointer_(self, io_calloc(1, sizeof(IoEditLineData)));
DATA(self)->prompt = IOSYMBOL("");
DATA(self)->editline = el_init("io", stdin, stdout, stderr);
DATA(self)->history = history_init();
el_set(DATA(self)->editline, EL_CLIENTDATA, self);
el_set(DATA(self)->editline, EL_HIST, history, DATA(self)->history);
el_set(DATA(self)->editline, EL_PROMPT, promptCallback);
el_set(DATA(self)->editline, EL_SIGNAL, 1);
el_set(DATA(self)->editline, EL_EDITOR, "emacs");
{
HistEvent ev;
history(DATA(self)->history, &ev, H_SETSIZE, 300);
}
el_source(DATA(self)->editline, NULL);
IoState_registerProtoWithFunc_((IoState *)state, self, IoEditLine_proto);
IoObject_addMethodTable_(self, methodTable);
return self;
}
开发者ID:cdcarter,项目名称:io,代码行数:40,代码来源:IoEditLine.c
示例9: malloc
// Serialize/Deserialize
char *IoMemcached_serialize(IoMemcached *self, IoObject *locals, IoObject *object, size_t *size, uint32_t *flags) {
char *cvalue;
if(ISSEQ(object)) {
*flags = _FLAG_SEQUENCE;
*size = IOSEQ_LENGTH(object);
cvalue = (char *) malloc(*size);
strncpy(cvalue, CSTRING(object), *size);
}
else if(ISNUMBER(object)) {
*flags = _FLAG_NUMBER;
double cnumber = IoNumber_asDouble(object);
cvalue = (char *) malloc(128 * sizeof(char));
*size = snprintf(cvalue, 127, "%.16f", cnumber);
}
else if(ISNIL(object)) {
*flags = _FLAG_NIL;
*size = 3;
cvalue = (char *) malloc(3 * sizeof(char));
strncpy(cvalue, "nil", 3);
}
else if(ISBOOL(object)) {
*flags = _FLAG_BOOLEAN;
*size = 1;
cvalue = (char *) malloc(sizeof(char));
if(object == IOSTATE->ioTrue) strncpy(cvalue, "1", 1);
if(object == IOSTATE->ioFalse) strncpy(cvalue, "0", 1);
}
else {
*flags = _FLAG_OBJECT;
IoMessage *serialize = IoMessage_newWithName_(IOSTATE, IOSYMBOL("serialized"));
IoSeq *serialized = IoMessage_locals_performOn_(serialize, locals, object);
*size = IOSEQ_LENGTH(serialized);
cvalue = (char *) malloc(*size);
strncpy(cvalue, CSTRING(serialized), *size);
}
return cvalue;
}
开发者ID:ADTSH,项目名称:io,代码行数:40,代码来源:IoMemcached.c
示例10: IoObject_getSlot_
//doc Loudmouth connect Connects to the server. Returns <code>self</code>.
IoObject *IoLoudmouth_connect(IoLoudmouth *self, IoObject *locals, IoMessage *m) {
// Q: Should we io_free() these?
IoSeq* username = IoObject_getSlot_(self, IOSYMBOL("username"));
IoSeq* password = IoObject_getSlot_(self, IOSYMBOL("password"));
IoSeq* resource = IoObject_getSlot_(self, IOSYMBOL("resource"));
IoSeq* host = IoObject_getSlot_(self, IOSYMBOL("host"));
IoNumber* port = IoObject_getSlot_(self, IOSYMBOL("port"));
IoObject* use_ssl = IoObject_getSlot_(self, IOSYMBOL("useSsl"));
IOASSERT(ISSEQ(username), "Loudmouth: username should be a Sequence");
IOASSERT(ISSEQ(password), "Loudmouth: password should be a Sequence");
IOASSERT(ISSEQ(resource), "Loudmouth: resource should be a Sequence");
IOASSERT(ISSEQ(host), "Loudmouth: host should be a Sequence");
IOASSERT(ISNUMBER(port), "Loudmouth: port should be a Number");
if(LMCONN(self) == NULL) {
LmConnection *connection = lm_connection_new_with_context(CSTRING(host), main_context);
IoObject_setDataPointer_(self, connection);
lm_connection_set_jid(connection, CSTRING(IoObject_getSlot_(self, IOSYMBOL("jid"))));
lm_connection_set_port(connection, CNUMBER(port));
if(ISTRUE(use_ssl) && lm_ssl_is_supported()) {
LmSSL *ssl = lm_ssl_new(NULL, onSslError, NULL, NULL);
lm_connection_set_ssl(connection, ssl);
lm_ssl_unref(ssl);
}
LmMessageHandler* handler = lm_message_handler_new(onXmppMessage, self, NULL);
lm_connection_register_message_handler(
connection, handler,
LM_MESSAGE_TYPE_MESSAGE, LM_HANDLER_PRIORITY_NORMAL
);
lm_message_handler_unref(handler);
lm_connection_set_disconnect_function(connection, onXmppDisconnect, NULL, NULL);
}
lm_connection_open(LMCONN(self), onXmppConnect, self, NULL, NULL);
return self;
}
开发者ID:ADTSH,项目名称:io,代码行数:42,代码来源:IoLoudmouth.c
示例11: IoObject_new
IoSQLite3 *IoSQLite3_proto(void *state)
{
IoObject *self = IoObject_new(state);
IoObject_tag_(self, IoSQLite3_newTag(state));
IoObject_setDataPointer_(self, io_calloc(1, sizeof(IoSQLite3Data)));
DATA(self)->path = IOSYMBOL(".");
IoState_registerProtoWithId_(state, self, protoId);
{
IoMethodTable methodTable[] = {
{"setPath", IoSQLite3_setPath},
{"path", IoSQLite3_path},
{"open", IoSQLite3_open},
{"close", IoSQLite3_close},
{"exec", IoSQLite3_exec},
{"error", IoSQLite3_errorMessage},
{"version", IoSQLite3_version},
{"setTimeoutSeconds", IoSQLite3_setTimeoutSeconds},
{"timeoutSeconds", IoSQLite3_timeoutSeconds},
{"rowsChangedCount", IoSQLite3_changes},
{"lastInsertRowId", IoSQLite3_lastInsertRowId},
{"tableNames", IoSQLite3_tableNames},
{"viewNames", IoSQLite3_viewNames},
{"columnNamesOfTable", IoSQLite3_columnNamesOfTable},
{"debugOn", IoSQLite3_debugOn},
{"debugOff", IoSQLite3_debugOff},
{"isOpen", IoSQLite3_isOpen},
{"escapeString", IoSQLite3_escapeString},
{NULL, NULL},
};
IoObject_addMethodTable_(self, methodTable);
}
return self;
}
开发者ID:JoeyButler,项目名称:io,代码行数:37,代码来源:IoSQLite3.c
示例12: IO_METHOD
//doc ClutterActorBox with(x1, y1, x2, y2)
IO_METHOD(IoClutterActorBox, with) {
float x1 = IoMessage_locals_floatArgAt_(m, locals, 0),
y1 = IoMessage_locals_floatArgAt_(m, locals, 1),
x2 = IoMessage_locals_floatArgAt_(m, locals, 2),
y2 = IoMessage_locals_floatArgAt_(m, locals, 3);
ClutterActorBox *actorBox = clutter_actor_box_new(x1, y1, x2, y2);
IoClutterActorBox *klone = IoClutterActorBox_newWithActorBox(IOSTATE, actorBox);
IoObject_setSlot_to_(klone,
IOSYMBOL("x1"), IoMessage_locals_numberArgAt_(m, locals, 0)
);
IoObject_setSlot_to_(klone,
IOSYMBOL("y1"), IoMessage_locals_numberArgAt_(m, locals, 1)
);
IoObject_setSlot_to_(klone,
IOSYMBOL("x2"), IoMessage_locals_numberArgAt_(m, locals, 2)
);
IoObject_setSlot_to_(klone,
IOSYMBOL("y2"), IoMessage_locals_numberArgAt_(m, locals, 3)
);
IoObject_setSlot_to_(klone,
IOSYMBOL("width"), IONUMBER(clutter_actor_box_get_width(actorBox))
);
IoObject_setSlot_to_(klone,
IOSYMBOL("height"), IONUMBER(clutter_actor_box_get_height(actorBox))
);
IoObject_setSlot_to_(klone,
IOSYMBOL("area"), IONUMBER(clutter_actor_box_get_area(actorBox))
);
return klone;
}
开发者ID:ADTSH,项目名称:io,代码行数:40,代码来源:IoClutterActorBox.c
示例13: IoObject_new
IoRegexMatch *IoRegexMatch_proto(void *state)
{
IoObject *self = IoObject_new(state);
IoObject_tag_(self, IoRegexMatch_newTag(state));
IoObject_setDataPointer_(self, calloc(1, sizeof(IoRegexMatchData)));
DATA(self)->regex = IONIL(self);
DATA(self)->subject = IOSYMBOL("");
DATA(self)->ranges = IoList_new(state);
IoState_registerProtoWithId_(state, self, protoId);
{
IoMethodTable methodTable[] = {
{"regex", IoRegexMatch_regex},
{"subject", IoRegexMatch_subject},
{"ranges", IoRegexMatch_ranges},
{0, 0},
};
IoObject_addMethodTable_(self, methodTable);
}
return self;
}
开发者ID:ADTSH,项目名称:io,代码行数:24,代码来源:IoRegexMatch.c
示例14: IoObject_getSlot_
IoCFFIPointer *IoCFFIPointer_ToType_(IoObject *type)
{
IoObject *pointer, *self;
IoMap *pointers;
IoSymbol *key;
// this is a hack so macros relying on self will work
self = type;
pointers = IoObject_getSlot_(IoState_protoWithInitFunction_(IOSTATE, IoCFFIPointer_proto), IOSYMBOL("pointers"));
key = IoState_on_doCString_withLabel_(IOSTATE, type, "uniqueHexId", "IoCFFIPointer_ToType_");
pointer = IoMap_rawAt(pointers, key);
if (!pointer)
{
// create new pointer and add to cache
pointer = IoCFFIPointer_new(IOSTATE);
IoObject_setSlot_to_(pointer, IOSYMBOL("pointedToType"), type);
IoMap_rawAtPut(pointers, key, pointer);
}
return pointer;
}
开发者ID:akimd,项目名称:io,代码行数:24,代码来源:IoCFFIPointer.c
示例15: IoMessage_locals_seqArgAt_
IoObject *IoTokyoCabinetPrefixCursor_jump(IoObject *self, IoObject *locals, IoMessage *m)
{
/*doc TokyoCabinetPrefixCursor jump(key)
Move cursor to record before key. Returns self
*/
IoSeq *key = IoMessage_locals_seqArgAt_(m, locals, 0);
int result;
UArray *p;
IoSeq *prefix = IoObject_getSlot_(self, IOSYMBOL("prefix"));
IOASSERT(ISSEQ(prefix), "prefix must be a sequence");
p = UArray_clone(IoSeq_rawUArray(prefix));
UArray_appendPath_(p, IoSeq_rawUArray(key));
result = tcbdbcurjump(TokyoCabinetPrefixCursor(self),
(const void *)UArray_bytes(p),
(int)UArray_sizeInBytes(p));
UArray_free(p);
IOASSERT(TokyoCabinetPrefixCursor(self), "invalid TokyoCabinetPrefixCursor");
return IOBOOL(self, result);
}
开发者ID:ADTSH,项目名称:io,代码行数:24,代码来源:IoTokyoCabinetPrefixCursor.c
示例16: IoObject_rawClonePrimitive
IoODEJointGroup *IoODEJointGroup_rawClone(IoODEJointGroup *proto)
{
IoObject *self = IoObject_rawClonePrimitive(proto);
IoObject_setDataPointer_(self, calloc(1, sizeof(IoODEJointGroupData)));
if(DATA(proto)->world)
{
IoODEWorld *world = DATA(proto)->world;
WORLD = world;
IoODEWorld_addJointGroup(world, self);
JOINTGROUPID = dJointGroupCreate(0);
DATA(self)->joints = List_new();
IoObject_inlineSetSlot_to_(self, IOSYMBOL("Ball"), IoODEBall_newProto(IOSTATE, self));
IoObject_inlineSetSlot_to_(self, IOSYMBOL("Hinge"), IoODEHinge_newProto(IOSTATE, self));
IoObject_inlineSetSlot_to_(self, IOSYMBOL("Slider"), IoODESlider_newProto(IOSTATE, self));
IoObject_inlineSetSlot_to_(self, IOSYMBOL("Hinge2"), IoODEHinge2_newProto(IOSTATE, self));
IoObject_inlineSetSlot_to_(self, IOSYMBOL("Universal"), IoODEUniversal_newProto(IOSTATE, self));
IoObject_inlineSetSlot_to_(self, IOSYMBOL("Fixed"), IoODEFixed_newProto(IOSTATE, self));
//IoObject_inlineSetSlot_to_(self, IOSYMBOL("AMotor"), IoODEAMotor_newProto(IOSTATE, self));
//IoObject_inlineSetSlot_to_(self, IOSYMBOL("LMotor"), IoODELMotor_newProto(IOSTATE, self));
}
return self;
}
开发者ID:Akiyah,项目名称:io,代码行数:24,代码来源:IoODEJointGroup.c
示例17: IONIL
IoObject *IoCFFIPointer_value(IoCFFIPointer *self, IoObject *locals, IoMessage *m)
{
IoObject *pointedToType;
IoCFFIPointer *pointer;
char *typeString, *cp, c;
if (*(DATA(self)->valuePointer) == NULL)
{
//IoState_error_(IOSTATE, m, "attempt to dereference NULL pointer");
return IONIL(self);
}
typeString = CSTRING(IoState_on_doCString_withLabel_(IOSTATE, self, "typeString", "IoCFFIPointer_value"));
pointedToType = IoObject_getSlot_(self, IOSYMBOL("pointedToType"));
if (ISCFFIPointer(pointedToType))
{
// we are a pointer to a pointer, so return a new Pointer
// that points to the address of our ptr dereferenced
cp = strrchr(typeString, '^');
switch (c = *(++cp))
{
#define IoCFFIPointer_value_SET_DATA_PTR(cType) \
pointer = IOCLONE(IoCFFIPointer_ToType_(IoObject_getSlot_(pointedToType, IOSYMBOL("pointedToType")))); \
*(DATA(pointer)->valuePointer) = *((cType **)(*(DATA(self)->valuePointer))); break
//DATA(pointer)->ptr = *((cType **)(DATA(self)->ptr)); break
case 'c':
case 'b':
IoCFFIPointer_value_SET_DATA_PTR(char);
case 'C':
case 'B':
IoCFFIPointer_value_SET_DATA_PTR(unsigned char);
case 's':
IoCFFIPointer_value_SET_DATA_PTR(short);
case 'S':
IoCFFIPointer_value_SET_DATA_PTR(unsigned short);
case 'i':
IoCFFIPointer_value_SET_DATA_PTR(int);
case 'I':
IoCFFIPointer_value_SET_DATA_PTR(unsigned int);
case 'l':
IoCFFIPointer_value_SET_DATA_PTR(long);
case 'L':
IoCFFIPointer_value_SET_DATA_PTR(unsigned long);
case 'f':
IoCFFIPointer_value_SET_DATA_PTR(float);
case 'd':
IoCFFIPointer_value_SET_DATA_PTR(double);
case '*':
IoCFFIPointer_value_SET_DATA_PTR(char *);
case '{':
case '(':
case '&':
case '[':
case 'v':
IoCFFIPointer_value_SET_DATA_PTR(void);
#undef IoCFFIPointer_value_SET_DATA_PTR
//case 'v':
// IoState_error_(IOSTATE, m, "attempt to dereference a void pointer");
// return IONIL(self);
default:
IoState_error_(IOSTATE, m, "unknown character '%c' in Pointer typeString", c);
return IONIL(self);
}
return pointer;
}
else if(ISCFFIDataType(pointedToType) || ISCFFIStructure(pointedToType) || ISCFFIFunction(pointedToType) || ISCFFIArray(pointedToType))
{
return IoCFFIDataType_objectFromData_(pointedToType, *(DATA(self)->valuePointer));
}
else
{
IoState_error_(IOSTATE, m, "attempt to dereference Pointer object whose pointedToType is unknown.");
return IONIL(self);
}
}
开发者ID:akimd,项目名称:io,代码行数:83,代码来源:IoCFFIPointer.c
示例18: IoObject_getSlot_
IoObject *IoCoroutine_rawException(IoCoroutine *self)
{
return IoObject_getSlot_(self, IOSYMBOL("exception"));
}
开发者ID:jdp,项目名称:io,代码行数:4,代码来源:IoCoroutine.c
示例19: IoCoroutine_rawSetException_
void IoCoroutine_rawSetException_(IoCoroutine *self, IoObject *v)
{
IoObject_setSlot_to_(self, IOSYMBOL("exception"), v);
}
开发者ID:jdp,项目名称:io,代码行数:4,代码来源:IoCoroutine.c
示例20: IoCoroutine_rawRemoveException
void IoCoroutine_rawRemoveException(IoCoroutine *self)
{
IoObject_removeSlot_(self, IOSYMBOL("exception"));
}
开发者ID:jdp,项目名称:io,代码行数:4,代码来源:IoCoroutine.c
注:本文中的IOSYMBOL函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论