Feature Request:ItemizeSquared - or is that too lazy?

We have Itemize which does an equate list with sequential numbers and we can jump the number mid list with equate(jump number), but there doesnt seem to be a way to easily create a list of sequential numbers to the power of 2 or squared for long unique bitmasks.

Or is that too lazy?

Sometimes I think you’re using a random question generator.


Why do you say that?

Hi Richard,
Personally I prefer explicit equates.
For bit like equates, expressing them in hex seems clean and readable.


BUTTON:OK               EQUATE (01H)
BUTTON:YES              EQUATE (02H)
BUTTON:NO               EQUATE (04H)
BUTTON:ABORT            EQUATE (08H)
BUTTON:RETRY            EQUATE (10H)
BUTTON:HELP             EQUATE (80H)

alternatevely they can be written as

BUTTON:OK               EQUATE (00000001b)
BUTTON:YES              EQUATE (00000010b)
BUTTON:NO               EQUATE (00000100b)
BUTTON:ABORT            EQUATE (00001000b)
BUTTON:RETRY            EQUATE (00010000b)
BUTTON:IGNORE           EQUATE (00100000b)
BUTTON:CANCEL           EQUATE (01000000b)
BUTTON:HELP             EQUATE (10000000b)

I did request a BINARY attribute for ITEMIZE around 20 years ago to do just that. I think I might have called it BITWISE.

Well searching for BITWISE on here takes me to
Unfinished text with some information about the TopSpeed assembler - ide / docs - ClarionHub
Topspeed assembler - ide / docs - ClarionHub
which is handy.

I think its another template I’m going to have to build because that way it can meet the requirements where people like Federico want to see them written out explicitly and I understand those reasons.

For me, I’ve seen websites with incorrect values for use with MS api’s for when people dont have VS or SDK kits which makes me wonder if there is an attack vector in the making. So the template would/should eliminate that potential attack vector and the templates are high up on the reasons why we use Clarion, because the templates help to remove human errors.

…or maybe a 24/7 stream of consciousness question submission program.

Sleep is a luxury when one is poor.
Another way to put this is, if I dont ask questions, in a bid to educate myself, I will continue to be exploited and exploitation starts with those teaching lessons.

Keep on rocking, Richard. I think you’re doing great.

Just use the column-wise editing ability of your program editor. Keep a file handy that has just the binary sequence of numbers and then do a column copy and paste from that into your program editor, after you have made the list of equate labels. Then use column editing to insert the “EQUATE(” and “)”. “ITEMIZE” may have sounded like a cool thing in the beginning, but with today’s program editing tools, I think “ITEMIZE” is a terrible idea.

You can do some math to set the values of equates and itemized values, although it’s restricted to multiplication and addition:


E:One                         EQUATE(1)
E:Double                      EQUATE(E:One*2)
E:Triple                      EQUATE(E:One*3)
E:PlusOne                     EQUATE(E:Triple+1)

One                             EQUATE(1)
Double                          EQUATE(I:One*2)
Triple                          EQUATE(I:One*3)
PlusOne                         EQUATE(I:Triple+1)


  MESSAGE(E:One &'|'& E:Double &'|'& E:Triple &'|'& E:PlusOne, 'Equate')
  MESSAGE(I:One &'|'& I:Double &'|'& I:Triple &'|'& I:PlusOne, 'Itemize')

My DateTime.equ includes this technique:


TIME:Tick                     EQUATE(  1              )
  OMIT('!END-OMIT', TIME:Second=100)
TIME:Second                   EQUATE(100 * TIME:Tick  )
TIME:Minute                   EQUATE( 60 * TIME:Second)
TIME:Hour                     EQUATE( 60 * TIME:Minute)
TIME:Day                      EQUATE( 24 * TIME:Hour  )
  !END-OMIT('END-OMIT', TIME:Second=100)
TIME:Week                     EQUATE(  7 * TIME:Day   )

TIME:Midnight                 EQUATE(1)
TIME:NoTime                   EQUATE(0)
TIME:Error                    EQUATE(-1)

TIME:Noon                     EQUATE(TIME:Midnight + 12*TIME:Hour)

I don’t recommend using a prefix on an Itemize’d equate. Because the declaration then won’t show up when you do a source search. In other words searching for
will show you everywhere it is used, but not where it is declared.

I had a programmer do it this way in some of our libraries, and it made it very difficult to debug the code.


Can you please elaborate on why you hold this opinion, as well as what editing tools you have in mind, and how they play into ITEMIZE

What is made difficult by use of ITEMIZE,PRE(I ) ?
The only thing I can think of is you were searching for the values associated with one of the equates. For example searching for the value of I:PlusOne from BoxSoft’s (Mikes) example above.

So when, your KSS search for I:PlusOne - filtered to declaration rows fails
You search again for PlusOne - easy peasy - same process when search for anything in clarion that might have a prefix (Files, Groups, Queues )

The real question is WHY you’d want to know the value of the ITEMIZE
My guess is you’re showing the value in a debugging statement.
So instead of showing the value, why not show a string interpretation

I just call the ToDescription( LONG xCode ),STRING method from the Enumeration class that I create for each ITEMIZE.

for example:

ctEnumRepeatSpacing     CLASS(ctEnumBase),TYPE,MODULE('ctEnumHelpers.clw'),LINK('ctEnumHelpers.clw',_ABCLinkMode_),DLL(_ABCDllMode_)
ToDescription               PROCEDURE(LONG   xCode       ,BYTE BlankOnError=FALSE),STRING,DERIVED
ToCode                      PROCEDURE(STRING xDescription),STRING,DERIVED !From Description to Code
PropFrom                    PROCEDURE(LONG   xFlag=0     ),STRING,DERIVED

The PropFrom is used to for ?SomeList{PROP:From} = oEnumRepeatSpacing.PropFrom()

In truth since these classes have no properties, I should remove the ,TYPE and just call them as static classes.

1 Like

In my experience, a search for declaration is not so much to know the value, but to know what other possible equates there are in that itemize structure. The value is important too though.


And we all know how much of a failure enums are. :slight_smile:

You also want to be able to find the definition to add new equates to the list.

1 Like

Well Mark, if you’ve got a whole class wrapper dealing with your equates and you have a way to know what a particular value means when you place it into a DEBUG statement or see it in a TPS file then I see you might not need to have explicit equates.

Mark there is a YouTube video that someone did to show column-wise editing. I’m not sure if she demonstrates block mode copy paste, but it is like using the multiple cursors - you can make a whole lot of similar lines of code in little time at all. YouTube video Block Mode / Column Editing Mode

Rich I still don’t see the connection to itemize and yes I do make Extensive use of multiple cursors on a daily basis.

Didnt know that could be done, thats kind of handy to know. Shame an example is not in the help docs.