本文整理汇总了C++中currentline函数的典型用法代码示例。如果您正苦于以下问题:C++ currentline函数的具体用法?C++ currentline怎么用?C++ currentline使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了currentline函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: addinfo
static void addinfo (lua_State *L, const char *msg) {
CallInfo *ci = L->ci;
if (isLua(ci)) { /* is Lua code? */
char buff[LUA_IDSIZE]; /* add file:line information */
int line = currentline(L, ci);
luaO_chunkid(buff, getstr(getluaproto(ci)->source), LUA_IDSIZE);
luaO_pushfstring(L, "%s:%d: %s", buff, line, msg);
}
}
开发者ID:26597925,项目名称:fakescript,代码行数:9,代码来源:ldebug.c
示例2: cfgerror
/*
* External (config file) error. Complain, using current file
* and line number.
*/
void
cfgerror(const char *fmt, ...)
{
va_list ap;
extern const char *yyfile;
va_start(ap, fmt);
cfgvxerror(yyfile, currentline(), fmt, ap);
va_end(ap);
}
开发者ID:ryo,项目名称:netbsd-src,代码行数:14,代码来源:util.c
示例3: luaG_runerror
l_noret luaG_runerror (lua_State *L, const char *fmt, ...) {
CallInfo *ci = L->ci;
const char *msg;
va_list argp;
va_start(argp, fmt);
msg = luaO_pushvfstring(L, fmt, argp); /* format message */
va_end(argp);
if (isLua(ci)) /* if Lua function, add source:line information */
luaG_addinfo(L, msg, ci_func(ci)->p->source, currentline(ci));
luaG_errormsg(L);
}
开发者ID:chanchancl,项目名称:YDWE,代码行数:11,代码来源:ldebug.c
示例4: addinfo
static void addinfo (lua_State *L, const char *msg) {
CallInfo *ci = L->ci;
if (isLua(ci)) { /* is Lua code? */
char buff[LUA_IDSIZE]; /* add file:line information */
int line = currentline(ci);
TString *src = ci_func(ci)->p->source;
if (src)
luaO_chunkid(buff, getstr(src), LUA_IDSIZE);
else { /* no source available; use "?" instead */
buff[0] = '?'; buff[1] = '\0';
}
luaO_pushfstring(L, "%s:%d: %s", buff, line, msg);
}
}
开发者ID:crazii,项目名称:mameplus,代码行数:14,代码来源:ldebug.c
示例5: auxgetinfo
static int auxgetinfo (lua_State *L, const char *what, lua_Debug *ar,
Closure *f, CallInfo *ci) {
int status = 1;
for (; *what; what++) {
switch (*what) {
case 'S': {
funcinfo(ar, f);
break;
}
case 'l': {
ar->currentline = (ci && isLua(ci)) ? currentline(ci) : -1;
break;
}
case 'u': {
ar->nups = (f == NULL) ? 0 : f->c.nupvalues;
if (noLuaClosure(f)) {
ar->isvararg = 1;
ar->nparams = 0;
}
else {
ar->isvararg = f->l.p->is_vararg;
ar->nparams = f->l.p->numparams;
}
break;
}
case 't': {
ar->istailcall = (ci) ? ci->callstatus & CIST_TAIL : 0;
break;
}
case 'n': {
/* calling function is a known Lua function? */
if (ci && !(ci->callstatus & CIST_TAIL) && isLua(ci->previous))
ar->namewhat = getfuncname(L, ci->previous, &ar->name);
else
ar->namewhat = NULL;
if (ar->namewhat == NULL) {
ar->namewhat = ""; /* not found */
ar->name = NULL;
}
break;
}
case 'L':
case 'f': /* handled by lua_getinfo */
break;
default:
status = 0; /* invalid option */
}
}
return status;
}
开发者ID:Chronodt,项目名称:emscripten,代码行数:50,代码来源:ldebug.c
示例6: luaG_runerror
l_noret luaG_runerror (lua_State *L, const char *fmt, ...) {
CallInfo *ci = L->ci;
const char *msg;
va_list argp;
va_start(argp, fmt);
msg = luaO_pushvfstring(L, fmt, argp); /* format message */
va_end(argp);
if (isLua(ci)) /* if Lua function, add source:line information */
luaG_addinfo(L, msg, ci_func(ci)->p->source, currentline(ci));
#if LUA_TILDE_DEBUGGER
if (L->hookmask & LUA_MASKERROR)
luaD_hook(L, LUA_HOOKERROR, -1);
#endif /* LUA_TILDE_DEBUGGER */
luaG_errormsg(L);
}
开发者ID:brkpt,项目名称:jamplus,代码行数:15,代码来源:ldebug.c
示例7: auxgetinfo
static int auxgetinfo(lua_State* L, const char* what, lua_Debug* ar,
Closure* f, CallInfo* ci)
{
int status = 1;
if (f == NULL)
{
info_tailcall(ar);
return status;
}
for (; *what; what++)
{
switch (*what)
{
case 'S':
{
funcinfo(ar, f);
break;
}
case 'l':
{
ar->currentline = (ci) ? currentline(L, ci) : -1;
break;
}
case 'u':
{
ar->nups = f->c.nupvalues;
break;
}
case 'n':
{
ar->namewhat = (ci) ? getfuncname(L, ci, &ar->name) : NULL;
if (ar->namewhat == NULL)
{
ar->namewhat = ""; /* not found */
ar->name = NULL;
}
break;
}
case 'L':
case 'f': /* handled by lua_getinfo */
break;
default:
status = 0; /* invalid option */
}
}
return status;
}
开发者ID:migerh,项目名称:DCPUToolchain,代码行数:47,代码来源:ldebug.c
示例8: auxgetinfo
static int
auxgetinfo(lua_State * L, const char *what, lua_Debug * ar, StkId f, CallInfo * ci)
{
int status = 1;
for (; *what; what++) {
switch (*what) {
case 'S':
{
funcinfo(ar, f);
break;
}
case 'l':
{
ar->currentline = (ci) ? currentline(ci) : -1;
break;
}
case 'u':
{
ar->nups = clvalue(f)->c.nupvalues;
break;
}
case 'n':
{
ar->namewhat = (ci) ? getfuncname(ci, &ar->name) : NULL;
if (ar->namewhat == NULL) {
/* try to find a global name */
if ((ar->name = travglobals(L, f)) != NULL)
ar->namewhat = "global";
else
ar->namewhat = ""; /* not found */
}
break;
}
case 'f':
{
setobj2s(L->top, f);
break;
}
default:
status = 0; /* invalid option */
}
}
return status;
}
开发者ID:Dany3R9,项目名称:Proj,代码行数:44,代码来源:ldebug.c
示例9: lua_getinfo
LUA_API int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar) {
StkId func;
int isactive = (*what != '>');
if (isactive)
func = ar->_func;
else {
what++; /* skip the '>' */
func = L->top - 1;
}
for (; *what; what++) {
switch (*what) {
case 'S': {
funcinfo(L, ar, func);
break;
}
case 'l': {
ar->currentline = currentline(func);
break;
}
case 'u': {
ar->nups = nups(func);
break;
}
case 'n': {
ar->namewhat = (isactive) ? getfuncname(L, func, &ar->name) : NULL;
if (ar->namewhat == NULL)
getname(L, func, ar);
break;
}
case 'f': {
setnormalized(L->top, func);
incr_top; /* push function */
break;
}
default: return 0; /* invalid option */
}
}
if (!isactive) L->top--; /* pop function */
return 1;
}
开发者ID:rparet,项目名称:darkpawns,代码行数:40,代码来源:ldebug.c
示例10: addfile
void
addfile(struct nvlist *nvpath, struct nvlist *optx, int flags, const char *rule,
const char *lintrule)
{
struct files *fi;
const char *dotp, *dotp1, *tail, *path, *tail1 = NULL;
struct nvlist *nv;
size_t baselen;
int needc, needf;
char base[200];
/* check various errors */
needc = flags & FI_NEEDSCOUNT;
needf = flags & FI_NEEDSFLAG;
if (needc && needf) {
error("cannot mix needs-count and needs-flag");
goto bad;
}
if (optx == NULL && (needc || needf)) {
error("nothing to %s for %s", needc ? "count" : "flag", path);
goto bad;
}
for (nv = nvpath; nv; nv = nv->nv_next) {
path = nv->nv_name;
/* find last part of pathname, and same without trailing suffix */
tail = strrchr(path, '/');
if (tail == NULL)
tail = path;
else
tail++;
dotp = strrchr(tail, '.');
if (dotp == NULL || dotp[1] == 0 ||
(baselen = dotp - tail) >= sizeof(base)) {
error("invalid pathname `%s'", path);
goto bad;
}
/*
* Ensure all tailnames are identical, because .o
* filenames must be identical too.
*/
if (tail1 &&
(dotp - tail != dotp1 - tail1 ||
strncmp(tail1, tail, dotp - tail)))
error("different production from %s %s",
nvpath->nv_name, tail);
tail1 = tail;
dotp1 = dotp;
}
/*
* Commit this file to memory. We will decide later whether it
* will be used after all.
*/
fi = emalloc(sizeof *fi);
if (ht_insert(pathtab, path, fi)) {
free(fi);
if ((fi = ht_lookup(pathtab, path)) == NULL)
panic("addfile: ht_lookup(%s)", path);
error("duplicate file %s", path);
xerror(fi->fi_srcfile, fi->fi_srcline,
"here is the original definition");
}
memcpy(base, tail, baselen);
base[baselen] = 0;
fi->fi_next = NULL;
fi->fi_srcfile = yyfile;
fi->fi_srcline = currentline();
fi->fi_flags = flags;
fi->fi_nvpath = nvpath;
fi->fi_base = intern(base);
fi->fi_optx = optx;
fi->fi_optf = NULL;
fi->fi_mkrule[0] = rule;
fi->fi_mkrule[1] = lintrule;
*nextfile = fi;
nextfile = &fi->fi_next;
return;
bad:
expr_free(optx);
}
开发者ID:7shi,项目名称:openbsd-crosstools,代码行数:83,代码来源:files.c
注:本文中的currentline函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论