本文整理汇总了C++中KMakeTrace函数的典型用法代码示例。如果您正苦于以下问题:C++ KMakeTrace函数的具体用法?C++ KMakeTrace怎么用?C++ KMakeTrace使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了KMakeTrace函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: DIR_readFileName
//## String DIR.readFileName()
static KMETHOD DIR_readFileName(KonohaContext *kctx, KonohaStack *sfp)
{
kDir *dir = (kDir *)sfp[0].asObject;
if(dir->dirp != NULL) {
KMakeTrace(trace, sfp);
struct dirent entry, *result;
int ret = readdir_r(dir->dirp, &entry, &result);
if(result != NULL) {
char *d_name = result->d_name;
if(dir->readerIconv == ICONV_NULL) {
KReturn(KLIB new_kString(kctx, OnStack, d_name, strlen(d_name), StringPolicy_SystemInfo));
}
else {
KBuffer wb;
KLIB KBuffer_Init(&(kctx->stack->cwb), &wb);
KLIB KBuffer_iconv(kctx, &wb, dir->readerIconv, d_name, strlen(d_name), trace);
KReturn(KLIB KBuffer_Stringfy(kctx, &wb, OnStack, StringPolicy_FreeKBuffer));
}
}
if(ret == -1) {
KTraceErrorPoint(trace, SystemFault, "readdir", LogErrno);
}
kDir_close(kctx, dir);
}
KReturn(KNULL(String));
}
开发者ID:Kouhei-Moriya,项目名称:konoha3,代码行数:27,代码来源:path_glue.c
示例2: Curl_receiveString
//## String Curl.receiveString();
static KMETHOD Curl_receiveString(KonohaContext *kctx, KonohaStack *sfp)
{
kCurl* kcurl = (kCurl *)sfp[0].asObject;
/* presets */
struct ReceiveBuffer rbuf = {0};
rbuf.kctx = kctx;
KLIB KBuffer_Init(&(kctx->stack->cwb), &rbuf.wb);
curl_easy_setopt(kcurl->curl, CURLOPT_WRITEFUNCTION, writeToBuffer);
curl_easy_setopt(kcurl->curl, CURLOPT_WRITEDATA, &rbuf);
/* perform */
KMakeTrace(trace, sfp);
CURLcode res;
if(kcurl->headers != NULL) {
curl_easy_setopt(kcurl->curl, CURLOPT_HTTPHEADER, kcurl->headers);
}
KTraceResponseCheckPoint(trace, 0, "curl_easy_perform",
res = curl_easy_perform(kcurl->curl)
);
if(res != CURLE_OK) {
int fault = diagnosisCurlFaultType(kctx, res, (kcurl->URLInfoNULL == NULL) ? 0 : kString_GuessUserFault(kcurl->URLInfoNULL));
KTraceErrorPoint(trace, fault, "curl_easy_perform", LogURL(kcurl), LogCurlStrError(res));
}
KReturn(KLIB KBuffer_Stringfy(rbuf.kctx, &rbuf.wb, OnStack, StringPolicy_FreeKBuffer));
}
开发者ID:imasahiro,项目名称:konoha3,代码行数:27,代码来源:Curl_glue.c
示例3: DIR_readPath
//## String DIR.readPath()
static KMETHOD DIR_readPath(KonohaContext *kctx, KonohaStack *sfp)
{
kDir *dir = (kDir *)sfp[0].asObject;
if(dir->dirp != NULL) {
KMakeTrace(trace, sfp);
struct dirent entry, *result;
int ret = readdir_r(dir->dirp, &entry, &result);
if(result != NULL) {
char *d_name = result->d_name, delim[2] = {'/', 0};
KBuffer wb;
KLIB KBuffer_Init(&(kctx->stack->cwb), &wb);
KLIB KBuffer_Write(kctx, &wb, kString_text(dir->PathInfoNULL), kString_size(dir->PathInfoNULL));
KLIB KBuffer_Write(kctx, &wb, delim, 1);
if(dir->readerIconv != ICONV_NULL) {
KLIB KBuffer_Write(kctx, &wb, d_name, strlen(d_name));
}
else {
KLIB KBuffer_iconv(kctx, &wb, dir->readerIconv, d_name, strlen(d_name), trace);
}
KReturn(KLIB KBuffer_Stringfy(kctx, &wb, OnStack, StringPolicy_FreeKBuffer));
}
if(ret == -1) {
KTraceErrorPoint(trace, SystemFault, "readdir", LogErrno);
}
kDir_close(kctx, dir);
}
KReturn(KNULL(String));
}
开发者ID:Kouhei-Moriya,项目名称:konoha3,代码行数:29,代码来源:path_glue.c
示例4: NameSpace_ImportPackageSymbol
// boolean NameSpace.import(String pkgname, String symbol);
static KMETHOD NameSpace_ImportPackageSymbol(KonohaContext *kctx, KonohaStack *sfp)
{
kString *key = sfp[2].asString;
ksymbol_t keyword = ksymbolA(S_text(key), S_size(key), _NEWID);
KMakeTrace(trace, sfp);
kNameSpace_ImportPackageSymbol(kctx, sfp[0].asNameSpace, S_text(sfp[1].asString), keyword, trace);
}
开发者ID:kkuramitsu,项目名称:minikonoha,代码行数:8,代码来源:parser.c
示例5: NameSpace_loadScript
// boolean NameSpace.load(String path);
static KMETHOD NameSpace_loadScript(KonohaContext *kctx, KonohaStack *sfp)
{
char pathbuf[512];
const char *path = PLATAPI formatTransparentPath(pathbuf, sizeof(pathbuf), FileId_t(sfp[K_RTNIDX].calledFileLine), S_text(sfp[1].asString));
KMakeTrace(trace, sfp);
kNameSpace_LoadScript(kctx, sfp[0].asNameSpace, path, trace);
}
开发者ID:kkuramitsu,项目名称:minikonoha,代码行数:8,代码来源:parser.c
示例6: NameSpace_hate
// boolean NameSpace.hate(String symbol);
static KMETHOD NameSpace_hate(KonohaContext *kctx, KonohaStack *sfp)
{
kString *key = sfp[2].asString;
ksymbol_t keyword = ksymbolA(S_text(key), S_size(key), _NEWID);
KMakeTrace(trace, sfp);
kNameSpace_RemoveSyntax(kctx, sfp[0].asNameSpace, keyword, trace);
}
开发者ID:kkuramitsu,项目名称:minikonoha,代码行数:8,代码来源:parser.c
示例7: File_putc
//## @Native void File.putc(int ch);
static KMETHOD File_putc(KonohaContext *kctx, KonohaStack *sfp)
{
kFile *file = (kFile *)sfp[0].asObject;
KMakeTrace(trace, sfp);
TRACE_fputc(kctx, file, sfp[1].intValue, trace);
KReturnVoid();
}
开发者ID:imasahiro,项目名称:konoha3,代码行数:8,代码来源:File_glue.c
示例8: File_getc
//## @Native int File.getc();
static KMETHOD File_getc(KonohaContext *kctx, KonohaStack *sfp)
{
kFile *file = (kFile *)sfp[0].asObject;
KMakeTrace(trace, sfp);
int ch = file->fp == NULL ? EOF : TRACE_fgetc(kctx, file, trace);
KReturnUnboxValue(ch);
}
开发者ID:imasahiro,项目名称:konoha3,代码行数:8,代码来源:File_glue.c
示例9: File_new
//## FILE FILE.new(String path, String mode);
static KMETHOD File_new(KonohaContext *kctx, KonohaStack *sfp)
{
KMakeTrace(trace, sfp);
char buffer[K_PATHMAX];
kString *path = sfp[1].asString;
const char *systemPath = I18NAPI formatSystemPath(kctx, buffer, sizeof(buffer), kString_text(path), kString_size(path), trace);
const char *mode = kString_text(sfp[2].asString);
FILE *fp = fopen(systemPath, mode);
kFile *file = (kFile *) sfp[0].asObject;
if(fp == NULL) {
int fault = KLIB DiagnosisFaultType(kctx, kString_GuessUserFault(path)|SystemError, trace);
KTraceErrorPoint(trace, fault, "fopen",
LogText("filename", kString_text(path)), LogText("mode", mode), LogErrno);
KLIB KRuntime_raise(kctx, KException_("IO"), fault, NULL, sfp);
}
if(mode[0] == 'w' || mode[0] == 'a' || mode[1] == '+') {
KTraceChangeSystemPoint(trace, "fopen", LogFileName(kString_text(path)), LogText("mode", mode));
}
file->fp = fp;
KFieldInit(file, file->PathInfoNULL, path);
if(!I18NAPI isSystemCharsetUTF8(kctx)) {
if(mode[0] == 'w' || mode[0] == 'a' || mode[1] == '+') {
file->writerIconv = I18NAPI iconvUTF8ToSystemCharset(kctx, trace);
}
else {
file->readerIconv = I18NAPI iconvSystemCharsetToUTF8(kctx, trace);
}
}
KReturn(file);
}
开发者ID:imasahiro,项目名称:konoha3,代码行数:31,代码来源:File_glue.c
示例10: File_Write
//## @Native int File.write(Bytes buf);
static KMETHOD File_Write(KonohaContext *kctx , KonohaStack *sfp)
{
kFile *file = sfp[0].asFile;
kBytes *ba = sfp[1].asBytes;
KMakeTrace(trace, sfp);
size_t writtenbyte = TRACE_fwrite(kctx, file, ba->buf, ba->bytesize, trace);
KReturnUnboxValue(writtenbyte);
}
开发者ID:imasahiro,项目名称:konoha3,代码行数:9,代码来源:File_glue.c
示例11: File_close
//## @Native void File.close();
static KMETHOD File_close(KonohaContext *kctx, KonohaStack *sfp)
{
kFile *file = (kFile *)sfp[0].asObject;
if(file->fp != NULL) {
KMakeTrace(trace, sfp);
kFile_close(kctx, file, trace);
}
KReturnVoid();
}
开发者ID:imasahiro,项目名称:konoha3,代码行数:10,代码来源:File_glue.c
示例12: System_fchdir
//## int System.fchdir(int fd)
static KMETHOD System_fchdir(KonohaContext *kctx, KonohaStack *sfp)
{
int fd = fchdir(sfp[1].intValue);
if(fd == -1) {
// TODO: throw
KMakeTrace(trace, sfp);
int fault = KLIB DiagnosisFaultType(kctx, SystemError, trace);
KTraceErrorPoint(trace, fault, "fchdir", LogUint("fd", fd));
}
KReturnUnboxValue(fd == 0);
}
开发者ID:kkuramitsu,项目名称:minikonoha,代码行数:12,代码来源:fd_glue.c
示例13: System_fstat
//## Stat System.fstat(int fd)
static KMETHOD System_fstat(KonohaContext *kctx, KonohaStack *sfp)
{
KMakeTrace(trace, sfp);
int fd = (int)sfp[1].intValue;
struct stat buf = {}; /* zero */
int ret = fstat(fd, &buf);
if(ret == -1) {
KTraceErrorPoint(trace, SystemFault|SoftwareFault, "fstat", LogInt("fildes", fd), LogErrno);
}
KReturn(KLIB new_kObject(kctx, OnStack, KGetReturnType(sfp), (uintptr_t)&buf));
}
开发者ID:masakiishii,项目名称:minikonoha,代码行数:12,代码来源:stat_glue.c
示例14: System_chdir
//## boolean chdir(String path)
static KMETHOD System_chdir(KonohaContext *kctx, KonohaStack *sfp)
{
KMakeTrace(trace, sfp);
char buffer[K_PATHMAX];
kString *path = sfp[1].asString;
const char *systemPath = PLATAPI I18NModule.formatSystemPath(kctx, buffer, sizeof(buffer), kString_text(path), kString_size(path), trace);
int ret = chdir(systemPath);
if(ret == -1) {
KTraceErrorPoint(trace, SystemFault, "chdir", LogFileName(kString_text(path)), LogErrno);
}
KReturnUnboxValue(ret != -1);
}
开发者ID:Kouhei-Moriya,项目名称:konoha3,代码行数:13,代码来源:path_glue.c
示例15: System_ttyname
//## String System.ttyname(int fd);
static KMETHOD System_ttyname(KonohaContext *kctx, KonohaStack *sfp)
{
int fd = sfp[1].intValue;
char buf[K_PAGESIZE];
int ret = ttyname_r(fd, buf, sizeof(buf));
if(ret != 0) {
KMakeTrace(trace, sfp);
int fault = KLIB DiagnosisFaultType(kctx, SystemError, trace);
KTraceErrorPoint(trace, fault, "ttyname", LogUint("fd", fd), LogErrno);
}
KReturn(KLIB new_kString(kctx, OnStack, buf, strlen(buf), 0));
}
开发者ID:kkuramitsu,项目名称:minikonoha,代码行数:13,代码来源:fd_glue.c
示例16: NameSpace_useStaticFunc
//## void NameSpace.useStaticFunc(Object o);
static KMETHOD NameSpace_useStaticFunc(KonohaContext *kctx, KonohaStack *sfp)
{
KMakeTrace(trace, sfp);
KonohaClass *ct = O_ct(sfp[1].asObject);
kNameSpace *ns = sfp[0].asNameSpace;
kNameSpace_SetStaticFunction(kctx, ns, ct->methodList_OnGlobalConstList, ct->typeId, trace);
while(ns != NULL) {
kNameSpace_SetStaticFunction(kctx, ns, ns->methodList_OnList, ct->typeId, trace);
ns = ns->parentNULL;
}
KReturnVoid();
}
开发者ID:kkuramitsu,项目名称:minikonoha,代码行数:13,代码来源:parser.c
示例17: System_isDir
//## boolean System.isDir(String path)
static KMETHOD System_isDir(KonohaContext *kctx, KonohaStack *sfp)
{
KMakeTrace(trace, sfp);
char buffer[K_PATHMAX];
kString *path = sfp[1].asString;
const char *systemPath = PLATAPI I18NModule.formatSystemPath(kctx, buffer, sizeof(buffer), kString_text(path), kString_size(path), trace);
struct stat buf;
if(stat(systemPath, &buf) == 0) {
KReturnUnboxValue(S_ISDIR(buf.st_mode));
}
KReturnUnboxValue(false);
}
开发者ID:Kouhei-Moriya,项目名称:konoha3,代码行数:13,代码来源:path_glue.c
示例18: System_access
// boolean System.access(String path, int mode);
static KMETHOD System_access(KonohaContext *kctx, KonohaStack *sfp)
{
KMakeTrace(trace, sfp);
char buffer[K_PATHMAX];
kString *path = sfp[1].asString;
const char *systemPath = PLATAPI formatSystemPath(kctx, buffer, sizeof(buffer), S_text(path), S_size(path), trace);
mode_t mode = (mode_t)sfp[2].intValue;
int ret = access(systemPath, mode);
if(ret == -1) {
KTraceErrorPoint(trace, SystemFault, "access", LogFileName(S_text(path)), LogMode(mode), LogErrno);
}
KReturnUnboxValue(ret != -1);
}
开发者ID:doly,项目名称:minikonoha,代码行数:14,代码来源:path_glue.c
示例19: Connection_new
//## Connection Connection.new(String dburl);
static KMETHOD Connection_new(KonohaContext *kctx, KonohaStack *sfp)
{
kConnection *con = (kConnection *) sfp[0].asObject;
KMakeTrace(trace, sfp);
const char *dburl = kString_text(sfp[1].asString);
QueryDriver *driver = FindQueryDriverByScheme(kctx, dburl);
DBHandler *db = driver->qopen(kctx, dburl, trace);
if(db != NULL) {
con->db = db;
con->driver = driver;
}
KReturn(con);
}
开发者ID:masakiishii,项目名称:minikonoha,代码行数:14,代码来源:sql_glue.c
示例20: Connection_query
//## ResultSet Connection.query(String query);
static KMETHOD Connection_query(KonohaContext *kctx, KonohaStack *sfp)
{
INIT_GCSTACK();
KMakeTrace(trace, sfp);
kConnection *conn = (kConnection *)sfp[0].asObject;
const char *query = kString_text(sfp[1].asString);
kResultSet *rs = (kResultSet *)KLIB new_kObject(kctx, OnStack, KGetReturnType(sfp), (uintptr_t)conn);
KCursor *qcur = conn->driver->qexec(kctx, conn->db, query, rs, trace);
if(qcur != NULL) {
rs->qcur = qcur;
rs->driver = conn->driver;
}
KReturnWith(rs, RESET_GCSTACK());
}
开发者ID:masakiishii,项目名称:minikonoha,代码行数:15,代码来源:sql_glue.c
注:本文中的KMakeTrace函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论