Merge remote branch 'origin/master'
authorKeith Packard <keithp@keithp.com>
Thu, 29 Jul 2010 19:07:49 +0000 (12:07 -0700)
committerKeith Packard <keithp@keithp.com>
Thu, 29 Jul 2010 19:07:49 +0000 (12:07 -0700)
19 files changed:
ao-tools/altosui/AltOS Package Configuration.pmdoc/01altosui-contents.xml [new file with mode: 0644]
ao-tools/altosui/AltOS Package Configuration.pmdoc/01altosui.xml [new file with mode: 0644]
ao-tools/altosui/AltOS Package Configuration.pmdoc/index.xml [new file with mode: 0644]
ao-tools/altosui/AltosDeviceDialog.java
ao-tools/altosui/AltosEeprom.java
ao-tools/altosui/AltosSerial.java
ao-tools/altosui/AltosUI.app/Contents/Info.plist [new file with mode: 0644]
ao-tools/altosui/AltosUI.app/Contents/MacOS/JavaApplicationStub [new file with mode: 0755]
ao-tools/altosui/AltosUI.app/Contents/PkgInfo [new file with mode: 0644]
ao-tools/altosui/AltosUI.app/Contents/Resources/AltosUIIcon.icns [new file with mode: 0644]
ao-tools/altosui/AltosUIIcon.icns [deleted file]
ao-tools/altosui/Makefile
ao-tools/altosui/altusmetrum.jpg [new file with mode: 0644]
ao-tools/libaltos/AltOS Package Configuration.pmdoc/01altosui-contents.xml [deleted file]
ao-tools/libaltos/AltOS Package Configuration.pmdoc/01altosui.xml [deleted file]
ao-tools/libaltos/AltOS Package Configuration.pmdoc/index.xml [deleted file]
ao-tools/libaltos/Makefile
ao-tools/libaltos/libaltos.c
ao-tools/libaltos/libaltos.h

diff --git a/ao-tools/altosui/AltOS Package Configuration.pmdoc/01altosui-contents.xml b/ao-tools/altosui/AltOS Package Configuration.pmdoc/01altosui-contents.xml
new file mode 100644 (file)
index 0000000..18e00fe
--- /dev/null
@@ -0,0 +1 @@
+<pkg-contents spec="1.12"><f n="AltosUI.app" o="keithp" g="keithp" p="16877" pt="/Users/keithp/altos/ao-tools/altosui/AltosUI.app" m="false" t="file"><f n="Contents" o="keithp" g="keithp" p="16877"><f n="Info.plist" o="keithp" g="keithp" p="33188"/><f n="MacOS" o="keithp" g="keithp" p="16877"><f n="JavaApplicationStub" o="keithp" g="keithp" p="33133"/></f><f n="PkgInfo" o="keithp" g="keithp" p="33188"/><f n="Resources" o="keithp" g="keithp" p="16877"><f n="AltosUIIcon.icns" o="keithp" g="keithp" p="33188"/><f n="Java" o="keithp" g="keithp" p="16877"/></f></f></f></pkg-contents>
\ No newline at end of file
diff --git a/ao-tools/altosui/AltOS Package Configuration.pmdoc/01altosui.xml b/ao-tools/altosui/AltOS Package Configuration.pmdoc/01altosui.xml
new file mode 100644 (file)
index 0000000..6170931
--- /dev/null
@@ -0,0 +1 @@
+<pkgref spec="1.12" uuid="C5762664-2F26-4536-94C4-56F0FBC08D1A"><config><identifier>org.altusmetrum.altosUi.AltosUI.pkg</identifier><version>0.7</version><description></description><post-install type="none"/><installFrom relative="true" mod="true">AltosUI.app</installFrom><installTo mod="true" relocatable="true">/Applications/AltosUI.app</installTo><flags><followSymbolicLinks/></flags><packageStore type="internal"></packageStore><mod>installTo.path</mod><mod>installFrom.isRelativeType</mod><mod>version</mod><mod>parent</mod><mod>requireAuthorization</mod><mod>installTo</mod></config><contents><file-list>01altosui-contents.xml</file-list><filter>/CVS$</filter><filter>/\.svn$</filter><filter>/\.cvsignore$</filter><filter>/\.cvspass$</filter><filter>/\.DS_Store$</filter></contents></pkgref>
\ No newline at end of file
diff --git a/ao-tools/altosui/AltOS Package Configuration.pmdoc/index.xml b/ao-tools/altosui/AltOS Package Configuration.pmdoc/index.xml
new file mode 100644 (file)
index 0000000..fabe54a
--- /dev/null
@@ -0,0 +1 @@
+<pkmkdoc spec="1.12"><properties><title>AltOS UI</title><build>/Users/keithp/altos/ao-tools/altosui/AltosUI.pkg</build><organization>org.altusmetrum</organization><userSees ui="both"/><min-target os="3"/><domain system="true" user="true"/></properties><distribution><versions min-spec="1.000000"/><scripts></scripts></distribution><description>Install AltOS User Interface</description><contents><choice title="AltosUI" id="choice0" starts_selected="true" starts_enabled="true" starts_hidden="false"><pkgref id="org.altusmetrum.altosUi.AltosUI.pkg"/></choice></contents><resources bg-scale="tofit" bg-align="center"><locale lang="en"><resource relative="true" mod="true" type="background">altusmetrum.jpg</resource></locale></resources><flags/><item type="file">01altosui.xml</item><mod>properties.anywhereDomain</mod><mod>properties.title</mod><mod>properties.customizeOption</mod><mod>description</mod><mod>properties.userDomain</mod><mod>properties.systemDomain</mod></pkmkdoc>
\ No newline at end of file
index 536a8057fdbfbed82331659fbb3682872386d5bb..c60bd7c3ee35a388f5733259e84d8e2d3e4946e4 100644 (file)
@@ -152,10 +152,8 @@ public class AltosDeviceDialog extends JDialog implements ActionListener {
 
        //Handle clicks on the Set and Cancel buttons.
        public void actionPerformed(ActionEvent e) {
-               if ("select".equals(e.getActionCommand())) {
-                       System.out.printf("got select action\n");
+               if ("select".equals(e.getActionCommand()))
                        AltosDeviceDialog.value = (altos_device)(list.getSelectedValue());
-               }
                AltosDeviceDialog.dialog.setVisible(false);
        }
 
index 6162521f11435b2fbe1e9b14144fa08eb483c71c..4c537a8901da0361ffe9bc0573ad049ee0707b44 100644 (file)
@@ -199,9 +199,9 @@ public class AltosEeprom implements Runnable {
                                        if (eeprom_file == null) {
                                                if (serial != 0 && flight != 0 && want_file) {
                                                        if (year != 0 && month != 0 && day != 0)
-                                                               eeprom_name = new AltosFile(year, month, day, serial, flight, "eeprom-new");
+                                                               eeprom_name = new AltosFile(year, month, day, serial, flight, "eeprom");
                                                        else
-                                                               eeprom_name = new AltosFile(serial, flight, "eeprom-new");
+                                                               eeprom_name = new AltosFile(serial, flight, "eeprom");
 
                                                        monitor.set_file(eeprom_name.getName());
                                                        eeprom_file = new FileWriter(eeprom_name);
@@ -229,7 +229,7 @@ public class AltosEeprom implements Runnable {
                                done = true;
                }
                if (eeprom_file == null) {
-                       eeprom_name = new AltosFile(serial,flight,"eeprom-new");
+                       eeprom_name = new AltosFile(serial,flight,"eeprom");
                        eeprom_file = new FileWriter(eeprom_name);
                        if (eeprom_file != null) {
                                FlushPending(eeprom_file, eeprom_pending);
index a5566ab898d4f3eb096f2d131e925e585bf8a499..efa63f681819e2ed9f3d22ebfac66d79e47f7750 100644 (file)
@@ -104,10 +104,8 @@ public class AltosSerial implements Runnable {
        }
 
        public void close() {
-               if (altos != null) {
+               if (altos != null)
                        libaltos.altos_close(altos);
-                       altos = null;
-               }
                if (input_thread != null) {
                        try {
                                input_thread.interrupt();
@@ -116,6 +114,10 @@ public class AltosSerial implements Runnable {
                        }
                        input_thread = null;
                }
+               if (altos != null) {
+                       libaltos.altos_free(altos);
+                       altos = null;
+               }
        }
 
        public void putc(char c) {
diff --git a/ao-tools/altosui/AltosUI.app/Contents/Info.plist b/ao-tools/altosui/AltosUI.app/Contents/Info.plist
new file mode 100644 (file)
index 0000000..97b1b59
--- /dev/null
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
+<plist version="0.9">
+<dict>
+       <key>CFBundleName</key>
+       <string>altosui</string>
+       <key>CFBundleVersion</key>
+       <string>100.0</string>
+       <key>CFBundleAllowMixedLocalizations</key>
+       <string>true</string>
+       <key>CFBundleExecutable</key>
+       <string>JavaApplicationStub</string>
+       <key>CFBundleDevelopmentRegion</key>
+       <string>English</string>
+       <key>CFBundlePackageType</key>
+       <string>APPL</string>
+       <key>CFBundleSignature</key>
+       <string>????</string>
+       <key>CFBundleGetInfoString</key>
+       <string>AltOS UI version 0.7</string>
+       <key>CFBundleInfoDictionaryVersion</key>
+       <string>6.0</string>
+       <key>CFBundleIconFile</key>
+       <string>AltosUIIcon.icns</string>
+       <key>Java</key>
+       <dict>
+               <key>MainClass</key>
+               <string>altosui.AltosUI</string>
+               <key>JVMVersion</key>
+               <string>1.5+</string>
+               <key>ClassPath</key>
+                       <array>
+                       <string>$JAVAROOT/altosui.jar</string>
+                       <string>$JAVAROOT/freetts.jar</string>
+                       </array>
+       </dict>
+</dict>
+</plist>
diff --git a/ao-tools/altosui/AltosUI.app/Contents/MacOS/JavaApplicationStub b/ao-tools/altosui/AltosUI.app/Contents/MacOS/JavaApplicationStub
new file mode 100755 (executable)
index 0000000..c661d3e
Binary files /dev/null and b/ao-tools/altosui/AltosUI.app/Contents/MacOS/JavaApplicationStub differ
diff --git a/ao-tools/altosui/AltosUI.app/Contents/PkgInfo b/ao-tools/altosui/AltosUI.app/Contents/PkgInfo
new file mode 100644 (file)
index 0000000..8a43480
--- /dev/null
@@ -0,0 +1 @@
+APPLAM.O
diff --git a/ao-tools/altosui/AltosUI.app/Contents/Resources/AltosUIIcon.icns b/ao-tools/altosui/AltosUI.app/Contents/Resources/AltosUIIcon.icns
new file mode 100644 (file)
index 0000000..fe49f36
Binary files /dev/null and b/ao-tools/altosui/AltosUI.app/Contents/Resources/AltosUIIcon.icns differ
diff --git a/ao-tools/altosui/AltosUIIcon.icns b/ao-tools/altosui/AltosUIIcon.icns
deleted file mode 100644 (file)
index fe49f36..0000000
Binary files a/ao-tools/altosui/AltosUIIcon.icns and /dev/null differ
index 2c284aaa8d636ba3847e2264dcd6dcd3abf1964a..790aecdabefcb570065df7516e9af59f4e1440e0 100644 (file)
@@ -29,13 +29,21 @@ FREETTSJAR= \
        cmutimelex.jar \
        cmu_us_kal.jar \
        en_us.jar \
-       freetts.jar \
-       freetts-jsapi10.jar \
-       jsapi.jar
+       freetts.jar
 
 JAVAFLAGS=-Xlint:unchecked
 
-all: altosui.jar
+OS:=$(shell uname)
+
+ifeq ($(OS),Linux)
+ALTOSUI_APP=altosui
+endif
+
+ifeq ($(OS),Darwin)
+ALTOSUI_APP=AltosUI.app/Contents/Resources/Java/altosui.jar
+endif
+
+all: altosui.jar $(ALTOSUI_APP)
 
 $(CLASSFILES):
 
@@ -56,6 +64,23 @@ classes/libaltosJNI:
 $(FREETTSJAR):
        ln -s $(FREETTSLIB)/$@ .
 
+ifeq ($(OS),Darwin)
+RESOURCES=altosui.jar $(FREETTSJAR) ../libaltos/libaltos.dylib
+
+$(ALTOSUI_APP): $(RESOURCES)
+       mkdir -p AltosUI.app/Contents/Resources/Java
+       cp $(RESOURCES) AltosUI.app/Contents/Resources/Java
+
+endif
+
+ifeq ($(OS),Linux)
+altosui:
+       echo "#!/bin/sh" > $@
+       echo "exec java -Djava.library.path=../libaltos -jar altosui.jar" >> $@
+       chmod +x ./altosui
+endif
+
 clean:
        rm -f *.class $(FREETTSJAR) altosui.jar
+       rm -f AltosUI.app/Contents/Resources/Java/*
        rm -rf classes
diff --git a/ao-tools/altosui/altusmetrum.jpg b/ao-tools/altosui/altusmetrum.jpg
new file mode 100644 (file)
index 0000000..0402792
Binary files /dev/null and b/ao-tools/altosui/altusmetrum.jpg differ
diff --git a/ao-tools/libaltos/AltOS Package Configuration.pmdoc/01altosui-contents.xml b/ao-tools/libaltos/AltOS Package Configuration.pmdoc/01altosui-contents.xml
deleted file mode 100644 (file)
index e19a1e4..0000000
+++ /dev/null
@@ -1 +0,0 @@
-<pkg-contents spec="1.12"><f n="AltosUI.app" o="keithp" g="keithp" p="16877" pt="/Users/keithp/AltosUI.app" m="false" t="file"><f n="Contents" o="keithp" g="keithp" p="16877"><f n="Info.plist" o="keithp" g="keithp" p="33188"/><f n="MacOS" o="keithp" g="keithp" p="16877"><f n="JavaApplicationStub" o="keithp" g="keithp" p="33133"/></f><f n="PkgInfo" o="keithp" g="keithp" p="33188"/><f n="Resources" o="keithp" g="keithp" p="16877"><f n="AltosUIIcon.icns" o="keithp" g="keithp" p="33188"/><f n="Java" o="keithp" g="keithp" p="16877"><f n="altosui.jar" o="keithp" g="keithp" p="33188"/><f n="cmu_time_awb.jar" o="keithp" g="keithp" p="33188"/><f n="cmu_us_kal.jar" o="keithp" g="keithp" p="33188"/><f n="cmudict04.jar" o="keithp" g="keithp" p="33188"/><f n="cmulex.jar" o="keithp" g="keithp" p="33188"/><f n="cmutimelex.jar" o="keithp" g="keithp" p="33188"/><f n="en_us.jar" o="keithp" g="keithp" p="33188"/><f n="freetts-jsapi10.jar" o="keithp" g="keithp" p="33188"/><f n="freetts.jar" o="keithp" g="keithp" p="33188"/><f n="libaltos.dylib" o="keithp" g="keithp" p="33188"/></f></f></f></f></pkg-contents>
\ No newline at end of file
diff --git a/ao-tools/libaltos/AltOS Package Configuration.pmdoc/01altosui.xml b/ao-tools/libaltos/AltOS Package Configuration.pmdoc/01altosui.xml
deleted file mode 100644 (file)
index 5d84e5f..0000000
+++ /dev/null
@@ -1 +0,0 @@
-<pkgref spec="1.12" uuid="C5762664-2F26-4536-94C4-56F0FBC08D1A"><config><identifier>org.altusmetrum.altosUi.AltosUI.pkg</identifier><version>1.0</version><description></description><post-install type="none"/><installFrom>/Users/keithp/AltosUI.app</installFrom><installTo mod="true" relocatable="true">/Applications/AltosUI.app</installTo><flags><followSymbolicLinks/></flags><packageStore type="internal"></packageStore><mod>installTo.path</mod><mod>parent</mod><mod>requireAuthorization</mod><mod>installTo</mod></config><contents><file-list>01altosui-contents.xml</file-list><filter>/CVS$</filter><filter>/\.svn$</filter><filter>/\.cvsignore$</filter><filter>/\.cvspass$</filter><filter>/\.DS_Store$</filter></contents></pkgref>
\ No newline at end of file
diff --git a/ao-tools/libaltos/AltOS Package Configuration.pmdoc/index.xml b/ao-tools/libaltos/AltOS Package Configuration.pmdoc/index.xml
deleted file mode 100644 (file)
index 1277db6..0000000
+++ /dev/null
@@ -1 +0,0 @@
-<pkmkdoc spec="1.12"><properties><title>AltOS UI</title><build>/Users/keithp/Documents/AltosUI.pkg</build><organization>org.altusmetrum</organization><userSees ui="easy"/><min-target os="3"/><domain anywhere="true"/></properties><distribution><versions min-spec="1.000000"/><scripts></scripts></distribution><contents><choice title="AltosUI" id="choice0" starts_selected="true" starts_enabled="true" starts_hidden="false"><pkgref id="org.altusmetrum.altosUi.AltosUI.pkg"/></choice></contents><resources bg-scale="none" bg-align="topleft"><locale lang="en"/></resources><flags/><item type="file">01altosui.xml</item><mod>properties.title</mod></pkmkdoc>
\ No newline at end of file
index 0bbd304c741587693337b92112497ad73c5eee72..fa5127ebc271e3ad755fa48ae6591637f41f7160 100644 (file)
@@ -51,7 +51,7 @@ JAVAFLAGS=-Xlint:unchecked
 all: libaltos.$(LIBEXT) cjnitest $(CLASSFILES)
 
 .java.class:
-       javac -cp "$(CLASSPATH)" $(JAVAFLAGS) $*.java
+       javac -encoding UTF8 -classpath "$(CLASSPATH)" $(JAVAFLAGS) $*.java
 
 CFLAGS=$(OS_CFLAGS) -O0 -g -I.
 
index df0d5b2eba6b21f99ea35e9196bed7771565cd6a..00fb2125443bc452b9807f8f106d81b726dd30b9 100644 (file)
@@ -567,6 +567,14 @@ void
 altos_close(struct altos_file *file)
 {
        close(file->fd);
+       file->fd = -1;
+}
+
+void
+altos_free(struct altos_file *file)
+{
+       if (file->fd != -1)
+               close(file->fd);
        free(file);
 }
 
@@ -592,6 +600,8 @@ altos_flush(struct altos_file *file)
        while (file->out_used) {
                int     ret;
 
+               if (file->fd < 0)
+                       return -EBADF;
                ret = write (file->fd, file->out_data, file->out_used);
                if (ret < 0)
                        return -errno;
@@ -610,6 +620,8 @@ altos_getchar(struct altos_file *file, int timeout)
                int     ret;
 
                altos_flush(file);
+               if (file->fd < 0)
+                       return -EBADF;
                ret = read(file->fd, file->in_data, USB_BUF_SIZE);
                if (ret < 0)
                        return -errno;
index 782f244eb6dd68b7682744f2ee43c2e70b3bce45..53026e0a755fa4d16609d27ec15c68602d15f47b 100644 (file)
@@ -42,6 +42,8 @@ altos_open(struct altos_device *device);
 
 void altos_close(struct altos_file *file);
 
+void altos_free(struct altos_file *file);
+
 int
 altos_putchar(struct altos_file *file, char c);