/[opencvs]/eyes/analyze_source_to_binary.c
ViewVC logotype

Contents of /eyes/analyze_source_to_binary.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations)
Thu Mar 8 11:49:30 2012 UTC (6 years, 6 months ago) by hib
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +4 -2 lines
File MIME type: text/plain
building girl3 (jenni)
1 #include <stdio.h>
2
3 /* This is used to generate binary bitmaps for making weird backgrounds on the fake names
4 stuff */
5
6 int bits[] = {0x1,0x2,0x4,0x8,
7 0x10,0x20,0x40,0x80};
8
9 int main (int argc,char *argv[]) {
10 long maxline=0;
11 char buf[10000];
12 if (argc ==3) {
13 long a,b;
14 a = atoi(argv[1]);
15 b = atoi(argv[2]);
16 maxline = a*b;
17 }
18 long count;
19 count=0;
20 unsigned char thechar=0;
21 while (
22 ((maxline==0)||(count<maxline))
23 &&(gets(buf))
24 ) {
25 if (buf[0]=='#') continue;
26 char buf2[10000];
27 char *a,*b;
28 a=buf;b=buf2;
29 int ctr=0;
30 while (*a) {
31 if (*a != '(') {
32 if (*a == ' ') {
33 a++;
34 continue;
35 }
36 else if ((*a == ':')|| (*a == ',')|| (*a ==')')) {
37 *b++='|';
38 }
39 else
40 *b++= *a;
41 }
42 a++;
43 }
44 *b = '\0';
45
46 b = buf2;
47 ctr = 0;
48 while (*b) {
49 if (*b == '|') {
50 ctr++;
51 if (ctr==5) {
52 *b = '\0';
53 break;
54 }
55 }
56 b++;
57 }
58 int j=0;
59 if (fieldi(buf2,2) > 127) {
60 j=1;
61 }
62 int bitcount = count & 7;
63 if (!bitcount) {
64 if (count) putchar(thechar);
65 thechar=j;
66 }
67 else thechar = thechar | (bits[bitcount] * j);
68 count++;
69 continue;
70 }
71 if (count) putchar(thechar);
72 }
73 /*convert $1 -depth 8 txt: | \
74 grep -v '^#' | \
75 sed s/\(//g | \
76 awk '{print $1 $2 $3 $4}' | \
77 sed s/,/\|/g | \
78 sed s/:/\|/g | \
79 sed s/\)/\|/g |
80 field 1 2 3 4 5
81 # convert dumps stuff out
82 # we then get rid of comments
83 # then we git rid of open parens
84 # then print out x,y:r,g,b)fffff
85 # then filter to x|y:r|g|b)fdffdf
86 # then filter to x|y|r|g|b)fddfdfdf
87 #then filter to x|y|r|g|b|ffffff
88 # the fff is not always there - erroneous.
89 # so we get rid of that by using field
90 */

  ViewVC Help
Powered by ViewVC 1.1.5