*** comm.c.org Sun Mar 31 21:01:47 1996 --- comm.c Sun Jul 4 15:55:41 1999 *************** *** 7,12 **** --- 7,15 ---- #include /*timeval*/ #include /*(malloc,strtol)*/ #include /*(kill)*/ + #ifdef __FreeBSD__ + #include + #endif #include "comm.h" /*OptType*/ #ifndef DEV_COMM *** mojichk.c.org Sun Apr 21 01:35:07 1996 --- mojichk.c Sun Jul 4 20:48:27 1999 *************** *** 1,5 **** --- 1,8 ---- #include /*optind*/ #include /*->inbuf.h (FILE)*/ + #ifdef __FreeBSD__ + #include + #endif #include "inbuf.h" /*inbuf*/ #define VERSION_MAJOR 0 *************** *** 66,75 **** --- 69,85 ---- /*printf("n = %d\n", n);*/ for (; n > 0; n--) crc(inbufGetByte()); if (verbose) printf("%04x\n", crcReg); + #ifdef FM_MOJI + if (inbuf.top[16] + inbuf.top[17]*256 != crcReg) { + if (verbose) printf("CRC failed.\n"); + exit(STAT_CRCFAIL); /* CRC failed */ + } + #else if (inbuf.top[20] + inbuf.top[21]*256 != crcReg) { if (verbose) printf("CRC failed.\n"); exit(STAT_CRCFAIL); /* CRC failed */ } + #endif } static unsigned crcCrcReg; *************** *** 119,124 **** --- 129,140 ---- crcCrcReg = 0; while (inbufGetBlock()) { inbufSeek(0); + #ifdef FM_MOJI + interestCheck(0); + if (verbose) printf("%02x: ", inbuf.top[2]); + check( ((inbuf.top[1] & 0x7f) * 256 + inbuf.top[2] + 3 + 18-1) + / 18 * 18 - 2 ); + #else if (inbuf.top[0] == 2) { /*STX*/ interestCheck(0); if (verbose) printf("%02x: ", inbuf.top[2]); *************** *** 129,137 **** --- 145,156 ---- if (verbose) printf("head: "); check(20); } + #endif } if (verbose) { + #ifndef FM_MOJI printf("crc of crc: %04x\n", crcCrcReg); + #endif printf("CRC ok.\n"); } } *************** *** 145,150 **** --- 164,181 ---- crcCrcReg = 0; while (inbufGetBlock()) { inbufSeek(0); + #ifdef FM_MOJI + { + int i; + interestCheck(1); + if (verbose) printf("%02x: ", inbuf.top[2]); + i = ((inbuf.top[3] & 0x7f) * 256 + inbuf.top[4] + 8 + 22-1) + / 22 - 1; + for (; i > 0; i--) inbufGetBlock(); /* skip */ + if (verbose) printf("%04x\n", inbuf.top[20] + inbuf.top[21]*256); + if (interested()) crcCrc(); + } + #else if (inbuf.top[0] == 2) { /*STX*/ int i; interestCheck(1); *************** *** 158,163 **** --- 189,195 ---- if (verbose) printf("head: %04x\n", inbuf.top[20] + inbuf.top[21]*256); } + #endif } if (verbose) printf("crc of crc: %04x\n", crcCrcReg); } *** inbuf.h.org Sat Apr 13 15:08:00 1996 --- inbuf.h Sun Jul 4 16:07:26 1999 *************** *** 3,9 **** --- 3,13 ---- #endif struct { + #ifdef FM_MOJI + unsigned char top[18]; + #else unsigned char top[22]; + #endif unsigned char *p; int n; } inbuf; *** modi2.c.org Mon Apr 22 00:28:39 1996 --- modi2.c Sun Jul 4 20:21:27 1999 *************** *** 1,4 **** --- 1,7 ---- #include + #ifdef __FreeBSD__ + #include + #endif #include "inbuf.h" /*(inbufInit)*/ #include "fb.h" /*(fbInit)*/ #include "moji.h" /*(mojiInit)*/ *************** *** 59,64 **** --- 62,104 ---- if (!(opt.text || opt.mus)) fbInit(); mojiInit(opt.text); + #ifdef FM_MOJI + inbufGetBlock(); + inbuf.p = &inbuf.top[11]; + while(1) { + int c = inbufGetByte(); + switch (c) { + case 0x20: /* honbun */ + diagPut(("=== honbun ===\n")); + if (opt.head || opt.mus) break; + moji(0); + continue; + case 0x24: /* header */ + diagPut(("=== header ===\n")); + if (opt.mus) break; + moji(1); + continue; + case 0x36: /* sentaku (NOT impriment) */ + i = (inbufGetByte() & 0x7f) * 0x100; + i += inbufGetByte(); + while(i) { + inbufGetByte(); + --i; + } + continue; + case 0x00: /* null */ + goto end; + default: + if(*(inbuf.p - 2) == 0x03) + goto end; + else { + fprintf(stderr, "format error(%02d)\n",c); + exit(1); + } + } + } + end: + #else while (inbufGetBlock()) { switch (inbuf.top[0]) { case SOH: *************** *** 178,183 **** --- 218,224 ---- formatError(); } } + #endif if (!(opt.text || opt.mus)) fbEnd(); return 0; } *** moji.c.org Sun Apr 21 20:53:05 1996 --- moji.c Sun Jul 4 17:30:22 1999 *************** *** 467,473 **** --- 467,478 ---- charStatReset(isHeader); + #ifdef FM_MOJI + inbufGetByte(); + inbufGetByte(); + #else inbuf.p = &inbuf.top[5]; /*seek!*/ + #endif for (;;) { c = getByte(); switch (c) { *************** *** 478,483 **** --- 483,491 ---- while (!getByte()); return; #else break; + #endif + #ifdef FM_MOJI + case 0x1f: diagPut(("US\n")); return; #endif case 3: diagPut(("ETX\n")); return; case 4: diagPut(("EOT\n")); return; *** fb.c.org Mon Feb 12 00:00:08 1996 --- fb.c Sun Jul 4 17:32:15 1999 *************** *** 20,26 **** --- 20,30 ---- #undef L #undef H + #ifdef FM_MOJI + fbuf = gdImageCreate(248, 60); + #else fbuf = gdImageCreate(248, 204); + #endif for (i = 0; i < 16; i++) if (gdImageColorAllocate(fbuf, r[i], g[i], b[i]) != i) { fprintf(stderr, "Unexpected behavior of gd.\n"); *** photo1.c.org Sat Feb 17 22:53:58 1996 --- photo1.c Sun Jul 4 20:31:58 1999 *************** *** 242,247 **** --- 242,248 ---- } /*EOL:*/ if (s.sd) y++; else y--; + if (s.uc1 & 2) while (mh.run != -1) getMhBit(); } } if (s.uc1 & 2) while (mh.run != -2) mhGetRun();