package {
  import stdio.flash.Sprite
  import stdio.process
  import stdio.Interactive

  [SWF(width=0, height=0)]
  public class test_readline_flash extends Sprite implements Interactive {
    public function main(): void {
      process.prompt = "What’s your name? "
      process.gets(function (name: String): void {
        process.puts("Hello, " + name + "!")
        process.prompt = "Favorite color? "
        process.gets(function (color: String): void {
          process.puts("I like " + color + " too!")
          process.exit()
        })
      })
    }
  }
}

Use `colorize` in readline test.

package {
  import stdio.colorize
  import stdio.flash.Sprite
  import stdio.process
  import stdio.Interactive

  [SWF(width=0, height=0)]
  public class test_readline_flash extends Sprite implements Interactive {
    public function main(): void {
      process.prompt = "What’s your name? "
      process.gets(function (name: String): void {
        process.puts("Hello, " + name + "!")
        process.prompt = "What’s your favorite color? "
        process.gets(function (color: String): void {
          color = color.toLowerCase()
          process.puts(
            "I like " + colorize(
              "%{bold}%{" + color + "}" + color + "%{none}"
            ) + " too!"
          )
          process.exit()
        })
      })
    }
  }
}


package org.openforis.collect.i18n {
	import mx.resources.ResourceManager;

	/**
	 * @author Mino Togna
	 * */
	public class Message {

		public function Message() {
		}

		public static function get(resource:String, parameters:Array=null, bundle:String="messages"):String {
			return ResourceManager.getInstance().getString(bundle, resource, parameters);
		}
	}
}

Return resource name instead of null if not found

package org.openforis.collect.i18n {
	import mx.resources.ResourceManager;

	/**
	 * @author Mino Togna
	 * @author S. Ricci
	 * */
	public class Message {

		public function Message() {
		}

		public static function get(resource:String, parameters:Array=null, bundle:String="messages"):String {
			var message:String = ResourceManager.getInstance().getString(bundle, resource, parameters);
			if(message != null) {
				return message;
			} else {
				return resource;
			}
		}
	}
}


package dolly.data {

public class PropertyLevelCopyableClass {

	[Copyable]
	public static var staticProperty1:String = "Value of first-level static property 1.";

	public static var staticProperty2:String = "Value of first-level static property 2.";

	[Cloneable]
	private var _writableField1:String = "Value of first-level writable field.";

	[Cloneable]
	public var property1:String = "Value of first-level public property 1.";

	public var property2:String = "Value of first-level public property 2.";

	public function PropertyLevelCopyableClass() {
	}

	[Copyable]
	public function get writableField1():String {
		return _writableField1;
	}

	public function set writableField1(value:String):void {
		_writableField1 = value;
	}

	[Copyable]
	public function get readOnlyField1():String {
		return "Value of first-level read-only field.";
	}
}
}

Fix stupid mistake with metadata names.

package dolly.data {

public class PropertyLevelCopyableClass {

	[Copyable]
	public static var staticProperty1:String = "Value of first-level static property 1.";

	public static var staticProperty2:String = "Value of first-level static property 2.";

	[Copyable]
	private var _writableField1:String = "Value of first-level writable field.";

	[Copyable]
	public var property1:String = "Value of first-level public property 1.";

	public var property2:String = "Value of first-level public property 2.";

	public function PropertyLevelCopyableClass() {
	}

	[Copyable]
	public function get writableField1():String {
		return _writableField1;
	}

	public function set writableField1(value:String):void {
		_writableField1 = value;
	}

	[Copyable]
	public function get readOnlyField1():String {
		return "Value of first-level read-only field.";
	}
}
}


package {
  import asunit.framework.TestSuite;

  public class Suite extends TestSuite {
    public function Suite() {
      super();
      addTest(new PlayerTest("testPass"));
    }
  }
}

Add URI tests to the asunit test suite

package {
  import asunit.framework.TestSuite;

  public class Suite extends TestSuite {
    public function Suite() {
      super();
      addTest(new PlayerTest("testPass"));
      addTest(new UriTest("test_isSafe"));
    }
  }
}


package
{
    import flash.media.Sound;
    import flash.net.URLRequest;

    public class ImpetusSound
    {
        private var sound:Sound;

        private var channels:Vector.<ImpetusChannel>;

        public function ImpetusSound(url:String):void
        {
            this.sound = new Sound();

            this.channels = new Vector.<ImpetusChannel>;

            this.sound.load(new URLRequest(url));
        }

        public function playNew():ImpetusChannel
        {
            var c:ImpetusChannel = new ImpetusChannel(this.sound.play(0));

            channels.push(c);

            return c;
        }

        public function stopAll():void
        {
            var len:int = this.channels.length;

            for(var i:int; i < len; i++)
            {
                this.channels[i].stop();
            }
        }
    }
}

Store url & add getUrl() getter

package
{
    import flash.media.Sound;
    import flash.net.URLRequest;

    public class ImpetusSound
    {
        private var url:String;
        private var sound:Sound;

        private var channels:Vector.<ImpetusChannel>;

        public function ImpetusSound(url:String):void
        {
            this.url = url;
            this.sound = new Sound();

            this.channels = new Vector.<ImpetusChannel>;

            this.sound.load(new URLRequest(url));
        }

        public function get getUrl():String
        {
            return this.url
        }

        public function playNew():ImpetusChannel
        {
            var c:ImpetusChannel = new ImpetusChannel(this.sound.play(0));

            channels.push(c);

            return c;
        }

        public function stopAll():void
        {
            var len:int = this.channels.length;

            for(var i:int; i < len; i++)
            {
                this.channels[i].stop();
            }
        }
    }
}


package {

  class ClassA
  {
    public function ClassA()
    {
      trace('A');
    }
    protected function foo() : void
    {
      trace('a');
    }
    protected function bar() : void
    {
      trace('b');
    }
  }

  class ClassC extends ClassA
  {
    public function ClassC()
    {
      trace('> C');
      super();

      foo();
      bar();
      trace('< C');
    }

    override protected function bar() : void {
      super.bar();
      trace('override b');
    }
  }

  class ClassE extends ClassC
  {
    public function ClassE()
    {
      trace('> E');
      super();
      foo();
      bar();
      trace('< E');
    }

    override protected function bar() : void {
      super.bar();
      trace('override b again');
    }
  }

  // var c = new ClassC();
  // var e = new ClassE();

  class X {
    protected var
  }
  trace("--");
}

Fix call super test case.

package {

  class ClassA
  {
    public function ClassA()
    {
      trace('A');
    }
    protected function foo() : void
    {
      trace('a');
    }
    protected function bar() : void
    {
      trace('b');
    }
  }

  class ClassC extends ClassA
  {
    public function ClassC()
    {
      trace('> C');
      super();

      foo();
      bar();
      trace('< C');
    }

    override protected function bar() : void {
      super.bar();
      trace('override b');
    }
  }

  class ClassE extends ClassC
  {
    public function ClassE()
    {
      trace('> E');
      super();
      foo();
      bar();
      trace('< E');
    }

    override protected function bar() : void {
      super.bar();
      trace('override b again');
    }
  }

  trace("--");
}


package flails.mxml {
  import com.asfusion.mate.actions.AbstractServiceInvoker;
  import com.asfusion.mate.actionLists.IScope;
  import com.asfusion.mate.actions.IAction;

  import mx.rpc.events.ResultEvent;
  import mx.rpc.events.FaultEvent;

  import flails.request.RequestPipe;
  import flails.resource.Resources;
  import flails.resource.Resource;

  public class ResourcefulServiceInvoker extends AbstractServiceInvoker implements IAction {
    public var resource:Resource;
    public var data:Array;
    public var type:String;
    public var id:String;
    public var parent:Object;

    [Bindable] public var result:Object;

    public function ResourcefulServiceInvoker() {
      currentInstance = this;
    }

    override protected function prepare(scope:IScope):void {
      super.prepare(scope);
    }

    override protected function run(scope:IScope):void {
      trace ("Using resource " + resource);

      var rp:RequestPipe = resource.newRequestPipe();

      innerHandlersDispatcher = rp;

      if (resultHandlers && resultHandlers.length > 0) {
        createInnerHandlers(scope, ResultEvent.RESULT, resultHandlers);
      }

      if (faultHandlers && faultHandlers.length > 0) {
        createInnerHandlers(scope, FaultEvent.FAULT, faultHandlers);
      }

      trace("calling " + type + "()");

      rp[type].apply(rp, data);
    }
  }
}

Set currentInstance on prepare, not on instantiation time.

package flails.mxml {
  import com.asfusion.mate.actions.AbstractServiceInvoker;
  import com.asfusion.mate.actionLists.IScope;
  import com.asfusion.mate.actions.IAction;

  import mx.rpc.events.ResultEvent;
  import mx.rpc.events.FaultEvent;

  import flails.request.RequestPipe;
  import flails.resource.Resources;
  import flails.resource.Resource;

  public class ResourcefulServiceInvoker extends AbstractServiceInvoker implements IAction {
    private var _data:Array;

    public var resource:Resource;
    public var type:String;
    public var id:String;
    public var parent:Object;

    [Bindable] public var result:Object;

    public function set data(args:Object):void {
      trace("setting data");

      if (args is Array)
        _data = args as Array;
      else
        _data = [args];
    }

    override protected function prepare(scope:IScope):void {
      currentInstance = this;

      super.prepare(scope);
    }

    override protected function run(scope:IScope):void {
      trace ("Using resource " + resource);

      var rp:RequestPipe = resource.newRequestPipe();

      innerHandlersDispatcher = rp;

      if (resultHandlers && resultHandlers.length > 0) {
        createInnerHandlers(scope, ResultEvent.RESULT, resultHandlers);
      }

      if (faultHandlers && faultHandlers.length > 0) {
        createInnerHandlers(scope, FaultEvent.FAULT, faultHandlers);
      }

      trace("calling " + type + "() with " + _data);

      rp[type].apply(rp, _data);
    }
  }
}


/**
 * Generated by Gas3 v2.3.0 (Granite Data Services).
 *
 * NOTE: this file is only generated if it does not exist. You may safely put
 * your custom code here.
 */

package org.openforis.collect.metamodel.proxy {
	import mx.collections.IList;

	import org.openforis.collect.util.CollectionUtil;

    [Bindable]
    [RemoteClass(alias="org.openforis.collect.metamodel.proxy.UITabSetProxy")]
    public class UITabSetProxy extends UITabSetProxyBase {

		public function getTab(name:String):UITabProxy {
			var stack:Array = new Array();
			stack.push(tabs);
			while (stack.length > 0) {
				var tabs:IList = stack.pop();
				for each(var tab:UITabProxy in tabs) {
					if(tab.name == name) {
						return tab;
					}
					if ( CollectionUtil.isNotEmpty(tab.tabs) ) {
						stack.push(tab.tabs);
					}
				}
			}
			return null;
		}
    }
}

