本文整理汇总了C++中dofile函数的典型用法代码示例。如果您正苦于以下问题:C++ dofile函数的具体用法?C++ dofile怎么用?C++ dofile使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dofile函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: main
int
main(
int argc,
char *argv[]
)
{
char *getenv();
int i, file0;
progname = argv[0];
libpath[0] = "./";
if ((libpath[i=1] = getenv("MDIR")) != NULL)
i++;
libpath[i++] = "/usr/local/lib/meta/";
libpath[i] = NULL;
for (file0 = 1; file0 < argc-1; file0 += 2)
if (!isopt(argv[file0]))
break;
if (file0 >= argc)
dofile(argc-1, argv+1, NULL);
else
for (i = file0; i < argc; i++)
dofile(file0-1, argv+1, argv[i]);
quit(0);
return 0; /* pro forma return */
}
开发者ID:Pizookies,项目名称:Radiance,代码行数:29,代码来源:dgraph.c
示例2: main
void main(int argc, char * argv[]) {
int numfiles = 0;
struct find_t find;
char * cp;
char * cp1;
setbuf(stdout, NULL); // unbuffered output via printf
argv++; argc--;
for (;argc--;argv++)
{
if( !_dos_findfirst( *argv, 0xffff, &find ) )
{
dofile( find.name );
numfiles++;
while( !_dos_findnext( &find ) ) {
numfiles++;
dofile( find.name );
}
}
}
if ( numfiles < 1 ) {
printf( "lbmcomp- this program compresses bbm files by removing\n");
printf( "unused chunks. The command line is the file specs\n" );
printf( "to convert. ie.. lbmcomp john*.bbm adam*.bbm\n\n" );
exit(1);
}
}
开发者ID:NonCreature0714,项目名称:descent,代码行数:31,代码来源:LBMCOMP.C
示例3: main
int
main(
int argc,
char *argv[]
)
{
char *getenv();
int i, file0;
progname = argv[0];
libpath[0] = "";
if ((libpath[i=1] = getenv("MDIR")) != NULL)
i++;
libpath[i++] = MDIR;
libpath[i] = NULL;
for (file0 = 1; file0 < argc; )
if (istyp(argv[file0]))
file0++;
else if (isvar(argv[file0]) && file0 < argc-1)
file0 += 2;
else
break;
if (file0 >= argc)
dofile(argc-1, argv+1, NULL);
else
for (i = file0; i < argc; i++)
dofile(file0-1, argv+1, argv[i]);
quit(0);
return 0; /* pro forma return */
}
开发者ID:MITSustainableDesignLab,项目名称:Daysim,代码行数:32,代码来源:bgraph.c
示例4: main
int main(int argc, char *argv[])
{
FILE *inf;
int i = 1;
if (1 == argc) {
dofile(stdin, "stdin");
return 0;
}
if (!strcmp(argv[1], "--")) {
i = 2;
goto loop;
}
if (!strcmp(argv[1], "--help") || !strcmp(argv[1], "-h")) {
printf("usage: %s [files...]\n", argv[0]);
puts("Rotates Unicode codepoints (UTF-8 encoded only) such that they stay within their plane.");
puts("Self-reversible, the same way rot13 is");
return 0;
}
if (!strcmp(argv[1], "--version") || !strcmp(argv[1], "-v")) {
puts("rot32768 version 1.0");
puts("Chris Barts, 2017. Released under the GPL Version 3.0 or later");
return 0;
}
loop:
for (; i < argc; i++) {
if ((inf = fopen(argv[i], "rb")) == NULL) {
handle_ferr(argv[i], "rot32768");
continue;
}
dofile(inf, argv[i]);
if (ferror(inf)) {
handle_ferr(argv[i], "rot32768");
fclose(inf);
continue;
}
if (fclose(inf) == EOF)
handle_ferr(argv[i], "rot32768");
}
return 0;
}
开发者ID:chbarts,项目名称:utf8decode,代码行数:49,代码来源:rot32768.c
示例5: main
int main (int argc, const char * argv[]) {
//
// /* a bunch of json: */
// char text1[]="{\n\"name\": \"Jack (\\\"Bee\\\") Nimble\", \n\"format\": {\"type\": \"rect\", \n\"width\": 1920, \n\"height\": 1080, \n\"interlace\": false,\"frame rate\": 24\n}\n}";
// char text2[]="[\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"]";
// char text3[]="[\n [0, -1, 0],\n [1, 0, 0],\n [0, 0, 1]\n ]\n";
// char text4[]="{\n \"Image\": {\n \"Width\": 800,\n \"Height\": 600,\n \"Title\": \"View from 15th Floor\",\n \"Thumbnail\": {\n \"Url\": \"http:/*www.example.com/image/481989943\",\n \"Height\": 125,\n \"Width\": \"100\"\n },\n \"IDs\": [116, 943, 234, 38793]\n }\n }";
// char text5[]="[\n {\n \"precision\": \"zip\",\n \"Latitude\": 37.7668,\n \"Longitude\": -122.3959,\n \"Address\": \"\",\n \"City\": \"SAN FRANCISCO\",\n \"State\": \"CA\",\n \"Zip\": \"94107\",\n \"Country\": \"US\"\n },\n {\n \"precision\": \"zip\",\n \"Latitude\": 37.371991,\n \"Longitude\": -122.026020,\n \"Address\": \"\",\n \"City\": \"SUNNYVALE\",\n \"State\": \"CA\",\n \"Zip\": \"94085\",\n \"Country\": \"US\"\n }\n ]";
//
// /* Process each json textblock by parsing, then rebuilding: */
// doit(text1);
// doit(text2);
// doit(text3);
// doit(text4);
// doit(text5);
//
// /* Parse standard testfiles: */
///* dofile("../../tests/test1"); */
///* dofile("../../tests/test2"); */
///* dofile("../../tests/test3"); */
///* dofile("../../tests/test4"); */
///* dofile("../../tests/test5"); */
//
// /* Now some samplecode for building objects concisely: */
// create_objects();
//
// return 0;
char filepath[] = "./main.json";
dofile(filepath);
}
开发者ID:songyancui,项目名称:netool,代码行数:31,代码来源:test.c
示例6: dodir
int dodir(char *dirpath)
{
int rc = 0;
char path[256];
DIR *dir;
struct dirent *dire;
struct stat statbuf;
if((dir = opendir(dirpath)) == NULL) {
fprintf(stderr, "Failed to scan directory %s\n", dirpath);
return -1;
}
if(verbose)
fprintf(stderr, "Scan %s\n", dirpath);
while((dire = readdir(dir)) != NULL && rc == 0) {
if(dire->d_name[0] == '.' || stricmp(dire->d_name, "cvs") == 0)
continue;
strcpy(path, dirpath);
strcat(path, "/");
strcat(path, dire->d_name);
stat(path, &statbuf);
if(statbuf.st_mode & S_IFDIR)
rc = dodir(path);
else if(statbuf.st_mode & S_IFREG)
rc = dofile(path);
}
closedir(dir);
return rc;
}
开发者ID:MaurodeLyon,项目名称:Embedded-Software-Ontwikkeling,代码行数:30,代码来源:crurom.c
示例7: rundir
/*
* run the current directory
*/
void
rundir(char *name)
{
int fd;
long i;
if(aflag && sflag)
fd = sysopenlocked(".", OREAD);
else
fd = open(".", OREAD);
if(fd == -1){
warning("reading %s", name);
return;
}
nfiles = sysdirreadall(fd, &dirbuf);
if(nfiles > 0){
for(i=0; i<nfiles; i++){
if(dirbuf[i].name[0]!='C' || dirbuf[i].name[1]!='.')
continue;
dofile(&dirbuf[i]);
}
free(dirbuf);
}
if(aflag && sflag)
sysunlockfile(fd);
else
close(fd);
}
开发者ID:99years,项目名称:plan9,代码行数:31,代码来源:runq.c
示例8: execfile
/*
* execute a series of commands in a file
*
* int f, n; default flag and numeric arg to pass on to file
*/
int execfile(int f, int n)
{
int status; /* return status of name query */
char *fname; /* name of file to execute */
char *fspec; /* full file spec */
fname = alloca(NSTRING * sizeof(char));
if ((status =
mlreply("File to execute: ", fname, NSTRING - 1)) != TRUE)
return status;
#if 1
/* look up the path for the file */
fspec = flook(fname, FALSE); /* used to by TRUE, P.K. */
/* if it isn't around */
if (fspec == NULL)
return FALSE;
#endif
/* otherwise, execute it */
while (n-- > 0)
if ((status = dofile(fspec)) != TRUE)
return status;
return TRUE;
}
开发者ID:k0gaMSX,项目名称:uemacs,代码行数:32,代码来源:exec.c
示例9: dofile
void LuaBase::boot() {
dofile("_system.lua");
lua_pushnil(); // resumeSave
lua_pushnil(); // bootParam - not used in scripts
lua_call("BOOT");
}
开发者ID:frnknstn,项目名称:residualvm,代码行数:7,代码来源:lua.cpp
示例10: main
int main (int argc, char **argv) {
struct Smain s;
lua_State *L = lua_open();
if (L == NULL) {
l_message(argv[0], "cannot create state: not enough memory");
return EXIT_FAILURE;
}
s.argc = argc;
s.argv = argv;
// Open tolua packages
loadANLBindings(L);
#ifndef DEFAULT_FILE_EXECUTE
luaL_openlibs(L);
int status = lua_cpcall(L, &pmain, &s);
report(L, status);
lua_close(L);
return (status || s.status) ? EXIT_FAILURE : EXIT_SUCCESS;
#else
lua_gc(L, LUA_GCSTOP, 0);
luaL_openlibs(L);
lua_gc(L, LUA_GCRESTART, 0);
dofile(L, DEFAULT_FILE_EXECUTE);
lua_close(L);
#endif
}
开发者ID:ColinGilbert,项目名称:accidental-noise-library,代码行数:31,代码来源:main.cpp
示例11: pmain
static int pmain (lua_State *L) {
struct Smain *s = (struct Smain *)lua_touserdata(L, 1);
char **argv = s->argv;
int script;
int has_i = 0, has_v = 0, has_e = 0;
globalL = L;
if (argv[0] && argv[0][0]) progname = argv[0];
lua_gc(L, LUA_GCSTOP, 0); /* stop collector during initialization */
luaL_openlibs(L); /* open libraries */
lua_gc(L, LUA_GCRESTART, 0);
s->status = handle_luainit(L);
if (s->status != 0) return 0;
script = collectargs(argv, &has_i, &has_v, &has_e);
if (script < 0) { /* invalid args? */
print_usage();
s->status = 1;
return 0;
}
if (has_v) print_version();
s->status = runargs(L, argv, (script > 0) ? script : s->argc);
if (s->status != 0) return 0;
if (script)
s->status = handle_script(L, argv, script);
if (s->status != 0) return 0;
if (has_i)
dotty(L);
else if (script == 0 && !has_e && !has_v) {
if (lua_stdin_is_tty()) {
print_version();
dotty(L);
}
else dofile(L, NULL); /* executes stdin as a file */
}
return 0;
}
开发者ID:andyvand,项目名称:UltraDefrag,代码行数:35,代码来源:lua.c
示例12: pmain
static int pmain (lua_State *L) {
int argc = (int)lua_tointeger(L, 1);
char **argv = (char **)lua_touserdata(L, 2);
int script;
int has_i = 0, has_v = 0, has_e = 0;
if (argv[0] && argv[0][0]) progname = argv[0];
script = collectargs(argv, &has_i, &has_v, &has_e);
if (script < 0) { /* invalid arg? */
print_usage(argv[-script]);
return 0;
}
if (has_v) print_version();
/* open standard libraries */
luaL_checkversion(L);
lua_gc(L, LUA_GCSTOP, 0); /* stop collector during initialization */
luaL_openlibs(L); /* open libraries */
lua_gc(L, LUA_GCRESTART, 0);
/* run LUA_INIT */
if (handle_luainit(L) != LUA_OK) return 0;
/* execute arguments -e and -l */
if (!runargs(L, argv, (script > 0) ? script : argc)) return 0;
/* execute main script (if there is one) */
if (script && handle_script(L, argv, script) != LUA_OK) return 0;
if (has_i) /* -i option? */
dotty(L);
else if (script == 0 && !has_e && !has_v) { /* no arguments? */
if (lua_stdin_is_tty()) {
print_version();
dotty(L);
}
else dofile(L, NULL); /* executes stdin as a file */
}
lua_pushboolean(L, 1); /* signal no errors */
return 1;
}
开发者ID:mabako,项目名称:iv-modlua,代码行数:35,代码来源:lua.c
示例13: main
void
main(int argc, char *argv[])
{
int i;
Biobuf *bin;
Binit(&bout, 1, OWRITE);
argv0 = argv[0];
ARGBEGIN {
case 'a': aflag = 1; break;
case 'g': gflag = 1; break;
case 'h': hflag = 1; break;
case 'n': nflag = 1; break;
case 's': sflag = 1; break;
case 'u': uflag = 1; break;
} ARGEND
if (argc > 1)
multifile++;
for(i=0; i<argc; i++){
filename = argv[i];
bin = Bopen(filename, OREAD);
if(bin == 0){
error("cannot open %s", filename);
continue;
}
if (isar(bin))
doar(bin);
else{
Bseek(bin, 0, 0);
dofile(bin);
}
Bterm(bin);
}
exits(errs);
}
开发者ID:pmallappa,项目名称:ken-cc,代码行数:35,代码来源:nm.c
示例14: pmain
static int pmain(lua_State *L)
{
int argc = (int)lua_tointeger(L, 1);
char **argv = (char**)lua_touserdata(L, 2);
int script;
int args[num_has];
args[has_i] = args[has_v] = args[has_e] = args[has_E] = 0;
if (argv[0] && argv[0][0])
progname = argv[0];
script = collectargs(argv, args);
if (script < 0) /* invalid arg? */
{
print_usage(argv[-script]);
return 0;
}
if (args[has_v])
print_version();
if (args[has_E]) /* option '-E'? */
{
lua_pushboolean(L, 1); /* signal for libraries to ignore env. vars. */
lua_setfield(L, LUA_REGISTRYINDEX, "LUA_NOENV");
}
/* open standard libraries */
luaL_checkversion(L);
lua_gc(L, LUA_GCSTOP, 0); /* stop collector during initialization */
luaL_openlibs(L); /* open libraries */
lua_gc(L, LUA_GCRESTART, 0);
if (!args[has_E] && handle_luainit(L) != LUA_OK)
return 0; /* error running LUA_INIT */
/* execute arguments -e and -l */
if (!runargs(L, argv, (script > 0) ? script : argc))
return 0;
/* execute main script (if there is one) */
if (script && handle_script(L, argv, script) != LUA_OK)
return 0;
if (args[has_i]) /* -i option? */
dotty(L);
else if (script == 0 && !args[has_e] && !args[has_v]) /* no arguments? */
{
if (lua_stdin_is_tty())
{
print_version();
dotty(L);
}
else
dofile(L, NULL); /* executes stdin as a file */
}
lua_pushboolean(L, 1); /* signal no errors */
return 1;
}
开发者ID:hyyh619,项目名称:OpenSceneGraph-3.4.0,代码行数:59,代码来源:lua.c
示例15: pmain
static int pmain(lua_State *L)
{
/* Load Lua libraries */
luaL_openlibs(L);
l_version();
return dofile(L,LUA_INIT_SCRIPT);
}
开发者ID:lzubiaur,项目名称:woot,代码行数:8,代码来源:main.c
示例16: handle_luainit
static int handle_luainit (lua_State *L) {
const char *init = getenv(LUA_INIT);
if (init == NULL) return 0; /* status OK */
else if (init[0] == '@')
return dofile(L, init+1);
else
return dostring(L, init, "=" LUA_INIT);
}
开发者ID:andyvand,项目名称:UltraDefrag,代码行数:8,代码来源:lua.c
示例17: pmain
static int pmain(lua_State *L)
{
struct Smain *s = &smain;
char **argv = s->argv;
int script;
int flags = 0;
globalL = L;
if (argv[0] && argv[0][0]) progname = argv[0];
LUAJIT_VERSION_SYM(); /* linker-enforced version check */
script = collectargs(argv, &flags);
if (script < 0) { /* invalid args? */
print_usage();
s->status = 1;
return 0;
}
if ((flags & FLAGS_NOENV)) {
lua_pushboolean(L, 1);
lua_setfield(L, LUA_REGISTRYINDEX, "LUA_NOENV");
}
lua_gc(L, LUA_GCSTOP, 0); /* stop collector during initialization */
luaL_openlibs(L); /* open libraries */
s->status = tvm_loadbufferx(L, luaJIT_BC_op, luaJIT_BC_op_SIZE, "op", "b")
|| docall(L, 0, 1);
if (s->status != 0) return 0;
s->status = tvm_loadbufferx(L, luaJIT_BC_parse, luaJIT_BC_parse_SIZE, "parse", "b")
|| docall(L, 0, 1);
if (s->status != 0) return 0;
s->status = tvm_loadbufferx(L, luaJIT_BC_lunokhod, luaJIT_BC_lunokhod_SIZE, "lunokhod", "b")
|| docall(L, 0, 1);
if (s->status != 0) return 0;
lua_gc(L, LUA_GCRESTART, -1);
if (!(flags & FLAGS_NOENV)) {
s->status = handle_luainit(L);
if (s->status != 0) return 0;
}
if ((flags & FLAGS_VERSION)) print_version();
s->status = runargs(L, argv, (script > 0) ? script : s->argc);
if (s->status != 0) return 0;
if (script) {
s->status = handle_script(L, argv, script);
if (s->status != 0) return 0;
}
if ((flags & FLAGS_INTERACTIVE)) {
print_jit_status(L);
dotty(L);
} else if (script == 0 && !(flags & (FLAGS_EXEC|FLAGS_VERSION))) {
if (lua_stdin_is_tty()) {
print_version();
print_jit_status(L);
dotty(L);
} else {
dofile(L, NULL); /* executes stdin as a file */
}
}
return 0;
}
开发者ID:pfalcon-mirrors,项目名称:tvmjit,代码行数:56,代码来源:tvmjit.c
示例18: main
int main (int argc, const char * argv[]) {
if (argc != 2) {
printf("Usage: %s filename\n",argv[0]);
return 1;
}
dofile(argv[1]);
return 0;
}
开发者ID:neophytos-sk,项目名称:phigita-star,代码行数:11,代码来源:test.c
示例19: main
int
main(int argc, char **argv)
{
freopen("/tmp/scylla.log", "a+", stderr);
if (argc<3 || argc>4)
{
printf("Usage: %s directory password [ssl-key]\n"
"\tRun Scylla (this here) from inetd.\n"
"\tScylla assumes that Charybdis feeds a file [with SSL].\n"
"\tScylla writes the file into the given directory.\n"
"\tMissing sub-directories are created as needed.\n"
"\tExisting files are renamed.\n", argv[0]);
return 1;
}
if (chdir(argv[1]))
ex("chdir");
sock = 0;
#ifndef NO_SSL
tino_ssl_server((argc>3 ? argv[3] : "/etc/scylla.pem"));
#endif
alarm_init(30,10);
if (sread_match(argv[2], 0))
ex("auth fail");
swrite("scylla " VERSION);
do
{
char *name;
name = sread();
if (!strcmp(name, "..") || !strncmp(name, "../", 3) ||
*name=='/' || strstr(name, "/../"))
ex("- illegal filename");
dofile(name);
free(name);
}
while (!sread_match("m", 0));
#ifndef NO_SSL
tino_ssl_close();
#endif
return 0;
}
开发者ID:hilbix,项目名称:sclib,代码行数:52,代码来源:scylla.c
示例20: handle_luainit
static int handle_luainit (lua_State *L) {
const char *name = "=" LUA_INITVERSION;
const char *init = getenv(name + 1);
if (init == NULL) {
name = "=" LUA_INIT;
init = getenv(name + 1); /* try alternative name */
}
if (init == NULL) return LUA_OK;
else if (init[0] == '@')
return dofile(L, init+1);
else
return dostring(L, init, name);
}
开发者ID:dhrebeniuk,项目名称:linosity,代码行数:13,代码来源:lua.c
注:本文中的dofile函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论