本文整理汇总了C++中check_capture函数的典型用法代码示例。如果您正苦于以下问题:C++ check_capture函数的具体用法?C++ check_capture怎么用?C++ check_capture使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了check_capture函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: add_s
static void add_s (MatchState *ms, luaL_Buffer *b,
const lua_WChar *s, const lua_WChar *e) {
lua_State *L = ms->L;
if (lua_iswstring(L, 3)) {
const lua_WChar *news = lua_towstring(L, 3);
size_t l = lua_strlen(L, 3);
size_t i;
for (i=0; i<l; i++) {
if (news[i] != ESC)
luaL_putwchar(b, news[i]);
else {
i++; /* skip ESC */
if (!iswdigit(news[i]))
luaL_putwchar(b, news[i]);
else {
int level = check_capture(ms, news[i]);
push_onecapture(ms, level);
luaL_addvalue(b); /* add capture to accumulated result */
}
}
}
}
else { /* is a function */
int n;
lua_pushvalue(L, 3);
n = push_captures(ms, s, e);
lua_call(L, n, 1);
if (lua_iswstring(L, -1))
luaL_addvalue(b); /* add return to accumulated result */
else
lua_pop(L, 1); /* function result is not a string: pop it */
}
}
开发者ID:anissen,项目名称:WikiAdventure,代码行数:33,代码来源:lwstrlib.c
示例2: add_s
static void add_s (lua_State *L, luaL_Buffer *b, struct Capture *cap) {
if (lua_isstring(L, 3)) {
const char *news = lua_tostring(L, 3);
size_t l = lua_strlen(L, 3);
size_t i;
for (i=0; i<l; i++) {
if (news[i] != ESC)
luaL_putchar(b, news[i]);
else {
i++; /* skip ESC */
if (!isdigit((unsigned char)news[i]))
luaL_putchar(b, news[i]);
else {
int level = check_capture(L, news[i], cap);
luaL_addlstring(b, cap->capture[level].init, cap->capture[level].len);
}
}
}
}
else { /* is a function */
int n;
lua_pushvalue(L, 3);
n = push_captures(L, cap);
lua_rawcall(L, n, 1);
if (lua_isstring(L, -1))
luaL_addvalue(b); /* add return to accumulated result */
else
lua_pop(L, 1); /* function result is not a string: pop it */
}
}
开发者ID:BackupTheBerlios,项目名称:gltron-svn,代码行数:30,代码来源:lstrlib.c
示例3: check_capture
static const char *match_capture (MatchState *ms, const char *s, int l) {
size_t len;
l = check_capture(ms, l);
len = ms->capture[l].len;
if ((size_t)(ms->src_end-s) >= len &&
memcmp(ms->capture[l].init, s, len) == 0)
return s+len;
else return NULL;
}
开发者ID:aronarts,项目名称:FireNET,代码行数:9,代码来源:lstrlib.c
示例4: check_capture
static const char *match_capture (lua_State *L, const char *s, int level,
struct Capture *cap) {
int l = check_capture(L, level, cap);
size_t len = cap->capture[l].len;
if ((size_t)(cap->src_end-s) >= len &&
memcmp(cap->capture[l].init, s, len) == 0)
return s+len;
else return NULL;
}
开发者ID:BackupTheBerlios,项目名称:gltron-svn,代码行数:9,代码来源:lstrlib.c
示例5: dev_info
void dev_info(const char *regex) {
int err, idx;
pcap_if_t *devs = NULL, *cur;
char errbuf[PCAP_ERRBUF_SIZE];
bool dev_found = false;
bool rfmon_ok, promisc_ok, capture_ok;
err = pcap_findalldevs(&devs, errbuf);
if(err)
die(0, "%s", errbuf);
for(idx = 0, cur = devs; cur; cur = cur->next, ++idx)
if(regex_matches_or_is_null(regex, cur->name)) {
dev_found = true;
errbuf[0] = '\0';
capture_ok = check_capture(errbuf, cur->name);
rfmon_ok = capture_ok ? check_rfmon(cur->name) : false;
promisc_ok = capture_ok ? check_promisc(cur->name) : false;
printf("%3d: ", idx);
printf("%-22s %s%s%s%s%s%s\n", cur->name
, cur->flags & PCAP_IF_LOOPBACK ? "[loopback]" : ""
, cur->flags & PCAP_IF_UP ? "[up]" : "[down]"
, cur->flags & PCAP_IF_RUNNING ? "[running]" : ""
, promisc_ok ? "[promisc_ok]" : ""
, rfmon_ok ? "[rfmon_ok]" : ""
, capture_ok ? "[usable]" : "[unusable]");
if(options.verbose) {
if(cur->description)
printf(" %s\n", cur->description);
if(errbuf[0])
printf(" %s\n", errbuf);
print_pcap_addrs(cur->addresses);
print_datalinks(cur->name);
print_timestamp_types(cur->name);
}
}
if(!dev_found)
fprintf(stderr, "No matching devices found\n");
pcap_freealldevs(devs);
}
开发者ID:protoben,项目名称:protodump,代码行数:46,代码来源:capture.c
注:本文中的check_capture函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论