October 12, 2017

[Amber] Variable Scope

The variable stdio in pressed method is defined under the application component. How to define this variable scope rule?

application: {
  stdio: (Console) <- console_window.stdio
  main_window: Window {
    button: {
      pressed: Void %{
        printf(stdio.output, "hello, world")
      %}
    }
  }
  console_window: Window {
  }
}

September 29, 2017

TO DO list

This article contains the to-do list of my software development project

last updated: 2017/09/28

KiwiEngine Framework

  • Now KEPropertyTable has JSValue as the value. The value is allocated by the JSContext, so the value will be destroyed when the context is released. To avoid it, the value of property table must be independent from JSContext.

September 23, 2017

[KiwiControls] Update to support Xcode9 and Swift4

The KiwiControl Framework define GUI parts which can be used by macOS and iOS. At the swift4 and SDK for it, following type definition is required to use it by AppKit(macOS) and UIKit(iOS) software.

#if os(iOS)
 public typealias KCLayoutAttribute = NSLayoutAttribute
 public typealias KCLayoutRelation = NSLayoutRelation
 public typealias KCLineBreakMode = NSLineBreakMode
#else
 public typealias KCLayoutAttribute = NSLayoutConstraint.Attribute
 public typealias KCLayoutRelation = NSLayoutConstraint.Relation
 public typealias KCLineBreakMode = NSParagraphStyle.LineBreakMode
#endif

[Amber Programming Language] How to support data stream

I consider about how to support data stream and it's notation by Amber Programming Language. Especially, consider how to connect shell engine model and console view.

Shell model

The shell model has standard input (stdin), standard output (stdout), standard error (stderr).

In the following example, The data stream is presented as '->'. The stdin property is stream of String.

  shell0: Shell {
     stdin:  String <- ... output module ...
     stdout: String -> ... input module ...
     error:  String -> ... input module ...
  }

Console view

The console view has one or more input to put string into console (uneducable text) view.

  console: Console {
     input:  String <- ... output module ...
  }

September 3, 2017

Assigning Swift closure into JSValue object

The closure code to be passed into the JSValue object must have @convention(block) attribute is required. Here is the sample code:.

let closure: @convention(block) (_ value: JSValue) -> JSValue = {
  (_ value: JSValue) -> JSValue in
  /* contents of closure */
}
... = JSValue(object: closure, in: ctxt)) /* Allocate JSValue */

There is following description in Apples's document about JSValue. But I didn't noticed.

Objective-C blocks (or Swift closures with the @convention(block) attribute) become JavaScript Function objects, with parameter and return types converted using the same rules as values. Converting a JavaScript function backed by a native block or method returns that block or method; all other JavaScript functions convert as empty dictionaries.

The @convention(block) directive is used to generate the closure code which has compatibility with the C object.

August 18, 2017

Programming Language: Forth

Here is link list about the Forth language:

  1. Programming Language: Forth: ANS Forth published by American National Standard for Information Systems
  2. Forth関連の情報サイトのまとめ(Japanese)

[Xcode] Unsolved warning messages

These warning messages can not be suppressed yet. The Xcode version is 8.3.3.
  • NSOpenPanel (for macOS):

    When I use NSOpenPanel in my swift application, following message are displayed in the Xcode log window.

    warning: <NSRemoteView: 0x6100001205a0> determined it was necessary to configure <NSVBOpenPanel: 0x100f138e0> to support remote view vibrancy
  • UITextView (for iOS):

    [MC] Reading from private effective user settings.

August 17, 2017

Generalized Unix Command Line Parameter Notation

If the notation of command line parameter for Unix command is defined, it will be used for following situations:

  1. The notation is used to communicate between GUI shell and unix command.
  2. The notation can be used to implement new unix command to control other commands.

This project defines "Canary Command Line Notation" for the notation of command line parameter for unix commands. For more details, see Canary Command Line Notation.

Execute shell commands by Cocoa application

August 7, 2017

Suppress resizing window which contains NSStackView

If there are no constraint on the top level NSStackView, the size of window will be changed when the stack view is updated.
To avoid this resize, give the fixed size to the top level stack view.


July 25, 2017

NSOpenPanel crashes

Do not remember Sandbox setting when you use NSOpenPanel in the application. If it is not set, the NSOpenPanel causes exception.

July 23, 2017

Posted documents on the other sites

Released documents

Programming Language

  • Amber: The programming language for user interface design

Format

Design Pattern

June 29, 2017

Swift class to implement variables at JavaScriptCore

Here is a table to know which class is used to implement variable on JavaScriptCore.

Summary

  1. The boolean value will be kept as NSNumber<Int> when it is a member of array and dictionary.
Object in JavaScript Type hierarchy to present by Swift
true JSValue.Bool
123 JSValue.NSNumber<Double>
1.23 JSValue.NSNumber<Double>
["hello", "world"] JSValue.Array.String
[true, false] JSValue.Array.NSNumber<Int>
[a:12] JSValue.Dictionary[String: NSNumber<Double>]
[a:true] JSValue.Dictionary[String: NSNumber<Int>]

May 27, 2017

Unix Tool Tips

rsync

rsync -auvE --delete source-dir destination-dir

Sync the directories. The destination directory will have same contents of source directory.

April 2, 2017

Released Software

Framework

These frameworks are targeting macOS and iOS: