Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'master' of https://github.com/CBCJVM/CBCJVM

Conflicts:
	cbc/CBCJVM/src/cbccore/Device.java
  • Loading branch information...
commit f2d876f5ee0f78b5e168a909270016640b720dfe 2 parents fd308cc + 1e53c99
Benjamin Woodruff PiPeep authored
23 cbc/CBCJVM/src/cbccore/Device.java
View
@@ -47,8 +47,13 @@
private static Sound lowSound;
private static Sensor lowSensors;
private static boolean onCBC = true;
+ private static boolean isInited = false;
public static void init() {
+ if (isInited) {
+ return;
+ }
+
init(new CBCSimulatorFactory());
}
@@ -113,6 +118,8 @@ public static Simulator getSimulatorController() {
* @see cbccore.low.Motor
*/
public static Motor getLowMotorController() {
+ init();
+
return lowMotors;
}
@@ -124,6 +131,8 @@ public static Motor getLowMotorController() {
* @see cbccore.low.Create
*/
public static Create getLowCreateController() {
+ init();
+
return lowCreate;
}
@@ -135,6 +144,8 @@ public static Create getLowCreateController() {
* @see cbccore.low.Display
*/
public static Display getLowDisplayController() {
+ init();
+
return lowDisplay;
}
@@ -146,6 +157,8 @@ public static Display getLowDisplayController() {
* @see cbccore.low.Servo
*/
public static Servo getLowServoController() {
+ init();
+
return lowServos;
}
@@ -157,6 +170,8 @@ public static Servo getLowServoController() {
* @see cbccore.low.Camera
*/
public static Camera getLowCameraController() {
+ init();
+
return lowCamera;
}
@@ -168,6 +183,8 @@ public static Camera getLowCameraController() {
* @see cbccore.low.Device
*/
public static cbccore.low.Device getLowDeviceController() {
+ init();
+
return lowDevice;
}
@@ -179,6 +196,8 @@ public static Camera getLowCameraController() {
* @see cbccore.low.Input
*/
public static Input getLowInputController() {
+ init();
+
return lowInput;
}
@@ -190,6 +209,8 @@ public static Input getLowInputController() {
* @see cbccore.low.Sound
*/
public static Sound getLowSoundController() {
+ init();
+
return lowSound;
}
@@ -201,6 +222,8 @@ public static Sound getLowSoundController() {
* @see cbccore.low.Sensor
*/
public static Sensor getLowSensorController() {
+ init();
+
return lowSensors;
}
6 installer/build.xml
View
@@ -16,8 +16,6 @@
<property name="sourceJNI-c" location="../cbc/CBCJVM/jni"/>
<property name="targetCode" location="${installData}/code"/>
<property name="sourceCode" location="../cbc/CBCJVM/examples/"/>
- <property name="targetCompile" location="${installData}/compile"/>
- <property name="sourceCompile" location="compile"/>
<target name="init" depends="clean"
description="initialize folder structure">
@@ -29,7 +27,6 @@
<mkdir dir="${targetJNI-java}"/>
<mkdir dir="${targetJNI-c}"/>
<mkdir dir="${targetCode}"/>
- <mkdir dir="${targetCompile}"/>
</target>
<target name="dist" depends="init" description="generate the distribution">
@@ -49,9 +46,6 @@
<copy todir="${targetCode}">
<fileset dir="${sourceCode}"/>
</copy>
- <copy todir="${targetCompile}">
- <fileset dir="${sourceCompile}"/>
- </copy>
</parallel>
</target>
101 installer/compile/compile
View
@@ -1,101 +0,0 @@
-#!/bin/sh
-
-DIR=/mnt/user/bin
-PROG=$DIR/robot
-NAME=$DIR/robot_name.txt
-
-rm -rf $DIR
-mkdir -p $DIR
-
-echo "Program last modified:"
-date -R -r ${1}
-
-if [ ${1##*.} = "bin" ]; then
- echo "Copying ${1}"
- cp "${1}" $PROG
- if [ -e $PROG ]; then
- echo "${1}" > $NAME
- echo "Copy succeeded."
- /mnt/user/nhs/success_sound &
- else
- echo "Copy failed."
- /mnt/user/nhs/fail_sound &
- fi
-else
-
- if [ ${1##*.} = "wav" ]; then
- echo "Playing audio file ${1}"
- btplay ${1}
-
- else
-
- if [ ${1##*.} = "mp3" ]; then
- echo "Playing audio file ${1}"
- btplay ${1}
- else
-
- if [ ! -e "${1%.*}.bin" ]; then
-
- echo "Compiling ${1}"
- if [ ${1##*.} = "c" ]; then
- /mnt/kiss/usercode/gcc-usercode "${1}" -o ${1%.*}.bin 2>&1
- else
- if [ ${1##*.} = "cpp" ]; then
- echo "C++ is coming soon."
- else
- if [ ${1##*.} = "cxx" ]; then
- echo "C++ is coming soon."
- else
- if [ ${1##*.} = "class" ]; then
- echo "Copying proxy to ${DIR}"
- FOLDER="${1%/*}"
- FILE="${1##*/}"
- LOL="${FILE%%.*}"
- echo "#!/bin/sh
- cd ${FOLDER}
- /mnt/user/jvm/java ${LOL}" > ${1%.*}.bin
- echo "${LOL}" > $NAME
- else
- echo "Unsupported format. Only C, C++, Java, WAV, MP3, and binary are supported."
- fi
- fi
- fi
- fi
- if [ -e ${1%.*}.bin ]; then
- echo "Compile succeeded."
-
- echo "Copying ${1%.*}.bin"
- cp "${1%.*}.bin" $PROG
- if [ -e $PROG ]; then
- echo "Copy succeeded."
- /mnt/user/nhs/success_sound &
- echo "${1}" > $NAME
- else
- echo "Copy failed."
- /mnt/user/nhs/fail_sound &
- fi
- else
- echo "Compile failed."
- /mnt/user/nhs/fail_sound &
- fi
-
- else
- echo "Copying ${1%.*}.bin"
- cp "${1%.*}.bin" $PROG
- if [ -e $PROG ]; then
- echo "Copy succeeded."
- /mnt/user/nhs/success_sound &
- echo "${1}" > $NAME
- else
- echo "Copy failed."
- /mnt/user/nhs/fail_sound &
- fi
- fi
- fi
- fi
-fi
-
-chmod -R 777 /mnt/user/
-
-sync
-sync
101 installer/compile/compile.sh
View
@@ -1,101 +0,0 @@
-#!/bin/sh
-
-DIR=/mnt/user/bin
-PROG=$DIR/robot
-NAME=$DIR/robot_name.txt
-
-rm -rf $DIR
-mkdir -p $DIR
-
-echo "Program last modified:"
-date -R -r ${1}
-
-if [ ${1##*.} = "bin" ]; then
- echo "Copying ${1}"
- cp ${1} $PROG
- if [ -e $PROG ]; then
- echo "${1}" > $NAME
- echo "Copy succeeded."
- /mnt/user/nhs/success_sound &
- else
- echo "Copy failed."
- /mnt/user/nhs/fail_sound &
- fi
-else
-
- if [ ${1##*.} = "wav" ]; then
- echo "Playing audio file ${1}"
- btplay ${1}
-
- else
-
- if [ ${1##*.} = "mp3" ]; then
- echo "Playing audio file ${1}"
- btplay ${1}
- else
-
- if [ ! -e "${1%.*}.bin" ]; then
-
- echo "Compiling ${1}"
- if [ ${1##*.} = "c" ]; then
- /mnt/kiss/usercode/gcc-usercode "${1}" -o ${1%.*}.bin 2>&1
- else
- if [ ${1##*.} = "cpp" ]; then
- echo "C++ is coming soon."
- else
- if [ ${1##*.} = "cxx" ]; then
- echo "C++ is coming soon."
- else
- if [ ${1##*.} = "class" ]; then
- echo "Copying proxy to ${DIR}"
- FOLDER=${1%/*}
- FILE=${1##*/}
- LOL=${FILE%%.*}
- echo "#!/bin/sh
- cd ${FOLDER}
- /mnt/user/jvm/java ${LOL}" > ${1%.*}.bin
- echo "${LOL}" > $NAME
- else
- echo "Unsupported format. Only C, C++, Java, WAV, MP3, and binary are supported."
- fi
- fi
- fi
- fi
- if [ -e ${1%.*}.bin ]; then
- echo "Compile succeeded."
-
- echo "Copying ${1%.*}.bin"
- cp ${1%.*}.bin $PROG
- if [ -e $PROG ]; then
- echo "Copy succeeded."
- /mnt/user/nhs/success_sound &
- echo "${1}" > $NAME
- else
- echo "Copy failed."
- /mnt/user/nhs/fail_sound &
- fi
- else
- echo "Compile failed."
- /mnt/user/nhs/fail_sound &
- fi
-
- else
- echo "Copying ${1%.*}.bin"
- cp ${1%.*}.bin $PROG
- if [ -e $PROG ]; then
- echo "Copy succeeded."
- /mnt/user/nhs/success_sound &
- echo "${1}" > $NAME
- else
- echo "Copy failed."
- /mnt/user/nhs/fail_sound &
- fi
- fi
- fi
- fi
-fi
-
-chmod -R 777 /mnt/user/
-
-sync
-sync
5 installer/install/install_script_p2
View
@@ -23,11 +23,8 @@ cp ./CBC.so /mnt/user/jvm/cbc/
cd /mnt/user
echo "[INSTALL] Removing JNI source..."
rm -Rf /mnt/user/jvm/cbc/jni
-echo "[INSTALL] Remounting and copying compile script."
-cd /mnt/user/compile
+echo "[INSTALL] Remounting..."
mount -o remount,rw /dev/sda2
-cp compile /mnt/kiss/usercode/
cd /mnt/user
-rm -Rf compile
echo "[INSTALL] CBCJVM Installed!"
echo "Please run the HelloWorld Program to verify."
Please sign in to comment.
Something went wrong with that request. Please try again.