[commit][3759] ckformat. c is normally generated from Smalltalk sources as src/ckformat.c

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[commit][3759] ckformat. c is normally generated from Smalltalk sources as src/ckformat.c

commits-3
 
Revision: 3759
Author:   lewis
Date:     2017-04-10 18:31:29 -0700 (Mon, 10 Apr 2017)
Log Message:
-----------
ckformat.c is normally generated from Smalltalk sources as src/ckformat.c
and is compiled from that source file. An older reference copy is retained
as platforms/unix/cmake/ckformat.c. Update it to match a recent version as
of April 2017.

Modified Paths:
--------------
    trunk/platforms/unix/cmake/ckformat.c

Modified: trunk/platforms/unix/cmake/ckformat.c
===================================================================
--- trunk/platforms/unix/cmake/ckformat.c 2017-02-23 01:23:17 UTC (rev 3758)
+++ trunk/platforms/unix/cmake/ckformat.c 2017-04-11 01:31:29 UTC (rev 3759)
@@ -5,18 +5,19 @@
 /* Usage: ckformat imageFileName */
 
 /* --- DO NOT EDIT THIS FILE --- */
-/* --- Automatically generated from class ImageFormat 2010-12-31T16:30:58.66-05:00--- */
-/* --- Souce code is in package ImageFormat, archive www.squeaksource.com/VMMaker --- */
+/* --- Automatically generated from class ImageFormat 2017-02-22T20:18:22.443+01:00--- */
+/* --- Source code is in package ImageFormat in the VMMaker repository --- */
 /* --- DO NOT EDIT THIS FILE --- */
 
 #include <stdio.h>
-
 #include <stdlib.h>
+#include <string.h>
 
