本文整理汇总了C++中end_capture函数的典型用法代码示例。如果您正苦于以下问题:C++ end_capture函数的具体用法?C++ end_capture怎么用?C++ end_capture使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了end_capture函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: execute_button_clicked
static void execute_button_clicked(struct trace_capture *cap)
{
struct stat st;
GtkResponseType ret;
const char *filename;
char *tracecmd;
if (end_capture(cap))
return;
tracecmd = find_tracecmd();
if (!tracecmd) {
warning("trace-cmd not found in path");
return;
}
free(tracecmd);
filename = gtk_entry_get_text(GTK_ENTRY(cap->file_entry));
if (stat(filename, &st) >= 0) {
ret = trace_dialog(GTK_WINDOW(cap->main_dialog), TRACE_GUI_ASK,
"The file '%s' already exists.\n"
"Are you sure you want to replace it",
filename);
if (ret == GTK_RESPONSE_NO)
return;
}
gtk_button_set_label(GTK_BUTTON(cap->run_button), CAP_STOP);
run_command(cap);
}
开发者ID:feedcafe,项目名称:trace-cmd,代码行数:31,代码来源:trace-capture.c
示例2: csStopCapture
/** Codel csStopCapture of activity CaptureSound.
*
* Triggered by capture_end, capture_stop.
* Yields to capture_ether.
<<<<<<< user version
* Throws capture_BUFFER_OVERRUN, capture_BUFFER_UNDERRUN.
=======
* Throws capture_BUFFER_UNDERRUN, capture_BUFFER_OVERRUN.
>>>>>>> template version
*/
genom_event
csStopCapture(void)
{
printf("Stopping sound capture.\n");
end_capture(&_capture_params);
//DBG: Save Big Buffer to text file
#ifdef DBG
_fp = fopen("home/boris/Bureau/cap.txt","w");
if(_fp==NULL){
printf("Cannot open file.\n");
int errnum = errno;
fprintf(stderr, "Value of errno: %d\n", errno);
perror("Error printed by perror");
fprintf(stderr, "Error opening file: %s\n", strerror( errnum ));
}
int ii;
for(ii=0;ii<max_length;++ii){
fprintf(_fp,"%f %f\n",buf_l[ii],buf_r[ii]);
}
fclose(_fp);
free(buf_l);
free(buf_r);
#endif
return capture_ether;
}
开发者ID:ndoxx,项目名称:CaptureModule,代码行数:37,代码来源:capture_retrieve_codels.c
示例3: switch
static const char *match (lua_State *L, const char *s, const char *p,
struct Capture *cap) {
init: /* using goto's to optimize tail recursion */
switch (*p) {
case '(': /* start capture */
return start_capture(L, s, p, cap);
case ')': /* end capture */
return end_capture(L, s, p, cap);
case ESC: /* may be %[0-9] or %b */
if (isdigit((unsigned char)(*(p+1)))) { /* capture? */
s = match_capture(L, s, *(p+1), cap);
if (s == NULL) return NULL;
p+=2;
goto init; /* else return match(L, s, p+2, cap) */
}
else if (*(p+1) == 'b') { /* balanced string? */
s = matchbalance(L, s, p+2, cap);
if (s == NULL) return NULL;
p+=4;
goto init; /* else return match(L, s, p+4, cap); */
}
else goto dflt; /* case default */
case '\0': /* end of pattern */
return s; /* match succeeded */
case '$':
if (*(p+1) == '\0') /* is the '$' the last char in pattern? */
return (s == cap->src_end) ? s : NULL; /* check end of string */
else goto dflt;
default:
dflt: { /* it is a pattern item */
const char *ep = luaI_classend(L, p); /* points to what is next */
int m = s<cap->src_end && luaI_singlematch((unsigned char)*s, p, ep);
switch (*ep) {
case '?': { /* optional */
const char *res;
if (m && ((res=match(L, s+1, ep+1, cap)) != NULL))
return res;
p=ep+1;
goto init; /* else return match(L, s, ep+1, cap); */
}
case '*': /* 0 or more repetitions */
return max_expand(L, s, p, ep, cap);
case '+': /* 1 or more repetitions */
return (m ? max_expand(L, s+1, p, ep, cap) : NULL);
case '-': /* 0 or more repetitions (minimum) */
return min_expand(L, s, p, ep, cap);
default:
if (!m) return NULL;
s++;
p=ep;
goto init; /* else return match(L, s+1, ep, cap); */
}
}
}
}
开发者ID:BackupTheBerlios,项目名称:gltron-svn,代码行数:55,代码来源:lstrlib.c
示例4: cb_StartCam
static void cb_StartCam( Fl_Widget*, void* )
{
if( started )
cb_PauseResume(0,0);
end_capture();
#ifdef WIN32
Sleep(10);
#endif
is_avi = 0;
capture = cvCaptureFromCAM( -1 );
cb_PauseResume(0,0);
}
开发者ID:JackJone,项目名称:opencv,代码行数:12,代码来源:facedetect.cpp
示例5: switch
static const lua_WChar *match (MatchState *ms, const lua_WChar *s, const lua_WChar *p) {
init: /* using goto's to optimize tail recursion */
switch (*p) {
case '(': /* start capture */
if (*(p+1) == ')') /* position capture? */
return start_capture(ms, s, p+2, CAP_POSITION);
else
return start_capture(ms, s, p+1, CAP_UNFINISHED);
case ')': /* end capture */
return end_capture(ms, s, p+1);
case ESC: /* may be %[0-9] or %b */
if (iswdigit(*(p+1))) { /* capture? */
s = match_capture(ms, s, *(p+1));
if (s == NULL) return NULL;
p+=2; goto init; /* else return match(ms, s, p+2) */
}
else if (*(p+1) == 'b') { /* balanced string? */
s = matchbalance(ms, s, p+2);
if (s == NULL) return NULL;
p+=4; goto init; /* else return match(ms, s, p+4); */
}
else goto dflt; /* case default */
case '\0': /* end of pattern */
return s; /* match succeeded */
case '$':
if (*(p+1) == '\0') /* is the `$' the last char in pattern? */
return (s == ms->src_end) ? s : NULL; /* check end of string */
else goto dflt;
default: dflt: { /* it is a pattern item */
const lua_WChar *ep = luaI_classend(ms, p); /* points to what is next */
int m = s<ms->src_end && luaI_singlematch(*s, p, ep);
switch (*ep) {
case '?': { /* optional */
const lua_WChar *res;
if (m && ((res=match(ms, s+1, ep+1)) != NULL))
return res;
p=ep+1; goto init; /* else return match(ms, s, ep+1); */
}
case '*': /* 0 or more repetitions */
return max_expand(ms, s, p, ep);
case '+': /* 1 or more repetitions */
return (m ? max_expand(ms, s+1, p, ep) : NULL);
case '-': /* 0 or more repetitions (minimum) */
return min_expand(ms, s, p, ep);
default:
if (!m) return NULL;
s++; p=ep; goto init; /* else return match(ms, s+1, ep); */
}
}
}
}
开发者ID:anissen,项目名称:WikiAdventure,代码行数:51,代码来源:lwstrlib.c
示例6: cb_StartAVI
static void cb_StartAVI( const char* newfile, int start_pos, int was_started )
{
if( newfile != 0 )
{
end_capture();
capture = cvCaptureFromAVI( newfile );
if( capture )
{
was_started = 1;
if( start_pos != 0 )
cvSetCaptureProperty( capture, CV_CAP_PROP_POS_FRAMES, start_pos );
}
is_avi = 1;
}
if( was_started )
cb_PauseResume(0,0);
}
开发者ID:JackJone,项目名称:opencv,代码行数:18,代码来源:facedetect.cpp
示例7: switch
static const char *match (MatchState *ms, const char *s, const char *p) {
init: /* using goto's to optimize tail recursion */
switch (*p) {
case '(': { /* start capture */
if (*(p+1) == ')') /* position capture? */
return start_capture(ms, s, p+2, CAP_POSITION);
else
return start_capture(ms, s, p+1, CAP_UNFINISHED);
}
case ')': { /* end capture */
return end_capture(ms, s, p+1);
}
case L_ESC: {
switch (*(p+1)) {
case 'b': { /* balanced string? */
s = matchbalance(ms, s, p+2);
if (s == NULL) return NULL;
p+=4; goto init; /* else return match(ms, s, p+4); */
}
case 'f': { /* frontier? */
const char *ep; char previous;
p += 2;
if (*p != '[')
luaL_error(ms->L, "missing " LUA_QL("[") " after "
LUA_QL("%%f") " in pattern");
ep = classend(ms, p); /* points to what is next */
previous = (s == ms->src_init) ? '\0' : *(s-1);
if (matchbracketclass(uchar(previous), p, ep-1) ||
!matchbracketclass(uchar(*s), p, ep-1)) return NULL;
p=ep; goto init; /* else return match(ms, s, ep); */
}
default: {
if (isdigit(uchar(*(p+1)))) { /* capture results (%0-%9)? */
s = match_capture(ms, s, uchar(*(p+1)));
if (s == NULL) return NULL;
p+=2; goto init; /* else return match(ms, s, p+2) */
}
goto dflt; /* case default */
}
}
}
case '\0': { /* end of pattern */
return s; /* match succeeded */
}
case '$': {
if (*(p+1) == '\0') /* is the `$' the last char in pattern? */
return (s == ms->src_end) ? s : NULL; /* check end of string */
else goto dflt;
}
default: dflt: { /* it is a pattern item */
const char *ep = classend(ms, p); /* points to what is next */
int m = s<ms->src_end && singlematch(uchar(*s), p, ep);
switch (*ep) {
case '?': { /* optional */
const char *res;
if (m && ((res=match(ms, s+1, ep+1)) != NULL))
return res;
p=ep+1; goto init; /* else return match(ms, s, ep+1); */
}
case '*': { /* 0 or more repetitions */
return max_expand(ms, s, p, ep);
}
case '+': { /* 1 or more repetitions */
return (m ? max_expand(ms, s+1, p, ep) : NULL);
}
case '-': { /* 0 or more repetitions (minimum) */
return min_expand(ms, s, p, ep);
}
default: {
if (!m) return NULL;
s++; p=ep; goto init; /* else return match(ms, s+1, ep); */
}
}
}
}
}
开发者ID:aronarts,项目名称:FireNET,代码行数:76,代码来源:lstrlib.c
示例8: match
static const char *
match(struct match_state *ms, const char *s, const char *p)
{
const char *ep, *res;
char previous;
if (ms->matchdepth-- == 0) {
match_error(ms, "pattern too complex");
return (NULL);
}
/* using goto's to optimize tail recursion */
init:
/* end of pattern? */
if (p != ms->p_end) {
switch (*p) {
case '(':
/* start capture */
if (*(p + 1) == ')')
/* position capture? */
s = start_capture(ms, s, p + 2, CAP_POSITION);
else
s = start_capture(ms, s, p + 1, CAP_UNFINISHED);
break;
case ')':
/* end capture */
s = end_capture(ms, s, p + 1);
break;
case '$':
/* is the '$' the last char in pattern? */
if ((p + 1) != ms->p_end) {
/* no; go to default */
goto dflt;
}
/* check end of string */
s = (s == ms->src_end) ? s : NULL;
break;
case L_ESC:
/* escaped sequences not in the format class[*+?-]? */
switch (*(p + 1)) {
case 'b':
/* balanced string? */
s = matchbalance(ms, s, p + 2);
if (s != NULL) {
p += 4;
/* return match(ms, s, p + 4); */
goto init;
} /* else fail (s == NULL) */
break;
case 'f':
/* frontier? */
p += 2;
if (*p != '[') {
match_error(ms, "missing '['"
" after '%f' in pattern");
break;
}
/* points to what is next */
ep = classend(ms, p);
if (ms->error != NULL)
break;
previous =
(s == ms->src_init) ? '\0' : *(s - 1);
if (!matchbracketclass(uchar(previous),
p, ep - 1) &&
matchbracketclass(uchar(*s),
p, ep - 1)) {
p = ep;
/* return match(ms, s, ep); */
goto init;
}
/* match failed */
s = NULL;
break;
case '0' ... '9':
/* capture results (%0-%9)? */
s = match_capture(ms, s, uchar(*(p + 1)));
if (s != NULL) {
p += 2;
/* return match(ms, s, p + 2) */
goto init;
}
break;
default:
goto dflt;
}
break;
default:
/* pattern class plus optional suffix */
dflt:
/* points to optional suffix */
ep = classend(ms, p);
if (ms->error != NULL)
break;
/* does not match at least once? */
if (!singlematch(ms, s, p, ep)) {
if (ms->repetitioncounter-- == 0) {
match_error(ms, "max repetition items");
//.........这里部分代码省略.........
开发者ID:Frankie-666,项目名称:lwan,代码行数:101,代码来源:patterns.c
示例9: luaL_error
static const char *match (MatchState *ms, const char *s, const char *p) {
if (ms->matchdepth-- == 0)
luaL_error(ms->L, "pattern too complex");
init: /* using goto's to optimize tail recursion */
if (p != ms->p_end) { /* end of pattern? */
switch (*p) {
case '(': { /* start capture */
if (*(p + 1) == ')') /* position capture? */
s = start_capture(ms, s, p + 2, CAP_POSITION);
else
s = start_capture(ms, s, p + 1, CAP_UNFINISHED);
break;
}
case ')': { /* end capture */
s = end_capture(ms, s, p + 1);
break;
}
case '$': {
if ((p + 1) != ms->p_end) /* is the `$' the last char in pattern? */
goto dflt; /* no; go to default */
s = (s == ms->src_end) ? s : NULL; /* check end of string */
break;
}
case L_ESC: { /* escaped sequences not in the format class[*+?-]? */
switch (*(p + 1)) {
case 'b': { /* balanced string? */
s = matchbalance(ms, s, p + 2);
if (s != NULL) {
p += 4; goto init; /* return match(ms, s, p + 4); */
} /* else fail (s == NULL) */
break;
}
case 'f': { /* frontier? */
const char *ep; char previous;
p += 2;
if (*p != '[')
luaL_error(ms->L, "missing " LUA_QL("[") " after "
LUA_QL("%%f") " in pattern");
ep = classend(ms, p); /* points to what is next */
previous = (s == ms->src_init) ? '\0' : *(s - 1);
if (!matchbracketclass(uchar(previous), p, ep - 1) &&
matchbracketclass(uchar(*s), p, ep - 1)) {
p = ep; goto init; /* return match(ms, s, ep); */
}
s = NULL; /* match failed */
break;
}
case '0': case '1': case '2': case '3':
case '4': case '5': case '6': case '7':
case '8': case '9': { /* capture results (%0-%9)? */
s = match_capture(ms, s, uchar(*(p + 1)));
if (s != NULL) {
p += 2; goto init; /* return match(ms, s, p + 2) */
}
break;
}
default: goto dflt;
}
break;
}
default: dflt: { /* pattern class plus optional suffix */
const char *ep = classend(ms, p); /* points to optional suffix */
/* does not match at least once? */
if (!singlematch(ms, s, p, ep)) {
if (*ep == '*' || *ep == '?' || *ep == '-') { /* accept empty? */
p = ep + 1; goto init; /* return match(ms, s, ep + 1); */
}
else /* '+' or no suffix */
s = NULL; /* fail */
}
else { /* matched once */
switch (*ep) { /* handle optional suffix */
case '?': { /* optional */
const char *res;
if ((res = match(ms, s + 1, ep + 1)) != NULL)
s = res;
else {
p = ep + 1; goto init; /* else return match(ms, s, ep + 1); */
}
break;
}
case '+': /* 1 or more repetitions */
s++; /* 1 match already done */
/* go through */
case '*': /* 0 or more repetitions */
s = max_expand(ms, s, p, ep);
break;
case '-': /* 0 or more repetitions (minimum) */
s = min_expand(ms, s, p, ep);
break;
default: /* no suffix */
s++; p = ep; goto init; /* return match(ms, s + 1, ep); */
}
}
break;
}
}
}
ms->matchdepth++;
return s;
//.........这里部分代码省略.........
开发者ID:dgkang,项目名称:skynet_v0.1_with_notes,代码行数:101,代码来源:lstrlib.c
示例10: switch
static const char *match(LuaMatchState *ms, const char *s, const char *p)
{
init: // using goto's to optimize tail recursion
if (p == ms->p_end) // end of pattern?
return s; // match succeeded
switch (*p)
{
case '(': { // start capture
if (*(p+1) == ')') // position capture?
return start_capture(ms, s, p+2, CAP_POSITION);
else
return start_capture(ms, s, p+1, CAP_UNFINISHED);
}
case ')': { // end capture
return end_capture(ms, s, p+1);
}
case '$': {
if ((p+1) == ms->p_end) // is the `$' the last char in pattern?
return (s == ms->src_end) ? s : NULL; // check end of string
else goto dflt;
}
case L_ESC: { // escaped sequences not in the format class[*+?-]?
switch (*(p+1)) {
case 'b': { // balanced string?
s = matchbalance(ms, s, p+2);
if (s == NULL) return NULL;
p+=4; goto init; // else return match(ms, s, p+4);
}
case 'f': { // frontier?
const char *ep; char previous;
p += 2;
if (*p != '['){
ms->error = "missing " LUA_QL("[") " after "
LUA_QL("%%f") " in pattern";
return NULL;
}
if(!classend(ms, p, &ep)) return NULL; // points to what is next
previous = (s == ms->src_init) ? '\0' : *(s-1);
if (matchbracketclass(uchar(previous), p, ep-1) ||
!matchbracketclass(uchar(*s), p, ep-1)) return NULL;
p=ep; goto init; // else return match(ms, s, ep);
}
case '0': case '1': case '2': case '3':
case '4': case '5': case '6': case '7':
case '8': case '9': { // capture results (%0-%9)?
s = match_capture(ms, s, uchar(*(p+1)));
if (s == NULL) return NULL;
p+=2; goto init; // else return match(ms, s, p+2)
}
default: goto dflt;
}
}
default: dflt: { // pattern class plus optional suffix
const char *ep;
int m;
if(!classend(ms, p, &ep)) return NULL; // points to what is next
m = s < ms->src_end && singlematch(uchar(*s), p, ep);
switch (*ep) {
case '?': { // optional
const char *res;
if (m && ((res=match(ms, s+1, ep+1)) != NULL))
return res;
p=ep+1; goto init; // else return match(ms, s, ep+1);
}
case '*': { // 0 or more repetitions
return max_expand(ms, s, p, ep);
}
case '+': { // 1 or more repetitions
return (m ? max_expand(ms, s+1, p, ep) : NULL);
}
case '-': { // 0 or more repetitions (minimum)
return min_expand(ms, s, p, ep);
}
default: {
if (!m) return NULL;
s++; p=ep; goto init; // else return match(ms, s+1, ep);
}
}
}
}
}
开发者ID:apitests,项目名称:libjl777,代码行数:81,代码来源:lua-regex.c
示例11: gdk_threads_enter
static void *monitor_pipes(void *data)
{
struct trace_capture *cap = data;
GtkTextIter start_iter;
GtkTextIter cut_iter;
GtkTextIter iter;
gchar buf[BUFSIZ+1];
struct timeval tv;
const char *val;
fd_set fds;
gboolean eof;
int max_size;
int total;
int del;
int ret;
int r;
gdk_threads_enter();
/* get the max size */
val = gtk_entry_get_text(GTK_ENTRY(cap->max_num_entry));
max_size = atoi(val);
/* Clear the buffer */
gtk_text_buffer_get_start_iter(cap->output_buffer, &start_iter);
gtk_text_buffer_get_end_iter(cap->output_buffer, &cut_iter);
gtk_text_buffer_delete(cap->output_buffer, &start_iter, &cut_iter);
total = 0;
gdk_threads_leave();
do {
FD_ZERO(&fds);
FD_SET(cap->command_input_fd, &fds);
tv.tv_sec = 6;
tv.tv_usec = 0;
ret = select(cap->command_input_fd+1, &fds, NULL, NULL, &tv);
if (ret < 0)
break;
eof = TRUE;
while ((r = read(cap->command_input_fd, buf, BUFSIZ)) > 0) {
eof = FALSE;
buf[r] = 0;
total += r;
if (total > max_size)
del = total - max_size;
else
del = 0;
gdk_threads_enter();
if (del) {
gtk_text_buffer_get_start_iter(cap->output_buffer, &start_iter);
gtk_text_buffer_get_start_iter(cap->output_buffer, &cut_iter);
gtk_text_iter_forward_chars(&cut_iter, del);
gtk_text_buffer_delete(cap->output_buffer, &start_iter, &cut_iter);
total -= del;
}
gtk_text_buffer_get_end_iter(cap->output_buffer,
&iter);
gtk_text_buffer_insert(cap->output_buffer, &iter, buf, -1);
gdk_threads_leave();
}
} while (!cap->capture_done && !eof);
if (eof) {
gdk_threads_enter();
end_capture(cap);
gdk_threads_leave();
}
pthread_exit(NULL);
}
开发者ID:feedcafe,项目名称:trace-cmd,代码行数:70,代码来源:trace-capture.c
示例12: tracing_dialog
//.........这里部分代码省略.........
gtk_widget_show(scrollwin);
viewport = gtk_viewport_new(NULL, NULL);
gtk_widget_show(viewport);
gtk_container_add(GTK_CONTAINER(scrollwin), viewport);
textview = gtk_text_view_new();
buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(textview));
gtk_container_add(GTK_CONTAINER(viewport), textview);
gtk_widget_show(textview);
cap.output_text = textview;
cap.output_buffer = buffer;
/* set the buffer from its previous setting */
if (info->cap_buffer_output)
gtk_text_buffer_set_text(buffer, info->cap_buffer_output,
strlen(info->cap_buffer_output));
hbox = gtk_hbox_new(FALSE, 0);
gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
gtk_widget_show(hbox);
label = gtk_label_new("Max # of characters in output display: ");
gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
gtk_widget_show(label);
entry = gtk_entry_new();
gtk_box_pack_start(GTK_BOX(hbox), entry, FALSE, FALSE, 0);
gtk_widget_show(entry);
cap.max_num_entry = entry;
if (!info->cap_max_buf_size)
info->cap_max_buf_size = DEFAULT_MAX_BUF_SIZE;
str = g_string_new("");
g_string_append_printf(str, "%d", info->cap_max_buf_size);
gtk_entry_set_text(GTK_ENTRY(entry), str->str);
g_string_free(str, TRUE);
g_signal_connect (entry, "insert-text",
G_CALLBACK (insert_text),
(gpointer)&cap);
gtk_widget_set_size_request(GTK_WIDGET(dialog),
DIALOG_WIDTH, DIALOG_HEIGHT);
gtk_widget_show(dialog);
cont:
result = gtk_dialog_run(GTK_DIALOG(dialog));
if (result == GTK_RESPONSE_ACCEPT) {
execute_button_clicked(&cap);
goto cont;
}
/* Make sure no capture is running */
end_capture(&cap);
/* Get the max buffer size */
val = gtk_entry_get_text(GTK_ENTRY(entry));
info->cap_max_buf_size = atoi(val);
gtk_text_buffer_get_start_iter(cap.output_buffer, &start_iter);
gtk_text_buffer_get_end_iter(cap.output_buffer, &end_iter);
g_free(info->cap_buffer_output);
info->cap_buffer_output = gtk_text_buffer_get_text(cap.output_buffer,
&start_iter,
&end_iter,
FALSE);
/* save the plugin and file to reuse if we come back */
update_plugin(&cap);
free(info->cap_file);
cap.info->cap_file = strdup(gtk_entry_get_text(GTK_ENTRY(cap.file_entry)));
free(info->cap_command);
command = gtk_entry_get_text(GTK_ENTRY(cap.command_entry));
if (command && strlen(command) && !is_just_ws(command))
cap.info->cap_command = strdup(command);
else
cap.info->cap_command = NULL;
update_events(&cap);
gtk_widget_destroy(dialog);
if (pevent)
pevent_free(pevent);
if (plugins)
tracecmd_free_list(plugins);
}
开发者ID:feedcafe,项目名称:trace-cmd,代码行数:101,代码来源:trace-capture.c
注:本文中的end_capture函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论