preparing 0.9 version, rename to crl1.h
[svn/Cll1h/.git] / demos / idmap.c
diff --git a/demos/idmap.c b/demos/idmap.c
deleted file mode 100644 (file)
index ff96319..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-#include "cll1.h"
-
-struct Line
-{
- int n;
- list(Line);
-} *line;
-
-struct Id
-{
- char *str;
- int count;
- struct Line *lines;
- list(Id);
-} *id,*ids=NULL;
-
-program
-{
- char *ptr;
- char *fname;
- char *c=NULL;
- int l=0;
-
- arguments
- {
-  thisargument(fname);
-  nextargument(c);
- }
- else
- {
-  puts("Usage: idmap file [c]");
-  return 1;
- }
-
- parse(fname)
- {
-  l++;
-  while(*_)
-  {
-   goto_alpha(_);
-   ptr=_;
-   skip_alnum(_);
-   *_=0;
-   _++;
-
-   if(*ptr)
-   {
-    if_exists(id,ids,eq(id->str,ptr))
-    {
-     id->count++;
-     if_exists(line,id->lines,line->n==l);
-     else
-     {
-      create(line,Line);
-      line->n=l;
-      push(line,id->lines);
-     }
-    }
-    else 
-    {
-     create(id,Id);
-     create(line,Line);
-     id->str=ptr;
-     id->count=1;
-     id->lines=line;
-     line->n=l;
-     insert(id,ids,sort_by,str);
-    }
-   }
-   if(*_=='"' || *_=='\'' )
-   {
-    char c=*_;
-    _++;
-    gotochr(_,c);
-   }
-  }
- }
- fail
- { 
-  perror(argv[1]); 
-  exit(-1);
- }
- done;
-
- if(c)
-  sort(id,ids,desc_order_by,count);
-  
- for_each(id,ids)
- { 
-  printf("%3dx %s",id->count,id->str);
-  for_each(line,id->lines) printf(" [%d]",line->n);
-  printf("\n"); 
- }
-}
This page took 0.116105 seconds and 4 git commands to generate.