-int main(int argc, char **argv) {
+main(int argc, char **argv) {
  FILE *f;
  unsigned char buf[8];
  int formatNumber;
+ unsigned char c;
  int match;
  if (argc != 2) {
  printf("usage: ckformat imageFileName\n");
@@ -27,154 +28,274 @@
  perror(argv[1]);
  exit(2);
  }
+ if(fseek(f, 0L, SEEK_SET) != 0) {
+ fprintf(stderr, "cannot go to pos %d in %s\n", 0, argv[1]);
+ exit(3);
+ }
  if (fread(buf, 1, 8, f) < 8) {
  fprintf(stderr, "cannot read %s\n", argv[1]);
  exit(3);
  }
- formatNumber= 6502;
- match = 1;
- if (buf[0] != 0) match= 0;
- if (buf[1] != 0) match= 0;
- if (buf[2] != 25) match= 0;
- if (buf[3] != 102) match= 0;
- if (match) {
- printf("%d\n", formatNumber);
+ {
+ unsigned char b_6502_1[4]= { 0, 0, 25, 102};
+ if (strncmp(buf, b_6502_1, 4) == 0) {
+ printf("%d\n", 6502);
  exit(0);
  }
- formatNumber= 6502;
- match = 1;
- if (buf[0] != 102) match= 0;
- if (buf[1] != 25) match= 0;
- if (buf[2] != 0) match= 0;
- if (buf[3] != 0) match= 0;
- if (match) {
- printf("%d\n", formatNumber);
+ }
+ {
+ unsigned char b_6502_2[4]= { 102, 25, 0, 0};
+ if (strncmp(buf, b_6502_2, 4) == 0) {
+ printf("%d\n", 6502);
  exit(0);
  }
- formatNumber= 6504;
- match = 1;
- if (buf[0] != 0) match= 0;
- if (buf[1] != 0) match= 0;
- if (buf[2] != 25) match= 0;
- if (buf[3] != 104) match= 0;
- if (match) {
- printf("%d\n", formatNumber);
+ }
+ {
+ unsigned char b_6504_3[4]= { 0, 0, 25, 104};
+ if (strncmp(buf, b_6504_3, 4) == 0) {
+ printf("%d\n", 6504);
  exit(0);
  }
- formatNumber= 6504;
- match = 1;
- if (buf[0] != 104) match= 0;
- if (buf[1] != 25) match= 0;
- if (buf[2] != 0) match= 0;
- if (buf[3] != 0) match= 0;
- if (match) {
- printf("%d\n", formatNumber);
+ }
+ {
+ unsigned char b_6504_4[4]= { 104, 25, 0, 0};
+ if (strncmp(buf, b_6504_4, 4) == 0) {
+ printf("%d\n", 6504);
  exit(0);
  }
- formatNumber= 6505;
- match = 1;
- if (buf[0] != 0) match= 0;
- if (buf[1] != 0) match= 0;
- if (buf[2] != 25) match= 0;
- if (buf[3] != 105) match= 0;
- if (match) {
- printf("%d\n", formatNumber);
+ }
+ {
+ unsigned char b_68000_5[8]= { 0, 0, 0, 0, 0, 1, 9, 160};
+ if (strncmp(buf, b_68000_5, 8) == 0) {
+ printf("%d\n", 68000);
  exit(0);
  }
- formatNumber= 6505;
- match = 1;
- if (buf[0] != 105) match= 0;
- if (buf[1] != 25) match= 0;
- if (buf[2] != 0) match= 0;
- if (buf[3] != 0) match= 0;
- if (match) {
- printf("%d\n", formatNumber);
+ }
+ {
+ unsigned char b_68000_6[8]= { 160, 9, 1, 0, 0, 0, 0, 0};
+ if (strncmp(buf, b_68000_6, 8) == 0) {
+ printf("%d\n", 68000);
  exit(0);
  }
- formatNumber= 68000;
- match = 1;
- if (buf[0] != 0) match= 0;
- if (buf[1] != 0) match= 0;
- if (buf[2] != 0) match= 0;
- if (buf[3] != 0) match= 0;
- if (buf[4] != 0) match= 0;
- if (buf[5] != 1) match= 0;
- if (buf[6] != 9) match= 0;
- if (buf[7] != 160) match= 0;
- if (match) {
- printf("%d\n", formatNumber);
+ }
+ {
+ unsigned char b_68002_7[8]= { 0, 0, 0, 0, 0, 1, 9, 162};
+ if (strncmp(buf, b_68002_7, 8) == 0) {
+ printf("%d\n", 68002);
  exit(0);
  }
- formatNumber= 68000;
- match = 1;
- if (buf[0] != 160) match= 0;
- if (buf[1] != 9) match= 0;
- if (buf[2] != 1) match= 0;
- if (buf[3] != 0) match= 0;
- if (buf[4] != 0) match= 0;
- if (buf[5] != 0) match= 0;
- if (buf[6] != 0) match= 0;
- if (buf[7] != 0) match= 0;
- if (match) {
- printf("%d\n", formatNumber);
+ }
+ {
+ unsigned char b_68002_8[8]= { 162, 9, 1, 0, 0, 0, 0, 0};
+ if (strncmp(buf, b_68002_8, 8) == 0) {
+ printf("%d\n", 68002);
  exit(0);
  }
- formatNumber= 68002;
- match = 1;
- if (buf[0] != 0) match= 0;
- if (buf[1] != 0) match= 0;
- if (buf[2] != 0) match= 0;
- if (buf[3] != 0) match= 0;
- if (buf[4] != 0) match= 0;
- if (buf[5] != 1) match= 0;
- if (buf[6] != 9) match= 0;
- if (buf[7] != 162) match= 0;
- if (match) {
- printf("%d\n", formatNumber);
+ }
+ {
+ unsigned char b_6505_9[4]= { 0, 0, 25, 105};
+ if (strncmp(buf, b_6505_9, 4) == 0) {
+ printf("%d\n", 6505);
  exit(0);
  }
- formatNumber= 68002;
- match = 1;
- if (buf[0] != 162) match= 0;
- if (buf[1] != 9) match= 0;
- if (buf[2] != 1) match= 0;
- if (buf[3] != 0) match= 0;
- if (buf[4] != 0) match= 0;
- if (buf[5] != 0) match= 0;
- if (buf[6] != 0) match= 0;
- if (buf[7] != 0) match= 0;
- if (match) {
- printf("%d\n", formatNumber);
+ }
+ {
+ unsigned char b_6505_10[4]= { 105, 25, 0, 0};
+ if (strncmp(buf, b_6505_10, 4) == 0) {
+ printf("%d\n", 6505);
  exit(0);
  }
- formatNumber= 68003;
- match = 1;
- if (buf[0] != 0) match= 0;
- if (buf[1] != 0) match= 0;
- if (buf[2] != 0) match= 0;
- if (buf[3] != 0) match= 0;
- if (buf[4] != 0) match= 0;
- if (buf[5] != 1) match= 0;
- if (buf[6] != 9) match= 0;
- if (buf[7] != 163) match= 0;
- if (match) {
- printf("%d\n", formatNumber);
+ }
+ {
+ unsigned char b_68003_11[8]= { 0, 0, 0, 0, 0, 1, 9, 163};
+ if (strncmp(buf, b_68003_11, 8) == 0) {
+ printf("%d\n", 68003);
  exit(0);
  }
- formatNumber= 68003;
- match = 1;
- if (buf[0] != 163) match= 0;
- if (buf[1] != 9) match= 0;
- if (buf[2] != 1) match= 0;
- if (buf[3] != 0) match= 0;
- if (buf[4] != 0) match= 0;
- if (buf[5] != 0) match= 0;
- if (buf[6] != 0) match= 0;
- if (buf[7] != 0) match= 0;
- if (match) {
- printf("%d\n", formatNumber);
+ }
+ {
+ unsigned char b_68003_12[8]= { 163, 9, 1, 0, 0, 0, 0, 0};
+ if (strncmp(buf, b_68003_12, 8) == 0) {
+ printf("%d\n", 68003);
  exit(0);
  }
- printf("0"); /* print an invalid format number */
+ }
+ {
+ unsigned char b_6521_13[4]= { 0, 0, 25, 121};
+ if (strncmp(buf, b_6521_13, 4) == 0) {
+ printf("%d\n", 6521);
+ exit(0);
+ }
+ }
+ {
+ unsigned char b_6521_14[4]= { 121, 25, 0, 0};
+ if (strncmp(buf, b_6521_14, 4) == 0) {
+ printf("%d\n", 6521);
+ exit(0);
+ }
+ }
+ {
+ unsigned char b_68019_15[8]= { 0, 0, 0, 0, 0, 1, 9, 179};
+ if (strncmp(buf, b_68019_15, 8) == 0) {
+ printf("%d\n", 68019);
+ exit(0);
+ }
+ }
+ {
+ unsigned char b_68019_16[8]= { 179, 9, 1, 0, 0, 0, 0, 0};
+ if (strncmp(buf, b_68019_16, 8) == 0) {
+ printf("%d\n", 68019);
+ exit(0);
+ }
+ }
+ {
+ unsigned char b_68021_17[8]= { 0, 0, 0, 0, 0, 1, 9, 181};
+ if (strncmp(buf, b_68021_17, 8) == 0) {
+ printf("%d\n", 68021);
+ exit(0);
+ }
+ }
+ {
+ unsigned char b_68021_18[8]= { 181, 9, 1, 0, 0, 0, 0, 0};
+ if (strncmp(buf, b_68021_18, 8) == 0) {
+ printf("%d\n", 68021);
+ exit(0);
+ }
+ }
+ if(fseek(f, 512L, SEEK_SET) != 0) {
+ fprintf(stderr, "cannot go to pos %d in %s\n", 512, argv[1]);
+ exit(3);
+ }
+ if (fread(buf, 1, 8, f) < 8) {
+ fprintf(stderr, "cannot read %s\n", argv[1]);
+ exit(3);
+ }
+ {
+ unsigned char b_6502_1[4]= { 0, 0, 25, 102};
+ if (strncmp(buf, b_6502_1, 4) == 0) {
+ printf("%d\n", 6502);
+ exit(0);
+ }
+ }
+ {
+ unsigned char b_6502_2[4]= { 102, 25, 0, 0};
+ if (strncmp(buf, b_6502_2, 4) == 0) {
+ printf("%d\n", 6502);
+ exit(0);
+ }
+ }
+ {
+ unsigned char b_6504_3[4]= { 0, 0, 25, 104};
+ if (strncmp(buf, b_6504_3, 4) == 0) {
+ printf("%d\n", 6504);
+ exit(0);
+ }
+ }
+ {
+ unsigned char b_6504_4[4]= { 104, 25, 0, 0};
+ if (strncmp(buf, b_6504_4, 4) == 0) {
+ printf("%d\n", 6504);
+ exit(0);
+ }
+ }
+ {
+ unsigned char b_68000_5[8]= { 0, 0, 0, 0, 0, 1, 9, 160};
+ if (strncmp(buf, b_68000_5, 8) == 0) {
+ printf("%d\n", 68000);
+ exit(0);
+ }
+ }
+ {
+ unsigned char b_68000_6[8]= { 160, 9, 1, 0, 0, 0, 0, 0};
+ if (strncmp(buf, b_68000_6, 8) == 0) {
+ printf("%d\n", 68000);
+ exit(0);
+ }
+ }
+ {
+ unsigned char b_68002_7[8]= { 0, 0, 0, 0, 0, 1, 9, 162};
+ if (strncmp(buf, b_68002_7, 8) == 0) {
+ printf("%d\n", 68002);
+ exit(0);
+ }
+ }
+ {
+ unsigned char b_68002_8[8]= { 162, 9, 1, 0, 0, 0, 0, 0};
+ if (strncmp(buf, b_68002_8, 8) == 0) {
+ printf("%d\n", 68002);
+ exit(0);
+ }
+ }
+ {
+ unsigned char b_6505_9[4]= { 0, 0, 25, 105};
+ if (strncmp(buf, b_6505_9, 4) == 0) {
+ printf("%d\n", 6505);
+ exit(0);
+ }
+ }
+ {
+ unsigned char b_6505_10[4]= { 105, 25, 0, 0};
+ if (strncmp(buf, b_6505_10, 4) == 0) {
+ printf("%d\n", 6505);
+ exit(0);
+ }
+ }
+ {
+ unsigned char b_68003_11[8]= { 0, 0, 0, 0, 0, 1, 9, 163};
+ if (strncmp(buf, b_68003_11, 8) == 0) {
+ printf("%d\n", 68003);
+ exit(0);
+ }
+ }
+ {
+ unsigned char b_68003_12[8]= { 163, 9, 1, 0, 0, 0, 0, 0};
+ if (strncmp(buf, b_68003_12, 8) == 0) {
+ printf("%d\n", 68003);
+ exit(0);
+ }
+ }
+ {
+ unsigned char b_6521_13[4]= { 0, 0, 25, 121};
+ if (strncmp(buf, b_6521_13, 4) == 0) {
+ printf("%d\n", 6521);
+ exit(0);
+ }
+ }
+ {
+ unsigned char b_6521_14[4]= { 121, 25, 0, 0};
+ if (strncmp(buf, b_6521_14, 4) == 0) {
+ printf("%d\n", 6521);
+ exit(0);
+ }
+ }
+ {
+ unsigned char b_68019_15[8]= { 0, 0, 0, 0, 0, 1, 9, 179};
+ if (strncmp(buf, b_68019_15, 8) == 0) {
+ printf("%d\n", 68019);
+ exit(0);
+ }
+ }
+ {
+ unsigned char b_68019_16[8]= { 179, 9, 1, 0, 0, 0, 0, 0};
+ if (strncmp(buf, b_68019_16, 8) == 0) {
+ printf("%d\n", 68019);
+ exit(0);
+ }
+ }
+ {
+ unsigned char b_68021_17[8]= { 0, 0, 0, 0, 0, 1, 9, 181};
+ if (strncmp(buf, b_68021_17, 8) == 0) {
+ printf("%d\n", 68021);
+ exit(0);
+ }
+ }
+ {
+ unsigned char b_68021_18[8]= { 181, 9, 1, 0, 0, 0, 0, 0};
+ if (strncmp(buf, b_68021_18, 8) == 0) {
+ printf("%d\n", 68021);
+ exit(0);
+ }
+ }
+ printf("0\n"); /* print an invalid format number */
  exit (-1); /* not found, exit with error code */
 }

Loading...