[BACK]Return to slib.k CVS log [TXT][DIR] Up to [local] / OpenXM / src / k097

Diff for /OpenXM/src/k097/slib.k between version 1.3 and 1.6

version 1.3, 2000/12/10 02:21:46 version 1.6, 2000/12/28 00:08:13
Line 1 
Line 1 
 /* $OpenXM: OpenXM/src/k097/slib.k,v 1.2 2000/01/21 03:01:26 takayama Exp $ */  /* $OpenXM: OpenXM/src/k097/slib.k,v 1.5 2000/12/10 09:34:27 takayama Exp $ */
 /*  slib.sm1, standard library. */  /*  slib.sm1, standard library. */
 /* April 26-- , 1996 */  /* April 26-- , 1996 */
 /* Don't use function names that is already used as a postscipt macro names*/  /* Don't use function names that is already used as a postscipt macro names*/
Line 94  def RingD(vList,weightMatrix,pp) {
Line 94  def RingD(vList,weightMatrix,pp) {
     sm1("[", vList,      sm1("[", vList,
         "ring_of_differential_operators ( ) elimination_order 0 ] define_ring          "ring_of_differential_operators ( ) elimination_order 0 ] define_ring
          /tmp set ");           /tmp set ");
       SetRingVariables();
     return(tmp);      return(tmp);
   } else ;    } else ;
   if (argsize == 2) {    if (argsize == 2) {
Line 117  def RingD(vList,weightMatrix,pp) {
Line 118  def RingD(vList,weightMatrix,pp) {
   ringpp =    ringpp =
   sm1("[", vList,    sm1("[", vList,
       "ring_of_differential_operators ", new0, " weight_vector",pp, " ] define_ring");        "ring_of_differential_operators ", new0, " weight_vector",pp, " ] define_ring");
   /* setRingVariables();  It doesn't work. It's a mystery. */    SetRingVariables();
   sm1(" @@@.indexMode.flag.save @@@.indexMode ");    sm1(" @@@.indexMode.flag.save @@@.indexMode ");
   return( ringpp );    return( ringpp );
 }  }
Line 144  def getvarn() {
Line 145  def getvarn() {
   sm1( "[(N)] system_variable (universalNumber) dc /FunctionValue set ");    sm1( "[(N)] system_variable (universalNumber) dc /FunctionValue set ");
 }  }
   
 SetRingVariables_Verbose = true;  SetRingVariables_Verbose = false;
 def SetRingVariables() {  def SetRingVariables() {
   /* Don't use local variables in this function,    /* Don't use local variables in this function,
      because we set global variables in this function.       because we set global variables in this function.
Line 152  def SetRingVariables() {
Line 153  def SetRingVariables() {
   if (SetRingVariables_Verbose ) {    if (SetRingVariables_Verbose ) {
     Print("SetRingVariables() Setting the global variables : ");      Print("SetRingVariables() Setting the global variables : ");
   }    }
   k00setRingVariables(0,sm1( "[(CC)] system_variable (universalNumber) dc "));    if (k00setRingVariables(0,sm1( "[(N)] system_variable (universalNumber) dc "))) {
   k00setRingVariables(sm1( "[(C)] system_variable (universalNumber) dc "),      sm1(" define_ring_variables ");
                       sm1( "[(LL)] system_variable (universalNumber) dc "));    }
   k00setRingVariables(sm1( "[(L)] system_variable (universalNumber) dc "),  
                       sm1( "[(MM)] system_variable (universalNumber) dc "));  
   k00setRingVariables(sm1( "[(M)] system_variable (universalNumber) dc "),  
                       sm1( "[(NN)] system_variable (universalNumber) dc "));  
   if (SetRingVariables_Verbose) {Ln();}    if (SetRingVariables_Verbose) {Ln();}
 }  }
   
Line 169  def k00AreThereLeftBrace(s) {
Line 166  def k00AreThereLeftBrace(s) {
   if (jj != -1) return(true); else return(false);    if (jj != -1) return(true); else return(false);
 }  }
   
 def void k00setRingVariables(tmp002_p,tmp002_q) {  def k00setRingVariables(p,q) {
   /* tmp002_ must not be used as variables names. */    local v,i;
   local tmp002_i,tmp002_v,tmp002_str;    for (i = p; i< q; i++) {
   PSfor (tmp002_i=tmp002_p;tmp002_i<tmp002_q;tmp002_i++) {      v = getxvar(i);
     tmp002_v = getxvar(tmp002_i);      if (k00AreThereLeftBrace(v)) {
     if (k00AreThereLeftBrace(tmp002_v)) { ; }         return(false);
     else {  
       if (SetRingVariables_Verbose) {Print(tmp002_v); Print(" ");}  
       str = AddString(["/",tmp002_v," $",tmp002_v,"$ (poly) data_conversion def "]);  
       sm1("[(parse) ",str," ] extension ");  
     }      }
     tmp002_v = getdvar(tmp002_i);          v = getdvar(i);
     if (k00AreThereLeftBrace(tmp002_v)) { ; }      if (k00AreThereLeftBrace(v)) {
     else {         return(false);
       if (SetRingVariables_Verbose) {Print(tmp002_v); Print(" ");}  
       str = AddString(["/",tmp002_v," $",tmp002_v,"$ (poly) data_conversion def "]);  
       sm1("[(parse) ",str," ] extension ");  
     }      }
   }    }
     return(true);
 }  }
 /* ---------------------------------- */  /* ---------------------------------- */
   
Line 326  def GetEnv(s) {
Line 317  def GetEnv(s) {
 }  }
 HelpAdd(["GetEnv",  HelpAdd(["GetEnv",
 ["GetEnv(s) returns the value of the environmental variable s (string s)."]]);  ["GetEnv(s) returns the value of the environmental variable s (string s)."]]);
   def Boundp(a) {
      local b;
      sm1("[(parse) [(/) ",a," ( load tag 0 eq
                             { /FunctionValue 0 def }
                             { /FunctionValue 1 def } ifelse )] cat ] extension");
   }
   HelpAdd(["Boundp",
   ["Boundp(s) checks if the symbol s is bounded to a value or not (string s)."]]);
   def Rest(a) {
     sm1(a," rest /FunctionValue set ");
   }
   HelpAdd(["Rest",
   ["Rest(a) returns the rest (cdr) of  a (list a)."]]);
   def GetPathName(s) {
     local t,sss;
     sss = s;
     sm1(" [(stat) s] extension 0 get /t set ");
     if (Tag(t) == 0) {
       s=AddString([GetEnv("LOAD_K_PATH"),"/",s]);
       sm1(" [(stat) s] extension 0 get /t set ");
       if (Tag(t) == 0) {
         return(null);
       }else{
         return(s);
       }
     }else{
       return(s);
     }
   }
   HelpAdd(["GetPathName",
   ["GetPathName(s) checks if the file s exists in the current directory or",
    "in LOAD_K_PATH. If there exists, it returns the path name (string s)."]]);
   
   def Load_sm1(fnames,flag) {
     local ppp,n,i,cmd;
     if (Boundp(flag)) {
     }else{
       n = Length(fnames);
       for (i=0; i<n; i++) {
          ppp = GetPathName(fnames[i]);
          if (Tag(ppp) != 0) {
             sm1(" [(parse) ppp pushfile ] extension ");
             cmd = AddString(["/",flag," 1 def "]);
             sm1(" [(parse) cmd ] extension ");
             i=n; /* break; */
          }
       }
     }
   }
   
   HelpAdd(["Load_sm1",
   ["Load_sm1(s,flag) loads a sm1 program from s[0], s[1], ....",
    "If loading is succeeded, the already-loaded flag is set to true.",
    "(list s, string flag)."]]);
   
   def GetRing(f) {
     sm1(" f getRing /FunctionValue set ");
   }
   
   def SetRing(r) {
     sm1(" r ring_def ");
   }

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.6

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>