void dumpMatrix(ScePspFMatrix4 m) { emitString("- ROW 0 -----"); emitFloat(m.x.x); emitFloat(m.x.y); emitFloat(m.x.z); emitFloat(m.x.w); emitString("- ROW 1 -----"); emitFloat(m.y.x); emitFloat(m.y.y); emitFloat(m.y.z); emitFloat(m.y.w); emitString("- ROW 2 -----"); emitFloat(m.z.x); emitFloat(m.z.y); emitFloat(m.z.z); emitFloat(m.z.w); emitString("- ROW 3 -----"); emitFloat(m.w.x); emitFloat(m.w.y); emitFloat(m.w.z); emitFloat(m.w.w); }
int main(int argc, char **argv) { char buffer[1024]; int decpt, sign; char *rve; pspDebugScreenInit(); pspDebugScreenPrintf("%d", 0); checkSetLessThan(); checkLeftShift(); checkRightShift(); /* dtoa(double d, int mode, int ndigits, int *decpt, int *sign, char **rve); */ emitString((char *)_itoa(12345678, buffer, 10)); emitLong(0x0123456789ABCDEFL); emitLong(testArguments(0x100, 0x1234567800000000L, 9.0f)); test(); checkFloat24(1.0f); emitFloat(2.0f / GlobalFloat); //emitString(dtoa(1234.567, 0, 10, &decpt, &sign, &rve)); return 0; }
void build_exec() { #ifdef DEBUG int i; emitString("Code:\n"); for (i=0;i<ExePtr;i++) { emitHexa(pExe[i]); } #endif // sprintf(message,"%s/%s",Pool,exe_name); // create full filename including the path // always write the executable file in internal data storage as external is not // an executable zone sprintf(message,"/data/data/pp.compiler/%s",exe_name); // create full filename including the path FILE* f=fopen(message,"r"); // check if the file exists if (f!=NULL) remove(message); // if yes, then remove it int fd=open(message,O_CREAT|O_RDWR,S_IRWXU); // create an executable file if (fd==-1) ReportError(CANTCREATEEXE); //int s=write(fd,CodeSample,exe_size); exe_size=ExePtr << 2; int s=write(fd,pExe,exe_size); //write data close(fd); if (s!=exe_size) ReportError(CANTCREATEEXE); }
void MainWindow::dockRun(){ cout<<"---docking---"<<endl; deDock = new DeDock(string("")); connect( deDock, SIGNAL(emitString(QString)), termEdit, SLOT(append(QString)) ); deDock->start(); }
void emitInt( FILE *file, char **buffer, int val, int base, int width, int flags, int *left ) { char lBuf[12]; // longest is base 10, 2^32 char *str = lBuf; if( flags & FL_TYPE_SIGNED_INT ) { xtoa(val,str,base ,(val < 0)); } else { xtoa((unsigned)val,str,base ,0); } emitString(file,buffer,str,width,flags,left); }
MainWindow::MainWindow() { createMenus(); createDockWindows(); communicator = new Communicator(); QObject::connect( communicator, SIGNAL(emitString(QString)), ttyTextEdit, SLOT( appendHtml( QString ) ) ); renderWidget = new DX12RenderWidget( communicator ); setWindowTitle( tr( "DirectXFrame" ) ); setCentralWidget( renderWidget ); }
void Settings::Save() { SPLog("Saving preferences to " CONFIGFILE); try { std::string buffer; buffer = "# OpenSpades config file\n" "#\n" "\n"; int column = 0; auto emitContinuation = [&] { buffer += "\\\n"; column = 0; }; auto emitString = [&](const std::string& val, bool escapeColon) { std::size_t i = 0; while(i < val.size() && val[i] == ' ') { if(column > 78) { emitContinuation(); } buffer += "\\ "; column += 2; i++; } while(i < val.size()) { if(column > 78) { emitContinuation(); } unsigned char uc = static_cast<unsigned char>(val[i]); switch(val[i]) { case '\n': buffer += "\\n"; column += 2; i++; break; case '\r': buffer += "\\r"; column += 2; i++; break; case '\t': buffer += "\\t"; column += 2; i++; break; default: std::size_t utf8charsize; GetCodePointFromUTF8String(val, i, &utf8charsize); if(val[i] == '#' || // comment marker (escapeColon && val[i] == ':') || // key/value split uc < 0x20 || // control char (uc >= 0x80 && utf8charsize == 0) || // invalid UTF8 utf8charsize >= 5) { // valid UTF-8 but codepoint beyond BMP/SMP range static const char *s = "0123456789abcdef"; buffer += "\\x"; buffer += s[uc>>4]; buffer += s[uc&15]; column += 3; i++; }else{ buffer.append(val, i, utf8charsize); column += utf8charsize; i += utf8charsize; } break; } } }; for(const auto& item: items) { Item *itm = item.second; emitString(itm->name, true); buffer += ": "; column += 2; emitString(itm->string, false); buffer += "\n"; column = 0; } std::unique_ptr<IStream> s(FileManager::OpenForWriting(CONFIGFILE)); s->Write(buffer); } catch (const std::exception& ex) {
void emitReal(double x) { char buffer[32]; sprintf(buffer,"%lf\n",x); emitString(buffer); }
void emitHexa(long unsigned x) { char buffer[16]; sprintf(buffer,"%lx\n",x); emitString(buffer); }
// for DEBUG only void emitInt(int x) { char buffer[32]; sprintf(buffer,"%ld\n",x); emitString(buffer); }
// prompt //------------- static void prompt(char*name) { emitString("Pépé le compiler v 1.03\nFreeware (c)2010-2011\nby Philippe Guillot\n"); sprintf(message,"Compiling \"%s\"...\n",name); emitString(message); }
static void about(void) { emitString(about_title); // REV. emitString(about_rev); emitKey(getNumKeycode(BOARD_REV_VALUE)); emitKey(KEY_ENTER); // VER. emitString(about_ver); emitKey(getNumKeycode((APP_VERSION_VALUE >> 8) & 0xf)); emitKey(KEY_PERIOD); emitKey(getNumKeycode((APP_VERSION_VALUE >> 4) & 0xf)); emitKey(getNumKeycode(APP_VERSION_VALUE & 0xf)); emitKey(KEY_ENTER); #ifdef WITH_HOS emitString(about_ble); emitString(about_rev); emitKey(getNumKeycode(HosGetRevision() & 0xf)); emitKey(KEY_ENTER); emitString(about_ver); emitKey(getNumKeycode((HosGetVersion() >> 8) & 0xf)); emitKey(KEY_PERIOD); emitKey(getNumKeycode((HosGetVersion() >> 4) & 0xf)); emitKey(getNumKeycode(HosGetVersion() & 0xf)); emitKey(KEY_ENTER); emitString(about_copyright); emitString(about_kvm); emitKey(getNumKeycode(CurrentProfile())); emitKey(KEY_ENTER); if (!isUSBMode()) { emitString(about_lesc); emitKey(getNumKeycode(HosGetLESC())); emitKey(KEY_ENTER); } #else emitString(about_copyright); #endif // F2 OS emitString(about_f2); emitOSName(); // F3 Layout emitString(about_f3); emitBaseName(); // F4 Kana Layout emitString(about_f4); emitKanaName(); // F5 Delay emitString(about_f5); emitDelayName(); // F6 Modifiers emitString(about_f6); emitModName(); // F7 IME emitString(about_f7); emitIMEName(); // F8 LED emitString(about_f8); emitLEDName(); // F9 Prefix Shift emitString(about_f9); emitPrefixShift(); #ifdef ENABLE_MOUSE emitMouse(); #endif #ifdef WITH_HOS if (!isBusPowered()) { uint16_t voltage = HosGetBatteryVoltage(); uint8_t level = HosGetBatteryLevel(); if (HOS_BATTERY_VOLTAGE_OFFSET < voltage) { emitKey(getNumKeycode(voltage / 100)); emitKey(KEY_PERIOD); voltage %= 100; emitKey(getNumKeycode(voltage / 10)); emitKey(getNumKeycode(voltage % 10)); emitKey(KEY_V); emitKey(KEY_SPACEBAR); emitNumber(level); emitKey(KEYPAD_PERCENT); emitKey(KEY_ENTER); } } #endif }
void Keyboard::addToString(const QString &str) { emitString(str); }