-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
new client network connection; better handling of arrays in calls to …
…java
- Loading branch information
Showing
15 changed files
with
123 additions
and
45 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
CP=`echo rainbow/java-lib/* | sed 's/ /\:/g'` | ||
java -server -cp rainbow.jar:$CP rainbow.Console $* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package rainbow.functions.network; | ||
|
||
import rainbow.ArcError; | ||
import rainbow.functions.Builtin; | ||
import rainbow.types.*; | ||
import rainbow.vm.VM; | ||
|
||
import java.io.IOException; | ||
import java.io.InputStream; | ||
import java.io.OutputStream; | ||
import java.net.Socket; | ||
|
||
public class Connect extends Builtin { | ||
public Connect() { | ||
super("client-socket"); | ||
} | ||
|
||
public void invokef(VM vm, ArcObject arg1, ArcObject arg2) { | ||
String host = ((ArcString)arg1).value(); | ||
int port = (int) ((ArcNumber)arg2).toInt(); | ||
Socket socket; | ||
try { | ||
socket = new Socket(host, port); | ||
InputStream in = socket.getInputStream(); | ||
OutputStream out = socket.getOutputStream(); | ||
vm.pushA(Pair.buildFrom( | ||
new SocketInputPort(in, (ArcString) arg1), | ||
new SocketOutputPort(out))); | ||
} catch (IOException e) { | ||
throw new ArcError("Couldn't connect to " + arg1 + ":" + arg2 + ", " + e, e); | ||
} | ||
|
||
} | ||
|
||
public ArcObject invoke(Pair args) { | ||
checkExactArgsCount(args, 2, getClass()); | ||
ArcNumber n = ArcNumber.cast(args.car(), this); | ||
return new ArcSocket((int) n.toInt()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters