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

C++ checkint函数代码示例

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

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



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

示例1: _exit

/***
Terminate the calling process.
@function _exit
@int status process exit status
@see _exit(2)
*/
static int
P_exit(lua_State *L)
{
	pid_t ret = checkint(L, 1);
	checknargs(L, 1);
	_exit(ret);
	return 0; /* Avoid a compiler warning (or possibly cause one
		     if the compiler's too clever, sigh). */
}
开发者ID:batrick,项目名称:luaposix,代码行数:15,代码来源:unistd.c


示例2: luaL_getn

int luaL_getn (lua_State *L, int t) {
  int n;
  t = abs_index(L, t);
  lua_pushliteral(L, "n");  /* try t.n */
  lua_rawget(L, t);
  if ((n = checkint(L, 1)) >= 0) return n;
  getsizes(L);  /* else try sizes[t] */
  lua_pushvalue(L, t);
  lua_rawget(L, -2);
  if ((n = checkint(L, 2)) >= 0) return n;
  for (n = 1; ; n++) {  /* else must count elements */
    lua_rawgeti(L, t, n);
    if (lua_isnil(L, -1)) break;
    lua_pop(L, 1);
  }
  lua_pop(L, 1);
  return n - 1;
}
开发者ID:segafan,项目名称:wme1_jankavan_tlc_edition-repo,代码行数:18,代码来源:lauxlib.c


示例3: slk_label

/***
Fetch the label for a soft label key.
@function slk_label
@int labnum
@treturn string current label for *labnum*
@see slk_label(3x)
*/
static int
Pslk_label(lua_State *L)
{
	int labnum = checkint(L, 1);
#if LCURSES_POSIX_COMPLIANT
	return pushstringresult(slk_label(labnum));
#else
	return binding_notimplemented(L, "slk_label", "curses");
#endif
}
开发者ID:lcurses,项目名称:lcurses,代码行数:17,代码来源:curses.c


示例4: slk_init

/***
Initialise the soft label keys area.
This must be called before @{initscr}.
@function slk_init
@int fmt
@treturn bool `true`, if successful
@see slk_init(3x)
*/
static int
Pslk_init(lua_State *L)
{
	int fmt = checkint(L, 1);
#if LCURSES_POSIX_COMPLIANT
	return pushokresult(slk_init(fmt));
#else
	return binding_notimplemented(L, "slk_init", "curses");
#endif
}
开发者ID:lcurses,项目名称:lcurses,代码行数:18,代码来源:curses.c


示例5: curs_set

/***
Change the visibility of the cursor.
@function curs_set
@int vis one of `0` (invisible), `1` (visible) or `2` (very visible)
@treturn[1] int previous cursor state
@return[2] nil if *vis* is not supported
@see curs_set(3x)
*/
static int
Pcurs_set(lua_State *L)
{
	int vis = checkint(L, 1);
	int state = curs_set(vis);
	if (state == ERR)
		return 0;

	return pushintresult(state);
}
开发者ID:lcurses,项目名称:lcurses,代码行数:18,代码来源:curses.c


示例6: send

/***
Send a message from a socket.
@function send
@int fd socket descriptor to act on
@string buffer message bytes to send
@treturn[1] int number of bytes sent, if successful
@return[2] nil
@treturn[2] string error message
@treturn[2] int errnum
@see send(2)
*/
static int
Psend(lua_State *L)
{
	int fd = checkint (L, 1);
	size_t len;
	const char *buf = luaL_checklstring(L, 2, &len);

	checknargs(L, 2);
	return pushresult(L, send(fd, buf, len, 0), "send");
}
开发者ID:fabgithub,项目名称:luaposix,代码行数:21,代码来源:socket.c


示例7: clock_gettime

/***
Read a clock.
@function clock_gettime
@int clk name of clock, one of `CLOCK_REALTIME`, `CLOCK_PROCESS_CPUTIME_ID`,
  `CLOCK_MONOTONIC` or `CLOCK_THREAD_CPUTIME_ID`
@treturn[1] PosixTimespec current value of *clk*, if successful
@return[2] nil
@treturn[2] string error message
@treturn[2] int errnum
@see clock_gettime(3)
*/
static int
Pclock_gettime(lua_State *L)
{
	struct timespec ts;
	int clk = checkint(L, 1);
	checknargs(L, 1);
	if (clock_gettime(clk, &ts) == -1)
		return pusherror(L, "clock_gettime");
	return pushtimespec(L, &ts);
}
开发者ID:tongson,项目名称:omnia,代码行数:21,代码来源:time.c


示例8: localtime

/***
Convert epoch time value to a broken-down local time.
@function localtime
@int t seconds since epoch
@treturn PosixTm broken-down time
@see localtime(3)
@see mktime
*/
static int
Plocaltime(lua_State *L)
{
	struct tm t;
	time_t epoch = checkint(L, 1);
	checknargs(L, 1);
	if (localtime_r(&epoch, &t) == NULL)
		return pusherror(L, "localtime");
	return pushtm(L, &t);
}
开发者ID:tongson,项目名称:omnia,代码行数:18,代码来源:time.c


示例9: clock_getres

/***
Find the precision of a clock.
@function clock_getres
@int clk name of clock, one of `CLOCK_REALTIME`, `CLOCK_PROCESS_CPUTIME_ID`,
  `CLOCK_MONOTONIC` or `CLOCK_THREAD_CPUTIME_ID`
@treturn[1] PosixTimespec resolution of *clk*, if successful
@return[2] nil
@treturn[2] string error message
@treturn[2] int errnum
@see clock_getres(3)
*/
static int
Pclock_getres(lua_State *L)
{
	struct timespec resolution;
	int clk = checkint(L, 1);
	checknargs(L, 1);
	if (clock_getres(clk, &resolution) == -1)
		return pusherror(L, "clock_getres");
	return pushtimespec(L, &resolution);
}
开发者ID:tongson,项目名称:omnia,代码行数:21,代码来源:time.c


示例10: all

/***
Bitwise OR of all (or selected) video attributes supported by the terminal.
@function termattrs
@int[opt] a terminal attribute bits
@treturn[1] bool `true`, if the terminal supports attribute *a*
@treturn[2] int bitarray of supported terminal attributes
@see termattrs(3x)
*/
static int
Ptermattrs(lua_State *L)
{
	if (lua_gettop(L) > 0)
	{
		int a = checkint(L, 1);
		return pushboolresult(termattrs() & a);
	}
	return pushintresult(termattrs());
}
开发者ID:lcurses,项目名称:lcurses,代码行数:18,代码来源:curses.c


示例11: checkch

static chtype
checkch(lua_State *L, int narg)
{
	if (lua_isnumber(L, narg))
		return (chtype)checkint(L, narg);
	if (lua_isstring(L, narg))
		return *lua_tostring(L, narg);

	return argtypeerror(L, narg, "int or char");
}
开发者ID:zevv,项目名称:luaposix,代码行数:10,代码来源:_helpers.c


示例12: fdopen

/***
Create a Lua file object from a file descriptor.
@function fdopen
@tparam int fd file descriptor
@tparam string mode the mode in which to open the file descriptor
@treturn[1] file file Lua file object *fd*, if successful
@return[2] nil
@treturn[2] string error message
@treturn[2] int errnum
@usage
local fdopen = require "posix.stdio".fdopen
local STDOUT_FILENO = require "posix.unistd".STDOUT_FILENO
stdout = fdopen (STDOUT_FILENO, "w")
*/
static int
Pfdopen(lua_State *L)	/** fdopen(fd, mode) */
{
	int fd = checkint(L, 1);
	const char *mode = luaL_checkstring(L, 2);
	checknargs(L, 2);
	if (!pushfile(L, fd, mode))
		return pusherror(L, "fdopen");
	return 1;
}
开发者ID:Nlcke,项目名称:luaposix,代码行数:24,代码来源:stdio.c


示例13: l_sqlite3_column_info

static int l_sqlite3_column_info(lua_State * L, const char * (*info_func)(sqlite3_stmt*,int) )
{
    const char * info = info_func(checkstmt_stmt(L, 1), checkint(L, 2));

    if (info)
        lua_pushstring(L, info);
    else
        lua_pushstring(L, "");

    return 1;
}
开发者ID:kkabdol,项目名称:GameCode4,代码行数:11,代码来源:libluasqlite3.c


示例14: ptsname

/***
Get the name of a slave pseudo-terminal
@function ptsname
@int fd descriptor returned by @{openpt}
@return[1] path name of the slave terminal device, if successful
@return[2] nil
@treturn[2] string error message
@treturn[2] int errnum
@see ptsname(3)
@see grantpt
@see unlockpt
*/
static int
Pptsname(lua_State *L)
{
	int fd=checkint(L, 1);
	const char* slave;
	checknargs(L, 1);
	slave = ptsname(fd);
	if (!slave)
		return pusherror(L, "getptsname");
	return pushstringresult(slave);
}
开发者ID:istr,项目名称:luaposix,代码行数:23,代码来源:stdlib.c


示例15: connect

