BuildROMs: Generate include files with standard lines endings on all platforms
This commit is contained in:
parent
92ff16ca7b
commit
e7169d48cd
1 changed files with 16 additions and 14 deletions
|
@ -321,7 +321,9 @@ if (0 == sim_read_ROM_include(include_filename,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NULL == (iFile = fopen (include_filename, "w"))) {
|
/* Open output file in binary mode for consistency with all simh
|
||||||
|
source files that have CRLF line endings with explicit writes of \r\n */
|
||||||
|
if (NULL == (iFile = fopen (include_filename, "wb"))) {
|
||||||
printf ("Error Opening '%s' for output: %s\n", include_filename, strerror(errno));
|
printf ("Error Opening '%s' for output: %s\n", include_filename, strerror(errno));
|
||||||
free (ROMData);
|
free (ROMData);
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -332,29 +334,29 @@ if (load_filename)
|
||||||
else
|
else
|
||||||
load_filename = rom_filename;
|
load_filename = rom_filename;
|
||||||
time (&now);
|
time (&now);
|
||||||
fprintf (iFile, "#ifndef ROM_%s_H\n", rom_array_name);
|
fprintf (iFile, "#ifndef ROM_%s_H\r\n", rom_array_name);
|
||||||
fprintf (iFile, "#define ROM_%s_H 0\n", rom_array_name);
|
fprintf (iFile, "#define ROM_%s_H 0\r\n", rom_array_name);
|
||||||
fprintf (iFile, "/*\n");
|
fprintf (iFile, "/*\r\n");
|
||||||
fprintf (iFile, " %s produced at %s", include_filename, ctime(&now));
|
fprintf (iFile, " %s produced at %s", include_filename, ctime(&now));
|
||||||
fprintf (iFile, " from %s which was last modified at %s", rom_filename, ctime(&statb.st_mtime));
|
fprintf (iFile, " from %s which was last modified at %s", rom_filename, ctime(&statb.st_mtime));
|
||||||
fprintf (iFile, " file size: %d (0x%X) - checksum: 0x%08X\n", (int)statb.st_size, (int)statb.st_size, checksum);
|
fprintf (iFile, " file size: %d (0x%X) - checksum: 0x%08X\r\n", (int)statb.st_size, (int)statb.st_size, checksum);
|
||||||
fprintf (iFile, " This file is a generated file and should NOT be edited or changed by hand.\n");
|
fprintf (iFile, " This file is a generated file and should NOT be edited or changed by hand.\r\n");
|
||||||
if (Comments)
|
if (Comments)
|
||||||
fprintf (iFile, "\n %s\n\n", Comments);
|
fprintf (iFile, "\n %s\r\n\r\n", Comments);
|
||||||
fprintf (iFile, "*/\n");
|
fprintf (iFile, "*/\r\n");
|
||||||
fprintf (iFile, "#define BOOT_CODE_SIZE 0x%X\n", (int)statb.st_size);
|
fprintf (iFile, "#define BOOT_CODE_SIZE 0x%X\r\n", (int)statb.st_size);
|
||||||
fprintf (iFile, "#define BOOT_CODE_FILENAME \"%s\"\n", load_filename);
|
fprintf (iFile, "#define BOOT_CODE_FILENAME \"%s\"\r\n", load_filename);
|
||||||
fprintf (iFile, "#define BOOT_CODE_ARRAY %s\n", rom_array_name);
|
fprintf (iFile, "#define BOOT_CODE_ARRAY %s\r\n", rom_array_name);
|
||||||
fprintf (iFile, "unsigned char %s[] = {", rom_array_name);
|
fprintf (iFile, "unsigned char %s[] = {", rom_array_name);
|
||||||
for (bytes_written=0;bytes_written<statb.st_size; ++bytes_written) {
|
for (bytes_written=0;bytes_written<statb.st_size; ++bytes_written) {
|
||||||
c = ROMData[bytes_written];
|
c = ROMData[bytes_written];
|
||||||
if (0 == bytes_written%16)
|
if (0 == bytes_written%16)
|
||||||
fprintf (iFile,"\n");
|
fprintf (iFile, "\r\n");
|
||||||
fprintf (iFile,"0x%02X,", c&0xFF);
|
fprintf (iFile,"0x%02X,", c&0xFF);
|
||||||
}
|
}
|
||||||
free (ROMData);
|
free (ROMData);
|
||||||
fprintf (iFile,"};\n");
|
fprintf (iFile,"};\r\n");
|
||||||
fprintf (iFile, "#endif /* ROM_%s_H */\n", rom_array_name);
|
fprintf (iFile, "#endif /* ROM_%s_H */\r\n", rom_array_name);
|
||||||
fclose (iFile);
|
fclose (iFile);
|
||||||
if (1) { /* Set Modification Time on the include file to be the modification time of the ROM file */
|
if (1) { /* Set Modification Time on the include file to be the modification time of the ROM file */
|
||||||
struct utimbuf times;
|
struct utimbuf times;
|
||||||
|
|
Loading…
Add table
Reference in a new issue