View Single Post
Old 2015-01-03, 01:48   #1
Explorer09
 
May 2014

1000012 Posts
Default mprime messages line wrap problem (with patch)

This is a personal complaint rather than a bug. On my Linux system with an 80 character wide terminal:

Code:
[Main thread Dec 30 08:36] Starting workers.
[Worker #1 Dec 30 08:36] Worker starting
[Worker #1 Dec 30 08:36] Setting affinity to run worker on logical CPU #1
[Worker #2 Dec 30 08:36] Worker starting
[Worker #2 Dec 30 08:36] Setting affinity to run worker on logical CPU #2
[Worker #1 Dec 30 08:36] Beginning a continuous self-test to check your computer
.
[Worker #1 Dec 30 08:36] Please read stress.txt.  Hit ^C to end this test.
[Worker #2 Dec 30 08:36] Beginning a continuous self-test to check your computer
.
[Worker #2 Dec 30 08:36] Please read stress.txt.  Hit ^C to end this test.
[Worker #1 Dec 30 08:36] Test 1, 7800 Lucas-Lehmer iterations of M9961473 using 
Pentium4 type-2 FFT length 512K, Pass1=256, Pass2=2K.
[Worker #2 Dec 30 08:36] Test 1, 7800 Lucas-Lehmer iterations of M9961473 using 
Pentium4 type-2 FFT length 512K, Pass1=256, Pass2=2K.
See the period get wrapped to the next line and an entire line is wasted for this.
This wasn't a problem before mprime supports multithreading. After multithreading support, some messages that originally fit a line get wrapped strangely like this.

This is my way to solve it. Change the wording of some of the messages so that they fit one line. (It was a quick hack, and I think mprime developers can rewrite messages better than me.)
Code:
diff -r -u a/commonb.c b/commonb.c
--- a/commonb.c	2014-05-28 23:39:04.000000000 +0800
+++ b/commonb.c	2015-01-02 21:02:54.125341836 +0800
@@ -26,7 +26,7 @@
 char ERRMSG1D[] = "ERROR: Shift counter corrupt.\n";
 char ERRMSG1E[] = "ERROR: Illegal double encountered.\n";
 char ERRMSG1F[] = "ERROR: FFT data has been zeroed!\n";
-char ERRMSG2[] = "Possible hardware failure, consult the readme.txt file.\n";
+char ERRMSG2[] = "Possible hardware failure, consult readme.txt file.\n";
 char ERRMSG3[] = "Continuing from last save file.\n";
 char ERRMSG4[] = "Waiting five minutes before restarting.\n";
 char ERRMSG5[] = "For added safety, redoing iteration using a slower, more reliable method.\n";
@@ -550,7 +550,7 @@
 			if (diff == 99999) {
 				AFFINITY_SCRAMBLE_STATE = 0;
 			} else {
-				OutputStr (MAIN_THREAD_NUM, "Enough information obtained to make a reasonable guess.\n");
+				OutputStr (MAIN_THREAD_NUM, "Have enough information to make a reasonable guess.\n");
 			}
 		}
 		if (AFFINITY_SCRAMBLE_STATE == 0 && scramble[0] == '*') {
@@ -578,7 +578,7 @@
 
 no_auto_detect:
 	if (scramble[0] != '*') {
-		OutputStr (MAIN_THREAD_NUM, "Using AffinityScramble2 settings to set affinity mask.\n");
+		OutputStr (MAIN_THREAD_NUM, "Using AffinityScramble2 setting to set affinity mask.\n");
 		AFFINITY_SCRAMBLE_STATE = 2;
 		for (i = 0; i < MAX_NUM_WORKER_THREADS && i < strlen (scramble); i++) {
 			if (scramble[i] >= '0' && scramble[i] <= '9')
@@ -1063,7 +1063,7 @@
 	int	thread_num)
 {
 	if (WORKER_THREADS_ACTIVE && ! STOP_FOR_PRIORITY_WORK[thread_num]) {
-		OutputStr (thread_num, "Restarting worker to do factoring prior to an LL test.\n");
+		OutputStr (thread_num, "Restarting worker to do factoring prior to LL test.\n");
 		STOP_FOR_PRIORITY_WORK[thread_num] = 1;
 	}
 }
@@ -5870,15 +5870,14 @@
 /* Torture test code */
 /*********************/
 
-#define TORTURE1 "Beginning a continuous self-test to check your computer.\n"
+#define TORTURE1 "Beginning a continuous self-test on your computer.\n"
 #if defined (__linux__) || defined (__FreeBSD__) || defined (__EMX__)
 #define TORTURE2 "Please read stress.txt.  Hit ^C to end this test.\n"
 #else
 #define TORTURE2 "Please read stress.txt.  Choose Test/Stop to end this test.\n"
 #endif
-#define SELFMSG1A "The program will now perform a self-test to make sure the\n"
-#define SELFMSG1B "Lucas-Lehmer code is working properly on your computer.\n"
-#define SELFMSG1C "This will take about an hour.\n"
+#define SELFMSG1A "The program will now perform a self-test to make sure the Lucas-Lehmer code is working properly on your computer.\n"
+#define SELFMSG1B "This will take about an hour.\n"
 #define SELF1 "Test %i, %i Lucas-Lehmer iterations of M%ld using %s.\n"
 #define SELFFAIL "FATAL ERROR: Final result was %08lX, expected: %08lX.\n"
 char SELFFAIL1[] = "ERROR: ILLEGAL SUMOUT\n";
@@ -6835,7 +6834,6 @@
 
 	OutputStr (thread_num, SELFMSG1A);
 	OutputStr (thread_num, SELFMSG1B);
-	OutputStr (thread_num, SELFMSG1C);
 
 /* Do the self test */
By the way, the coding style of those message strings are terrible. Some of them are #define'd as macros, some of them are declared as char[] global variables (without const), and some non-trivial messages are inlined as arguments in OutputStr(). The serious inconsistency of the definition of the strings should be fixed some day.
Explorer09 is offline   Reply With Quote