static void printOut( char *string, size_t offset, size_t size ) { char * string_left = string; size_t curr_pos = 0; int ascii; offset = offset; ascii = !IsMasmOutput(); for( ;; ) { if( string_left < ( string + size ) ) { if( ascii && printableString( string_left ) && strlen( string_left ) > 0 ) { if( strlen( string_left ) < ( size - curr_pos ) ) { BufferConcat( " .asciiz\t" ); curr_pos = printString( string_left, ASCIZ ); } else { BufferConcat( " .ascii\t" ); curr_pos = printString( string_left, ASCII ); } string_left += curr_pos; } else { printRest( (unsigned_8 *)string_left, size - (size_t)( string_left - string ) ); break; } } else { break; } BufferConcatNL(); BufferPrint(); } }
static void printOut( const char *string, size_t offset, size_t size ) { const char *string_left; size_t item_size; bool ascii; /* unused parameters */ (void)offset; ascii = !IsMasmOutput(); item_size = 0; string_left = string; for( ; string_left < ( string + size ); ) { if( !ascii || !printableString( string_left ) || strlen( string_left ) == 0 ) { printRest( (unsigned_8 *)string_left, size - (size_t)( string_left - string ) ); break; } if( strlen( string_left ) < ( size - item_size ) ) { BufferConcat( " .asciiz\t" ); item_size = printString( string_left, ASCIZ ); } else { BufferConcat( " .ascii\t" ); item_size = printString( string_left, ASCII ); } string_left += item_size; BufferConcatNL(); BufferPrint(); } }
void DiagnosticOutput::printHints() { for (const auto& diag : hintStack) { if (diag.sloc) printRest(diag); else out << "hint: " << diag.message << "\n"; } }
void setup(void) { Serial.begin(9600); // If your TFT's plastic wrap has a Red Tab, use the following: tft.initR(INITR_REDTAB); // initialize a ST7735R chip, red tab // If your TFT's plastic wrap has a Green Tab, use the following: //tft.initR(INITR_GREENTAB); // initialize a ST7735R chip, green tab // how much memory have we got left at this point? Serial.print("Avail mem (bytes):"); Serial.println(AVAIL_MEM); Serial.print("Initializing SD card..."); if (!SD.begin(SD_CS)) { Serial.println("failed!"); return; } Serial.println("OK!"); // clear to yellow tft.fillScreen(tft.Color565(0xff, 0xff, 0x00)); lcd_image_draw(&map_image, &tft, 0, 0, 0, 0, 128, 128); // how much memory have we got left at this point? Serial.print("Avail mem (bytes):"); Serial.println(AVAIL_MEM); // test out reading blocks from the SD card if (!card.init(SPI_HALF_SPEED, SD_CS)) { Serial.println("Raw SD Initialization has failed"); while (1) {}; // Just wait, stuff exploded. } // how much memory have we got left at this point? Serial.print("Avail mem (bytes):"); Serial.println(AVAIL_MEM); uint32_t block_num = 4000000; uint32_t start = millis(); for (int l=0; l<135; l++) { card.readBlock( block_num, (uint8_t *) block_buf); // Serial.println(block_buf[1].name); } uint32_t stop = millis(); //Serial.println(stop - start); //dump_block((uint8_t *) block_buf, BLOCK_LEN); // Serial.println(block_buf[1].name); for(int i = 0; i < 1066; i++) { printRest(i); } }
void convertKernNoteToDM(HumdrumFile& infile, int line, int spine, int track) { const char* element = infile[line][spine]; double duration; Array<int> notes; if (strcmp(element, ".") == 0) { return; } if (infile[line].getExInterpNum(spine) != E_KERN_EXINT) { return; } if (infile[line].getBeat() == 1.0) { bar++; cout << "\n (bar " << bar << ") "; } duration = Convert::kernToDuration(infile[line][spine]); if (strchr(element, 'r') != NULL) { cout << " "; printRest(duration); return; } getNoteArray(notes, infile, line, spine); int notecount = notes.getSize(); cout << " ("; for (int i=0; i<notecount; i++) { printNote(notes[i]); if (i < notecount - 1) { cout << " "; } } cout << " "; printCMNDuration(duration); if (strchr(infile[line][spine], '[') != NULL) { cout << " begin-tie"; } else if (strchr(infile[line][spine], ']') != NULL) { cout << " end-tie"; } else if (strchr(infile[line][spine], '_') != NULL) { } cout << ")"; }
void loop() { // Calculate the position of the map that we are redrawing behind the old cursor map_redraw.x = cursor.position.x - cursor.r; map_redraw.y = cursor.position.y - cursor.r; // Calculate the source tile of the map that we are palcing map_tile.x = map_redraw.x + m_map.x; map_tile.y = map_redraw.y + m_map.y; // Ini redraw parameter, will be used to indicate that a redraw is required bool redraw = 0; // Analog read into joystick parameters JoyStick.x = analogRead(HORZJOY); JoyStick.y = analogRead(VERTJOY); // If there is a deviation from the initial readings, this indicates that there might be some redrawing required if(iniJoy.x != JoyStick.x || iniJoy.y != JoyStick.y) { moveJoystick(&JoyStick, &cursor, &tft, &redraw); moveCursorOff(&map_image, &tft, &cursor, &m_map, &redraw); } if(state) { // Determine the location of the cursor on the image file cursor_map.x = m_map.x + cursor.position.x; cursor_map.y = m_map.y + cursor.position.y; #if DEBUG Serial.print("Mapped (X,Y) Coord> ("); Serial.print(cursor_map.x); Serial.print(","); Serial.print(cursor_map.y); Serial.println(")"); Serial.print("Mapped (LON,LAT) Coord> ("); Serial.print(x_to_lon(cursor_map.x)); Serial.print(","); Serial.print(y_to_lat(cursor_map.y)); Serial.println(")"); #endif // Sets our page number to be zero uint16_t page = 1; // Prints loading screen to tft while loading and sorting get processed loadingScreen(&card, &tft); // Define RestDist structure for holding the distances from the different rest's // NOTE: As rest is an array, it does not need to be dereferenced RestDist rest[TOTAL_REST]; // Load the restraunts from the SD card into the restdist array loadRest(&card, rest, &cursor_map, TOTAL_REST); // Use the comb sort algorithm to sort the list of restraunts comb_sort(rest, TOTAL_REST); // Print page 1 of the sorted list printRest(&card, &tft, rest, page); while(state) { // Reads the current position of the joystick JoyStick.y = analogRead(VERTJOY); /* * Checks whether the joystick has moved (selecting other restraunts from list) and prints the restraunt according the page passed, with added support for checking that you do not go over the amount of restraunts that were loaded. */ if(JoyStick.y > 800 && page != 1) { printRest(&card, &tft, rest, --page); } else if(JoyStick.y < 250 && (page - 1)*PAGESIZE + PAGESIZE < TOTAL_REST) { printRest(&card, &tft, rest, ++page); } } // Redraw the map lcd_image_draw(&map_image, &tft, &m_map, &c_zero, tft.width(), tft.height()); // Redraw the cursor in its old position drawCursor(&tft, &cursor); // Set the redraw parameter to be zero redraw = 0; } /* * This will redraw the map over the old cursor, and redraw the cursor in the new position if the cursor has been indicated as moved. */ if(redraw == 1) { // Included for DEBUG purposes #if DEBUG // Determine the location of the cursor on the image file cursor_map.x = m_map.x + cursor.position.x; cursor_map.y = m_map.y + cursor.position.y; Serial.print("Mapped (X,Y) Coord> ("); Serial.print(cursor_map.x); Serial.print(","); Serial.print(cursor_map.y); Serial.println(")"); Serial.print("Mapped (LON,LAT) Coord> ("); Serial.print(x_to_lon(cursor_map.x)); Serial.print(","); Serial.print(y_to_lat(cursor_map.y)); Serial.println(")"); #endif // Redraw the map in front of the old cursor lcd_image_draw(&map_image, &tft, &map_tile, &map_redraw, cursor.r*2+1, cursor.r*2+1); // Draw the new cursor at the new position drawCursor(&tft, &cursor); } }
void DiagnosticOutput::printFirst(const Diagnostic& diag) { printIncludeStack(out, diag.sloc->parent()); printRest(diag); }