diff --git a/com.xored.fantom.classfile/META-INF/MANIFEST.MF b/com.xored.fantom.classfile/META-INF/MANIFEST.MF index f727f2d..88923c2 100644 --- a/com.xored.fantom.classfile/META-INF/MANIFEST.MF +++ b/com.xored.fantom.classfile/META-INF/MANIFEST.MF @@ -3,5 +3,5 @@ Bundle-ManifestVersion: 2 Bundle-Name: F4 Classfile Bundle-SymbolicName: com.xored.fantom.classfile;singleton:=true Bundle-Version: 1.0.0.qualifier -Require-Bundle: org.fantom.sys;bundle-version="1.0.69" +Require-Bundle: org.fantom.sys;bundle-version="1.0.71" Bundle-Vendor: Xored software, Inc. diff --git a/org.fantom-feature/feature.properties b/org.fantom-feature/feature.properties index 9927a0e..b6be5fe 100644 --- a/org.fantom-feature/feature.properties +++ b/org.fantom-feature/feature.properties @@ -1,5 +1,5 @@ #------------------------------------------------------------------------------- -# Copyright (c) 2008, 2016 Xored software, Inc. +# Copyright (c) 2008, 2018 Xored software, Inc. # All rights reserved. This program and the accompanying materials # are made available under the terms of the Eclipse Public License v1.0 # which accompanies this distribution, and is available at @@ -10,7 +10,7 @@ #------------------------------------------------------------------------------- copyrightURL=epl-v10.html copyright=\ -Copyright (c) 2008, 2016 Xored software, Inc.\n\ +Copyright (c) 2008, 2018 Xored software, Inc.\n\ All rights reserved. This program and the accompanying materials\n\ are made available under the terms of the Eclipse Public License v1.0\n\ which accompanies this distribution, and is available at\n\ diff --git a/org.fantom-feature/feature.xml b/org.fantom-feature/feature.xml index 86571c2..d207749 100644 --- a/org.fantom-feature/feature.xml +++ b/org.fantom-feature/feature.xml @@ -2,7 +2,7 @@ diff --git a/org.fantom-feature/pom.xml b/org.fantom-feature/pom.xml index 3755d51..b910b47 100644 --- a/org.fantom-feature/pom.xml +++ b/org.fantom-feature/pom.xml @@ -9,6 +9,6 @@ org.fantom-features org.fantom - 1.0.69-SNAPSHOT + 1.0.71-SNAPSHOT eclipse-feature diff --git a/org.fantom-updatesite/site.xml b/org.fantom-updatesite/site.xml index 5a9b208..ef286fc 100644 --- a/org.fantom-updatesite/site.xml +++ b/org.fantom-updatesite/site.xml @@ -1,4 +1,4 @@ - + diff --git a/org.fantom.compiler/META-INF/MANIFEST.MF b/org.fantom.compiler/META-INF/MANIFEST.MF index 0b877db..f61808a 100644 --- a/org.fantom.compiler/META-INF/MANIFEST.MF +++ b/org.fantom.compiler/META-INF/MANIFEST.MF @@ -2,6 +2,6 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Fantom core pod Compiler Bundle-SymbolicName: org.fantom.compiler;singleton:=true -Bundle-Version: 1.0.69.qualifier -Require-Bundle: org.fantom.sys;bundle-version="1.0.69" +Bundle-Version: 1.0.71.qualifier +Require-Bundle: org.fantom.sys;bundle-version="1.0.71" Bundle-Vendor: Xored software, Inc. diff --git a/org.fantom.compiler/compiler.pod b/org.fantom.compiler/compiler.pod index 9036059..7c47ab1 100644 Binary files a/org.fantom.compiler/compiler.pod and b/org.fantom.compiler/compiler.pod differ diff --git a/org.fantom.compiler/pom.xml b/org.fantom.compiler/pom.xml index d08c336..1544234 100644 --- a/org.fantom.compiler/pom.xml +++ b/org.fantom.compiler/pom.xml @@ -9,6 +9,6 @@ org.fantom org.fantom.compiler - 1.0.69-SNAPSHOT + 1.0.71-SNAPSHOT eclipse-plugin diff --git a/org.fantom.compilerJava/META-INF/MANIFEST.MF b/org.fantom.compilerJava/META-INF/MANIFEST.MF index c26c24c..363a22e 100644 --- a/org.fantom.compilerJava/META-INF/MANIFEST.MF +++ b/org.fantom.compilerJava/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Fantom core pod CompilerJava Bundle-SymbolicName: org.fantom.compilerJava;singleton:=true -Bundle-Version: 1.0.69.qualifier -Require-Bundle: org.fantom.sys;bundle-version="1.0.69", - org.fantom.compiler;bundle-version="1.0.69" +Bundle-Version: 1.0.71.qualifier +Require-Bundle: org.fantom.sys;bundle-version="1.0.71", + org.fantom.compiler;bundle-version="1.0.71" Bundle-Vendor: Xored software, Inc. diff --git a/org.fantom.compilerJava/build.fan b/org.fantom.compilerJava/build.fan index 07f7909..78a0dfc 100755 --- a/org.fantom.compilerJava/build.fan +++ b/org.fantom.compilerJava/build.fan @@ -17,7 +17,7 @@ class Build : BuildPod new make() { podName = "compilerJava" - version = Version("1.0.69") + version = Version("1.0.71") summary = "Compiler FFI Plugin for Java" meta = ["org.name": "Fantom", "org.uri": "http://fantom.org/", diff --git a/org.fantom.compilerJava/compilerJava.pod b/org.fantom.compilerJava/compilerJava.pod index 6b2a2c6..ce1d2fe 100644 Binary files a/org.fantom.compilerJava/compilerJava.pod and b/org.fantom.compilerJava/compilerJava.pod differ diff --git a/org.fantom.compilerJava/fan/JavaType.fan b/org.fantom.compilerJava/fan/JavaType.fan index 08eb7c0..96cc336 100755 --- a/org.fantom.compilerJava/fan/JavaType.fan +++ b/org.fantom.compilerJava/fan/JavaType.fan @@ -146,7 +146,7 @@ class JavaType : CType ** Classfile to use for loading const File? classfile - ** Modified for F4 to support content-assistance + protected virtual Void load() { if (loaded) return diff --git a/org.fantom.compilerJava/pom.xml b/org.fantom.compilerJava/pom.xml index acf00b2..d5cbed6 100644 --- a/org.fantom.compilerJava/pom.xml +++ b/org.fantom.compilerJava/pom.xml @@ -9,6 +9,6 @@ org.fantom org.fantom.compilerJava - 1.0.69-SNAPSHOT + 1.0.71-SNAPSHOT eclipse-plugin diff --git a/org.fantom.compilerJs/META-INF/MANIFEST.MF b/org.fantom.compilerJs/META-INF/MANIFEST.MF index def33e0..c245c29 100644 --- a/org.fantom.compilerJs/META-INF/MANIFEST.MF +++ b/org.fantom.compilerJs/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Fantom core pod CompilerJs Bundle-SymbolicName: org.fantom.compilerJs;singleton:=true -Bundle-Version: 1.0.69.qualifier -Require-Bundle: org.fantom.sys;bundle-version="1.0.69", - org.fantom.compiler;bundle-version="1.0.69" +Bundle-Version: 1.0.71.qualifier +Require-Bundle: org.fantom.sys;bundle-version="1.0.71", + org.fantom.compiler;bundle-version="1.0.71" Bundle-Vendor: Xored software, Inc. diff --git a/org.fantom.compilerJs/compilerJs.pod b/org.fantom.compilerJs/compilerJs.pod index 7b3a6b8..9d55912 100644 Binary files a/org.fantom.compilerJs/compilerJs.pod and b/org.fantom.compilerJs/compilerJs.pod differ diff --git a/org.fantom.compilerJs/pom.xml b/org.fantom.compilerJs/pom.xml index 288608e..7bb2b2a 100644 --- a/org.fantom.compilerJs/pom.xml +++ b/org.fantom.compilerJs/pom.xml @@ -9,6 +9,6 @@ org.fantom org.fantom.compilerJs - 1.0.69-SNAPSHOT + 1.0.71-SNAPSHOT eclipse-plugin diff --git a/org.fantom.concurrent/META-INF/MANIFEST.MF b/org.fantom.concurrent/META-INF/MANIFEST.MF index 0d37d2a..60bf559 100644 --- a/org.fantom.concurrent/META-INF/MANIFEST.MF +++ b/org.fantom.concurrent/META-INF/MANIFEST.MF @@ -2,6 +2,6 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Fantom core pod Concurrent Bundle-SymbolicName: org.fantom.concurrent;singleton:=true -Bundle-Version: 1.0.69.qualifier -Require-Bundle: org.fantom.sys;bundle-version="1.0.69" +Bundle-Version: 1.0.71.qualifier +Require-Bundle: org.fantom.sys;bundle-version="1.0.71" Bundle-Vendor: Xored software, Inc. diff --git a/org.fantom.concurrent/concurrent.pod b/org.fantom.concurrent/concurrent.pod index c275dca..068fabe 100644 Binary files a/org.fantom.concurrent/concurrent.pod and b/org.fantom.concurrent/concurrent.pod differ diff --git a/org.fantom.concurrent/pom.xml b/org.fantom.concurrent/pom.xml index d545428..a3c7bb9 100644 --- a/org.fantom.concurrent/pom.xml +++ b/org.fantom.concurrent/pom.xml @@ -9,6 +9,6 @@ org.fantom org.fantom.concurrent - 1.0.69-SNAPSHOT + 1.0.71-SNAPSHOT eclipse-plugin diff --git a/org.fantom.fandoc/META-INF/MANIFEST.MF b/org.fantom.fandoc/META-INF/MANIFEST.MF index 313a0b8..c49da78 100644 --- a/org.fantom.fandoc/META-INF/MANIFEST.MF +++ b/org.fantom.fandoc/META-INF/MANIFEST.MF @@ -2,6 +2,6 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Fantom core pod Fandoc Bundle-SymbolicName: org.fantom.fandoc;singleton:=true -Bundle-Version: 1.0.69.qualifier +Bundle-Version: 1.0.71.qualifier Bundle-Vendor: Xored software, Inc. -Require-Bundle: org.fantom.sys;bundle-version="1.0.69" +Require-Bundle: org.fantom.sys;bundle-version="1.0.71" diff --git a/org.fantom.fandoc/fandoc.pod b/org.fantom.fandoc/fandoc.pod index 2771a23..2a13008 100644 Binary files a/org.fantom.fandoc/fandoc.pod and b/org.fantom.fandoc/fandoc.pod differ diff --git a/org.fantom.fandoc/pom.xml b/org.fantom.fandoc/pom.xml index f501044..eb796eb 100644 --- a/org.fantom.fandoc/pom.xml +++ b/org.fantom.fandoc/pom.xml @@ -9,6 +9,6 @@ org.fantom org.fantom.fandoc - 1.0.69-SNAPSHOT + 1.0.71-SNAPSHOT eclipse-plugin diff --git a/org.fantom.fanr/META-INF/MANIFEST.MF b/org.fantom.fanr/META-INF/MANIFEST.MF index 33ea40a..ef1ceb1 100644 --- a/org.fantom.fanr/META-INF/MANIFEST.MF +++ b/org.fantom.fanr/META-INF/MANIFEST.MF @@ -2,9 +2,9 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Fantom core pod Fanr Bundle-SymbolicName: org.fantom.fanr;singleton:=true -Bundle-Version: 1.0.69.qualifier -Require-Bundle: org.fantom.sys;bundle-version="1.0.69", - org.fantom.concurrent;bundle-version="1.0.69", - org.fantom.util;bundle-version="1.0.69", - org.fantom.web;bundle-version="1.0.69" +Bundle-Version: 1.0.71.qualifier +Require-Bundle: org.fantom.sys;bundle-version="1.0.71", + org.fantom.concurrent;bundle-version="1.0.71", + org.fantom.util;bundle-version="1.0.71", + org.fantom.web;bundle-version="1.0.71" Bundle-Vendor: Xored software, Inc. diff --git a/org.fantom.fanr/fanr.pod b/org.fantom.fanr/fanr.pod index fb01c84..6adb33b 100644 Binary files a/org.fantom.fanr/fanr.pod and b/org.fantom.fanr/fanr.pod differ diff --git a/org.fantom.fanr/pom.xml b/org.fantom.fanr/pom.xml index d2aae27..b4c6c06 100644 --- a/org.fantom.fanr/pom.xml +++ b/org.fantom.fanr/pom.xml @@ -9,6 +9,6 @@ org.fantom org.fantom.fanr - 1.0.69-SNAPSHOT + 1.0.71-SNAPSHOT eclipse-plugin diff --git a/org.fantom.fwt/META-INF/MANIFEST.MF b/org.fantom.fwt/META-INF/MANIFEST.MF index c84bfbd..8155a94 100644 --- a/org.fantom.fwt/META-INF/MANIFEST.MF +++ b/org.fantom.fwt/META-INF/MANIFEST.MF @@ -2,11 +2,11 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Fantom core pod Fwt Bundle-SymbolicName: org.fantom.fwt;singleton:=true -Bundle-Version: 1.0.69.qualifier +Bundle-Version: 1.0.71.qualifier Bundle-RequiredExecutionEnvironment: J2SE-1.5 Require-Bundle: org.eclipse.swt, - org.fantom.sys;bundle-version="1.0.69", - org.fantom.concurrent;bundle-version="1.0.69", - org.fantom.gfx;bundle-version="1.0.69" + org.fantom.sys;bundle-version="1.0.71", + org.fantom.concurrent;bundle-version="1.0.71", + org.fantom.gfx;bundle-version="1.0.71" Export-Package: org.fantom.fwt.util Bundle-Vendor: Xored software, Inc. diff --git a/org.fantom.fwt/fwt.pod b/org.fantom.fwt/fwt.pod index 2484e49..217f289 100644 Binary files a/org.fantom.fwt/fwt.pod and b/org.fantom.fwt/fwt.pod differ diff --git a/org.fantom.fwt/pom.xml b/org.fantom.fwt/pom.xml index a3e32f9..495afef 100644 --- a/org.fantom.fwt/pom.xml +++ b/org.fantom.fwt/pom.xml @@ -9,6 +9,6 @@ org.fantom org.fantom.fwt - 1.0.69-SNAPSHOT + 1.0.71-SNAPSHOT eclipse-plugin diff --git a/org.fantom.fwt/source/fan/RichText.fan b/org.fantom.fwt/source/fan/RichText.fan index 2941c2e..7feab8c 100644 --- a/org.fantom.fwt/source/fan/RichText.fan +++ b/org.fantom.fwt/source/fan/RichText.fan @@ -142,6 +142,18 @@ class RichText : TextWidget set { model.text = it } } + ** + ** The current foreground color for text. + ** Defaults to null (system default) + ** + native Color? fg + + ** + ** The current background color of text field + ** Defaults to null (system default) + ** + native Color? bg + ////////////////////////////////////////////////////////////////////////// // Utils ////////////////////////////////////////////////////////////////////////// diff --git a/org.fantom.fwt/source/java/Fwt.java b/org.fantom.fwt/source/java/Fwt.java index 3a1fb09..3c3990d 100644 --- a/org.fantom.fwt/source/java/Fwt.java +++ b/org.fantom.fwt/source/java/Fwt.java @@ -68,6 +68,8 @@ private Fwt() {} // Display ////////////////////////////////////////////////////////////////////////// + public Display display() { return display; } + public void mainEventLoop(Shell shell) { eventLoop(shell); @@ -269,6 +271,11 @@ public void disposeAllCursors() // Images ////////////////////////////////////////////////////////////////////////// + /** + * Access to images cache + */ + public HashMap images() { return images; } + /** * Map a Fan Image to an SWT Image. */ diff --git a/org.fantom.fwt/source/java/RichTextPeer.java b/org.fantom.fwt/source/java/RichTextPeer.java index b04c2df..d2f8f27 100644 --- a/org.fantom.fwt/source/java/RichTextPeer.java +++ b/org.fantom.fwt/source/java/RichTextPeer.java @@ -162,6 +162,23 @@ public void run() public void set(Widget w, int v) { ((StyledText)w).setTabs(v); } }; + public fan.gfx.Color fg(RichText self) { return fg.get(); } + public void fg(RichText self, fan.gfx.Color v) { fg.set(v); } + public final Prop.ColorProp fg = new Prop.ColorProp(this) + { + public void set(Widget w, org.eclipse.swt.graphics.Color v) { ((StyledText)w).setForeground(v); } + }; + + public fan.gfx.Color bg(RichText self) { return bg.get(); } + public void bg(RichText self, fan.gfx.Color v) { bg.set(v); } + public final Prop.ColorProp bg = new Prop.ColorProp(this) + { + public void set(Widget w, org.eclipse.swt.graphics.Color v) { + ((StyledText)w).setBackground(v); + ((StyledText)w).setMarginColor(v); + } + }; + ////////////////////////////////////////////////////////////////////////// // Selection ////////////////////////////////////////////////////////////////////////// diff --git a/org.fantom.fwt/source/js/MenuItemPeer.js b/org.fantom.fwt/source/js/MenuItemPeer.js index d0bca2d..0fc7537 100644 --- a/org.fantom.fwt/source/js/MenuItemPeer.js +++ b/org.fantom.fwt/source/js/MenuItemPeer.js @@ -12,37 +12,7 @@ fan.fwt.MenuItemPeer = fan.sys.Obj.$extend(fan.fwt.WidgetPeer); fan.fwt.MenuItemPeer.prototype.$ctor = function(self) {} -// CSS -fan.fwt.WidgetPeer.addCss( - "div._fwt_MenuItem_ {" + - " font:" + fan.fwt.WidgetPeer.fontToCss(fan.fwt.DesktopPeer.$sysFont) + ";" + - " padding: 2px 12px 0px 12px;" + - " white-space: nowrap;" + - " -webkit-box-sizing: border-box;" + - " -moz-box-sizing: border-box;" + - " box-sizing: border-box;" + - "}" + - "div._fwt_MenuItem_ img {" + - " padding: 2px 4px 3px 0;" + - " vertical-align: middle;" + - "}" + - "div._fwt_MenuItem_.sep {" + - " margin: 6px 0 0 0;" + - " padding: 0 0 6px 0;" + - " border-top: 1px solid #dadada;" + - "}" + - "div._fwt_MenuItem_.disabled {" + - " color: #999;" + - "}" + - "div._fwt_MenuItem_:hover," + - "div._fwt_MenuItem_:focus {" + - " background: #3d80df;" + - " color: #fff;" + - "}" + - "div._fwt_MenuItem_.disabled:hover {" + - " background: none;" + - " color: #999;" + - "}"); +// see init.js for CSS fan.fwt.MenuItemPeer.prototype.selected = function(self) { return this.m_selected; } fan.fwt.MenuItemPeer.prototype.selected$ = function(self, val) { this.m_selected = val; } diff --git a/org.fantom.fwt/source/js/TabPanePeer.js b/org.fantom.fwt/source/js/TabPanePeer.js index eba6323..2a01a6a 100644 --- a/org.fantom.fwt/source/js/TabPanePeer.js +++ b/org.fantom.fwt/source/js/TabPanePeer.js @@ -9,7 +9,7 @@ /** * TabPanePeer. */ -fan.fwt.TabPanePeer = fan.sys.Obj.$extend(fan.fwt.PanePeer); +fan.fwt.TabPanePeer = fan.sys.Obj.$extend(fan.fwt.WidgetPeer); fan.fwt.TabPanePeer.prototype.$ctor = function(self) {} fan.fwt.TabPanePeer.prototype.selectedIndex = function(self) { return this.m_selectedIndex; } diff --git a/org.fantom.fwt/source/js/TablePeer.js b/org.fantom.fwt/source/js/TablePeer.js index 5ef8738..efb3ea4 100644 --- a/org.fantom.fwt/source/js/TablePeer.js +++ b/org.fantom.fwt/source/js/TablePeer.js @@ -10,6 +10,7 @@ // TableModel extensions // // fan.fwt.TableModel.prototype.$uri = function(col,row) { return null; } +// fan.fwt.TableModel.prototype.$uriTarget = function(col,row) { return null; } // fan.fwt.TableModel.prototype.$onMouseDown = function(col,row) {} // @@ -336,6 +337,11 @@ fan.fwt.TablePeer.prototype.rebuild = function(self) { var a = document.createElement("a"); a.href = uri.encode(); + + var target = null; + if (model.$uriTarget) target = model.$uriTarget(view.m_cols.get(c), view.m_rows.get(r)); + if (target != null) a.target = target; + node.appendChild(a); node = a; } diff --git a/org.fantom.fwt/source/js/init.js b/org.fantom.fwt/source/js/init.js index cc8ca80..0cbad65 100644 --- a/org.fantom.fwt/source/js/init.js +++ b/org.fantom.fwt/source/js/init.js @@ -18,6 +18,40 @@ fan.concurrent.Actor.locals().set("gfx.env", fan.fwt.FwtEnv.make()); fan.fwt.DesktopPeer.clipboard = function() { return fan.fwt.DesktopPeer.$clipboard; } fan.fwt.DesktopPeer.$clipboard = new fan.fwt.Clipboard(); +// +// fwt::MenuItem CSS +// +fan.fwt.WidgetPeer.addCss( + "div._fwt_MenuItem_ {" + + " font:" + fan.fwt.WidgetPeer.fontToCss(fan.fwt.DesktopPeer.sysFont()) + ";" + + " padding: 2px 12px 0px 12px;" + + " white-space: nowrap;" + + " -webkit-box-sizing: border-box;" + + " -moz-box-sizing: border-box;" + + " box-sizing: border-box;" + + "}" + + "div._fwt_MenuItem_ img {" + + " padding: 2px 4px 3px 0;" + + " vertical-align: middle;" + + "}" + + "div._fwt_MenuItem_.sep {" + + " margin: 6px 0 0 0;" + + " padding: 0 0 6px 0;" + + " border-top: 1px solid #dadada;" + + "}" + + "div._fwt_MenuItem_.disabled {" + + " color: #999;" + + "}" + + "div._fwt_MenuItem_:hover," + + "div._fwt_MenuItem_:focus {" + + " background: #3d80df;" + + " color: #fff;" + + "}" + + "div._fwt_MenuItem_.disabled:hover {" + + " background: none;" + + " color: #999;" + + "}"); + // // fwt::Combo CSS // @@ -64,7 +98,7 @@ fan.fwt.WidgetPeer.addCss( " height: 19px;" + " padding: 5px 6px 4px 6px;" + " color: #fff;" + - " font: " + fan.fwt.WidgetPeer.fontToCss(fan.fwt.DesktopPeer.$sysFont) + ";" + + " font: " + fan.fwt.WidgetPeer.fontToCss(fan.fwt.DesktopPeer.sysFont()) + ";" + // " textShadow: 0 -1px 1px #1c1c1c;" + " text-align: center;" + " border-bottom: 1px solid #282828;" + diff --git a/org.fantom.gfx/META-INF/MANIFEST.MF b/org.fantom.gfx/META-INF/MANIFEST.MF index e1f91f8..ea7bca9 100644 --- a/org.fantom.gfx/META-INF/MANIFEST.MF +++ b/org.fantom.gfx/META-INF/MANIFEST.MF @@ -2,8 +2,8 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Fantom core pod Gfx Bundle-SymbolicName: org.fantom.gfx;singleton:=true -Bundle-Version: 1.0.69.qualifier +Bundle-Version: 1.0.71.qualifier Bundle-RequiredExecutionEnvironment: J2SE-1.5 -Require-Bundle: org.fantom.sys;bundle-version="1.0.69", - org.fantom.concurrent;bundle-version="1.0.69" +Require-Bundle: org.fantom.sys;bundle-version="1.0.71", + org.fantom.concurrent;bundle-version="1.0.71" Bundle-Vendor: Xored software, Inc. diff --git a/org.fantom.gfx/gfx.pod b/org.fantom.gfx/gfx.pod index 403f664..0fc7e92 100644 Binary files a/org.fantom.gfx/gfx.pod and b/org.fantom.gfx/gfx.pod differ diff --git a/org.fantom.gfx/pom.xml b/org.fantom.gfx/pom.xml index 7eca2d0..9f8bad6 100644 --- a/org.fantom.gfx/pom.xml +++ b/org.fantom.gfx/pom.xml @@ -9,6 +9,6 @@ org.fantom org.fantom.gfx - 1.0.69-SNAPSHOT + 1.0.71-SNAPSHOT eclipse-plugin diff --git a/org.fantom.inet/META-INF/MANIFEST.MF b/org.fantom.inet/META-INF/MANIFEST.MF index 5530465..782dccf 100644 --- a/org.fantom.inet/META-INF/MANIFEST.MF +++ b/org.fantom.inet/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Fantom core pod Inet Bundle-SymbolicName: org.fantom.inet;singleton:=true -Bundle-Version: 1.0.69.qualifier -Require-Bundle: org.fantom.sys;bundle-version="1.0.69", - org.fantom.concurrent;bundle-version="1.0.69" +Bundle-Version: 1.0.71.qualifier +Require-Bundle: org.fantom.sys;bundle-version="1.0.71", + org.fantom.concurrent;bundle-version="1.0.71" Bundle-Vendor: Xored software, Inc. diff --git a/org.fantom.inet/inet.pod b/org.fantom.inet/inet.pod index 20fd5bf..3230b75 100644 Binary files a/org.fantom.inet/inet.pod and b/org.fantom.inet/inet.pod differ diff --git a/org.fantom.inet/pom.xml b/org.fantom.inet/pom.xml index 40b8057..7181d08 100644 --- a/org.fantom.inet/pom.xml +++ b/org.fantom.inet/pom.xml @@ -9,6 +9,6 @@ org.fantom org.fantom.inet - 1.0.69-SNAPSHOT + 1.0.71-SNAPSHOT eclipse-plugin diff --git a/org.fantom.sys/META-INF/MANIFEST.MF b/org.fantom.sys/META-INF/MANIFEST.MF index 3f12c05..eab3e97 100644 --- a/org.fantom.sys/META-INF/MANIFEST.MF +++ b/org.fantom.sys/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %Bundle-Name Bundle-SymbolicName: org.fantom.sys;singleton:=true -Bundle-Version: 1.0.69.qualifier +Bundle-Version: 1.0.71.qualifier Bundle-Vendor: %Bundle-Vendor Bundle-Localization: plugin Bundle-RequiredExecutionEnvironment: J2SE-1.5 @@ -16,6 +16,6 @@ Export-Package: fan.sys, fanx.util, org.fantom.internal.sys Require-Bundle: org.eclipse.core.runtime, - org.fantom;bundle-version="1.0.69";visibility:=reexport + org.fantom;bundle-version="1.0.71";visibility:=reexport Bundle-Activator: org.fantom.internal.sys.Activator Bundle-ActivationPolicy: lazy diff --git a/org.fantom.sys/env-diff.patch b/org.fantom.sys/env-diff.patch deleted file mode 100644 index 25aad54..0000000 --- a/org.fantom.sys/env-diff.patch +++ /dev/null @@ -1,229 +0,0 @@ -### Eclipse Workspace Patch 1.0 -#P org.fantom.sys -Index: src/fan/sys/BootEnv.java -=================================================================== -RCS file: /cvsroot/fantom/runtime/org.fantom.sys/src/fan/sys/BootEnv.java,v -retrieving revision 1.3 -diff -u -r1.3 BootEnv.java ---- src/fan/sys/BootEnv.java 18 Nov 2010 08:43:36 -0000 1.3 -+++ src/fan/sys/BootEnv.java 18 Nov 2010 08:50:04 -0000 -@@ -228,7 +228,7 @@ - } - } - -- public Class loadJavaClass(String className) -+ public Class loadJavaClass(String className, String callingPod) - throws Exception - { - // handle primitives, these don't get handled by URLClassLoader -@@ -247,8 +247,15 @@ - } - - // route to extention classloader -- return FanClassLoader.extClassLoader.loadClass(className); -+ return getJavaClassLoader(callingPod).loadClass(className); - } -+ -+ @Override -+ public ClassLoader getJavaClassLoader(String pod) -+ { -+ return FanClassLoader.extClassLoader; -+ } -+ - - ////////////////////////////////////////////////////////////////////////// - // Fields -Index: src/fan/sys/Env.java -=================================================================== -RCS file: /cvsroot/fantom/runtime/org.fantom.sys/src/fan/sys/Env.java,v -retrieving revision 1.3 -diff -u -r1.3 Env.java ---- src/fan/sys/Env.java 18 Nov 2010 08:43:36 -0000 1.3 -+++ src/fan/sys/Env.java 18 Nov 2010 08:50:04 -0000 -@@ -201,10 +201,15 @@ - * Load the Java class of a FFI JavaType. - * Default implementation delegates to parent. - */ -- public Class loadJavaClass(String className) -+ public Class loadJavaClass(String className, String callingPod) - throws Exception - { -- return parent.loadJavaClass(className); -+ return parent.loadJavaClass(className, callingPod); -+ } -+ -+ public ClassLoader getJavaClassLoader(String callingPod) -+ { -+ return parent.getJavaClassLoader(callingPod); - } - - /** -@@ -240,7 +245,7 @@ - * The JavaType will delegate to `loadJavaClass` when it is time - * to load the Java class mapped by the FFI type. - */ -- public final JavaType loadJavaType(String podName, String typeName) -+ public final JavaType loadJavaType(String podName, String typeName, String callingPod) - { - // we shouldn't be using this method for pure Fantom types - if (!podName.startsWith("[java]")) -@@ -260,7 +265,7 @@ - if (t != null) return t; - - // create a new one -- t = new JavaType(this, podName, typeName); -+ t = new JavaType(this, podName, typeName, callingPod); - javaTypeCache.put(clsName, t); - return t; - } -Index: src/fan/sys/FanClassLoader.java -=================================================================== -RCS file: /cvsroot/fantom/runtime/org.fantom.sys/src/fan/sys/FanClassLoader.java,v -retrieving revision 1.3 -diff -u -r1.3 FanClassLoader.java ---- src/fan/sys/FanClassLoader.java 18 Nov 2010 08:43:36 -0000 1.3 -+++ src/fan/sys/FanClassLoader.java 18 Nov 2010 08:50:04 -0000 -@@ -29,7 +29,7 @@ - - public FanClassLoader(Pod pod) - { -- super(new URL[0], extClassLoader); -+ super(new URL[0], pod.name == "sys" ? FanClassLoader.class.getClassLoader() : Env.cur().getJavaClassLoader(pod.name)); - try - { - this.pod = pod; -Index: src/fan/sys/JavaType.java -=================================================================== -RCS file: /cvsroot/fantom/runtime/org.fantom.sys/src/fan/sys/JavaType.java,v -retrieving revision 1.3 -diff -u -r1.3 JavaType.java ---- src/fan/sys/JavaType.java 18 Nov 2010 08:43:36 -0000 1.3 -+++ src/fan/sys/JavaType.java 18 Nov 2010 08:50:04 -0000 -@@ -24,12 +24,13 @@ - // Constructor - ////////////////////////////////////////////////////////////////////////// - -- JavaType(Env env, String podName, String typeName) -+ JavaType(Env env, String podName, String typeName, String callingPod) - { - this.env = env; - this.podName = podName; - this.typeName = typeName; - this.cls = null; -+ this.callingPod = callingPod; - } - - JavaType(Env env, Class cls) -@@ -127,7 +128,7 @@ - try - { - if (cls == null) -- cls = env.loadJavaClass(toClassName(podName, typeName)); -+ cls = env.loadJavaClass(toClassName(podName, typeName), callingPod); - return cls; - } - catch (Exception e) -@@ -539,6 +540,7 @@ - private Env env; // ctor - private String podName; // ctor - private String typeName; // ctor -+ private String callingPod; // ctor - private Type nullable; // toNullable() - private Class cls; // init() - private int flags = -1; // init() -Index: src/fan/sys/Pod.java -=================================================================== -RCS file: /cvsroot/fantom/runtime/org.fantom.sys/src/fan/sys/Pod.java,v -retrieving revision 1.3 -diff -u -r1.3 Pod.java ---- src/fan/sys/Pod.java 18 Nov 2010 08:43:36 -0000 1.3 -+++ src/fan/sys/Pod.java 18 Nov 2010 08:50:04 -0000 -@@ -475,7 +475,7 @@ - String typeName = ref.typeName; - if (podName.startsWith("[java]")) - { -- Type t = Env.cur().loadJavaType(podName, typeName); -+ Type t = Env.cur().loadJavaType(podName, typeName, name); - if (ref.isNullable()) t = t.toNullable(); - return t; - } -Index: src/fan/sys/Type.java -=================================================================== -RCS file: /cvsroot/fantom/runtime/org.fantom.sys/src/fan/sys/Type.java,v -retrieving revision 1.3 -diff -u -r1.3 Type.java ---- src/fan/sys/Type.java 18 Nov 2010 08:43:36 -0000 1.3 -+++ src/fan/sys/Type.java 18 Nov 2010 08:50:04 -0000 -@@ -50,7 +50,14 @@ - - public Type typeof() { return Sys.TypeType; } - -- public String podName() { return pod().name(); } -+ public String podName() -+ { -+ if(pod() == null) -+ { -+ int breakpoint = 1; -+ } -+ return pod().name(); -+ } - public abstract Pod pod(); - public abstract String name(); - public abstract String qname(); -Index: src/fanx/emit/FFacetEmit.java -=================================================================== -RCS file: /cvsroot/fantom/runtime/org.fantom.sys/src/fanx/emit/FFacetEmit.java,v -retrieving revision 1.3 -diff -u -r1.3 FFacetEmit.java ---- src/fanx/emit/FFacetEmit.java 18 Nov 2010 08:43:36 -0000 1.3 -+++ src/fanx/emit/FFacetEmit.java 18 Nov 2010 08:50:04 -0000 -@@ -270,7 +270,7 @@ - throws Exception - { - if (curClass == null) -- curClass = Env.cur().loadJavaClass(curType.jname().replace("/", ".")); -+ curClass = Env.cur().loadJavaClass(curType.jname().replace("/", "."), pod.podName); - return curClass; - } - -Index: src/fanx/emit/FPodEmit.java -=================================================================== -RCS file: /cvsroot/fantom/runtime/org.fantom.sys/src/fanx/emit/FPodEmit.java,v -retrieving revision 1.3 -diff -u -r1.3 FPodEmit.java ---- src/fanx/emit/FPodEmit.java 18 Nov 2010 08:43:36 -0000 1.3 -+++ src/fanx/emit/FPodEmit.java 18 Nov 2010 08:50:04 -0000 -@@ -58,7 +58,7 @@ - for (int i=0; i - + diff --git a/org.fantom.sys/pom.xml b/org.fantom.sys/pom.xml index c08ac21..1585955 100644 --- a/org.fantom.sys/pom.xml +++ b/org.fantom.sys/pom.xml @@ -9,6 +9,6 @@ org.fantom org.fantom.sys - 1.0.69-SNAPSHOT + 1.0.71-SNAPSHOT eclipse-plugin diff --git a/org.fantom.sys/src/fan/sys/BootEnv.java b/org.fantom.sys/src/fan/sys/BootEnv.java index 3eefb97..00c03de 100644 --- a/org.fantom.sys/src/fan/sys/BootEnv.java +++ b/org.fantom.sys/src/fan/sys/BootEnv.java @@ -83,10 +83,18 @@ private static String initHost() { return java.net.InetAddress.getLocalHost().getHostName(); } - catch (Throwable e) + catch (Throwable e) {} + + try { - return "unknown"; + // fallbacks if DNS resolution fails + String s; + s = System.getenv("HOSTNAME"); if (s != null) return s; + s = System.getenv("FAN_HOSTNAME"); if (s != null) return s; } + catch (Throwable e) {} + + return "unknown"; } private static String initUser() diff --git a/org.fantom.sys/src/fan/sys/Buf.java b/org.fantom.sys/src/fan/sys/Buf.java index 0262417..df75609 100644 --- a/org.fantom.sys/src/fan/sys/Buf.java +++ b/org.fantom.sys/src/fan/sys/Buf.java @@ -213,23 +213,23 @@ public boolean close() return true; } - public final Endian endian() + public Endian endian() { return out.endian(); } - public final void endian(Endian endian) + public void endian(Endian endian) { out.endian(endian); in.endian(endian); } - public final Charset charset() + public Charset charset() { return out.charset(); } - public final void charset(Charset charset) + public void charset(Charset charset) { out.charset(charset); in.charset(charset); @@ -344,7 +344,7 @@ public final Buf fill(long b, long times) public final String readStrToken() { return in.readStrToken(); } public final String readStrToken(Long max) { return in.readStrToken(max); } - public final String readStrToken(Long max, Func f) { return in.readStrToken(FanInt.Chunk, f); } + public final String readStrToken(Long max, Func f) { return in.readStrToken(max, f); } public final List readAllLines() { return in.readAllLines(); } diff --git a/org.fantom.sys/src/fan/sys/Charset.java b/org.fantom.sys/src/fan/sys/Charset.java index 14ea466..656e757 100644 --- a/org.fantom.sys/src/fan/sys/Charset.java +++ b/org.fantom.sys/src/fan/sys/Charset.java @@ -119,18 +119,20 @@ public int decode(InStream in) { int c = in.r(); if (c < 0) return -1; - int c2, c3; + int c2, c3, c4; switch (c >> 4) { case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: /* 0xxxxxxx*/ return c; + case 12: case 13: /* 110x xxxx 10xx xxxx*/ c2 = in.r(); if ((c2 & 0xC0) != 0x80) throw IOErr.make("Invalid UTF-8 encoding"); return ((c & 0x1F) << 6) | (c2 & 0x3F); + case 14: /* 1110 xxxx 10xx xxxx 10xx xxxx */ c2 = in.r(); @@ -138,6 +140,19 @@ public int decode(InStream in) if (((c2 & 0xC0) != 0x80) || ((c3 & 0xC0) != 0x80)) throw IOErr.make("Invalid UTF-8 encoding"); return (((c & 0x0F) << 12) | ((c2 & 0x3F) << 6) | ((c3 & 0x3F) << 0)); + + case 15: + /* 1111 0xxx 10xx xxxx 10xx xxxx 10xx xxxx */ + c2 = in.r(); + c3 = in.r(); + c4 = in.r(); + if (((c2 & 0xC0) != 0x80) || ((c3 & 0xC0) != 0x80) || ((c4 & 0xC0) != 0x80)) + throw IOErr.make("Invalid UTF-8 encoding"); + // Java can't handle chars in this upper / extended range + // so return a replacement character instead + // see https://en.wikipedia.org/wiki/Specials_(Unicode_block)#Replacement_character + return 0xFFFD; + default: throw IOErr.make("Invalid UTF-8 encoding"); } diff --git a/org.fantom.sys/src/fan/sys/ConstBuf.java b/org.fantom.sys/src/fan/sys/ConstBuf.java index 7d8f391..392181d 100644 --- a/org.fantom.sys/src/fan/sys/ConstBuf.java +++ b/org.fantom.sys/src/fan/sys/ConstBuf.java @@ -21,12 +21,14 @@ public final class ConstBuf // Constructor ////////////////////////////////////////////////////////////////////////// - public ConstBuf(byte[] bytes, int size) + public ConstBuf(byte[] bytes, int size, Endian endian, Charset charset) { - this.buf = bytes; - this.size = size; - this.in = errInStream; - this.out = errOutStream; + this.buf = bytes; + this.size = size; + this.in = errInStream; + this.out = errOutStream; + this.endian = endian; + this.charset = charset; } ////////////////////////////////////////////////////////////////////////// @@ -45,7 +47,7 @@ public ConstBuf(byte[] bytes, int size) public InStream in() { - return new ConstBufInStream(); + return new ConstBufInStream(this); } public final long size() @@ -145,6 +147,14 @@ public final int pipeFrom(ByteBuffer src, int len) public final Buf trim() { throw err(); } + public Endian endian() { return endian; } + + public void endian(Endian endian) { throw err(); } + + public Charset charset() { return charset; } + + public void charset(Charset charset) { throw err(); } + ////////////////////////////////////////////////////////////////////////// // Utils ////////////////////////////////////////////////////////////////////////// @@ -251,6 +261,12 @@ static class ErrInStream extends InStream class ConstBufInStream extends InStream { + ConstBufInStream(ConstBuf buf) + { + endian(buf.endian); + charset(buf.charset); + } + public Long read() { int n = r(); return n < 0 ? null : FanInt.pos[n]; } public int r() { @@ -308,7 +324,9 @@ public long skip(long n) // Fields ////////////////////////////////////////////////////////////////////////// - byte[] buf; - int size; + final byte[] buf; + final int size; + final Endian endian; + final Charset charset; } \ No newline at end of file diff --git a/org.fantom.sys/src/fan/sys/DateTimeStr.java b/org.fantom.sys/src/fan/sys/DateTimeStr.java index 0c49821..89c1cfe 100644 --- a/org.fantom.sys/src/fan/sys/DateTimeStr.java +++ b/org.fantom.sys/src/fan/sys/DateTimeStr.java @@ -79,6 +79,7 @@ public String format() // literals if (c == '\'') { + int numLiterals = 0; while (true) { ++i; @@ -86,7 +87,9 @@ public String format() c = pattern.charAt(i); if (c == '\'') break; s.append((char)c); + numLiterals++; } + if (numLiterals == 0) s.append((char)'\''); continue; } @@ -505,13 +508,22 @@ private void parse(String s) break; case '\'': - while (true) + if (n == 2) // '' means one ' { - int expected = pattern.charAt(++i); - if (expected == '\'') break; int actual = str.charAt(pos++); - if (actual != expected) - throw new RuntimeException("Expected '" + (char)expected + "', not '" + (char)actual + "' [pos " + pos +"]"); + if (actual != '\'') + throw new RuntimeException("Expected single quote, not '" + (char)actual + "' [pos " + pos +"]"); + } + else + { + while (true) + { + int expected = pattern.charAt(++i); + if (expected == '\'') break; + int actual = str.charAt(pos++); + if (actual != expected) + throw new RuntimeException("Expected '" + (char)expected + "', not '" + (char)actual + "' [pos " + pos +"]"); + } } break; diff --git a/org.fantom.sys/src/fan/sys/Depend.java b/org.fantom.sys/src/fan/sys/Depend.java index 3012a54..a6c6f76 100644 --- a/org.fantom.sys/src/fan/sys/Depend.java +++ b/org.fantom.sys/src/fan/sys/Depend.java @@ -226,6 +226,12 @@ public final Version version(long index) return constraints[(int)index].version; } + public final boolean isSimple() { return isSimple(0L); } + public final boolean isSimple(long index) + { + return !isPlus(index) && !isRange(index); + } + public final boolean isPlus() { return isPlus(0L); } public final boolean isPlus(long index) { diff --git a/org.fantom.sys/src/fan/sys/Err.java b/org.fantom.sys/src/fan/sys/Err.java index f5245a8..7423d7c 100644 --- a/org.fantom.sys/src/fan/sys/Err.java +++ b/org.fantom.sys/src/fan/sys/Err.java @@ -147,7 +147,7 @@ public String toStr() // Trace ////////////////////////////////////////////////////////////////////////// - public Err trace() { return trace(Env.cur().out(), null, 0, toJava()); } + public Err trace() { return trace(Env.cur().err(), null, 0, toJava()); } public Err trace(OutStream out) { return trace(out, null, 0, toJava()); } public Err trace(OutStream out, Map opt) { return trace(out, opt, optToIndent(opt), toJava()); } diff --git a/org.fantom.sys/src/fan/sys/FanDecimal.java b/org.fantom.sys/src/fan/sys/FanDecimal.java index cba314b..e34921f 100644 --- a/org.fantom.sys/src/fan/sys/FanDecimal.java +++ b/org.fantom.sys/src/fan/sys/FanDecimal.java @@ -160,7 +160,9 @@ public static String toLocale(BigDecimal self, String pattern, Locale locale) // get default pattern if necessary if (pattern == null) - pattern = Env.cur().locale(Sys.sysPod, "decimal", "#,###.0##", locale); + { + return FanFloat.toLocale(self.doubleValue(), pattern, locale); + } // parse pattern and get digits NumPattern p = NumPattern.parse(pattern); diff --git a/org.fantom.sys/src/fan/sys/FanFloat.java b/org.fantom.sys/src/fan/sys/FanFloat.java index 43f9ae0..f4908ee 100644 --- a/org.fantom.sys/src/fan/sys/FanFloat.java +++ b/org.fantom.sys/src/fan/sys/FanFloat.java @@ -105,6 +105,16 @@ public static boolean isNaN(double self) return Double.isNaN(self); } + public static boolean isNegZero(double self) + { + return bits(self) == 0x8000000000000000L; + } + + public static double normNegZero(double self) + { + return bits(self) == 0x8000000000000000L ? 0f : self; + } + public static long hash(double self) { return bits(self); @@ -329,7 +339,13 @@ public static String toLocale(double self, String pattern, Locale locale) // get default pattern if necessary if (pattern == null) - pattern = Env.cur().locale(Sys.sysPod, "float", "#,###.0##", locale); + { + // If large, then route to FanInt.toLocale + if (Math.abs(self) >= 100d) + return FanInt.toLocale(Math.round(self), null, locale); + + pattern = toDefaultLocalePattern(self); + } // TODO: if value is < 10^-3 or > 10^7 it will be // converted to exponent string, so just bail on that @@ -346,11 +362,30 @@ public static String toLocale(double self, String pattern, Locale locale) } catch (Exception e) { - e.printStackTrace(); + //e.printStackTrace(); return String.valueOf(self); } } + static String toDefaultLocalePattern(final double self) + { + final double abs = Math.abs(self); + final double fabs = Math.floor(abs); + + if (fabs >= 10d) return "#0.0#"; + if (fabs >= 1d) return "#0.0##"; + + // format a fractional number (no decimal part) + final double frac = abs - fabs; + if (frac < 0.00000001d) return "0.0"; + if (frac < 0.0000001d) return "0.0000000##"; + if (frac < 0.000001d) return "0.000000##"; + if (frac < 0.00001d) return "0.00000##"; + if (frac < 0.0001d) return "0.0000##"; + if (frac < 0.001d) return "0.000##"; + return "0.0##"; + } + ////////////////////////////////////////////////////////////////////////// // Fields ////////////////////////////////////////////////////////////////////////// diff --git a/org.fantom.sys/src/fan/sys/FanStr.java b/org.fantom.sys/src/fan/sys/FanStr.java index fafc80d..aa73a64 100644 --- a/org.fantom.sys/src/fan/sys/FanStr.java +++ b/org.fantom.sys/src/fan/sys/FanStr.java @@ -176,6 +176,7 @@ public static String plus(String self, Object obj) { if (obj == null) return self.concat("null"); String x = FanObj.toStr(obj); + if (self.length() == 0) return x; if (x.length() == 0) return self; return self.concat(x); } diff --git a/org.fantom.sys/src/fan/sys/File.java b/org.fantom.sys/src/fan/sys/File.java index 7fd3cdb..d8fabd2 100644 --- a/org.fantom.sys/src/fan/sys/File.java +++ b/org.fantom.sys/src/fan/sys/File.java @@ -138,6 +138,8 @@ public boolean isEmpty() public abstract DateTime modified(); public abstract void modified(DateTime time); + public boolean isHidden() { return false; } + public abstract String osPath(); public abstract File parent(); @@ -276,7 +278,7 @@ else if (exclude instanceof Func) } else if (overwrite instanceof Func) { - if (!((Func)overwrite).callBool(to)) return; + if (!((Func)overwrite).callBool(to, this)) return; } else { diff --git a/org.fantom.sys/src/fan/sys/InStream.java b/org.fantom.sys/src/fan/sys/InStream.java index 7f46424..ea7c2d8 100644 --- a/org.fantom.sys/src/fan/sys/InStream.java +++ b/org.fantom.sys/src/fan/sys/InStream.java @@ -406,6 +406,7 @@ public Charset charset() public void charset(Charset charset) { + if (this.charset == charset) return; this.charsetDecoder = charset.newDecoder(); this.charsetEncoder = charset.newEncoder(); this.charset = charset; @@ -448,7 +449,7 @@ public String readChars(long n) return buf.toString(); } - public String readLine() { return readLine(FanInt.Chunk); } + public String readLine() { return readLine(null); } public String readLine(Long max) { // max limit @@ -491,7 +492,7 @@ public String readLine(Long max) return buf.toString(); } - public String readStrToken() { return readStrToken(FanInt.Chunk, null); } + public String readStrToken() { return readStrToken(null, null); } public String readStrToken(Long max) { return readStrToken(max, null); } public String readStrToken(Long max, Func f) { @@ -530,7 +531,7 @@ public String readStrToken(Long max, Func f) return buf.toString(); } - public String readNullTerminatedStr() { return readNullTerminatedStr(FanInt.Chunk); } + public String readNullTerminatedStr() { return readNullTerminatedStr(null); } public String readNullTerminatedStr(Long max) { // max limit diff --git a/org.fantom.sys/src/fan/sys/List.java b/org.fantom.sys/src/fan/sys/List.java index df97986..9acec68 100644 --- a/org.fantom.sys/src/fan/sys/List.java +++ b/org.fantom.sys/src/fan/sys/List.java @@ -823,6 +823,25 @@ public final List map(Func f) return acc; } + public final List flatMap(Func f) + { + Type r = f.returns(); + Type of = Sys.ObjType.toNullable(); + if (r instanceof ListType) of = ((ListType)r).v; + List acc = new List(of, (int)size()); + if (f.arity() == 1) + { + for (int i=0; i=len) throw ArgErr.make("Invalid Uri esc: " + path); + c = path.charAt(i); + if (c == '.') throw ArgErr.make("Invalid Uri esc: " + path); } - else if (s != null) s.append((char)c); + s.append((char)c); } - return s == null ? path : s.toString(); + return s.toString(); } public static String fileNameToUriName(String name) @@ -211,6 +222,8 @@ public void modified(DateTime time) file.setLastModified(time.toJava()); } + public boolean isHidden() { return file.isHidden(); } + public String osPath() { return file.getPath(); @@ -279,7 +292,7 @@ public FileStore store() { try { - return new LocalFileStore(this.file); + return new LocalFileStore(java.nio.file.Files.getFileStore(this.file.toPath())); } catch (java.io.IOException e) { @@ -287,6 +300,38 @@ public FileStore store() } } +////////////////////////////////////////////////////////////////////////// +// Trap +////////////////////////////////////////////////////////////////////////// + + public Object trap(String name, List args) + { + // undocumented local file access + Object arg = args == null ? null : args.first(); + if (name.equals("readable")) return trapReadable(arg); + if (name.equals("writable")) return trapWritable(arg); + if (name.equals("executable")) return trapExecutable(arg); + return super.trap(name, args); + } + + private Object trapReadable(Object arg) + { + if (arg == null) return this.file.canRead(); + else return this.file.setReadable((Boolean)arg); + } + + private Object trapWritable(Object arg) + { + if (arg == null) return this.file.canWrite(); + else return this.file.setWritable((Boolean)arg); + } + + private Object trapExecutable(Object arg) + { + if (arg == null) return this.file.canExecute(); + else return this.file.setExecutable((Boolean)arg); + } + ////////////////////////////////////////////////////////////////////////// // File Management ////////////////////////////////////////////////////////////////////////// @@ -372,17 +417,24 @@ public File moveTo(File to) public void delete() { - if (!exists()) return; - - if (file.isDirectory()) + if (exists() && file.isDirectory()) { List kids = list(); for (int i=0; i 0; + this.fs = fs; } public Long totalSpace() { - return spaceKnown ? file.getTotalSpace() : null; + try + { + return fs.getTotalSpace(); + } + catch (java.io.IOException e) + { + return null; + } } public Long availSpace() { - return spaceKnown ? file.getUsableSpace() : null; + try + { + return fs.getUsableSpace(); + } + catch (java.io.IOException e) + { + return null; + } } public Long freeSpace() { - return spaceKnown ? file.getFreeSpace() : null; + try + { + return fs.getUnallocatedSpace(); + } + catch (java.io.IOException e) + { + return null; + } } public Type typeof() { return Sys.LocalFileStoreType; } - final java.io.File file; - final boolean spaceKnown; + final java.nio.file.FileStore fs; } \ No newline at end of file diff --git a/org.fantom.sys/src/fan/sys/Locale.java b/org.fantom.sys/src/fan/sys/Locale.java index 0ba6240..ee068f3 100644 --- a/org.fantom.sys/src/fan/sys/Locale.java +++ b/org.fantom.sys/src/fan/sys/Locale.java @@ -175,7 +175,7 @@ Month monthByName(String name) { String lang = java.util.Locale.getDefault().getLanguage(); String country = java.util.Locale.getDefault().getCountry(); - if (country == null && country.length() == 0) + if (country == null || country.length() == 0) x = fromStr(lang); else x = fromStr(lang + "-" + country); diff --git a/org.fantom.sys/src/fan/sys/MemBuf.java b/org.fantom.sys/src/fan/sys/MemBuf.java index 8e7963e..bca7fde 100644 --- a/org.fantom.sys/src/fan/sys/MemBuf.java +++ b/org.fantom.sys/src/fan/sys/MemBuf.java @@ -52,7 +52,7 @@ public final Object toImmutable() int size = this.size; this.buf = emptyBytes; this.size = 0; - return new ConstBuf(buf, size); + return new ConstBuf(buf, size, endian(), charset()); } ////////////////////////////////////////////////////////////////////////// diff --git a/org.fantom.sys/src/fan/sys/Method.java b/org.fantom.sys/src/fan/sys/Method.java index 34a77d5..cf456b2 100644 --- a/org.fantom.sys/src/fan/sys/Method.java +++ b/org.fantom.sys/src/fan/sys/Method.java @@ -155,6 +155,20 @@ class MethodFunc extends Func { MethodFunc(Type returns) { this.returns = returns; } + public Type typeof() + { + // lazily build FuncType for the method + if (this.funcType == null) + { + Type[] p = new Type[params.sz()]; + for (int i=0; i=str.length()) throw ArgErr.make("Invalid esc: " + str); + c = str.charAt(i); + } + buf.append((char)c); + } + return buf.toString(); + } + + private static int sectionToMask(long section) + { + switch ((int)section) + { + case 1: return PATH; + case 2: return QUERY; + case 3: return FRAG; + default: throw ArgErr.make("Invalid section flag: " + section); + } + } + + public static final long sectionPath = 1; + public static final long sectionQuery = 2; + public static final long sectionFrag = 3; + ////////////////////////////////////////////////////////////////////////// // Java Constructors ////////////////////////////////////////////////////////////////////////// @@ -184,6 +256,7 @@ private void normalizePath() String seg = (String)path.get(i); if (seg.equals(".") && (path.sz() > 1 || host != null)) { + if (path.isRO()) path = path.rw(); path.removeAt(i); modified = true; dotLast = true; @@ -191,6 +264,7 @@ private void normalizePath() } else if (seg.equals("..") && i > 0 && !path.get(i-1).toString().equals("..")) { + if (path.isRO()) path = path.rw(); path.removeAt(i); path.removeAt(i-1); modified = true; @@ -416,6 +490,11 @@ private List pathSegments(String pathStr, int numSegs) return new List(Sys.StrType, path); } + String decodeToken(int mask) + { + return substring(0, str.length(), mask); + } + Map decodeQuery() { return parseQuery(substring(0, str.length(), QUERY)); @@ -509,16 +588,33 @@ private String toQueryStr(String q, int start, int end, boolean escaped) private String substring(int start, int end, int section) { - if (!decoding) return str.substring(start, end); - StringBuilder buf = new StringBuilder(end-start); - dpos = start; - while (dpos < end) + if (!decoding) { - int ch = nextChar(section); - if (nextCharWasEscaped && ch < delimEscMap.length && (delimEscMap[ch] & section) != 0) - buf.append('\\'); - buf.append((char)ch); + int last = 0; + for (int i=start; i org.fantom org.fantom.util - 1.0.69-SNAPSHOT + 1.0.71-SNAPSHOT eclipse-plugin diff --git a/org.fantom.util/util.pod b/org.fantom.util/util.pod index 961d3b3..81af1a5 100644 Binary files a/org.fantom.util/util.pod and b/org.fantom.util/util.pod differ diff --git a/org.fantom.web/META-INF/MANIFEST.MF b/org.fantom.web/META-INF/MANIFEST.MF index 84a6c9b..b654e89 100644 --- a/org.fantom.web/META-INF/MANIFEST.MF +++ b/org.fantom.web/META-INF/MANIFEST.MF @@ -2,8 +2,8 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Fantom core pod Web Bundle-SymbolicName: org.fantom.web;singleton:=true -Bundle-Version: 1.0.69.qualifier -Require-Bundle: org.fantom.sys;bundle-version="1.0.69", - org.fantom.concurrent;bundle-version="1.0.69", - org.fantom.inet;bundle-version="1.0.69" +Bundle-Version: 1.0.71.qualifier +Require-Bundle: org.fantom.sys;bundle-version="1.0.71", + org.fantom.concurrent;bundle-version="1.0.71", + org.fantom.inet;bundle-version="1.0.71" Bundle-Vendor: Xored software, Inc. diff --git a/org.fantom.web/pom.xml b/org.fantom.web/pom.xml index 7e8601a..7a04aa5 100644 --- a/org.fantom.web/pom.xml +++ b/org.fantom.web/pom.xml @@ -9,6 +9,6 @@ org.fantom org.fantom.web - 1.0.69-SNAPSHOT + 1.0.71-SNAPSHOT eclipse-plugin diff --git a/org.fantom.web/web.pod b/org.fantom.web/web.pod index 28f43cf..fac090b 100644 Binary files a/org.fantom.web/web.pod and b/org.fantom.web/web.pod differ diff --git a/org.fantom.webmod/META-INF/MANIFEST.MF b/org.fantom.webmod/META-INF/MANIFEST.MF index 8de4a38..3e89cdf 100644 --- a/org.fantom.webmod/META-INF/MANIFEST.MF +++ b/org.fantom.webmod/META-INF/MANIFEST.MF @@ -2,9 +2,9 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Fantom core pod WebMod Bundle-SymbolicName: org.fantom.webmod;singleton:=true -Bundle-Version: 1.0.69.qualifier -Require-Bundle: org.fantom.sys;bundle-version="1.0.69", - org.fantom.inet;bundle-version="1.0.69", - org.fantom.web;bundle-version="1.0.69", - org.fantom.util;bundle-version="1.0.69" +Bundle-Version: 1.0.71.qualifier +Require-Bundle: org.fantom.sys;bundle-version="1.0.71", + org.fantom.inet;bundle-version="1.0.71", + org.fantom.web;bundle-version="1.0.71", + org.fantom.util;bundle-version="1.0.71" Bundle-Vendor: Xored software, Inc. diff --git a/org.fantom.webmod/pom.xml b/org.fantom.webmod/pom.xml index e06bf79..86c186b 100644 --- a/org.fantom.webmod/pom.xml +++ b/org.fantom.webmod/pom.xml @@ -9,6 +9,6 @@ org.fantom org.fantom.webmod - 1.0.69-SNAPSHOT + 1.0.71-SNAPSHOT eclipse-plugin diff --git a/org.fantom.webmod/webmod.pod b/org.fantom.webmod/webmod.pod index be937ad..c9e56c7 100644 Binary files a/org.fantom.webmod/webmod.pod and b/org.fantom.webmod/webmod.pod differ diff --git a/org.fantom.wisp/META-INF/MANIFEST.MF b/org.fantom.wisp/META-INF/MANIFEST.MF index eac8c82..a427a91 100644 --- a/org.fantom.wisp/META-INF/MANIFEST.MF +++ b/org.fantom.wisp/META-INF/MANIFEST.MF @@ -2,9 +2,9 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Fantom core pod Wisp Bundle-SymbolicName: org.fantom.wisp;singleton:=true -Bundle-Version: 1.0.69.qualifier -Require-Bundle: org.fantom.sys;bundle-version="1.0.69", - org.fantom.concurrent;bundle-version="1.0.69", - org.fantom.inet;bundle-version="1.0.69", - org.fantom.web;bundle-version="1.0.69" +Bundle-Version: 1.0.71.qualifier +Require-Bundle: org.fantom.sys;bundle-version="1.0.71", + org.fantom.concurrent;bundle-version="1.0.71", + org.fantom.inet;bundle-version="1.0.71", + org.fantom.web;bundle-version="1.0.71" Bundle-Vendor: Xored software, Inc. diff --git a/org.fantom.wisp/pom.xml b/org.fantom.wisp/pom.xml index d645c94..8165607 100644 --- a/org.fantom.wisp/pom.xml +++ b/org.fantom.wisp/pom.xml @@ -9,6 +9,6 @@ org.fantom org.fantom.wisp - 1.0.69-SNAPSHOT + 1.0.71-SNAPSHOT eclipse-plugin diff --git a/org.fantom.wisp/wisp.pod b/org.fantom.wisp/wisp.pod index 7417b89..ce14305 100644 Binary files a/org.fantom.wisp/wisp.pod and b/org.fantom.wisp/wisp.pod differ diff --git a/org.fantom/META-INF/MANIFEST.MF b/org.fantom/META-INF/MANIFEST.MF index 7966b90..4204dda 100644 --- a/org.fantom/META-INF/MANIFEST.MF +++ b/org.fantom/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Fantom Runtime Bundle-SymbolicName: org.fantom;singleton:=true -Bundle-Version: 1.0.69.qualifier +Bundle-Version: 1.0.71.qualifier Bundle-Vendor: Xored software, Inc. Bundle-Activator: org.fantom.FantomVM Require-Bundle: org.eclipse.core.runtime diff --git a/org.fantom/about.ini b/org.fantom/about.ini index 056355c..6ebc88b 100644 --- a/org.fantom/about.ini +++ b/org.fantom/about.ini @@ -10,8 +10,8 @@ featureImage=featureImage.png aboutText=Fantom OSGi Runtime \n\n\ -Version: 1.0.69\n\n\ -Copyright (c) 2009-2016 Xored Software, Inc. All rights reserved.\n\ +Version: 1.0.71\n\n\ +Copyright (c) 2009-2018 Xored Software, Inc. All rights reserved.\n\ Visit http://www.xored.com/f4/\n\n\ This product includes software developed by the\n\ Eclipse Foundation http://www.eclipse.org/\n\n\ diff --git a/org.fantom/featureImage.png b/org.fantom/featureImage.png index f92e9f6..7caa211 100644 Binary files a/org.fantom/featureImage.png and b/org.fantom/featureImage.png differ diff --git a/org.fantom/pom.xml b/org.fantom/pom.xml index 8e9bf38..ad5307d 100644 --- a/org.fantom/pom.xml +++ b/org.fantom/pom.xml @@ -9,6 +9,6 @@ org.fantom org.fantom - 1.0.69-SNAPSHOT + 1.0.71-SNAPSHOT eclipse-plugin diff --git a/org.fantom/src/org/fantom/FantomException.java b/org.fantom/src/org/fantom/FantomException.java index 888433b..a3db1a1 100644 --- a/org.fantom/src/org/fantom/FantomException.java +++ b/org.fantom/src/org/fantom/FantomException.java @@ -1,14 +1,3 @@ -/******************************************************************************* - * Copyright (c) 2010 xored software, Inc. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * xored software, Inc. - initial API and Implementation (Alex Panchenko) - *******************************************************************************/ package org.fantom; @SuppressWarnings("serial") diff --git a/readme.md b/readme.md index c2d5788..7eaea47 100644 --- a/readme.md +++ b/readme.md @@ -3,3 +3,20 @@ Core Fantom pods bundled as individual eclipse plugins. Fantom Runtime is used internally by the [F4 IDE](https://github.com/xored/f4) to run plugins and compile Fantom code. + +Use Maven to compile and package Fantom Runtime (tested with Maven 3.3.9): + + > mvn clean package + +This should create an update directory in your project root named `org.fantom-updatesite`. To use this newly compiled version of Fantom Runtime with F4, edit the `pom.xml` file in the F4 project root. Find the `fantom-runtime` repository and update it to reference the new update site directory: + + + + always + + fantom-runtime + p2 + file:///D:/Projects/fantom-runtime/org.fantom-updatesite/target/site/ + + +Now you can use Maven to build F4 and include your new Fantom Runtime.