r11859: Canonicalize whitespace
[ctsim.git] / tools / ctsimtext.cpp
index be55b6ac8bcb36401cf29cb34d94935eb78c91ea..a72edd75cbf6ec6ec6c2cbecca7ce65ca22f00c3 100644 (file)
@@ -67,7 +67,7 @@ static int processCommand (int argc, char* const argv[]);
 static void convertStringToArgcv (char* szLine, int* piArgc, char*** pppArgv);
 
 
 static void convertStringToArgcv (char* szLine, int* piArgc, char*** pppArgv);
 
 
-void 
+void
 ctsimtext_usage (const char *program)
 {
   std::cout << "usage: " << fileBasename(program) << " ctsim-function-name ctstim-function-parameters...\n";
 ctsimtext_usage (const char *program)
 {
   std::cout << "usage: " << fileBasename(program) << " ctsim-function-name ctstim-function-parameters...\n";
@@ -86,11 +86,11 @@ ctsimtext_usage (const char *program)
   std::cout << "  phm2if        Convert a geometric phantom into an imagefile\n";
   std::cout << "  phm2pj        Take projections of a phantom object\n";
   std::cout << "  phm2helix     Take projections of a phantom object\n";
   std::cout << "  phm2if        Convert a geometric phantom into an imagefile\n";
   std::cout << "  phm2pj        Take projections of a phantom object\n";
   std::cout << "  phm2helix     Take projections of a phantom object\n";
-  std::cout << "  pjHinterp    Interpolate helical projections of a phantom object\n";
+  std::cout << "  pjHinterp     Interpolate helical projections of a phantom object\n";
   std::cout << "  linogram      Print linogram sampling\n";
 }
 
   std::cout << "  linogram      Print linogram sampling\n";
 }
 
