iangilham.com

By | | tags: code mheg-5 interactive-tv

Note: All code examples in this post are licensed under a BSD style license.

There are a few players in interactive television in the UK, each using different technology to build interactive experiences. Freeview and Freesat both use profiles of MHEG-5 as the programming language and runtime environment. MHEG-5 is a fairly unusual language in that it uses an event-based programming model, with all state declared outside the scope of the events.

As far as programming languages go, MHEG-5 makes a developer’s life difficult. There are no symbolic names so we have to refer to everything by an integer object ID. There are no data structures, so arrays have to be implemented manually by iterating on the object IDs and being very careful about where to stop. Links, the functional blocks of imperative code, can fire asynchronously and have no local state so care must be taken to avoid race conditions. There are only a few basic library calls, referred to as “resident programs”, which enable basic string manipulation and limited interac...

By | | tags: code mpeg

Note: All code examples in this post are licensed under the GPL version 2 (or later). My code is a derivative work of OpenCaster.

Playing out MPEG transport streams is a fairly complex affair. At the office, we have our o...

By | | tags: code spring

A few weeks ago I had a go at implementing a familiar kind of application using some new tools. The basic structure should be well known to most developers:

This basic structure pervades the software industry and naturally, there is a vast swathe of reinvented wheels for managing the control flow, often multiple implementations in the same company.

I was building a new application with this structure in Java to consolidate a process that used two similar applications down to just one, reducing complexity along the way. The existing apps implement file system polling for input and FTP and SOAP calls for output. As I was doing exploratory wor...

By | | tags: software bugs cplusplus

I’ve written before about the compiler bug in managed C++ 7.1. From the information I had available, it looked like the compiler warning was merely a false-positive. Unfortunately, it looks like the problem goes deeper than that.

Consider this test application:

// Managed C++ legacy syntax for .Net 1.0

#include "stdafx.h"

#using <mscorlib.dll>

using namespace System;
using namespace System::Collections;

// commented the FlagsAttribute to simplify printout
//[FlagsAttribute]
__value enum MyEnum : Int64 {
    None = 0,
    Flag0 = 1i64 << 0,
    Flag1 = 1i64 << 1,
    Flag2 = 1i64 << 2,
    Flag3 = 1i64 << 3,
    Flag4 = 1i64 << 4,
    Flag5 = 1i64 << 5,
    Flag6 = 1i64 << 6,
    Flag7 = 1i64 << 7,
    Flag8 = 1i64 << 8,
    Flag9 = 1i64 << 9,
    Flag10 = 1i64 << 10,
    Flag11 = 1i64 << 11,
    Flag12 = 1i64 << 12,
    Flag13 = 1i64 << 13,
    Flag14 = 1i64 << 14,
    Flag15 = 1i64 << 15,
    Flag16 = 1i64 << 16,
    Flag17 = 1i64 << 17,
    Flag18 = 1i64 << 18,
    Flag19 = 1i64 << 19,
    Flag20 = 1i64 << 20,
    Flag21 = 1i64 << 21,
    Flag22 = 1i64 << 22,
    Flag23 = 1i64 << 23,
    Flag24 = 1i64 << 24,
    Flag25 = 1i64 << 25,
    Flag26 = 1i64 << 26,
    Flag27 = 1i64 << 27,
    Flag28 = 1i64 << 28,
    Flag29 = 1i64 << 29,
    Flag30 = 1i64 << 30,
    Flag31 = 1i64 << 31,
    Flag32 = 1i64 << 32,
    Flag33 = 1i64 << 33,
    Flag34 = 1i64 << 34,
    Flag35 = 1i64 << 35,
    Flag36 = 1i64 << 36,
    Flag37 = 1i64 << 37,
    Flag38 = 1i64 << 38,
    Flag39 = 1i64 << 39,
    Flag40 = 1i64 << 40,
    Flag41 = 1i64 << 41,
    Flag42 = 1i64 << 42,
    Flag43 = 1i64 << 43,
    Flag44 = 1i64 << 44,
    Flag45 = 1i64 << 45,
    Flag46 = 1i64 << 46,
    Flag47 = 1i64 << 47,
    Flag48 = 1i64 << 48,
    Flag49 = 1i64 << 49,
    Flag50 = 1i64 << 50,
    Flag51 = 1i64 << 51,
    Flag52 = 1i64 << 52,
    Flag53 = 1i64 << 53,
    Flag54 = 1i64 << 54,
    Flag55 = 1i64 << 55,
    Flag56 = 1i64 << 56,
    Flag57 = 1i64 << 57,
    Flag58 = 1i64 << 58,
    Flag59 = 1i64 << 59,
    Flag60 = 1i64 << 60,
    Flag61 = 1i64 << 61,
    Flag62 = 1i64 << 62,
    Flag63 = 1i64 << 63,
    All = Int64::MaxValue
};

int _tmain()
{
    Console::WriteLine(S"Testing enum range");
    Array* values = Enum::GetValues(__typeof(MyEnum));
    for(Int32 i = 0; ...