Mercurial > hg > Members > nobuyasu > CbC
changeset 14:43cfb6cbf809 draft
add Huffman
author | Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 31 Jul 2012 04:15:35 +0900 |
parents | f29ec9081099 |
children | 7da9f2892b4e |
files | Huffman/a.out Huffman/test-huffman.c Huffman/test.txt fibonacci/Makefile fibonacci/fibonacci2.cbc |
diffstat | 5 files changed, 48 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Huffman/test-huffman.c Tue Jul 31 04:15:35 2012 +0900 @@ -0,0 +1,34 @@ +#include <stdio.h> +#include <stdlib.h> + + + + + +#define BUF 1024 + + +int main(int argc, char* argv[]) { + + FILE *fp; + char *filename = "./test.txt"; + if ( (fp = fopen( filename,"r")) == NULL ) { + fprintf(stderr, "can't open file %s\n", filename); + exit(0); + } + char c; + while (c = getc(fp)) { + if (feof(fp)) { + break; + } + + putc(c,stdout); + + } + + + + + fclose(fp); + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Huffman/test.txt Tue Jul 31 04:15:35 2012 +0900 @@ -0,0 +1,1 @@ +AAAABBBBCCCCDDDD
--- a/fibonacci/Makefile Fri Jun 15 04:18:53 2012 +0900 +++ b/fibonacci/Makefile Tue Jul 31 04:15:35 2012 +0900 @@ -1,15 +1,19 @@ CbCC=cbc-gcc-4.6.0 -#CFLAGS="-O3 -v" -CFLAGS=-O2 +#CFLAGS="-O3" +CFLAGS=-O2 -m64 +#CFLAGS=-O0 -PROGRAM= cbc_fibonacci2 c_fibonacci2 +#PROGRAM= fibonacci2_cbc_loop fibonacci2_c_loop fibonacci2_norec +PROGRAM= fibonacci2_cbc_loop fibonacci2_norec all: $(PROGRAM) -cbc_fibonacci2: fibonacci2.cbc - $(CbCC) $(CFLAGS) -o $@ $^ -c_fibonacci2: fibonacci2.c - $(CbCC) $(CFLAGS) -o $@ $^ +fibonacci2_cbc_loop: fibonacci2_loop.cbc + $(CbCC) $(CFLAGS) -o $@ $^ +fibonacci2_c_loop: fibonacci2_loop.c + $(CbCC) $(CFLAGS) -o $@ $^ +fibonacci2_norec: fibonacci2_norec.cbc + $(CbCC) $(CFLAGS) -o $@ $^ clean: - rm e $(PROGRAM) \ No newline at end of file + rm $(PROGRAM)
--- a/fibonacci/fibonacci2.cbc Fri Jun 15 04:18:53 2012 +0900 +++ b/fibonacci/fibonacci2.cbc Tue Jul 31 04:15:35 2012 +0900 @@ -1,7 +1,7 @@ #include <stdio.h> #include <stdlib.h> __code print(__rectype *p, long int num, long int count, long int result, long int prev) { - printf("fibonacci(%d) = %lld\n",num,result); + printf("fibonacci(%d) = %ld\n",num,result); goto cs_while(print, num, count, result, prev); // exit(0); }