Author: piumarta Date: 2012-07-30 11:30:13 -0700 (Mon, 30 Jul 2012) New Revision: 2564
Added: trunk/platforms/unix/cmake/ckformat.c Modified: trunk/platforms/unix/vm/build.cmake Log: buil ckformat and install in plugin directory
Added: trunk/platforms/unix/cmake/ckformat.c =================================================================== --- trunk/platforms/unix/cmake/ckformat.c (rev 0) +++ trunk/platforms/unix/cmake/ckformat.c 2012-07-30 18:30:13 UTC (rev 2564) @@ -0,0 +1,180 @@ +/* ckformat: Print the image format number on standard output */ +/* for use in a shell script to test image format requirements. */ +/* A non-zero return status code indicates failure. */ + +/* 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 --- */ +/* --- DO NOT EDIT THIS FILE --- */ + +#include <stdio.h> + +#include <stdlib.h> + +int main(int argc, char **argv) { + FILE *f; + unsigned char buf[8]; + int formatNumber; + int match; + if (argc != 2) { + printf("usage: ckformat imageFileName\n"); + exit(1); + } + f = fopen(argv[1], "r"); + if (f == NULL) { + perror(argv[1]); + exit(2); + } + 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); + 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); + 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); + 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); + 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); + 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); + 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); + 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); + 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); + 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); + 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); + 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); + exit(0); + } + printf("0"); /* print an invalid format number */ + exit (-1); /* not found, exit with error code */ +}
Modified: trunk/platforms/unix/vm/build.cmake =================================================================== --- trunk/platforms/unix/vm/build.cmake 2012-07-30 18:23:16 UTC (rev 2563) +++ trunk/platforms/unix/vm/build.cmake 2012-07-30 18:30:13 UTC (rev 2564) @@ -65,17 +65,24 @@ COMMAND chmod +x ${bld}/squeak )
+INSTALL (PROGRAMS ${bld}/squeak DESTINATION bin) + ADD_CUSTOM_TARGET (squeak.sh DEPENDS ${config}/squeak.sh.in COMMAND sh ${bld}/config ${config}/squeak.sh.in ${bld}/squeak.sh COMMAND chmod +x ${bld}/squeak.sh )
-ADD_DEPENDENCIES (squeakvm squeak squeak.sh) - -INSTALL (PROGRAMS ${bld}/squeak DESTINATION bin) INSTALL (PROGRAMS ${bld}/squeak.sh DESTINATION bin)
+ADD_EXECUTABLE (ckformat + ${config}/ckformat.c +) + +INSTALL (PROGRAMS ${bld}/ckformat DESTINATION ${plgdir}) + +ADD_DEPENDENCIES (squeakvm squeak squeak.sh ckformat) + # manual page
ADD_CUSTOM_TARGET (squeak.1
vm-dev@lists.squeakfoundation.org