| version 1.2, 2000/12/14 05:09:29 |
version 1.6, 2006/12/07 00:07:06 |
|
|
| ID=" $OpenXM: OpenXM/src/Macaulay2/m2/oxclient.m2,v 1.1 2000/09/21 09:20:53 takayama Exp $ " |
ID=" $OpenXM: OpenXM/src/Macaulay2/m2/oxclient.m2,v 1.5 2006/10/27 01:38:17 takayama Exp $ " |
| |
|
| |
-- This is configured for Macaulay2 0.9.95 |
| load "oxcommon.m2" |
load "oxcommon.m2" |
| |
|
| oxSession = method() |
oxSession = method() |
| Line 58 oxStartSession = (s) -> ( |
|
| Line 59 oxStartSession = (s) -> ( |
|
| comm = toString "xterm -geometry 80x25-0-0 -e ox -ox " | s | " -data " | |
comm = toString "xterm -geometry 80x25-0-0 -e ox -ox " | s | " -data " | |
| dPort | " -control " | cPort | |
dPort | " -control " | cPort | |
| " -reverse -host localhost" | " -pass " | PASS | " &" ; |
" -reverse -host localhost" | " -pass " | PASS | " &" ; |
| comm = makeLaunchCommand(true,"localhost",getenv("USER"),"localhost", |
comm = makeLaunchCommand(false,"localhost",getenv("USER"),"localhost", |
| s,dPort,cPort,PASS); |
s,dPort,cPort,PASS); |
| |
-- true : connection by ssh, false: only for the local host. |
| print comm; |
print comm; |
| if (run (comm) != 0) |
if (run (comm) != 0) |
| then error "Couldn't start the ox server " | s; |
then error "Couldn't start the ox server " | s; |
| Line 207 oxPopMathcap(OXSESSION) := (F) ->( |
|
| Line 209 oxPopMathcap(OXSESSION) := (F) ->( |
|
| oxPrimDecomp = method() |
oxPrimDecomp = method() |
| oxPrimDecomp(OXSESSION, Ideal) := (F, I) -> ( |
oxPrimDecomp(OXSESSION, Ideal) := (F, I) -> ( |
| -- translate to asir notation |
-- translate to asir notation |
| s := toString I; |
s := toString flatten entries gens I; |
| s = "[" | substring(s,6,#s-7) | "]"; |
s = replace("\\{","[",s); -- substring(2,5,s) |
| |
s = replace ("\\}","]",s); |
| v = toString gens ring I; |
v = toString gens ring I; |
| v = "[" | substring(v,1,#v-2) | "]"; |
v = replace("\\{","[",v); |
| |
v = replace("\\}","]",v); |
| s = "primadec(" | s | "," | v | ");"; |
s = "primadec(" | s | "," | v | ");"; |
| << "sending" << s << endl; |
<< "sending" << s << endl; |
| oxData(F, s); |
oxData(F, s); |
| oxExecuteStringByLocalParser(F); |
oxExecuteStringByLocalParser(F); |
| str = oxPopString(F); |
str = oxPopString(F); |
| |
-- BUG: oxPopCMO(F) is still buggy. |
| toList apply(value str, i -> {ideal(toList(i#0)), ideal(toList(i#1))}) |
toList apply(value str, i -> {ideal(toList(i#0)), ideal(toList(i#1))}) |
| ) |
) |
| oxPrimDecomp(OXSESSION, Ideal) := (F, I) -> ( |
|
| -- translate to asir notation |
|
| s := toString I; |
|
| s = "[" | substring(s,6,#s-7) | "]"; |
|
| v = toString gens ring I; |
|
| v = "[" | substring(v,1,#v-2) | "]"; |
|
| s = "primadec(" | s | "," | v | ");"; |
|
| << "sending" << s << endl; |
|
| oxData(F, s); |
|
| oxExecuteStringByLocalParser(F); |
|
| --str = oxPopString(F); |
|
| --toList apply(value str, i -> {ideal(toList(i#0)), ideal(toList(i#1))}) |
|
| ) |
|
| |
|
| -- makeLaunchCommand generates an argument of run. |
-- makeLaunchCommand generates an argument of run. |
| -- Replace comm = toString "xterm ...." in oxStartSession (oxcommon.m2) by |
-- Replace comm = toString "xterm ...." in oxStartSession (oxcommon.m2) by |
| Line 241 oxPrimDecomp(OXSESSION, Ideal) := (F, I) -> ( |
|
| Line 233 oxPrimDecomp(OXSESSION, Ideal) := (F, I) -> ( |
|
| |
|
| makeLaunchCommand=(UseSSH,MyHostName,RemoteLoginName,RemoteHostName,OxServerName,dPort,cPort,PASS)->( |
makeLaunchCommand=(UseSSH,MyHostName,RemoteLoginName,RemoteHostName,OxServerName,dPort,cPort,PASS)->( |
| commXterm := toString " xterm -geometry 80x25-0-0 " ; |
commXterm := toString " xterm -geometry 80x25-0-0 " ; |
| commOX :=toString " -e ox -ox " | OxServerName | |
commOX :=toString " -e ox -ox " | |
| |
getenv("OpenXM_HOME") | "/bin/" | |
| |
OxServerName | |
| " -data " | dPort | |
" -data " | dPort | |
| " -control " | cPort | |
" -control " | cPort | |
| " -reverse " | |
" -reverse " | |
| " -host " | RemoteHostName | |
" -host " | RemoteHostName | |
| " -pass " | PASS | " "; |
" -pass " | PASS | " "; |
| if (UseSSH) then ( |
if (UseSSH) then ( |
| comm = toString "ssh -f -l " | RemoteLoginName | " " | |
comm = toString "ssh -f -X -A -l " | RemoteLoginName | " " | |
| RemoteHostName | |
RemoteHostName | |
| " '" | commXterm | |
" '" | commXterm | |
| --uncomment when X11 forwarding is not allowed. |
--uncomment when X11 forwarding is not allowed. |
| " -display " | MyHostName | ":0 " | |
-- " -display " | MyHostName | ":0 " | |
| commOX | "' >/dev/null "; |
commOX | "' >/dev/null "; |
| ) |
) |
| else ( |
else ( |