byte pollStatus() { if(busWriteByte(BUS_CMD_BOARDSTATUS, SLAVE_ID_POWERBOARD) != 0) { showString("STA FAIL ", 1); return 255; } byte len = readDataBlock(SLAVE_ID_POWERBOARD); if(len!=1) { showString("STA FAIL ", 1); return 255; } rxBuf[0] &= 0xFD; /* Clear the reported kill switch bit */ /* We report the kill switch our own way */ if(IN_KS == 1) rxBuf[0] |= 0x02; return rxBuf[0]; }
void ICACHE_FLASH_ATTR displayEntry(uint8 idx) { showString(0, 0, valueEntries[idx].location); showString(0, 1, valueEntries[idx].device); showString(0, 2, valueEntries[idx].name); showString(0, 3, valueEntries[idx].type); showString(4, 5, valueEntries[idx].val); }
/* Run a bit of the run-time diagnostic message system */ void processRuntimeDiag() { byte t; unsigned char tmp[16]; t = pollThrusterState(); if(tsValue != t) /* A change */ { switch(t) { case 0x00: { showString("Vehicle Safe ", 1); break; } case 0x1F: /* Thrusters enabled and magnet attached */ { showString("Vehicle Enabled ", 1); break; } case 0x0F: /* Thrusters enabled by sensor board, but no magnet */ { showString("No Kill Switch ", 1); break; } case 0x10: /* Magnet attached but thrusters disabled by sensor board */ { showString("Safe only in SW ", 1); break; } default: { sprintf(tmp, "TS: %c%c%c%c%c ", (t & 0x10) ? 'K' : '-', (t & 0x08) ? '1' : '-', (t & 0x04) ? '2' : '-', (t & 0x02) ? '3' : '-', (t & 0x01) ? '4' : '-'); if(t & 0x10) { sprintf(tmp+10, "UNSAFE"); } showString(tmp, 1); } } tsValue=t; } }
void EEPROM_RetrieveSettings(bool def, bool printout) { // if def=true, the default values will be used int i=EEPROM_OFFSET; char stored_ver[4]; char ver[4]=EEPROM_VERSION; unsigned long ul_help = 0; EEPROM_readAnything(i,stored_ver); //read stored version if ((!def)&&(strncmp(ver,stored_ver,3)==0)) { // version number match EEPROM_readAnything(i,axis_steps_per_unit); EEPROM_readAnything(i,max_feedrate); EEPROM_readAnything(i,max_acceleration_units_per_sq_second); EEPROM_readAnything(i,move_acceleration); EEPROM_readAnything(i,retract_acceleration); EEPROM_readAnything(i,minimumfeedrate); EEPROM_readAnything(i,mintravelfeedrate); EEPROM_readAnything(i,ul_help); //min Segmenttime --> not used yet EEPROM_readAnything(i,max_xy_jerk); EEPROM_readAnything(i,max_z_jerk); unsigned int Kp,Ki,Kd; EEPROM_readAnything(i,Kp); EEPROM_readAnything(i,Ki); EEPROM_readAnything(i,Kd); showString(PSTR("Stored settings retreived\r\n")); } else { float tmp1[]=_AXIS_STEP_PER_UNIT; float tmp2[]=_MAX_FEEDRATE; long tmp3[]=_MAX_ACCELERATION_UNITS_PER_SQ_SECOND; for (short i=0;i<4;i++) { axis_steps_per_unit[i]=tmp1[i]; max_feedrate[i]=tmp2[i]; max_acceleration_units_per_sq_second[i]=tmp3[i]; } move_acceleration=_ACCELERATION; retract_acceleration=_RETRACT_ACCELERATION; minimumfeedrate=DEFAULT_MINIMUMFEEDRATE; mintravelfeedrate=DEFAULT_MINTRAVELFEEDRATE; max_xy_jerk=_MAX_XY_JERK; max_z_jerk=_MAX_Z_JERK; showString(PSTR("Using Default settings\r\n")); } if(printout) { EEPROM_printSettings(); } }
LOCAL void ICACHE_FLASH_ATTR initDone_cb() { CFG_Load(); os_printf("\n%s starting ...\n", sysCfg.deviceName); MQTT_InitConnection(&mqttClient, sysCfg.mqtt_host, sysCfg.mqtt_port, sysCfg.security); MQTT_InitClient(&mqttClient, sysCfg.device_id, sysCfg.mqtt_user, sysCfg.mqtt_pass, sysCfg.mqtt_keepalive, 1); char temp[100]; os_sprintf(temp, "/Raw/%s/offline", sysCfg.device_id); MQTT_InitLWT(&mqttClient, temp, "offline", 0, 0); MQTT_OnConnected(&mqttClient, mqttConnectedCb); MQTT_OnDisconnected(&mqttClient, mqttDisconnectedCb); MQTT_OnData(&mqttClient, mqttDataCb); os_printf("SDK version is: %s\n", system_get_sdk_version()); os_printf("Smart-Config version is: %s\n", smartconfig_get_version()); system_print_meminfo(); os_printf("Flash size map %d; id %lx\n", system_get_flash_size_map(), spi_flash_get_id()); WIFI_Connect(sysCfg.sta_ssid, sysCfg.sta_pwd, sysCfg.deviceName, wifiConnectCb); lcdInit(); lightOn(); showString(1, 1, "MQTT Monitor"); }
void EEPROM_StoreSettings() { unsigned long ul_help = 20000; unsigned int ui_help = 0; char ver[4]= "000"; int i=EEPROM_OFFSET; EEPROM_writeAnything(i,ver); // invalidate data first EEPROM_writeAnything(i,axis_steps_per_unit); EEPROM_writeAnything(i,max_feedrate); EEPROM_writeAnything(i,max_acceleration_units_per_sq_second); EEPROM_writeAnything(i,move_acceleration); EEPROM_writeAnything(i,retract_acceleration); EEPROM_writeAnything(i,minimumfeedrate); EEPROM_writeAnything(i,mintravelfeedrate); EEPROM_writeAnything(i,ul_help); //Min Segment Time, not used yet EEPROM_writeAnything(i,max_xy_jerk); EEPROM_writeAnything(i,max_z_jerk); //PID Settings, not used yet --> placeholder ui_help = 2560; EEPROM_writeAnything(i,ui_help); //Kp ui_help = 64; EEPROM_writeAnything(i,ui_help); //Ki ui_help = 4096; EEPROM_writeAnything(i,ui_help); //Kd char ver2[4]=EEPROM_VERSION; i=EEPROM_OFFSET; EEPROM_writeAnything(i,ver2); // validate data showString(PSTR("Settings Stored\r\n")); }
void EEPROM_StoreSettings() { char ver[4]= "000"; EEPROM_write_setting(EEPROM_OFFSET, ver); // invalidate data first EEPROM_write_setting(axis_steps_per_unit_address, axis_steps_per_unit); EEPROM_write_setting(max_feedrate_address, max_feedrate); EEPROM_write_setting(max_acceleration_units_per_sq_second_address, max_acceleration_units_per_sq_second); EEPROM_write_setting(move_acceleration_address, move_acceleration); EEPROM_write_setting(retract_acceleration_address, retract_acceleration); EEPROM_write_setting(minimumfeedrate_address, minimumfeedrate); EEPROM_write_setting(mintravelfeedrate_address, mintravelfeedrate); EEPROM_write_setting(min_seg_time_address, min_seg_time); //Min Segment Time, not used yet EEPROM_write_setting(max_xy_jerk_address, max_xy_jerk); EEPROM_write_setting(max_z_jerk_address, max_z_jerk); EEPROM_write_setting(max_e_jerk_address, max_e_jerk); //PID Settings #ifdef PIDTEMP EEPROM_write_setting(Kp_address, PID_Kp); //Kp EEPROM_write_setting(Ki_address, PID_Ki); //Ki EEPROM_write_setting(Kd_address, PID_Kd); //Kd #else EEPROM_write_setting(Kp_address, 2048); //Kp EEPROM_write_setting(Ki_address, 32); //Ki EEPROM_write_setting(Kd_address, 2048); //Kd #endif char ver2[4]=EEPROM_VERSION; EEPROM_write_setting(EEPROM_OFFSET, ver2); // validate data showString(PSTR("Settings Stored\r\n")); }
void diagBootMode() { byte mode=0; // unsigned char tmp[16]; long j=0; showString("Diagnostic Mode ", 0); while(pollStatus() & 0x80); while(1) { if(pollStatus() & 0x80) { mode++; if(mode == 3) { showIdent(); mode = 0; } showBootDiag(mode); j=0; while(pollStatus() & 0x80) { j++; if(j == 25000) { return; } } } showBootDiag(mode); } }
void TestParser::docPI( const XMLCh* const target , const XMLCh* const data) { if (fOutputType == OutputType_Debug) { XERCES_STD_QUALIFIER cout << "Got document PI:\n " << "Target: \"" << target << '"'; if (XMLString::stringLen(data)) XERCES_STD_QUALIFIER cout << ", Data: \"" << StrX(data) << "\"\n"; XERCES_STD_QUALIFIER cout << " SrcOfs: " << fScanner->getSrcOffset() << "\n" << XERCES_STD_QUALIFIER endl; } else if ((fOutputType == OutputType_XML) || (fOutputType == OutputType_JCCanon) || (fOutputType == OutputType_SunCanon)) { XERCES_STD_QUALIFIER cout << "<?"; showString(target); XERCES_STD_QUALIFIER cout << " "; if (XMLString::stringLen(data)) XERCES_STD_QUALIFIER cout << StrX(data); XERCES_STD_QUALIFIER cout << "?>"; } }
Tag* Presence::tag() const { if( m_subtype == Invalid ) return 0; Tag* t = new Tag( "presence" ); if( m_to ) t->addAttribute( "to", m_to.full() ); if( m_from ) t->addAttribute( "from", m_from.full() ); const std::string& type = typeString( m_subtype ); if( !type.empty() ) { if( type != "available" ) t->addAttribute( "type", type ); } else { const std::string& show = showString( m_subtype ); if( !show.empty() ) new Tag( t, "show", show ); } new Tag( t, "priority", util::int2string( m_priority ) ); getLangs( m_stati, m_status, "status", t ); StanzaExtensionList::const_iterator it = m_extensionList.begin(); for( ; it != m_extensionList.end(); ++it ) t->addChild( (*it)->tag() ); return t; }
void showIdent() { byte i=0; long j=0; unsigned char tmp[16]; while(!(pollStatus() & 0x80)); for(i=0; i<NUM_SLAVES; i++) { sprintf(tmp, "Ident IRQ %d: ", i); showString(tmp, 0); /* Don't mix the strings */ for(j=0; j<17; j++) rxBuf[j]=0; if(busWriteByte(BUS_CMD_ID, i) != 0) { showString("<Write Fail> ", 1); } else { byte len = readDataBlock(i); if(len > 0) { for(j=len; j<16; j++) rxBuf[j]=32; showString(rxBuf, 1); } else { showString("<Read Fail> ", 1); } } while(pollStatus() & 0x80); while(!(pollStatus() & 0x80)); } showString("Diagnostic Mode ", 0); }
byte pollThrusterState() { if(busWriteByte(BUS_CMD_THRUSTER_STATE, SLAVE_ID_THRUSTERS) != 0) { showString("TSTA FAIL ", 1); return 0; } byte len = readDataBlock(SLAVE_ID_THRUSTERS); if(len!=1) { showString("TSTA FAIL ", 1); return 0; } if(IN_KS == 1) rxBuf[0] |= 0x10; return rxBuf[0]; }
void mexFunction( int nargout, mxArray *out[], int nargin, const mxArray *in[] ) { jhm::cout_redirect(); jhm::MAT mfile("data.mat"); jhm::println( "Opened file with %d variables.", mfile.nfields() ); showLogical(mfile); showNumeric(mfile); showString(mfile); showVector(mfile); showMatrix(mfile); showVolume(mfile); }
void splash(){ // Splash int i=0; char * s= ".WMDONKEY."; while (i<4){ RedrawWindow(); showString(s,1); copyXPMArea(70,47,47,19,9,20); RedrawWindow(); sleep(1); i++; } }
void showBanner() { showString(PSTR("\nBoardcaster v1 - Fall 2011\n")); showString(PSTR("by Francisco De La Cruz\n")); showString(PSTR("..Richard B. Kaufman..\n")); showString(PSTR("..Gabriel J. Perez..\n")); showString(PSTR("..Daniel Gonzalez..\n")); showString(PSTR("..Carlos Andreu..\n")); }
void TestParser::docComment(const XMLCh* const comment) { if (fOutputType == OutputType_Debug) { XERCES_STD_QUALIFIER cout << "Got document COMMENT:\n " << "Text: \"" << StrX(comment) << "\"\n" << " SrcOfs: " << fScanner->getSrcOffset() << "\n" << XERCES_STD_QUALIFIER endl; } else if (fOutputType == OutputType_XML) { XERCES_STD_QUALIFIER cout << "<!--"; showString(comment); XERCES_STD_QUALIFIER cout << "-->"; } }
static void handleInput(char ch) { if ('0' <= ch && ch <= '9') inputValue = 10 * inputValue + ch - '0'; else { switch (ch) { default: showString(PSTR("Type '?' for help.\n")); return; case '?': showHelp(); return; case 'b': config.freq = inputValue; break; case 'g': config.in_group = inputValue; break; case 'n': config.in_node = inputValue; break; case 'G': config.out_group = inputValue; break; case 'N': config.out_node = inputValue; break; case 'a': config.acks_enable = inputValue; break; case 'm': config.multi_node = inputValue != 0; break; } inputValue = 0; saveConfig(); } }
int main(int argc, const char * argv[]) { char str[] = "This is a sample string"; showString(str); printf("Address of str array: %p\n", &str); // sizeof returns array size eventhough array variable is given printf("str has a length of %lu, str has %lu bytes (incl. \\0 char)\n", strlen(str), sizeof(str)); // Pointer type has to be declared to ensure correct pointer arithmetic char *c = str; printf("Address of c variable: %p\n", &c); printf("The size of the str pointer is %lu bytes\n", sizeof(c)); printf("The first char of str is (str[0] == *str): %c %c\n", str[0], *str); printf("The second char of str is: %c \n", *(str+1)); char bStr[] = "Another Sample"; substring(bStr, 9); }
void TestParser::endElement(const XMLElementDecl& elemDecl , const unsigned int uriId , const bool isRoot) { if (fOutputType == OutputType_Debug) { if (fDoNamespaces) { XMLBuffer bufURI; fScanner->getURIText(uriId, bufURI); XERCES_STD_QUALIFIER cout << "Got ENDELEMENT:\n Name: " << "{" << StrX(bufURI.getRawBuffer()) << "}" << StrX(elemDecl.getBaseName()) << XERCES_STD_QUALIFIER endl; } else { XERCES_STD_QUALIFIER cout << "Got ENDELEMENT:\n Name: " << StrX(elemDecl.getFullName()) << XERCES_STD_QUALIFIER endl; } XERCES_STD_QUALIFIER cout << " SrcOfs: " << fScanner->getSrcOffset() << "\n" << XERCES_STD_QUALIFIER endl; } else if ((fOutputType == OutputType_XML) || (fOutputType == OutputType_JCCanon) || (fOutputType == OutputType_SunCanon)) { XERCES_STD_QUALIFIER cout << "</"; showString(elemDecl.getFullName()); XERCES_STD_QUALIFIER cout << ">"; } // Clear the flag that says we're now inside the root if (isRoot) fInsideRoot = false; }
static void translate_input (int forward_translation, char *table_name) { char charbuf[BUFSIZE]; char *outputbuf; widechar inbuf[BUFSIZE]; widechar transbuf[BUFSIZE]; int inlen; int translen; int k; int ch = 0; int result; while (1) { translen = BUFSIZE; k = 0; while ((ch = getchar ()) != '\n' && ch != EOF && k < BUFSIZE) charbuf[k++] = ch; if (ch == EOF && k == 0) break; charbuf[k] = 0; inlen = extParseChars (charbuf, inbuf); if (forward_translation) result = lou_translateString (table_name, inbuf, &inlen, transbuf, &translen, NULL, NULL, 0); else result = lou_backTranslateString (table_name, inbuf, &inlen, transbuf, &translen, NULL, NULL, 0); if (!result) break; outputbuf = showString (transbuf, translen); k = strlen (outputbuf) - 1; outputbuf[k] = 0; printf ("%s\n", &outputbuf[1]); } lou_free (); }
/* All variables must be declared before use, although certain declarations * can be made implicitly by content. A declaration specifies a type, and * contains a list of one or more variables of that type. */ int main() { /* 声明未初始化局部变量, Automatic variables for which is no explicit * initializer have undefined(i.e., garbage) values. */ int i, result; // 此时, i 和 result 的值未知,依赖于具体的编译器和系统 /* The qualifier const can be applied to the declaratio of any variable * to specify that its value will not be changed.For an array,the const * qualifier says that the elements will not be altered. */ const int lower = 1, upper = 99, step = 2; const char msg[] = "1 + 3 + 5 + ...... + 99 = "; /* 这里, msg的数组元素不可改变,如果试图改变它的元素的值,如msg[4] = 's'; * 则会报错:error: assignment of read-only * location ‘msg[4]’. */ /* 初始化上面未初始化的局部变量 */ result = 0; for (i = lower; i <= upper; i += step) result += i; printf("%s%d\n", msg, result); static int static_default; // 未初始化的静态变量会被默认初始化为 0 printf("external_default = %d\nstatic_default = %d\n", external_default, static_default); printNum(); printNum(); char s1[] = "Initialized : "; char s2[] = "error"; showString(s1, s2); printf("Altered : %s\n", s2); return 0; }
/** @brief Entry point for the program @returns 0 if all goes well Demonstrate some ways strings get used and abused. */ int main(void) { char* candidate; //Declaring... A STRING! (it's a pointer... to the start of an array...) candidate = "Barack Romney"; //String auto-created, 'candidate' points to first letter. showString(candidate); candidate = "Mitt Obama"; //String autogen, 'candidate' points to first letter showString(candidate); showString("Mickey Mouse"); //String autogen and passed to function showString("Chuck Norris' Roundhouse"); //String autogen and pass char nominee[12]; //12-character array, whose first letter is pointed to by 'nominee' candidate = nominee; //Make 'candidate' point to the same thing 'nominee' does. while( candidate[0]!='*') //As long as the name doesn't start with a * { printf("Enter your own candidate (max 11 letters, * to end):"); scanf("%11s", candidate); //Semi-necessary magic number, one less than 12. showString(candidate); } printf("\n\nFANCY CODE BEGINS\n\n"); char fmt[5]; char* input; int size; printf("How many letters do you need?"); scanf("%d", &size); input = malloc((size+1)*sizeof(char)); //Allocate enough space for that many characters, plus one sprintf(fmt, "%%%ds", size); //Create a format string like "%12s" with the size built in printf("Please enter at most %d characters: ", size); scanf(fmt, input); //Use that format string to limit the scan, store result wherever input points showString(input); return 0; }
void tetrisDisplay(tetris* t,int16 u,...) { union { tetrisForm* f; tetrisUnsolved* u; char* s; }p; int32 i,j,k,m,n; va_list valist; va_start(valist,u); switch(u) { case 0: box("□",tetris_X,tetris_Y,tetris_width_max,tetris_length_max,7); box("□",tetris_sub_box_X,tetris_sub_box_Y,4,4,7); break; case 1: case 2: case 3: case 4: p.f=va_arg(valist,tetrisForm*); for(i=0;i!=4;++i) for(j=0;j!=4;++j) if((1<<(j*4+i))&form[p.f->_f][p.f->_i]) switch(u) { case 1: m=tetris_X+p.f->_x+i; n=tetris_Y+p.f->_y+j; if(n<tetris_Y)break; showString("■",m,n,p.f->_c); break; case 2: m=tetris_X+p.f->_x+i; n=tetris_Y+p.f->_y+j; if(n<tetris_Y)break; showString("□",m,n,7); break; case 3: showString("■",tetris_sub_box_X+i,tetris_sub_box_Y+j,p.f->_c); break; case 4: showString("□",tetris_sub_box_X+i,tetris_sub_box_Y+j,7); break; default: break; } break; case 5: p.u=va_arg(valist,tetrisUnsolved*); for(i=0;i!=tetris_width_max;++i) for(j=0;j!=tetris_length_max;++j) if(k=p.u[j*tetris_width_max+i]) showString(" ",tetris_X+i,tetris_Y+j,k<<4); break; case 6: p.u=va_arg(valist,tetrisUnsolved*); for(i=0;i!=tetris_width_max;++i) for(j=0;j!=tetris_length_max;++j) if(p.u[j*tetris_width_max+i]) showString("□",tetris_X+i,tetris_Y+j,7); break; case 7: p.s=va_arg(valist,char*); showString(p.s,tetris_sub_box_X,tetris_sub_box_Y+4+va_arg(valist,int16),7); break; case 8: p.s=va_arg(valist,char*); showString(p.s,tetris_X,tetris_Y+tetris_length_max+va_arg(valist,int16),7); break; default: break; } va_end (valist); }
void TestParser::startElement(const XMLElementDecl& elemDecl , const unsigned int uriId , const XMLCh* const prefixName , const RefVectorOf<XMLAttr>& attrList , const unsigned int attCount , const bool isEmpty , const bool isRoot) { // Set the flag that says we're now inside the root, if its not empty if (isRoot && !isEmpty) fInsideRoot = true; if (fOutputType == OutputType_Debug) { XMLBuffer bufURI; if (fDoNamespaces) { fScanner->getURIText(uriId, bufURI); XERCES_STD_QUALIFIER cout << "Got STARTELEMENT:\n " << " Name: {" << StrX(bufURI.getRawBuffer()) << "}" << StrX(elemDecl.getBaseName()) << ", AttCount: " << attCount << ", Empty?: " << (isEmpty ? "yes" : "no") << "\n"; } else { XERCES_STD_QUALIFIER cout << "Got STARTELEMENT:\n Name: " << StrX(elemDecl.getFullName()) << ", AttCount: " << attCount << ", Empty?: " << (isEmpty ? "yes" : "no") << "\n"; } XERCES_STD_QUALIFIER cout << " SrcOfs: " << fScanner->getSrcOffset() << "\n"; // If any attributes, then show them if (attCount) { XERCES_STD_QUALIFIER cout << " Attrs: "; for (unsigned int attInd = 0; attInd < attCount; attInd++) { const XMLAttr* curAttr = attrList.elementAt(attInd); if (fDoNamespaces) { fScanner->getURIText(curAttr->getURIId(), bufURI); XERCES_STD_QUALIFIER cout << "Name=" << "{" << StrX(bufURI.getRawBuffer()) << "}" << StrX(curAttr->getName()); } else { XERCES_STD_QUALIFIER cout << "Name=" << StrX(curAttr->getQName()); } if (curAttr->getSpecified()) XERCES_STD_QUALIFIER cout << " (Explicit) "; else XERCES_STD_QUALIFIER cout << " (Defaulted) "; XERCES_STD_QUALIFIER cout << "Value=" << StrX(curAttr->getValue()) << "\n" << " "; } } XERCES_STD_QUALIFIER cout << XERCES_STD_QUALIFIER endl; } else if (fOutputType == OutputType_XML) { XERCES_STD_QUALIFIER cout << "<"; showString(elemDecl.getFullName()); if (attCount) { XERCES_STD_QUALIFIER cout << " "; for (unsigned int index = 0; index < attCount; index++) { const XMLAttr* curAttr = attrList.elementAt(index); showString(curAttr->getQName()); XERCES_STD_QUALIFIER cout << "=\""; showString(curAttr->getValue()); XERCES_STD_QUALIFIER cout << "\""; if (index < attCount-1) XERCES_STD_QUALIFIER cout << " "; } } if (isEmpty) XERCES_STD_QUALIFIER cout << "/>"; else XERCES_STD_QUALIFIER cout << ">"; } else if ((fOutputType == OutputType_JCCanon) || (fOutputType == OutputType_SunCanon)) { XERCES_STD_QUALIFIER cout << "<"; showString(elemDecl.getFullName()); if (attCount) { XERCES_STD_QUALIFIER cout << " "; // // Get a list of attribute pointers. The canonical output // format requires sorted attributes. If we aren't doing // canonical output, then we don't sort it, but we still use // the array. // const XMLAttr** attrTmp = new const XMLAttr*[attCount]; unsigned int index; for (index = 0; index < attCount; index++) attrTmp[index] = attrList.elementAt(index); if (attCount > 1) qsort(attrTmp, attCount, sizeof(XMLAttr*), attrComp); for (index = 0; index < attCount; index++) { const XMLAttr* curAttr = attrTmp[index]; showString(curAttr->getQName()); XERCES_STD_QUALIFIER cout << "=\""; showString(curAttr->getValue()); XERCES_STD_QUALIFIER cout << "\""; if (index < attCount-1) XERCES_STD_QUALIFIER cout << " "; } delete [] attrTmp; } if (isEmpty) { XERCES_STD_QUALIFIER cout << "></"; showString(elemDecl.getFullName()); XERCES_STD_QUALIFIER cout << ">"; } else { XERCES_STD_QUALIFIER cout << ">"; } } }
void TextNode::prettyPrint(ostream & os, int indent) const { showString(os, value); }
void vibedView::modelChanged() { showString( 0 ); }
vibedView::vibedView( Instrument * _instrument, QWidget * _parent ) : InstrumentView( _instrument, _parent ) { setAutoFillBackground( true ); QPalette pal; pal.setBrush( backgroundRole(), PLUGIN_NAME::getIconPixmap( "artwork" ) ); setPalette( pal ); m_volumeKnob = new Knob( knobBright_26, this ); m_volumeKnob->setVolumeKnob( true ); m_volumeKnob->move( 103, 142 ); m_volumeKnob->setHintText( tr( "Volume:" ) + " ", "" ); m_volumeKnob->setWhatsThis( tr( "The 'V' knob sets the volume " "of the selected string." ) ); m_stiffnessKnob = new Knob( knobBright_26, this ); m_stiffnessKnob->move( 129, 142 ); m_stiffnessKnob->setHintText( tr( "String stiffness:" ) + " ", "" ); m_stiffnessKnob->setWhatsThis( tr( "The 'S' knob sets the stiffness of the selected string. The stiffness " "of the string affects how long the string will ring out. The lower " "the setting, the longer the string will ring." ) ); m_pickKnob = new Knob( knobBright_26, this ); m_pickKnob->move( 153, 142 ); m_pickKnob->setHintText( tr( "Pick position:" ) + " ", "" ); m_pickKnob->setWhatsThis( tr( "The 'P' knob sets the position where the selected string will be 'picked'. " "The lower the setting the closer the pick is to the bridge." ) ); m_pickupKnob = new Knob( knobBright_26, this ); m_pickupKnob->move( 177, 142 ); m_pickupKnob->setHintText( tr( "Pickup position:" ) + " ", "" ); m_pickupKnob->setWhatsThis( tr( "The 'PU' knob sets the position where the vibrations will be monitored " "for the selected string. The lower the setting, the closer the " "pickup is to the bridge." ) ); m_panKnob = new Knob( knobBright_26, this ); m_panKnob->move( 105, 187 ); m_panKnob->setHintText( tr( "Pan:" ) + " ", "" ); m_panKnob->setWhatsThis( tr( "The Pan knob determines the location of the selected string in the stereo " "field." ) ); m_detuneKnob = new Knob( knobBright_26, this ); m_detuneKnob->move( 150, 187 ); m_detuneKnob->setHintText( tr( "Detune:" ) + " ", "" ); m_detuneKnob->setWhatsThis( tr( "The Detune knob modifies the pitch of the selected string. Settings less " "than zero will cause the string to sound flat. Settings greater than zero " "will cause the string to sound sharp." ) ); m_randomKnob = new Knob( knobBright_26, this ); m_randomKnob->move( 194, 187 ); m_randomKnob->setHintText( tr( "Fuzziness:" ) + " ", "" ); m_randomKnob->setWhatsThis( tr( "The Slap knob adds a bit of fuzz to the selected string which is most " "apparent during the attack, though it can also be used to make the string " "sound more 'metallic'.") ); m_lengthKnob = new Knob( knobBright_26, this ); m_lengthKnob->move( 23, 193 ); m_lengthKnob->setHintText( tr( "Length:" ) + " ", "" ); m_lengthKnob->setWhatsThis( tr( "The Length knob sets the length of the selected string. Longer strings " "will both ring longer and sound brighter, however, they will also eat up " "more CPU cycles." ) ); m_impulse = new LedCheckBox( "", this ); m_impulse->move( 23, 94 ); ToolTip::add( m_impulse, tr( "Impulse or initial state" ) ); m_impulse->setWhatsThis( tr( "The 'Imp' selector determines whether the waveform in the graph is to be " "treated as an impulse imparted to the string by the pick or the initial " "state of the string." ) ); m_harmonic = new nineButtonSelector( PLUGIN_NAME::getIconPixmap( "button_-2_on" ), PLUGIN_NAME::getIconPixmap( "button_-2_off" ), PLUGIN_NAME::getIconPixmap( "button_-1_on" ), PLUGIN_NAME::getIconPixmap( "button_-1_off" ), PLUGIN_NAME::getIconPixmap( "button_f_on" ), PLUGIN_NAME::getIconPixmap( "button_f_off" ), PLUGIN_NAME::getIconPixmap( "button_2_on" ), PLUGIN_NAME::getIconPixmap( "button_2_off" ), PLUGIN_NAME::getIconPixmap( "button_3_on" ), PLUGIN_NAME::getIconPixmap( "button_3_off" ), PLUGIN_NAME::getIconPixmap( "button_4_on" ), PLUGIN_NAME::getIconPixmap( "button_4_off" ), PLUGIN_NAME::getIconPixmap( "button_5_on" ), PLUGIN_NAME::getIconPixmap( "button_5_off" ), PLUGIN_NAME::getIconPixmap( "button_6_on" ), PLUGIN_NAME::getIconPixmap( "button_6_off" ), PLUGIN_NAME::getIconPixmap( "button_7_on" ), PLUGIN_NAME::getIconPixmap( "button_7_off" ), 2, 21, 127, this ); m_harmonic->setWindowTitle( tr( "Octave" ) ); m_harmonic->setWhatsThis( tr( "The Octave selector is used to choose which harmonic of the note the " "string will ring at. For example, '-2' means the string will ring two " "octaves below the fundamental, 'F' means the string will ring at the " "fundamental, and '6' means the string will ring six octaves above the " "fundamental." ) ); m_stringSelector = new nineButtonSelector( PLUGIN_NAME::getIconPixmap( "button_1_on" ), PLUGIN_NAME::getIconPixmap( "button_1_off" ), PLUGIN_NAME::getIconPixmap( "button_2_on" ), PLUGIN_NAME::getIconPixmap( "button_2_off" ), PLUGIN_NAME::getIconPixmap( "button_3_on" ), PLUGIN_NAME::getIconPixmap( "button_3_off" ), PLUGIN_NAME::getIconPixmap( "button_4_on" ), PLUGIN_NAME::getIconPixmap( "button_4_off" ), PLUGIN_NAME::getIconPixmap( "button_5_on" ), PLUGIN_NAME::getIconPixmap( "button_5_off" ), PLUGIN_NAME::getIconPixmap( "button_6_on" ), PLUGIN_NAME::getIconPixmap( "button_6_off" ), PLUGIN_NAME::getIconPixmap( "button_7_on" ), PLUGIN_NAME::getIconPixmap( "button_7_off" ), PLUGIN_NAME::getIconPixmap( "button_8_on" ), PLUGIN_NAME::getIconPixmap( "button_8_off" ), PLUGIN_NAME::getIconPixmap( "button_9_on" ), PLUGIN_NAME::getIconPixmap( "button_9_off" ), 0, 21, 39, this); m_graph = new Graph( this ); m_graph->setWindowTitle( tr( "Impulse Editor" ) ); m_graph->setForeground( PLUGIN_NAME::getIconPixmap( "wavegraph4" ) ); m_graph->move( 76, 21 ); m_graph->resize(132, 104); m_graph->setWhatsThis( tr( "The waveform editor provides control over the initial state or impulse " "that is used to start the string vibrating. The buttons to the right of " "the graph will initialize the waveform to the selected type. The '?' " "button will load a waveform from a file--only the first 128 samples " "will be loaded.\n\n" "The waveform can also be drawn in the graph.\n\n" "The 'S' button will smooth the waveform.\n\n" "The 'N' button will normalize the waveform.") ); setWhatsThis( tr( "Vibed models up to nine independently vibrating strings. The 'String' " "selector allows you to choose which string is being edited. The 'Imp' " "selector chooses whether the graph represents an impulse or the initial " "state of the string. The 'Octave' selector chooses which harmonic the " "string should vibrate at.\n\n" "The graph allows you to control the initial state or impulse used to set the " "string in motion.\n\n" "The 'V' knob controls the volume. The 'S' knob controls the string's " "stiffness. The 'P' knob controls the pick position. The 'PU' knob " "controls the pickup position.\n\n" "'Pan' and 'Detune' hopefully don't need explanation. The 'Slap' knob " "adds a bit of fuzz to the sound of the string.\n\n" "The 'Length' knob controls the length of the string.\n\n" "The LED in the lower right corner of the waveform editor determines " "whether the string is active in the current instrument." ) ); m_power = new LedCheckBox( "", this, tr( "Enable waveform" ) ); m_power->move( 212, 130 ); ToolTip::add( m_power, tr( "Click here to enable/disable waveform." ) ); // String selector is not a part of the model m_stringSelector->setWindowTitle( tr( "String" ) ); m_stringSelector->setWhatsThis( tr( "The String selector is used to choose which string the controls are " "editing. A Vibed instrument can contain up to nine independently " "vibrating strings. The LED in the lower right corner of the " "waveform editor indicates whether the selected string is active." ) ); connect( m_stringSelector, SIGNAL( nineButtonSelection( int ) ), this, SLOT( showString( int ) ) ); showString( 0 ); m_sinWaveBtn = new PixmapButton( this, tr( "Sine wave" ) ); m_sinWaveBtn->move( 212, 24 ); m_sinWaveBtn->setActiveGraphic( embed::getIconPixmap( "sin_wave_active" ) ); m_sinWaveBtn->setInactiveGraphic( embed::getIconPixmap( "sin_wave_inactive" ) ); ToolTip::add( m_sinWaveBtn, tr( "Use a sine-wave for " "current oscillator." ) ); connect( m_sinWaveBtn, SIGNAL (clicked () ), this, SLOT ( sinWaveClicked() ) ); m_triangleWaveBtn = new PixmapButton( this, tr( "Triangle wave" ) ); m_triangleWaveBtn->move( 212, 41 ); m_triangleWaveBtn->setActiveGraphic( embed::getIconPixmap( "triangle_wave_active" ) ); m_triangleWaveBtn->setInactiveGraphic( embed::getIconPixmap( "triangle_wave_inactive" ) ); ToolTip::add( m_triangleWaveBtn, tr( "Use a triangle-wave " "for current oscillator." ) ); connect( m_triangleWaveBtn, SIGNAL ( clicked () ), this, SLOT ( triangleWaveClicked( ) ) ); m_sawWaveBtn = new PixmapButton( this, tr( "Saw wave" ) ); m_sawWaveBtn->move( 212, 58 ); m_sawWaveBtn->setActiveGraphic( embed::getIconPixmap( "saw_wave_active" ) ); m_sawWaveBtn->setInactiveGraphic( embed::getIconPixmap( "saw_wave_inactive" ) ); ToolTip::add( m_sawWaveBtn, tr( "Use a saw-wave for " "current oscillator." ) ); connect( m_sawWaveBtn, SIGNAL (clicked () ), this, SLOT ( sawWaveClicked() ) ); m_sqrWaveBtn = new PixmapButton( this, tr( "Square wave" ) ); m_sqrWaveBtn->move( 212, 75 ); m_sqrWaveBtn->setActiveGraphic( embed::getIconPixmap( "square_wave_active" ) ); m_sqrWaveBtn->setInactiveGraphic( embed::getIconPixmap( "square_wave_inactive" ) ); ToolTip::add( m_sqrWaveBtn, tr( "Use a square-wave for " "current oscillator." ) ); connect( m_sqrWaveBtn, SIGNAL ( clicked () ), this, SLOT ( sqrWaveClicked() ) ); m_whiteNoiseWaveBtn = new PixmapButton( this, tr( "White noise wave" ) ); m_whiteNoiseWaveBtn->move( 212, 92 ); m_whiteNoiseWaveBtn->setActiveGraphic( embed::getIconPixmap( "white_noise_wave_active" ) ); m_whiteNoiseWaveBtn->setInactiveGraphic( embed::getIconPixmap( "white_noise_wave_inactive" ) ); ToolTip::add( m_whiteNoiseWaveBtn, tr( "Use white-noise for " "current oscillator." ) ); connect( m_whiteNoiseWaveBtn, SIGNAL ( clicked () ), this, SLOT ( noiseWaveClicked() ) ); m_usrWaveBtn = new PixmapButton( this, tr( "User defined wave" ) ); m_usrWaveBtn->move( 212, 109 ); m_usrWaveBtn->setActiveGraphic( embed::getIconPixmap( "usr_wave_active" ) ); m_usrWaveBtn->setInactiveGraphic( embed::getIconPixmap( "usr_wave_inactive" ) ); ToolTip::add( m_usrWaveBtn, tr( "Use a user-defined " "waveform for current oscillator." ) ); connect( m_usrWaveBtn, SIGNAL ( clicked () ), this, SLOT ( usrWaveClicked() ) ); m_smoothBtn = new PixmapButton( this, tr( "Smooth" ) ); m_smoothBtn->move( 79, 129 ); m_smoothBtn->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "smooth_active" ) ); m_smoothBtn->setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "smooth_inactive" ) ); m_smoothBtn->setChecked( false ); ToolTip::add( m_smoothBtn, tr( "Click here to smooth waveform." ) ); connect( m_smoothBtn, SIGNAL ( clicked () ), this, SLOT ( smoothClicked() ) ); m_normalizeBtn = new PixmapButton( this, tr( "Normalize" ) ); m_normalizeBtn->move( 96, 129 ); m_normalizeBtn->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "normalize_active" ) ); m_normalizeBtn->setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "normalize_inactive" ) ); m_normalizeBtn->setChecked( false ); ToolTip::add( m_normalizeBtn, tr( "Click here to normalize waveform." ) ); connect( m_normalizeBtn, SIGNAL ( clicked () ), this, SLOT ( normalizeClicked() ) ); }
void EEPROM_printSettings() { // if def=true, the default values will be used #ifdef PRINT_EEPROM_SETTING showString(PSTR("Steps per unit:\r\n")); showString(PSTR(" M92 X")); Serial.print(axis_steps_per_unit[0]); showString(PSTR(" Y")); Serial.print(axis_steps_per_unit[1]); showString(PSTR(" Z")); Serial.print(axis_steps_per_unit[2]); showString(PSTR(" E")); Serial.println(axis_steps_per_unit[3]); showString(PSTR("Maximum feedrates (mm/s):\r\n")); showString(PSTR(" M203 X")); Serial.print(max_feedrate[0]); showString(PSTR(" Y")); Serial.print(max_feedrate[1]); showString(PSTR(" Z")); Serial.print(max_feedrate[2]); showString(PSTR(" E")); Serial.println(max_feedrate[3]); showString(PSTR("Maximum Acceleration (mm/s2):\r\n")); showString(PSTR(" M201 X")); Serial.print(max_acceleration_units_per_sq_second[0] ); showString(PSTR(" Y")); Serial.print(max_acceleration_units_per_sq_second[1] ); showString(PSTR(" Z")); Serial.print(max_acceleration_units_per_sq_second[2] ); showString(PSTR(" E")); Serial.println(max_acceleration_units_per_sq_second[3]); showString(PSTR("Acceleration: S=acceleration, T=retract acceleration\r\n")); showString(PSTR(" M204 S")); Serial.print(move_acceleration ); showString(PSTR(" T")); Serial.println(retract_acceleration); showString(PSTR("Advanced variables: S=Min feedrate (mm/s), T=Min travel feedrate (mm/s), X=maximum xY jerk (mm/s), Z=maximum Z jerk (mm/s)\r\n")); showString(PSTR(" M205 S")); Serial.print(minimumfeedrate ); showString(PSTR(" T" )); Serial.print(mintravelfeedrate ); // showString(PSTR(" B")); // Serial.print(minsegmenttime ); showString(PSTR(" X")); Serial.print(max_xy_jerk ); showString(PSTR(" Z")); Serial.println(max_z_jerk); #ifdef PIDTEMP /* showString(PSTR("PID settings:"); showString(PSTR(" M301 P")); Serial.print(Kp); showString(PSTR(" I")); Serial.print(Ki); SshowString(PSTR(" D")); Serial.print(Kd); */ #endif #endif }
void showHelp() { showConfig(); showString(helpText); }
int main (int argc, char **argv) { char *charbuf; widechar inbuf[BUFSIZE]; widechar transbuf[BUFSIZE]; widechar outbuf[BUFSIZE]; int outputPos[BUFSIZE]; int inputPos[BUFSIZE]; int inlen; int translen; int outlen; int cursorPos = -1; int realInlen = 0; int k; int optc; set_program_name (argv[0]); while ((optc = getopt_long (argc, argv, "hv", longopts, NULL)) != -1) switch (optc) { /* --help and --version exit immediately, per GNU coding standards. */ case 'v': version_etc (stdout, program_name, PACKAGE_NAME, VERSION, AUTHORS, (char *) NULL); exit (EXIT_SUCCESS); break; case 'h': print_help (); exit (EXIT_SUCCESS); break; default: fprintf (stderr, "Try `%s --help' for more information.\n", program_name); exit (EXIT_FAILURE); break; } if (optind < argc) { /* Print error message and exit. */ fprintf (stderr, "%s: extra operand: %s\n", program_name, argv[optind]); fprintf (stderr, "Try `%s --help' for more information.\n", program_name); exit (EXIT_FAILURE); } validTable = NULL; enteredCursorPos = -1; mode = 0; while (1) { getCommands (); printf ("Type something, press enter, and view the results.\n"); printf ("A blank line returns to command entry.\n"); if (minimalist) while (1) { translen = outputSize; outlen = outputSize; inlen = getInput (); if (inlen == 0) break; if (!(realInlen = extParseChars (inputBuffer, inbuf))) break; inlen = realInlen; if (!lou_translateString (table, inbuf, &inlen, transbuf, &translen, NULL, NULL, 0)) break; transbuf[translen] = 0; printf ("Translation:\n"); charbuf = showString (transbuf, translen); k = strlen (charbuf) - 1; charbuf[k] = 0; printf ("%s\n", &charbuf[1]); if (showSizes) printf ("input length = %d; output length = %d\n", inlen, translen); lou_backTranslateString (table, transbuf, &translen, outbuf, &outlen, NULL, NULL, 0); printf ("Back-translation:\n"); charbuf = showString (outbuf, outlen); k = strlen (charbuf) - 1; charbuf[k] = 0; printf ("%s\n", &charbuf[1]); if (showSizes) printf ("input length = %d; output length = %d.\n", translen, outlen); if (outlen == realInlen) { for (k = 0; k < realInlen; k++) if (inbuf[k] != outbuf[k]) break; if (k == realInlen) printf ("Perfect roundtrip!\n"); } } else while (1) { for (k = 0; k < strlen (enteredEmphasis); k++) emphasis[k] = (formtype) enteredEmphasis[k]; emphasis[k] = 0; strcpy (spacing, enteredSpacing); cursorPos = enteredCursorPos; inlen = getInput (); if (inlen == 0) break; outlen = outputSize; if (backOnly) { if (!(translen = extParseChars (inputBuffer, transbuf))) break; inlen = realInlen; } else { translen = outputSize; if (!(realInlen = extParseChars (inputBuffer, inbuf))) break; inlen = realInlen; if (!lou_translate (table, inbuf, &inlen, transbuf, &translen, emphasis, spacing, &outputPos[0], &inputPos[0], &cursorPos, mode)) break; transbuf[translen] = 0; if (mode & dotsIO) { printf ("Translation dot patterns:\n"); printf ("%s\n", showDots (transbuf, translen)); } else { printf ("Translation:\n"); charbuf = showString (transbuf, translen); k = strlen (charbuf) - 1; charbuf[k] = 0; printf ("%s\n", &charbuf[1]); if (showSizes) printf ("input length = %d; output length = %d\n", inlen, translen); } } if (cursorPos != -1) printf ("Cursor position: %d\n", cursorPos); if (enteredSpacing[0]) printf ("Returned spacing: %s\n", spacing); if (showPositions) { printf ("Output positions:\n"); for (k = 0; k < inlen; k++) printf ("%d ", outputPos[k]); printf ("\n"); printf ("Input positions:\n"); for (k = 0; k < translen; k++) printf ("%d ", inputPos[k]); printf ("\n"); } if (!forwardOnly) { if (!lou_backTranslate (table, transbuf, &translen, outbuf, &outlen, emphasis, spacing, &outputPos[0], &inputPos[0], &cursorPos, mode)) break; printf ("Back-translation:\n"); charbuf = showString (outbuf, outlen); k = strlen (charbuf) - 1; charbuf[k] = 0; printf ("%s\n", &charbuf[1]); if (showSizes) printf ("input length = %d; output length = %d\n", translen, outlen); if (cursorPos != -1) printf ("Cursor position: %d\n", cursorPos); if (enteredSpacing[0]) printf ("Returned spacing: %s\n", spacing); if (showPositions) { printf ("Output positions:\n"); for (k = 0; k < translen; k++) printf ("%d ", outputPos[k]); printf ("\n"); printf ("Input positions:\n"); for (k = 0; k < outlen; k++) printf ("%d ", inputPos[k]); printf ("\n"); } } if (!(forwardOnly || backOnly)) { if (outlen == realInlen) { for (k = 0; k < realInlen; k++) if (inbuf[k] != outbuf[k]) break; if (k == realInlen) printf ("Perfect roundtrip!\n"); } } } } lou_free (); exit (EXIT_SUCCESS); }