#35 $Q/$QS and subscripts with Cntl Chars

open
nobody
None
5
2012-12-29
2002-09-29
No

I have noted some odd behaviour in $Q,$QS, and $QL if
subscripts with control characters are encountered.
It appears that $Q converts the control codes to
display values embedded within a $C( ). Then the $QS
and $QL functions fail completely when executed against
one of these values returned by $Q. It should be noted
that $O works fine with these values.

Examples

GTM> K ^X

GTM> S A=$C(3)_"ABC"_$C(10)

GTM> S ^X(A)=""

GTM> S B="^X"

GTM> W $Q(@B)

^X($C(3)_"ABC"_$C(10))

GTM> S S=$Q(@B)

GTM> W $QS(S,1)
%GTM-E-NOCANONICNAME, Value is not a canonic name
(^X($C(3)_"ABC"_$C(10)))

This error also occurs with $QL

Discussion

  • Malleswara Rao P

    Logged In: YES
    user_id=220075

    Hi Kevin,
    Thank you for providing the reproducible test case. We
    would like you to know that we are looking into this
    issue. We'll update you soon once we have an
    explanation.

    Thanks
    -malli

     
  • Malleswara Rao P

    Logged In: YES
    user_id=220075

    Kevin,
    Apologies for the delay. We have identified that if control
    characters are involved in subscripts, $QLength and
    $QSubscript do not recognize them in the format
    returned by $QUERY. The reason being that $QL/$QS can
    only accept a canonical name. The standard (Section
    7.1.4.12) names it as _namevalue_ which has the syntax
    of _glvn_ with restrictions - no nakeds, subscripts are
    literals etc. Given that $QUERY returns a "readable"
    output, these functions will need to be enhanced to
    recognize $C format as well to allow indirect arguments.
    We will fix this issue in an upcoming release. Meanwhile,
    if you are interested to dig in further, below are the
    relevant modules:
    is_canonnical_name.c
    f_qlength.c
    f_qsubscript.c
    op_fnqlength.c
    op_fnqsubscript.c

    Thanks for reporting good test.
    -malli

     
  • Kevin Kirkwood

    Kevin Kirkwood - 2002-10-02

    Logged In: YES
    user_id=431794

    Thanks for your speedy response. I think what is needed here
    is a modification to $Q rather than $QL and $QS other
    versions of M merely send back the subscripts with only
    quotes around them if non numeric. In this way statements
    like .
    S S="^X"
    S X=$Q(@S)
    W @X

    will always work. The write @X will not work with the
    Embedded $C( ) syntax as it stands.

     
  • Malleswara Rao P

    Logged In: YES
    user_id=220075

    The visible presentation of control characters is an
    important element in productivity and quality, which the
    standard tries (with limited success) to deal with (.e.g. by
    limiting strlit to graphics). Just because other
    implementations are developer hostile, is no need for us
    to follow.

    We don't see any problem with 'write' with embedded $C.
    For example, the following code snippet illustrates
    that 'write @y' shows standard behavior.

    GTM>s x=$c(10,65,10),x(x)=1,y=$q(x) w !,y,!,@y

    x($C(10)_"A"_$C(10))
    1
    GTM>

    thanks
    -malli

     
  • Douglas A. Ruisaard

    Logged In: YES
    user_id=622242

    I totally disagree with the rationale for using $C() to display
    embedded control characters within nodes.

    I believe it to be quite RARE that the content of a node,
    particularly one which contains control characters (for
    whatever reason that may be... eg MIIS to MUMPS
    conversion) is intended to be "viewed" with a WRITE
    statement. Rather, the very essence of $QS and $QL is to
    manipulate the CONTENT of global NODES. With embedded $C
    (), can someone tell me how I can re-convert them back to
    the valid control characters the appilcation is undoubtedly
    expecting? ... without going thru a considerable amount of
    manipulation of the returned node value.

    Calling the lack of being able to "see" control characters with
    a simple WRITE is so **NOT** hostile seeing how it is so
    simple to modify any global display utility to display the control
    characters in any fashion desired... who says I want them as
    $C()... I rather have them flashing VT sysmbols like f/f so
    they'll really stand out... and they do in the Global display
    function I wrote...the one which discovered this issue in the
    first place.

    douglas ruisaard
    Trilogy Software

     
  • Kevin Kirkwood

    Kevin Kirkwood - 2002-10-03

    Logged In: YES
    user_id=431794

    I guess addition of a new view parameter to alter the behavior
    would be a good compromise. I have a few applications that
    do pick out subscripts from $Q and it would be nice if there
    was a view command to make porting these applications
    easier.

    Kevin

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks