File: remobjs.m2

package info (click to toggle)
macaulay2 1.21%2Bds-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 133,096 kB
  • sloc: cpp: 110,377; ansic: 16,306; javascript: 4,193; makefile: 3,821; sh: 3,580; lisp: 764; yacc: 590; xml: 177; python: 140; perl: 114; lex: 65; awk: 3
file content (34 lines) | stat: -rw-r--r-- 1,004 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
RemoteObject = new Type of XMLnode
RemoteObject.synonym = "remote object"

protect connection

getGlobalSymbol(SCSCP#"private dictionary", "connection")
net RemoteObject := x -> (
	if x.?connection and x.connection#?"service_name" then 
		concatenate("<< Remote ", x.connection#"service_name", " object >>")
	else if x.?connection and x.connection#?"nicedesc" then
		concatenate("<< Remote object at ", x.connection#"nicedesc", " >>")
	else
		concatenate("<< Some remote object >>")
)



identifyRemoteObjects = method();
identifyRemoteObjects (SCSCPConnection, XMLnode) := (s,x)-> (
	--I try to avoid copying here unless I have a choice
	if x.tag === "OMR" then (
		r := new RemoteObject from x;
		r.connection = s;
		r
	) else if x.?children then (
		for i in 0..(#(x.children)-1) do (
			nw := if class((x.children)#i) === XMLnode then identifyRemoteObjects(s,(x.children)#i) else (x.children)#i;
			if (nw =!= (x.children)#i) then x.children = replace(i, nw, x.children);
		);
		x
	) else (
		x
	)
)