Fix unexpected behavior with nested tabs

/**
 * Generated by Gas3 v2.3.0 (Granite Data Services).
 *
 * NOTE: this file is only generated if it does not exist. You may safely put
 * your custom code here.
 */

package org.openforis.collect.metamodel.proxy {
	import mx.collections.IList;

	import org.openforis.collect.util.CollectionUtil;

    [Bindable]
    [RemoteClass(alias="org.openforis.collect.metamodel.proxy.UITabSetProxy")]
    public class UITabSetProxy extends UITabSetProxyBase {

		public function getTab(name:String):UITabProxy {
			var stack:Array = new Array();
			stack.push(this.tabs);
			while (stack.length > 0) {
				var currentTabs:IList = stack.pop();
				for each(var tab:UITabProxy in currentTabs) {
					if(tab.name == name) {
						return tab;
					}
					if ( CollectionUtil.isNotEmpty(tab.tabs) ) {
						stack.push(tab.tabs);
					}
				}
			}
			return null;
		}
    }
}


package laml.display {
	import flash.display.DisplayObject;
	import flash.display.Sprite;

	public class Skin extends Sprite implements ISkin {

		public function getBitmapByName(alias:String):DisplayObject {
			if(hasOwnProperty(alias)) {
				return new this[alias]() as DisplayObject;
			}

			return null;
		}
	}
}

Put MX dependencies in skin

package laml.display {
	import flash.display.DisplayObject;
	import flash.display.Sprite;

	import mx.core.BitmapAsset;
	import mx.core.FontAsset;
	import mx.core.IFlexAsset;
	import mx.core.IFlexDisplayObject;
	import mx.core.SpriteAsset;

	public class Skin extends Sprite implements ISkin {
 		private var bitmapAsset:BitmapAsset;
		private var fontAsset:FontAsset;
		private var iFlexAsset:IFlexAsset;
		private var iFlexDisplayObject:IFlexDisplayObject;
		private var spriteAsset:SpriteAsset;

		public function getBitmapByName(alias:String):DisplayObject {
			if(hasOwnProperty(alias)) {
				return new this[alias]() as DisplayObject;
			}

			return null;
		}
	}
}


/**
 * Copyright (c) 2009 Lance Carlson
 * See LICENSE for full license information.
 */

package flails.resource {
  import flails.request.RequestPipe;
  import flails.request.HTTPClient;
  import flails.request.ResourcePathBuilder;
  import flails.request.JSONFilter;

  import flash.utils.getQualifiedClassName;

  import mx.core.IMXMLObject;

  public class Resource {
    public var name:String;
    public var instanceClass:Class;

    public function Resource() {}

    public function initialized(parent:Object, id:String):void {
    }

    public function index(resultHandler:Function, errorHandler:Function = null):void {
      requestPipe(resultHandler, errorHandler).index();
    }

    public function show(id:Number, resultHandler:Function, errorHandler:Function = null):void {
      requestPipe(resultHandler, errorHandler).show(id);
    }

    public function requestPipe(resultHandler:Function, errorHandler:Function):RequestPipe {
      // TODO: The pluralization obviously needs to be taken care of
      var pipe:RequestPipe = new HTTPClient(new ResourcePathBuilder(name), new JSONFilter(instanceClass));

      pipe.addEventListener("result", resultHandler);

      return pipe;
    }
  }
}

Implement IMXMLObject. Some defaults and checks.

/**
 * Copyright (c) 2009 Lance Carlson
 * See LICENSE for full license information.
 */

package flails.resource {
  import flails.request.RequestPipe;
  import flails.request.HTTPClient;
  import flails.request.ResourcePathBuilder;
  import flails.request.JSONFilter;

  import mx.core.IMXMLObject;

  public class Resource implements IMXMLObject {
    public var name:String;
    public var instanceClass:Class;

    public function Resource() {}

    public function initialized(parent:Object, id:String):void {
      if (name == null) throw new Error("Name not set for resource.");
      if (instanceClass == null) instanceClass = Record;
    }

    public function index(resultHandler:Function, errorHandler:Function = null):void {
      requestPipe(resultHandler, errorHandler).index();
    }

    public function show(id:Number, resultHandler:Function, errorHandler:Function = null):void {
      requestPipe(resultHandler, errorHandler).show(id);
    }

    public function requestPipe(resultHandler:Function, errorHandler:Function):RequestPipe {
      // TODO: The pluralization obviously needs to be taken care of
      var pipe:RequestPipe = new HTTPClient(new ResourcePathBuilder(name), new JSONFilter(instanceClass));

      pipe.addEventListener("result", resultHandler);

      return pipe;
    }
  }
}


package dolly {

import dolly.core.dolly_internal;
import dolly.data.CompositeCloneableClass;

import org.as3commons.reflect.Type;

use namespace dolly_internal;

public class CloningOfCompositeCloneableClassTest {

	private var compositeCloneableClass:CompositeCloneableClass;
	private var compositeCloneableClassType:Type;

	[Before]
	public function before():void {
		compositeCloneableClass = new CompositeCloneableClass();

		compositeCloneableClassType = Type.forInstance(compositeCloneableClass);
	}

	[After]
	public function after():void {
		compositeCloneableClass = null;
		compositeCloneableClassType = null;
	}
}
}

Test for calculation of cloneable fields in CompositeCloneableClass.

package dolly {
import dolly.core.dolly_internal;
import dolly.data.CompositeCloneableClass;

import org.as3commons.reflect.Field;
import org.as3commons.reflect.Type;
import org.flexunit.asserts.assertEquals;
import org.flexunit.asserts.assertNotNull;

use namespace dolly_internal;

public class CloningOfCompositeCloneableClassTest {

	private var compositeCloneableClass:CompositeCloneableClass;
	private var compositeCloneableClassType:Type;

	[Before]
	public function before():void {
		compositeCloneableClass = new CompositeCloneableClass();

		compositeCloneableClassType = Type.forInstance(compositeCloneableClass);
	}

	[After]
	public function after():void {
		compositeCloneableClass = null;
		compositeCloneableClassType = null;
	}

	[Test]
	public function findingAllWritableFieldsForType():void {
		const writableFields:Vector.<Field> = Cloner.findAllWritableFieldsForType(compositeCloneableClassType);
		assertNotNull(writableFields);
		assertEquals(4, writableFields.length);
	}
}
}


package dolly {
import dolly.core.dolly_internal;
import dolly.data.CompositeCloneableClass;

import org.as3commons.reflect.Field;
import org.as3commons.reflect.Type;
import org.flexunit.asserts.assertEquals;
import org.flexunit.asserts.assertNotNull;

use namespace dolly_internal;

public class CloningOfCompositeCloneableClassTest {

	private var compositeCloneableClass:CompositeCloneableClass;
	private var compositeCloneableClassType:Type;

	[Before]
	public function before():void {
		compositeCloneableClass = new CompositeCloneableClass();

		compositeCloneableClassType = Type.forInstance(compositeCloneableClass);
	}

	[After]
	public function after():void {
		compositeCloneableClass = null;
		compositeCloneableClassType = null;
	}

	[Test]
	public function findingAllWritableFieldsForType():void {
		const writableFields:Vector.<Field> = Cloner.findAllWritableFieldsForType(compositeCloneableClassType);
		assertNotNull(writableFields);
		assertEquals(4, writableFields.length);
	}
}
}

Test for cloning array in CompositeCloneableClass.

package dolly {
import dolly.core.dolly_internal;
import dolly.data.CompositeCloneableClass;

import org.as3commons.reflect.Field;
import org.as3commons.reflect.Type;
import org.flexunit.asserts.assertEquals;
import org.flexunit.asserts.assertFalse;
import org.flexunit.asserts.assertNotNull;
import org.hamcrest.assertThat;
import org.hamcrest.collection.array;
import org.hamcrest.collection.arrayWithSize;
import org.hamcrest.collection.everyItem;
import org.hamcrest.core.isA;
import org.hamcrest.object.equalTo;

use namespace dolly_internal;

public class CloningOfCompositeCloneableClassTest {

	private var compositeCloneableClass:CompositeCloneableClass;
	private var compositeCloneableClassType:Type;

	[Before]
	public function before():void {
		compositeCloneableClass = new CompositeCloneableClass();

		compositeCloneableClassType = Type.forInstance(compositeCloneableClass);
	}

	[After]
	public function after():void {
		compositeCloneableClass = null;
		compositeCloneableClassType = null;
	}

	[Test]
	public function findingAllWritableFieldsForType():void {
		const writableFields:Vector.<Field> = Cloner.findAllWritableFieldsForType(compositeCloneableClassType);
		assertNotNull(writableFields);
		assertEquals(4, writableFields.length);
	}

	[Test]
	public function cloningOfArray():void {
		const clone:CompositeCloneableClass = Cloner.clone(compositeCloneableClass);

		assertNotNull(clone.array);
		assertThat(clone.array, arrayWithSize(5));
		assertThat(clone.array, compositeCloneableClass.array);
		assertFalse(clone.array == compositeCloneableClass.array);
		assertThat(clone.array, everyItem(isA(Number)));
		assertThat(clone.array, array(equalTo(0), equalTo(1), equalTo(2), equalTo(3), equalTo(4)));
	}
}
}


package org.flexunit.events
{
	import flash.events.ErrorEvent;
	import flash.events.Event;

	public class UnknownError extends Error
	{
		public function UnknownError( event:Event )
		{
			var error:Error;
			if ( event.hasOwnProperty( "error" ) ) {
				var errorGeneric:* = event[ "error" ];

				if ( errorGeneric is Error ) {
					error = errorGeneric as Error;
				} else if ( errorGeneric is ErrorEvent ) {
					var errorEvent:ErrorEvent = errorGeneric as ErrorEvent;
					error = new Error( "Top Level Error", errorEvent.errorID );
				}
			}

			super( error.message, error.errorID );
		}
	}
}

Fix for build issue around unknown error

package org.flexunit.events
{
	import flash.events.ErrorEvent;
	import flash.events.Event;

	public class UnknownError extends Error
	{
		public function UnknownError( event:Event )
		{
			var error:Error;
			if ( event.hasOwnProperty( "error" ) ) {
				var errorGeneric:* = event[ "error" ];

				if ( errorGeneric is Error ) {
					error = errorGeneric as Error;
				} else if ( errorGeneric is ErrorEvent ) {
					var errorEvent:ErrorEvent = errorGeneric as ErrorEvent;
					error = new Error( "Top Level Error", Object(errorEvent).errorID );
				}
			}

			super( error.message, error.errorID );
		}
	}
}


