diff options
author | root <root@no.no.james.local> | 2016-03-16 20:50:13 +0000 |
---|---|---|
committer | root <root@no.no.james.local> | 2016-03-16 20:50:13 +0000 |
commit | 666d7880fb56268b84e5dc282077ab1205be567f (patch) | |
tree | 3175bfedf5a66e60f1af78e556042e5600168d2f /code/ATTIC/old-hpgl.c | |
download | laser_projector-666d7880fb56268b84e5dc282077ab1205be567f.tar.gz laser_projector-666d7880fb56268b84e5dc282077ab1205be567f.tar.bz2 laser_projector-666d7880fb56268b84e5dc282077ab1205be567f.zip |
works
Diffstat (limited to 'code/ATTIC/old-hpgl.c')
-rw-r--r-- | code/ATTIC/old-hpgl.c | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/code/ATTIC/old-hpgl.c b/code/ATTIC/old-hpgl.c new file mode 100644 index 0000000..a915b8c --- /dev/null +++ b/code/ATTIC/old-hpgl.c @@ -0,0 +1,70 @@ +#include <stdio.h> +#include <stdlib.h> +#include <stdint.h> + + +void pos(int x,int y,int b ) +{ +int16_t lr[2]; + +lr[0]=x; +lr[1]=y; + +lr[0]&=~1; +if (!b) lr[1]|=1; + +fwrite(lr,sizeof(lr),1,stdout); +fwrite(lr,sizeof(lr),1,stdout); +fwrite(lr,sizeof(lr),1,stdout); +} + + + +void ana(char *s ) +{ +int16_t lr[2]; +int x,y; + + +if (strncmp(s,"PA",2)) return; + +if (sscanf(s,"PA%d,%d",&x,&y)!=2) return; + + +lr[0]=y*2 - 10000; +lr[1]=10000-x*2; + +lr[0]&=~1; +if (x<3000) lr[1]|=1; + +fwrite(lr,sizeof(lr),1,stdout); +} + + +int main(int argc,char *argv[]) +{ +char c; +char buf[1024]; +int ic,len; + + +buf[0]=0; +len=0; + +while ((ic=getchar())!=EOF) +{ +c=ic; +if ((c==';') || (c=='\n') || (c=='\r')) { + ana(buf); + buf[0]=0; + len=0; +} else { + buf[len++]=c; + buf[len]=0; +} +} + +ana(buf); + +return 0; +} |