|
@@ -15,7 +15,7 @@ def link(address, username, objects):
|
|
|
data = []
|
|
|
|
|
|
data.append(("V", '3'))
|
|
|
- data.append(("V", '"check_symbols"'))
|
|
|
+ data.append(("V", '"link_and_load"'))
|
|
|
for obj in objects:
|
|
|
data.append(("V", '"%s"' % obj))
|
|
|
data.append(("V", '""'))
|
|
@@ -25,58 +25,6 @@ def link(address, username, objects):
|
|
|
if "False" in v:
|
|
|
raise Exception("Linking error")
|
|
|
|
|
|
- # Ok, we know that all symbols can be defined with this set of files, now link their initializers together
|
|
|
- initializers = []
|
|
|
- for obj in objects:
|
|
|
- data.append(("V", '3'))
|
|
|
- data.append(("V", '"read_initializers"'))
|
|
|
- data.append(("V", '"%s"' % obj))
|
|
|
-
|
|
|
- data = flush_data(address, data, username)
|
|
|
-
|
|
|
- for obj in objects:
|
|
|
- print("[LINK] %s" % (obj))
|
|
|
- v = urllib2.urlopen(urllib2.Request(address, urllib.urlencode({"op": "get_output", "username": username}))).read()
|
|
|
- start = str(v.split("&", 1)[0].split("=")[1])
|
|
|
- initializers.append(start)
|
|
|
-
|
|
|
- # Bind all initializers together
|
|
|
- if definers:
|
|
|
- print("[LOAD] %s:main()" % definers["main"])
|
|
|
- else:
|
|
|
- print("[LOAD] main()")
|
|
|
-
|
|
|
- # Set interface to constructors
|
|
|
- commands = [("V", '1')]
|
|
|
-
|
|
|
- # Link all initializers together
|
|
|
- for init in initializers:
|
|
|
- commands.extend([
|
|
|
- ("V", '"call"'),
|
|
|
- ("V", '"access"'),
|
|
|
- ("V", '"resolve"'),
|
|
|
- ("V", '"exec"'),
|
|
|
- ("V", '1'),
|
|
|
- ("V", '"const"'),
|
|
|
- ("R", str(init)),
|
|
|
- ("V", 'true'),
|
|
|
- ])
|
|
|
-
|
|
|
- # Load main function
|
|
|
- commands.extend([
|
|
|
- ("V", '"return"'),
|
|
|
- ("V", 'true'),
|
|
|
- ("V", '"call"'),
|
|
|
- ("V", '"access"'),
|
|
|
- ("V", '"resolve"'),
|
|
|
- ("V", '"main"'),
|
|
|
- ("V", '0'),
|
|
|
- ("V", 'false'),
|
|
|
- ])
|
|
|
-
|
|
|
- import json
|
|
|
- urllib2.urlopen(urllib2.Request(address, urllib.urlencode({"op": "set_input", "data": json.dumps(commands), "username": username}))).read()
|
|
|
-
|
|
|
if __name__ == "__main__":
|
|
|
if len(sys.argv) == 1:
|
|
|
print("No username defined")
|