From af9f1abf98585f22edd46b2bbdaaed22f3b93408 Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Sun, 13 Nov 2022 16:38:48 -0500 Subject: [PATCH] Code/Comments cleanup Tabs to spaces Whitespace Normalize clang-format comments --- src/86box.c | 10 ++++---- src/chipset/ali1429.c | 4 ++-- src/chipset/ali1621.c | 40 ++++++++++++++++---------------- src/chipset/headland.c | 2 +- src/chipset/intel_piix.c | 12 +++++----- src/cpu/386.c | 10 ++++---- src/cpu/8080.c | 8 +++---- src/cpu/fpu.c | 18 +++++++------- src/cpu/x86_ops_msr.h | 4 ++-- src/device/keyboard.c | 2 +- src/device/serial.c | 1 + src/disk/hdd_table.c | 32 ++++++++++++------------- src/include_make/86box/version.h | 36 ++++++++++++++-------------- src/lpt.c | 2 +- src/random.c | 6 ++--- src/video/vid_table.c | 4 ++-- src/vnc.c | 12 +++++----- src/win/win_dynld.c | 30 ++++++++++++------------ 18 files changed, 117 insertions(+), 116 deletions(-) diff --git a/src/86box.c b/src/86box.c index c380c5d03..6be333253 100644 --- a/src/86box.c +++ b/src/86box.c @@ -205,15 +205,15 @@ char exe_path[2048]; /* path (dir) of executable */ char usr_path[1024]; /* path (dir) of user data */ char cfg_path[1024]; /* full path of config file */ FILE *stdlog = NULL; /* file to log output to */ -// int scrnsz_x = SCREEN_RES_X; /* current screen size, X */ -// int scrnsz_y = SCREEN_RES_Y; /* current screen size, Y */ +// int scrnsz_x = SCREEN_RES_X; /* current screen size, X */ +// int scrnsz_y = SCREEN_RES_Y; /* current screen size, Y */ int config_changed; /* config has changed */ int title_update; int framecountx = 0; int hard_reset_pending = 0; -// int unscaled_size_x = SCREEN_RES_X; /* current unscaled size X */ -// int unscaled_size_y = SCREEN_RES_Y; /* current unscaled size Y */ +// int unscaled_size_x = SCREEN_RES_X; /* current unscaled size X */ +// int unscaled_size_y = SCREEN_RES_Y; /* current unscaled size Y */ // int efscrnsz_y = SCREEN_RES_Y; static wchar_t mouse_msg[3][200]; @@ -473,7 +473,7 @@ usage: printf("-D or --debug - force debug output logging\n"); #endif #if 0 - printf("-E or --nographic - forces the old behavior\n"); + printf("-E or --nographic - forces the old behavior\n"); #endif printf("-F or --fullscreen - start in fullscreen mode\n"); printf("-G or --lang langid - start with specified language (e.g. en-US, or system)\n"); diff --git a/src/chipset/ali1429.c b/src/chipset/ali1429.c index 16d3e3f4b..699769fa2 100644 --- a/src/chipset/ali1429.c +++ b/src/chipset/ali1429.c @@ -324,8 +324,8 @@ ali1429_init(const device_t *info) GREEN = info->local; /* M1429 Ports: - 22h Index Port - 23h Data Port + 22h Index Port + 23h Data Port */ io_sethandler(0x0022, 0x0002, ali1429_read, NULL, NULL, ali1429_write, NULL, NULL, dev); diff --git a/src/chipset/ali1621.c b/src/chipset/ali1621.c index 968ef3769..7db437b24 100644 --- a/src/chipset/ali1621.c +++ b/src/chipset/ali1621.c @@ -59,28 +59,28 @@ ali1621_log(const char *fmt, ...) /* Table translated to a more sensible format: Read cycles: - SMREN SMM Mode Code Data - 0 X X PCI PCI - 1 0 Close PCI PCI - 1 0 Lock PCI PCI - 1 0 Protect PCI PCI - 1 0 Open DRAM DRAM - 1 1 Open DRAM DRAM - 1 1 Protect DRAM DRAM - 1 1 Close DRAM PCI - 1 1 Lock DRAM PCI + SMREN SMM Mode Code Data + 0 X X PCI PCI + 1 0 Close PCI PCI + 1 0 Lock PCI PCI + 1 0 Protect PCI PCI + 1 0 Open DRAM DRAM + 1 1 Open DRAM DRAM + 1 1 Protect DRAM DRAM + 1 1 Close DRAM PCI + 1 1 Lock DRAM PCI Write cycles: - SMWEN SMM Mode Data - 0 X X PCI - 1 0 Close PCI - 1 0 Lock PCI - 1 0 Protect PCI - 1 0 Open DRAM - 1 1 Open DRAM - 1 1 Protect DRAM - 1 1 Close PCI - 1 1 Lock PCI + SMWEN SMM Mode Data + 0 X X PCI + 1 0 Close PCI + 1 0 Lock PCI + 1 0 Protect PCI + 1 0 Open DRAM + 1 1 Open DRAM + 1 1 Protect DRAM + 1 1 Close PCI + 1 1 Lock PCI Explanation of the modes based above: If SM*EN = 0, SMRAM is entirely disabled, otherwise: diff --git a/src/chipset/headland.c b/src/chipset/headland.c index 5589af87a..c1881bede 100644 --- a/src/chipset/headland.c +++ b/src/chipset/headland.c @@ -255,7 +255,7 @@ memmap_state_update(headland_t *dev) mem_mapping_set_exec(&dev->high_mapping, ram + 0x100000); } } else { - /* 1 MB - 1 MB + 384k: RAM pointing to A0000-FFFFF + /* 1 MB - 1 MB + 384k: RAM pointing to A0000-FFFFF 1 MB + 384k: Any ram pointing 1 MB onwards. */ /* First, do the addresses above 1 MB. */ mem_mapping_set_addr(&dev->mid_mapping, 0x100000, mem_size > 1024 ? 0x60000 : (mem_size - 640) << 10); diff --git a/src/chipset/intel_piix.c b/src/chipset/intel_piix.c index dcf125979..180940e26 100644 --- a/src/chipset/intel_piix.c +++ b/src/chipset/intel_piix.c @@ -1023,9 +1023,9 @@ piix_write(int func, int addr, uint8_t val, void *priv) fregs[0x07] &= 0xf7; break; #if 0 - case 0x3c: - fregs[0x3c] = val; - break; + case 0x3c: + fregs[0x3c] = val; + break; #endif case 0x40: fregs[0x40] = (val & 0xc0) | 1; @@ -1657,9 +1657,9 @@ static void /* Bit 5: 0 = CMOS Setup disabled, 1 = CMOS Setup enabled. */ /* Bit 4: External CPU clock (Switch 8). */ /* Bit 3: External CPU clock (Switch 7). */ - /* 50 MHz: Switch 7 = Off, Switch 8 = Off. */ - /* 60 MHz: Switch 7 = On, Switch 8 = Off. */ - /* 66 MHz: Switch 7 = Off, Switch 8 = On. */ + /* 50 MHz: Switch 7 = Off, Switch 8 = Off. */ + /* 60 MHz: Switch 7 = On, Switch 8 = Off. */ + /* 66 MHz: Switch 7 = Off, Switch 8 = On. */ /* Bit 2: 0 = On-board audio absent, 1 = On-board audio present. */ /* Bit 1: 0 = Soft-off capable power supply present, 1 = Soft-off capable power supply absent. */ /* Bit 0: 0 = 1.5x multiplier, 1 = 2x multiplier (Switch 6). */ diff --git a/src/cpu/386.c b/src/cpu/386.c index ecf426270..421a978bd 100644 --- a/src/cpu/386.c +++ b/src/cpu/386.c @@ -196,13 +196,13 @@ exec386(int cycs) } } else if (trap) { flags_rebuild(); - trap = 0; + trap = 0; #ifndef USE_NEW_DYNAREC - oldcs = CS; + oldcs = CS; #endif - cpu_state.oldpc = cpu_state.pc; - dr[6] |= 0x4000; - x86_int(1); + cpu_state.oldpc = cpu_state.pc; + dr[6] |= 0x4000; + x86_int(1); } if (smi_line) diff --git a/src/cpu/8080.c b/src/cpu/8080.c index 642bd03cf..afea3625c 100644 --- a/src/cpu/8080.c +++ b/src/cpu/8080.c @@ -45,9 +45,9 @@ clock_end(void) int diff = cycdiff - cycles; /* On 808x systems, clock speed is usually crystal frequency divided by an integer. */ - tsc += (uint64_t)diff * ((uint64_t)xt_cpu_multi >> 32ULL); /* Shift xt_cpu_multi by 32 bits to the right and then multiply. */ + tsc += (uint64_t)diff * ((uint64_t)xt_cpu_multi >> 32ULL); /* Shift xt_cpu_multi by 32 bits to the right and then multiply. */ if (TIMER_VAL_LESS_THAN_VAL(timer_target, (uint32_t)tsc)) - timer_process(); + timer_process(); } static void @@ -55,8 +55,8 @@ i8080_wait(int c, int bus) { cycles -= c; if (bus < 2) { - clock_end(); - clock_start(); + clock_end(); + clock_start(); } } diff --git a/src/cpu/fpu.c b/src/cpu/fpu.c index c7a446ee9..d41a58508 100644 --- a/src/cpu/fpu.c +++ b/src/cpu/fpu.c @@ -36,9 +36,9 @@ fpu_log(const char *fmt, ...) va_list ap; if (fpu_do_log) { - va_start(ap, fmt); - pclog_ex(fmt, ap); - va_end(ap); + va_start(ap, fmt); + pclog_ex(fmt, ap); + va_end(ap); } } #else @@ -55,9 +55,9 @@ fpu_get_type(const cpu_family_t *cpu_family, int cpu, const char *internal_name) int c = 0; while (fpus[c].internal_name) { - if (!strcmp(internal_name, fpus[c].internal_name)) - fpu_type = fpus[c].type; - c++; + if (!strcmp(internal_name, fpus[c].internal_name)) + fpu_type = fpus[c].type; + c++; } return fpu_type; @@ -72,9 +72,9 @@ fpu_get_internal_name(const cpu_family_t *cpu_family, int cpu, int type) int c = 0; while (fpus[c].internal_name) { - if (fpus[c].type == type) - return fpus[c].internal_name; - c++; + if (fpus[c].type == type) + return fpus[c].internal_name; + c++; } return fpus[0].internal_name; diff --git a/src/cpu/x86_ops_msr.h b/src/cpu/x86_ops_msr.h index 6624218e4..cdf9d8612 100644 --- a/src/cpu/x86_ops_msr.h +++ b/src/cpu/x86_ops_msr.h @@ -15,8 +15,8 @@ static int opRDTSC(uint32_t fetchdat) EDX = tsc >> 32; CLOCK_CYCLES(1); #ifdef USE_DYNAREC - if (cpu_use_dynarec) - update_tsc(); + if (cpu_use_dynarec) + update_tsc(); #endif return 0; } diff --git a/src/device/keyboard.c b/src/device/keyboard.c index f84682940..a5503cc3b 100644 --- a/src/device/keyboard.c +++ b/src/device/keyboard.c @@ -34,7 +34,7 @@ void (*keyboard_send)(uint16_t val); static int recv_key[512]; /* keyboard input buffer */ static int oldkey[512]; #if 0 -static int keydelay[512]; +static int keydelay[512]; #endif static scancode *scan_table; /* scancode table for keyboard */ diff --git a/src/device/serial.c b/src/device/serial.c index ede197584..efb3cca4a 100644 --- a/src/device/serial.c +++ b/src/device/serial.c @@ -52,6 +52,7 @@ static int next_inst = 0; static serial_device_t serial_devices[SERIAL_MAX]; //#define ENABLE_SERIAL_CONSOLE 1 + #ifdef ENABLE_SERIAL_LOG int serial_do_log = ENABLE_SERIAL_LOG; diff --git a/src/disk/hdd_table.c b/src/disk/hdd_table.c index 29f7c5f20..f3f1ee2d1 100644 --- a/src/disk/hdd_table.c +++ b/src/disk/hdd_table.c @@ -27,7 +27,7 @@ unsigned int hdd_table[128][3] = { // clang-format off - { 306, 4, 17 }, /* 0 - 7 */ + { 306, 4, 17 }, /* 0 - 7 */ { 615, 2, 17 }, { 306, 4, 26 }, { 1024, 2, 17 }, @@ -36,7 +36,7 @@ unsigned int hdd_table[128][3] = { { 614, 4, 17 }, { 615, 4, 17 }, - { 670, 4, 17 }, /* 8 - 15 */ + { 670, 4, 17 }, /* 8 - 15 */ { 697, 4, 17 }, { 987, 3, 17 }, { 820, 4, 17 }, @@ -45,7 +45,7 @@ unsigned int hdd_table[128][3] = { { 733, 5, 17 }, { 615, 6, 17 }, - { 462, 8, 17 }, /* 016-023 */ + { 462, 8, 17 }, /* 016-023 */ { 306, 8, 26 }, { 615, 4, 26 }, { 1024, 4, 17 }, @@ -54,7 +54,7 @@ unsigned int hdd_table[128][3] = { { 932, 5, 17 }, { 1024, 2, 40 }, - { 809, 6, 17 }, /* 024-031 */ + { 809, 6, 17 }, /* 024-031 */ { 976, 5, 17 }, { 977, 5, 17 }, { 698, 7, 17 }, @@ -63,7 +63,7 @@ unsigned int hdd_table[128][3] = { { 615, 8, 17 }, { 989, 5, 17 }, - { 820, 4, 26 }, /* 032-039 */ + { 820, 4, 26 }, /* 032-039 */ { 1024, 5, 17 }, { 733, 7, 17 }, { 754, 7, 17 }, @@ -72,7 +72,7 @@ unsigned int hdd_table[128][3] = { { 615, 6, 26 }, { 462, 8, 26 }, - { 830, 7, 17 }, /* 040-047 */ + { 830, 7, 17 }, /* 040-047 */ { 855, 7, 17 }, { 751, 8, 17 }, { 1024, 4, 26 }, @@ -81,7 +81,7 @@ unsigned int hdd_table[128][3] = { { 855, 5, 26 }, { 977, 7, 17 }, - { 987, 7, 17 }, /* 048-055 */ + { 987, 7, 17 }, /* 048-055 */ { 1024, 7, 17 }, { 823, 4, 38 }, { 925, 8, 17 }, @@ -90,7 +90,7 @@ unsigned int hdd_table[128][3] = { { 977, 5, 26 }, { 698, 7, 26 }, - { 699, 7, 26 }, /* 056-063 */ + { 699, 7, 26 }, /* 056-063 */ { 940, 8, 17 }, { 615, 8, 26 }, { 1024, 5, 26 }, @@ -99,7 +99,7 @@ unsigned int hdd_table[128][3] = { { 823, 10, 17 }, { 754, 11, 17 }, - { 830, 10, 17 }, /* 064-071 */ + { 830, 10, 17 }, /* 064-071 */ { 925, 9, 17 }, { 1224, 7, 17 }, { 940, 6, 26 }, @@ -108,7 +108,7 @@ unsigned int hdd_table[128][3] = { { 1024, 9, 17 }, { 965, 10, 17 }, - { 969, 5, 34 }, /* 072-079 */ + { 969, 5, 34 }, /* 072-079 */ { 980, 10, 17 }, { 960, 5, 35 }, { 918, 11, 17 }, @@ -117,7 +117,7 @@ unsigned int hdd_table[128][3] = { { 1024, 7, 26 }, { 1024, 11, 17 }, - { 940, 8, 26 }, /* 080-087 */ + { 940, 8, 26 }, /* 080-087 */ { 776, 8, 33 }, { 755, 16, 17 }, { 1024, 12, 17 }, @@ -126,7 +126,7 @@ unsigned int hdd_table[128][3] = { { 830, 10, 26 }, { 925, 9, 26 }, - { 960, 9, 26 }, /* 088-095 */ + { 960, 9, 26 }, /* 088-095 */ { 1024, 13, 17 }, { 1224, 11, 17 }, { 900, 15, 17 }, @@ -135,7 +135,7 @@ unsigned int hdd_table[128][3] = { { 918, 15, 17 }, { 1524, 4, 39 }, - { 1024, 9, 26 }, /* 096-103 */ + { 1024, 9, 26 }, /* 096-103 */ { 1024, 14, 17 }, { 965, 10, 26 }, { 980, 10, 26 }, @@ -144,7 +144,7 @@ unsigned int hdd_table[128][3] = { { 1024, 15, 17 }, { 1024, 16, 17 }, - { 1224, 15, 17 }, /* 104-111 */ + { 1224, 15, 17 }, /* 104-111 */ { 755, 16, 26 }, { 903, 8, 46 }, { 984, 10, 34 }, @@ -153,7 +153,7 @@ unsigned int hdd_table[128][3] = { { 1023, 15, 26 }, { 684, 16, 38 }, - { 1930, 4, 62 }, /* 112-119 */ + { 1930, 4, 62 }, /* 112-119 */ { 967, 16, 31 }, { 1013, 10, 63 }, { 1218, 15, 36 }, @@ -162,7 +162,7 @@ unsigned int hdd_table[128][3] = { { 702, 16, 63 }, { 1002, 13, 63 }, - { 854, 16, 63 }, /* 119-127 */ + { 854, 16, 63 }, /* 119-127 */ { 987, 16, 63 }, { 995, 16, 63 }, { 1024, 16, 63 }, diff --git a/src/include_make/86box/version.h b/src/include_make/86box/version.h index 6f3da5e2c..78a6dc2f1 100644 --- a/src/include_make/86box/version.h +++ b/src/include_make/86box/version.h @@ -19,31 +19,31 @@ #define LSTR(s) _LSTR(s) /* Version info. */ -#define EMU_NAME "86Box" -#define EMU_NAME_W LSTR(EMU_NAME) +#define EMU_NAME "86Box" +#define EMU_NAME_W LSTR(EMU_NAME) -#define EMU_VERSION "3.8" -#define EMU_VERSION_W LSTR(EMU_VERSION) -#define EMU_VERSION_EX "3.50" /* frozen due to IDE re-detection behavior on Windows */ -#define EMU_VERSION_MAJ 3 -#define EMU_VERSION_MIN 8 +#define EMU_VERSION "3.8" +#define EMU_VERSION_W LSTR(EMU_VERSION) +#define EMU_VERSION_EX "3.50" /* frozen due to IDE re-detection behavior on Windows */ +#define EMU_VERSION_MAJ 3 +#define EMU_VERSION_MIN 8 #define EMU_VERSION_PATCH 0 -#define EMU_BUILD_NUM 0 +#define EMU_BUILD_NUM 0 -#define EMU_VERSION_FULL EMU_VERSION -#define EMU_VERSION_FULL_W EMU_VERSION_W +#define EMU_VERSION_FULL EMU_VERSION +#define EMU_VERSION_FULL_W EMU_VERSION_W -#define COPYRIGHT_YEAR "2022" +#define COPYRIGHT_YEAR "2022" /* Web URL info. */ -#define EMU_SITE "86box.net" -#define EMU_SITE_W LSTR(EMU_SITE) -#define EMU_ROMS_URL "https://github.com/86Box/roms/releases/latest" -#define EMU_ROMS_URL_W LSTR(EMU_ROMS_URL) +#define EMU_SITE "86box.net" +#define EMU_SITE_W LSTR(EMU_SITE) +#define EMU_ROMS_URL "https://github.com/86Box/roms/releases/latest" +#define EMU_ROMS_URL_W LSTR(EMU_ROMS_URL) #ifdef RELEASE_BUILD -# define EMU_DOCS_URL "https://86box.readthedocs.io/en/v3.8/" +# define EMU_DOCS_URL "https://86box.readthedocs.io/en/v3.8/" #else -# define EMU_DOCS_URL "https://86box.readthedocs.io" +# define EMU_DOCS_URL "https://86box.readthedocs.io" #endif -#define EMU_DOCS_URL_W LSTR(EMU_DOCS_URL) +#define EMU_DOCS_URL_W LSTR(EMU_DOCS_URL) diff --git a/src/lpt.c b/src/lpt.c index 269546c5d..22b9ba30a 100644 --- a/src/lpt.c +++ b/src/lpt.c @@ -40,7 +40,7 @@ static const struct { {"dot_matrix", &lpt_prt_escp_device }, {"postscript", &lpt_prt_ps_device }, {"plip", &lpt_plip_device }, - {"dongle_savquest", &lpt_hasp_savquest_device }, + {"dongle_savquest", &lpt_hasp_savquest_device }, {"", NULL } // clang-format on }; diff --git a/src/random.c b/src/random.c index 49204b656..18c52ef02 100644 --- a/src/random.c +++ b/src/random.c @@ -54,9 +54,9 @@ rdtsc(void) unsigned hi, lo; # ifdef _MSC_VER __asm { - rdtsc - mov hi, edx ; EDX:EAX is already standard return!! - mov lo, eax + rdtsc + mov hi, edx ; EDX:EAX is already standard return!! + mov lo, eax } # else __asm__ __volatile__("rdtsc" diff --git a/src/video/vid_table.c b/src/video/vid_table.c index b6b55f56f..ed92ad2f0 100644 --- a/src/video/vid_table.c +++ b/src/video/vid_table.c @@ -73,9 +73,9 @@ static const device_t vid_internal_device = { .config = NULL }; -// clang-format off static const VIDEO_CARD video_cards[] = { +// clang-format off { &vid_none_device }, { &vid_internal_device }, { &atiega_device }, @@ -261,8 +261,8 @@ video_cards[] = { { &voodoo_3_3500_se_agp_device }, { &voodoo_3_3500_si_agp_device }, { NULL } -}; // clang-format on +}; #ifdef ENABLE_VID_TABLE_LOG int vid_table_do_log = ENABLE_VID_TABLE_LOG; diff --git a/src/vnc.c b/src/vnc.c index 3dde2ca2d..3bffdcd9d 100644 --- a/src/vnc.c +++ b/src/vnc.c @@ -192,12 +192,12 @@ vnc_init(UNUSED(void *arg)) rfbPixelFormat rpf = { /* * Screen format: - * 32bpp; 32 depth; - * little endian; - * true color; - * max 255 R/G/B; - * red shift 16; green shift 8; blue shift 0; - * padding + * 32bpp; 32 depth; + * little endian; + * true color; + * max 255 R/G/B; + * red shift 16; green shift 8; blue shift 0; + * padding */ 32, 32, 0, 1, 255, 255, 255, 16, 8, 0, 0, 0 }; diff --git a/src/win/win_dynld.c b/src/win/win_dynld.c index de0c32ef7..187a2b2aa 100644 --- a/src/win/win_dynld.c +++ b/src/win/win_dynld.c @@ -36,9 +36,9 @@ dynld_log(const char *fmt, ...) va_list ap; if (dynld_do_log) { - va_start(ap, fmt); - pclog_ex(fmt, ap); - va_end(ap); + va_start(ap, fmt); + pclog_ex(fmt, ap); + va_end(ap); } } #else @@ -55,22 +55,22 @@ dynld_module(const char *name, dllimp_t *table) /* See if we can load the desired module. */ if ((h = LoadLibrary(name)) == NULL) { - dynld_log("DynLd(\"%s\"): library not found! (%08X)\n", name, GetLastError()); - return(NULL); + dynld_log("DynLd(\"%s\"): library not found! (%08X)\n", name, GetLastError()); + return(NULL); } /* Now load the desired function pointers. */ for (imp=table; imp->name!=NULL; imp++) { - func = GetProcAddress(h, imp->name); - if (func == NULL) { - dynld_log("DynLd(\"%s\"): function '%s' not found! (%08X)\n", - name, imp->name, GetLastError()); - FreeLibrary(h); - return(NULL); - } + func = GetProcAddress(h, imp->name); + if (func == NULL) { + dynld_log("DynLd(\"%s\"): function '%s' not found! (%08X)\n", + name, imp->name, GetLastError()); + FreeLibrary(h); + return(NULL); + } - /* To overcome typing issues.. */ - *(char **)imp->func = (char *)func; + /* To overcome typing issues.. */ + *(char **)imp->func = (char *)func; } /* All good. */ @@ -83,5 +83,5 @@ void dynld_close(void *handle) { if (handle != NULL) - FreeLibrary((HMODULE)handle); + FreeLibrary((HMODULE)handle); }