Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] Diff of /branches/pure-cfg/src/lib/common/image.c
ViewVC logotype

Diff of /branches/pure-cfg/src/lib/common/image.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1230, Mon May 16 06:08:14 2011 UTC revision 1231, Mon May 16 13:49:17 2011 UTC
# Line 485  Line 485 
485      *imgOut = img;      *imgOut = img;
486      return DIDEROT_OK;      return DIDEROT_OK;
487  }  }
   
 /* functions to get input-parameter values */  
 Status_t Diderot_InputString (const char *name, const char **v, bool hasDflt)  
 {  
     return DIDEROT_FAIL;  
 }  
   
 Status_t Diderot_InputReal (const char *name, Diderot_real_t *v, bool hasDflt)  
 {  
     char        buf[256];  
     double      f;  
   
     while (true) {  
         if (hasDflt)  
             printf("Enter value for %s (default %lf): ", name, (double)*v);  
         else  
             printf("Enter value for %s: ", name);  
         fflush (stdout);  
   
         char *p = fgets(buf, sizeof(buf), stdin);  
         if (p == NULL)  
             return DIDEROT_FAIL;        // EOF  
         int n = sscanf(buf, "%lf\n", &f);  
         if (n == 1) {  
             *v = (Diderot_real_t)f;  
             return DIDEROT_OK;;  
         }  
         else if (hasDflt)  
             return DIDEROT_OK;;  
     }  
   
 }  
   
 Status_t Diderot_InputVec3 (const char *name, Diderot_vec3_t *v, bool hasDflt)  
 {  
     char        buf[256];  
     double      f1, f2, f3;  
   
     while (true) {  
         if (hasDflt) {  
             Diderot_union3_t u;  
             u.v = *v;  
             printf("Enter value for %s (default %f %f %f): ",  
                 name, (double)(u.r[0]), (double)(u.r[1]), (double)(u.r[2]));  
         }  
         else  
             printf("Enter value for %s: ", name);  
         fflush (stdout);  
   
         char *p = fgets(buf, sizeof(buf), stdin);  
         if (p == NULL)  
             return DIDEROT_FAIL;        // EOF  
         int n = sscanf(buf, "%lf %lf %lf\n", &f1, &f2, &f3);  
         if (n == 3) {  
             *v = vec3((Diderot_real_t)f1, (Diderot_real_t)f2, (Diderot_real_t)f3);  
             return DIDEROT_OK;;  
         }  
         else if (hasDflt)  
             return DIDEROT_OK;;  
     }  
   
 }  

Legend:
Removed from v.1230  
changed lines
  Added in v.1231

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0