package com.kaltura.kdpfl.plugin
{
	import org.osmf.traits.LoaderBase;

	public class WVLoader extends LoaderBase
	{
		public function WVLoader()
		{
			super();
		}
	}
}

Fix a bug that caused "ChangeMedia" to fail

package com.kaltura.kdpfl.plugin
{
	import flash.external.ExternalInterface;

	import org.osmf.media.MediaResourceBase;
	import org.osmf.traits.LoaderBase;

	public class WVLoader extends LoaderBase
	{
		public function WVLoader()
		{
			super();
		}

		override public function canHandleResource(resource:MediaResourceBase):Boolean
		{
			if (resource.hasOwnProperty("url") && resource["url"].toString().indexOf(".wvm") > -1 )
			{
				try
				{
					ExternalInterface.call("mediaURL" , resource["url"].toString());
				}
				catch(error:Error)
				{
					trace("Failed to call external interface");
				}
				return true;
			}
			return false;
		}
	}
}


package goplayer
{
  import flash.display.Loader
  import flash.events.Event
  import flash.events.IOErrorEvent
  import flash.net.URLRequest
  import flash.system.ApplicationDomain
  import flash.system.LoaderContext
  import flash.system.SecurityDomain

  public class FlashContentLoadAttempt
  {
    private const loader : Loader = new Loader

    private var url : String
    private var listener : FlashContentLoaderListener

    public function FlashContentLoadAttempt
      (url : String, listener : FlashContentLoaderListener)
    {
      this.url = url, this.listener = listener

      loader.contentLoaderInfo.addEventListener
        (Event.COMPLETE, handleContentLoaded)
      loader.contentLoaderInfo.addEventListener
        (IOErrorEvent.IO_ERROR, handleIOError)
    }

    public function execute() : void
    { loader.load(new URLRequest(url)) }

    private function handleContentLoaded(event : Event) : void
    { listener.handleContentLoaded(loader.contentLoaderInfo) }

    private function handleIOError(event : IOErrorEvent) : void
    { debug("Failed to load <" + url + ">: " + event.text) }
  }
}

Improve error handling of external content loading.

