Changeset d0869f in git
- Timestamp:
- Mar 4, 2010, 5:12:57 PM (13 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', '0604212ebb110535022efecad887940825b97c3f')
- Children:
- 7030440734b67f0c17c06d82bb3f51131c25ba89
- Parents:
- cff3f3df4ef642dfd7e474c8e5293cc98ee2929d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/LIB/surf.lib
rcff3f3 rd0869f 72 72 { 73 73 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")); 75 75 string err_mes; // string containing error messages 76 76 def base=basering; … … 105 105 write(":w "+l,"clip=none;"); 106 106 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;"); 108 109 write(l, 109 110 "root_finder=d_chain_bisection;epsilon=0.0000000001;iterations=20000;"); … … 138 139 } 139 140 } 141 140 142 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); 152 158 } 153 159 else 154 160 { 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); 158 177 } 159 178 160 179 if (i != 0) 161 180 { 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 } 168 187 } 169 188 example … … 206 225 " 207 226 { 208 string l = " /tmp/surf"+string(system("pid"));227 string l = "./surfer" + string(system("pid")); 209 228 string err_mes; // string containing error messages 210 229 def base=basering; … … 237 256 if (ncols(I)==1 and (n==3 or nvars(base)==3)) // surface 238 257 { 239 write(":w " + l, "surface=" ,I[1],";");258 write(":w " + l, "surface=" + string(I[1]) + ";"); 240 259 } 241 260 else … … 246 265 } 247 266 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"; 250 274 "Close window to exit from 'surfer'"; 251 i=system("sh", surf_call); 275 i = system("sh", surf_call); 276 system("sh", "/bin/rm " + l); 252 277 253 278 if (i != 0) 254 279 { 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 } 261 286 } 262 287 example … … 277 302 278 303 } 304 proc isWindows() 305 "returns 1 if this SINGULAR instance runs under (some) Windows OS; 306 0 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 } 279 324 ///////////////////////////////////////////////////////////////////////////////
Note: See TracChangeset
for help on using the changeset viewer.