From f7e6b237f56f1ef8905af76971aac54c6340636e Mon Sep 17 00:00:00 2001 From: dwarning Date: Wed, 6 Nov 2024 15:02:10 +0100 Subject: [PATCH] format - white spaces --- src/frontend/resource.c | 2 +- src/misc/misc_time.c | 10 +-- src/sharedspice.c | 158 ++++++++++++++++++++-------------------- src/winmain.c | 8 +- 4 files changed, 89 insertions(+), 89 deletions(-) diff --git a/src/frontend/resource.c b/src/frontend/resource.c index baa347f4f..13eaa1ad3 100644 --- a/src/frontend/resource.c +++ b/src/frontend/resource.c @@ -261,7 +261,7 @@ printres(char *name) // fprintf(cp_out, "Resident set size = "); // fprintmem(cp_out, mem_ng_act.resident); // fprintf(cp_out, ".\n"); - fprintf(cp_out, "\n"); + fprintf(cp_out, "\n"); fprintf(cp_out, "Shared ngspice pages = "); fprintmem(cp_out, mem_ng_act.shared); fprintf(cp_out, ".\n"); diff --git a/src/misc/misc_time.c b/src/misc/misc_time.c index 61e037e88..f066b3f65 100644 --- a/src/misc/misc_time.c +++ b/src/misc/misc_time.c @@ -23,7 +23,7 @@ Copyright 1990 Regents of the University of California. All rights reserved. #include #ifndef HAVE_GETTIMEOFDAY #include -#include // portable: uint64_t MSVC: __int64 +#include // portable: uint64_t MSVC: __int64 /*/ MSVC defines this in winsock2.h!? typedef struct timeval { @@ -36,7 +36,7 @@ int gettimeofday(struct timeval * tp, void * unused) NG_IGNORE(unused); // Note: some broken versions only have 8 trailing zero's, the correct epoch has 9 trailing zero's // This magic number is the number of 100 nanosecond intervals since January 1, 1601 (UTC) - // until 00:00:00 January 1, 1970 + // until 00:00:00 January 1, 1970 static const uint64_t EPOCH = ((uint64_t) 116444736000000000ULL); SYSTEMTIME system_time; @@ -108,9 +108,9 @@ void timediff(PerfTime *now, PerfTime *begin, int *sec, int *msec) } -/* - * How many seconds have elapsed in running time. - * This is the routine called in IFseconds +/* + * How many seconds have elapsed in running time. + * This is the routine called in IFseconds */ double diff --git a/src/sharedspice.c b/src/sharedspice.c index 117512cb4..db278981d 100644 --- a/src/sharedspice.c +++ b/src/sharedspice.c @@ -976,7 +976,7 @@ ngSpice_Init(SendChar* printfcn, SendStat* statusfcn, ControlledExit* ngspiceexi #else /* ~ HAVE_PWD_H */ /* load user's initialisation file try accessing the initialisation file .spiceinit in a user provided - path read from environmental variable SPICE_USERINIT_DIR, + path read from environmental variable SPICE_USERINIT_DIR, if that fails try the alternate name spice.rc, then look into the current directory, then the HOME directory, then into USERPROFILE. Don't read .spiceinit, if ngSpice_nospiceinit() has been called. */ @@ -1913,7 +1913,7 @@ void SetAnalyse( || defined (HAVE_FTIME) PerfTime timenow; /* actual time stamp */ int diffsec, diffmillisec; /* differences actual minus prev. time stamp */ - int result; /* return value from callback function */ + int result; /* return value from callback function */ char* s; /* outputs to callback function */ int OldPercent; /* Previous progress value */ char OldAn[128]; /* Previous analysis type */ @@ -1961,67 +1961,67 @@ void SetAnalyse( else return; - CKTcircuit *ckt = NULL; + CKTcircuit *ckt = NULL; - if (ft_curckt) - ckt = ft_curckt->ci_ckt; + if (ft_curckt) + ckt = ft_curckt->ci_ckt; - if ((DecaPercent == OldPercent) && !strcmp(OldAn, Analyse)) - return; + if ((DecaPercent == OldPercent) && !strcmp(OldAn, Analyse)) + return; - /* get current time */ - perf_timer_get_time(&timenow); - diffsec = timenow.seconds; - diffmillisec = timenow.milliseconds; + /* get current time */ + perf_timer_get_time(&timenow); + diffsec = timenow.seconds; + diffmillisec = timenow.milliseconds; - s = TMALLOC(char, 128); + s = TMALLOC(char, 128); - if (!strcmp(Analyse, "tran")) { - if (ckt && (ckt->CKTtime > ckt->CKTfinalTime - ckt->CKTmaxStep)) { - sprintf(s, "--ready--"); - result = statfcn(s, ng_ident, userptr); - tfree(s); - return; - } - } - - if (DecaPercent >= 1000){ - /* Because CKTmaxStep may be smaller than 0.1%, we print only when CKTtime is large enough. */ - if (!strcmp(Analyse, "tran") && ckt && (ckt->CKTtime < ckt->CKTfinalTime - ckt->CKTmaxStep)) { + if (!strcmp(Analyse, "tran")) { + if (ckt && (ckt->CKTtime > ckt->CKTfinalTime - ckt->CKTmaxStep)) { + sprintf(s, "--ready--"); + result = statfcn(s, ng_ident, userptr); tfree(s); return; + } + } + + if (DecaPercent >= 1000){ + /* Because CKTmaxStep may be smaller than 0.1%, we print only when CKTtime is large enough. */ + if (!strcmp(Analyse, "tran") && ckt && (ckt->CKTtime < ckt->CKTfinalTime - ckt->CKTmaxStep)) { + tfree(s); + return; + } + sprintf( s, "--ready--"); + result = statfcn(s, ng_ident, userptr); + tfree(s); + return; + } + /* info every one percent of progress: + actual time, progress, + to catch linearity of progress of simulation */ + if (ft_ngdebug && !strcmp(Analyse, "tran")) + if ((int)((double)DecaPercent/10.) > (int)((double)OldPercent/10.)) { + printf("%3.1f%% percent progress after %4.2f seconds.\n", (double)DecaPercent/10., seconds()); } - sprintf( s, "--ready--"); - result = statfcn(s, ng_ident, userptr); - tfree(s); - return; - } - /* info every one percent of progress: - actual time, progress, - to catch linearity of progress of simulation */ - if (ft_ngdebug && !strcmp(Analyse, "tran")) - if ((int)((double)DecaPercent/10.) > (int)((double)OldPercent/10.)) { - printf("%3.1f%% percent progress after %4.2f seconds.\n", (double)DecaPercent/10., seconds()); - } - if(thread1) - OldPercent1 = DecaPercent; - else - OldPercent2 = DecaPercent; - /* output only into hwAnalyse window and if time elapsed is larger than - DELTATIME given value, or if analysis has changed, else return */ - if ((diffsec > 0) || (diffmillisec > DELTATIME) || strcmp(OldAn, Analyse)) { + if(thread1) + OldPercent1 = DecaPercent; + else + OldPercent2 = DecaPercent; + /* output only into hwAnalyse window and if time elapsed is larger than + DELTATIME given value, or if analysis has changed, else return */ + if ((diffsec > 0) || (diffmillisec > DELTATIME) || strcmp(OldAn, Analyse)) { if (DecaPercent < 0) { sprintf( s, "--ready--"); } - else if (DecaPercent == 0) { - sprintf( s, "%s", Analyse); - } - else if (!strcmp(Analyse, "shooting")) { - sprintf( s, "%s: %d", Analyse, DecaPercent); - } - else { - sprintf( s, "%s: %3.1f%%", Analyse, (double)DecaPercent/10.); - } + else if (DecaPercent == 0) { + sprintf( s, "%s", Analyse); + } + else if (!strcmp(Analyse, "shooting")) { + sprintf( s, "%s: %d", Analyse, DecaPercent); + } + else { + sprintf( s, "%s: %3.1f%%", Analyse, (double)DecaPercent/10.); + } if (thread1) { timebefore1.milliseconds = timenow.milliseconds; timebefore1.seconds = timenow.seconds; @@ -2030,34 +2030,34 @@ void SetAnalyse( timebefore2.milliseconds = timenow.milliseconds; timebefore2.seconds = timenow.seconds; } - /* info when previous analysis period has finished */ - if (strcmp(OldAn, Analyse)) { - if ((ft_nginfo || ft_ngdebug) && (strcmp(OldAn, ""))) - printf("%s finished after %5.3f seconds.\n", OldAn, seconds()); - if(thread1) - strncpy(OldAn1, Analyse, 127); - else - strncpy(OldAn2, Analyse, 127); - } - /* ouput only after a change */ - if (strcmp(olds, s)) - result = statfcn(s, ng_ident, userptr); - if(thread1) - strcpy(olds1, s); - else - strcpy(olds2, s); - } - tfree(s); + /* info when previous analysis period has finished */ + if (strcmp(OldAn, Analyse)) { + if ((ft_nginfo || ft_ngdebug) && (strcmp(OldAn, ""))) + printf("%s finished after %5.3f seconds.\n", OldAn, seconds()); + if(thread1) + strncpy(OldAn1, Analyse, 127); + else + strncpy(OldAn2, Analyse, 127); + } + /* ouput only after a change */ + if (strcmp(olds, s)) + result = statfcn(s, ng_ident, userptr); + if(thread1) + strcpy(olds1, s); + else + strcpy(olds2, s); + } + tfree(s); #else - char* s; - int result; - static bool havesent = FALSE; - if (!havesent) { - s = copy("No usage info available"); - result = statfcn(s, ng_ident, userptr); - tfree(s); - havesent = TRUE; - } + char* s; + int result; + static bool havesent = FALSE; + if (!havesent) { + s = copy("No usage info available"); + result = statfcn(s, ng_ident, userptr); + tfree(s); + havesent = TRUE; + } #endif } diff --git a/src/winmain.c b/src/winmain.c index c4144c487..b9388c9b6 100644 --- a/src/winmain.c +++ b/src/winmain.c @@ -202,7 +202,7 @@ SetSource(char *Name) tfree(NameW); #endif InvalidateRgn(hwSource, NULL, TRUE); - } + } } @@ -1192,7 +1192,7 @@ wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ LPWSTR } #else { - HDC textDC; + HDC textDC; TEXTMETRICW tm; tfont = CreateFontW(15, 0, 0, 0, FW_MEDIUM, FALSE, FALSE, FALSE, ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, @@ -1240,7 +1240,7 @@ wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ LPWSTR LineHeight = tm.tmHeight + tm.tmExternalLeading + BorderSize; ReleaseDC(swString, stringDC); } - } + } #else swString = CreateWindowExW(WS_EX_NOPARENTNOTIFY, swClassNameW, swWindowNameW, ES_LEFT | WS_CHILD | WS_BORDER | @@ -1258,7 +1258,7 @@ wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ LPWSTR LineHeight = tm.tmHeight + tm.tmExternalLeading + BorderSize; ReleaseDC(swString, stringDC); } - } + } #endif /* Element windows */