::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:
class Type.Integer.Public  public Gilda:

type Integer.Type  in Byte, Parcel, Word, Cell

global Bit0    |= 1,                       &Only special bits are defined.
       Bit7    |= 2 ^ 7,                   &
       Bit15   |= 2 ^ 15,                  &
       Bit16   |= 2 ^ 16,                  &
       Bit31   |= 2 ^ 31,                  &
       Bit32   |= 2 ^ 32,                  &
       Bit47   |= 2 ^ 47,                  &
       Bit48   |= 2 ^ 48,                  &
       Bit62   |= 2 ^ 62,                  &
       Bit63   |= 2 ^ 63,                  &

       Byte0   |=                  #FF,    &Select a byte.
       Byte1   |=                #FF00,    &
       Byte2   |=             #FF_0000,    &
       Byte3   |=           #FF00_0000,    &
       Byte4   |=        #FF_0000_0000,    &
       Byte5   |=      #FF00_0000_0000,    &
       Byte6   |=   #FF_0000_0000_0000,    &
       Byte7   |= #FF00_0000_0000_0000,    &

       Parcel0 |=                #FFFF,    &Select a parcel.
       Parcel1 |=           #FFFF_0000,    &
       Parcel2 |=      #FFFF_0000_0000,    &
       Parcel3 |= #FFFF_0000_0000_0000,    &

       At.Bound     |= -Span( @ ),         &Select used reference bits.
       Parcel.Bound |= -2,                 &
       Word.Bound   |= -4,                 &
       Cell.Bound   |= -8
:
:...............................................................................



:::::::::::::::::::::::::::::: Integer.Endian  :::::::::::::::::::::::::::::::::
:
method ENDIAN..cell  pure:  Reverse the byte order of a Cell.

change Integer  cell       :Integer to reorder.
:
:...............................................................................
:
method ENDIAN..word  pure:  Reverse the byte order of a Word.

change Integer  word       :Integer to reorder.
:
:...............................................................................
:
method ENDIAN..parcel  pure:  Reverse the byte order of a Parcel.

change Integer  parcel       :Integer to reorder.
:
:...............................................................................



::::::::::::::::::::::::::::  Integer.Input(*)  ::::::::::::::::::::::::::::::::
:
function IS.GILDA.INTEGER:  See if a literal is a Gilda integer.

 entry Literal     string,         &Potentially an ASCII integer value.
       Signed = 0  Bit             :Set to allow a leading sign.

  exit Valid       Bit             :Set if a valid Gilda integer.
:
:...............................................................................



:::::::::::::::::::::::::::  Integer.Input(cell)  ::::::::::::::::::::::::::::::
:
method INTEGER.GILDA..cell:  Parse a signed decimal into an integer value.

  exit Integer    cell

 entry Input      string       : In - Index to the first digit.
                               :Out - Index past the last digit.

change Index = 0  word         : In - Index to the first digit.
                               :      <= 0 if input is only a number.
                               :Out - Index past the last digit.
:
:...............................................................................
:
method INTEGER.JAVA..cell:  Parse a Java decimal into a signed integer value.

  exit Integer    cell         :Binary result

 entry Input      string       : In - Index to the first digit
                               :Out - Index past the last digit

change Index = 0  word         : In - Index to the first digit
                               :      <= 0 if input is only a number
                               :Out - Index past the last digit
:
:  Hex     = {'0x' | '0X'}  {'0'..'9' | 'A'..'F' | 'a'..'f'}+
:  Octal   = '0'  {'0'..'7'}*
:  Decimal = ['+' | '-'] {'0'..'9'}*
:...............................................................................
:
method INTEGER.DECIMAL..cell:  Parse a signed decimal into an integer value.

  exit Integer    cell         :Binary result

 entry Input      string       : In - Index to the first digit
                               :Out - Index past the last digit

change Index = 0  word         : In - Index to the first digit.
                               :      <= 0 if input is only a number
                               :Out - Index past the last digit
:
:  {'+' | '-'}  decimal {decimal | '_'}*
:...............................................................................

method INTEGER.BINARY..cell:  Parse an unsigned binary constant into an integer value.

  exit Integer     cell

 entry Input       string

change Index = 0   word         : In - Index to the first digit.
                                :      <= 0 if input is only a number.
                                :Out - Index past the last digit.
:...............................................................................
:
method INTEGER.HEXADECIMAL..cell:  Parse hex digits into an integer value.

  exit Integer    cell

 entry Input      string       : In - Index to the first digit.
                               :Out - Index past the last digit.

