From 37b24667fd02bb796dd9ecfe77245ce385abc9cf Mon Sep 17 00:00:00 2001 From: Godzil Date: Wed, 22 Mar 2023 18:20:16 +0000 Subject: [PATCH] Fix type lenght -> length --- dis_asm.cpp | 4 ++-- emu51.cpp | 14 +++++++------- gui.cpp | 38 +++++++++++++++++++------------------- include/code_51.h | 2 +- include/gui.h | 6 +++--- 5 files changed, 32 insertions(+), 32 deletions(-) diff --git a/dis_asm.cpp b/dis_asm.cpp index 23eebf4..1c72158 100644 --- a/dis_asm.cpp +++ b/dis_asm.cpp @@ -55,7 +55,7 @@ void dis_asm::draw(uint16_t adress) if ( asm51[ram[adress]].code == ram[adress] ) { textprintf(surface, mainf, left, c, color, "%4x:", adress); - for ( cnt = 0 ; cnt < asm51[ram[adress]].lenght ; cnt++ ) + for ( cnt = 0 ; cnt < asm51[ram[adress]].length ; cnt++ ) { if ( PC == ( adress + cnt )) { @@ -68,7 +68,7 @@ void dis_asm::draw(uint16_t adress) hexoutB(left + 50 + cnt * 24, c, colPC, ram[adress + cnt]); } textprintf(surface, mainf, left + 144, c, color, "%s", asm51[ram[adress]].display_string); - adress += asm51[ram[adress]].lenght; + adress += asm51[ram[adress]].length; } else { diff --git a/emu51.cpp b/emu51.cpp index 0910de8..03c4158 100755 --- a/emu51.cpp +++ b/emu51.cpp @@ -68,11 +68,11 @@ void init_8051(void) } // 8051 assembler macros -int get_lenght(uint8_t code) +int get_length(uint8_t code) { if ( asm51[code].code == code ) { - return asm51[code].lenght; + return asm51[code].length; } else { @@ -100,7 +100,7 @@ int load_code_table(code_51 *tmp_tab) FILE *strio = NULL; char _mnem[6]; int _code; - int _lenght; + int _length; int _cycles; char _datas[12]; strio = fopen("list51.txt", "r"); @@ -111,7 +111,7 @@ int load_code_table(code_51 *tmp_tab) fscanf(strio, "%x", &_code); fscanf(strio, "%s", _mnem); fscanf(strio, "%s", _datas); - fscanf(strio, "%d", &_lenght); + fscanf(strio, "%d", &_length); fscanf(strio, "%d", &_cycles); if ( _mnem[0] == 'E' && _mnem[1] == 'N' && _mnem[2] == 'D' ) { @@ -120,7 +120,7 @@ int load_code_table(code_51 *tmp_tab) tmp_tab[_code].code = (uint8_t) _code; strcpy(tmp_tab[_code].mnem, _mnem); strcpy(tmp_tab[_code].datas, _datas); - tmp_tab[_code].lenght = (uint8_t) _lenght; + tmp_tab[_code].length = (uint8_t) _length; tmp_tab[_code].cycles = (uint8_t) _cycles; } fclose(strio); @@ -710,8 +710,8 @@ int main(void) } if ( key[KEY_DOWN] ) { - aadr += get_lenght(prog[aadr]); - aadr += get_lenght(prog[aadr]); + aadr += get_length(prog[aadr]); + aadr += get_length(prog[aadr]); } if ( key[KEY_PGUP] && !( key[KEY_LSHIFT] || key[KEY_RSHIFT] )) { diff --git a/gui.cpp b/gui.cpp index 770558b..2a05961 100644 --- a/gui.cpp +++ b/gui.cpp @@ -136,22 +136,22 @@ void change_char(char *string, char ch, int pos) string[pos - 1] = ch; } -void insert_char(char *string, char ch, int pos, int lenght) +void insert_char(char *string, char ch, int pos, int length) { - for ( int c = lenght ; c > pos ; c-- ) + for ( int c = length ; c > pos ; c-- ) { string[c - 1] = string[c - 2]; } string[pos - 1] = ch; } -void cut_char(char *string, int pos, int lenght) +void cut_char(char *string, int pos, int length) { - for ( int c = pos ; c < lenght ; c++ ) + for ( int c = pos ; c < length ; c++ ) { string[c - 1] = string[c]; } - string[lenght - 1] = (char) ( 32 ); + string[length - 1] = (char) ( 32 ); } void change_ext(char *s) @@ -170,7 +170,7 @@ void change_ext(char *s) return; } -void GetText(char *text, BITMAP *buf, int x, int y, int w, int h, int lenght, char *title) +void GetText(char *text, BITMAP *buf, int x, int y, int w, int h, int length, char *title) { int c; BITMAP *surface = create_bitmap(w, h); @@ -188,11 +188,11 @@ void GetText(char *text, BITMAP *buf, int x, int y, int w, int h, int lenght, ch textprintf_centre(surface, mainf, surface->w / 2, 4, makecol(255, 255, 255), " %s ", title); text[0] = 32; - for ( c = 1 ; c <= lenght - 1 ; c++ ) + for ( c = 1 ; c <= length - 1 ; c++ ) { text[c] = 32; } - text[lenght - 1] = 0; + text[length - 1] = 0; clear_keybuf(); int pos = 1; uint16_t key_p; @@ -219,16 +219,16 @@ void GetText(char *text, BITMAP *buf, int x, int y, int w, int h, int lenght, ch if ( pos > 1 ) { pos--; - cut_char(text, pos, lenght); - text[lenght - 2] = 32; - text[lenght - 1] = 0; + cut_char(text, pos, length); + text[length - 2] = 32; + text[length - 1] = 0; } flag = true; break; case KEY_DEL: - cut_char(text, pos, lenght); - text[lenght - 2] = 32; - text[lenght - 1] = 0; + cut_char(text, pos, length); + text[length - 2] = 32; + text[length - 1] = 0; flag = true; break; case KEY_LEFT: @@ -237,20 +237,20 @@ void GetText(char *text, BITMAP *buf, int x, int y, int w, int h, int lenght, ch flag = true; break; case KEY_RIGHT: - if ( pos < lenght ) + if ( pos < length ) { pos++; } flag = true; break; } - if ( !key[KEY_ENTER] && key_ch != 0 && pos < lenght && !flag ) + if ( !key[KEY_ENTER] && key_ch != 0 && pos < length && !flag ) { - insert_char(text, key_ch, pos, lenght); + insert_char(text, key_ch, pos, length); pos++; - text[lenght - 1] = 0; + text[length - 1] = 0; } } - text[lenght - 1] = 0; + text[length - 1] = 0; blit(cache, buf, 0, 0, x, y, w, h); destroy_bitmap(cache); destroy_bitmap(surface); diff --git a/include/code_51.h b/include/code_51.h index 330b28e..8b4f40c 100644 --- a/include/code_51.h +++ b/include/code_51.h @@ -14,7 +14,7 @@ class code_51 public: char mnem[6]; // instruction mnemonic (2-4 characters) uint8_t code; // instruction code - uint8_t lenght; // bytes which are needed to write this instruction into memory + uint8_t length; // bytes which are needed to write this instruction into memory uint8_t cycles; // time unit char display_string[20]; // string which is ready for displaying, it's made by make_ds(WORD) method char datas[12]; // string which contains datas which will be displayed after mnemonic diff --git a/include/gui.h b/include/gui.h index 7e2038b..942b31a 100755 --- a/include/gui.h +++ b/include/gui.h @@ -13,10 +13,10 @@ bool checkBit(uint8_t tmp_b, int pos); void draw_SEG_digit(BITMAP *buf, int x, int y, int color, int size, uint8_t segm_code); void draw_LED_bin(BITMAP *buf, int x, int y, int color, uint8_t code); void change_char(char *string, char ch, int pos); -void insert_char(char *string, char ch, int pos, int lenght); -void cut_char(char *string, int pos, int lenght); +void insert_char(char *string, char ch, int pos, int length); +void cut_char(char *string, int pos, int length); void change_ext(char *s); -void GetText(char *text, BITMAP *buf, int x, int y, int w, int h, int lenght, char *title); +void GetText(char *text, BITMAP *buf, int x, int y, int w, int h, int length, char *title); void ShowMessage(char *text, BITMAP *buf, int x, int y, int w, int h, char *title); bool QuestionBox(char *text, BITMAP *buf, int x, int y, int w, int h, char *title, int _color); void ShowMsgEx(char *text, BITMAP *buf, int x, int y, int w, int h, char *title, int _color);