-void 
+void
 interactive_usage ()
 {
   std::cout << "usage: function-name parameters...\n";
 interactive_usage ()
 {
   std::cout << "usage: function-name parameters...\n";
@@ -113,10 +113,10 @@ interactive_usage ()
 
 static bool s_bInteractive = false;
 
 
 static bool s_bInteractive = false;
 
-int 
+int
 ctsimtext_main (int argc, char * argv[])
 {
 ctsimtext_main (int argc, char * argv[])
 {
-  int iReturn = 0;  
+  int iReturn = 0;
 
   if (argc > 1 && (strcmp(s_szProgramName, fileBasename (argv[0])) == 0 || strcmp(s_szProgramName2, fileBasename (argv[0])) == 0 || strcmp(s_szProgramName3, fileBasename (argv[0])) == 0)) {
     argv++;
 
   if (argc > 1 && (strcmp(s_szProgramName, fileBasename (argv[0])) == 0 || strcmp(s_szProgramName2, fileBasename (argv[0])) == 0 || strcmp(s_szProgramName3, fileBasename (argv[0])) == 0)) {
     argv++;
@@ -132,7 +132,7 @@ ctsimtext_main (int argc, char * argv[])
     std::cout << ", Version " << VERSION;
 #endif
     std::cout << " (Type \"quit\" to end)\n\n";
     std::cout << ", Version " << VERSION;
 #endif
     std::cout << " (Type \"quit\" to end)\n\n";
-    
+
     while (1) {
 #ifdef HAVE_READLINE
       char* pszInputLine = readline (szPrompt);
     while (1) {
 #ifdef HAVE_READLINE
       char* pszInputLine = readline (szPrompt);
@@ -140,36 +140,36 @@ ctsimtext_main (int argc, char * argv[])
         break;
       if (*pszInputLine != EOS)
         add_history (pszInputLine);
         break;
       if (*pszInputLine != EOS)
         add_history (pszInputLine);
-      
+
 #else  // DONT_HAVE_READLINE
 #else  // DONT_HAVE_READLINE
-      
+
       static const int s_MaxLineLength = 1024;
       char* pszInputLine = new char [s_MaxLineLength+1];
       std::cout << szPrompt;
       std::cin.getline (pszInputLine, s_MaxLineLength);
       static const int s_MaxLineLength = 1024;
       char* pszInputLine = new char [s_MaxLineLength+1];
       std::cout << szPrompt;
       std::cin.getline (pszInputLine, s_MaxLineLength);
-      
+
 #ifdef DEBUG
       std::cout << "#" << pszInputLine << "#\n";
 #endif
 #ifdef DEBUG
       std::cout << "#" << pszInputLine << "#\n";
 #endif
-      
+
       std::cout << std::flush;
       std::cout << "\n";
 #endif  // DONT_HAVE_READLINE
       std::cout << std::flush;
       std::cout << "\n";
 #endif  // DONT_HAVE_READLINE
-      
-      if (strncasecmp (pszInputLine, "quit", 4) == 0) 
+
+      if (strncasecmp (pszInputLine, "quit", 4) == 0)
         break;
         break;
-      
+
       convertStringToArgcv (pszInputLine, &argc, &argv);
 #ifdef DEBUG
       for (int i = 0; i < argc; i++)
         std::cout << "Token " << i << ": " << argv[i] << "\n";
 #endif
       iReturn = processCommand (argc, argv);
       convertStringToArgcv (pszInputLine, &argc, &argv);
 #ifdef DEBUG
       for (int i = 0; i < argc; i++)
         std::cout << "Token " << i << ": " << argv[i] << "\n";
 #endif
       iReturn = processCommand (argc, argv);
-      
+
       delete pszInputLine;
     }
   }
       delete pszInputLine;
     }
   }
-  
+
   return iReturn;
 }
 
   return iReturn;
 }
 
@@ -179,12 +179,12 @@ convertStringToArgcv (char* pszLine, int* piArgc, char*** pppArgv)
   char* pCurrentPos = pszLine;
   int nTokens = 0;
   std::vector<char*> vecpszToken;
   char* pCurrentPos = pszLine;
   int nTokens = 0;
   std::vector<char*> vecpszToken;
-  
+
   // Process line
   bool bInDoubleQuote = false;
   bool bInSingleQuote = false;
   bool bInToken = false;
   // Process line
   bool bInDoubleQuote = false;
   bool bInSingleQuote = false;
   bool bInToken = false;
-  
+
   while (*pCurrentPos) {
     if (isspace (*pCurrentPos)) {
       if (! bInToken)
   while (*pCurrentPos) {
     if (isspace (*pCurrentPos)) {
       if (! bInToken)
@@ -225,10 +225,10 @@ convertStringToArgcv (char* pszLine, int* piArgc, char*** pppArgv)
       nTokens++;
       vecpszToken.push_back (pCurrentPos);
     }
       nTokens++;
       vecpszToken.push_back (pCurrentPos);
     }
-    
+
     pCurrentPos++;
   }
     pCurrentPos++;
   }
-  
+
   *piArgc = nTokens;
   if (nTokens > 0) {
     *pppArgv = new char* [nTokens];
   *piArgc = nTokens;
   if (nTokens > 0) {
     *pppArgv = new char* [nTokens];
@@ -238,15 +238,15 @@ convertStringToArgcv (char* pszLine, int* piArgc, char*** pppArgv)
     *pppArgv = NULL;
 }
 
     *pppArgv = NULL;
 }
 
-static int 
+static int
 processCommand (int argc, char* const argv[])
 {
   if (argc < 1)
     return 1;
 processCommand (int argc, char* const argv[])
 {
   if (argc < 1)
     return 1;
-  
+
   const char* const pszFunction = fileBasename (argv[0]);
 
   const char* const pszFunction = fileBasename (argv[0]);
 
-  try {  
+  try {
     if (strcasecmp (pszFunction, "if1") == 0)
       return if1_main (argc, argv);
     else if (strcasecmp (pszFunction, "if2") == 0)
     if (strcasecmp (pszFunction, "if1") == 0)
       return if1_main (argc, argv);
     else if (strcasecmp (pszFunction, "if2") == 0)
@@ -283,15 +283,15 @@ processCommand (int argc, char* const argv[])
     std::cerr << "Exception: " << e.what() << std::endl;
   } catch (...) {
     std::cerr << "Unknown exception caught\n";
     std::cerr << "Exception: " << e.what() << std::endl;
   } catch (...) {
     std::cerr << "Unknown exception caught\n";
-  }  
+  }
 
   return 1;
 }
 
 
   return 1;
 }
 
-int 
+int
 main (int argc, char* argv[])
 {
 main (int argc, char* argv[])
 {
-#if defined(HAVE_FFTW) && defined(HAVE_GETENV) 
+#if defined(HAVE_FFTW) && defined(HAVE_GETENV)
   const char* const pszHome = getenv("HOME");
   char* pszWisdom = NULL;
 
   const char* const pszHome = getenv("HOME");
   char* pszWisdom = NULL;
 
@@ -305,9 +305,9 @@ main (int argc, char* argv[])
     pszWisdom[nHome] = '/';
     strcpy(pszWisdom+nHome+1,szFileBase);
     pszWisdom[nHome+nBase+2] = 0;
     pszWisdom[nHome] = '/';
     strcpy(pszWisdom+nHome+1,szFileBase);
     pszWisdom[nHome+nBase+2] = 0;
-    
+
     FILE *wisdom = fopen(pszWisdom,"r");
     FILE *wisdom = fopen(pszWisdom,"r");
-    if (wisdom) { 
+    if (wisdom) {
       fftw_import_wisdom_from_file(wisdom);
       fclose(wisdom);
     }
       fftw_import_wisdom_from_file(wisdom);
       fclose(wisdom);
     }
@@ -315,8 +315,8 @@ main (int argc, char* argv[])
 #endif
 
   int retval = ctsimtext_main(argc, argv);
 #endif
 
   int retval = ctsimtext_main(argc, argv);
-  
-#if defined(HAVE_FFTW) && defined(HAVE_GETENV) 
+
+#if defined(HAVE_FFTW) && defined(HAVE_GETENV)
   if (pszWisdom) {
     FILE* wisdom = fopen(pszWisdom,"w+");
     if (wisdom) {
   if (pszWisdom) {
     FILE* wisdom = fopen(pszWisdom,"w+");
     if (wisdom) {
@@ -326,6 +326,6 @@ main (int argc, char* argv[])
     }
   }
 #endif
     }
   }
 #endif
-  
+
   return retval;
 }
   return retval;
 }