Mercurial > hg > Members > nobuyasu > CbC
changeset 4:afa536eef659
remove some files
author | Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 19 Apr 2012 13:41:35 +0900 |
parents | 4e98faa1d831 |
children | d6ac7ec2c6a7 5dc0fa7caa57 |
files | automaton/fautomaton1.cbc~ automaton/test.c~ |
diffstat | 2 files changed, 0 insertions(+), 122 deletions(-) [+] |
line wrap: on
line diff
--- a/automaton/fautomaton1.cbc~ Thu Apr 19 13:41:11 2012 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,107 +0,0 @@ -/* - * Implementation of the fininte automat by CbC - * test program - * - * Finite automaton M. - * M = ({q1,q2},{0,1}, delta, q1, {q2}) - * - * delta = - * |0 1 - * ----------- - * q1|q1 q2 - * q1|q1 q2 - */ - -#include <stdio.h> -#include <stdlib.h> // exit() -#include <string.h> // strlen() - -__code q1(char *c, int size, int count); -__code q2(char *c, int size, int count); - - -__code print_error() -{ - printf("error\n"); - exit(0); -} - -__code no_recognize() -{ - printf("no recognize\n"); -} - -__code recognize() -{ - printf("recognize\n"); -} - -int _isspace(char c) -{ - return c == ' ' || c == '\t'; -} - -char *skipchar(char *c) -{ - - while(_isspace(*c)) { - c++; - } - - return c; -} - -__code q1(char *c, int size, int count) -{ -// char *ch = skipchar(c); - char *ch = c; - ch++; - count++; - switch(*c) { - case '0': - goto q1(ch, size, count); - break; - case '1': - goto q2(ch, size, count); - break; - default: - if(count >= size) - goto no_recognize(); - else - goto recognize(); - - } - -} - -__code q2(char *c, int size, int count) -{ -// char *ch = skipchar(c); - char *ch = c; - ch++; - count++; - switch(*c) { - case '0': - goto q1(ch, size, count); - break; - case '1': - goto q2(ch, size, count); - break; - default: - if(count >= size) - goto recognize(); - else - goto no_recognize(); - } - -} - - -int main(int argc, char *argv[]) -{ - if(argc == 1 ) goto print_error(); - int size = strlen(argv[1]); - char *c = argv[1]; - goto q1(c, size, 0); - return 0; -}
--- a/automaton/test.c~ Thu Apr 19 13:41:11 2012 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,15 +0,0 @@ -#include <stdio.h> - -int main(int argc, char *argv[]) { - long size = sizeof(argv[0])/sizeof(char); - char *c = argv[0]; - printf("argv[0] = %s\n",argv[0]); - - printf("size = %ld\n",size); - long i; - for(i=0; i<size; i++,c++) { - printf("%c",*c); - } - - return 0; -}