Changeset d0869f in git


Ignore:
Timestamp:
Mar 4, 2010, 5:12:57 PM (13 years ago)
Author:
Frank Seelisch <seelisch@…>
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', '0604212ebb110535022efecad887940825b97c3f')
Children:
7030440734b67f0c17c06d82bb3f51131c25ba89
Parents:
cff3f3df4ef642dfd7e474c8e5293cc98ee2929d
Message:
fixes for plot and surfer in Windows OS

git-svn-id: file:///usr/local/Singular/svn/trunk@12593 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/LIB/surf.lib

    rcff3f3 rd0869f  
    7272{
    7373  string extra_surf_opts=" -x --auto-resize "; // remove this line for surf 0.9
    74   string l = "/tmp/surf"+string(system("pid"));
     74  string l = "/tmp/surf" + string(system("pid"));
    7575  string err_mes; // string containing error messages
    7676  def base=basering;
     
    105105    write(":w "+l,"clip=none;");
    106106      write(l, "width=500; height=500; set_size; do_background=yes;
    107 background_red=255; background_green=255; background_blue=255;");
     107               background_red=255; background_green=255;
     108               background_blue=255;");
    108109    write(l,
    109110    "root_finder=d_chain_bisection;epsilon=0.0000000001;iterations=20000;");
     
    138139    }
    139140  }
     141
    140142  string surf_call;
    141   surf_call = "surf ";
    142   if (defined(extra_surf_opts))
    143   {
    144     surf_call = surf_call + " " + extra_surf_opts;
    145   }
    146   surf_call =surf_call + l + " >/dev/null 2>&1";
    147 
    148   "Press q to exit from 'surf'";
    149   if ("ppcMac-darwin" != system("uname"))
    150   {
    151      i=system("sh", surf_call);
     143
     144  if (isWindows())
     145  {
     146    surf_call = "((xwin -multiwindow -clipboard -silent-dup-error";
     147    surf_call = surf_call + " >/dev/null 2>&1 &) && sleep 5 && (surf";
     148    if (defined(extra_surf_opts))
     149    {
     150      surf_call = surf_call + " " + extra_surf_opts;
     151    }
     152    surf_call = surf_call + l + ">/dev/null 2>&1))";
     153    surf_call = surf_call + "&& /bin/rm " + l;
     154    "Press q to exit from 'surf'.";
     155    "(You may leave the XServer running for further invocations"
     156    + " of 'plot'.)";
     157    i = system("sh", surf_call);
    152158  }
    153159  else
    154160  {
    155      surf_call = surf_call + " || " + "singularsurf "
    156                  + extra_surf_opts + " " + l +" >/dev/null 2>&1";
    157      i = system("sh", surf_call);
     161    surf_call = "surf ";
     162    if (defined(extra_surf_opts))
     163    {
     164      surf_call = surf_call + " " + extra_surf_opts;
     165    }
     166    surf_call = surf_call + l + " >/dev/null 2>&1";
     167 
     168    if ("ppcMac-darwin" == system("uname"))
     169    {
     170       surf_call = surf_call + " || " + "singularsurf "
     171                   + extra_surf_opts + " " + l + " >/dev/null 2>&1";
     172    }
     173
     174    "Press q to exit from 'surf'";
     175    i = system("sh", surf_call);
     176    system("sh", "/bin/rm " + l);
    158177  }
    159178
    160179  if (i != 0)
    161180  {
    162     err_mes = "calling `surf` failed. (the shell return the error code "
    163           + string(i) + ")." + newline +
    164           "probably the executable `surf` is not found.";
    165     ERROR(err_mes);
    166   }
    167   i = system("sh", "/bin/rm "+l);
     181    err_mes = "calling `surf` failed" + newline
     182              + " (The shell returned the error code "
     183              + string(i) + "." + newline
     184              + "Probably, the executable `surf` was not found.)";
     185    ERROR(err_mes);
     186  }
    168187}
    169188example
     
    206225"
    207226{
    208   string l = "/tmp/surf"+string(system("pid"));
     227  string l = "./surfer" + string(system("pid"));
    209228  string err_mes; // string containing error messages
    210229  def base=basering;
     
    237256  if (ncols(I)==1 and (n==3 or nvars(base)==3)) // surface
    238257  {
    239     write(":w " + l, "surface=",I[1],";");
     258    write(":w " + l, "surface=" + string(I[1]) + ";");
    240259  }
    241260  else
     
    246265  }
    247266  string surf_call;
    248   surf_call ="surfer " + l + " >/dev/null 2>&1";
    249 
     267 
     268  surf_call = "surfer";
     269  if (isWindows())
     270  {
     271    surf_call = surf_call + ".exe";
     272  }
     273  surf_call = surf_call + " " + l; // + " >/dev/null 2>&1";
    250274  "Close window to exit from 'surfer'";
    251   i=system("sh", surf_call);
     275  i = system("sh", surf_call);
     276  system("sh", "/bin/rm " + l);
    252277
    253278  if (i != 0)
    254279  {
    255     err_mes = "calling `surfer` failed. (the shell return the error code "
    256           + string(i) + ")." + newline +
    257           "probably the executable `surfer` is not found.";
    258     ERROR(err_mes);
    259   }
    260   i = system("sh", "/bin/rm "+l);
     280    err_mes = "calling `surfer` failed" + newline
     281              + " (The shell returned the error code "
     282              + string(i) + "." + newline
     283              + "Probably, the executable `surfer` was not found.)";
     284    ERROR(err_mes);
     285  }
    261286}
    262287example
     
    277302
    278303}
     304proc isWindows()
     305"returns 1 if this SINGULAR instance runs under (some) Windows OS;
     3060 otherwise"
     307{
     308  string s = system("uname");
     309  for (int i = 1; i <= size(s)-2; i = i + 1)
     310  {
     311    if (s[i] == "W")
     312    {
     313      if (s[i+1] == "i")
     314      {
     315        if (s[i+2] == "n")
     316        {
     317          return (1);
     318        }
     319      }
     320    }
     321  }
     322  return (0);
     323}
    279324///////////////////////////////////////////////////////////////////////////////
Note: See TracChangeset for help on using the changeset viewer.