package goplayer
{
  import flash.display.Loader
  import flash.events.Event
  import flash.events.IOErrorEvent
  import flash.net.URLRequest
  import flash.system.ApplicationDomain
  import flash.system.LoaderContext
  import flash.system.SecurityDomain

  public class FlashContentLoadAttempt
  {
    private const loader : Loader = new Loader

    private var url : String
    private var listener : FlashContentLoaderListener

    public function FlashContentLoadAttempt
      (url : String, listener : FlashContentLoaderListener)
    {
      this.url = url, this.listener = listener

      loader.contentLoaderInfo.addEventListener
        (Event.COMPLETE, handleContentLoaded)
      loader.contentLoaderInfo.addEventListener
        (IOErrorEvent.IO_ERROR, handleIOError)
    }

    public function execute() : void
    { loader.load(new URLRequest(url)) }

    private function handleContentLoaded(event : Event) : void
    { listener.handleContentLoaded(loader.contentLoaderInfo) }

    private function handleIOError(event : IOErrorEvent) : void
    {
      const code : String = event.text.match(/^Error #(\d+)/)[1]
      const message : String = code == "2035" ? "Not found" : event.text

      debug("Error: Failed to load <" + url + ">: " + message)
    }
  }
}


package aerys.minko.render.effect.vertex
{
	import aerys.minko.render.RenderTarget;
	import aerys.minko.render.effect.basic.BasicProperties;
	import aerys.minko.render.effect.basic.BasicShader;
	import aerys.minko.render.shader.SFloat;
	import aerys.minko.type.stream.format.VertexComponent;

	public class VertexUVShader extends BasicShader
	{

		public function VertexUVShader(target 	: RenderTarget 	= null,
									   priority	: Number		= 0)
		{
			super(target, priority);
		}

		override protected function getPixelColor() : SFloat
		{
			var uv 				: SFloat = getVertexAttribute(VertexComponent.UV);

			if (meshBindings.propertyExists(BasicProperties.DIFFUSE_UV_SCALE))
				uv.scaleBy(meshBindings.getParameter(BasicProperties.DIFFUSE_UV_SCALE, 2));

			if (meshBindings.propertyExists(BasicProperties.DIFFUSE_UV_OFFSET))
				uv.incrementBy(meshBindings.getParameter(BasicProperties.DIFFUSE_UV_OFFSET, 2));

			var interpolatedUv 	: SFloat = fractional(interpolate(uv));

			return float4(interpolatedUv.x, interpolatedUv.y, 0, 1);
		}

	}
}

Optimize uv shader for limit values

package aerys.minko.render.effect.vertex
{
	import aerys.minko.render.RenderTarget;
	import aerys.minko.render.effect.basic.BasicProperties;
	import aerys.minko.render.effect.basic.BasicShader;
	import aerys.minko.render.shader.SFloat;
	import aerys.minko.type.stream.format.VertexComponent;

	public class VertexUVShader extends BasicShader
	{
		public function VertexUVShader(target 	: RenderTarget 	= null,
									   priority	: Number		= 0)
		{
			super(target, priority);
		}

		override protected function getPixelColor() : SFloat
		{
			var uv 	: SFloat = getVertexAttribute(VertexComponent.UV);

			if (meshBindings.propertyExists(BasicProperties.DIFFUSE_UV_SCALE))
				uv.scaleBy(meshBindings.getParameter(BasicProperties.DIFFUSE_UV_SCALE, 2));

			if (meshBindings.propertyExists(BasicProperties.DIFFUSE_UV_OFFSET))
				uv.incrementBy(meshBindings.getParameter(BasicProperties.DIFFUSE_UV_OFFSET, 2));

			uv = interpolate(uv);

			var fractional : SFloat = fractional(uv);
			var fractionalIsZero : SFloat = equal(fractional, float2(0, 0));
			var interpolatedUv 	: SFloat = add(
				multiply(not(fractionalIsZero), fractional),
				multiply(fractionalIsZero, saturate(uv))
			);

			return float4(interpolatedUv.x, interpolatedUv.y, 0, 1);
		}

	}
}


package dolly {
public class ClassWithSomeCopyableFields {

	public static var staticProperty1:String;

	[Cloneable]
	public static var staticProperty2:String;

	[Cloneable]
	public static var staticProperty3:String;

	private var _writableField:String;
	private var _readOnlyField:String = "read-only field value";

	public var property1:String;

	[Cloneable]
	public var property2:String;

	[Cloneable]
	public var property3:String;

	public function ClassWithSomeCopyableFields() {
	}

	[Cloneable]
	public function get writableField():String {
		return _writableField;
	}

	public function set writableField(value:String):void {
		_writableField = value;
	}

	[Cloneable]
	public function get readOnlyField():String {
		return _readOnlyField;
	}
}
}

Change metadata tags to Copyable in test data class.

package dolly {
public class ClassWithSomeCopyableFields {

	public static var staticProperty1:String;

	[Copyable]
	public static var staticProperty2:String;

	[Copyable]
	public static var staticProperty3:String;

	private var _writableField:String;
	private var _readOnlyField:String = "read-only field value";

	public var property1:String;

	[Copyable]
	public var property2:String;

	[Copyable]
	public var property3:String;

	public function ClassWithSomeCopyableFields() {
	}

	[Copyable]
	public function get writableField():String {
		return _writableField;
	}

	public function set writableField(value:String):void {
		_writableField = value;
	}

	[Copyable]
	public function get readOnlyField():String {
		return _readOnlyField;
	}
}
}


package goplayer
{
  import flash.display.Loader
  import flash.events.Event
  import flash.events.IOErrorEvent
  import flash.net.URLRequest
  import flash.system.ApplicationDomain
  import flash.system.LoaderContext
  import flash.system.SecurityDomain

  public class FlashContentLoadAttempt
  {
    private const loader : Loader = new Loader

    private var url : String
    private var listener : FlashContentLoaderListener

    public function FlashContentLoadAttempt
      (url : String, listener : FlashContentLoaderListener)
    {
      this.url = url, this.listener = listener

      loader.contentLoaderInfo.addEventListener
        (Event.COMPLETE, handleContentLoaded)
      loader.contentLoaderInfo.addEventListener
        (IOErrorEvent.IO_ERROR, handleIOError)
    }

    public function execute() : void
    { loader.load(new URLRequest(url)) }

    private function get loaderContext() : LoaderContext
    {
      const result : LoaderContext = new LoaderContext(false, new ApplicationDomain(ApplicationDomain.currentDomain))

      result.securityDomain = SecurityDomain.currentDomain

      return result
    }

    private function handleContentLoaded(event : Event) : void
    { listener.handleContentLoaded(loader.contentLoaderInfo) }

    private function handleIOError(event : IOErrorEvent) : void
    { debug("Failed to load <" + url + ">: " + event.text) }
  }
}

Remove custom LoaderContext creation code.

package goplayer
{
  import flash.display.Loader
  import flash.events.Event
  import flash.events.IOErrorEvent
  import flash.net.URLRequest
  import flash.system.ApplicationDomain
  import flash.system.LoaderContext
  import flash.system.SecurityDomain

  public class FlashContentLoadAttempt
  {
    private const loader : Loader = new Loader

    private var url : String
    private var listener : FlashContentLoaderListener

    public function FlashContentLoadAttempt
      (url : String, listener : FlashContentLoaderListener)
    {
      this.url = url, this.listener = listener

      loader.contentLoaderInfo.addEventListener
        (Event.COMPLETE, handleContentLoaded)
      loader.contentLoaderInfo.addEventListener
        (IOErrorEvent.IO_ERROR, handleIOError)
    }

    public function execute() : void
    { loader.load(new URLRequest(url)) }

    private function handleContentLoaded(event : Event) : void
    { listener.handleContentLoaded(loader.contentLoaderInfo) }

    private function handleIOError(event : IOErrorEvent) : void
    { debug("Failed to load <" + url + ">: " + event.text) }
  }
}


//
// Flump - Copyright 2012 Three Rings Design

package flump.export {

import flash.display.DisplayObject;
import flash.display.Sprite;
import flash.geom.Point;
import flash.geom.Rectangle;

import flump.xfl.XflTexture;

public class PackedTexture
{
    public const holder :Sprite = new Sprite();
    public var tex :XflTexture;
    public var offset :Point;
    public var w :int, h :int, a :int;
    public var atlasX :int, atlasY :int;
    public var atlasRotated :Boolean;

    public function PackedTexture (tex :XflTexture, image :DisplayObject) {
        this.tex = tex;
        holder.addChild(image);
        const bounds :Rectangle = image.getBounds(holder);
        offset = new Point(bounds.x, bounds.y);
        w = Math.ceil(bounds.width);
        h = Math.ceil(bounds.height);
        a = w * h;
    }

    public function toString () :String {
        return "a " + a + " w " + w + " h " + h + " atlas " + atlasX + ", " + atlasY;
    }
}
}

Move the images by their offset

//
// Flump - Copyright 2012 Three Rings Design

package flump.export {

import flash.display.DisplayObject;
import flash.display.Sprite;
import flash.geom.Point;
import flash.geom.Rectangle;

import flump.xfl.XflTexture;

public class PackedTexture
{
    public const holder :Sprite = new Sprite();
    public var tex :XflTexture;
    public var offset :Point;
    public var w :int, h :int, a :int;
    public var atlasX :int, atlasY :int;
    public var atlasRotated :Boolean;

    public function PackedTexture (tex :XflTexture, image :DisplayObject) {
        this.tex = tex;
        holder.addChild(image);
        const bounds :Rectangle = image.getBounds(holder);
        image.x = -bounds.x;
        image.y = -bounds.y;
        offset = new Point(bounds.x, bounds.y);
        w = Math.ceil(bounds.width);
        h = Math.ceil(bounds.height);
        a = w * h;
    }

    public function toString () :String {
        return "a " + a + " w " + w + " h " + h + " atlas " + atlasX + ", " + atlasY;
    }
}
}


//
// $Id$
//
// Nenya library - tools for developing networked games
// Copyright (C) 2002-2007 Three Rings Design, Inc., All Rights Reserved
// http://www.threerings.net/code/nenya/
//
// This library is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation; either version 2.1 of the License, or
// (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

package com.threerings.flex {

import flash.display.DisplayObject;

import mx.core.UIComponent;

/**
 * Wraps a non-Flex component for use in Flex.
 */
public class FlexWrapper extends UIComponent
{
    public function FlexWrapper (object :DisplayObject)
    {
        // don't capture mouse events in this wrapper
        mouseEnabled = false;
        addChild(object);
        width = object.width;
        height = object.height;
    }
}
}

Make this optional, and not the default. Turns out a bunch of shit makes the wrapper size a little bigger, and some things seem to freak out when the wrapper has a size, even when includeInLayout=false. Flex you very much.

//
// $Id$
//
// Nenya library - tools for developing networked games
// Copyright (C) 2002-2007 Three Rings Design, Inc., All Rights Reserved
// http://www.threerings.net/code/nenya/
//
// This library is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation; either version 2.1 of the License, or
// (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

package com.threerings.flex {

import flash.display.DisplayObject;

import mx.core.UIComponent;

/**
 * Wraps a non-Flex component for use in Flex.
 */
public class FlexWrapper extends UIComponent
{
    public function FlexWrapper (object :DisplayObject, inheritSize :Boolean = false)
    {
        // don't capture mouse events in this wrapper
        mouseEnabled = false;
        addChild(object);
        if (inheritSize) {
            width = object.width;
            height = object.height;
        }
    }
}
}


package stdio {
  import flash.display.*
  import flash.utils.getQualifiedClassName
  import flash.utils.setTimeout

  public class Sprite extends flash.display.Sprite {
    public function Sprite() {
      stage.scaleMode = StageScaleMode.NO_SCALE
      stage.align = StageAlign.TOP_LEFT

      // Let the subclass constructor run first.
      setTimeout(initialize, 0)
    }

    private function initialize(): void {
      setup(loaderInfo, this, start)
    }

    private function start(): void {
      if ("main" in this && this["main"].length === 0) {
        this["main"]()
      } else {
        warn("Please write your main method like this:")
        warn("public function main(): void {}")
        process.exit(1)
      }
    }

    private function warn(message: String): void {
      process.warn(getQualifiedClassName(this) + ": " + message)
    }
  }
}

Fix bug preventing running processes recursively.

package stdio {
  import flash.display.*
  import flash.utils.getQualifiedClassName
  import flash.utils.setTimeout

  public class Sprite extends flash.display.Sprite {
    public function Sprite() {
      if (stage) {
        stage.scaleMode = StageScaleMode.NO_SCALE
        stage.align = StageAlign.TOP_LEFT
      }

      // Let the subclass constructor run first.
      setTimeout(initialize, 0)
    }

    private function initialize(): void {
      setup(loaderInfo, this, start)
    }

    private function start(): void {
      if ("main" in this && this["main"].length === 0) {
        this["main"]()
      } else {
        warn("Please write your main method like this:")
        warn("public function main(): void {}")
        process.exit(1)
      }
    }

    private function warn(message: String): void {
      process.warn(getQualifiedClassName(this) + ": " + message)
    }
  }
}


Scene@ newScene_;
Scene@ scene_;
Camera@ camera_;

void Start()
{
	StartScene("Scenes/Level1.xml");
	SubscribeToEvent("LevelComplete", "HandleLevelComplete");
}

void Stop()
{
}

void HandleLevelComplete(StringHash type, VariantMap& data)
{
	log.Debug("Level Complete. I should be loading "+data["NextLevel"].GetString());
	StartScene(data["NextLevel"].GetString());
}

void StartScene(String scene)
{
	newScene_ = Scene();
	newScene_.LoadAsyncXML(cache.GetFile(scene));

	SubscribeToEvent("AsyncLoadFinished", "HandleAsyncLoadFinished");
}

void HandleAsyncLoadFinished(StringHash type, VariantMap& data)
{
	UnsubscribeFromEvent("AsyncLoadFinished");

	newScene_ = data["Scene"].GetPtr();

	SubscribeToEvent("Update", "HandleDelayedStart");
}

void HandleDelayedStart(StringHash type, VariantMap& data)
{
	UnsubscribeFromEvent("Update");

	Node@ cameraNode = newScene_.GetChild("Camera", true);
	Camera@ newCamera = cameraNode.CreateComponent("Camera");

	Viewport@ viewport = Viewport(newScene_, cameraNode.GetComponent("Camera"));
	renderer.viewports[0] = viewport;

	scene_ = newScene_;
	camera_ = newCamera;
	newScene_ = null;
}

Add a level timer to the main procedure

Scene@ newScene_;
Scene@ scene_;
Camera@ camera_;
Timer timer_;

void Start()
{
	StartScene("Scenes/Level1.xml");
	SubscribeToEvent("LevelComplete", "HandleLevelComplete");
}

void Stop()
{
}

void HandleLevelComplete(StringHash type, VariantMap& data)
{
	log.Debug("Level Complete. I should be loading "+data["NextLevel"].GetString());
	float timeTaken = timer_.GetMSec(false);
	log.Debug("You took " + timeTaken / 1000.f + " seconds to solve the level");

	StartScene(data["NextLevel"].GetString());
}

void StartScene(String scene)
{
	newScene_ = Scene();
	newScene_.LoadAsyncXML(cache.GetFile(scene));

	SubscribeToEvent("AsyncLoadFinished", "HandleAsyncLoadFinished");
}

void HandleAsyncLoadFinished(StringHash type, VariantMap& data)
{
	UnsubscribeFromEvent("AsyncLoadFinished");

	newScene_ = data["Scene"].GetPtr();

	SubscribeToEvent("Update", "HandleDelayedStart");
}

void HandleDelayedStart(StringHash type, VariantMap& data)
{
	UnsubscribeFromEvent("Update");

	Node@ cameraNode = newScene_.GetChild("Camera", true);
	Camera@ newCamera = cameraNode.CreateComponent("Camera");

	Viewport@ viewport = Viewport(newScene_, cameraNode.GetComponent("Camera"));
	renderer.viewports[0] = viewport;

	scene_ = newScene_;
	camera_ = newCamera;
	newScene_ = null;

	timer_.Reset();
}


//
// $Id$

package com.threerings.flash {

import flash.display.Sprite;

import flash.events.Event;

/**
 * Convenience superclass to use for sprites that need to update every frame.
 * (One must be very careful to remove all ENTER_FRAME listeners when not needed, as they
 * will prevent an object from being garbage collected!)
 */
public class FrameSprite extends Sprite
{
    public function FrameSprite ()
    {
        addEventListener(Event.ADDED_TO_STAGE, handleAdded);
        addEventListener(Event.REMOVED_FROM_STAGE, handleRemoved);
    }

    /**
     * Called when we're added to the stage.
     */
    protected function handleAdded (... ignored) :void
    {
        addEventListener(Event.ENTER_FRAME, handleFrame);
        handleFrame(); // update immediately
    }

    /**
     * Called when we're added to the stage.
     */
    protected function handleRemoved (... ignored) :void
    {
        removeEventListener(Event.ENTER_FRAME, handleFrame);
    }

    /**
     * Called to update our visual appearance prior to each frame.
     */
    protected function handleFrame (... ignored) :void
    {
        // nothing here. Override in yor subclass.
    }
}

}

Allow subclasses to choose not to call handleFrame() when ADDED_TO_STAGE is received.

//
// $Id$

package com.threerings.flash {

import flash.display.Sprite;

import flash.events.Event;

/**
 * Convenience superclass to use for sprites that need to update every frame.
 * (One must be very careful to remove all ENTER_FRAME listeners when not needed, as they
 * will prevent an object from being garbage collected!)
 */
public class FrameSprite extends Sprite
{
    /**
     * @param renderFrameUponAdding if true, the handleFrame() method
     *        is called whenever an ADDED_TO_STAGE event is received.
     */
    public function FrameSprite (renderFrameUponAdding :Boolean = true)
    {
        _renderOnAdd = renderFrameUponAdding;

        addEventListener(Event.ADDED_TO_STAGE, handleAdded);
        addEventListener(Event.REMOVED_FROM_STAGE, handleRemoved);
    }

    /**
     * Called when we're added to the stage.
     */
    protected function handleAdded (... ignored) :void
    {
        addEventListener(Event.ENTER_FRAME, handleFrame);
        if (_renderOnAdd) {
            handleFrame(); // update immediately
        }
    }

    /**
     * Called when we're added to the stage.
     */
    protected function handleRemoved (... ignored) :void
    {
        removeEventListener(Event.ENTER_FRAME, handleFrame);
    }

    /**
     * Called to update our visual appearance prior to each frame.
     */
    protected function handleFrame (... ignored) :void
    {
        // nothing here. Override in yor subclass.
    }

    /** Should we call handleFrame() when we get ADDED_TO_STAGE? */
    protected var _renderOnAdd :Boolean;
}

}


package org.servebox.cafe.core.application
{
	import org.servebox.cafe.core.spring.ApplicationContext;

	import spark.components.Application;

	public class Application extends spark.components.Application implements CafeApplication
	{
		private var _context : ApplicationContext;

		public function Application()
		{
			super();
			ApplicationInitializer.prepare( this );
			_context = ApplicationInitializer.getDefaultContext();
		}

		public function getContext():ApplicationContext
		{
			return null;
		}
	}
}

Fix bug on getContext() null

package org.servebox.cafe.core.application
{
	import org.servebox.cafe.core.spring.ApplicationContext;

	import spark.components.Application;

	public class Application extends spark.components.Application implements CafeApplication
	{
		private var _context : ApplicationContext;

		public function Application()
		{
			super();
			ApplicationInitializer.prepare( this );
			_context = ApplicationInitializer.getDefaultContext();
		}

		public function getContext():ApplicationContext
		{
			return _context;
		}
	}
}


////////////////////////////////////////////////////////////////////////////////
//
//  Licensed to the Apache Software Foundation (ASF) under one or more
//  contributor license agreements.  See the NOTICE file distributed with
//  this work for additional information regarding copyright ownership.
//  The ASF licenses this file to You under the Apache License, Version 2.0
//  (the "License"); you may not use this file except in compliance with
//  the License.  You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
//  Unless required by applicable law or agreed to in writing, software
//  distributed under the License is distributed on an "AS IS" BASIS,
//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//  See the License for the specific language governing permissions and
//  limitations under the License.
//
////////////////////////////////////////////////////////////////////////////////
package org.apache.flex.html.staticControls.beads
{
	import flash.display.Graphics;
	import flash.events.Event;
	import flash.events.IEventDispatcher;

	import org.apache.flex.core.IBead;
	import org.apache.flex.core.IStrand;
	import org.apache.flex.core.UIBase;

	public class SolidBackgroundBead implements IBead
	{
		public function SolidBackgroundBead()
		{
		}

		private var _strand:IStrand;

		public function get strand():IStrand
		{
			return _strand;
		}
		public function set strand(value:IStrand):void
		{
			_strand = value;
            IEventDispatcher(value).addEventListener("heightChanged", changeHandler);
            IEventDispatcher(value).addEventListener("widthChanged", changeHandler);
		}

		private var _backgroundColor:uint;

		public function get backgroundColor():uint
		{
			return _backgroundColor;
		}
		public function set backgroundColor(value:uint):void
		{
			_backgroundColor = value;
			if (_strand)
				changeHandler(null);
		}

		private function changeHandler(event:Event):void
		{
            var host:UIBase = UIBase(_strand);
            var g:Graphics = host.graphics;
            var w:Number = host.width;
            var h:Number = host.height;
            g.clear();
            g.beginFill(backgroundColor);
            g.drawRect(0, 0, w, h);
            g.endFill();
		}
	}
}


/* -*- Mode: java; indent-tabs-mode: nil -*- */
/*
   Compiled with:
   java -jar utils/asc.jar -import playerglobal.abc -swf Template,100,100,10 test/swfs/test_TemplateTest.as

   This template is for writing test SWFs using pure AS3. It allows for testing
   UI events, screen and program state using the Shumway test harness.
*/

package {

    import flash.display.Sprite;
    import flash.events.Event;

    public class TemplateTest extends Sprite {
        public var loader;
        public function TemplateTest() {
            var child = new TestObject();
            addChild(child);
            addEventListener(Event.ENTER_FRAME, child.enterFrameHandler);
        }
    }
}

import flash.display.*;
import flash.events.*;
import flash.net.*;

class TestObject extends Sprite {
    private var color: uint = 0xFFCC00;
    private var pos: uint   = 10;
    private var size: uint  = 80;

    /*
      In the constructor, install event listeners for testing events, and
      construct and add child objects.
    */
    public function TestObject() {
    }

    private var frameCount = 0;

    /*
      In the enterFrameHandler, make API calls per frame to test both
      screen and program side-effects.
    */
    function enterFrameHandler(event:Event):void {
        frameCount++;
        var target = event.target;
        var loader = target.loader;
        switch (frameCount) {
        case 1:
            (function () {
                /*
                  Log test results in the standard format shown here to allow
                  for easy linking with monitor programs.
                */
                var result = true ? "PASS" : "FAIL";
                trace(result + ": test::Template/method ()");
                trace(result + ": test::Template/get name ()");
                trace(result + ": test::Template/set name ()");
            })();
            break;
        default:
            /*
              Remove enterFrameHandler when done.
            */
            parent.removeEventListener(Event.ENTER_FRAME, enterFrameHandler);
            break;
        }
    }
}


Create a dummy textbox class for the sole purpose of writing the XML loader

package Classes
{
	public class Textbox
	{
		public var contents:String;

		public function Textbox()
		{
			contents="";
		}
		public function Textbox(text)
		{
			contents=text;
		}
		public setContents(text)
		{
			contents=text;
		}
	}
}


Add AngelScript Http Request demo sample.

// Http request example.
// This example demonstrates:
//     - How to use Http request API

#include "Scripts/Utilities/Sample.as"

String message;
Text@ text;
HttpRequest@ httpRequest;

void Start()
{
    // Execute the common startup for samples
    SampleStart();

    // Create the user interface
    CreateUI();

    // Set the mouse mode to use in the sample
    SampleInitMouseMode(MM_FREE);

    // Subscribe to basic events such as update
    SubscribeToEvents();
}

void CreateUI()
{
    // Construct new Text object
    text = Text();

    // Set font and text color
    text.SetFont(cache.GetResource("Font", "Fonts/Anonymous Pro.ttf"), 15);
    text.color = Color(1.0f, 1.0f, 0.0f);

    // Align Text center-screen
    text.horizontalAlignment = HA_CENTER;
    text.verticalAlignment = VA_CENTER;

    // Add Text instance to the UI root element
    ui.root.AddChild(text);
}

void SubscribeToEvents()
{
    // Subscribe HandleUpdate() function for processing HTTP request
    SubscribeToEvent("Update", "HandleUpdate");
}

void HandleUpdate(StringHash eventType, VariantMap& eventData)
{
    // Create HTTP request
    if (httpRequest is null)
        httpRequest = network.MakeHttpRequest("http://httpbin.org/ip", "GET");
    else
    {
        // Initializing HTTP request
        if (httpRequest.state == HTTP_INITIALIZING)
            return;
        // An error has occured
        else if (httpRequest.state == HTTP_ERROR)
        {
            text.text = "An error has occured.";
            UnsubscribeFromEvent("Update");
        }
        // Get message data
        else
        {
            if (httpRequest.availableSize > 0)
                message += httpRequest.ReadLine();
            else
            {
                text.text = "Processing...";

                JSONFile@ json = JSONFile();
                json.FromString(message);

                JSONValue val = json.GetRoot().Get("origin");

                if (val.isNull)
                    text.text = "Invalid string.";
                else
                    text.text =  "Your IP is: " + val.GetString();

                UnsubscribeFromEvent("Update");
            }
        }
    }
}

// Create XML patch instructions for screen joystick layout specific to this sample app
String patchInstructions =
        "<patch>" +
        "    <add sel=\"/element/element[./attribute[@name='Name' and @value='Hat0']]\">" +
        "        <attribute name=\"Is Visible\" value=\"false\" />" +
        "    </add>" +
        "</patch>";


package
{
    import flash.display.Sprite;
    import flash.text.TextField;
    import flash.net.XMLSocket;

    public class swfcat extends Sprite
    {
        private var output_text:TextField;

        private function puts(s:String):void
        {
            output_text.appendText(s + "\n");
        }

        public function swfcat()
        {
            output_text = new TextField();
            output_text.width = 400;
            output_text.height = 300;
            output_text.background = true;
            output_text.backgroundColor = 0x001f0f;
            output_text.textColor = 0x44CC44;
            addChild(output_text);
        }
    }
}


Test case base class -- all AS test classes extend this.

/*
Copyright 2009, Matthew Eernisse (mde@fleegix.org) and Slide, Inc.

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
*/

package org.windmill {
  import flash.display.Sprite;
  import flash.display.Stage;
  import org.windmill.WMAssert;
  public class TestCase extends Sprite {
    public var asserts:* = WMAssert;
    // Get a reference to the Stage in the base class
    // before the tests actually load so tests can all
    // reference it
    private var fakeStage:Stage = Windmill.getStage();
    override public function get stage():Stage {
      return fakeStage;
    }
  }
}


Add stub class for Equivalence class testing

package unittests
{
	public class TestEquivalence
	{
		[Before]
		public function setUp():void
		{
		}

		[After]
		public function tearDown():void
		{
		}

		[BeforeClass]
		public static function setUpBeforeClass():void
		{
		}

		[AfterClass]
		public static function tearDownAfterClass():void
		{
		}

	}
}


Add VertexUvShader (vertex streams must have an uv component)

package aerys.minko.render.effect.vertex
{
	import aerys.minko.render.RenderTarget;
	import aerys.minko.render.effect.basic.BasicShader;
	import aerys.minko.render.shader.SFloat;
	import aerys.minko.type.stream.format.VertexComponent;

	public class VertexUVShader extends BasicShader
	{

		public function VertexUVShader(target 	: RenderTarget 	= null,
									   priority	: Number		= 0)
		{
			super(target, priority);
		}

		override protected function getPixelColor() : SFloat
		{
			var uv 				: SFloat = getVertexAttribute(VertexComponent.UV);
			var interpolatedUv 	: SFloat = normalize(interpolate(uv));

			return float4(interpolatedUv.x, interpolatedUv.y, 0, 1);
		}

	}
}


package dolly.utils {
import dolly.core.dolly_internal;

import mx.collections.ArrayCollection;
import mx.collections.ArrayList;

use namespace dolly_internal;

public class PropertyUtilTests {

	private var sourceObj:Object;
	private var targetObj:Object;

	[Before]
	public function before():void {
		sourceObj = {};
		sourceObj.array = [0, 1, 2, 3, 4];
		sourceObj.arrayList = new ArrayList([0, 1, 2, 3, 4]);
		sourceObj.arrayCollection = new ArrayCollection([0, 1, 2, 3, 4]);

		targetObj = {};
	}

	[After]
	public function after():void {
		sourceObj = targetObj = null;
	}
}
}


Fix 525654 - added test for runtime Vector specialization

/* ***** BEGIN LICENSE BLOCK *****
 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
 *
 * The contents of this file are subject to the Mozilla Public License Version
 * 1.1 (the "License"); you may not use this file except in compliance with
 * the License. You may obtain a copy of the License at
 * http://www.mozilla.org/MPL/
 *
 * Software distributed under the License is distributed on an "AS IS" basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
 * for the specific language governing rights and limitations under the
 * License.
 *
 * The Original Code is [Open Source Virtual Machine.].
 *
 * The Initial Developer of the Original Code is
 * Adobe System Incorporated.
 * Portions created by the Initial Developer are Copyright (C) 2007-2008
 * the Initial Developer. All Rights Reserved.
 *
 * Contributor(s):
 *   Adobe AS3 Team
 *
 * Alternatively, the contents of this file may be used under the terms of
 * either the GNU General Public License Version 2 or later (the "GPL"), or
 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
 * in which case the provisions of the GPL or the LGPL are applicable instead
 * of those above. If you wish to allow use of your version of this file only
 * under the terms of either the GPL or the LGPL, and not to allow others to
 * use your version of this file under the terms of the MPL, indicate your
 * decision by deleting the provisions above and replace them with the notice
 * and other provisions required by the GPL or the LGPL. If you do not delete
 * the provisions above, a recipient may use your version of this file under
 * the terms of any one of the MPL, the GPL or the LGPL.
 *
 * ***** END LICENSE BLOCK ***** */
/**
   Description:
   Runtime specialization
   Specialization of the Vector type can be done at runtime
   instead of at compile time.
*/

function getVector() { return Vector; }

var CODE = 1007; //  Instantiation attempted on a non-constructor.

startTest();
var TITLE="Runtime specialization";
writeHeaderToLog(TITLE);

var x = getVector().<int>;
y = new x();

y.push(1);
y.push(2);
y.push(3);

AddTestCase(    "Vector constructed via runtime specialization",
                3,
                y.length);

AddTestCase(    "Vector constructed via runtime specialization",
                2,
                y[1]);

var neg_result = "Failed to catch invalid construct";

try {
   unspecialized = getVector();
   var z = new unspecialized();
} catch ( ex )
{
    neg_result = String(ex);
}

AddTestCase ( "Invalid use of unspecialized type in constructor", TYPEERROR + CODE,  typeError(neg_result));

test();


Test class for cloning of PropertyLevelCopyableCloneableClass.

package dolly {

import dolly.core.dolly_internal;
import dolly.data.PropertyLevelCopyableCloneableClass;

import org.as3commons.reflect.Type;

use namespace dolly_internal;

public class CloningOfPropertyLevelCopyableCloneableClassTest {

	private var propertyLevelCopyableCloneable:PropertyLevelCopyableCloneableClass;
	private var propertyLevelCopyableCloneableType:Type;

	[Before]
	public function before():void {
		propertyLevelCopyableCloneable = new PropertyLevelCopyableCloneableClass();
		propertyLevelCopyableCloneable.property1 = "property1 value";
		propertyLevelCopyableCloneable.writableField1 = "writableField1 value";
		propertyLevelCopyableCloneableType = Type.forInstance(propertyLevelCopyableCloneable);
	}

	[After]
	public function after():void {
		propertyLevelCopyableCloneable = null;
		propertyLevelCopyableCloneableType = null;
	}

	/**
	 * Cloner.findingAllWritableFieldsForType() method will throw CloningError in this case
	 * because PropertyLevelCopyableCloneableClass class is not cloneable indeed.
	 */
	[Test(expects="dolly.core.errors.CloningError")]
	public function findingAllWritableFieldsForType():void {
		Cloner.findAllWritableFieldsForType(propertyLevelCopyableCloneableType);
	}

	/**
	 * Cloner.clone() method will throw CloningError in this case
	 * because PropertyLevelCopyableCloneableClass class is not cloneable indeed.
	 */
	[Test(expects="dolly.core.errors.CloningError")]
	public function cloningByCloner():void {
		Cloner.clone(propertyLevelCopyableCloneable);
	}

	/**
	 * Method clone() will throw CloningError in this case
	 * because PropertyLevelCopyableCloneableClass class is not cloneable indeed.
	 */
	[Test(expects="dolly.core.errors.CloningError")]
	public function cloningByCloneFunction():void {
		clone(propertyLevelCopyableCloneable);
	}
}
}


[GenericAccessors]
interface Foo<G> : Object {
	public virtual G get_foo (G g) {
		return g;
	}
}

class Bar<G> : Object, Foo<G> {
}

void main () {
	var bar = new Bar<string> ();
	assert ("foo" == bar.get_foo ("foo"));
}

Extend "GenericAccessors" test to increase coverage

[GenericAccessors]
interface Foo<G> : Object {
	public virtual G get_foo (G g) {
		assert (typeof (G) == typeof (string));
		G g_copy = g;
		assert (GLib.strcmp ((string) g_copy, "foo") == 0);
		assert (&g_copy != &g);
		return g;
	}
}

class Bar<G> : Object, Foo<G> {
}

void main () {
	var bar = new Bar<string> ();
	assert ("foo" == bar.get_foo ("foo"));
}


/**
 * SubZero, a MDNS browser.
 * Copyright (C) 2012 Daniel Svensson
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */

public static void main (string[] args)
{
	var ml = new GLib.MainLoop();

	var sc = new SubZero.Browser();
	sc.services = { "_xmms2._tcp.local" };

	sc.service_event.connect((service, hostname, port) => {
		GLib.warning(@"Found $service at $hostname:$port");
	});

	sc.start();
	ml.run();
	sc.stop();
}

Use print instead of warning in example.

/**
 * SubZero, a MDNS browser.
 * Copyright (C) 2012 Daniel Svensson
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */

public static void main (string[] args)
{
	var ml = new GLib.MainLoop();

	var sc = new SubZero.Browser();
	sc.services = { "_xmms2._tcp.local" };

	sc.service_event.connect((service, hostname, port) => {
		GLib.print(@"Found $service at $hostname:$port\n");
	});

	sc.start();
	ml.run();
	sc.stop();
}


[CCode (array_length = false, array_null_terminated = true)]
string[] manam;

class Foo {
	public string[] f = manam;
	public string[] i = { "baz", "foo", "bar" };
	public static string[] sf = manam;
	public static string[] si = { "baz", "foo", "bar" };
}

[CCode (array_length = false)]
string[] minim;

class Bar {
	public string[] f = minim;
	public static string[] sf = minim;
}

void main () {
	{
		manam = { "manam", "foo", "bar" };
		assert (manam.length == 3);
		var foo = new Foo ();
		assert (foo.f.length == 3);
		assert (Foo.sf.length == 3);
		assert (foo.i.length == 3);
		assert (Foo.si.length == 3);
	}
	{
		minim = { "minim", "foo", "bar" };
		assert (minim.length == -1);
		var bar = new Bar ();
		assert (bar.f.length == -1);
		assert (Bar.sf.length == -1);
	}
}

Extend "array field intializer" test to increase coverage

[CCode (array_length = false, array_null_terminated = true)]
string[] manam;

class Foo {
	public string[] f = manam;
	public string[] i = { "baz", "foo", "bar" };
	public string[] ia = { "baz", manam[0], "bar" };
	public static string[] sf = manam;
	public static string[] si = { "baz", "foo", "bar" };
	public static string[] sa = { "baz", manam[0], "bar" };
}

[CCode (array_length = false)]
string[] minim;

class Bar {
	public string[] f = minim;
	public static string[] sf = minim;
}

void main () {
	{
		manam = { "manam", "foo", "bar" };
		assert (manam.length == 3);
		var foo = new Foo ();
		assert (foo.f.length == 3);
		assert (foo.f[0] == "manam");
		assert (Foo.sf.length == 3);
		assert (Foo.sf[0] == "manam");
		assert (foo.i.length == 3);
		assert (foo.ia.length == 3);
		assert (foo.ia[1] == "manam");
		assert (Foo.si.length == 3);
		assert (Foo.sa.length == 3);
		assert (Foo.sa[1] == "manam");
	}
	{
		minim = { "minim", "foo", "bar" };
		assert (minim.length == -1);
		var bar = new Bar ();
		assert (bar.f.length == -1);
		assert (Bar.sf.length == -1);
	}
}


class Maman.Foo : Object {
	[Signal (detailed = true)]
	public signal void bar ();
}

void main () {
	bool detailed1 = false;
	bool detailed2 = false;
	string detail1 = "detail1";
	string detail2 = "detail2";

	var foo = new Maman.Foo ();
	foo.bar[detail1].connect (() => { detailed1 = true; });
	foo.bar[detail2].connect (() => { detailed2 = true; });
	foo.bar[detail1] ();
	foo.bar[detail2] ();
	assert (detailed1 && detailed2);
}

Extend "detailed signal" test to increase coverage

class Maman.Foo : Object {
	[Signal (detailed = true)]
	public signal void bar ();
}

void main () {
	bool detailed1 = false;
	bool detailed2 = false;
	bool detailed3 = false;
	string detail1 = "detail1";
	string detail2 = "detail2";

	var foo = new Maman.Foo ();
	foo.bar[detail1].connect (() => { detailed1 = true; });
	foo.bar[detail2].connect (() => { detailed2 = true; });
	foo.bar["detail3"].connect (() => { detailed3 = true; });
	foo.bar[detail1] ();
	foo.bar[detail2] ();
	foo.bar["detail3"] ();
	assert (detailed1 && detailed2 && detailed3);
}


/* iterable.vala
 *
 * Copyright (C) 2007-2008  Jürg Billeter
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.

 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.

 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
 *
 * Author:
 * 	Jürg Billeter <j@bitron.ch>
 */

using GLib;

/**
 * Implemented by classes that support a simple iteration over instances of the
 * collection.
 */
public interface Gee.Iterable<G> : GLib.Object {
	public abstract Type get_element_type ();

	/**
	 * Returns a Iterator that can be used for simple iteration over a
	 * collection.
	 *
	 * @return a Iterator that can be used for simple iteration over a
	 *         collection
	 */
	public abstract Iterator<G> iterator ();
}

Add missing method documentation comment

/* iterable.vala
 *
 * Copyright (C) 2007-2008  Jürg Billeter
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.

 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.

 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
 *
 * Author:
 * 	Jürg Billeter <j@bitron.ch>
 */

using GLib;

/**
 * Implemented by classes that support a simple iteration over instances of the
 * collection.
 */
public interface Gee.Iterable<G> : GLib.Object {
	/**
	 * Returns the type of the elements contained in this collection.
	 *
	 * @return the type of the elements contained in this collection
	 */
	public abstract Type get_element_type ();

	/**
	 * Returns a Iterator that can be used for simple iteration over a
	 * collection.
	 *
	 * @return a Iterator that can be used for simple iteration over a
	 *         collection
	 */
	public abstract Iterator<G> iterator ();
}


using GLib;
using DBus;

namespace FreeSmartphone {
	public static GLib.Object get_proxy(DBus.Connection connection, string bus_name, string object_path, string interface_name, Type type) {
		return connection.get_object_from_type(bus_name, object_path, interface_name, type);
	}
}


/*
 * Copyright (C) 2010 Jens Georg <mail@jensge.org>.
 *
 * Author: Jens Georg <mail@jensge.org>
 *
 * This file is part of Rygel.
 *
 * Rygel is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * Rygel is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 */

internal class Rygel.MediaExportObjectFactory : MediaDBObjectFactory {
    public override MediaContainer get_container (MediaDB media_db,
                                                  string  id,
                                                  string  title,
                                                  uint    child_count) {
        return new MediaExportWritableContainer (media_db, id, title);
    }
}

Make object-factory hand out virtual containers

/*
 * Copyright (C) 2010 Jens Georg <mail@jensge.org>.
 *
 * Author: Jens Georg <mail@jensge.org>
 *
 * This file is part of Rygel.
 *
 * Rygel is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * Rygel is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 */

internal class Rygel.MediaExportObjectFactory : MediaDBObjectFactory {
    public override MediaContainer get_container (MediaDB media_db,
                                                  string  id,
                                                  string  title,
                                                  uint    child_count) {
        if (id.has_prefix (MediaExportQueryContainer.PREFIX)) {
            return new MediaExportQueryContainer (media_db, id, title);
        } else {
            return new MediaExportWritableContainer (media_db, id, title);
        }
    }
}


using Tracker;
using Tracker.Sparql;

int
main( string[] args )
{
	TestApp app = new TestApp (new  Tracker.Bus.Connection ());

	return app.run ();
}

Simplify error handling in query tests

using Tracker;
using Tracker.Sparql;

int
main( string[] args )
{
	try {
		TestApp app = new TestApp (new  Tracker.Bus.Connection ());

		return app.run ();
	} catch (GLib.Error e) {
		warning ("Couldn't perform test: %s", e.message);
		return 1;
	}
}


/* valacallable.vala
 *
 * Copyright (C) 2011  Luca Bruno
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.

 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.

 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
 *
 * Author:
 * 	Luca Bruno <lucabru@src.gnome.org>
 */

using GLib;

/**
 * Interface for all callable types.
 */
public interface Vala.Callable : CodeNode {
	/**
	 * The return type of this callable.
	 */
	public abstract DataType return_type { get; set; }

	/**
	 * Appends parameter to this callable.
	 *
	 * @param param a formal parameter
	 */
	public abstract void add_parameter (Parameter param);

	/**
	 * Returns the parameter list.
	 */
	public abstract unowned List<Parameter> get_parameters ();
}

Make Callable derive from Symbol

/* valacallable.vala
 *
 * Copyright (C) 2011  Luca Bruno
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.

 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.

 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
 *
 * Author:
 * 	Luca Bruno <lucabru@src.gnome.org>
 */

using GLib;

/**
 * Interface for all callable types.
 */
public interface Vala.Callable : Symbol {
	/**
	 * The return type of this callable.
	 */
	public abstract DataType return_type { get; set; }

	/**
	 * Appends parameter to this callable.
	 *
	 * @param param a formal parameter
	 */
	public abstract void add_parameter (Parameter param);

	/**
	 * Returns the parameter list.
	 */
	public abstract unowned List<Parameter> get_parameters ();
}


/*
 * Copyright (C) 2010, Nokia <ivan.frade@nokia.com>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA  02110-1301, USA.
 */

public abstract class Tracker.Sparql.Cursor : Object {
	public abstract int n_columns { get; }
	public abstract unowned string get_string (int column, out int length = null);
	public virtual bool interrupt () throws GLib.Error {
		warning ("Interrupt interface called when not implemented");
		return false;
	}

	public abstract bool iter_next () throws GLib.Error;
	public abstract void rewind ();
}

Add connection property to Cursor class

/*
 * Copyright (C) 2010, Nokia <ivan.frade@nokia.com>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA  02110-1301, USA.
 */

public abstract class Tracker.Sparql.Cursor : Object {
	public Connection connection { get; set; }
	public abstract int n_columns { get; }
	public abstract unowned string get_string (int column, out int length = null);
	public virtual bool interrupt () throws GLib.Error {
		warning ("Interrupt interface called when not implemented");
		return false;
	}

	public abstract bool iter_next () throws GLib.Error;
	public abstract void rewind ();
}


using Gtk;

public static int runmode = 0; // 0 -> Desktop, 1 -> Tablet

public void main (string[] args) {
	Gtk.init (ref args);

	foreach(string arg in args) {
		stdout.printf("Argument : %s\n",arg);
		if(arg == "tablet") {
			stdout.printf("Entering Tablet Mode.\n");
			runmode = 1;
		}
	}

	Gtk.Window taskl;
	if (runmode == 1) {
		taskl = new ATaskl.TabletWindow  ();
	} else {
		taskl = new ATaskl.MainWindow  ();
		taskl.show_all ();
	}

	int hx, hy;
	taskl.get_size (out hx, out hy);

	Panel.MainWindow win = new Panel.MainWindow (hy, runmode, taskl);
	win.show_all ();

	Gtk.main ();
}

Fix a bug: ALaunch in tablet mode

using Gtk;

public static int runmode = 0; // 0 -> Desktop, 1 -> Tablet

public void main (string[] args) {
	Gtk.init (ref args);

	foreach(string arg in args) {
		stdout.printf("Argument : %s\n",arg);
		if(arg == "tablet") {
			stdout.printf("Entering Tablet Mode.\n");
			runmode = 1;
		}
	}

	Gtk.Window taskl;
	if (runmode == 1) {
		taskl = new ATaskl.TabletWindow  ();
	} else {
		taskl = new ATaskl.MainWindow  ();
		taskl.show_all ();
	}

	int hx, hy;
	taskl.get_size (out hx, out hy);

	Panel.MainWindow win;
	if (runmode == 1) {
		win = new Panel.MainWindow (0, runmode, taskl);
	} else {
		win = new Panel.MainWindow (hy, runmode, taskl);
	}
	win.show_all ();

	Gtk.main ();
}


void main () {
	{
		int i = 0;
		i = i++ + 1;
		assert (i == 1);
	}
	{
		int i = 0;
		assert (i++ == 0);
	}
	{
		int i = 0;
		i = ++i + 1;
		assert (i == 2);
	}
	{
		int i = 0;
		assert (++i == 1);
	}
}

Extend "pre-post increment" test to increase coverage


using Dockery.DockerSdk;
using Dockery.DockerSdk.Model;

namespace Dockery.DockerSdk.Serializer {

    public class PullStepDeserializer : Object {

        public Model.Remote.PullStep? deserialize(string json) throws DeserializationError {

            Model.Remote.PullStep pull_step;

            try {
                var parser = new Json.Parser();

                parser.load_from_data(json);

                var node = parser.get_root();

                string id = node.get_object().get_string_member("id");
                string status = node.get_object().get_string_member("status");

                Remote.PullStepProgress? progress = null;

                if (node.get_object().has_member("progressDetail")) {
                    var progress_details = node.get_object().get_object_member("progressDetail");
                    if (progress_details.has_member("current") && progress_details.has_member("total")) {
                        progress = new Remote.PullStepProgress(
                            progress_details.get_int_member("current"),
                            progress_details.get_int_member("total")
                        );
                    }
                }

                return new Model.Remote.PullStep.from(
                    Remote.PullStep.get_status_from_raw_status(status),
                    id,
                    progress
                );

            } catch (Error e) {
                throw new DeserializationError.PULL_PROCESS_DATA("Error while deserializing pull step : %s".printf(e.message));
            }
        }
    }
}

Add PullStep.Status.DIGEST step to deserializer

using Dockery.DockerSdk;
using Dockery.DockerSdk.Model;

namespace Dockery.DockerSdk.Serializer {

    public class PullStepDeserializer : Object {

        public Model.Remote.PullStep? deserialize(string json) throws DeserializationError {

            Model.Remote.PullStep pull_step;

            try {
                var parser = new Json.Parser();

                parser.load_from_data(json);

                var node = parser.get_root();

                string id;

                if (node.get_object().has_member("id")) {
                    id = node.get_object().get_string_member("id");
                } else {
                    //Digest status case
                    id = "NA";
                }

                string status = node.get_object().get_string_member("status");

                Remote.PullStepProgress? progress = null;

                if (node.get_object().has_member("progressDetail")) {
                    var progress_details = node.get_object().get_object_member("progressDetail");
                    if (progress_details.has_member("current") && progress_details.has_member("total")) {
                        progress = new Remote.PullStepProgress(
                            progress_details.get_int_member("current"),
                            progress_details.get_int_member("total")
                        );
                    }
                }

                return new Model.Remote.PullStep.from(
                    Remote.PullStep.get_status_from_raw_status(status),
                    id,
                    progress
                );

            } catch (Error e) {
                throw new DeserializationError.PULL_PROCESS_DATA("Error while deserializing pull step : %s".printf(e.message));
            }
        }
    }
}


[CCode (cname = "g_hash_table_get_keys_as_array", array_length_type = "guint", type = "gpointer*")]
public extern (unowned string)[] g_hash_table_get_keys_as_array (GLib.HashTable<string,string> hash_table);

private static int main (string[] args) {
  var ht = new GLib.HashTable<string,string> (GLib.str_hash, GLib.str_equal);
  ht["one"] = "hello";
  ht["two"] = "world";

  string[] keys = g_hash_table_get_keys_as_array (ht);
  ht = null;

  foreach (unowned string k in keys) {
	  assert (k == "one" || k == "two");
  }

  return 0;
}

Fix test of previous commit a6df1b9

string foo = null;

(unowned string)[] bar () {
	(unowned string)[] ret = new (unowned string)[1];
	ret[0] = foo;
	return ret;
}

void main() {
	foo = "foo";

	string[] keys = bar();
	foo = null;

	foreach (unowned string k in keys) {
		assert (k == "foo");
	}
}


// This file is part of GNOME Boxes. License: LGPLv2+

private abstract class Boxes.CollectionItem: Boxes.UI {
    public string name { set; get; }
}

private class Boxes.Collection: GLib.Object {
    public signal void item_added (CollectionItem item);
    public signal void item_removed (CollectionItem item);

    public GenericArray<CollectionItem> items;

    construct {
        items = new GenericArray<CollectionItem> ();
    }

    public Collection () {
    }

    public void add_item (CollectionItem item) {
        items.add (item);
        item_added (item);
    }

    public void remove_item (CollectionItem item) {
        items.remove (item);
        item_removed (item);
    }
}

private class Boxes.CollectionFilter: GLib.Object {
    public string text;

    public bool filter (CollectionItem item) {
        if (text == null)
            return true;

        var text = text.casefold ();
        return item.name.casefold ().index_of (text) != -1;
    }
}

private class Boxes.Category: GLib.Object {
    public enum Kind {
        USER,
        NEW,
        FAVORITES,
        PRIVATE,
        SHARED
    }

    public string name;
    public Kind kind;

    public Category (string name, Kind kind = Kind.USER) {
        this.name = name;
        this.kind = kind;
    }
}

Allow search with multiple terms

// This file is part of GNOME Boxes. License: LGPLv2+

private abstract class Boxes.CollectionItem: Boxes.UI {
    public string name { set; get; }
}

private class Boxes.Collection: GLib.Object {
    public signal void item_added (CollectionItem item);
    public signal void item_removed (CollectionItem item);

    public GenericArray<CollectionItem> items;

    construct {
        items = new GenericArray<CollectionItem> ();
    }

    public Collection () {
    }

    public void add_item (CollectionItem item) {
        items.add (item);
        item_added (item);
    }

    public void remove_item (CollectionItem item) {
        items.remove (item);
        item_removed (item);
    }
}

private class Boxes.CollectionFilter: GLib.Object {
    string [] terms;

    public string text {
        set {
            terms = value.split(" ");
            for (int i = 0; i < terms.length; i++)
                terms[i] = canonicalize_for_search (terms[i]);
        }
    }

    public bool filter (CollectionItem item) {
        var name = canonicalize_for_search (item.name);
        foreach (var term in terms) {
            if (! (term in name))
                return false;
        }
        return true;
    }
}

private class Boxes.Category: GLib.Object {
    public enum Kind {
        USER,
        NEW,
        FAVORITES,
        PRIVATE,
        SHARED
    }

    public string name;
    public Kind kind;

    public Category (string name, Kind kind = Kind.USER) {
        this.name = name;
        this.kind = kind;
    }
}


namespace GtkClutter {
	public errordomain TextureError {
		[Deprecated (since = "vala-0.16", replacement = "INVALID_STOCK_ID")]
		[CCode (cname = "GTK_CLUTTER_TEXTURE_ERROR_INVALID_STOCK_ID")]
		ID
	}

	public const int CLUTTER_GTK_MAJOR_VERSION;
	public const int CLUTTER_GTK_MICRO_VERSION;
	public const int CLUTTER_GTK_MINOR_VERSION;
	public const int CLUTTER_GTK_VERSION_HEX;
	public const string CLUTTER_GTK_VERSION_S;
	public static bool check_version (uint major, uint minor, uint micro);
}

Use [Version] instead of [Deprecated] and

namespace GtkClutter {
	public errordomain TextureError {
		[Version (deprecated_since = "vala-0.16", replacement = "INVALID_STOCK_ID")]
		[CCode (cname = "GTK_CLUTTER_TEXTURE_ERROR_INVALID_STOCK_ID")]
		ID
	}

	public const int CLUTTER_GTK_MAJOR_VERSION;
	public const int CLUTTER_GTK_MICRO_VERSION;
	public const int CLUTTER_GTK_MINOR_VERSION;
	public const int CLUTTER_GTK_VERSION_HEX;
	public const string CLUTTER_GTK_VERSION_S;
	public static bool check_version (uint major, uint minor, uint micro);
}


void foo ([CCode (array_length_type = "gsize")] ref uint8[] a) {
	assert (a.length == 32);
}

void main () {
	uint8[] a = new uint8[32];
	foo (ref a);
}

Drop fatal assert on big-endian archs

void foo ([CCode (array_length_type = "gsize")] ref uint8[] a) {
}

void main () {
	uint8[] a = new uint8[32];
	foo (ref a);
}


/* browsable.vala
 *
 * Copyright (C) 2008  Florian Brosch
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
 *
 * Author:
 * 	Florian Brosch <flo.brosch@gmail.com>
 */

using Gee;

public interface Valadoc.Api.Browsable : Item {

	public abstract bool is_browsable (Settings settings);
}

Add API documentation for Browsable

/* browsable.vala
 *
 * Copyright (C) 2008  Florian Brosch
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
 *
 * Author:
 * 	Florian Brosch <flo.brosch@gmail.com>
 */

using Gee;

/**
 * Specifies whether users are able to browse the item.
 */
public interface Valadoc.Api.Browsable : Item {

	/**
	 * Specifies whether users are able to browse the item.
	 */
	public abstract bool is_browsable (Settings settings);
}


namespace Dockery.DockerSdk.Model {
    public enum ContainerStatus {
        CREATED,
        RESTARTING,
        RUNNING,
        PAUSED,
        EXITED;

        public static ContainerStatus[] all() {
            return {RUNNING, PAUSED, EXITED, CREATED, RESTARTING};
        }

        public static ContainerStatus[] actives() {
            return {RUNNING, PAUSED};
        }

        public static bool is_active(ContainerStatus status) {
            return status in ContainerStatus.actives();
        }
    }
}

Fix container status is_active static method call

namespace Dockery.DockerSdk.Model {
    public enum ContainerStatus {
        CREATED,
        RESTARTING,
        RUNNING,
        PAUSED,
        EXITED;

        public static ContainerStatus[] all() {
            return {RUNNING, PAUSED, EXITED, CREATED, RESTARTING};
        }

        public static ContainerStatus[] actives() {
            return {RUNNING, PAUSED};
        }

        public bool is_active(ContainerStatus status) {
            return status in ContainerStatus.actives();
        }
    }
}


/*
 * Copyright (C) 2008 Zeeshan Ali <zeenix@gmail.com>.
 *
 * Author: Zeeshan Ali <zeenix@gmail.com>
 *
 * This file is part of Rygel.
 *
 * Rygel is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * Rygel is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 */

using GUPnP;

/**
 * Represents a media object (container and item).
 */
public abstract class Rygel.MediaObject : GLib.Object {
    public string id;
    public string title;

    public unowned MediaContainer parent;
}

Allow owned refs to parent container

/*
 * Copyright (C) 2008 Zeeshan Ali <zeenix@gmail.com>.
 *
 * Author: Zeeshan Ali <zeenix@gmail.com>
 *
 * This file is part of Rygel.
 *
 * Rygel is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * Rygel is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 */

using GUPnP;

/**
 * Represents a media object (container and item).
 */
public abstract class Rygel.MediaObject : GLib.Object {
    public string id;
    public string title;

    // You can keep both a unowned and owned ref to parent of this MediaObject.
    // In most cases, one will only need to keep an unowned ref to avoid cyclic
    // references since usually parent container will keep refs to child items.
    // However in some cases, one only wants the parent to exist as long as the
    // child exists and it is in those cases, you will want to use 'parent_ref'.
    //
    // You must set 'parent' if you set 'parent_ref' but the opposite is not
    // mandatory.
    public unowned MediaContainer parent;
    public MediaContainer parent_ref;
}


interface IFoo {
	public abstract string foo { get; set; }
}

class Bar : IFoo {
	public string foo { get; set; }
}

class Foo : Bar {
	public string bar (string s) {
		base.foo = s;
		return base.foo;
	}
}

void main () {
	var foo = new Foo ();
	assert (foo is IFoo);
	assert (foo.bar ("foo") == "foo");
}

Extend "property base-access" interface test to increase coverage

struct Manam {
	public int i;
}

interface IFoo {
	public abstract string foo { get; set; }
	public abstract Manam manam { get; set; }
}

class Bar : IFoo {
	public string foo { get; set; }
	public Manam manam { get; set; }
}

class Foo : Bar {
	public string bar (string s) {
		base.foo = s;
		return base.foo;
	}

	public Manam baz (Manam m) {
		base.manam = m;
		return base.manam;
	}
}

void main () {
	var foo = new Foo ();
	assert (foo is IFoo);
	assert (foo.bar ("foo") == "foo");
	Manam manam = { 42 };
	assert (foo.baz (manam) == manam);
}


namespace Dockery.DockerSdk.Dto.Events {

    public abstract class Event : GLib.Object {

        public string event { get; construct set; }
        public abstract string event_type { get { return "Event";} }
        public string action { get; construct set; }
        public string scope { get; construct set; }
        public int64 timeNano { get; construct set; }

        public Event(string event, string action, string scope, int64 timeNano) {
            this.event = event;
            this.action = action;
            this.scope = scope;
            this.timeNano = timeNano;
        }

        public virtual string to_string() {
            return @"$event";
        }
    }
}

Fix compilation error with valac 0.42.2

namespace Dockery.DockerSdk.Dto.Events {

    public abstract class Event : GLib.Object {

        public string event { get; construct set; }
        public abstract string event_type  { get; }
        public string action { get; construct set; }
        public string scope { get; construct set; }
        public int64 timeNano { get; construct set; }

        public Event(string event, string action, string scope, int64 timeNano) {
            this.event = event;
            this.action = action;
            this.scope = scope;
            this.timeNano = timeNano;
        }

        public virtual string to_string() {
            return @"$event";
        }
    }
}


namespace Dockery.DockerSdk.Endpoint {

    /**
     * https://docs.docker.com/engine/reference/api/docker_remote_api_v1.21
     */
    public abstract class Endpoint {

        protected Client.Client client;

        protected Io.QueryStringBuilder filter_builder = new Io.QueryStringBuilder();

        public Endpoint(Client.Client client) {
            this.client = client;
        }

        /**
         * Throw error with the right message or do nothing if actual code == ok_status_code
         * If paylod is not empty, then the message is fetched from the response payload
         */
        protected void throw_error_from_status_code(
            int ok_status_code,
            Io.Response response,
            Gee.HashMap<int, string> map
        ) throws Io.RequestError {

            if (response.status != ok_status_code) {
                string? message = map.get(response.status);
                if (null != message) {
                    message = response.payload;
                }

                throw new Io.RequestError.FATAL(message);
            }
        }

        /**
         * Create and return a base HashMap of status code => messages, compatible with all container requests
         */
        protected Gee.HashMap<int, string> create_error_messages() {

            var error_messages = new Gee.HashMap<int, string>();
            error_messages.set(500, "Docker daemon fatal error");

            return error_messages;
        }
    }
}

Fix segfault when connecting to non-existing daemon

namespace Dockery.DockerSdk.Endpoint {

    /**
     * https://docs.docker.com/engine/reference/api/docker_remote_api_v1.21
     */
    public abstract class Endpoint {

        protected Client.Client client;

        protected Io.QueryStringBuilder filter_builder = new Io.QueryStringBuilder();

        public Endpoint(Client.Client client) {
            this.client = client;
        }

        protected void throw_error_from_status_code(
            int ok_status_code,
            Io.Response response,
            Gee.HashMap<int, string> map
        ) throws Io.RequestError {

            if (response.status != ok_status_code) {
                string? message = map.get(response.status);
                if (null == message) {
                    message = response.payload;
                }

                if (null == message && response.status < 100) {
                    message = "Unable to reach the service. Aborting.";
                }

                if (null == message) {
                    message = "Unkown error while requesting the docker deamon";
                }

                throw new Io.RequestError.FATAL(message);
            }
        }

        /**
         * Create and return a base HashMap of status code => messages, compatible with all container requests
         */
        protected Gee.HashMap<int, string> create_error_messages() {

            var error_messages = new Gee.HashMap<int, string>();
            error_messages.set(500, "Docker daemon fatal error");

            return error_messages;
        }
    }
}