x
Yes
No
Do you want to visit DriveHQ English website?
首页
产品服务
价格
免费试用
下载客户端
关于我们
云文件服务
|
云备份服务
|
FTP服务
|
企业邮箱服务
|
网站托管
|
客户端软件
云文件服务
云备份服务
FTP服务
企业级邮箱服务
网站托管
客户端软件
mkjambase.c - Hosted on DriveHQ Cloud IT Platform
返回上层目录
上传
下载
共享
发布
新建文件夹
新建文件
复制
剪切
删除
粘贴
评论
升级服务
路径: \\game3dprogramming\materials\DarkPuzzle\libs\bullet_sdk\jam-2.5\mkjambase.c
旋转
特效
属性
历史版本
/* * Copyright 1993, 1995 Christopher Seiwald. * * This file is part of Jam - see jam.c for Copyright information. */ /* * mkjambase.c - turn Jambase into a big C structure * * Usage: mkjambase jambase.c Jambase ... * * Results look like this: * * char *jambase[] = { * "...\n", * ... * 0 }; * * Handles \'s and "'s specially; knows to delete blank and comment lines. * * 11/04/02 (seiwald) - const-ing for string literals */ # include
# include
main( int argc, char **argv, char **envp ) { char buf[ 1024 ]; FILE *fin; FILE *fout; char *p; int doDotC = 0; if( argc < 3 ) { fprintf( stderr, "usage: %s jambase.c Jambase ...\n", argv[0] ); return -1; } if( !( fout = fopen( argv[1], "w" ) ) ) { perror( argv[1] ); return -1; } /* If the file ends in .c generate a C source file */ if( ( p = strrchr( argv[1], '.' ) ) && !strcmp( p, ".c" ) ) doDotC++; /* Now process the files */ argc -= 2, argv += 2; if( doDotC ) { fprintf( fout, "/* Generated by mkjambase from Jambase */\n" ); fprintf( fout, "const char *jambase[] = {\n" ); } for( ; argc--; argv++ ) { if( !( fin = fopen( *argv, "r" ) ) ) { perror( *argv ); return -1; } if( doDotC ) { fprintf( fout, "/* %s */\n", *argv ); } else { fprintf( fout, "### %s ###\n", *argv ); } while( fgets( buf, sizeof( buf ), fin ) ) { if( doDotC ) { char *p = buf; /* Strip leading whitespace. */ while( *p == ' ' || *p == '\t' || *p == '\n' ) p++; /* Drop comments and empty lines. */ if( *p == '#' || !*p ) continue; /* Copy */ putc( '"', fout ); for( ; *p && *p != '\n'; p++ ) switch( *p ) { case '\\': putc( '\\', fout ); putc( '\\', fout ); break; case '"': putc( '\\', fout ); putc( '"', fout ); break; default: putc( *p, fout ); break; } fprintf( fout, "\\n\",\n" ); } else { fprintf( fout, "%s", buf ); } } fclose( fin ); } if( doDotC ) fprintf( fout, "0 };\n" ); fclose( fout ); return 0; }
mkjambase.c
网页地址
文件地址
上一页
46/73
下一页
下载
( 2 KB )
Comments
Total ratings:
0
Average rating:
无评论
of 10
Would you like to comment?
Join now
, or
Logon
if you are already a member.