diff --git a/final_performance/lib/libsysy.a b/final_performance/lib/libsysy.a new file mode 100644 index 0000000..7abfa51 Binary files /dev/null and b/final_performance/lib/libsysy.a differ diff --git a/final_performance/lib/sylib.c b/final_performance/lib/sylib.c new file mode 100644 index 0000000..dc3d92c --- /dev/null +++ b/final_performance/lib/sylib.c @@ -0,0 +1,83 @@ +#include +#include +#include +#include"sylib.h" +/* Input & output functions */ +int getint(){int t; scanf("%d",&t); return t; } +int getch(){char c; scanf("%c",&c); return (int)c; } +float getfloat(){ + float n; + scanf("%a", &n); + return n; +} + +int getarray(int a[]){ + int n; + scanf("%d",&n); + for(int i=0;i +#include +#include +/* Input & output functions */ +int getint(),getch(),getarray(int a[]); +float getfloat(); +int getfarray(float a[]); + +void putint(int a),putch(int a),putarray(int n,int a[]); +void putfloat(float a); +void putfarray(int n, float a[]); + +void putf(char a[], ...); + +/* Timing function implementation */ +struct timeval _sysy_start,_sysy_end; +#define starttime() _sysy_starttime(__LINE__) +#define stoptime() _sysy_stoptime(__LINE__) +#define _SYSY_N 1024 +int _sysy_l1[_SYSY_N],_sysy_l2[_SYSY_N]; +int _sysy_h[_SYSY_N], _sysy_m[_SYSY_N],_sysy_s[_SYSY_N],_sysy_us[_SYSY_N]; +int _sysy_idx; +__attribute((constructor)) void before_main(); +__attribute((destructor)) void after_main(); +void _sysy_starttime(int lineno); +void _sysy_stoptime(int lineno); + +#endif diff --git a/functional/lib/libsysy.a b/functional/lib/libsysy.a new file mode 100644 index 0000000..7abfa51 Binary files /dev/null and b/functional/lib/libsysy.a differ diff --git a/functional/lib/sylib.c b/functional/lib/sylib.c new file mode 100644 index 0000000..dc3d92c --- /dev/null +++ b/functional/lib/sylib.c @@ -0,0 +1,83 @@ +#include +#include +#include +#include"sylib.h" +/* Input & output functions */ +int getint(){int t; scanf("%d",&t); return t; } +int getch(){char c; scanf("%c",&c); return (int)c; } +float getfloat(){ + float n; + scanf("%a", &n); + return n; +} + +int getarray(int a[]){ + int n; + scanf("%d",&n); + for(int i=0;i +#include +#include +/* Input & output functions */ +int getint(),getch(),getarray(int a[]); +float getfloat(); +int getfarray(float a[]); + +void putint(int a),putch(int a),putarray(int n,int a[]); +void putfloat(float a); +void putfarray(int n, float a[]); + +void putf(char a[], ...); + +/* Timing function implementation */ +struct timeval _sysy_start,_sysy_end; +#define starttime() _sysy_starttime(__LINE__) +#define stoptime() _sysy_stoptime(__LINE__) +#define _SYSY_N 1024 +int _sysy_l1[_SYSY_N],_sysy_l2[_SYSY_N]; +int _sysy_h[_SYSY_N], _sysy_m[_SYSY_N],_sysy_s[_SYSY_N],_sysy_us[_SYSY_N]; +int _sysy_idx; +__attribute((constructor)) void before_main(); +__attribute((destructor)) void after_main(); +void _sysy_starttime(int lineno); +void _sysy_stoptime(int lineno); + +#endif diff --git a/hidden_functional/lib/libsysy.a b/hidden_functional/lib/libsysy.a new file mode 100644 index 0000000..7abfa51 Binary files /dev/null and b/hidden_functional/lib/libsysy.a differ diff --git a/hidden_functional/lib/sylib.c b/hidden_functional/lib/sylib.c new file mode 100644 index 0000000..dc3d92c --- /dev/null +++ b/hidden_functional/lib/sylib.c @@ -0,0 +1,83 @@ +#include +#include +#include +#include"sylib.h" +/* Input & output functions */ +int getint(){int t; scanf("%d",&t); return t; } +int getch(){char c; scanf("%c",&c); return (int)c; } +float getfloat(){ + float n; + scanf("%a", &n); + return n; +} + +int getarray(int a[]){ + int n; + scanf("%d",&n); + for(int i=0;i +#include +#include +/* Input & output functions */ +int getint(),getch(),getarray(int a[]); +float getfloat(); +int getfarray(float a[]); + +void putint(int a),putch(int a),putarray(int n,int a[]); +void putfloat(float a); +void putfarray(int n, float a[]); + +void putf(char a[], ...); + +/* Timing function implementation */ +struct timeval _sysy_start,_sysy_end; +#define starttime() _sysy_starttime(__LINE__) +#define stoptime() _sysy_stoptime(__LINE__) +#define _SYSY_N 1024 +int _sysy_l1[_SYSY_N],_sysy_l2[_SYSY_N]; +int _sysy_h[_SYSY_N], _sysy_m[_SYSY_N],_sysy_s[_SYSY_N],_sysy_us[_SYSY_N]; +int _sysy_idx; +__attribute((constructor)) void before_main(); +__attribute((destructor)) void after_main(); +void _sysy_starttime(int lineno); +void _sysy_stoptime(int lineno); + +#endif diff --git a/init.sh b/init.sh index 88a78a2..6b0399c 100755 --- a/init.sh +++ b/init.sh @@ -5,6 +5,8 @@ # 把当前目录下后缀为.out的文件放入文件夹out中 # 把当前目录下后缀为.sy的文件放入文件夹sy中 +# cp -r ./lib $1/lib + cd $1 # 如果文件夹不存在则创建 if [ ! -d "in" ]; then @@ -16,21 +18,22 @@ fi if [ ! -d "sy" ]; then mkdir sy fi +# -# 把当前目录下后缀为.in的文件放入文件夹in中 -for file in `ls *.in` -do - mv $file in -done +# # 把当前目录下后缀为.in的文件放入文件夹in中 +# for file in `ls *.in` +# do +# mv $file in +# done -# 把当前目录下后缀为.out的文件放入文件夹out中 -for file in `ls *.out` -do - mv $file out -done +# # 把当前目录下后缀为.out的文件放入文件夹out中 +# for file in `ls *.out` +# do +# mv $file out +# done -# 把当前目录下后缀为.sy的文件放入文件夹sy中 -for file in `ls *.sy` -do - mv $file sy -done +# # 把当前目录下后缀为.sy的文件放入文件夹sy中 +# for file in `ls *.sy` +# do +# mv $file sy +# done diff --git a/performance/lib/libsysy.a b/performance/lib/libsysy.a new file mode 100644 index 0000000..7abfa51 Binary files /dev/null and b/performance/lib/libsysy.a differ diff --git a/performance/lib/sylib.c b/performance/lib/sylib.c new file mode 100644 index 0000000..dc3d92c --- /dev/null +++ b/performance/lib/sylib.c @@ -0,0 +1,83 @@ +#include +#include +#include +#include"sylib.h" +/* Input & output functions */ +int getint(){int t; scanf("%d",&t); return t; } +int getch(){char c; scanf("%c",&c); return (int)c; } +float getfloat(){ + float n; + scanf("%a", &n); + return n; +} + +int getarray(int a[]){ + int n; + scanf("%d",&n); + for(int i=0;i +#include +#include +/* Input & output functions */ +int getint(),getch(),getarray(int a[]); +float getfloat(); +int getfarray(float a[]); + +void putint(int a),putch(int a),putarray(int n,int a[]); +void putfloat(float a); +void putfarray(int n, float a[]); + +void putf(char a[], ...); + +/* Timing function implementation */ +struct timeval _sysy_start,_sysy_end; +#define starttime() _sysy_starttime(__LINE__) +#define stoptime() _sysy_stoptime(__LINE__) +#define _SYSY_N 1024 +int _sysy_l1[_SYSY_N],_sysy_l2[_SYSY_N]; +int _sysy_h[_SYSY_N], _sysy_m[_SYSY_N],_sysy_s[_SYSY_N],_sysy_us[_SYSY_N]; +int _sysy_idx; +__attribute((constructor)) void before_main(); +__attribute((destructor)) void after_main(); +void _sysy_starttime(int lineno); +void _sysy_stoptime(int lineno); + +#endif diff --git a/readme.md b/readme.md index 92b5134..74cf223 100644 --- a/readme.md +++ b/readme.md @@ -1,3 +1,2 @@ # SySy测试代码 -有事没事翻译一点c的代码为sysy的代码加入进来 \ No newline at end of file