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
 public typealias KCLayoutAttribute = NSLayoutConstraint.Attribute
 public typealias KCLayoutRelation = NSLayoutConstraint.Relation
 public typealias KCLineBreakMode = NSParagraphStyle.LineBreakMode

[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.