int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); QStringList args = a.arguments(); if (args.size() < 3) { qCritical("Usage: %s <input.edif> <output.xml>", argv[0]); return 1; } /*QFile fi(args[1]); if (!fi.open(QFile::ReadOnly)) { qCritical("Can't open EDIF file"); return 1; } lispParserInit(&fi); QVariantList top = lispParse().toList();*/ QVariantList top = parseLispFile(args[1]); //fi.close(); QFile fo(args[2]); if (!fo.open(QFile::WriteOnly | QFile::Truncate)) { qCritical("Can't open XML file"); return 1; } QXmlStreamWriter stream(&fo); stream.setAutoFormatting(true); stream.writeStartDocument(); writeTop(stream, top); /*stream.writeStartElement("bookmark"); stream.writeAttribute("href", "http://qt-project.org/"); stream.writeTextElement("title", "Qt Project"); stream.writeEndElement(); // bookmark*/ stream.writeEndDocument(); fo.close(); return 0; }
//------------------------------------------------------------------------------------ // MAIN Routine //------------------------------------------------------------------------------------ void main(void) { char input; char SFRPAGE_SAVE = SFRPAGE; WDTCN = 0xDE; // Disable the watchdog timer WDTCN = 0xAD; // Note: = "DEAD"! SYSCLK_INIT(); // Initialize the oscillator Timer_Init(); // Initialize timer UART_INIT(); // Initialize UARTs PORT_INIT(); // Initialize the Crossbar and GPIO SPI_Init(); SFRPAGE = UART0_PAGE; // Direct output to UART0 printf("\033[2J"); //clear screen printf("\033[2J"); //clear screen printf("\033[13;0H"); //print divider printf("--------------------------------------------------------------------------------"); //printf("\033[1;12r"); //define scrollable area //printf("\033[14;25r"); while(1) { if (RI0 == 1) { RI0 = 0; input = SBUF0; // If input from UART0, read SBUF0 if (input == 0x7F){ sendChars(); } else{ if (input == 'a') //228 { printf("i am a\n\r"); SPI0CKR += 5; printf("clock: %d\n\r", SPI0CKR); } else if (input == 'z') { SPI0CKR -= 5; printf("clock: %d\n\r", SPI0CKR); } //SFRPAGE_SAVE = SFRPAGE; //SFRPAGE = SPI0_PAGE; NSSMD0 = 0; //slave select SPIF = 0; //clear SPIF SPI0DAT = input; //send input while (!SPIF); //wait until sent NSSMD0 = 1; //release slave writeTop(input); //write to UART0 RI0 = 0; //Clear input flag overflows = 0; //wait while(overflows < 30000); NSSMD0 = 0; //slave select while (!SPIF); //wait until not busy SPIF = 0; //busy SPI0DAT = input; //write dummy character while (!SPIF); //wait until transfer is over NSSMD0 = 1; //release slave input = SPI0DAT; //read SPI0DAT writeBot(input); //SFRPAGE = SFRPAGE_SAVE; } } } }