change Index = 0  word         : In - Index to the first digit.
                               :      <= 0 if input is only a number.
                               :Out - Index past the last digit.
:...............................................................................
:
method INTEGER.OCTAL..cell:  Parse an unsigned octal constant into an integer value.

  exit Integer     cell

 entry Input       string

change Index = 0   word         : In - Index to the first digit.
                                :      <= 0 if input is only a number.
                                :Out - Index past the last digit.
:...............................................................................
:
function FORM.RADIX..cell:  Convert an integer to a text representation in a base.

 entry Integer    cell,        &Unsigned integer to convert.
       Radix      byte

  exit Form       string       :Formatted result (lowercase letters).
:...............................................................................



::::::::::::::::::::::::::::  Integer.Input(word)  :::::::::::::::::::::::::::::
:
method INTEGER.GILDA..word:  Parse a signed decimal into an integer value.

  exit Integer    word

 entry Input      string       : In - Index to the first digit.
                               :Out - Index past the last digit.

change Index = 0  word         : In - Index to the first digit.
                               :      <= 0 if input is only a number.
                               :Out - Index past the last digit.
:
:...............................................................................
:
method INTEGER.JAVA..word:  Parse a Java decimal into a signed integer value.

  exit Integer    word         :Binary result.

 entry Input      string       : In - Index to the first digit.
                               :Out - Index past the last digit.

change Index = 0  word         : In - Index to the first digit.
                               :      <= 0 if input is only a number.
                               :Out - Index past the last digit.
:
:  Hex     = {'0x' | '0X'}  {'0'..'9' | 'A'..'F' | 'a'..'f'}+
:  Octal   = '0'  {'0'..'7'}*
:  Decimal = ['+' | '-'] {'0'..'9'}*
:...............................................................................
:
method INTEGER.BINARY..word:  Parse an unsigned binary constant into an integer value.

  exit Integer     word

 entry Input       string

change Index = 0   word         : In - Index to the first digit.
                                :      <= 0 if input is only a number.
                                :Out - Index past the last digit.
:...............................................................................
:
method INTEGER.DECIMAL..word:  Parse a signed decimal into an integer value.

  exit Integer    word

 entry Input      string       : In - Index to the first digit.
                               :Out - Index past the last digit.

change Index = 0  word         : In - Index to the first digit.
                               :      <= 0 if input is only a number.
                               :Out - Index past the last digit.
:
:  {'+' | '-'}  decimal {decimal | '_'}*
:...............................................................................
:
method INTEGER.HEXADECIMAL..word:  Parse hex digits into an integer value.

  exit Integer    word

 entry Input      string       : In - Index to the first digit.
                               :Out - Index past the last digit.

change Index = 0  word         : In - Index to the first digit.
                               :      <= 0 if input is only a number.
                               :Out - Index past the last digit.
:...............................................................................
:
method INTEGER.OCTAL..word:  Parse an unsigned octal constant into an integer value.

  exit Integer     word

 entry Input       string

change Index = 0   word         : In - Index to the first digit.
                                :      <= 0 if input is only a number.
                                :Out - Index past the last digit.
:...............................................................................
:
function FORM.RADIX..word:  Convert an integer to a text representation in a base.

 entry Integer    word,        &Unsigned integer to convert.
       Radix      byte

  exit Form       string       :Formatted result (lowercase letters).
:...............................................................................



::::::::::::::::::::::::::  Integer.Input(parcel)  :::::::::::::::::::::::::::::
:
method INTEGER.GILDA..parcel:  Parse a signed decimal into an integer value.

  exit Integer    parcel

 entry Input      string       : In - Index to the first digit.
                               :Out - Index past the last digit.

change Index = 0  word         : In - Index to the first digit.
                               :      <= 0 if input is only a number.
                               :Out - Index past the last digit.
:
:...............................................................................
:
method INTEGER.JAVA..parcel:  Parse a Java decimal into a signed integer value.

  exit Integer    parcel     :Binary result.

 entry Input      string       : In - Index to the first digit.
                               :Out - Index past the last digit.

change Index = 0  word         : In - Index to the first digit.
                               :      <= 0 if input is only a number.
                               :Out - Index past the last digit.
