ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: "Rudd, Kevin" <kevin@lps.umd.edu>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Cc: "Rudd, Kevin" <kevin@lps.umd.edu>
Subject: MP keyword function: string parameters no longer accept string variables directly
Date: Wed, 21 Jul 2021 16:51:53 +0000	[thread overview]
Message-ID: <0604A082-3947-4F0A-B31D-BB72F96F4C37@lps.umd.edu> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 2652 bytes --]

Hi---

Here's another apparent change on the MP side---for keyword functions, string parameters no longer accept string variables directly. They do seem to register them (hasparameter => true) but don't capture the value (getparameter => 0). Thus:

system          > ConTeXt  ver: 2021.07.16 22:03 LMTX  fmt: 2021.7.21  int: english/english

metapost        > trace > This is MPLIB for LuaMetaTeX, version 3.11, running in scaled mode.
metapost        > trace >
metapost        > trace > loading metafun for lmtx, including the plain 1.004 base definitions
metapost        > trace >
metapost        > trace > >> "string constant fuschia ..."
metapost        > trace > >> true
metapost        > trace > >> "fuschia"
metapost        > trace > >> "string variable fuschia = fuschia ..."
metapost        > trace > >> true
metapost        > trace > >> 0
metapost        > trace > >> "expression containing string variable fuschia = fuschia ..."
metapost        > trace > >> true
metapost        > trace > >> "fuschia"

String constant: succeeds
String variable: fails
String expression with string variable: succeeds

Here's the MWE:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% system          > ConTeXt  ver: 2021.07.16 22:03 LMTX  fmt: 2021.7.21  int: english/english

\startMPdefinitions

    presetparameters "parameters_Test"
    [
    ]

    def Test =
        applyparameters "parameters_Test" "do_Test"
    enddef;

    def do_Test =
        pushparameters "parameters_Test";
        show hasparameter "color";
        show getparameter "color";
    enddef;

\stopMPdefinitions

\starttext

hello

\startalignment[center]
    \startplacefigure
        \startMPcode
            string fuschia; fuschia = "fuschia";

            show "string constant fuschia ...";
            Test [ color = "fuschia" ];

            show "string variable fuschia = " & fuschia & " ...";
            Test [ color =  fuschia  ];

            show "expression containing string variable fuschia = " & fuschia & " ...";
            Test [ color =  "" & fuschia  ];

        \stopMPcode
    \stopplacefigure
\stopalignment

goodbye

\stoptext

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


Kevin W. Rudd, Ph.D.
CAPT, USN (Ret)

Computer Architecture & Computer Engineering
Advanced Computing Systems (ACS) Research Program
Laboratory for Physical Sciences (LPS)

443-654-7878
kevin@lps.umd.edu<mailto:kevin@lps.umd.edu>

Visiting Research Professor
United States Naval Academy

rudd@usna.edu<mailto:rudd@usna.edu>



[-- Attachment #1.2: Type: text/html, Size: 7774 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

             reply	other threads:[~2021-07-21 16:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-21 16:51 Rudd, Kevin [this message]
2021-07-21 17:38 ` Hans Hagen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0604A082-3947-4F0A-B31D-BB72F96F4C37@lps.umd.edu \
    --to=kevin@lps.umd.edu \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).