IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 12, 2007, 4:26:31 PM (19 years ago)
Author:
eugene
Message:

added module system; added panstarrs user features; panstarrs threaded

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/lib.shell/variable.c

    r8134 r11084  
    244244}
    245245
    246 double get_double_variable (char *name) {
    247  
    248   int i;
    249   char *local, *MacroName;
    250 
    251   MacroName = GetMacroName ();
    252 
    253   /* look for local variable first */
    254   ALLOCATE (local, char, strlen(name) + strlen(MacroName) + 2);
    255   sprintf (local, "%s.%s", MacroName, name);
    256   for (i = 0; i < Nvariables; i++) { /* find the variable mentioned */
    257     if (!strcmp(local, variables[i].name)) {
    258       free (local);
     246double get_double_variable (char *name, int *found) {
     247 
     248  int i;
     249  char *local, *MacroName;
     250
     251  MacroName = GetMacroName ();
     252
     253  /* look for local variable first */
     254  ALLOCATE (local, char, strlen(name) + strlen(MacroName) + 2);
     255  sprintf (local, "%s.%s", MacroName, name);
     256  for (i = 0; i < Nvariables; i++) { /* find the variable mentioned */
     257    if (!strcmp(local, variables[i].name)) {
     258      free (local);
     259      *found = TRUE;
    259260      return (atof (variables[i].value));
    260261    }
     
    265266  for (i = 0; i < Nvariables; i++) { /* find the variable mentioned */
    266267    if (!strcmp(name, variables[i].name)) {
     268      *found = TRUE;
    267269      return (atof (variables[i].value));
    268270    }
    269271  }
     272  *found = FALSE;
     273  return (0.0);
     274}
     275
     276int get_int_variable (char *name, int *found) {
     277 
     278  int i;
     279  char *local, *MacroName;
     280
     281  MacroName = GetMacroName ();
     282
     283  /* look for local variable first */
     284  ALLOCATE (local, char, strlen(name) + strlen(MacroName) + 2);
     285  sprintf (local, "%s.%s", MacroName, name);
     286  for (i = 0; i < Nvariables; i++) { /* find the variable mentioned */
     287    if (!strcmp(local, variables[i].name)) {
     288      *found = TRUE;
     289      free (local);
     290      return (atof (variables[i].value));
     291    }
     292  }
     293  free (local);
     294
     295  /* look for global variable */
     296  for (i = 0; i < Nvariables; i++) { /* find the variable mentioned */
     297    if (!strcmp(name, variables[i].name)) {
     298      *found = TRUE;
     299      return (atof (variables[i].value));
     300    }
     301  }
     302  *found = FALSE;
    270303  return (0.0);
    271304}
Note: See TracChangeset for help on using the changeset viewer.