:
:  Hex     = {'0x' | '0X'}  {'0'..'9' | 'A'..'F' | 'a'..'f'}+
:  Octal   = '0'  {'0'..'7'}*
:  Decimal = ['+' | '-'] {'0'..'9'}*
:...............................................................................
:
method INTEGER.BINARY..parcel:  Parse an unsigned binary constant into an integer value.

  exit Integer     parcel

 entry Input       string

change Index = 0   word         : In - Index to the first digit.
                                :      <= 0 if input is only a number.
                                :Out - Index past the last digit.
:...............................................................................
:
method INTEGER.DECIMAL..parcel:  Parse a signed decimal into an integer value.

  exit Integer    parcel

 entry Input      string       :Integer to convert.

change Index = 0  word         : In - Index to the first digit.
                               :      <= 0 if input is only a number.
                               :Out - Index past the last digit.
:
:  {'+' | '-'}  decimal {decimal | '_'}*
:...............................................................................
:
method INTEGER.HEXADECIMAL..parcel:  Parse hex digits into an integer value.

  exit Integer    parcel

 entry Input      string       : In - Index to the first digit.
                               :Out - Index past the last digit.

change Index = 0  word         : In - Index to the first digit.
                               :      <= 0 if input is only a number.
                               :Out - Index past the last digit.
:...............................................................................
:
method INTEGER.OCTAL..parcel:  Parse an unsigned octal constant into an integer value.

  exit Integer     parcel

 entry Input       string

change Index = 0   word         : In - Index to the first digit.
                                :      <= 0 if input is only a number.
                                :Out - Index past the last digit.
:...............................................................................
:
function FORM.RADIX..parcel:  Convert an integer to a text representation in a base.

 entry Integer    parcel,      &Unsigned integer to convert.
       Radix      byte

  exit Form       string       :Formatted result (lowercase letters).
:...............................................................................



::::::::::::::::::::::::::  Integer.Input(byte)  :::::::::::::::::::::::::::::::
:
method INTEGER.GILDA..byte:  Parse a signed decimal into an integer value.

  exit Integer    byte

 entry Input      string       : In - Index to the first digit.
                               :Out - Index past the last digit.

change Index = 0  word         : In - Index to the first digit.
                               :      <= 0 if input is only a number.
                               :Out - Index past the last digit.
:
:...............................................................................
:
method INTEGER.JAVA..byte:  Parse a Java decimal into a signed integer value.

  exit Integer    byte     :Binary result.

 entry Input      string       : In - Index to the first digit.
                               :Out - Index past the last digit.

change Index = 0  word         : In - Index to the first digit.
                               :      <= 0 if input is only a number.
                               :Out - Index past the last digit.
:
:  Hex     = {'0x' | '0X'}  {'0'..'9' | 'A'..'F' | 'a'..'f'}+
:  Octal   = '0'  {'0'..'7'}*
:  Decimal = ['+' | '-'] {'0'..'9'}*
:...............................................................................
:
method INTEGER.BINARY..byte:  Parse an unsigned binary constant into an integer value.

  exit Integer     byte

 entry Input       string

change Index = 0   word         : In - Index to the first digit.
                                :      <= 0 if input is only a number.
                                :Out - Index past the last digit.
:...............................................................................
:
method INTEGER.DECIMAL..byte:  Parse a signed decimal into an integer value.

  exit Integer    byte

 entry Input      string       : In - Index to the first digit.
                               :Out - Index past the last digit.

change Index = 0  word         : In - Index to the first digit.
                               :      <= 0 if input is only a number.
                               :Out - Index past the last digit.
:
:  {'+' | '-'}  decimal {decimal | '_'}*
:...............................................................................
::
method INTEGER.HEXADECIMAL..byte:  Parse hex digits into an integer value.

  exit Integer    byte

 entry Input      string       : In - Index to the first digit.
                               :Out - Index past the last digit.

change Index = 0  word         : In - Index to the first digit.
                               :      <= 0 if input is only a number.
                               :Out - Index past the last digit.
:...............................................................................
:
method INTEGER.OCTAL..byte:  Parse an unsigned octal constant into an integer value.

  exit Integer     byte

 entry Input       string

change Index = 0   word         : In - Index to the first digit.
                                :      <= 0 if input is only a number.
                                :Out - Index past the last digit.
:...............................................................................
:
function FORM.RADIX..byte:  Convert an integer to a text representation in a base.

 entry Integer    byte,        &Unsigned integer to convert.
       Radix      byte

  exit Form       string       :Formatted result (lowercase letters).
:...............................................................................


end