本文整理汇总了C++中skip_token函数的典型用法代码示例。如果您正苦于以下问题:C++ skip_token函数的具体用法?C++ skip_token怎么用?C++ skip_token使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了skip_token函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: get_default
//-------------------------------------------------------------------
// Process one entry "@default VAR VALUE"
//-------------------------------------------------------------------
static const char* get_default(sc_param *p, const char *ptr, int isScript)
{
ptr = skip_to_token(ptr);
if (p)
{
int type = MENUITEM_INT|MENUITEM_SCRIPT_PARAM;
int range = 0;
if (strncmp(ptr, "true", 4) == 0)
{
p->val = 1;
type = MENUITEM_BOOL|MENUITEM_SCRIPT_PARAM;
range = MENU_MINMAX(1,0); // Force boolean data type in Lua (ToDo: this is clunky, needs fixing)
}
else if (strncmp(ptr, "false", 5) == 0)
{
p->val = 0;
type = MENUITEM_BOOL|MENUITEM_SCRIPT_PARAM;
range = MENU_MINMAX(1,0); // Force boolean data type in Lua (ToDo: this is clunky, needs fixing)
}
else
{
p->val = strtol(ptr, NULL, 0);
}
p->old_val = p->val;
if (isScript) // Loading from script file (rather than saved param set file)
{
p->def_val = p->val;
p->range = range;
p->range_type = type;
}
}
return skip_token(ptr);
}
开发者ID:c10ud,项目名称:CHDK,代码行数:37,代码来源:gui_script.c
示例2: skip_token
int *cpu_available_freq_func( void ) {
char *p;
static int val[3];
if ( stat(CPU_FREQ_SCALING_AVAILABLE_FREQ, &struct_stat) == 0 ) {
if(slurpfile(CPU_FREQ_SCALING_AVAILABLE_FREQ, sys_devices_system_cpu_available, 128)) {
p = sys_devices_system_cpu_available;
val[0] = (strtol( p, (char **)NULL , 10 ) / 1000 );
p = skip_token(p);
val[1] = (strtol( p, (char **)NULL , 10 ) / 1000 );
p = skip_token(p);
val[2] = (strtol( p, (char **)NULL , 10 ) / 1000 );
}
}
return val;
}
开发者ID:imaxxs,项目名称:cyton,代码行数:16,代码来源:metrics.cpp
示例3: zap_unknown
/* same as in ACK */
static int zap_unknown(asm86_t *a)
/* An error, zap the rest of the line. */
{
token_t *t;
#define MAX_ASTR 4096
char astr[MAX_ASTR];
unsigned astr_len = 0;
astr[astr_len++] = '\t';
while ((t= get_token(0))->type != T_EOF && t->symbol != ';'
&& t->type != T_COMMENT) {
switch(t->type) {
case T_CHAR:
astr[astr_len++] = t->symbol;
break;
case T_WORD:
case T_STRING:
strncpy(astr + astr_len, t->name, t->len);
astr_len += t->len;
break;
}
skip_token(1);
}
astr[astr_len++] = '\0';
a->raw_string = malloc(astr_len);
if (!a->raw_string)
return -1;
strcpy(a->raw_string, astr);
return 0;
}
开发者ID:boostsup,项目名称:minix3,代码行数:35,代码来源:parse_gnu.c
示例4: parse_meta_handed
static int parse_meta_handed(const char *p)
{
char *t;
int meta;
int ret = 0;
if (!p) goto ret;
while (*p) {
t = get_token(p);
if (t) {
meta = lookup_meta_token(t);
free(t);
} else meta = INVALID_NUMBER;
if (meta == INVALID_NUMBER /*|| !is_meta_handed(meta)*/) {
ret = INVALID_NUMBER;
break;
}
ret |= meta;
p = skip_token(p);
}
ret:
return ret;
}
开发者ID:thentenaar,项目名称:sctools,代码行数:26,代码来源:scas.c
示例5: read_boot_time
static unsigned long
read_boot_time(glibtop *server)
{
char* line = NULL;
size_t size = 0;
FILE* stat;
unsigned long btime = 0;
if (!(stat = fopen("/proc/stat", "r"))) {
glibtop_error_io_r(server, "fopen(\"/proc/stat\")");
goto out;
}
while (getline(&line, &size, stat) != -1) {
if (!strncmp(line, "btime", 5)) {
btime = strtoul(skip_token(line), NULL, 10);
break;
}
}
free(line);
fclose(stat);
out:
return btime;
}
开发者ID:GNOME,项目名称:libgtop,代码行数:25,代码来源:glibtop_private.c
示例6: total_jiffies_func
/*
* A helper function to return the total number of cpu jiffies
*/
JT
total_jiffies_func ( void )
{
char *p;
JT user_jiffies, nice_jiffies, system_jiffies, idle_jiffies,
wio_jiffies, irq_jiffies, sirq_jiffies;
p = update_file(&proc_stat);
p = skip_token(p);
p = skip_whitespace(p);
user_jiffies = strtod( p, &p );
p = skip_whitespace(p);
nice_jiffies = strtod( p, &p );
p = skip_whitespace(p);
system_jiffies = strtod( p, &p );
p = skip_whitespace(p);
idle_jiffies = strtod( p, &p );
if(num_cpustates == NUM_CPUSTATES_24X)
return user_jiffies + nice_jiffies + system_jiffies + idle_jiffies;
p = skip_whitespace(p);
wio_jiffies = strtod( p, &p );
p = skip_whitespace(p);
irq_jiffies = strtod( p, &p );
p = skip_whitespace(p);
sirq_jiffies = strtod( p, &p );
return user_jiffies + nice_jiffies + system_jiffies + idle_jiffies +
wio_jiffies + irq_jiffies + sirq_jiffies;
}
开发者ID:bnicholes,项目名称:monitor-core,代码行数:34,代码来源:metrics.c
示例7: parse_size
parse_size(device *current,
device *bus,
const char *chp,
device_unit *size)
{
int i;
int nr;
const char *curr = chp;
memset(size, 0, sizeof(*size));
/* parse the numeric list */
size->nr_cells = device_nr_size_cells(bus);
nr = 0;
ASSERT(size->nr_cells > 0);
while (1) {
char *next;
size->cells[nr] = strtoul(curr, &next, 0);
if (curr == next)
device_error(current, "Problem parsing <size> %s", chp);
nr += 1;
if (next[0] != ',')
break;
if (nr == size->nr_cells)
device_error(current, "Too many values in <size> %s", chp);
curr = next + 1;
}
ASSERT(nr > 0 && nr <= size->nr_cells);
/* right align the numbers */
for (i = 1; i <= size->nr_cells; i++) {
if (i <= nr)
size->cells[size->nr_cells - i] = size->cells[nr - i];
else
size->cells[size->nr_cells - i] = 0;
}
return skip_token(chp);
}
开发者ID:3125788,项目名称:android_toolchain_gdb,代码行数:35,代码来源:tree.c
示例8: get_cpu
void get_cpu (dbgov_cpu * buf)
{
char buffer[BUFSIZ], *p;
memset (buf, 0, sizeof (dbgov_cpu));
int res = try_file_to_buffer (buffer, FILENAME);
if (res == TRY_FILE_TO_BUFFER_OK_IOSTAT)
{
p = skip_token (buffer);
buf->user = strtoull (p, &p, 0);
buf->nice = strtoull (p, &p, 0);
buf->sys = strtoull (p, &p, 0);
buf->idle = strtoull (p, &p, 0);
buf->total = buf->user + buf->nice + buf->sys + buf->idle;
/* 2.6 kernel */
if (os_version_code >= LINUX_VERSION_CODE (2, 6, 0))
{
buf->iowait = strtoull (p, &p, 0);
buf->irq = strtoull (p, &p, 0);
buf->softirq = strtoull (p, &p, 0);
buf->total += buf->iowait + buf->irq + buf->softirq;
}
buf->frequency = 100;
}
}
开发者ID:deanet,项目名称:mysql-governor,代码行数:29,代码来源:parce_proc_fs.c
示例9: parse_multi_set
static int parse_multi_set(const char *p)
{
char *t;
int s, val = 0;
while (p && *p) {
t = get_token(p);
if (t) {
s = lookup_set_token(t);
free(t);
if (s == INVALID_NUMBER) {
val = s;
break;
}
if (s) val |= 1 << (s - 1);
else val = 0;
}
p = skip_token(p);
}
return val;
}
开发者ID:thentenaar,项目名称:sctools,代码行数:25,代码来源:scas.c
示例10: cpu_user_func
g_val_t
cpu_user_func ( void )
{
char *p;
static g_val_t val;
static struct timeval stamp={0, 0};
static JT last_user_jiffies, user_jiffies,
last_total_jiffies, total_jiffies, diff;
p = update_file(&proc_stat);
if((proc_stat.last_read.tv_sec != stamp.tv_sec) &&
(proc_stat.last_read.tv_usec != stamp.tv_usec)) {
stamp = proc_stat.last_read;
p = skip_token(p);
user_jiffies = strtod( p , (char **)NULL );
total_jiffies = total_jiffies_func();
diff = user_jiffies - last_user_jiffies;
if ( diff )
val.f = ((double)diff/(double)(total_jiffies - last_total_jiffies)) * 100.0;
else
val.f = 0.0;
last_user_jiffies = user_jiffies;
last_total_jiffies = total_jiffies;
}
return val;
}
开发者ID:HC-ITOPS,项目名称:monitor-core,代码行数:31,代码来源:metrics.c
示例11: cpu_user_func
g_val_t
cpu_user_func ( void )
{
char *p;
static g_val_t val;
static int stamp;
static double last_user_jiffies, user_jiffies,
last_total_jiffies, total_jiffies, diff;
p = update_file(&proc_stat);
if(proc_stat.last_read != stamp) {
stamp = proc_stat.last_read;
p = skip_token(p);
user_jiffies = strtod( p , (char **)NULL );
total_jiffies = total_jiffies_func();
diff = user_jiffies - last_user_jiffies;
if ( diff )
val.f = (diff/(total_jiffies - last_total_jiffies))*100;
else
val.f = 0.0;
last_user_jiffies = user_jiffies;
last_total_jiffies = total_jiffies;
}
return val;
}
开发者ID:colama,项目名称:colama-3rdparty-tools,代码行数:30,代码来源:metrics.c
示例12: token
/* read_config_read_data():
reads data of a given type from a token(s) on a configuration line.
Returns: character pointer to the next token in the configuration line.
NULL if none left.
NULL if an unknown type.
*/
char *read_config_read_data(int type, char *readfrom, void *dataptr, size_t *len) {
int *intp;
char **charpp;
oid **oidpp;
if (dataptr == NULL || readfrom == NULL)
return NULL;
switch(type) {
case ASN_INTEGER:
intp = (int *) dataptr;
*intp = atoi(readfrom);
readfrom = skip_token(readfrom);
return readfrom;
case ASN_OCTET_STR:
charpp = (char **) dataptr;
return read_config_read_octet_string(readfrom, (u_char **) charpp, len);
case ASN_OBJECT_ID:
oidpp = (oid **) dataptr;
return read_config_read_objid(readfrom, oidpp, len);
default:
DEBUGMSGTL(("read_config_read_data","Fail: Unknown type: %d", type));
return NULL;
}
return NULL;
}
开发者ID:Palantir555,项目名称:ecos-mars-zx3,代码行数:37,代码来源:read_config.c
示例13: attach_process_add_line
static void
attach_process_add_line (AttachProcess *ap, GtkTreeStore *store, gchar *line)
{
gchar *pid, *user, *start, *command, *tmp;
// guint i, level;
GtkTreeIter *iter;
pid = skip_spaces (line); // skip leading spaces
user = skip_token_and_spaces (pid); // skip PID
start = skip_token_and_spaces (user); // skip USER
tmp = skip_token (start); // skip START (do not skip spaces)
command = calc_depth_and_get_iter (ap, store, &iter, tmp);
if (ap->hide_paths)
{
command = skip_path (command);
}
if (ap->hide_params)
{
remove_params(command);
}
gtk_tree_store_set (store, iter,
PID_COLUMN, pid,
USER_COLUMN, user,
START_COLUMN, start,
COMMAND_COLUMN, command,
-1);
}
开发者ID:rosedu,项目名称:anjuta,代码行数:31,代码来源:start.c
示例14: skip_multiple_token
static inline char *
skip_multiple_token (const char *p, size_t count)
{
while(count--)
p = skip_token (p);
return (char *)p;
}
开发者ID:aBothe,项目名称:debugger,代码行数:8,代码来源:libgtop-glue.c
示例15: zap
static void zap(void)
/* An error, zap the rest of the line. */
{
token_t *t;
while ((t= get_token(0))->type != T_EOF && t->symbol != ';')
skip_token(1);
}
开发者ID:ducis,项目名称:operating-system-labs,代码行数:8,代码来源:parse_ack.c
示例16: get_token_len
static inline size_t get_token_len( char* tok )
{
char* start = tok;
skip_token( tok );
return size_t( tok - start );
}
开发者ID:Bluehorn,项目名称:wxPython,代码行数:8,代码来源:cjparser.cpp
示例17: parse_bookmark
/* ----------------------------------------------------------------------- */
static bool parse_bookmark(const char *bookmark, const bool parse_filenames)
{
const char* s = bookmark;
const char* end;
#define GET_INT_TOKEN(var) s = int_token(s, &var)
#define GET_LONG_TOKEN(var) s = long_token(s, &var)
#define GET_BOOL_TOKEN(var) var = (atoi(s)!=0); s = skip_token(s)
/* if new format bookmark, extract the optional content flags,
otherwise treat as an original format bookmark */
int opt_flags = 0;
bool new_format = (strchr(s, '>') == s);
if (new_format)
{
s++;
GET_INT_TOKEN(opt_flags);
}
/* extract all original bookmark tokens */
GET_INT_TOKEN(bm.resume_index);
GET_LONG_TOKEN(bm.resume_offset);
GET_INT_TOKEN(bm.resume_seed);
if (!new_format) /* skip deprecated token */
s = skip_token(s);
GET_LONG_TOKEN(bm.resume_time);
GET_INT_TOKEN(bm.repeat_mode);
GET_BOOL_TOKEN(bm.shuffle);
/* extract all optional bookmark tokens */
if (opt_flags & BM_PITCH)
GET_INT_TOKEN(bm.pitch);
if (opt_flags & BM_SPEED)
GET_INT_TOKEN(bm.speed);
if (*s == 0)
{
return false;
}
end = strchr(s, ';');
/* extract file names */
if (parse_filenames)
{
size_t len = (end == NULL) ? strlen(s) : (size_t) (end - s);
len = MIN(TEMP_BUF_SIZE - 1, len);
strlcpy(global_temp_buffer, s, len + 1);
if (end != NULL)
{
end++;
strlcpy(global_filename, end, MAX_PATH);
}
}
return true;
}
开发者ID:richq,项目名称:rockbox,代码行数:59,代码来源:bookmark.c
示例18: cpu_system_func
double cpu_system_func ( void ) {
char *p;
double val;
double last_system_jiffies, system_jiffies,
last_total_jiffies, total_jiffies, diff;
p = update_file(&proc_stat);
p = skip_token(p);
p = skip_token(p);
p = skip_token(p);
system_jiffies = strtod( p , (char **)NULL );
if (num_cpustates > NUM_CPUSTATES_24X) {
p = skip_token(p);
p = skip_token(p);
p = skip_token(p);
system_jiffies += strtod( p , (char **)NULL ); /* "intr" counted in system */
p = skip_token(p);
system_jiffies += strtod( p , (char **)NULL ); /* "sintr" counted in system */
}
total_jiffies = total_jiffies_func();
diff = system_jiffies - last_system_jiffies;
if ( diff )
val = (diff/(total_jiffies - last_total_jiffies))*100;
else
val = 0.0;
last_system_jiffies = system_jiffies;
last_total_jiffies = total_jiffies;
return val;
}
开发者ID:imaxxs,项目名称:cyton,代码行数:33,代码来源:metrics.cpp
示例19: is_function
inline static bool is_function( char* cur, bool& isAMacro )
{
isAMacro = false;
int tmpLnNo;
store_line_no( tmpLnNo );
// NOTE:: comments and quoted strings are not checked here
// first,check for "single-line hanginging macros" like:
// ___UNICODE
//
char* eol = cur;
skip_to_eol( eol );
skip_token( cur );
get_next_token( cur );
if ( cur > eol )
{
isAMacro = true;
restore_line_no( tmpLnNo );
return true;
}
// it's not a macro, go to the begining of arg. list
do
{
// if bracket found, it's a function or a begining
// of some macro
if ( *cur == '(' )
{
restore_line_no( tmpLnNo );
return true;
}
// end of statement found without any brackets in it
// - it cannot be a function
if ( *cur == ';' )
{
restore_line_no( tmpLnNo );
return false;
}
++cur;
} while( cur < _gSrcEnd);
isAMacro = 1;
restore_line_no( tmpLnNo );
return false;
}
开发者ID:Bluehorn,项目名称:wxPython,代码行数:57,代码来源:cjparser.cpp
示例20: proc_total_func
g_val_t
proc_total_func ( void )
{
char *p;
g_val_t val;
p = update_file(&proc_loadavg);
p = skip_token(p);
p = skip_token(p);
p = skip_token(p);
p = skip_whitespace(p);
while ( isdigit(*p) )
p++;
p++; /* skip the slash-/ */
val.uint32 = strtol( p, (char **)NULL, 10 );
return val;
}
开发者ID:bdbaddog,项目名称:monitor-core,代码行数:18,代码来源:metrics.c
注:本文中的skip_token函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论