3 by Robert Schmidt of Ztiff Zox Softwear 1993
\r
5 Converts a TWEAK version 1.0 file to an #include-able C file
\r
6 defining the equivalent Register array, which is directly
\r
7 passable to the outRegArray() function defined in the TwkUser
\r
13 #include <fstream.h>
\r
17 #include "TwkUser.h"
\r
20 main(int argc, char **argv)
\r
24 printf("TWEAK2C version 1.0\n"
\r
25 "by Robert Schmidt of Ztiff Zox Softwear 1993\n"
\r
26 "Converts a TWEAK version 1.x file to an #include-able C file.\n"
\r
28 "Syntax: TWEAK2C <TWEAK-file> <C file to create> <array name>\n"
\r
29 "All parameters are required.\n"
\r
36 int regs = loadRegArray(argv[1], &table);
\r
38 return 1; // loadRegArray provides error message
\r
40 ofstream out(argv[2], ios::out | ios::trunc);
\r
42 out << "#include \"TwkUser.h\" // get Register definition" << endl;
\r
43 out << "Register " << argv[3] << "[] =" << endl;
\r
44 out << "\t{" << hex << endl;
\r
46 Register *reg = table;
\r
49 out << "\t{ 0x" << reg->port << ", 0x" << int(reg->index)
\r
50 << ", 0x" << int(reg->value) << (regs?"},\n":"}\n");
\r
53 out << "\t};" << endl;
\r