Skip to content

Instantly share code, notes, and snippets.

@MarkGoldberg
Last active February 12, 2019 15:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MarkGoldberg/9252788 to your computer and use it in GitHub Desktop.
Save MarkGoldberg/9252788 to your computer and use it in GitHub Desktop.
Clarion - Proposed Picture Notation for Hex,Octal and Binary
It would be great to extend the picture notations to Support Hex, Binary and Octal Notations.
Ideally these new pictures would be available for use in the RTL and Topscan
The following specification is intended to match the current Language Reference for @N pictures
-----------------------------------------------------------------------------------------------
@[B|b|O|o|H|h] [currency] [sign] [fill] size [grouping] [places] [sign] [currency] [B]
Base
@[N|n] = Decimal - status quo, will not alter (see existing doc for @N)
@[B|b] = Binary
@[O|o] = Octal (somewhat confusing with Zero)
@H = Hex (UpperCase digits, ABCDEF)
@h = Hex (LowerCase digits, abcdef)
Currency - same as @N notations
Can be used as an Indicator of the base
None - @H8
Leading - @H~0x~8
Trailing Upper - @H8~H~
Trailing Lower - @H8~h~
Sign - Only applies to @N
Fill - same as @N notations
Size - same as @N notations
Grouping
for decimal there are:
None produce commas
. (period) produce periods
_ (underscore) produce spaces
: (colon) produce colons
- (minus) produce dashes (requested, but worried about confusion with negative values)
All of the decimal pictures group on 3 Digits
(see notes in [places] below using places for grouping)
Add an explicit comma
, (comma) produce commas (needed for places as grouping control)
Places
Since the Binary/Octal/Hex values would be considered integers
we can co-opt this value to control how many digits to group on.
(the Default Digits might vary by base (to be determined))
So, for a value that would show in hex as: [89ABCDEF]
@H9_4 => 89AB CDEF
@H11_2 => 89 AB CD EF
@H8_0 => 89ABCDEF override default grouping
@H11 => 89,AB,CD,EF !default number of digits (whatever is decided, shown here as 2)
@H11_ => 89 AB CD EF !default number of digits (whatever is decided, shown here as 2)
@H11. => 89.AB.CD.EF !a bit strange - should be reviewed
@H11: => 89:AB:CD:EF
@H9,4 => 89AB,CDEF !explicit comma grouping symbol
NOTE: At first I wrote all of those (above) @H8 something,
but it was pointed out that the grouping chars add to the number of digits
Trailing B - Blank When Zero - same as @N notations
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment