本文整理汇总了C++中IoState_error_函数的典型用法代码示例。如果您正苦于以下问题:C++ IoState_error_函数的具体用法?C++ IoState_error_怎么用?C++ IoState_error_使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IoState_error_函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: IoMessage_locals_valueArgAt_
IoObject *IoDBI_initWithDriversPath(IoDBI *self, IoObject *locals,
IoMessage *m)
{
/*doc DBI initWithDriversPath
Initialize the DBI environment with the specified libdbi driver path.
*/
IoObject *dir = IoMessage_locals_valueArgAt_(m, locals, 0);
if (ISSYMBOL(dir))
{
DATA(self)->driverCount = dbi_initialize(CSTRING(dir));
}
else
{
IoState_error_(IOSTATE, m, "argument 0 to method '%s' must be a Symbol, not a '%s'\n",
CSTRING(IoMessage_name(m)), IoObject_name(dir));
}
if (DATA(self)->driverCount == -1)
{
IoState_error_(IOSTATE, m, "*** IoDBI error during dbi_initialize\n");
}
else
{
DATA(self)->didInit = 1;
}
return IONUMBER(DATA(self)->driverCount);
}
开发者ID:BMeph,项目名称:io,代码行数:29,代码来源:IoDBI.c
示例2: DynLib_pointerForSymbolName_
IoDynLib *IoDynLib_callPluginInitFunc(IoDynLib *self, IoObject *locals, IoMessage *m)
{
/*doc DynLib callPluginInit(functionName)
Call's the dll function of the specified name.
Returns the result as a Number or raises an exception on error.
*/
intptr_t rc = 0;
intptr_t *params = NULL;
void *f = DynLib_pointerForSymbolName_(DATA(self),
CSTRING(IoMessage_locals_symbolArgAt_(m, locals, 0)));
if (f == NULL)
{
IoState_error_(IOSTATE, m, "Error resolving call '%s'.",
CSTRING(IoMessage_locals_symbolArgAt_(m, locals, 0)));
return IONIL(self);
}
if (IoMessage_argCount(m) < 1)
{
IoState_error_(IOSTATE, m, "Error, you must give an init function name to check for.");
return IONIL(self);
}
params = io_calloc(1, sizeof(intptr_t) * 2);
params[0] = (intptr_t)IOSTATE;
params[1] = (intptr_t)IOSTATE->lobby;
rc = ((intptr_t (*)(intptr_t, intptr_t))f)(params[0], params[1]);
io_free(params);
return IONUMBER(rc);
}
开发者ID:Habaut,项目名称:GameBindings,代码行数:33,代码来源:IoDynLib.c
示例3: OCTX
IoSecureServer *IoSecureServer_setCRLFile(IoSecureServer *self, IoObject *locals, IoMessage *msg)
{
SSL_CTX *ctx = OCTX(self);
IoSeq *pathSeq = IoMessage_locals_seqArgAt_(msg, locals, 0);
char *path = IoSeq_asCString(pathSeq);
if(ctx == NULL)
{
IoState_error_(IOSTATE, msg, "SecureServer has no SSL_CTX");
return IONIL(self);
}
X509_STORE *store = SSL_CTX_get_cert_store(ctx);
X509_STORE_set_verify_cb_func(store, IoSecureSockets_Verify_CRL_Callback);
X509_STORE_set_flags (store, X509_V_FLAG_CRL_CHECK | X509_V_FLAG_CRL_CHECK_ALL);
X509_LOOKUP *lookup;
if (!(lookup = X509_STORE_add_lookup (store, X509_LOOKUP_file ())))
{
ERR_print_errors_fp(stderr);
IoState_error_(IOSTATE, msg, "Error creating X509_LOOKUP object.");
return IONIL(self);
}
if (X509_load_crl_file(lookup, path, X509_FILETYPE_PEM) != 1)
{
ERR_print_errors_fp(stderr);
IoState_error_(IOSTATE, msg, "Error loading CRL from file %s\n", path);
return IONIL(self);
}
return self;
}
开发者ID:ADTSH,项目名称:io,代码行数:29,代码来源:IoSecureServer.c
示例4: Levels_levelForOp
int Levels_levelForOp(Levels *self, char *messageName, IoSymbol *messageSymbol, IoMessage *msg)
{
IoObject *value = IoMap_rawAt(self->operatorTable, messageSymbol);
if (!value)
{
return -1;
}
if (ISNUMBER(value))
{
int precedence = IoNumber_asInt((IoNumber*)value);
if (precedence < 0 || precedence >= IO_OP_MAX_LEVEL)
{
IoState_error_(IoObject_state(msg), msg, "compile error: Precedence for operators must be between 0 and %d. Precedence was %d.", IO_OP_MAX_LEVEL - 1, precedence);
}
return precedence;
}
else
{
IoState_error_(IoObject_state(msg), msg, "compile error: Value for '%s' in Message OperatorTable operators is not a number. Values in the OperatorTable operators are numbers which indicate the precedence of the operator.", messageName);
return -1; // The C compiler does not know that IoState_error_() will never return.
}
}
开发者ID:ADTSH,项目名称:io,代码行数:25,代码来源:IoMessage_opShuffle.c
示例5: IO_METHOD
IO_METHOD(IoSeq, between)
{
/*doc Sequence between(aSequence, anotherSequence)
Returns a new Sequence containing the bytes between the
occurance of aSequence and anotherSequence in the receiver.
*/
long start = 0;
long end = 0;
IoSeq *fromSeq, *toSeq;
fromSeq = (IoSeq *)IoMessage_locals_valueArgAt_(m, locals, 0);
if (ISSEQ(fromSeq))
{
start = UArray_find_from_(DATA(self), DATA(fromSeq), 0) + IoSeq_rawSize(fromSeq);
if (start == -1)
{
start = 0;
}
}
else if (ISNIL(fromSeq))
{
start = 0;
}
else
{
IoState_error_(IOSTATE, m, "Nil or Sequence argument required for arg 0, not a %s",
IoObject_name((IoObject *)fromSeq));
}
toSeq = (IoSeq *)IoMessage_locals_valueArgAt_(m, locals, 1);
if (ISSEQ(toSeq))
{
end = UArray_find_from_(DATA(self), DATA(toSeq), start);
if (end == -1) start = UArray_size(DATA(self));
}
else if (ISNIL(toSeq))
{
end = UArray_size(DATA(self));
}
else
{
IoState_error_(IOSTATE, m, "Nil or Sequence argument required for arg 1, not a %s",
IoObject_name((IoObject *)toSeq));
}
{
UArray *ba = UArray_slice(DATA(self), start, end);
IoSeq *result = IoSeq_newWithUArray_copy_(IOSTATE, ba, 0);
return result;
}
}
开发者ID:doublec,项目名称:io,代码行数:55,代码来源:IoSeq_immutable.c
示例6: checkStatus_
IoCairoSurface *IoCairoSurface_newWithRawSurface_(void *state, IoMessage *m, cairo_surface_t *surface)
{
IoObject *self = 0;
IoStateProtoFunc *initFunc = 0;
checkStatus_(state, m, cairo_surface_status(surface));
switch(cairo_surface_get_type(surface))
{
case CAIRO_SURFACE_TYPE_IMAGE:
initFunc = IoCairoImageSurface_proto;
break;
case CAIRO_SURFACE_TYPE_PS:
initFunc = IoCairoPSSurface_proto;
break;
case CAIRO_SURFACE_TYPE_PDF:
initFunc = IoCairoPDFSurface_proto;
break;
case CAIRO_SURFACE_TYPE_SVG:
initFunc = IoCairoSVGSurface_proto;
break;
default:
IoState_error_(state, 0, "Unsupported surface type");
}
self = IOCLONE(IoState_protoWithId_(state, protoId));
IoObject_setDataPointer_(self, surface);
return self;
}
开发者ID:AlexGensek,项目名称:io,代码行数:29,代码来源:IoCairoSurface.c
示例7: ReportDBIError
void ReportDBIError(dbi_conn conn, void *state, IoMessage *m)
{
const char *error;
int errorCode = dbi_conn_error(conn, &error);
IoState_error_(state, m, "libdbi: %i: %s\n", errorCode, error);
}
开发者ID:BMeph,项目名称:io,代码行数:7,代码来源:IoDBI.c
示例8: CNUMBER
IoCFFIArray *IoCFFIArray_atPut(IoCFFIArray *self, IoObject *locals, IoMessage *m)
{
int pos;
IoObject *value, *arrayType, *d;
char *ptr;
pos = CNUMBER(IoMessage_locals_numberArgAt_(m, locals, 0));
value = IoMessage_locals_valueArgAt_(m, locals, 1);
if ( pos >= DATA(self)->arraySize ) {
IoState_error_(IOSTATE, m, "index out of bounds");
return IONIL(self);
}
arrayType = IoObject_getSlot_(self, IOSYMBOL("arrayType"));
ptr = ((char *)DATA(self)->buffer) + (DATA(self)->itemSize * pos);
d = IOCLONE(arrayType);
IoCFFIDataType_rawSetValue(d, value);
memcpy(ptr, (void *)IoCFFIDataType_ValuePointerFromObject_(self, d), DATA(self)->itemSize);
if ( DATA(self)->keepValuesRefs ) {
DATA(self)->keepValuesRefs[pos] = IOREF(d);
}
return self;
}
开发者ID:bomma,项目名称:io,代码行数:27,代码来源:IoCFFIArray.c
示例9: IoMessage_locals_seqArgAt_
/*doc Memcached replace(key, value[, expiration])
Asks memcached to store the value identified by the key,
but only if the server *does* already hold data for this key.
Returns true on success, false if there is already data for this key.
Otherwise raises an exception.
*/
IoObject *IoMemcached_replace(IoMemcached *self, IoObject *locals, IoMessage *m)
{
IoSeq *key = IoMessage_locals_seqArgAt_(m, locals, 0);
IoObject *value = IoMessage_locals_quickValueArgAt_(m, locals, 1);
time_t expiration = IoMessage_argCount(m) == 3 ? IoMessage_locals_intArgAt_(m, locals, 2) : 0;
uint32_t flags;
size_t size;
char *cvalue = IoMemcached_serialize(self, locals, value, &size, &flags);
memcached_return_t rc;
rc = memcached_replace(DATA(self)->mc,
CSTRING(key), IOSEQ_LENGTH(key),
cvalue, size,
expiration, flags
);
free(cvalue);
if(rc != MEMCACHED_SUCCESS && rc != MEMCACHED_NOTSTORED)
IoState_error_(IOSTATE, m, memcached_strerror(DATA(self)->mc, rc));
// MEMCACHED_NOTSTORED is a legitmate error in the case of a collision.
if(rc == MEMCACHED_NOTSTORED)
return IOSTATE->ioFalse;
return IOSTATE->ioTrue; // MEMCACHED_SUCCESS
}
开发者ID:ADTSH,项目名称:io,代码行数:35,代码来源:IoMemcached.c
示例10: IO_METHOD
IO_METHOD(IoFile, write)
{
/*doc File write(aSequence1, aSequence2, ...)
Writes the arguments to the receiver file. Returns self.
*/
int i;
IoFile_assertOpen(self, locals, m);
IoFile_assertWrite(self, locals, m);
for (i = 0; i < IoMessage_argCount(m); i ++)
{
IoSymbol *string = IoMessage_locals_seqArgAt_(m, locals, i);
UArray_writeToCStream_(IoSeq_rawUArray(string), DATA(self)->stream);
if (ferror(DATA(self)->stream) != 0)
{
IoState_error_(IOSTATE, m, "error writing to file '%s'",
UTF8CSTRING(DATA(self)->path));
}
}
return self;
}
开发者ID:achoy,项目名称:io,代码行数:25,代码来源:IoFile.c
示例11: IoAVCodec_registerIfNeeded
IoObject *IoAVCodec_open(IoAVCodec *self, IoObject *locals, IoMessage *m)
{
/*doc AVCodec open
Opens the input file. Return self on success or raises an exception on error.
*/
int err;
IoAVCodec_registerIfNeeded(self);
IoAVCodec_freeContextIfNeeded(self);
IoAVCodec_createContextIfNeeded(self);
DATA(self)->isAtEnd = 0;
err = IoAVCodec_openFile(self);
if (err != 0)
{
IoObject *fileName = IoObject_symbolGetSlot_(self, IOSYMBOL("path"));
IoState_error_(IOSTATE, m, "error %i opening file %s\n", err, CSTRING(fileName));
return IONIL(self);
}
IoAVCodec_findStreams(self);
av_read_play(DATA(self)->formatContext);
return self;
}
开发者ID:BMeph,项目名称:io,代码行数:28,代码来源:IoAVCodec.c
示例12: IO_METHOD
IO_METHOD(IoSeq, replaceMap)
{
/*doc Sequence replaceMap(aMap)
In the receiver, the keys of aMap replaced with its values. Returns self.
*/
IoMap *map = IoMessage_locals_mapArgAt_(m, locals, 0);
UArray *ba = DATA(self);
IO_ASSERT_NOT_SYMBOL(self);
PHASH_FOREACH(IoMap_rawHash(map), k, v,
{
IoSymbol *subSeq = k;
IoSymbol *otherSeq = v;
if (ISSEQ(otherSeq))
{
UArray_replace_with_(ba, DATA(subSeq), DATA(otherSeq));
}
else
{
IoState_error_(IOSTATE, m,
"argument 0 to method '%s' must be a Map with Sequence values, not '%s'",
CSTRING(IoMessage_name(m)), IoObject_name(otherSeq));
}
}
);
开发者ID:Alessandroo,项目名称:io,代码行数:28,代码来源:IoSeq_mutable.c
示例13: IoMessage_locals_valueArgAt_
IoObject *IoCFFIPointer_castTo(IoCFFIPointer *self, IoObject *locals, IoMessage *m)
{
IoObject *toType = IoMessage_locals_valueArgAt_(m, locals, 0);
IoObject *o = IoState_on_doCString_withLabel_(IOSTATE, toType, "?typeString", "IoCFFIPointer_castTo");
if(!ISNIL(o)) {
char *typeStr = CSTRING(o);
switch(typeStr[0]) {
case '^':
toType = IOCLONE(toType);
*(DATA(toType)->valuePointer) = *((void **)IoCFFIDataType_ValuePointerFromObject_(toType, self));
return toType;
case '*':
toType = IOCLONE(toType);
IoCFFIDataType_rawSetValue(toType, self);
return toType;
default:
IoState_error_(IOSTATE, m, "Wrong type to cast to.");
break;
}
}
else {
// Mm... well, if the type to cast to does not have a typeString slot,
// it should be an Io Object, so the address stored here is a pointer to an
// Io Object. Simply cast the pointer and return it... dangerous but...
IoObject *obj = (IoObject *)*(DATA(self)->valuePointer);
if(ISOBJECT(obj))
return (IoObject *)*(DATA(self)->valuePointer);
}
return IONIL(self);
}
开发者ID:akimd,项目名称:io,代码行数:34,代码来源:IoCFFIPointer.c
示例14: IoMessage_assertArgCount_receiver_
void IoMessage_assertArgCount_receiver_(IoMessage *self, int n, IoObject *receiver)
{
if (List_size(DATA(self)->args) < n)
{
IoState_error_(IOSTATE, self, "[%s %s] requires %i arguments\n",
IoObject_name(receiver), CSTRING(DATA(self)->name), n);
}
}
开发者ID:mikedouglas,项目名称:io,代码行数:8,代码来源:IoMessage.c
示例15: IoMap_new
/*doc Memcached stats
Returns a Map with servers' statistics. Keys are server addresses,
values are maps with actual stats.
*/
IoObject *IoMemcached_stats(IoMemcached *self, IoObject *locals, IoMessage *m)
{
IoMap *results_map = IoMap_new(IOSTATE);
int errors = 0;
uint32_t pos = 0;
while(pos < memcached_server_count(DATA(self)->mc)) {
memcached_server_instance_st server = memcached_server_instance_by_position(DATA(self)->mc, pos);
if(server == NULL)
continue;
const char *hostname = memcached_server_name(server);
const in_port_t port = memcached_server_port(server);
memcached_stat_st stats;
memcached_return_t rc = memcached_stat_servername(&stats, "", hostname, port);
if(rc != MEMCACHED_SUCCESS) {
errors++;
continue;
}
char **ckeys = memcached_stat_get_keys(DATA(self)->mc, &stats, &rc);
if(rc != MEMCACHED_SUCCESS) {
errors++;
continue;
}
IoMap *per_server_map = IoMap_new(IOSTATE);
char *ckey = *ckeys;
while(ckey != NULL) {
char *cvalue = memcached_stat_get_value(DATA(self)->mc, &stats, ckey, &rc);
if(rc != MEMCACHED_SUCCESS) {
errors++;
continue;
}
IoMap_rawAtPut(per_server_map, IOSYMBOL(ckey), IOSYMBOL(cvalue));
free(cvalue);
ckey++;
}
free(ckeys);
// "127.0.0.1:11211"
char *server_key = (char *) malloc((strlen(hostname) + 1 + 5 + 1) * sizeof(char));
sprintf(server_key, "%s:%d", hostname, port);
IoMap_rawAtPut(results_map, IOSYMBOL(server_key), per_server_map);
free(server_key);
pos++;
}
if(errors > 0)
IoState_error_(IOSTATE, m, memcached_strerror(DATA(self)->mc, MEMCACHED_SOME_ERRORS));
return results_map;
}
开发者ID:ADTSH,项目名称:io,代码行数:62,代码来源:IoMemcached.c
示例16: IoSeq_rawPio_reallocateToSize_
void IoSeq_rawPio_reallocateToSize_(IoSeq *self, size_t size)
{
if (ISSYMBOL(self))
{
IoState_error_(IOSTATE, NULL, "attempt to resize an immutable Sequence");
}
UArray_sizeTo_(DATA(self), size);
}
开发者ID:Alessandroo,项目名称:io,代码行数:9,代码来源:IoSeq_mutable.c
示例17: IoAssertNotSymbol
static void IoAssertNotSymbol(IoSeq *self, IoMessage *m)
{
if (ISSYMBOL(self))
{
IoState_error_(IOSTATE, m,
"'%s' cannot be called on an immutable Sequence",
CSTRING(IoMessage_name(m)));
}
}
开发者ID:Alessandroo,项目名称:io,代码行数:9,代码来源:IoSeq_mutable.c
示例18: IoMessage_locals_numberArgAt_errorForType_
void IoMessage_locals_numberArgAt_errorForType_(IoMessage *self,
IoObject *locals,
int n,
const char *typeName)
{
IoObject *v = IoMessage_locals_valueArgAt_(self, locals, n);
IoState_error_(IOSTATE, self, "argument %i to method '%s' must be a %s, not a '%s'",
n, CSTRING(DATA(self)->name), typeName, IoObject_name(v));
}
开发者ID:mikedouglas,项目名称:io,代码行数:9,代码来源:IoMessage.c
示例19: IoState_error_
IoObject *IoSyslog_open(IoSyslog *self, IoObject *locals, IoMessage *m)
{
/*doc Syslog open(aPriority, someOptions, optionalIdentity)
Opens the syslog for writing. optionalIdentity need not be entered
and will default to the name of the distribution of Io you are running
or if you have embedded Io into your application and set
Lobby distribution = "foo", it will be set to "foo".
*/
int syslog_facility, syslog_options;
//int i, max;
char *syslog_ident;
if (DATA(self)->syslog_opened)
{
IoState_error_(IOSTATE, m, "System log is already open");
return IONIL(self);
}
{
DATA(self)->facility = IOREF(IoMessage_locals_numberArgAt_(m, locals, 0));
if (ISNIL(DATA(self)->facility))
{
syslog_facility = LOG_USER;
}
else
{
syslog_facility = IoObject_dataUint32(DATA(self)->facility);
}
DATA(self)->options = IOREF(IoMessage_locals_listArgAt_(m, locals, 1));
syslog_options = 0;
if (ISNIL(DATA(self)->options))
{
syslog_options = LOG_PID | LOG_CONS;
}
else
{
List *list = IoList_rawList(DATA(self)->options);
LIST_FOREACH(list, i, v,
syslog_options |= (int)CNUMBER(v);
);
}
syslog_ident = (char *)IOSYMBOL_BYTES(DATA(self)->ident);
if ((strlen(syslog_ident) == 0) || ISNIL(DATA(self)->ident))
{
char *s = CSTRING(IoState_doCString_(IOSTATE, "Lobby distribution"));
strncpy(syslog_ident, s, strlen(s));
}
openlog(syslog_ident, syslog_options, syslog_facility);
DATA(self)->syslog_opened = 1;
DATA(self)->syslog_mask = setlogmask(0);
setlogmask(DATA(self)->syslog_mask);
}
开发者ID:Akiyah,项目名称:io,代码行数:57,代码来源:IoSyslog.c
示例20: IoImage_checkError
void IoImage_checkError(IoImage *self, IoObject *locals, IoMessage *m)
{
const char *e = Image_error(DATA(self)->image);
if (e != NULL)
{
IoState_error_(IOSTATE, m, "Image %s on %s", e, Image_path(DATA(self)->image));
}
}
开发者ID:Alessandroo,项目名称:io,代码行数:9,代码来源:IoImage.c
注:本文中的IoState_error_函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论