本文整理汇总了C++中CTRACE函数的典型用法代码示例。如果您正苦于以下问题:C++ CTRACE函数的具体用法?C++ CTRACE怎么用?C++ CTRACE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CTRACE函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CTRACE
/*
* Find the EXTERNAL command which matches the given name 'param'. If there is
* more than one possibility, make a popup menu of the matching commands and
* allow the user to select one. Return the selected command.
*/
static char *lookup_external(char *param,
int only_overriders)
{
int pass, num_disabled, num_matched, num_choices, cur_choice;
size_t length = 0;
char *cmdbuf = NULL;
char **actions = 0;
char **choices = 0;
lynx_list_item_type *ptr = 0;
for (pass = 0; pass < 2; pass++) {
num_disabled = 0;
num_matched = 0;
num_choices = 0;
for (ptr = externals; ptr != 0; ptr = ptr->next) {
if (match_item_by_name(ptr, param, only_overriders)) {
++num_matched;
CTRACE((tfp, "EXTERNAL: '%s' <==> '%s'\n", ptr->name, param));
if (no_externals && !ptr->always_enabled && !only_overriders) {
++num_disabled;
} else {
if (pass == 0) {
length++;
} else if (pass != 0) {
cmdbuf = format_command(ptr->command, param);
if (length > 1) {
actions[num_choices] = cmdbuf;
choices[num_choices] =
format_command(ptr->menu_name, param);
}
}
num_choices++;
}
}
}
if (length > 1) {
if (pass == 0) {
actions = typecallocn(char *, length + 1);
choices = typecallocn(char *, length + 1);
if (actions == 0 || choices == 0)
outofmem(__FILE__, "lookup_external");
} else {
actions[num_choices] = 0;
choices[num_choices] = 0;
}
}
示例2: ARGS1
int HTLoadRules ARGS1(CONST char *, filename)
{
FILE * fp = fopen(filename, "r");
char line[LINE_LENGTH+1];
if (!fp) {
CTRACE(stderr, "HTRules: Can't open rules file %s\n", filename);
return -1; /* File open error */
}
for(;;) {
if (!fgets(line, LINE_LENGTH+1, fp)) break; /* EOF or error */
(void) HTSetConfiguration(line);
}
fclose(fp);
return 0; /* No error or syntax errors ignored */
}
示例3: ARGS2
/* Create a chunk with a certain allocation unit and ensured size
** --------------
*/
PUBLIC HTChunk * HTChunkCreate2 ARGS2 (int,grow, size_t, needed)
{
HTChunk * ch = typecalloc(HTChunk);
if (ch == NULL)
outofmem(__FILE__, "HTChunkCreate2");
HTChunkInit (ch, grow);
if (needed > 0) {
ch->allocated = needed-1 - ((needed-1) % ch->growby)
+ ch->growby; /* Round up */
CTRACE((tfp, "HTChunkCreate2: requested %d, allocate %d\n",
(int) needed, ch->allocated));
ch->data = typecallocn(char, ch->allocated);
if (!ch->data)
outofmem(__FILE__, "HTChunkCreate2 data");
}
示例4: ARGS1
PRIVATE int HTCloseGzFile ARGS1(
gzFile, gzfp)
{
int gzres;
if (gzfp == NULL)
return 0;
gzres = gzclose(gzfp);
if (TRACE) {
if (gzres == Z_ERRNO) {
perror("gzclose ");
} else if (gzres != Z_OK) {
CTRACE((tfp, "gzclose : error number %d\n", gzres));
}
}
return(gzres);
}
示例5: NXPrintf
HTStyleSheet *HTStyleSheetWrite(HTStyleSheet *self, NXStream * stream)
{
int numStyles = 0;
HTStyle *style;
for (style = self->styles; style; style = style->next)
numStyles++;
NXPrintf(stream, "%d\n", numStyles);
CTRACE((tfp, "StyleSheet: Writing %d styles\n", numStyles));
for (style = self->styles; style; style = style->next) {
NXPrintf(stream, "%s ", style->name);
(void) HTStyleWrite(style, stream);
}
return self;
}
示例6: jthread_set_wait_monitor
static void jthread_set_wait_monitor(jobject monitor)
{
vm_thread_t vm_thread = jthread_self_vm_thread();
assert(vm_thread);
jvmti_thread_t jvmti_thread = &vm_thread->jvmti_thread;
if (!jvmti_thread) {
// nothing to do
return;
}
CTRACE(("TM: set wait monitor: %x", monitor));
int disable_count = hythread_reset_suspend_disable();
jvmti_thread->wait_monitor = vm_thread->jni_env->NewGlobalRef(monitor);
hythread_set_suspend_disable(disable_count);
} // jthread_set_wait_monitor
示例7: CTRACE
BufferMapper* BufferManager::map(DataBuffer& buffer)
{
bool ret;
BufferMapper* mapper;
CTRACE();
Mutex::Autolock _l(mLock);
//try to get mapper from pool
mapper = mBufferPool->getMapper(buffer.getKey());
if (mapper) {
// increase mapper ref count
mapper->incRef();
return mapper;
}
// create a new buffer mapper and add it to pool
do {
VLOGTRACE("new buffer, will add it");
mapper = createBufferMapper(buffer);
if (!mapper) {
ELOGTRACE("failed to allocate mapper");
break;
}
ret = mapper->map();
if (!ret) {
ELOGTRACE("failed to map");
delete mapper;
mapper = NULL;
break;
}
ret = mBufferPool->addMapper(buffer.getKey(), mapper);
if (!ret) {
ELOGTRACE("failed to add mapper");
break;
}
// increase mapper ref count
mapper->incRef();
return mapper;
} while (0);
// error handling
if (mapper) {
mapper->unmap();
delete mapper;
}
return NULL;
}
示例8: _check_cb
static void
_check_cb(UNUSED EV_P_ UNUSED ev_check *w, UNUSED int revents)
{
int npending;
npending = ev_pending_count(the_loop);
#ifdef TRACE_VERBOSE
CTRACE("ev_pending_count=%d", npending);
#endif
if (npending <= 0) {
//CTRACE("Breaking loop? ...");
//ev_break(the_loop, EVBREAK_ALL);
}
timecounter_now = (uint64_t)(ev_now(the_loop) * 1000000000.);
//CTRACE("revents=%08x", revents);
}
示例9: test0
static void
test0(void)
{
int res;
struct sigaction act = {
.sa_flags = SA_SIGINFO,
};
UNUSED mrkthr_ctx_t *cli;
//mrkthr_ctx_t *srv;
sigemptyset(&(act.sa_mask));
act.sa_sigaction = (void (*)(int, siginfo_t *, void *))sigterm_handler;
sigaction(SIGTERM, &act, NULL);
sigaction(SIGINT, &act, NULL);
mrkthr_init();
shutdown_timer_ctx = mrkthr_new("tm", shut_me_down, 0);
//CTRACE();
//if (pipe(read_pipe) != 0) {
// FAIL("pipe");
//}
//CTRACE();
//if (pipe(write_pipe) != 0) {
// FAIL("pipe");
//}
//CTRACE();
//srv = mrkthr_spawn("qwe", qwe, 2, read_pipe[0], write_pipe[1]);
//cli = mrkthr_spawn("asd", asd, 2, write_pipe[0], read_pipe[1]);
cli = mrkthr_spawn("bar", bar, 0);
res = mrkthr_loop();
mrkthr_fini();
CTRACE("res=%d", res);
}
示例10: ARGS2
/* Match maintype to any MIME type starting with maintype,
* for example: image/gif should match image
*/
PRIVATE int half_match ARGS2(char *,trial_type, char *,target)
{
char *cp = strchr(trial_type, '/');
/* if no '/' or no '*' */
if (!cp || *(cp+1) != '*')
return 0;
CTRACE((tfp, "HTFormat: comparing %s and %s for half match\n",
trial_type, target));
/* main type matches */
if (!strncmp(trial_type, target, (cp-trial_type)-1))
return 1;
return 0;
}
示例11: ARGS3
PRIVATE void syntax_error ARGS3(FILE *, fp,
char *, msg,
LexItem, lex_item)
{
char buffer[41];
int cnt = 0;
int ch;
while ((ch = getc(fp)) != EOF && ch != '\n')
if (cnt < 40) buffer[cnt++] = ch;
buffer[cnt] = (char)0;
CTRACE(tfp, "%s %d before: '%s'\nHTGroup.c: %s (got %s)\n",
"HTGroup.c: Syntax error in rule file at line",
HTlex_line, buffer, msg, lex_verbose(lex_item));
HTlex_line++;
}
示例12: mrkthr_wait_for_read
int
mrkthr_wait_for_read(int fd)
{
int res;
UNUSED ev_item_t *ev, *ev1;
ev = ev_io_item_get(fd, EV_READ);
//ev_io_set(&ev->ev.io, fd, EV_READ);
me->pdata.ev = ev;
/*
* check if there is another thread waiting for the same event.
*/
if (ev->ev.io.data == NULL) {
ev->ev.io.data = me;
} else if (ev->ev.io.data != me) {
/*
* in this case we are not allowed to wait for this event,
* sorry.
*/
me->co.rc = MRKTHR_CO_RC_SIMULTANEOUS;
return -1;
}
#ifdef TRACE_VERBOSE
CTRACE(FBBLUE("starting ev_io %d/%s"),
ev->ev.io.fd,
EV_STR(ev->ev.io.events));
#endif
ev_io_start(the_loop, &ev->ev.io);
/* wait for an event */
me->co.state = CO_STATE_READ;
res = yield();
ev1 = ev_io_item_get(fd, EV_READ);
assert(ev == ev1);
assert(ev->ev.io.data == me);
ev->ev.io.data = NULL;
me->pdata.ev = NULL;
return res;
}
示例13: psbWsbmDestroyTTMBuffer
int psbWsbmDestroyTTMBuffer(void * buf)
{
CTRACE();
if(!buf) {
ETRACE("invalid ttm buffer");
return -EINVAL;
}
/*FIXME: should I unmap this buffer object first?*/
wsbmBOUnmap((struct _WsbmBufferObject *)buf);
wsbmBOUnreference((struct _WsbmBufferObject **)&buf);
XTRACE();
return 0;
}
示例14: CTRACE
bool DisplayPlane::initialize(uint32_t bufferCount)
{
CTRACE();
if (bufferCount < MIN_DATA_BUFFER_COUNT) {
WLOGTRACE("buffer count %d is too small", bufferCount);
bufferCount = MIN_DATA_BUFFER_COUNT;
}
// create buffer cache, adding few extra slots as buffer rendering is async
// buffer could still be queued in the display pipeline such that they
// can't be unmapped]
mCacheCapacity = bufferCount;
mDataBuffers.setCapacity(bufferCount);
mActiveBuffers.setCapacity(MIN_DATA_BUFFER_COUNT);
mInitialized = true;
return true;
}
示例15: ARGS2
/*
* Put the AddHrefs in a list. It can be used for indexing to
* present special filetypes through a CGI.
*/
PUBLIC void HTAddHref ARGS2(char *, url,
char *, type_templ)
{
HTHrefNode * node;
if (!url || !type_templ) return;
node = (HTHrefNode*)calloc(1,sizeof(HTHrefNode));
if (!node) outofmem(__FILE__, "HTAddHref");
if (url) StrAllocCopy(node->href_url, url);
if (type_templ) StrAllocCopy(node->type_templ, type_templ);
if (!hrefs) hrefs = HTList_new();
HTList_addObject(hrefs, (void*)node);
CTRACE(stderr,
"AddHref..... %s => URL=\"%s\" \n",type_templ,url);
}