Newton Formats errata

Newton Formats, the document which describes, among other things, the Newton OS package format and provides a specification for a de facto standard NewtonScript virtual machine, contains a few errors. Here I provide corrections to them.

Page 1-11

The lowest 4 bits of a character Ref are 0110, not 1010. If they were 1010, $\u0001 (0x16) would be indistinguishable from true (0x1A).

Page 1-15

The C code for the symbol hash function has a bug; it loops forever. It also assumes that long is 32-bit (which the document acknowledges). Here is a simpler, correct, and more portable version (requires ctype.h and stdint.h):

uint32_t SymbolHash (char* Name)
{
  uint32_t Result = 0;

  while(*Name)
    Result += toupper(*Name++);

  return Result * 2654435769U;
}

Page 2-15

The descriptions of the send and send-if-defined instructions say that name comes before receiver; it is actually the opposite.

Page 2-16

The descripton of the resend-if-defined instruction does not specify the state of the stack before and after the instruction is executed. The state is the same as for the resend instruction.

Page 2-21

The description of the divide instruction says:

If num2 is the integer zero, the exception |evt.ex.div0| is thrown.

Apple's implementation ignores this rule and instead converts num2 to a real. This causes num1 to be converted to a real too, giving the result of positive or negative infinity.

NSM currently does the same.

Page 4-6

In the NewtonScript code that generates the frame x, the slot named right should be named uchar instead.


First published on .
Last updated on .

Table of contents

Contact me