Prototype Queue or Group

Tags: #<Tag:0x00007f68895599e0>

Hi,
I am creating a dll with a procedure to make an impression. My question is how can I send a group or a queue as a parameter.

Thank you so much

Generic queues and groups:

myproc1 procedure(queue q)
myproc2 procedure(*queue q)
myproc3 procedure(group g)
myproc4 procedure(*group g)

Typed queues and groups:

GrpType group, type
f1 long
  end

myproc5 procedure(GrpType g)

See Clarion help.

2 Likes

THANKS YOU,
I will try soon

Note, groups and queues are always passed by address
You can use CONST if you want compiler warnings if you alter the group or queue buffer
Otherwise, I think it’s clearer to explicitly add the * (for by address) as in *group

Note, if you wish to only pass a queue buffer, vs. the entire queue
I find it cleanest to define the queue as follows.

gtYada    GROUP,TYPE
SomeField   LONG
Another     LONG
!etc.
          END

qtYada    QUEUE(gtYada),TYPE
          END

then you can write

 ProccessBuffer PROCEDURE( *gtYada Buffer )
 ProcessQ       PROCEDURE( *qtYada Q )

Say you have

Q   &qtYada
    CODE 
    Q &= NEW qtYada
    DO FillQ
    ProcessBuffer( Q ) !<-- notice I'm passing Q as a gtYada (a group)
    ProcessQ( Q )      !<-- notice I'm passing Q as a qtYada (a queue)
2 Likes

Hi Mark - You can also create a &GROUP reference to a queue. I have done this. @Mike_Duglas also does that in his cJSON class. https://github.com/mikeduglas/cJSON/blob/master/libsrc/cjson.clw. Look at json::CreateArray PROCEDURE(*QUEUE que, BOOL pNamesInLowerCase = TRUE, <STRING options>)