本文整理汇总了C++中process_line函数的典型用法代码示例。如果您正苦于以下问题:C++ process_line函数的具体用法?C++ process_line怎么用?C++ process_line使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了process_line函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: spnl
void nl_convert_spice_t::convert(const pstring &contents)
{
std::vector<pstring> spnl(plib::psplit(contents, "\n"));
// Add gnd net
// FIXME: Parameter
out("NETLIST_START(dummy)\n");
add_term("0", "GND");
pstring line = "";
for (const auto &i : spnl)
{
// Basic preprocessing
pstring inl = plib::ucase(plib::trim(i));
if (plib::startsWith(inl, "+"))
line = line + inl.substr(1);
else
{
process_line(line);
line = inl;
}
}
process_line(line);
dump_nl();
// FIXME: Parameter
out("NETLIST_END()\n");
}
开发者ID:fesh0r,项目名称:mame-full,代码行数:29,代码来源:nl_convert.cpp
示例2: spnl
void nl_convert_spice_t::convert(const pstring &contents)
{
pstring_vector_t spnl(contents, "\n");
// Add gnd net
// FIXME: Parameter
out("NETLIST_START(dummy)\n");
add_term("0", "GND");
pstring line = "";
for (std::size_t i=0; i < spnl.size(); i++)
{
// Basic preprocessing
pstring inl = spnl[i].trim().ucase();
if (inl.startsWith("+"))
line = line + inl.substr(1);
else
{
process_line(line);
line = inl;
}
}
process_line(line);
dump_nl();
// FIXME: Parameter
out("NETLIST_END()\n");
}
开发者ID:NULUSIOS,项目名称:mame,代码行数:29,代码来源:nl_convert.cpp
示例3: compile_shader_mem
void compile_shader_mem(void *data, int len) {
char line[256];
memset(&line,0,sizeof(line));
int i =0;
char c;
char *p = (char *)data;
while((len-- > 0) && (c = (char)*p++)) {
if(c == 0) {
line[i] = 0;
if(line[0] != '#' || line[0] == ';')
process_line(line);
//printf("Last line: %s\n",line);
break;
} else if(c == '\t' || c=='\r') {
} else if(c == '\n') {
line[i] = 0;
i = 0;
if(line[0] != '#' || line[0] == ';')
process_line(line);
//printf("Parse line: %s\n",line);
}else {
line[i++] = c;
}
}
}
开发者ID:chc,项目名称:shaderpacket,代码行数:25,代码来源:shaderasm.cpp
示例4: process
/*
* Open the file and initiate recursive processing.
*/
static int
process(const char *fname) {
char buf[8192];
char *collector = 0;
size_t collector_size = sizeof(buf);
size_t collector_offset = 0;
int lineno = 0;
FILE *fp;
if(strcmp(fname, "-")) {
fp = fopen(fname, "r");
if(!fp) {
perror(fname);
return -1;
}
} else {
fp = stdin;
}
while(fgets(buf, sizeof(buf), fp) || !feof(fp)) {
size_t len = strlen(buf);
if(!len) continue;
if(collector_offset || buf[len - 1] != '\n') {
if((collector_size - collector_offset) <= len || !collector) {
collector_size <<= 1;
collector = REALLOC(collector, collector_size);
if(!collector) {
perror("realloc()");
exit(EX_OSERR);
}
}
memcpy(collector + collector_offset, buf, len + 1);
collector_offset += len;
}
if(buf[len - 1] != '\n') continue;
if(collector_offset) {
assert(collector[collector_offset - 1] == '\n');
process_line(fname, collector, ++lineno);
collector_offset = 0;
} else {
process_line(fname, buf, ++lineno);
}
}
if(fp != stdin) fclose(fp);
return 0;
}
开发者ID:SteveDCronin,项目名称:asn1c,代码行数:54,代码来源:enber.c
示例5: while
void unix_console_connection::process_input(int len) {
int st = 0;
while (st < len) {
int i;
for (i = st; i < len; i++) {
if (buffer[i] == '\n' || buffer[i] == ';' || buffer[i] == '?') {
break;
}
}
if (buffer[i] == '?') {
//std::string in((const char *)buffer + st, i - st);
std::string in((const char *)buffer + st, (i + 1) - st);
dump_partial(in.c_str());
} else if ((i - st) > 0) {
if (buffer[i] == '\n')
i--;
std::string in((const char *)buffer + st, i - st);
process_line(in.c_str());
}
st = i + 1;
}
if (autoclose) {
if (bufbuffer.empty())
console->release_connection(this);
else
doom();
}
}
开发者ID:Distrotech,项目名称:mrd6,代码行数:34,代码来源:unix_console.cpp
示例6: DEFINE_CMD_MAIN
DEFINE_CMD_MAIN(filecmd,int argc,TCHAR** argv) {
int i;
TCHAR* fn;
FILE* fp;
for(i=1;i<argc;i++) {
fn=argv[i];
if(_tcscmp(fn,TEXT("-"))==0)
fp=stdin;
else {
fp=_tfopen(fn,TEXT("r"));
}
if(fp) {
TCHAR* line = malloc(MAX_ARG_LENGTH*sizeof(TCHAR)+1);
int l=0;
DEBUG_PRINT(TEXT("reading file %s\n"),fn);
while((l=fgetline(line,MAX_ARG_LENGTH,fp))!=-1) {
if(l==0)
continue;
if(!process_line(APPNAME,line))
break;
}
fclose(fp);
}
else {
fprintf(stderr,TEXT("File not accessable:\"%s\"\n"),fn);
}
}
return 0;
}
开发者ID:badcodes,项目名称:c,代码行数:29,代码来源:filecmd.c
示例7: process_file
static int process_file(const char *fname)
{
FILE *fp;
int linenum = 0, err = 0;
char linebuf[256];
fp = fopen(fname, "r");
if (!fp) {
err = ERR_FILE_NOT_FOUND;
goto ret;
}
while (fgets(linebuf, sizeof(linebuf), fp)) {
++linenum;
err = process_line(linebuf);
if (err) {
fprintf(stderr, "error at line %d: ", linenum);
break;
}
}
ret:
if (fp) fclose(fp);
return err;
}
开发者ID:thentenaar,项目名称:sctools,代码行数:25,代码来源:scas.c
示例8: do_connection
/* process a single client connection */
static void do_connection(mysocket_t sd)
{
char line[256];
int rc;
/* loop over:
- get a request from the client
- process the request
*/
for (;;)
{
rc = get_nvt_line(sd, line);
if (rc < 0 || !*line)
goto done;
fprintf(stderr, "client: %s\n", line);
if (process_line(sd, line) < 0)
{
perror("process_line");
goto done;
}
} /* for (;;) */
done:
if (myclose(sd) < 0)
{
perror("myclose (sd)");
}
}
开发者ID:CodyPitts,项目名称:stcp_skeleton,代码行数:32,代码来源:server.c
示例9: set_read
void set_read(const char *filename)
{
FILE *fp;
char line[4096];
if (config_file_has_been_read) {
warn("%s(): trying to read config file again", __func__);
return;
}
config_file_has_been_read = 1;
fp = fopen(filename, "r");
if (!fp) {
warn("could not open file %s", filename);
return;
}
while (fgets(line, sizeof(line), fp)) {
char *p;
if (line[0] == '\0')
continue;
p = strrchr(line, '\n');
if (!p)
continue;
*p = '\0';
process_line(line);
}
fclose(fp);
}
开发者ID:johanmalm,项目名称:jgmenu,代码行数:28,代码来源:set.c
示例10: my_parsefile
/*
** Write the header of the file (minus the prog size)
** init the linked lists storing label definition and reference
** Read every line of the file fd_champ,
** split them into a word tab and send them
** to process_line
** Then launch late_operation
** if any error is encountered during these operations,
** return -1, else return 0
*/
int my_parsefile(int fd_champ, int fd_binary)
{
char *line;
char **lexed_line;
int j;
int fileoffset;
t_lateinfo info;
my_init_info(&info);
if ((fileoffset = write_header(fd_champ, fd_binary)) == -1)
return (-1);
j = 1;
while ((line = get_next_line(fd_champ)) != NULL)
{
if (line[0] != COMMENT_CHAR && line[0] != '.' && line[0] && line[0])
{
if ((lexed_line = my_epur(all_in_tab(line))) == NULL
|| process_line(lexed_line, fd_binary, &fileoffset, &info) == -1)
{
my_fprintf(2, "at line %i : \"%s\" ", j, line);
return (-1);
}
}
free(line);
++j;
}
return (late_operation(fd_binary, fileoffset, &info));
}
开发者ID:Thegeiger,项目名称:Corewar,代码行数:38,代码来源:compil.c
示例11: user_marker_info
static void user_marker_info(char *fname)
{
int idx;
char *buf;
const char *msg;
FILE *ins;
ins = fopen(fname, "r");
if (ins == NULL)
{
warning("unable to open marker info file");
return;
}
idx = 1;
buf = (char *) malloc(MaxLineLen);
assert(buf != NULL);
while (get_line(ins, buf, MaxLineLen, &msg) != NULL)
{
if (msg != NULL)
{
fflush(stdout);
fprintf(stderr, "%s, line %d: %s\n", fname, idx, msg);
fprintf(stderr, " (length = %d)\n", (int) strlen(buf));
fflush(stderr);
}
process_line(buf, fname, idx);
idx += 1;
}
free(buf);
fclose(ins);
}
开发者ID:whztt07,项目名称:agglobe,代码行数:35,代码来源:markers.cpp
示例12: risin_processf
int
risin_processf( fields *risin, char *p, char *filename, long nref )
{
newstr tag, data;
newstr_init( &tag );
newstr_init( &data );
while ( *p ) {
if ( risin_istag( p ) ) {
p = process_line( &tag, &data, p );
/* no anonymous fields allowed */
/* if ( tag.len && data.len )*/
if ( tag.len )
fields_add( risin, tag.data, data.data, 0 );
} else {
p = process_line2( &tag, &data, p );
if ( data.len && risin->nfields>0 ) {
newstr *od;
od = &(risin->data[risin->nfields-1] );
newstr_addchar( od, ' ' );
newstr_strcat( od, data.data );
}
}
newstr_empty( &tag );
newstr_empty( &data );
}
newstr_free( &tag );
newstr_free( &data );
return 1;
}
开发者ID:andytwoods,项目名称:xPapers,代码行数:31,代码来源:risin.c
示例13: load_lines
/** Get the lines and boundaries from the map and load them in an array
*/
void load_lines(struct Map_info *map, struct Point **points, int *num_points,
struct Line **lines, int *num_lines)
{
int index_line = 0;
int index_point = 0;
struct line_pnts *sites;
struct line_cats *cats;
int cat = 0;
int type;
sites = Vect_new_line_struct();
cats = Vect_new_cats_struct();
while ((type = Vect_read_next_line(map, sites, cats)) > -1) {
if (type != GV_LINE && type != GV_BOUNDARY && type != GV_POINT)
continue;
if (type == GV_LINE)
process_line(sites, points, &index_point, lines, &index_line, -1);
else if (type == GV_BOUNDARY)
process_boundary(sites, points, &index_point, lines, &index_line,
cat++);
else if (type == GV_POINT)
process_point(sites, points, &index_point, -1);
}
*num_points = index_point;
*num_lines = index_line;
Vect_destroy_line_struct(sites);
Vect_destroy_cats_struct(cats);
}
开发者ID:imincik,项目名称:pkg-grass,代码行数:36,代码来源:main.c
示例14: make_repl
void *connection_handler(void *socket_desc) {
repl_t *repl = make_repl();
repl->current_prompt = form_prompt(repl->current_ns, false);
repl->session_id = ++session_id_counter;
int sock = *(int *) socket_desc;
ssize_t read_size;
char client_message[4096];
write(sock, repl->current_prompt, strlen(repl->current_prompt));
while ((read_size = recv(sock, client_message, 4095, 0)) > 0) {
sock_to_write_to = sock;
cljs_set_print_sender(&socket_sender);
client_message[read_size] = '\0';
process_line(repl, strdup(client_message));
cljs_set_print_sender(NULL);
sock_to_write_to = 0;
write(sock, repl->current_prompt, strlen(repl->current_prompt));
}
free(socket_desc);
return NULL;
}
开发者ID:mfikes,项目名称:planck,代码行数:29,代码来源:repl.c
示例15: main
/* main program controls all the action
*/
int
main(int argc, char *argv[]) {
int fileinput=0;
command_t comd;
csv_t D;
/* first argument on commandline is the data file name */
read_csv_file(argv[1], &D);
/* second argument, if it exists, is file of input commands */
if (argc==3) {
fileinput = 1;
reassign_input(argv[2]);
}
/* start the main execution loop */
print_prompt();
while (read_command(&comd, fileinput, D.ncols)) {
process_line(&comd, &D);
/* then round we go */
print_prompt();
}
/* all done, so pack up and go home */
printf("bye\n");
return 0;
}
开发者ID:georgiah,项目名称:C-assignments,代码行数:29,代码来源:349008ass2.c
示例16: channel_process_input
static gboolean channel_process_input ()
{
static char linebuf[4096];
char *linep = linebuf;
char *line;
int bytes_read;
#if GLIB_MAJOR_VERSION > 1
// we need to call this again because we will get new events before returning
// from this function
// semantics of add_watch silently changing between glib versions!!!!
g_io_add_watch (channel_in, G_IO_IN, (GIOFunc) channel_process_input, NULL);
#endif
g_io_channel_read (channel_in, linebuf, 4096, &bytes_read);
linebuf[bytes_read] = '\0';
while (*linep != '\0')
{
line = linep;
while (*linep++ != '\n')
g_assert (linep[-1] != '\0');
linep[-1] = '\0';
if (opt_verbose) printf ("engine got command \"%s\"\n", line);
command_list = g_slist_append (command_list, g_strdup (line));
}
while (process_line ())
;
#if GLIB_MAJOR_VERSION == 1
return TRUE;
#else
return FALSE;
#endif
}
开发者ID:barak,项目名称:gtkboard,代码行数:31,代码来源:engine.c
示例17: read_file
static int read_file(int const fd, char **line, char **test, int c)
{
int byte_read;
char buf[BUFF_SIZE + 1];
int char_left;
if ((char_left = 0) == 0 && process_buf(&char_left, test, &c, line))
return (1);
while ((byte_read = read(fd, buf, BUFF_SIZE)))
{
if ((buf[byte_read] = 0) == 0 && byte_read == -1)
return (-1);
char_left = process_line(byte_read, buf, line, c);
c += byte_read;
if (char_left > 0)
{
if (!(*test))
ft_memdel((void **)test);
(*test) = ft_strnew(char_left);
ft_strncpy((*test), buf + (byte_read - char_left), char_left);
}
else if (char_left == 0)
ft_memdel((void **)test);
if (char_left != -1)
return (1);
}
return (0);
}
开发者ID:jcornill,项目名称:School-Project-42,代码行数:28,代码来源:get_next_line.c
示例18: while
void hdcolors::read_config(char *filename){
FILE *cfgfile=fopen(filename,"rt");
if (cfgfile==NULL)
con->printf("^7failed to open config-file %s\n",filename);
else {
char line[256]; line[255]=0;
while(!feof(cfgfile)){
fgets(line,255,cfgfile);
line[strlen(line)!=0?strlen(line)-1:0]=0;
char *pos;
pos=strchr(line,';'); if (pos!=NULL) *pos=0;
pos=strchr(line,'#'); if (pos!=NULL) *pos=0;
if (*pos!=0){
pos=line+strlen(line)-1;
while(*pos==' ')pos--;
*(++pos)=0;
pos=line;
while(*pos==' ')pos++;
// strupr(pos);
strlwr(pos);
if (*pos!=0&&strrchr(pos,'=')!=0)
process_line(pos);
};
};
fclose(cfgfile);
};
};
开发者ID:vividos,项目名称:OldStuff,代码行数:34,代码来源:hdcolors.cpp
示例19: convert
void
convert(FILE *a, FILE *b, FILE *c, FILE *d)
{
static char line[MAX_LINE_LEN+1];
header(b, "gnuplot help");
fprintf(b, "<h1 align=\"center\">gnuplot %s patchlevel %s</h1>\n", gnuplot_version, gnuplot_patchlevel);
header(c, "gnuplot help contents");
fprintf(c, "<ul>\n");
if (d) {
header(d, "gnuplot help index");
fprintf(d, "<ul>\n");
}
/* process each line of the file */
while (get_line(line, sizeof(line), a)) {
process_line(line, b, c, d);
}
footer(b);
fprintf(c, "</ul>\n");
footer(c);
if (d) {
fprintf(d, "</ul>\n");
footer(d);
}
list_free();
}
开发者ID:chyalexcheng,项目名称:gnuplot,代码行数:33,代码来源:doc2html.c
示例20: process_file
int process_file(ai::PL::KnowledgeBase &kb, char *buf, std::istream &in, std::ostream &out)
{
int done = 0;
int interactive = 0;
if(isatty(fileno(in)))
{
interactive = 1;
}
while(in.good() && !done)
{
if(interactive)
{
out << "> " << std::flush;
}
in.getline(buf, BUF_SIZE);
if((strlen(buf) == 0) && !in.good())
{ // end of file without any data
out << std::endl;
continue;
}
done = process_line(kb, interactive, buf, in, out);
}
return 0;
}
开发者ID:sstephens,项目名称:sstephens1,代码行数:26,代码来源:PL_Shell.cpp
注:本文中的process_line函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论