generate_philips_list.c

来自「一个手机平台的字体现实标准库转平台c源字库的脚本程序。」· C语言 代码 · 共 71 行

C
71
字号
#include <stdio.h>
#include <string.h>
#define SIZE  512

void gen_index_file(void)
{
FILE * finp, * fout;	
char * p1, * p2, * p3;
char str[SIZE];
char str1[128];

memset(str, 0, SIZE);
memset(str1, 0, sizeof(str1));	

p1=p2=p3=NULL;	

if((finp=fopen("ph_in.h","r"))==NULL)
{
	printf("input file err!\n");
	exit(0);	
}
	
if((fout=fopen("index.h","w+"))==NULL)
{
	printf("output file err!\n");
	exit(0);	
}

// /* ¤ */  {/*0x00a4,*/  

fputs("int data_index[]={",fout);
fputc('\n',fout);
while(fgets(str,sizeof(str),finp))
{
	p1=strstr(str,"/*");
	if(!p1)
	continue;
	p2=strstr(str,"*/");
	p2++,p2++;

	memcpy(str1,p1,(p2-p1));
	
	fputs(str1,fout);
	memset(str1, 0, sizeof(str1));	
	p1=strstr(str,"{/*");
	p2=strstr(p1,"*/");
	p1+=3;

	memcpy(str1,p1,(p2-p1));
	fputs(str1,fout);
	fputc('\n',fout);
	
}
fputc('}',fout);
fputc(';',fout);






fclose(finp);
fclose(fout);

	
}

main()
{
gen_index_file();	
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?