/[ascend]/trunk/tcltk/generic/interface/Driver.c
ViewVC logotype

Diff of /trunk/tcltk/generic/interface/Driver.c

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

revision 1616 by jpye, Sun Aug 5 09:44:07 2007 UTC revision 1617 by jpye, Tue Sep 4 04:13:08 2007 UTC
# Line 453  int AscDriver(int argc, CONST char **arg Line 453  int AscDriver(int argc, CONST char **arg
453      variable.      variable.
454  */  */
455  #define OSPATH_PUTENV(VAR,FP) \  #define OSPATH_PUTENV(VAR,FP) \
456      CONSOLE_DEBUG("VAR: %s",VAR); \      /*CONSOLE_DEBUG("VAR: %s",VAR);*/ \
457      sprintf(envcmd,"%s=",VAR); \      sprintf(envcmd,"%s=",VAR); \
458      ospath_strcat(FP,envcmd,MAX_ENV_VAR_LENGTH); \      ospath_strcat(FP,envcmd,MAX_ENV_VAR_LENGTH); \
459      CONSOLE_DEBUG("ENVCMD: %s",envcmd); \      /*CONSOLE_DEBUG("ENVCMD: %s",envcmd);*/ \
460      PUTENV(envcmd)      PUTENV(envcmd)
461    
462  /**  /**
# Line 527  static void AscCheckEnvironVars(Tcl_Inte Line 527  static void AscCheckEnvironVars(Tcl_Inte
527    
528      /* import these into the environment */      /* import these into the environment */
529      err = env_import(ASC_ENV_DIST,getenv,PUTENV);      err = env_import(ASC_ENV_DIST,getenv,PUTENV);
530      if(err)CONSOLE_DEBUG("No %s var imported, error %d",ASC_ENV_DIST,err);      if(err)CONSOLE_DEBUG("No %s var imported (error %d)",ASC_ENV_DIST,err);
531      env_import(ASC_ENV_TK,getenv,PUTENV);      env_import(ASC_ENV_TK,getenv,PUTENV);
532      env_import(ASC_ENV_BITMAPS,getenv,PUTENV);      env_import(ASC_ENV_BITMAPS,getenv,PUTENV);
533      env_import(ASC_ENV_LIBRARY,getenv,PUTENV);      env_import(ASC_ENV_LIBRARY,getenv,PUTENV);
# Line 536  static void AscCheckEnvironVars(Tcl_Inte Line 536  static void AscCheckEnvironVars(Tcl_Inte
536      /* used for colour console output */      /* used for colour console output */
537      env_import("TERM",getenv,PUTENV);      env_import("TERM",getenv,PUTENV);
538    
539      CONSOLE_DEBUG("IMPORTING VARS");      /* CONSOLE_DEBUG("IMPORTING VARS"); */
540    
541      distdir = GETENV(ASC_ENV_DIST);      distdir = GETENV(ASC_ENV_DIST);
542      tkdir = GETENV(ASC_ENV_TK);      tkdir = GETENV(ASC_ENV_TK);
# Line 547  static void AscCheckEnvironVars(Tcl_Inte Line 547  static void AscCheckEnvironVars(Tcl_Inte
547      /* Create an ASCENDDIST value if it's missing */      /* Create an ASCENDDIST value if it's missing */
548    
549      if(distdir == NULL){      if(distdir == NULL){
550          CONSOLE_DEBUG("NO " ASC_ENV_DIST " VAR DEFINED");          CONSOLE_DEBUG("Note: No '" ASC_ENV_DIST "' var defined");
551    
552  # ifndef ASC_ABSOLUTE_PATHS  # ifndef ASC_ABSOLUTE_PATHS
553    
# Line 555  static void AscCheckEnvironVars(Tcl_Inte Line 555  static void AscCheckEnvironVars(Tcl_Inte
555          fp = ospath_new(progname);          fp = ospath_new(progname);
556    
557          ospath_strncpy(fp,s1,PATH_MAX);          ospath_strncpy(fp,s1,PATH_MAX);
558          CONSOLE_DEBUG("PROGNAME = %s",s1);          /* CONSOLE_DEBUG("PROGNAME = %s",s1); */
559    
560          /* get the directory name from the exe path*/          /* get the directory name from the exe path*/
561          fp1 = ospath_getdir(fp);          fp1 = ospath_getdir(fp);
562          ospath_free(fp);          ospath_free(fp);
563    
564          ospath_strncpy(fp1,s1,PATH_MAX);          ospath_strncpy(fp1,s1,PATH_MAX);
565          CONSOLE_DEBUG("DIR = %s",s1);          /* CONSOLE_DEBUG("DIR = %s",s1); */
566    
567          /* append the contents of ASC_DISTDIR_REL_BIN to this path*/          /* append the contents of ASC_DISTDIR_REL_BIN to this path*/
568          fp = ospath_new_noclean(ASC_DISTDIR_REL_BIN);          fp = ospath_new_noclean(ASC_DISTDIR_REL_BIN);
# Line 570  static void AscCheckEnvironVars(Tcl_Inte Line 570  static void AscCheckEnvironVars(Tcl_Inte
570          ospath_cleanup(distfp);          ospath_cleanup(distfp);
571    
572          ospath_strncpy(fp1,s1,PATH_MAX);          ospath_strncpy(fp1,s1,PATH_MAX);
573          CONSOLE_DEBUG("DIST = %s",s1);          /* CONSOLE_DEBUG("DIST = %s",s1); */
574    
575  # else  # else
576          CONSOLE_DEBUG("ASC_ABSOLUTE_PATHS=%d",ASC_ABSOLUTE_PATHS);          CONSOLE_DEBUG("ASC_ABSOLUTE_PATHS=%d",ASC_ABSOLUTE_PATHS);
# Line 578  static void AscCheckEnvironVars(Tcl_Inte Line 578  static void AscCheckEnvironVars(Tcl_Inte
578          (void)progname;          (void)progname;
579  # endif  # endif
580          distdir = ospath_str(distfp);          distdir = ospath_str(distfp);
581          CONSOLE_DEBUG("GUESSING %s = %s",ASC_ENV_DIST,distdir);          /* CONSOLE_DEBUG("GUESSING %s = %s",ASC_ENV_DIST,distdir); */
582          OSPATH_PUTENV(ASC_ENV_DIST,distfp);          OSPATH_PUTENV(ASC_ENV_DIST,distfp);
583          distdir = GETENV(ASC_ENV_DIST);          distdir = GETENV(ASC_ENV_DIST);
584          CONSOLE_DEBUG("RETRIEVED %s = %s",ASC_ENV_DIST,distdir);          /* CONSOLE_DEBUG("RETRIEVED %s = %s",ASC_ENV_DIST,distdir); */
585          printenv();          printenv();
586      }      }
587    
588      if(tkdir == NULL){      if(tkdir == NULL){
589          CONSOLE_DEBUG("USING DEFAULT %s = %s",ASC_ENV_TK,ASC_ENV_TK_DEFAULT);          /* CONSOLE_DEBUG("USING DEFAULT %s = %s",ASC_ENV_TK,ASC_ENV_TK_DEFAULT); */
590          guessedtk=1;          guessedtk=1;
591          tkfp = ospath_new_expand_env(ASC_ENV_TK_DEFAULT, &GETENV);          tkfp = ospath_new_expand_env(ASC_ENV_TK_DEFAULT, &GETENV);
592          tkdir = ospath_str(tkfp);          tkdir = ospath_str(tkfp);
593    
594          ospath_strncpy(tkfp,envcmd,MAX_ENV_VAR_LENGTH);          ospath_strncpy(tkfp,envcmd,MAX_ENV_VAR_LENGTH);
595          CONSOLE_DEBUG("TK = %s",envcmd);          /* CONSOLE_DEBUG("TK = %s",envcmd); */
596    
597          OSPATH_PUTENV(ASC_ENV_TK,tkfp);          OSPATH_PUTENV(ASC_ENV_TK,tkfp);
598      }else{      }else{
# Line 602  static void AscCheckEnvironVars(Tcl_Inte Line 602  static void AscCheckEnvironVars(Tcl_Inte
602      }      }
603    
604      if(bitmapsdir == NULL){      if(bitmapsdir == NULL){
605          CONSOLE_DEBUG("NO " ASC_ENV_BITMAPS " VAR DEFINED");          /* CONSOLE_DEBUG("NO " ASC_ENV_BITMAPS " VAR DEFINED"); */
606          /* Create a path $ASCENDTK/bitmaps */          /* Create a path $ASCENDTK/bitmaps */
607          bitmapsfp = ospath_new_expand_env("$ASCENDTK/bitmaps", &GETENV);          bitmapsfp = ospath_new_expand_env("$ASCENDTK/bitmaps", &GETENV);
608          OSPATH_PUTENV(ASC_ENV_BITMAPS,bitmapsfp);          OSPATH_PUTENV(ASC_ENV_BITMAPS,bitmapsfp);
# Line 616  static void AscCheckEnvironVars(Tcl_Inte Line 616  static void AscCheckEnvironVars(Tcl_Inte
616          @TODO Also, what about ASCEND_DEFAULTLIBRARY ?          @TODO Also, what about ASCEND_DEFAULTLIBRARY ?
617      */      */
618      if(librarydir == NULL){      if(librarydir == NULL){
619          CONSOLE_DEBUG("NO " ASC_ENV_LIBRARY " VAR DEFINED");          /* CONSOLE_DEBUG("NO " ASC_ENV_LIBRARY " VAR DEFINED"); */
620          libraryfp = ospath_new_expand_env("$ASCENDDIST/models", &GETENV);          libraryfp = ospath_new_expand_env("$ASCENDDIST/models", &GETENV);
621          CONSOLE_DEBUG("CREATED LIBRARY VAL");          /* CONSOLE_DEBUG("CREATED LIBRARY VAL"); */
622          OSPATH_PUTENV(ASC_ENV_LIBRARY,libraryfp);          OSPATH_PUTENV(ASC_ENV_LIBRARY,libraryfp);
623          librarydir = ospath_str(libraryfp);          librarydir = ospath_str(libraryfp);
624          ospath_free(libraryfp);          ospath_free(libraryfp);
625      }      }
626    
627      if(solversdir == NULL){      if(solversdir == NULL){
628          CONSOLE_DEBUG("NO " ASC_ENV_LIBRARY " VAR DEFINED");          /* CONSOLE_DEBUG("NO " ASC_ENV_LIBRARY " VAR DEFINED"); */
629          solversfp = ospath_new_expand_env("$ASCENDDIST/solvers", &GETENV);          solversfp = ospath_new_expand_env("$ASCENDDIST/solvers", &GETENV);
630          CONSOLE_DEBUG("CREATED SOLVERS VAL");          /* CONSOLE_DEBUG("CREATED SOLVERS VAL"); */
631          OSPATH_PUTENV(ASC_ENV_SOLVERS,solversfp);          OSPATH_PUTENV(ASC_ENV_SOLVERS,solversfp);
632          solversdir = ospath_str(solversfp);          solversdir = ospath_str(solversfp);
633          ospath_free(solversfp);          ospath_free(solversfp);

Legend:
Removed from v.1616  
changed lines
  Added in v.1617

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22