/***
Initiate a connection on a socket.
@function connect
@int fd socket descriptor to act on
@tparam sockaddr addr socket address
@treturn[1] int `0`, if successful
@return[2] nil
@treturn[2] string error message
@treturn[2] int errnum
@see connect(2)
*/
static int
Pconnect(lua_State *L)
{
	struct sockaddr_storage sa;
	socklen_t salen;
	int fd = checkint(L, 1);
	checknargs (L, 2);
	if (sockaddr_from_lua(L, 2, &sa, &salen) != 0)
		return pusherror(L, "not a valid IPv4 dotted-decimal or IPv6 address string");

	return pushresult(L, connect(fd, (struct sockaddr *)&sa, salen), "connect");
}
开发者ID:fabgithub,项目名称:luaposix,代码行数:23,代码来源:socket.c


示例16: read

/***
Read bytes from a file.
@function read
@int fd the file descriptor to act on
@int count maximum number of bytes to read
@treturn[1] string string from *fd* with at most *count* bytes, if successful
@return[2] nil
@treturn[2] string error message
@treturn[2] int errnum
@see read(2)
*/
static int
Pread(lua_State *L)
{
	int fd = checkint(L, 1);
	int count = checkint(L, 2), ret;
	void *ud, *buf;
	lua_Alloc lalloc;

	checknargs(L, 2);
	lalloc = lua_getallocf(L, &ud);

	/* Reset errno in case lalloc doesn't set it */
	errno = 0;
	if ((buf = lalloc(ud, NULL, 0, count)) == NULL && count > 0)
		return pusherror(L, "lalloc");

	ret = read(fd, buf, count);
	if (ret >= 0)
		lua_pushlstring(L, buf, ret);
	lalloc(ud, buf, count, 0);
	return (ret < 0) ? pusherror(L, NULL) : 1;
}
开发者ID:batrick,项目名称:luaposix,代码行数:33,代码来源:unistd.c


示例17: CvBGCodeBookModel_nmodMax

static int CvBGCodeBookModel_nmodMax(lua_State *L)
{
    const char f_msg[]=CVBGCODEBOOKMODEL_NAME".modMax={int, int, int}";
    CvBGCodeBookModel *s=checkCvBGCodeBookModel(L,1);
    if ((!lua_istable(L,3))||(lua_objlen(L,3)!=3)) luaL_error(L,f_msg);
    for(int i=0;i<3;i++) 
    {
      lua_rawgeti(L,3,i+1);
      s->modMax[i]=(uchar)checkint(L,4);
      lua_pop(L,1);
    }
    return 0;
}
开发者ID:HydraFramework,项目名称:HydraDependencyPods,代码行数:13,代码来源:CvBGCodeBookModel.cpp


示例18: sendto

/***
Send a message from a socket.
@function sendto
@int fd socket descriptor to act on
@string buffer message bytes to send
@tparam sockaddr destination socket address
@treturn[1] int number of bytes sent, if successful
@return[2] nil
@treturn[2] string error message
@treturn[2] int errnum
@see sendto(2)
*/
static int
Psendto(lua_State *L)
{
	size_t len;
	int fd = checkint(L, 1);
	const char *buf = luaL_checklstring(L, 2, &len);
	struct sockaddr_storage sa;
	socklen_t salen;
	checknargs (L, 3);
	if (sockaddr_from_lua(L, 3, &sa, &salen) != 0)
		return pusherror (L, "not a valid IPv4 dotted-decimal or IPv6 address string");

	return pushresult(L, sendto(fd, buf, len, 0, (struct sockaddr *)&sa, salen), "sendto");
}
开发者ID:fabgithub,项目名称:luaposix,代码行数:26,代码来源:socket.c


示例19: can_change_color

/***
Return the foreground and background colors associated with a color pair id.
@function pair_content
@int pair color pair id to act on
@treturn int foreground color of *pair*
@treturn int background color of *pair*
@see can_change_color(3x)
@see init_pair
*/
static int
Ppair_content(lua_State *L)
{
	short pair = checkint(L, 1);
	short f;
	short b;
	int ret = pair_content(pair, &f, &b);

	if (ret == ERR)
		return 0;

	lua_pushinteger(L, f);
	lua_pushinteger(L, b);
	return 2;
}
开发者ID:lcurses,项目名称:lcurses,代码行数:24,代码来源:curses.c


示例20: luaL_setn

LUALIB_API void luaL_setn (lua_State *L, int t, int n) {
  t = abs_index(L, t);
  lua_pushliteral(L, "n");
  lua_rawget(L, t);
  if (checkint(L, 1) >= 0) {  /* is there a numeric field `n'? */
    lua_pushliteral(L, "n");  /* use it */
    lua_pushinteger(L, n);
    lua_rawset(L, t);
  }
  else {  /* use `sizes' */
    getsizes(L);
    lua_pushvalue(L, t);
    lua_pushinteger(L, n);
    lua_rawset(L, -3);  /* sizes[t] = n */
    lua_pop(L, 1);  /* remove `sizes' */
  }
}
开发者ID:dreamsxin,项目名称:ultimatepp,代码行数:17,代码来源:lauxlib.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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