Parcourir la source

Code cleanup from cli changes.

bringup
Jacob Alexander il y a 9 ans
Parent
révision
1db716ce53
2 fichiers modifiés avec 7 ajouts et 7 suppressions
  1. 5
    5
      Debug/cli/cli.c
  2. 2
    2
      Debug/cli/cli.h

+ 5
- 5
Debug/cli/cli.c Voir le fichier

CLI_commandLookup(); CLI_commandLookup();


// Add the command to the history // Add the command to the history
cli_saveHistory( CLILineBuffer );
CLI_saveHistory( CLILineBuffer );


// Keep the array circular, discarding the older entries // Keep the array circular, discarding the older entries
if ( CLIHistoryTail < CLIHistoryHead ) if ( CLIHistoryTail < CLIHistoryHead )
} }


CLIHistoryCurrent = CLIHistoryTail; // 'Up' starts at the last item CLIHistoryCurrent = CLIHistoryTail; // 'Up' starts at the last item
cli_saveHistory( NULL ); // delete the old temp buffer
CLI_saveHistory( NULL ); // delete the old temp buffer


// Reset the buffer // Reset the buffer
CLILineBufferCurrent = 0; CLILineBufferCurrent = 0;
{ {
// Is first time pressing arrow. Save the current buffer // Is first time pressing arrow. Save the current buffer
CLILineBuffer[ prev_buf_pos ] = '\0'; CLILineBuffer[ prev_buf_pos ] = '\0';
cli_saveHistory( CLILineBuffer );
CLI_saveHistory( CLILineBuffer );
} }


// Grab the previus item from the history if there is one // Grab the previus item from the history if there is one
if ( RING_PREV( CLIHistoryCurrent ) != RING_PREV( CLIHistoryHead ) ) if ( RING_PREV( CLIHistoryCurrent ) != RING_PREV( CLIHistoryHead ) )
CLIHistoryCurrent = RING_PREV( CLIHistoryCurrent ); CLIHistoryCurrent = RING_PREV( CLIHistoryCurrent );
cli_retreiveHistory( CLIHistoryCurrent );
CLI_retreiveHistory( CLIHistoryCurrent );
} }
if ( CLILineBuffer[ prev_buf_pos + 2 ] == 0x42 ) // Hist next if ( CLILineBuffer[ prev_buf_pos + 2 ] == 0x42 ) // Hist next
{ {
// Grab the next item from the history if it exists // Grab the next item from the history if it exists
if ( RING_NEXT( CLIHistoryCurrent ) != RING_NEXT( CLIHistoryTail ) ) if ( RING_NEXT( CLIHistoryCurrent ) != RING_NEXT( CLIHistoryTail ) )
CLIHistoryCurrent = RING_NEXT( CLIHistoryCurrent ); CLIHistoryCurrent = RING_NEXT( CLIHistoryCurrent );
cli_retreiveHistory( CLIHistoryCurrent );
CLI_retreiveHistory( CLIHistoryCurrent );
} }
} }
return; return;

+ 2
- 2
Debug/cli/cli.h Voir le fichier

const char name##CLIDict_DescEntry[] = description; const char name##CLIDict_DescEntry[] = description;
#endif #endif


#define RING_PREV(i) wrap(i-1,0,CLIMaxHistorySize-1)
#define RING_NEXT(i) wrap(i+1,0,CLIMaxHistorySize-1)
#define RING_PREV(i) CLI_wrap(i - 1, 0, CLIMaxHistorySize - 1)
#define RING_NEXT(i) CLI_wrap(i + 1, 0, CLIMaxHistorySize - 1)




// ----- Structs ----- // ----- Structs -----