1 Star 0 Fork 4

EzioZz/swcodegen

forked from 锦轩/swcodegen 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
sw_common.c 1.22 KB
一键复制 编辑 原始数据 按行查看 历史
锦轩 提交于 2020-07-19 19:55 . matrix multiply passed
#include <ctype.h>
#include <limits.h>
#include <string.h>
#include "sw_common.h"
#include "ppcg.h"
/* Open the hosc .c file and the slave .c file for writing.
* Add the neccessary includes.
*/
void sw_open_files(struct sw_info *info, const char *input)
{
char name[PATH_MAX];
int len;
len = ppcg_extract_base_name(name, input);
strcpy(name + len, "_host.c");
info->host_c = fopen(name, "w");
strcpy(name + len, "_slave.c");
info->slave_c = fopen(name, "w");
strcpy(name + len, "_slave.h");
info->slave_h = fopen(name, "w");
fprintf(info->host_c, "#include <stdlib.h>\n");
//fprintf(info->host_c, "#include <stdio.h>\n");
fprintf(info->host_c, "#include <athread.h>\n");
//fprintf(info->host_c, "#include <sys/type.h>\n");
//fprintf(info->host_c, "#include <sys/stat.h>\n");
fprintf(info->host_c, "#include <fcntl.h>\n");
fprintf(info->host_c, "#include \"%s\"\n", name);
fprintf(info->slave_c, "#include <stdio.h>\n");
fprintf(info->slave_c, "#include <math.h>\n");
fprintf(info->slave_c, "#include <string.h>\n");
fprintf(info->slave_c, "#include \"slave.h\"\n");
}
/* Close all output files.
*/
void sw_close_files(struct sw_info *info)
{
fclose(info->slave_h);
fclose(info->slave_c);
fclose(info->host_c);
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C
1
https://gitee.com/EzioZz/swcodegen.git
git@gitee.com:EzioZz/swcodegen.git
EzioZz
swcodegen
swcodegen
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385